]> scripts.mit.edu Git - autoinstalls/wordpress.git/commitdiff
Wordpress 2.6.2-scripts wordpress-2.6.2-scripts
authorEdward Z. Yang <ezyang@mit.edu>
Sat, 21 Nov 2009 01:20:25 +0000 (20:20 -0500)
committerEdward Z. Yang <ezyang@mit.edu>
Sat, 21 Nov 2009 01:42:28 +0000 (20:42 -0500)
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
291 files changed:
index.php
readme.html
wp-admin/admin-ajax.php
wp-admin/admin-header.php
wp-admin/admin-post.php [new file with mode: 0644]
wp-admin/admin.php
wp-admin/async-upload.php
wp-admin/bookmarklet.php [deleted file]
wp-admin/categories.php
wp-admin/comment.php
wp-admin/css/colors-classic-rtl.css
wp-admin/css/colors-classic.css
wp-admin/css/colors-fresh-rtl.css
wp-admin/css/colors-fresh.css
wp-admin/css/dashboard-rtl.css
wp-admin/css/global-rtl.css [new file with mode: 0644]
wp-admin/css/global.css
wp-admin/css/ie-rtl.css
wp-admin/css/ie.css
wp-admin/css/install-rtl.css
wp-admin/css/install.css
wp-admin/css/login-rtl.css
wp-admin/css/media-rtl.css
wp-admin/css/media.css
wp-admin/css/press-this-ie-rtl.css [new file with mode: 0644]
wp-admin/css/press-this-ie.css [new file with mode: 0644]
wp-admin/css/press-this-rtl.css [new file with mode: 0644]
wp-admin/css/press-this.css [new file with mode: 0644]
wp-admin/css/theme-editor-rtl.css
wp-admin/css/widgets-rtl.css
wp-admin/css/widgets.css
wp-admin/custom-header.php
wp-admin/edit-category-form.php
wp-admin/edit-comments.php
wp-admin/edit-form-advanced.php
wp-admin/edit-form-comment.php
wp-admin/edit-link-categories.php
wp-admin/edit-link-category-form.php
wp-admin/edit-link-form.php
wp-admin/edit-page-form.php
wp-admin/edit-pages.php
wp-admin/edit-tag-form.php
wp-admin/edit-tags.php
wp-admin/edit.php
wp-admin/export.php
wp-admin/gears-manifest.php [new file with mode: 0644]
wp-admin/images/gear.png [new file with mode: 0644]
wp-admin/images/loading-publish.gif [new file with mode: 0644]
wp-admin/images/loading.gif [new file with mode: 0644]
wp-admin/images/logo.gif [new file with mode: 0644]
wp-admin/images/no.png [new file with mode: 0644]
wp-admin/images/required.gif [new file with mode: 0644]
wp-admin/images/tab.png [new file with mode: 0644]
wp-admin/images/yes.png [new file with mode: 0644]
wp-admin/import/blogger.php
wp-admin/import/dotclear.php
wp-admin/import/greymatter.php
wp-admin/import/mt.php
wp-admin/import/textpattern.php
wp-admin/import/wordpress.php
wp-admin/import/wp-cat2tag.php
wp-admin/includes/bookmark.php
wp-admin/includes/class-wp-filesystem-base.php [new file with mode: 0644]
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/comment.php
wp-admin/includes/dashboard.php
wp-admin/includes/export.php
wp-admin/includes/file.php
wp-admin/includes/image.php
wp-admin/includes/media.php
wp-admin/includes/misc.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.php
wp-admin/includes/update.php
wp-admin/includes/upgrade.php
wp-admin/includes/user.php
wp-admin/includes/widgets.php
wp-admin/index.php
wp-admin/install-helper.php
wp-admin/install.php
wp-admin/js/editor.js
wp-admin/js/forms.js
wp-admin/js/gallery.js [new file with mode: 0644]
wp-admin/js/link.js
wp-admin/js/media-upload.js
wp-admin/js/post.js
wp-admin/js/revisions-js.php [new file with mode: 0644]
wp-admin/js/theme-preview.js [new file with mode: 0644]
wp-admin/js/widgets.js
wp-admin/js/word-count.js [new file with mode: 0644]
wp-admin/js/wp-gears.js [new file with mode: 0644]
wp-admin/link-add.php
wp-admin/link-category.php
wp-admin/link-import.php
wp-admin/link-manager.php
wp-admin/link-parse-opml.php
wp-admin/link.php
wp-admin/media.php
wp-admin/menu-header.php
wp-admin/menu.php
wp-admin/moderation.php
wp-admin/options-discussion.php
wp-admin/options-general.php
wp-admin/options-misc.php
wp-admin/options-permalink.php
wp-admin/options-privacy.php
wp-admin/options-reading.php
wp-admin/options-writing.php
wp-admin/options.php
wp-admin/page-new.php
wp-admin/page.php
wp-admin/plugin-editor.php
wp-admin/plugins.php
wp-admin/post-new.php
wp-admin/post.php
wp-admin/press-this.php [new file with mode: 0644]
wp-admin/revision.php [new file with mode: 0644]
wp-admin/rtl.css
wp-admin/setup-config.php
wp-admin/sidebar.php
wp-admin/theme-editor.php
wp-admin/themes.php
wp-admin/update-links.php
wp-admin/update.php
wp-admin/upgrade.php
wp-admin/upload.php
wp-admin/user-edit.php
wp-admin/users.php
wp-admin/widgets.php
wp-admin/wp-admin.css
wp-app.php
wp-atom.php
wp-blog-header.php
wp-comments-post.php
wp-commentsrss2.php
wp-config-sample.php
wp-config.php
wp-content/plugins/akismet/akismet.php
wp-content/plugins/akismet/readme.txt [new file with mode: 0644]
wp-content/plugins/hello.php
wp-content/themes/classic/index.php
wp-content/themes/classic/style.css
wp-content/themes/default/comments.php
wp-content/themes/default/images/header-img.php
wp-content/themes/default/searchform.php
wp-content/themes/default/single.php
wp-content/themes/default/style.css
wp-cron.php
wp-feed.php
wp-includes/Text/Diff.php [new file with mode: 0644]
wp-includes/Text/Diff/Engine/native.php [new file with mode: 0644]
wp-includes/Text/Diff/Engine/shell.php [new file with mode: 0644]
wp-includes/Text/Diff/Engine/string.php [new file with mode: 0644]
wp-includes/Text/Diff/Engine/xdiff.php [new file with mode: 0644]
wp-includes/Text/Diff/Renderer.php [new file with mode: 0644]
wp-includes/Text/Diff/Renderer/inline.php [new file with mode: 0644]
wp-includes/atomlib.php
wp-includes/author-template.php
wp-includes/bookmark-template.php
wp-includes/bookmark.php
wp-includes/cache.php
wp-includes/canonical.php
wp-includes/capabilities.php
wp-includes/category-template.php
wp-includes/category.php
wp-includes/class-IXR.php
wp-includes/class-phpass.php
wp-includes/class-phpmailer.php
wp-includes/class-pop3.php
wp-includes/class-smtp.php
wp-includes/class-snoopy.php
wp-includes/class.wp-dependencies.php [new file with mode: 0644]
wp-includes/class.wp-scripts.php [new file with mode: 0644]
wp-includes/class.wp-styles.php [new file with mode: 0644]
wp-includes/classes.php
wp-includes/comment-template.php
wp-includes/comment.php
wp-includes/cron.php
wp-includes/default-filters.php
wp-includes/deprecated.php
wp-includes/feed.php
wp-includes/formatting.php
wp-includes/functions.php
wp-includes/functions.wp-scripts.php [new file with mode: 0644]
wp-includes/functions.wp-styles.php [new file with mode: 0644]
wp-includes/general-template.php
wp-includes/images/blank.gif [new file with mode: 0644]
wp-includes/js/autosave.js
wp-includes/js/jquery/jquery.dimensions.min.js [deleted file]
wp-includes/js/jquery/jquery.js
wp-includes/js/jquery/suggest.js
wp-includes/js/jquery/ui.core.js [new file with mode: 0644]
wp-includes/js/jquery/ui.sortable.js [new file with mode: 0644]
wp-includes/js/jquery/ui.tabs.js
wp-includes/js/swfupload/handlers.js
wp-includes/js/thickbox/macFFBgHack.png [new file with mode: 0644]
wp-includes/js/thickbox/thickbox.css
wp-includes/js/tinymce/langs/wp-langs.php
wp-includes/js/tinymce/plugins/fullscreen/editor_plugin.js
wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm
wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js
wp-includes/js/tinymce/plugins/inlinepopups/template.htm
wp-includes/js/tinymce/plugins/media/css/media.css
wp-includes/js/tinymce/plugins/media/editor_plugin.js
wp-includes/js/tinymce/plugins/media/js/media.js
wp-includes/js/tinymce/plugins/media/media.htm
wp-includes/js/tinymce/plugins/paste/blank.htm
wp-includes/js/tinymce/plugins/paste/editor_plugin.js
wp-includes/js/tinymce/plugins/paste/pastetext.htm
wp-includes/js/tinymce/plugins/paste/pasteword.htm
wp-includes/js/tinymce/plugins/safari/editor_plugin.js
wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js
wp-includes/js/tinymce/plugins/wordpress/img/audio.gif [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wordpress/img/image.gif [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wordpress/img/media.gif [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wordpress/img/video.gif [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wordpress/popups.css [deleted file]
wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wpeditimage/editimage.html [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wpeditimage/img/delete.png [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wpeditimage/img/image.png [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js [new file with mode: 0644]
wp-includes/js/tinymce/themes/advanced/about.htm
wp-includes/js/tinymce/themes/advanced/anchor.htm
wp-includes/js/tinymce/themes/advanced/charmap.htm
wp-includes/js/tinymce/themes/advanced/color_picker.htm
wp-includes/js/tinymce/themes/advanced/editor_template.js
wp-includes/js/tinymce/themes/advanced/image.htm
wp-includes/js/tinymce/themes/advanced/img/icons.gif
wp-includes/js/tinymce/themes/advanced/js/color_picker.js
wp-includes/js/tinymce/themes/advanced/js/image.js
wp-includes/js/tinymce/themes/advanced/link.htm
wp-includes/js/tinymce/themes/advanced/skins/default/content.css
wp-includes/js/tinymce/themes/advanced/skins/o2k7/content.css
wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css
wp-includes/js/tinymce/themes/advanced/source_editor.htm
wp-includes/js/tinymce/tiny_mce.js
wp-includes/js/tinymce/tiny_mce_config.php
wp-includes/js/tinymce/tiny_mce_ext.js
wp-includes/js/tinymce/tiny_mce_popup.js
wp-includes/js/tinymce/utils/editable_selects.js
wp-includes/js/tinymce/utils/mctabs.js
wp-includes/js/tinymce/utils/validate.js
wp-includes/js/tinymce/wordpress.css
wp-includes/js/tinymce/wp-mce-help.php
wp-includes/js/wp-ajax.js [deleted file]
wp-includes/js/wp-lists.js
wp-includes/kses.php
wp-includes/l10n.php
wp-includes/link-template.php
wp-includes/media.php
wp-includes/pluggable.php
wp-includes/plugin.php
wp-includes/post-template.php
wp-includes/post.php
wp-includes/query.php
wp-includes/rewrite.php
wp-includes/rss.php
wp-includes/script-loader.php
wp-includes/shortcodes.php
wp-includes/streams.php
wp-includes/taxonomy.php
wp-includes/template-loader.php
wp-includes/theme.php
wp-includes/update.php
wp-includes/user.php
wp-includes/vars.php
wp-includes/version.php
wp-includes/widgets.php
wp-includes/wp-db.php
wp-includes/wp-diff.php [new file with mode: 0644]
wp-links-opml.php
wp-load.php [new file with mode: 0644]
wp-login.php
wp-mail.php
wp-pass.php
wp-rdf.php
wp-register.php
wp-rss.php
wp-rss2.php
wp-settings.php
wp-trackback.php
xmlrpc.php

index b1c655cd5206a392562d94d6f8dbd7a0da2cafbe..49403ecc2d8a343da95ad8d354b4f16a73f094d9 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1,5 +1,18 @@
 <?php
-/* Short and sweet */
+/**
+ * Front to the WordPress application. This file doesn't do anything, but loads
+ * wp-blog-header.php which does and tells WordPress to load the theme.
+ *
+ * @package WordPress
+ */
+
+/**
+ * Tells WordPress to load the WordPress theme and output it.
+ *
+ * @var bool
+ */
 define('WP_USE_THEMES', true);
+
+/** Loads the WordPress Environment and Template */
 require('./wp-blog-header.php');
 ?>
\ No newline at end of file
index a60861c5fa26171f6d4e0ff64419ba56129254b9..45fd3f888b3c4ead84d6beda4dbc8e31372f0da6 100644 (file)
@@ -8,7 +8,7 @@
 <body>
 <h1 id="logo" style="text-align: center">
        <img alt="WordPress" src="wp-admin/images/wordpress-logo.png" />
-       <br /> Version 2.5
+       <br /> Version 2.6.1
 </h1>
 <p style="text-align: center">Semantic Personal Publishing Platform</p>
 
@@ -29,7 +29,7 @@
 
 <h1>Upgrading</h1>
 <p>Before you upgrade anything, make sure you have backup copies of any files you may have modified such as <code>index.php</code>.</p>
-<h2>Upgrading from any previous WordPress to 2.5:</h2>
+<h2>Upgrading from any previous WordPress to 2.6.1:</h2>
 <ol>
        <li>Delete your old WP files, saving ones you've modified.</li>
        <li>Upload the new files.</li>
index 4e34333ca74d2d36c9a840a2776eb3310145009a..4485935147ed90a97b3f8cb89a57f5c84e5a2551 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 define('DOING_AJAX', true);
 
-require_once('../wp-config.php');
+require_once('../wp-load.php');
 require_once('includes/admin.php');
 
 if ( !is_user_logged_in() )
@@ -13,9 +13,14 @@ if ( isset($_GET['action']) && 'ajax-tag-search' == $_GET['action'] ) {
 
        $s = $_GET['q']; // is this slashed already?
 
-       if ( strstr( $s, ',' ) )
-               die; // it's a multiple tag insert, we won't find anything
-       $results = $wpdb->get_col( "SELECT name FROM $wpdb->terms WHERE name LIKE ('%$s%')" );
+       if ( strstr( $s, ',' ) ) { 
+               $s = explode( ',', $s ); 
+               $s = $s[count( $s ) - 1]; 
+       }
+       $s = trim( $s );
+       if ( strlen( $s ) < 2 )
+        die; // require 2 chars for matching
+       $results = $wpdb->get_col( "SELECT name FROM $wpdb->terms WHERE name LIKE ('%". $s . "%')" );
        echo join( $results, "\n" );
        die;
 }
@@ -25,14 +30,17 @@ switch ( $action = $_POST['action'] ) :
 case 'delete-comment' :
        check_ajax_referer( "delete-comment_$id" );
        if ( !$comment = get_comment( $id ) )
-               die('0');
+               die('1');
        if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
                die('-1');
 
-       if ( isset($_POST['spam']) && 1 == $_POST['spam'] )
+       if ( isset($_POST['spam']) && 1 == $_POST['spam'] ) {
+               if ( 'spam' == wp_get_comment_status( $comment->comment_ID ) )
+                       die('1');
                $r = wp_set_comment_status( $comment->comment_ID, 'spam' );
-       else
+       } else {
                $r = wp_delete_comment( $comment->comment_ID );
+       }
 
        die( $r ? '1' : '0' );
        break;
@@ -41,24 +49,38 @@ case 'delete-cat' :
        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');
+       else
+               die('0');
        break;
 case 'delete-tag' :
        check_ajax_referer( "delete-tag_$id" );
        if ( !current_user_can( 'manage_categories' ) )
                die('-1');
 
+       $tag = get_term( $id, 'post_tag' );
+       if ( !$tag || is_wp_error( $tag ) )
+               die('1');
+
        if ( wp_delete_term($id, 'post_tag'))
                die('1');
-       else    die('0');
+       else
+               die('0');
        break;
 case 'delete-link-cat' :
        check_ajax_referer( "delete-link-category_$id" );
        if ( !current_user_can( 'manage_categories' ) )
                die('-1');
 
+       $cat = get_term( $id, 'link_category' );
+       if ( !$cat || is_wp_error( $cat ) )
+               die('1');
+
        $cat_name = get_term_field('name', $id, 'link_category');
 
        // Don't delete the default cats.
@@ -89,14 +111,20 @@ case 'delete-link' :
        if ( !current_user_can( 'manage_links' ) )
                die('-1');
 
+       $link = get_bookmark( $id );
+       if ( !$link || is_wp_error( $link ) )
+               die('1');
+
        if ( wp_delete_link( $id ) )
                die('1');
-       else    die('0');
+       else
+               die('0');
        break;
 case 'delete-meta' :
        check_ajax_referer( "delete-meta_$id" );
        if ( !$meta = get_post_meta_by_id( $id ) )
-               die('0');
+               die('1');
+
        if ( !current_user_can( 'edit_post', $meta->post_id ) )
                die('-1');
        if ( delete_meta( $meta->meta_id ) )
@@ -108,6 +136,9 @@ case 'delete-post' :
        if ( !current_user_can( 'delete_post', $id ) )
                die('-1');
 
+       if ( !get_post( $id ) )
+               die('1');
+
        if ( wp_delete_post( $id ) )
                die('1');
        else
@@ -118,19 +149,28 @@ case 'delete-page' :
        if ( !current_user_can( 'delete_page', $id ) )
                die('-1');
 
+       if ( !get_page( $id ) )
+               die('1');
+
        if ( wp_delete_post( $id ) )
                die('1');
-       else    die('0');
+       else
+               die('0');
        break;
 case 'dim-comment' :
        if ( !$comment = get_comment( $id ) )
                die('0');
+
        if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
                die('-1');
        if ( !current_user_can( 'moderate_comments' ) )
                die('-1');
 
-       if ( 'unapproved' == wp_get_comment_status($comment->comment_ID) ) {
+       $current = wp_get_comment_status( $comment->comment_ID );
+       if ( $_POST['new'] == $current )
+               die('1');
+
+       if ( 'unapproved' == $current ) {
                check_ajax_referer( "approve-comment_$id" );
                if ( wp_set_comment_status( $comment->comment_ID, 'approve' ) )
                        die('1');
@@ -150,6 +190,9 @@ case 'add-category' : // On the Fly
                $parent = 0;
        $post_category = isset($_POST['post_category'])? (array) $_POST['post_category'] : array();
        $checked_categories = array_map( 'absint', (array) $post_category );
+       $popular_ids = isset( $_POST['popular_ids'] ) ?
+                       array_map( 'absint', explode( ',', $_POST['popular_ids'] ) ) :
+                       false;
 
        $x = new WP_Ajax_Response();
        foreach ( $names as $cat_name ) {
@@ -163,7 +206,7 @@ case 'add-category' : // On the Fly
                        continue;
                $category = get_category( $cat_id );
                ob_start();
-                       wp_category_checklist( 0, $cat_id, $checked_categories );
+                       wp_category_checklist( 0, $cat_id, $checked_categories, $popular_ids );
                $data = ob_get_contents();
                ob_end_clean();
                $x->add( array(
@@ -349,13 +392,16 @@ case 'add-comment' :
 
        list($comments, $total) = _wp_get_comment_list( $status, $search, $start, 1 );
 
+       if ( get_option('show_avatars') )
+               add_filter( 'comment_author', 'floated_admin_avatar' );
+
        if ( !$comments )
                die('1');
        $x = new WP_Ajax_Response();
        foreach ( (array) $comments as $comment ) {
                get_comment( $comment );
                ob_start();
-                       _wp_comment_row( $comment->comment_ID, $mode, false );
+                       _wp_comment_row( $comment->comment_ID, $mode, $status );
                        $comment_list_item = ob_get_contents();
                ob_end_clean();
                $x->add( array(
@@ -459,10 +505,11 @@ case 'add-user' :
        $x->send();
        break;
 case 'autosave' : // The name of this action is hardcoded in edit_post()
-       $nonce_age = check_ajax_referer( 'autosave', 'autosavenonce');
+       define( 'DOING_AUTOSAVE', true );
+
+       $nonce_age = check_ajax_referer( 'autosave', 'autosavenonce' );
        global $current_user;
 
-       $_POST['post_status'] = 'draft';
        $_POST['post_category'] = explode(",", $_POST['catslist']);
        $_POST['tags_input'] = explode(",", $_POST['tags_input']);
        if($_POST['post_type'] == 'page' || empty($_POST['post_category']))
@@ -476,8 +523,9 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
 
        $supplemental = array();
 
-       $id = 0;
+       $id = $revision_id = 0;
        if($_POST['post_ID'] < 0) {
+               $_POST['post_status'] = 'draft';
                $_POST['temp_ID'] = $_POST['post_ID'];
                if ( $do_autosave ) {
                        $id = wp_write_post();
@@ -508,8 +556,18 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
                        if ( !current_user_can('edit_post', $post_ID) )
                                die(__('You are not allowed to edit this post.'));
                }
+
                if ( $do_autosave ) {
-                       $id = edit_post();
+                       // 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;
index 0185a9868386f9fc55b7a5a10b037b50909f7b4c..54fdea489274eab7098d13fe6fd1378781714d59 100644 (file)
@@ -5,6 +5,7 @@ if ( $editing ) {
        if ( user_can_richedit() )
                wp_enqueue_script( 'wp_tiny_mce' );
 }
+wp_enqueue_script( 'wp-gears' );
 
 $min_width_pages = array( 'post.php', 'post-new.php', 'page.php', 'page-new.php', 'widgets.php', 'comment.php', 'link.php' );
 $the_current_page = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
@@ -28,14 +29,13 @@ get_admin_page_title();
 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
 <title><?php bloginfo('name') ?> &rsaquo; <?php echo wp_specialchars( strip_tags( $title ) ); ?> &#8212; WordPress</title>
 <?php
+
 wp_admin_css( 'css/global' );
 wp_admin_css();
 wp_admin_css( 'css/colors' );
+wp_admin_css( 'css/ie' );
+
 ?>
-<!--[if gte IE 6]>
-<?php wp_admin_css( 'css/ie' );
-?>
-<![endif]-->
 <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();}}};
@@ -44,26 +44,83 @@ addLoadEvent = function(func) {if (typeof jQuery != "undefined") jQuery(document
 <?php if ( ($parent_file != 'link-manager.php') && ($parent_file != 'options-general.php') && $ie6_no_scrollbar ) : ?>
 <style type="text/css">* html { overflow-x: hidden; }</style>
 <?php endif;
-if ( isset($page_hook) )
-       do_action('admin_print_scripts-' . $page_hook);
-else if ( isset($plugin_page) )
-       do_action('admin_print_scripts-' . $plugin_page);
-do_action('admin_print_scripts');
+
+$hook_suffixes = array();
 
 if ( isset($page_hook) )
-       do_action('admin_head-' . $page_hook);
+       $hook_suffixes[] = "-$page_hook";
 else if ( isset($plugin_page) )
-       do_action('admin_head-' . $plugin_page);
-do_action('admin_head');
+       $hook_suffixes[] = "-$plugin_page";
+else if ( isset($pagenow) )
+       $hook_suffixes[] = "-$pagenow";
+
+$hook_suffixes[] = '';
+
+foreach ( $hook_suffixes as $hook_suffix )
+       do_action("admin_print_styles$hook_suffix"); // do_action( 'admin_print_styles-XXX' ); do_action( 'admin_print_styles' );
+foreach ( $hook_suffixes as $hook_suffix )
+       do_action("admin_print_scripts$hook_suffix"); // do_action( 'admin_print_scripts-XXX' ); do_action( 'admin_print_scripts' );
+foreach ( $hook_suffixes as $hook_suffix )
+       do_action("admin_head$hook_suffix"); // do_action( 'admin_head-XXX' ); do_action( 'admin_head' );
+unset($hook_suffixes, $hook_suffix);
+
 ?>
 </head>
 <body class="wp-admin <?php echo apply_filters( 'admin_body_class', '' ); ?>">
 <div id="wpwrap">
 <div id="wpcontent">
 <div id="wphead">
-<h1><?php bloginfo('name'); ?><span id="viewsite"><a href="<?php echo trailingslashit( get_option('home') ); ?>"><?php _e('Visit Site') ?></a></span></h1>
+<h1><?php if ( '' == get_bloginfo('name', 'display') ) echo '&nbsp;'; else echo get_bloginfo('name', 'display'); ?><span id="viewsite"><a href="<?php echo trailingslashit( get_option('home') ); ?>"><?php _e('Visit Site') ?></a></span></h1>
 </div>
-<div id="user_info"><p><?php printf(__('Howdy, <a href="%1$s">%2$s</a>!'), 'profile.php', $user_identity) ?> | <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="<?php _e('Log Out') ?>"><?php _e('Log Out'); ?></a> | <?php _e('<a href="http://codex.wordpress.org/">Help</a>') ?> | <?php _e('<a href="http://wordpress.org/support/">Forums</a>') ?></p></div>
+
+<?php
+if ( ! $is_opera ) { 
+?>
+       <div id="gears-info-box" class="info-box" style="display:none;">
+       <img src="images/gear.png" title="Gear" alt="" class="gears-img" />
+       <div id="gears-msg1">
+       <h3 class="info-box-title"><?php _e('Speed up WordPress'); ?></h3>
+       <p><?php _e('WordPress now has support for Gears, which adds new features to your web browser.'); ?><br />
+       <a href="http://gears.google.com/" target="_blank" style="font-weight:normal;"><?php _e('More information...'); ?></a></p>
+       <p><?php _e('After you install and enable Gears most of WordPress&#8217; images, scripts, and CSS files will be stored locally on your computer. This speeds up page load time.'); ?></p>
+       <p><strong><?php _e('Don&#8217;t install on a public or shared computer.'); ?></strong></p>     <div class="submit"><button onclick="window.location = 'http://gears.google.com/?action=install&amp;return=<?php echo urlencode( admin_url() ); ?>';" class="button"><?php _e('Install Now'); ?></button>
+       <button class="button" style="margin-left:10px;" onclick="document.getElementById('gears-info-box').style.display='none';"><?php _e('Cancel'); ?></button></div>
+       </div>
+
+       <div id="gears-msg2" style="display:none;">
+       <h3 class="info-box-title"><?php _e('Gears Status'); ?></h3>
+       <p><?php _e('Gears is installed on this computer but is not enabled for use with WordPress.'); ?></p> 
+       <p><?php 
+       
+       if ( $is_safari )
+               _e('To enable it, make sure this web site is not on the denied list in Gears Settings under the Safari menu, then click the button below.');
+       else
+               _e('To enable it, make sure this web site is not on the denied list in Gears Settings under your browser Tools menu, then click the button below.'); 
+       
+       ?></p>
+       <p><strong><?php _e('However if this is a public or shared computer, Gears should not be enabled.'); ?></strong></p>
+       <div class="submit"><button class="button" onclick="wpGears.getPermission();"><?php _e('Enable Gears'); ?></button>
+       <button class="button" style="margin-left:10px;" onclick="document.getElementById('gears-info-box').style.display='none';"><?php _e('Cancel'); ?></button></div>
+       </div>
+
+       <div id="gears-msg3" style="display:none;">
+       <h3 class="info-box-title"><?php _e('Gears Status'); ?></h3>
+       <p><?php
+       
+       if ( $is_safari )
+               _e('Gears is installed and enabled on this computer. You can disable it from the Safari menu.');
+       else
+               _e('Gears is installed and enabled on this computer. You can disable it from your browser Tools menu.'); 
+       
+       ?></p>
+       <p><?php _e('If there are any errors, try disabling Gears, then reload the page and enable it again.'); ?></p>
+       <p><?php _e('Local storage status:'); ?> <span id="gears-wait"><span style="color:#f00;"><?php _e('Please wait! Updating files:'); ?></span> <span id="gears-upd-number"></span></span></p>
+       <div class="submit"><button class="button" onclick="document.getElementById('gears-info-box').style.display='none';"><?php _e('Close'); ?></button></div>
+       </div>
+       </div>
+<?php } ?>
+
+<div id="user_info"><p><?php printf(__('Howdy, <a href="%1$s">%2$s</a>!'), 'profile.php', $user_identity) ?> | <a href="<?php echo site_url('wp-login.php?action=logout', 'login') ?>" title="<?php _e('Log Out') ?>"><?php _e('Log Out'); ?></a> | <?php _e('<a href="http://codex.wordpress.org/">Help</a>') ?> | <?php _e('<a href="http://wordpress.org/support/">Forums</a>'); if ( ! $is_opera ) { ?> | <span id="gears-menu"><a href="#" onclick="wpGears.message(1);return false;"><?php _e('Turbo') ?></a></span><?php } ?></p></div>
 
 <?php
 require(ABSPATH . 'wp-admin/menu-header.php');
diff --git a/wp-admin/admin-post.php b/wp-admin/admin-post.php
new file mode 100644 (file)
index 0000000..f45fc62
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+define('WP_ADMIN', TRUE);
+
+if ( defined('ABSPATH') )
+       require_once(ABSPATH . 'wp-load.php');
+else
+       require_once('../wp-load.php');
+
+require_once(ABSPATH . 'wp-admin/includes/admin.php');
+
+if ( !wp_validate_auth_cookie() )
+       wp_die(__('Cheatin&#8217; uh?'));
+
+nocache_headers();
+
+do_action('admin_init');
+
+$action = 'admin_post';
+if ( !empty($_REQUEST['action']) )
+       $action .= '_' . $_REQUEST['action'];
+
+do_action($action);
+
+?>
\ No newline at end of file
index 1664820796b96a41bcb47bbb5d09f87c4dea255b..20ff3693f5562b4e1d21c8ba6bee960223d995e0 100644 (file)
@@ -2,12 +2,12 @@
 define('WP_ADMIN', TRUE);
 
 if ( defined('ABSPATH') )
-       require_once( ABSPATH . 'wp-config.php');
+       require_once(ABSPATH . 'wp-load.php');
 else
-    require_once('../wp-config.php');
+       require_once('../wp-load.php');
 
 if ( get_option('db_version') != $wp_db_version ) {
-       wp_redirect(get_option('siteurl') . '/wp-admin/upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI'])));
+       wp_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI']))));
        exit;
 }
 
@@ -26,8 +26,8 @@ $time_format = get_option('time_format');
 
 wp_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'popuptitle', 'popupurl', 'text', 'trackback', 'pingback'));
 
-wp_admin_css_color('classic', __('Classic'), get_option( 'siteurl' ) . "/wp-admin/css/colors-classic.css", array('#07273E', '#14568A', '#D54E21', '#2683AE'));
-wp_admin_css_color('fresh', __('Fresh'), get_option( 'siteurl' ) . "/wp-admin/css/colors-fresh.css", array('#464646', '#CEE1EF', '#D54E21', '#2683AE'));
+wp_admin_css_color('classic', __('Classic'), admin_url("css/colors-classic.css"), array('#07273E', '#14568A', '#D54E21', '#2683AE'));
+wp_admin_css_color('fresh', __('Fresh'), admin_url("css/colors-fresh.css"), array('#464646', '#CEE1EF', '#D54E21', '#2683AE'));
 
 wp_enqueue_script( 'common' );
 wp_enqueue_script( 'jquery-color' );
@@ -58,7 +58,7 @@ if (isset($plugin_page)) {
                        wp_die(__('Invalid plugin page'));
                }
 
-               if (! ( file_exists(ABSPATH . PLUGINDIR . "/$plugin_page") && is_file( ABSPATH . PLUGINDIR . "/$plugin_page") ) )
+               if (! ( file_exists(WP_PLUGIN_DIR . "/$plugin_page") && is_file(WP_PLUGIN_DIR . "/$plugin_page") ) )
                        wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page)));
 
                do_action('load-' . $plugin_page);
@@ -66,7 +66,7 @@ if (isset($plugin_page)) {
                if (! isset($_GET['noheader']))
                        require_once(ABSPATH . 'wp-admin/admin-header.php');
 
-               include(ABSPATH . PLUGINDIR . "/$plugin_page");
+               include(WP_PLUGIN_DIR . "/$plugin_page");
        }
 
        include(ABSPATH . 'wp-admin/admin-footer.php');
@@ -113,4 +113,7 @@ if (isset($plugin_page)) {
        do_action("load-$pagenow");
 }
 
+if ( !empty($_REQUEST['action']) )
+       do_action('admin_action_' . $_REQUEST['action']);
+
 ?>
index 1a37dceb96bf725f18e8de357dd4dd8292e7cbaf..18b810414168c571a4bc7e864b921885a89c6ac9 100644 (file)
@@ -5,17 +5,19 @@
 */
 
 if ( defined('ABSPATH') )
-       require_once( ABSPATH . 'wp-config.php');
+       require_once(ABSPATH . 'wp-load.php');
 else
-    require_once('../wp-config.php');
+       require_once('../wp-load.php');
 
 // Flash often fails to send cookies with the POST or upload, so we need to pass it in GET or POST instead
-if ( empty($_COOKIE[AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
+if ( is_ssl() && empty($_COOKIE[SECURE_AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
+       $_COOKIE[SECURE_AUTH_COOKIE] = $_REQUEST['auth_cookie'];
+elseif ( empty($_COOKIE[AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
        $_COOKIE[AUTH_COOKIE] = $_REQUEST['auth_cookie'];
 unset($current_user);
 require_once('admin.php');
 
-header('Content-Type: text/plain');
+header('Content-Type: text/plain; charset=' . get_option('blog_charset'));
 
 if ( !current_user_can('upload_files') )
        wp_die(__('You do not have permission to upload files.'));
@@ -26,6 +28,8 @@ if ( ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) {
        exit;
 }
 
+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">'.wp_specialchars($id->get_error_message()).'</div>';
diff --git a/wp-admin/bookmarklet.php b/wp-admin/bookmarklet.php
deleted file mode 100644 (file)
index 8618458..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-<?php
-$mode = 'bookmarklet';
-require_once('admin.php');
-
-if ( ! current_user_can('edit_posts') )
-       wp_die(__('Cheatin&#8217; uh?'));
-
-if ('b' == $a):
-?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<script type="text/javascript">
-<!--
-window.close()
--->
-</script>
-</head>
-<body></body>
-</html>
-<?php
-exit;
-endif;
-
-$post = get_default_post_to_edit();
-
-$popuptitle = wp_specialchars(stripslashes($popuptitle));
-$text       = wp_specialchars(stripslashes(urldecode($text)));
-
-$popuptitle = funky_javascript_fix($popuptitle);
-$text       = funky_javascript_fix($text);
-
-$post_title = wp_specialchars($_REQUEST['post_title']);
-if (!empty($post_title))
-       $post->post_title =  stripslashes($post_title);
-else
-       $post->post_title = $popuptitle;
-
-
-$content  = wp_specialchars($_REQUEST['content']);
-$popupurl = clean_url($_REQUEST['popupurl']);
-if ( !empty($content) ) {
-       $post->post_content = wp_specialchars( stripslashes($_REQUEST['content']) );
-} else {
-       $post->post_content = '<a href="'.$popupurl.'">'.$popuptitle.'</a>'."\n$text";
-}
-
-/* /big funky fixes */
-
-?><!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 bloginfo('name') ?> &rsaquo; Bookmarklet &#8212; WordPress</title>
-<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
-<?php
-wp_admin_css( 'css/global' );
-wp_admin_css();
-?>
-
-<style type="text/css">
-<!--
-
-#wpbookmarklet textarea,input,select {
-       border-width: 1px;
-       border-color: #cccccc;
-       border-style: solid;
-       padding: 2px;
-       margin: 1px;
-}
-
-#wpbookmarklet .checkbox {
-       background-color: #ffffff;
-       border-width: 0px;
-       padding: 0px;
-       margin: 0px;
-}
-
-#wpbookmarklet textarea {
-       font-family: Verdana, Geneva, Arial, Helvetica;
-       font-size: 0.9em;
-}
-
-#wpbookmarklet .wrap {
-       border: 0px;
-}
-
-#wpbookmarklet #postdiv {
-       margin-bottom: 0.5em;
-}
-
-#wpbookmarklet #titlediv {
-       margin-bottom: 1em;
-}
-
--->
-</style>
-</head>
-<body id="wpbookmarklet">
-<div id="wphead">
-<h1><?php bloginfo('name') ?></h1>
-</div>
-
-<?php require('edit-form.php'); ?>
-
-<?php do_action('admin_footer', ''); ?>
-
-</body>
-</html>
index 945da0c63df477dea003cc0d7c3086f041f062cf..d2e8fb3720f45eef84691d3928a941c124463556 100644 (file)
@@ -126,6 +126,7 @@ endif; ?>
 <?php endif; ?>
 
 <p id="post-search">
+       <label class="hidden" for="post-search-input"><?php _e('Search Categories'); ?>:</label>
        <input type="text" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" />
        <input type="submit" value="<?php _e( 'Search Categories' ); ?>" class="button" />
 </p>
@@ -134,6 +135,24 @@ endif; ?>
 
 <div class="tablenav">
 
+<?php
+$pagenum = absint( $_GET['pagenum'] );
+if ( empty($pagenum) )
+       $pagenum = 1;
+if( !$catsperpage || $catsperpage < 0 )
+       $catsperpage = 20;
+
+$page_links = paginate_links( array(
+       'base' => add_query_arg( 'pagenum', '%#%' ),
+       'format' => '',
+       'total' => ceil(wp_count_terms('category') / $catsperpage),
+       'current' => $pagenum
+));
+
+if ( $page_links )
+       echo "<div class='tablenav-pages'>$page_links</div>";
+?>
+
 <div class="alignleft">
 <input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
 <?php wp_nonce_field('bulk-categories'); ?>
@@ -147,7 +166,7 @@ endif; ?>
 <table class="widefat">
        <thead>
        <tr>
-               <th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('posts-filter'));" /></th>
+               <th scope="col" class="check-column"><input type="checkbox" /></th>
         <th scope="col"><?php _e('Name') ?></th>
         <th scope="col"><?php _e('Description') ?></th>
         <th scope="col" class="num"><?php _e('Posts') ?></th>
@@ -155,13 +174,18 @@ endif; ?>
        </thead>
        <tbody id="the-list" class="list:cat">
 <?php
-cat_rows();
+cat_rows(0, 0, 0, $pagenum, $catsperpage);
 ?>
        </tbody>
 </table>
 </form>
 
 <div class="tablenav">
+
+<?php
+if ( $page_links )
+       echo "<div class='tablenav-pages'>$page_links</div>";
+?>
 <br class="clear" />
 </div>
 <br class="clear" />
index 72d014703a98b8e838909aeac144762bd5cdea1b..d1e394ea9a3d7f6d77ba8f481b43a89026e6ab7e 100644 (file)
@@ -21,7 +21,7 @@ case 'editcomment' :
        $title = __('Edit Comment');
 
        wp_enqueue_script('comment');
-       //wp_enqueue_script('thickbox');
+
        require_once('admin-header.php');
 
        $comment_id = absint( $_GET['c'] );
@@ -78,7 +78,7 @@ if ( 'spam' == $_GET['dt'] ) {
 
 <table width="100%">
 <tr>
-<td><input type='button' class="button" value='<?php _e('No'); ?>' onclick="self.location='<?php echo get_option('siteurl'); ?>/wp-admin/edit-comments.php';" /></td>
+<td><input type='button' class="button" value='<?php _e('No'); ?>' onclick="self.location='<?php echo admin_url('edit-comments.php'); ?>" /></td>
 <td class="textright"><input type='submit' class="button" value='<?php echo $button; ?>' /></td>
 </tr>
 </table>
@@ -146,7 +146,7 @@ case 'deletecomment' :
        else if ( '' != wp_get_original_referer() && false == $noredir )
                wp_redirect( wp_get_original_referer() );
        else
-               wp_redirect( get_option('siteurl') . '/wp-admin/edit-comments.php' );
+               wp_redirect( admin_url('edit-comments.php') );
 
        die;
        break;
@@ -171,7 +171,7 @@ case 'unapprovecomment' :
        if ( '' != wp_get_referer() && false == $noredir )
                wp_redirect( wp_get_referer() );
        else
-               wp_redirect( get_option('siteurl') . '/wp-admin/edit.php?p=' . absint( $comment->comment_post_ID ) . '#comments' );
+               wp_redirect( admin_url('edit.php?p=' . absint( $comment->comment_post_ID ) . '#comments') );
 
        exit();
        break;
@@ -193,14 +193,10 @@ case 'approvecomment' :
 
        wp_set_comment_status( $comment->comment_ID, 'approve' );
 
-       if ( true == get_option('comments_notify') )
-               wp_notify_postauthor( $comment->comment_ID );
-
-
        if ( '' != wp_get_referer() && false == $noredir )
                wp_redirect( wp_get_referer() );
        else
-               wp_redirect( get_option('siteurl') . '/wp-admin/edit.php?p=' . absint( $comment->comment_post_ID ) . '#comments' );
+               wp_redirect( admin_url('edit.php?p=' . absint( $comment->comment_post_ID ) . '#comments') );
 
        exit();
        break;
@@ -229,4 +225,4 @@ default:
 
 include('admin-footer.php');
 
-?>
\ No newline at end of file
+?>
index 5d0d05cf3eb9f84a9a1230407bb461883d32b663..4c6f3271d9342986b460f184e1b9bcb4fb5f6288 100644 (file)
@@ -1,3 +1,24 @@
+.post-com-count {
+}
+#adminmenu li a #awaiting-mod, #sidemenu li a #update-plugins {
+       background-image: url(../images/comment-stalk-rtl.gif);
+       background-position:right bottom;
+}
+#footer {
+       background-position:99% 10px;
+}
 #poststuff .closed .togbox, #poststuff .togbox {
-background-image: url(../images/toggle-arrow-rtl.gif) !important;
-}
\ No newline at end of file
+       background-image: url(../images/toggle-arrow-rtl.gif) !important;
+}
+.bar {
+       border-right-color: transparent;
+       border-left-color: #99d;
+}
+.plugins .togl {
+       border-right-color: transparent;
+       border-left-color: #ccc;
+}
+#upload-menu li.current {
+       border-right-color: transparent;
+       border-left-color: #448abd;
+}
index 6f83c661e22c8575faf89300861b1125b65c5533..65d0f3831420af13aa75ce541ee8447a9355ded8 100644 (file)
@@ -2,7 +2,7 @@ a.page-numbers:hover {
        border-color: #999;
 }
 
-body   {
+body, .form-table .pre {
        background-color: #fff;
        color: #333;
 }
@@ -37,7 +37,7 @@ input.disabled, textarea.disabled {
        color: #fff;
 }
 
-ul#category-tabs li.ui-tabs-selected, li.widget-list-control-item, div.nav, .tablenav, .submitbox, h3.dashboard-widget-title, h3.dashboard-widget-title span, h3.dashboard-widget-title small, ul.view-switch li.current, .form-table tr, #poststuff h3, .login form {
+ul#category-tabs li.ui-tabs-selected, li.widget-list-control-item, div.nav, .tablenav, .submitbox, h3.dashboard-widget-title, h3.dashboard-widget-title span, h3.dashboard-widget-title small, ul.view-switch li.current, .form-table tr, #poststuff h3, .login form, h3.info-box-title {
        background-color: #cfebf7;
 }
 
@@ -63,7 +63,7 @@ ul#widget-list li.widget-list-item h4.widget-title {
        color: #000;
 }
 
-ul.widget-control-list .sorthelper {
+.sorthelper {
        background-color: #ccf3fa;
 }
 
@@ -204,11 +204,11 @@ ul.widget-control-list .sorthelper {
        border-color: #535353;
 }
 
-.submit input:hover, .button:hover, .button-secondary:hover, #wphead #viewsite a:hover, #submenu a.current, #submenu a:hover, .submitbox #previewview a:hover, #the-comment-list .comment a:hover, #rightnow a:hover, a:hover, .subsubsub a:hover, .subsubsub a.current:hover, #login form .submit input:hover, div.dashboard-widget-submit input:hover, #edit-slug-buttons a.save:hover {
+.submit input:hover, .button:hover, .button-secondary:hover, #wphead #viewsite a:hover, #submenu a.current, #submenu a:hover, .submitbox #previewview a:hover, #the-comment-list .comment a:hover, #rightnow a:hover, a:hover, .subsubsub a:hover, .subsubsub a.current:hover, #login form .submit input:hover, div.dashboard-widget-submit input:hover, #edit-slug-buttons a.save:hover, #media-upload a.del-link:hover {
        color: #d54e21;
 }
 
-#adminmenu a:hover, #sidemenu a:hover {
+#adminmenu a:hover, #sidemenu a:hover, .ui-tabs-nav a:hover {
        color: #97c4d8;
 }
 
@@ -239,7 +239,8 @@ ul.widget-control-list .sorthelper {
        border-bottom-color: #999;
 }
 
-.submitbox .submitdelete:hover {
+.submitbox .submitdelete:hover,
+#media-upload a.delete:hover {
        color: #fff;
        background-color: #f00;
        border-bottom-color: #f00;
@@ -291,11 +292,11 @@ ul.widget-control-list .sorthelper {
        color: #5a5a5a;
 }
 
-#poststuff #edButtonPreview, #poststuff #edButtonHTML, #the-comment-list p.comment-author strong a, a {
+#poststuff #edButtonPreview, #poststuff #edButtonHTML, #the-comment-list p.comment-author strong a, #media-upload a.del-link, #media-upload a.delete, a {
        color: #2e7ca0;
 }
 
-#adminmenu a {
+#adminmenu a, .ui-tabs-nav a {
        color: #cfebf6;
 }
 
@@ -303,7 +304,7 @@ ul.widget-control-list .sorthelper {
        color: #2782af
 }
 /* Because we don't want visited on these links */
-#adminmenu a.current, #sidemenu a.current {
+#adminmenu a.current, #sidemenu a.current, body.press-this .ui-tabs-selected a, body.press-this .ui-tabs-selected a:hover {
        background-color: #fff;
        border-color: #07273e;
        border-bottom-color: #fff;
@@ -311,11 +312,11 @@ ul.widget-control-list .sorthelper {
        font-weight: bold;
 }
 
-#adminmenu li a #awaiting-mod {
+#adminmenu li a #awaiting-mod, #sidemenu li a #update-plugins {
        background-image: url(../images/comment-stalk-classic.gif);
 }
 
-#adminmenu li a #awaiting-mod span {
+#adminmenu li a #awaiting-mod span, #sidemenu li a #update-plugins span {
        background-color: #d54e21;
        color: #fff;
 }
@@ -326,7 +327,7 @@ ul.widget-control-list .sorthelper {
 }
 
 
-#adminmenu li a:hover #awaiting-mod span {
+#adminmenu li a:hover #awaiting-mod span, #sidemenu li a:hover #update-plugins span {
        background-color: #07273E;
 }
 
@@ -414,11 +415,11 @@ input.readonly {
        background-color: #fff;
 }
 
-#plugins .active {
+.plugins .active {
        background-color: #BBEEBB;
 }
 
-#plugins .togl {
+.plugins .togl {
        border-right-color: #ccc;
 }
 
@@ -426,7 +427,7 @@ input.readonly {
        background-color: #ffffe0;
 }
 
-#plugins tr {
+.plugins tr {
        background-color: #fff;
 }
 
@@ -550,11 +551,6 @@ div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover
        color: #f00;
 }
 
-#media-upload a.delete { 
-       color: #888; 
-}
-
-
 /* TinyMCE */
 .wp_themeSkin *,
 .wp_themeSkin a:hover, 
@@ -565,7 +561,7 @@ div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover
 }
 
 /* Containers */
-.wp_themeSkin table {
+.wp_themeSkin table, #wp_editbtns {
        background: #83B4D5;
 }
 
@@ -717,3 +713,18 @@ div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover
        background-color: #ddd;
        color: #333;
 }
+
+/* Diff */
+
+table.diff .diff-deletedline {
+       background-color: #ffdddd;
+}
+table.diff .diff-deletedline del {
+       background-color: #ff9999;
+}
+table.diff .diff-addedline {
+       background-color: #ddffdd;
+}
+table.diff .diff-addedline ins {
+       background-color: #99ff99;
+}
index 5d0d05cf3eb9f84a9a1230407bb461883d32b663..d7b7afbb705b2ad68ad4dca329a16a7415315b50 100644 (file)
@@ -1,3 +1,24 @@
+.bar {
+       border-right-color: transparent;
+       border-left-color: #99d;
+}
+.post-com-count {
+}
+#adminmenu li a #awaiting-mod, #sidemenu li a #update-plugins {
+       background-image: url(../images/comment-stalk-rtl.gif);
+       background-position:right bottom;
+}
+#footer {
+       background-position:99% 10px;
+}
+.plugins .togl {
+       border-right-color: transparent;
+       border-left-color: #ccc;
+}
 #poststuff .closed .togbox, #poststuff .togbox {
-background-image: url(../images/toggle-arrow-rtl.gif) !important;
-}
\ No newline at end of file
+       background-image: url(../images/toggle-arrow-rtl.gif);
+}
+#upload-menu li.current {
+       border-right-color:transparent;
+       border-left-color: #448abd;
+}
index 1332c3765c44121e606dfaf5c7689437e60cd0da..09e0c58226b7683020c54bc187f7ab16bc64cde2 100644 (file)
@@ -2,7 +2,7 @@ a.page-numbers:hover {
        border-color: #999;
 }
 
-body   {
+body, .form-table .pre {
        background-color: #fff;
        color: #333;
 }
@@ -41,7 +41,7 @@ input.disabled, textarea.disabled {
        color: #fff;
 }
 
-li.widget-list-control-item, div.nav, .tablenav, .submitbox, h3.dashboard-widget-title, h3.dashboard-widget-title span, h3.dashboard-widget-title small, ul.view-switch li.current, .form-table tr, #poststuff h3, .login form {
+li.widget-list-control-item, div.nav, .tablenav, .submitbox, h3.dashboard-widget-title, h3.dashboard-widget-title span, h3.dashboard-widget-title small, ul.view-switch li.current, .form-table tr, #poststuff h3, .login form, h3.info-box-title {
        background-color: #eaf3fa;
 }
 
@@ -63,7 +63,7 @@ ul#widget-list li.widget-list-item h4.widget-title {
        color: #000;
 }
 
-ul.widget-control-list .sorthelper {
+.sorthelper {
        background-color: #ccf3fa;
 }
 
@@ -196,7 +196,7 @@ ul.widget-control-list .sorthelper {
        border-color: #535353;
 }
 
-.submit input:hover, .button:hover, .button-secondary:hover, #wphead #viewsite a:hover, #adminmenu a:hover, #sidemenu a:hover, #submenu a.current, #submenu a:hover, .submitbox #previewview a:hover, #the-comment-list .comment a:hover, #rightnow a:hover, a:hover, .subsubsub a:hover, .subsubsub a.current:hover, #login form .submit input:hover, div.dashboard-widget-submit input:hover, #edit-slug-buttons a.save:hover, #media-upload a.delete:hover {
+.submit input:hover, .button:hover, .button-secondary:hover, #wphead #viewsite a:hover, #adminmenu a:hover, #sidemenu a:hover, #submenu a.current, #submenu a:hover, .submitbox #previewview a:hover, #the-comment-list .comment a:hover, #rightnow a:hover, a:hover, .subsubsub a:hover, .subsubsub a.current:hover, #login form .submit input:hover, div.dashboard-widget-submit input:hover, #edit-slug-buttons a.save:hover, #media-upload a.delete:hover, #media-upload a.del-link:hover, .ui-tabs-nav a:hover {
        color: #d54e21;
 }
 
@@ -226,7 +226,8 @@ ul.widget-control-list .sorthelper {
        border-bottom-color: #999;
 }
 
-.submitbox .submitdelete:hover {
+.submitbox .submitdelete:hover,
+#media-upload a.delete:hover {
        color: #fff;
        background-color: #f00;
        border-bottom-color: #f00;
@@ -278,28 +279,28 @@ ul.widget-control-list .sorthelper {
        color: #666;
 }
 
-#adminmenu a, #submenu a, #poststuff #edButtonPreview, #poststuff #edButtonHTML, #the-comment-list p.comment-author strong a, a {
+#adminmenu a, #submenu a, #poststuff #edButtonPreview, #poststuff #edButtonHTML, #the-comment-list p.comment-author strong a, #media-upload a.del-link, #media-upload a.delete, .ui-tabs-nav a, a {
        color: #2583ad;
 }
 
 /* Because we don't want visited on these links */
-#adminmenu a.current, #sidemenu a.current {
+#adminmenu a.current, #sidemenu a.current, body.press-this .ui-tabs-selected a, body.press-this .ui-tabs-selected a:hover {
        background-color: #fff;
        border-color: #c6d9e9;
        border-bottom-color: #fff;
        color: #d54e21;
 }
 
-#adminmenu li a #awaiting-mod {
+#adminmenu li a #awaiting-mod, #sidemenu li a #update-plugins {
        background-image: url(../images/comment-stalk-fresh.gif);
 }
 
-#adminmenu li a #awaiting-mod span, #rightnow .reallynow {
+#adminmenu li a #awaiting-mod span, #sidemenu li a #update-plugins span, #rightnow .reallynow {
        background-color: #d54e21;
        color: #fff;
 }
 
-#adminmenu li a:hover #awaiting-mod span {
+#adminmenu li a:hover #awaiting-mod span, #sidemenu li a:hover #update-plugins span {
        background-color: #264761;
 }
 
@@ -383,11 +384,11 @@ input.readonly {
        background-color: #fff;
 }
 
-#plugins .active {
+.plugins .active {
        background-color: #e7f7d3;
 }
 
-#plugins .togl {
+.plugins .togl {
        border-right-color: #ccc;
 }
 
@@ -395,7 +396,7 @@ input.readonly {
        background-color: #ffffe0;
 }
 
-#plugins tr {
+.plugins tr {
        background-color: #fff;
 }
 
@@ -532,7 +533,7 @@ div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover
 }
 
 /* Containers */
-.wp_themeSkin table {
+.wp_themeSkin table, #wp_editbtns {
        background: #cee1ef;
 }
 
@@ -688,3 +689,18 @@ div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover
        background-color: #ddd;
        color: #333;
 }
+
+/* Diff */
+
+table.diff .diff-deletedline {
+       background-color: #ffdddd;
+}
+table.diff .diff-deletedline del {
+       background-color: #ff9999;
+}
+table.diff .diff-addedline {
+       background-color: #ddffdd;
+}
+table.diff .diff-addedline ins {
+       background-color: #99ff99;
+}
index 29e59cf28b03b7bc58d0e9b0545c3b0cd36d64c3..3c4fd61aa576886b1d45a2925feb2db3f7a46cc1 100644 (file)
@@ -1,62 +1,62 @@
+/* Right Now */
 #rightnow {
-       margin-left: 15px;
+       margin-right:0;
+       margin-left: 7px;
 }
-
 #rightnow .reallynow span {
        text-align: right;
        float: right;
 }
-
 #rightnow .reallynow a {
        text-align: left;
        float: left;
        margin: 1px 0 0 6px;
 }
-
-h3.dashboard-widget-title span {
-       text-align: right;
-       float: right;
+/* Widgets */
+div#dashboard-widgets-wrap {
+       margin-right:0;
+       margin-left:-13px;
 }
-
-#dashboard-widgets .widget_rss ul li a {
+div.dashboard-widget-holder {
        float:right;
-       font-weight:bold;
-       margin:0pt 0pt 0.2em 0.5em;
 }
-
-#dashboard-widgets .widget_rss ul li span.rss-date {
+div.dashboard-widget {
+       margin-right:0;
+       margin-left: 20px;
+}
+h3.dashboard-widget-title span {
+       text-align: right;
        float: right;
 }
-
 h3.dashboard-widget-title small {
        text-align: left;
-       float: left;
+       float:left;
 }
-div.dashboard-widget-content ul,
-div.dashboard-widget-content ol,
-div.dashboard-widget-content dl {
+div.dashboard-widget-submit input  {
+       font-family: Tahoma;
+}
+div.dashboard-widget-content ul, div.dashboard-widget-content ol, div.dashboard-widget-content dl {
        padding-left:0;
        padding-right:15px;
 }
-div#dashboard-widgets-wrap
-{
-       margin-right:0;
-       margin-left:-10px;
+#dashboard_secondary div.dashboard-widget-content ul li {
+       float:right;
 }
-
-div.dashboard-widget {
-       margin-right:0;
-       margin-left:20px;
+#dashboard_secondary div.dashboard-widget-content ul li .post {
+       font-family:arial;
+}
+#dashboard_secondary div.dashboard-widget-content ul li a {
+       border-right:0 none;
+       border-left: 1px solid #dadada;
+       height:110px;
+}
+#dashboard_secondary div.dashboard-widget-content ul li a cite {
+       font-family: Tahoma;
 }
-
 #dashboard-widgets .widget_rss ul li span.rss-date {
        float:right;
 }
 #dashboard-widgets .widget_rss ul li a {
-       float:right;
-       margin:0 0 0.2em 0.5em;
+       float: right;
+       margin: 0 0 .2em .5em;
 }
-#dashboard_secondary div.dashboard-widget-content ul li a {
-       border-right:0 none;
-       border-left:1px solid #DADADA;
-}
\ No newline at end of file
diff --git a/wp-admin/css/global-rtl.css b/wp-admin/css/global-rtl.css
new file mode 100644 (file)
index 0000000..c1dfe5e
--- /dev/null
@@ -0,0 +1,31 @@
+body, td {
+       font-family: Tahoma;
+}
+textarea, input, select {
+       font-family: Tahoma;
+}
+h1, h2, h3 {
+       font-family:arial;
+}
+.widefat td {
+       padding: 7px 10px 9px 15px;
+}
+.widefat th {
+       padding: 9px 10px 6px 15px;
+       text-align: right;
+}
+.widefat th input {
+       margin: 0 8px 0 0;
+}
+.widefat .check-column {
+       text-align: left;
+}
+.wrap h2 {
+       font-family:arial;
+       margin: 5px -4px 0 0;
+       padding-right:0;
+       padding-left: 280px;
+}
+.wrap h2.long-header {
+       padding-left: 0;
+}
index 926aa88bd7aa1156221389385e4cc5003720785d..295adea8725e5d31295c3213b7ed6de7ecff2043 100644 (file)
@@ -194,3 +194,7 @@ th.check-column + th, th.check-column + td {
        padding-bottom: 7px;
        padding-right: 280px;
 }
+
+.wrap h2.long-header {
+       padding-right: 0;
+}
index 54cadd07bf8e962b97aa7caddd19a15dd6b244b4..1aa7cdb7db1518e7af15c535d0c44fd2d45b4b65 100644 (file)
@@ -1,53 +1,73 @@
-/* footer */
-body, td {
-       font-family: Tahoma,Verdana,sans-serif;
+#poststuff .postbox h3 {
+       padding-left:0;
+       padding-right: 23px;
 }
-
-.wrap {
-       text-align: right;
+* html #poststuff .postarea, * html #poststuff #titlediv {
+       margin-left:0;
+       margin-right: 3%;
 }
-
-.wrap h2 {
-       margin: 5px 0 0 4px;
-}
-
-#footer {
-       padding-left:50px;
+* html #poststuff h2 {
+       margin-right: 0;
 }
-#footer p {
-       background:none;
-       height:auto;
-       padding: 5px 5px 0;
-}
-
 #bh {
+       padding-right:0;
        padding-left: 15px;
-       padding-right: 0px;
 }
-/* write post */
+div#dashboard-widgets {
+       padding-right:0;
+       padding-left: 1px;
+}
+#tagchecklist span a {
+       margin: 4px -9px 0 0;
+}
 #poststuff .togbox {
-       margin-right:-16px;
+       margin-left:0;
+       margin-right: -19px;
 }
-#poststuff h3 {
-       padding-right:20px;
+.widefat th input {
+       margin: 0 5px 0 0;
 }
-
-p#widget-search, p#post-search {
-       padding-left: 15px;
+/* ---------- add by navid */
+#dashmenu { /* fix top right bottom in admin */
+       direction:ltr;
+}
+#sidemenu a { /* fix left admin buttom ex. plugins, options */
+       float:left;
 }
-
-.widefat th {
-       padding-bottom: 8px;
+.wrap h2 {
+       margin:5px 4px 0 0;
+}
+#editor-toolbar {/* fix hover in media uploader icon */
+       direction:ltr;
+}
+#TB_window { /* fix theme preview */
+       left:2%;
+}
+/* fix widget page */
+form#widgets-filter {
+       position:static;
 }
-
-/* template editor */
-#template textarea {
+#widget-search {
+       display:none;
+}
+/* fix manage comment page */
+ul.view-switch li {
        float:left;
 }
-
-/* Editor */
-
-.mceToolbar {
-       direction: ltr;
-       text-align: left;
-}
\ No newline at end of file
+form#posts-filter {
+       position:static;
+}
+#post-search {
+       display:none;
+}
+#submenu {
+       margin-right: 20px;
+}
+/* Fixes for media-upload window */
+/* Center media-upload panel on screen */
+#TB_window { 
+       width: 670px; 
+       position: absolute; 
+       top: 50%; 
+       left: 50%; 
+       margin-right: 335px !important; }
index 39ef2546374d009cbbc9005d084a4caf2fcc2258..e4d035548b1cb9af93df5ada915b88eca50bea89 100644 (file)
@@ -111,7 +111,10 @@ div#dashboard-widgets {
 .tablenav-pages {
        display: block;
        margin-top: -3px;
+}
 
+table.ie-fixed {
+       table-layout: fixed;
 }
 
 #post-search .button, #widget-search .button {
index 806dbc54b187204c59b660e3048c65d5e5a6c524..efef9612102bfd287808cc635da8c30fc36dab10 100644 (file)
@@ -1,19 +1,27 @@
 body {
-       font-size: 11px;;
+       font-family: Tahoma;
+}
+/* Half the page disapears on IE6 */
+* html body {
+       width: 700px; 
+       position: absolute; 
+       left: 50%; 
+       margin-right: 350px;
 }
 ul, ol {
        padding: 5px 22px 5px 5px;
 }
-.form-table th {
-       text-align: right;
+.step, th {
+       text-align:right;
 }
-input {
-       padding: 1px
+.submit input, .button, .button-secondary  {
+       font-family: Tahoma;
+       margin-right:0;
+}
+.form-table th {
+       text-align:right;
 }
-#logo {
-       text-align: left;
+h1 {
+       font-family:arial;
+       margin: 5px -4px 0 0;
 }
-#admin_email {
-       direction: ltr;
-       text-align: left;
-}
\ No newline at end of file
index 5f4164c6155fe98900b765419726d62de36b488d..cfa03253b575f0d38bf5d3c9677722435061ad91 100644 (file)
@@ -7,8 +7,10 @@ body {
        margin: 2em auto 0 auto;
        width: 700px;
        padding: 1em 2em;
+       -moz-border-radius: 12px;
+       -khtml-border-radius: 12px;
        -webkit-border-radius: 12px;
-       font-size: 62.5%;
+       border-radius: 12px;
 }
 
 a { color: #2583ad; text-decoration: none; }
@@ -25,34 +27,41 @@ h2 { font-size: 16px; }
 
 p, li {
        padding-bottom: 2px;
-       font-size: 1.3em;
-       line-height: 1.8em;
+       font-size: 13px;
+       line-height: 18px;
 }
 
 code {
-       font-size: 1.3em;
+       font-size: 13px;
 }
 
 ul, ol { padding: 5px 5px 5px 22px; }
 
 #logo { margin: 6px 0 14px 0px; border-bottom: none;}
 
-.step a, .step input { font-size: 2em; }
+.step {
+       margin: 20px 0 15px;
+}
 
-td input { font-size: 1.5em; }
+.step input {
+       font-size: 18px;
+}
+
+a.button {
+       font-size: 18px;
+}
 
 .step, th { text-align: left; padding: 0; }
 
 .submit input, .button, .button-secondary {
        font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
-       padding: 6px;
-       border: none;
+       padding: 5px 7px 7px;
+       border: 1px solid #a3a3a3;
        margin-left: 0;
-       font-size: 13px !important;
-       -moz-border-radius: 2px;
-       -khtml-border-radius: 2px;
-       -webkit-border-radius: 2px;
-       border-radius: 2px;
+       -moz-border-radius: 3px;
+       -khtml-border-radius: 3px;
+       -webkit-border-radius: 3px;
+       border-radius: 3px;
        color: #246;
        background: #e5e5e5;
 }
@@ -63,6 +72,7 @@ td input { font-size: 1.5em; }
 
 .submit input:hover, .button:hover, .button-secondary:hover {
        color: #d54e21;
+       border-color: #535353;
 }
 
 .form-table {
@@ -75,12 +85,13 @@ td input { font-size: 1.5em; }
        margin-bottom: 9px;
        padding: 10px;
        border-bottom: 8px solid #fff;
+       font-size: 12px;
 }
 
 .form-table th {
-       font-size: 12px;
+       font-size: 13px;
        text-align: left;
-       padding: 12px 10px 10px 10px;
+       padding: 16px 10px 10px 10px;
        border-bottom: 8px solid #fff;
        width: 110px;
        vertical-align: top;
@@ -100,6 +111,12 @@ td input { font-size: 1.5em; }
        font-size: 11px;
 }
 
+.form-table input {
+       line-height: 20px;
+       font-size: 15px;
+       padding: 2px;
+}
+
 h1 {
        border-bottom: 1px solid #dadada;
        clear: both;
@@ -116,9 +133,10 @@ h1 {
 
 #error-page p {
        font-size: 14px;
-       line-height: 1.6em;
+       line-height: 16px;
+       margin: 25px 0 20px;
 }
 
 #error-page code {
-       font-size: 1em;
+       font-size: 15px;
 }
\ No newline at end of file
index fc272634ae22404b44f6a2896bb0a06054423695..daefbacb6af8c31fd41012fa961615e4756784b9 100644 (file)
@@ -1,32 +1,37 @@
 body {
-       font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
-       direction: rtl;
+       font-family: Tahoma;
 }
 form {
        margin-left:0;
-       margin-right:8px;
+       margin-right: 8px;
 }
 form .forgetmenot {
        float:right;
 }
+#login form .submit input  {
+       font-family: Tahoma;
+}
 form .submit {
        float:left;
 }
+#backtoblog a {
+       left:auto;
+       right:15px;
+}
 #login_error, .message {
-       margin:0 8px 16px 0;
+       margin: 0 8px 16px 0;
 }
 #nav {
-       margin: 0 8px 0 0;
+       margin:0 8px 0 0;
 }
 #user_pass, #user_login, #user_email {
        margin-right:0;
        margin-left: 6px;
-       direction:ltr;
 }
 h1 a {
        text-decoration:none;
 }
-#backtoblog a {
-       left: auto;
-       right: 15px;
-}
\ No newline at end of file
+/* ltr input */
+#user_login, #user_pass {
+       direction:ltr;
+}
index f0c00dfe7b4324f4c1280ef465d8e3a39f8649c5..b23ad0e88c8d789eb3d1b41231f955cd76007a41 100644 (file)
@@ -1,21 +1,66 @@
-ul#sidemenu {
-       left: auto;
-       right: 0;
+body#media-upload ul#sidemenu {
+       left:auto;
+       right:0;
+       width: 620px;
+}
+#search-filter {
+       text-align:left;
 }
 .align .field label {
-       display: block;
+       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 label {
+       margin: 0 0 0 1em;
+}
+.filename.original {
        float: right;
-       padding: 0 25px 0 0;
-       margin: 5px 3px 5px 5px; 
 }
-.align .field input {
-       display: block;
+.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;
+}
+.bar {
+       border-right-width:0;
+       border-left-width: 3px;
+       border-left-style: solid;
+}
+.media-item .pinkynail {
+       float:right;
+}
+.describe-toggle-on, .describe-toggle-off {
+       float: left;
+       margin-right:0;
+       margin-left: 20px;
+}
+/* Specific to Uploader */
+
+#media-upload .media-upload-form p {
+       margin: 0 0 1em 1em;
+}
+.filename {
        float: right;
-       margin: 5px 15px 5px 0;
-}
-.image-align-none-label,
-.image-align-left-label,
-.image-align-center-label,
-.image-align-right-label {
-       background-position: center right;
-}
\ No newline at end of file
+       margin-left:0;
+       margin-right: 10px;
+}
+#media-upload .describe th.label {
+       text-align:right;
+}
+.menu_order {
+       float:left;
+}
index c77a069c21c0377708048743e47c422bbc24b472..d04866afe0da6e0d16c804062ab12e844af24725 100644 (file)
@@ -32,6 +32,7 @@ form {
 .media-upload-form label, .media-upload-form legend {
        display:block;
        font-weight: bold;
+       font-size: 13px;
        margin-bottom: 0.5em;
        margin: 0 0 0.5em 0;
 }
@@ -196,6 +197,11 @@ abbr.required {
 #media-upload .media-upload-form p {
        margin: 0 1em 1em 0;
 }
+
+#media-upload .media-upload-form p.ml-submit {
+       padding: 1em 0;
+}
+
 #media-upload p.help {
        font-style: italic;
        font-weight: normal;
@@ -217,10 +223,17 @@ abbr.required {
        min-height: 36px;
        width: 100%;
 }
+
+#media-upload .ui-sortable .media-item {
+       cursor: move;
+}
+
 .filename {
+       float: left;
        line-height: 36px;
        margin-left: 10px;
-       float: left;
+       overflow: hidden;
+       max-width: 430px;
 }
 #media-upload .describe {
        border-top-width: 1px;
@@ -228,6 +241,7 @@ abbr.required {
        padding: 5px;
        width: 100%;
        clear: both;
+       cursor: default;
 }
 #media-upload .describe th.label {
        padding-top: .5em;
@@ -240,3 +254,62 @@ abbr.required {
        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;
+}
+
+#media-upload a.delete,
+#media-upload a.del-link {
+       padding: 0 3px 1px;
+}
+
+#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 #DDDDDD;
+       font-size: 10px;
+       padding: 1px;
+       width: 23px;
+}
+
+.ui-sortable-helper {
+       background-color: #fff;
+       border: 1px solid #aaa;
+       opacity: 0.6;
+       filter: alpha(opacity=60);
+}
+
+#media-upload th.order-head {
+        width: 25%;
+        text-align: center;
+}
+
+#media-upload .widefat {
+       width: 626px;
+       border-style: solid solid none;
+}
+
+.sorthelper {
+       z-index: -1;
+}
diff --git a/wp-admin/css/press-this-ie-rtl.css b/wp-admin/css/press-this-ie-rtl.css
new file mode 100644 (file)
index 0000000..912e0e2
--- /dev/null
@@ -0,0 +1,3 @@
+.ui-tabs-nav {
+       margin-right: 0;
+}
diff --git a/wp-admin/css/press-this-ie.css b/wp-admin/css/press-this-ie.css
new file mode 100644 (file)
index 0000000..e9667c1
--- /dev/null
@@ -0,0 +1,7 @@
+#posting {
+       position: static !important;
+}
+ .ui-tabs-nav {
+       margin-left: 0;
+       border: 0 !important;
+}
diff --git a/wp-admin/css/press-this-rtl.css b/wp-admin/css/press-this-rtl.css
new file mode 100644 (file)
index 0000000..f75d7ec
--- /dev/null
@@ -0,0 +1,98 @@
+body {
+       font-family: Tahoma;
+}
+.ui-tabs-nav {
+       padding-left:0;
+       padding-right:8px;
+}
+.ui-tabs-nav li {
+       float: right;
+}
+.button {
+       font-family: Tahoma;
+       margin-left:0;
+       margin-right: 5px;
+}
+#wphead #viewsite {
+       margin-left:0;
+       margin-right: 10px;
+}
+#viewsite {
+       right:auto;
+       left: 8px;
+}
+#wphead #viewsite a {
+       font-family: Tahoma;
+}
+h1 {
+       right:auto;
+       left:0;
+}
+div#posting {
+       padding-left:0;
+       padding-right: 16px;
+}
+#photo_directions span {
+       right:auto;
+       left:3px;
+}
+#img_container a {
+       float:right;
+}
+#img_container a, #img_container a:link, #img_container a:visited {
+       margin:0 0 4px 4px;
+}
+div#categories {
+       right:auto;
+       left:16px;
+}
+div#categories h2 {
+       margin: .5em 1em .5em 0;
+}
+#tagsdiv #newtag {
+       margin-right:0; 
+       margin-left: 5px;       
+}
+#jaxtag {
+       padding-left:0;
+       padding-right: 1em;
+}
+#tagchecklist {
+       padding-left:0;
+       padding-right: 1em;
+}
+#tagchecklist span {
+       margin-right: 10px;
+       margin-left: .5em;
+       float: right;
+}
+#tagchecklist span a {
+       margin: 6px -9px 0pt 0;
+       float: right;
+}
+.submitbox {
+       float: left;
+}
+.submitbox .submit input {
+       text-align:right;
+}
+.video_split #extra_fields {
+       float:right;
+}
+.video_split .editor_area {
+       float: left;
+}
+.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;
+}
diff --git a/wp-admin/css/press-this.css b/wp-admin/css/press-this.css
new file mode 100644 (file)
index 0000000..daf60ba
--- /dev/null
@@ -0,0 +1,521 @@
+body {
+       font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
+       color: #333;
+       margin: 0px;
+       padding: 0px;
+}
+
+img { border: 0; }
+/* Tabs */
+@media projection , screen {
+       .ui-tabs-hide {
+               display: none;
+       }
+}
+
+@media print {
+       .ui-tabs-nav {
+               display: none;
+       }
+}
+
+.ui-tabs-nav {
+       list-style: none;
+       border-bottom: 1px solid #C6D9E9;
+       padding-left: 8px;
+       margin-bottom: .5em;
+       margin-top: -2em;
+}
+
+/* Additional IE specific bug fixes... */
+* html .ui-tabs-nav { /* auto clear, @ IE 6 & IE 7 Quirks Mode */
+       display: inline-block;
+}
+
+* :first-child+html .ui-tabs-nav {
+       /* @ IE 7 Standards Mode - do not group selectors, otherwise IE 6 will ignore complete rule (because of the unknown + combinator)... */
+       display: inline-block;
+}
+
+.ui-tabs-nav:after {
+       /* clearing without presentational markup, IE gets extra treatment */
+       display: block;
+       clear: both;
+       content: " ";
+}
+
+.ui-tabs-nav li {
+       float: left;
+       margin: 0;
+       height: 2em;
+       line-height: 2em;
+}
+
+.ui-tabs-nav a,.ui-tabs-nav a span {
+       display: block;
+}
+
+.ui-tabs-nav a {
+       margin: 1px 0 0;
+       /* position: relative makes opacity fail for disabled tab in IE */
+       padding-left: 0;
+       color: #27537a;
+       font-weight: bold;
+       line-height: 2em;
+       text-align: center;
+       text-decoration: none;
+       white-space: nowrap; /* required in IE 6 */
+       outline: 0; /* prevent dotted border in Firefox */
+       padding: 0 1em;
+}
+
+.ui-tabs-nav .ui-tabs-selected a {
+       position: relative;
+       top: 1px;
+       z-index: 2;
+       margin-top: 0;
+       -moz-border-radius-topleft: 4px;
+       -moz-border-radius-topright: 4px;
+       -webkit-border-top-left-radius: 4px;
+       -webkit-border-top-right-radius: 4px;
+       border-style: solid;
+       border-width: 1px;
+       background: white;
+       border-bottom-width: 2px;
+       margin-top: -2px;
+}
+
+.ui-tabs-nav a:hover,.ui-tabs-nav a:focus,.ui-tabs-nav a:active,
+.ui-tabs-nav .ui-tabs-selected a:link,.ui-tabs-nav .ui-tabs-selected a:visited { 
+       cursor: pointer;
+}
+
+/* Header */
+#wphead {
+       border-top: none;
+       height: 2em;
+       padding-top: 8px;
+}
+
+.button {
+       font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
+       padding: 3px 5px;
+       font-size: 12px;
+       line-height: 1.5em;
+       border-width: 1px;
+       border-style: solid;
+       -moz-border-radius: 3px;
+       -khtml-border-radius: 3px;
+       -webkit-border-radius: 3px;
+       border-radius: 3px;
+       cursor: pointer;
+       margin-left: 5px;
+       text-decoration: none;
+}
+
+.howto {
+       font-size: 11px;
+       font-style: italic;
+       display: block;
+}
+
+#wphead #viewsite {
+       position: absolute;
+       margin-top: 12px;
+       margin-left: 10px;
+}
+
+#viewsite {
+       position: relative;
+       right: 8px;
+       top: 6px;
+       margin: 0 !important;
+}
+
+#wphead #viewsite a {
+       font: 12px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
+       padding: 3px 4px;
+       display: block;
+       letter-spacing: normal;
+       border-width: 1px;
+       border-style: solid;
+       -moz-border-radius: 3px;
+       -khtml-border-radius: 3px;
+       -webkit-border-radius: 3px;
+       border-radius: 3px;
+       text-decoration: none;
+}
+
+#previewview {
+       padding-top: 8px !important;
+       padding-bottom: 8px !important;
+}
+
+h1 {
+       font-size: .75em;
+       line-height: 2.666em;
+       top: .5em;
+       right: 0;
+       margin: 0 !important;
+       padding: 0 !important;
+       width: 236px;
+       background: none;
+}
+
+input.text {
+       border: 0pt none;
+       outline-color: -moz-use-text-color;
+       outline-style: none;
+       outline-width: medium;
+       padding: 0pt;
+       width: 100%;
+       border-style: solid;
+       color: #333333;
+}
+
+/* Editor/Main Column */
+
+div#container {
+       margin: 0;
+       min-width: 500px;
+}
+
+div#container form {
+       margin: 0px;
+       padding: 0px;
+}
+
+div#posting {
+       padding-left: 16px;
+       position: absolute;
+       z-index: 1;
+       width: 66%;
+}
+
+#post_title {
+       width: 99%;
+}
+
+.titlewrap {
+       border-style: solid;
+       border-width: 1px;
+       padding: 2px 3px;
+       border-color: #CCCCCC;
+}
+
+div#posting h2 {
+       margin: .5em 0 .25em 0;
+       font-size: 12px;
+       padding: 3px;
+       background: ;
+}
+
+.editor-container {
+       border-width: 1px;
+       border-color: #ccc;
+       border-style: solid;
+       margin-bottom: 1em;
+}
+
+/* Photo Styles */
+
+#photo_directions {
+       margin-top: .25em;
+       display: block;
+       position: relative;
+}
+
+#photo_directions span {
+       display: block;
+       position: absolute;
+       top: 0;
+       right: 3px;
+}
+
+#photo_saving {
+       margin: 0 8px 8px;
+       vertical-align: middle;
+}
+
+#img_container {
+       background-color: #fff;
+       overflow: auto;
+       height: 100px;
+}
+
+#img_container a {
+       display: block;
+       width: 79px;
+       height: 79px;
+       float: left;
+}
+
+#img_container img {
+       width: 75px;
+       height: 75px;
+       border: 0px;
+       padding: 2px;
+       background-color: #f4f4f4;
+       cursor: pointer;
+}
+#img_container a, #img_container a:link, #img_container a:visited {
+       border: 2px solid #ccc;
+       margin: 0 4px 4px 0;
+} 
+#img_container a:hover, #img_container a:active {
+       border: 2px solid #000;
+}
+
+/* Submit Column */
+
+div#categories {
+       font-size: 85%;
+       position: absolute;
+       top: 50px;
+       right: 16px;
+       width: 27%;
+       z-index: 2;
+}
+
+div#categories h2 {
+       color: #333;
+       font-size: 12px;
+       margin: .5em 0 .5em 1em;
+       padding: 0;
+}
+
+#categories-all {
+       overflow: auto;
+       padding: 0 1em 1em 1em;
+       height: 15em;
+}
+
+#categories ul {
+       list-style: none;
+       padding: 0;
+       margin: 0;
+}
+
+#tagsdiv #newtag {
+       padding: 3px;
+       margin-right: 5px;
+       width: 16em;    
+}
+
+#jaxtag {
+       clear: both;
+       padding-left: 1em;
+       margin: 0;
+}
+
+#tagchecklist {
+       padding-left: 1em;
+       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 0pt 0pt -9px;
+       cursor: pointer;
+       width: 10px;
+       height: 10px;
+       display: block;
+       float: left;
+       text-indent: -9999px;
+       overflow: hidden;
+       position: absolute;
+}
+.submit {
+       -moz-border-radius-bottomleft: 3px;
+       -khtml-border-bottom-left-radius: 3px;
+       -webkit-border-bottom-left-radius: 3px;
+       border-bottom-left-radius: 3px;
+       -moz-border-radius-bottomright: 3px;
+       -khtml-border-bottom-right-radius: 3px;
+       -webkit-border-bottom-right-radius: 3px;
+       border-bottom-right-radius: 3px;
+       margin: 0;
+       padding: 10px;
+}
+.submitbox {
+       width: 100%;
+       float: right;
+}
+
+.submitbox .submit a:hover {
+       border-bottom-width: 1px;
+       border-bottom-style: solid;
+}
+
+.submitbox .submit input {
+       border: none;
+       text-align: left;
+       padding: 6px 4px;
+       font-size: 12px;
+       margin: 2px;
+       -moz-border-radius: 3px;
+       -khtml-border-radius: 3px;
+       -webkit-border-radius: 3px;
+       border-radius: 3px;
+       cursor: pointer;
+}
+
+.submitbox #previewview {
+       padding: 15px 10px;
+       -moz-border-radius-topleft: 3px;
+       -khtml-border-top-left-radius: 3px;
+       -webkit-border-top-left-radius: 3px;
+       border-top-left-radius: 3px;
+       -moz-border-radius-topright: 3px;
+       -khtml-border-top-right-radius: 3px;
+       -webkit-border-top-right-radius: 3px;
+       border-top-right-radius: 3px;
+}
+
+/* Video Styles */
+.video_split #extra_fields {
+       width: 27%;
+       height: 300px;
+       float: left;
+}
+
+#embed_code {
+       border: 0;
+       width: 99%;
+       height: 200px;
+}
+.video_split .editor_area {
+       width: 70%;
+       float: right;
+}
+
+.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;
+}
+
+.photolist {
+       display: none;
+}
+
+#extra_fields small {
+       display: block;
+       margin-top: .5em;
+       padding-bottom: .25em;
+}
+
+#TB_ajaxContent #options {
+       position: absolute;
+       top: 20px;
+       right: 25px;
+       padding: 5px;
+}
+#TB_ajaxContent h3 {
+       margin-bottom: .25em;
+}
+
+.updated {
+       margin: 0;
+       margin-left: 15px;
+       margin-right: 15px;
+       padding: 0;
+       max-width: 980px;
+       border-width: 1px;
+       border-style: solid;
+       padding: 0 0.6em;
+       max-width: 950px;
+       margin-top: 1em;
+       margin-bottom: 1em;
+}
+
+.updated p, .error p {
+       margin: 0.6em 0;
+}
+
+.updated a, .error a {
+       text-decoration: underline;
+}
+
+.updated a {
+       text-decoration: none;
+       padding-bottom: 2px;
+}
+
+#post_status {
+       margin-left: 10px;
+       margin-bottom: 1em;
+       display: block;
+}
+
+/* Footer */
+
+#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;
+}
+
+
+/* Utility Classes */
+.centered {
+       text-align: center;
+}
+
+.hidden {
+       display: none;
+}
\ No newline at end of file
index 407886b284c31867f0fd570f363e652649dcddee..7b9f31bb2b20a1fb823abe42862a9eecb8ebe331 100644 (file)
@@ -1,11 +1,15 @@
+#template textarea {
+       font-family:monospace;
+}
 #templateside {
        float:left;
 }
 #themeselector {
        padding-right:0;
-       padding-left:5px;
+       padding-left: 5px;
+       float: left;
 }
 div.tablenav {
-       margin-left:210px;
        margin-right:0;
-}
\ No newline at end of file
+       margin-left: 210px;
+}
index e17aadc215bb33685202b24e0cdb028b10a0ddff..70838cd41aeba9fbadff68fe7afd50ef7942de24 100644 (file)
@@ -1,50 +1,45 @@
+/* 2 column liquid layout */
 div.widget-liquid-left-holder {
-       clear:right;
-       float:right;
+       float: right;
+       clear: right;
        margin-right:0;
-       margin-left:-310px;
+       margin-left: -310px;
 }
 div.widget-liquid-left {
        margin-right:0;
-       margin-left:310px;
+       margin-left: 320px;
 }
 div.widget-liquid-right {
-       clear:left;
-       float:left;
+       float: left;
+       clear: left;
 }
 p#widget-search {
+       right:auto;
        left:0;
-       right:auto
+}
+h4.widget-title span {
+       float: right;
+}
+h4.widget-title a {
+       float: left;
+       margin-left:0;
+       margin-right: 1em;
 }
 ul#widget-list li.widget-list-item h4.widget-title {
        float:right;
-       text-align:right;
 }
 ul#widget-list li.widget-list-item div.widget-description {
-       margin:0 200px 0 0;
-       padding:0 4em 0 0;
+       margin: 0 200px 0 0;
+       padding: 0 4em 0 0;
 }
 .widget-control-save, .widget-control-remove {
-       float:right;
        margin-right:0;
-       margin-left:8px;
+       margin-left: 8px;
+       float: right;
 }
-h4.widget-title a {
-       right:auto;
-       left:1em;
-}
-li.widget-list-control-item h4.widget-title a, #dragHelper li.widget-list-control-item h4.widget-title a, #draghelper li.widget-list-control-item h4.widget-title a:visited {
+li.widget-list-control-item h4.widget-title a,
+#dragHelper li.widget-list-control-item h4.widget-title a,
+#draghelper li.widget-list-control-item h4.widget-title a:visited {
        right:auto;
-       left:1em;
-}
-
-li.widget-list-control-item div.widget-control {
-       padding:0 0 0 10px;
-}
-ul.widget-control-list div.widget-control-actions {
-       margin-right:0;
-       margin-left:-10px;
+       left: 1em;
 }
-ul.widget-control-list .widget-title {
-       text-align:right;
-}
\ No newline at end of file
index 5d044cf6dcf75739b98b07a4c91066ad012fd93f..f21f22a1cc178c68d7efedc5ace9e5643f10d84a 100644 (file)
@@ -45,10 +45,20 @@ ul#widget-list li.widget-list-item {
        margin: 0;
        border-bottom-width: 1px;
        border-bottom-style: solid;
-       background-color: transparent;
        line-height: 1;
 }
 
+h4.widget-title span {
+       float: left;
+}
+
+h4.widget-title a {
+       float: right;
+       text-decoration: underline;
+       border-bottom: none;
+       margin-left: 1em;
+}
+
 ul#widget-list li.widget-list-item h4.widget-title {
        position: relative;
        margin: 0;
@@ -59,7 +69,7 @@ ul#widget-list li.widget-list-item h4.widget-title {
        -moz-border-radius: 3px;
        -khtml-border-radius: 3px;
        -webkit-border-radius: 3px;
-       border-radius: 3px;;
+       border-radius: 3px;
 }
 
 #dragHelper h4.widget-title {
@@ -74,7 +84,6 @@ ul#widget-list li.widget-list-item div.widget-description {
        font-size: 11px;
 }
 
-
 ul#widget-list li.widget-list-item ul.widget-control-info {
        display: none;
 }
@@ -91,27 +100,26 @@ ul.widget-control-list {
        padding: 0 1em;
 }
 
-ul.widget-control-list li {
-       position: relative;
-}
-
 div#current-widgets p.submit {
        padding: 1em;
 }
 
 li.widget-list-control-item {
-       margin: 0 0 1em;
+       margin: 1em 0;
        -moz-border-radius: 3px;
        -khtml-border-radius: 3px;
        -webkit-border-radius: 3px;
        border-radius: 3px;
 }
 
-li.widget-list-control-item h4, #dragHelper li.widget-list-control-item h4, li.widget-sortable h4 {
+li.widget-list-control-item h4, 
+#dragHelper li.widget-list-control-item h4, 
+li.widget-sortable h4 {
        margin: 0;
-       padding: 0.4em 2.5em 0.4em 0.8em;
        cursor: move;
        font-size: 13px;
+       padding: 0.4em 0.8em;
+       position: relative;
        -moz-border-radius: 3px;
        -khtml-border-radius: 3px;
        -webkit-border-radius: 3px;
@@ -129,13 +137,6 @@ li.widget-list-control-item h4, #dragHelper li.widget-list-control-item h4, li.w
        text-decoration: none;
 }
 
-h4.widget-title a {
-       position: absolute;
-       right: 1em;
-       text-decoration: underline;
-       border-bottom: none;
-}
-
 li.widget-list-control-item h4.widget-title a,
 #dragHelper li.widget-list-control-item h4.widget-title a,
 #draghelper li.widget-list-control-item h4.widget-title a:visited {
@@ -143,16 +144,15 @@ li.widget-list-control-item h4.widget-title a,
 }
 
 li.widget-list-control-item h4.widget-title a:hover {
-
        text-decoration: none;
        border-bottom: none;
 }
 
 li.widget-list-control-item div.widget-control {
        display: none;
-       margin: 1em;
-       padding: 0 10px 0 7px; /* Correction for padding, margin, border of inputs */
+       padding: 15px;
        font-size: 11px;
+       position: relative;
 }
 
 li.widget-list-control-item div.widget-control p {
@@ -161,15 +161,9 @@ li.widget-list-control-item div.widget-control p {
 }
 
 ul.widget-control-list div.widget-control-actions {
-       margin-right: -10px; /* Correction for padding, margin, border of inputs */
-       margin-left: -6px;
        border-top-width: 1px;
        border-top-style: solid;
-       padding: 0.5em 0 0.8em;
-}
-
-ul.widget-control-list .widget-title {
-       
+       padding: 0.5em 0 0;
 }
 
 .widget-control-edit {
index c54d9a924122617c76e931818e44dfd3a28aa0a0..b1f583d144071bfad226299221ea01b41e45f602 100644 (file)
@@ -189,7 +189,7 @@ Event.observe( window, 'load', hide_text );
 <div id="desc"><?php bloginfo('description');?></div>
 </div>
 <?php if ( !defined( 'NO_HEADER_TEXT' ) ) { ?>
-<form method="post" action="<?php echo get_option('siteurl') ?>/wp-admin/themes.php?page=custom-header&amp;updated=true">
+<form method="post" action="<?php echo admin_url('themes.php?page=custom-header&amp;updated=true') ?>">
 <input type="button" value="<?php _e('Hide Text'); ?>" onclick="hide_text()" id="hidetext" />
 <input type="button" value="<?php _e('Select a Text Color'); ?>" onclick="colorSelect($('textcolor'), 'pickcolor')" id="pickcolor" /><input type="button" value="<?php _e('Use Original Color'); ?>" onclick="colorDefault()" id="defaultcolor" />
 <?php wp_nonce_field('custom-header') ?>
index 60368c2f0abd2394246b27af52833d4c05641d39..f32cfd4fdaa848b0a1259b6da2dfd30ecc089f6e 100644 (file)
@@ -26,18 +26,18 @@ if ( ! empty($cat_ID) ) {
        <table class="form-table">
                <tr class="form-field form-required">
                        <th scope="row" valign="top"><label for="cat_name"><?php _e('Category Name') ?></label></th>
-                       <td><input name="cat_name" id="cat_name" type="text" value="<?php echo attribute_escape($category->name); ?>" size="40" /><br />
+                       <td><input name="cat_name" id="cat_name" type="text" value="<?php echo attribute_escape($category->name); ?>" size="40" aria-required="true" /><br />
             <?php _e('The name is used to identify the category almost everywhere, for example under the post or in the category widget.'); ?></td>
                </tr>
                <tr class="form-field">
                        <th scope="row" valign="top"><label for="category_nicename"><?php _e('Category Slug') ?></label></th>
-                       <td><input name="category_nicename" id="category_nicename" type="text" value="<?php echo attribute_escape($category->slug); ?>" size="40" /><br />
+                       <td><input name="category_nicename" id="category_nicename" type="text" value="<?php echo attribute_escape(apply_filters('editable_slug', $category->slug)); ?>" size="40" /><br />
             <?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></td>
                </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('hide_empty=0&name=category_parent&orderby=name&selected=' . $category->parent . '&hierarchical=1&show_option_none=' . __('None')); ?><br />
+                               <?php wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'category_parent', 'orderby' => 'name', 'selected' => $category->parent, 'hierarchical' => true, 'show_option_none' => __('None'))); ?><br />
                 <?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?>
                        </td>
                </tr>
index bc62681bc4b6e415d1bf37694b4082bca21b897b..62fb2df69d1ab1e23e7d3a09dc75a4e4d7dbd194 100644 (file)
@@ -12,8 +12,7 @@ if ( !empty( $_REQUEST['delete_comments'] ) ) {
        $comments_deleted = $comments_approved = $comments_unapproved = $comments_spammed = 0;
        foreach ($_REQUEST['delete_comments'] as $comment) : // Check the permissions on each
                $comment = (int) $comment;
-               $post_id = (int) $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = $comment");
-               // $authordata = get_userdata( $wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $post_id") );
+               $post_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d", $comment) );
                if ( !current_user_can('edit_post', $post_id) )
                        continue;
                if ( !empty( $_REQUEST['spamit'] ) ) {
@@ -31,6 +30,8 @@ if ( !empty( $_REQUEST['delete_comments'] ) ) {
                }
        endforeach;
        $redirect_to = basename( __FILE__ ) . '?deleted=' . $comments_deleted . '&approved=' . $comments_approved . '&spam=' . $comments_spammed . '&unapproved=' . $comments_unapproved;
+       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']) )
@@ -97,7 +98,7 @@ if ( isset( $_GET['approved'] ) || isset( $_GET['deleted'] ) || isset( $_GET['sp
 <?php
 $status_links = array();
 $num_comments = wp_count_comments();
-$stati = array('moderated' => sprintf(__ngettext('Awaiting Moderation (%s)', 'Awaiting Moderation (%s)', $num_comments->moderated), "<span class='comment-count'>$num_comments->moderated</span>"), 'approved' => _c('Approved|plural'));
+$stati = array('moderated' => sprintf(__ngettext('Awaiting Moderation (%s)', 'Awaiting Moderation (%s)', number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"), 'approved' => _c('Approved|plural'));
 $class = ( '' === $comment_status ) ? ' class="current"' : '';
 $status_links[] = "<li><a href=\"edit-comments.php\"$class>".__('Show All Comments')."</a>";
 foreach ( $stati as $status => $label ) {
@@ -117,6 +118,7 @@ unset($status_links);
 </ul>
 
 <p id="post-search">
+       <label class="hidden" for="post-search-input"><?php _e( 'Search Comments' ); ?>:</label>
        <input type="text" id="post-search-input" name="s" value="<?php echo $search; ?>" />
        <input type="submit" value="<?php _e( 'Search Comments' ); ?>" class="button" />
 </p>
@@ -132,22 +134,24 @@ unset($status_links);
 
 <?php
 
+$comments_per_page = apply_filters('comments_per_page', 20, $comment_status);
+
 if ( isset( $_GET['apage'] ) )
        $page = abs( (int) $_GET['apage'] );
 else
        $page = 1;
 
-$start = $offset = ( $page - 1 ) * 20;
+$start = $offset = ( $page - 1 ) * $comments_per_page;
 
-list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, 25 ); // Grab a few extra
+list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, $comments_per_page + 5 ); // Grab a few extra
 
-$comments = array_slice($_comments, 0, 20);
-$extra_comments = array_slice($_comments, 20);
+$comments = array_slice($_comments, 0, $comments_per_page);
+$extra_comments = array_slice($_comments, $comments_per_page);
 
 $page_links = paginate_links( array(
        'base' => add_query_arg( 'apage', '%#%' ),
        'format' => '',
-       'total' => ceil($total / 20),
+       'total' => ceil($total / $comments_per_page),
        'current' => $page
 ));
 
@@ -173,6 +177,9 @@ if ( $page_links )
 <input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
 <?php do_action('manage_comments_nav', $comment_status); ?>
 <?php wp_nonce_field('bulk-comments'); ?>
+<?php if ( isset($_GET['apage']) ) { ?>
+       <input type="hidden" name="apage" value="<?php echo absint( $_GET['apage'] ); ?>" />
+<?php } ?>
 </div>
 
 <br class="clear" />
@@ -186,7 +193,7 @@ if ($comments) {
 <table class="widefat">
 <thead>
   <tr>
-    <th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('comments-form'));" /></th>
+    <th scope="col" class="check-column"><input type="checkbox" /></th>
     <th scope="col"><?php _e('Comment') ?></th>
     <th scope="col"><?php _e('Date') ?></th>
     <th scope="col" class="action-links"><?php _e('Actions') ?></th>
index 85042a149633afd7ee04b0e6a02fc83cc68d293f..983bc27d8d06abe238cf5fede35ff20ff856a229 100644 (file)
@@ -1,12 +1,46 @@
- <?php
-$action = isset($action)? $action : '';
+<?php
+
+$action = isset($action) ? $action : '';
 if ( isset($_GET['message']) )
        $_GET['message'] = absint( $_GET['message'] );
 $messages[1] = sprintf( __( 'Post updated. Continue editing below or <a href="%s">go back</a>.' ), attribute_escape( stripslashes( $_GET['_wp_original_http_referer'] ) ) );
 $messages[2] = __('Custom field updated.');
 $messages[3] = __('Custom field deleted.');
 $messages[4] = __('Post updated.');
+
+if ( isset($_GET['revision']) )
+       $messages[5] = sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) );
+
+$notice = false;
+$notices[1] = __( 'There is an autosave of this post that is more recent than the version below.  <a href="%s">View the autosave</a>.' );
+
+if ( !isset($post_ID) || 0 == $post_ID ) {
+       $form_action = 'post';
+       $temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post()
+       $form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />";
+       $autosave = false;
+} else {
+       $post_ID = (int) $post_ID;
+       $form_action = 'editpost';
+       $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
+       $autosave = wp_get_post_autosave( $post_id );
+
+       // Detect if there exists an autosave newer than the post and if that autosave is different than the post
+       if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt ) > mysql2date( 'U', $post->post_modified_gmt ) ) {
+               foreach ( _wp_post_revision_fields() as $autosave_field => $_autosave_field ) {
+                       if ( wp_text_diff( $autosave->$autosave_field, $post->$autosave_field ) ) {
+                               $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) );
+                               break;
+                       }
+               }
+               unset($autosave_field, $_autosave_field);
+       }
+}
+
 ?>
+<?php if ( $notice ) : ?>
+<div id="notice" class="error"><p><?php echo $notice ?></p></div>
+<?php endif; ?>
 <?php if (isset($_GET['message'])) : ?>
 <div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
 <?php endif; ?>
@@ -20,33 +54,15 @@ $messages[4] = __('Post updated.');
 <h2><?php _e('Write Post') ?></h2>
 <?php
 
-if (!isset($post_ID) || 0 == $post_ID) {
-       $form_action = 'post';
-       $temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post()
-       $form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />";
+if ( !isset($post_ID) || 0 == $post_ID)
        wp_nonce_field('add-post');
-} else {
-       $post_ID = (int) $post_ID;
-       $form_action = 'editpost';
-       $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
+else
        wp_nonce_field('update-post_' .  $post_ID);
-}
 
 $form_pingback = '<input type="hidden" name="post_pingback" value="' . (int) get_option('default_pingback_flag') . '" id="post_pingback" />';
 
 $form_prevstatus = '<input type="hidden" name="prev_status" value="' . attribute_escape( $post->post_status ) . '" />';
 
-$form_trackback = '<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. attribute_escape( str_replace("\n", ' ', $post->to_ping) ) .'" />';
-
-if ('' != $post->pinged) {
-       $pings = '<p>'. __('Already pinged:') . '</p><ul>';
-       $already_pinged = explode("\n", trim($post->pinged));
-       foreach ($already_pinged as $pinged_url) {
-               $pings .= "\n\t<li>" . wp_specialchars($pinged_url) . "</li>";
-       }
-       $pings .= '</ul>';
-}
-
 $saveasdraft = '<input name="save" type="submit" id="save" class="button" tabindex="3" value="' . attribute_escape( __('Save and Continue Editing') ) . '" />';
 
 ?>
@@ -57,14 +73,7 @@ $saveasdraft = '<input name="save" type="submit" id="save" class="button" tabind
 <input type="hidden" id="post_author" name="post_author" value="<?php echo attribute_escape( $post->post_author ); ?>" />
 <input type="hidden" id="post_type" name="post_type" value="<?php echo $post->post_type ?>" />
 <input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo $post->post_status ?>" />
-<input name="referredby" type="hidden" id="referredby" value="<?php
-if ( !empty($_REQUEST['popupurl']) )
-       echo clean_url(stripslashes($_REQUEST['popupurl']));
-else if ( strpos( wp_get_referer(), '/wp-admin/' ) === false && $post_ID && url_to_postid(wp_get_referer()) === $post_ID  )
-       echo 'redo';
-else
-       echo clean_url(stripslashes(wp_get_referer()));
-?>" />
+<input name="referredby" type="hidden" id="referredby" value="<?php echo clean_url(stripslashes(wp_get_referer())); ?>" />
 <?php if ( 'draft' != $post->post_status ) wp_original_referer_field(true, 'previous'); ?>
 
 <?php echo $form_extra ?>
@@ -83,10 +92,13 @@ else
 
 <div class="inside">
 
-<p><strong><?php _e('Publish Status') ?></strong></p>
+<p><strong><label for='post_status'><?php _e('Publish Status') ?></label></strong></p>
 <p>
-<select name='post_status' tabindex='4'>
-<?php if ( current_user_can('publish_posts') ) : // Contributors only get "Unpublished" and "Pending Review" ?>
+<select name='post_status' id='post_status' tabindex='4'>
+<?php 
+// only show the publish menu item if they are allowed to publish posts or they are allowed to edit this post (accounts for 'edit_published_posts' capability) 
+if ( current_user_can('publish_posts') OR ( $post->post_status == 'publish' AND current_user_can('edit_post', $post->ID) ) ) :
+?>
 <option<?php selected( $post->post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='publish'><?php _e('Published') ?></option>
 <?php if ( 'future' == $post->post_status ) : ?>
 <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
@@ -98,7 +110,7 @@ else
 </p>
 
 <?php if ( current_user_can( 'publish_posts' ) ) : ?>
-<p><label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex="4" /> <?php _e('Keep this post private') ?></label></p>
+<p id="private-checkbox"><label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex="4" /> <?php _e('Keep this post private') ?></label></p>
 <?php endif; ?>
 <?php
 if ($post_ID) {
@@ -156,6 +168,7 @@ if ( ( 'edit' == $action) && current_user_can('delete_post', $post_ID) )
 <br class="clear" />
 <?php endif; ?>
 <span id="autosave"></span>
+<span id="wp-word-count"></span>
 </p>
 
 <div class="side-info">
@@ -172,6 +185,9 @@ if ( ( 'edit' == $action) && current_user_can('delete_post', $post_ID) )
 <li><a href="edit.php?post_status=draft"><?php _e('View Drafts'); ?></a></li>
 <?php do_action('post_relatedlinks_list'); ?>
 </ul>
+
+<h5><?php _e('Shortcuts') ?></h5>
+<p><?php _e('Drag-and-drop the following link to your bookmarks bar or right click it and add it to your favorites for a posting shortcut.') ?>  <a href="<?php echo get_shortcut_link(); ?>" title="<?php echo attribute_escape(__('Press This')) ?>"><?php _e('Press This') ?></a></p>
 </div>
 
 <?php do_action('submitpost_box'); ?>
@@ -179,7 +195,7 @@ if ( ( 'edit' == $action) && current_user_can('delete_post', $post_ID) )
 
 <div id="post-body">
 <div id="titlediv">
-<h3><?php _e('Title') ?></h3>
+<h3><label for="title"><?php _e('Title') ?></label></h3>
 <div id="titlewrap">
        <input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape($post->post_title); ?>" id="title" autocomplete="off" />
 </div>
@@ -194,7 +210,7 @@ endif; ?>
 </div>
 
 <div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
-<h3><?php _e('Post') ?></h3>
+<h3><label for="content"><?php _e('Post') ?></label></h3>
 <?php the_editor($post->post_content); ?>
 <?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?>
 <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
@@ -205,23 +221,22 @@ endif; ?>
 <?php echo $form_pingback ?>
 <?php echo $form_prevstatus ?>
 
-<div id="tagsdiv" class="postbox <?php echo postbox_classes('tagsdiv', 'post'); ?>">
-<h3><?php _e('Tags'); ?></h3>
-<div class="inside">
-<p id="jaxtag"><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post_ID ); ?>" /></p>
+<?php
+function post_tags_meta_box($post) {
+?>
+<p id="jaxtag"><label class="hidden" for="newtag"><?php _e('Tags'); ?></label><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post->ID ); ?>" /></p>
 <div id="tagchecklist"></div>
-</div>
-</div>
-
-<div id="categorydiv" class="postbox <?php echo postbox_classes('categorydiv', 'post'); ?>">
-<h3><?php _e('Categories') ?></h3>
-<div class="inside">
+<?php
+}
+add_meta_box('tagsdiv', __('Tags'), 'post_tags_meta_box', 'post', 'normal', 'core');
 
+function post_categories_meta_box($post) {
+?>
 <div id="category-adder" class="wp-hidden-children">
        <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4>
        <p id="category-add" class="wp-hidden-child">
-               <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" />
-               <?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?>
+               <label class="hidden" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" aria-required="true"/>
+               <label class="hidden" for="newcat_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?>
                <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php _e( 'Add' ); ?>" tabindex="3" />
                <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?>
                <span id="category-ajax-response"></span>
@@ -241,12 +256,13 @@ endif; ?>
 
 <div id="categories-all" class="ui-tabs-panel">
        <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
-               <?php wp_category_checklist($post_ID) ?>
+               <?php wp_category_checklist($post->ID, false, false, $popular_ids) ?>
        </ul>
 </div>
-
-</div>
-</div>
+<?php
+}
+add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'post', 'normal', 'core');
+?>
 
 <?php do_meta_boxes('post', 'normal', $post); ?>
 
@@ -254,32 +270,41 @@ endif; ?>
 
 <h2><?php _e('Advanced Options'); ?></h2>
 
-<div id="postexcerpt" class="postbox <?php echo postbox_classes('postexcerpt', 'post'); ?>">
-<h3><?php _e('Excerpt') ?></h3>
-<div class="inside"><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea>
+<?php
+function post_excerpt_meta_box($post) {
+?>
+<label class="hidden" for="excerpt"><?php _e('Excerpt') ?></label><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea>
 <p><?php _e('Excerpts are optional hand-crafted summaries of your content. You can <a href="http://codex.wordpress.org/Template_Tags/the_excerpt" target="_blank">use them in your template</a>'); ?></p>
-</div>
-</div>
+<?php
+}
+add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'post', 'advanced', 'core');
+
+function post_trackback_meta_box($post) {
+       $form_trackback = '<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. attribute_escape( str_replace("\n", ' ', $post->to_ping) ) .'" />';
+       if ('' != $post->pinged) {
+               $pings = '<p>'. __('Already pinged:') . '</p><ul>';
+               $already_pinged = explode("\n", trim($post->pinged));
+               foreach ($already_pinged as $pinged_url) {
+                       $pings .= "\n\t<li>" . wp_specialchars($pinged_url) . "</li>";
+               }
+               $pings .= '</ul>';
+       }
 
-<div id="trackbacksdiv" class="postbox <?php echo postbox_classes('trackbacksdiv', 'post'); ?>">
-<h3><?php _e('Trackbacks') ?></h3>
-<div class="inside">
-<p><?php _e('Send trackbacks to:'); ?> <?php echo $form_trackback; ?><br /> (<?php _e('Separate multiple URLs with spaces'); ?>)</p>
+?>
+<p><label for="trackback"><?php _e('Send trackbacks to:'); ?></label> <?php echo $form_trackback; ?><br /> (<?php _e('Separate multiple URLs with spaces'); ?>)</p>
 <p><?php _e('Trackbacks are a way to notify legacy blog systems that you&#8217;ve linked to them. If you link other WordPress blogs they&#8217;ll be notified automatically using <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">pingbacks</a>, no other action necessary.'); ?></p>
 <?php
 if ( ! empty($pings) )
        echo $pings;
-?>
-</div>
-</div>
+}
+add_meta_box('trackbacksdiv', __('Trackbacks'), 'post_trackback_meta_box', 'post', 'advanced', 'core');
 
-<div id="postcustom" class="postbox <?php echo postbox_classes('postcustom', 'post'); ?>">
-<h3><?php _e('Custom Fields') ?></h3>
-<div class="inside">
+function post_custom_meta_box($post) {
+?>
 <div id="postcustomstuff">
 <table cellpadding="3">
 <?php
-$metadata = has_meta($post_ID);
+$metadata = has_meta($post->ID);
 list_meta($metadata);
 ?>
 
@@ -290,55 +315,66 @@ list_meta($metadata);
 <div id="ajax-response"></div>
 </div>
 <p><?php _e('Custom fields can be used to add extra metadata to a post that you can <a href="http://codex.wordpress.org/Using_Custom_Fields" target="_blank">use in your theme</a>.'); ?></p>
-</div>
-</div>
+<?php
+}
+add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', 'post', 'advanced', 'core');
 
-<?php do_action('dbx_post_advanced'); ?>
+do_action('dbx_post_advanced');
 
-<div id="commentstatusdiv" class="postbox <?php echo postbox_classes('commentstatusdiv', 'post'); ?>">
-<h3><?php _e('Comments &amp; Pings') ?></h3>
-<div class="inside">
+function post_comment_status_meta_box($post) {
+?>
 <input name="advanced_view" type="hidden" value="1" />
 <p><label for="comment_status" class="selectit">
 <input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> />
 <?php _e('Allow Comments') ?></label></p>
 <p><label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow Pings') ?></label></p>
 <p><?php _e('These settings apply to this post only. &#8220;Pings&#8221; are <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">trackbacks and pingbacks</a>.'); ?></p>
-</div>
-</div>
+<?php
+}
+add_meta_box('commentstatusdiv', __('Comments &amp; Pings'), 'post_comment_status_meta_box', 'post', 'advanced', 'core');
 
-<div id="passworddiv" class="postbox <?php echo postbox_classes('passworddiv', 'post'); ?>">
-<h3><?php _e('Password Protect This Post') ?></h3>
-<div class="inside">
-<p><input name="post_password" type="text" size="25" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" /></p>
+function post_password_meta_box($post) {
+?>
+<p><label class="hidden" for="post_password"><?php _e('Password Protect This Post') ?></label><input name="post_password" type="text" size="25" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" /></p>
 <p><?php _e('Setting a password will require people who visit your blog to enter the above password to view this post and its comments.'); ?></p>
-</div>
-</div>
-
-<div id="slugdiv" class="postbox <?php echo postbox_classes('slugdiv', 'post'); ?>">
-<h3><?php _e('Post Slug') ?></h3>
-<div class="inside">
-<input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" />
-</div>
-</div>
+<?php
+}
+add_meta_box('passworddiv', __('Password Protect This Post'), 'post_password_meta_box', 'post', 'advanced', 'core');
 
+function post_slug_meta_box($post) {
+?>
+<label class="hidden" for="post_name"><?php _e('Post Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" />
 <?php
+}
+add_meta_box('slugdiv', __('Post Slug'), 'post_slug_meta_box', 'post', 'advanced', 'core');
+
 $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 ) :
+function post_author_meta_box($post) {
+       global $current_user, $user_ID;
+       $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;
 ?>
-<div id="authordiv" class="postbox <?php echo postbox_classes('authordiv', 'post'); ?>">
-<h3><?php _e('Post Author'); ?></h3>
-<div class="inside">
-<?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post_ID) ? $user_ID : $post->post_author) ); ?>
-</div>
-</div>
-<?php endif; ?>
+<label class="hidden" for="post_author_override"><?php _e('Post Author'); ?></label><?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post->ID) ? $user_ID : $post->post_author) ); ?>
+<?php
+}
+add_meta_box('authordiv', __('Post Author'), 'post_author_meta_box', 'post', 'advanced', 'core');
+endif;
 
-<?php do_meta_boxes('post', 'advanced', $post); ?>
+if ( isset($post_ID) && 0 < $post_ID && wp_get_post_revisions( $post_ID ) ) :
+function post_revisions_meta_box($post) {
+       wp_list_post_revisions();
+}
+add_meta_box('revisionsdiv', __('Post Revisions'), 'post_revisions_meta_box', 'post', 'advanced', 'core');
+endif;
 
-<?php do_action('dbx_post_sidebar'); ?>
+do_meta_boxes('post', 'advanced', $post);
+
+do_action('dbx_post_sidebar');
+?>
 </div>
 </div>
 
index dfef0a78e9adfc9b18931f499944f5b1710f5059..601f4cbb4ee17cb719e99de99ed8dbcf587cb3f5 100644 (file)
@@ -22,9 +22,9 @@ $form_extra = "' />\n<input type='hidden' name='comment_ID' value='" . $comment-
 
 <div class="inside">
 
-<p><strong><?php _e('Approval Status') ?></strong></p>
+<p><strong><label for='comment_status'><?php _e('Approval Status') ?></label></strong></p>
 <p>
-<select name='comment_status'>
+<select name='comment_status' id='comment_status'>
 <option<?php selected( $comment->comment_approved, '1' ); ?> value='1'><?php _e('Approved') ?></option>
 <option<?php selected( $comment->comment_approved, '0' ); ?> value='0'><?php _e('Moderated') ?></option>
 <option<?php selected( $comment->comment_approved, 'spam' ); ?> value='spam'><?php _e('Spam') ?></option>
@@ -64,28 +64,28 @@ echo "<a class='submitdelete' href='" . wp_nonce_url("comment.php?action=deletec
 
 <div id="post-body">
 <div id="namediv" class="stuffbox">
-<h3><?php _e('Name') ?></h3>
+<h3><label for="name"><?php _e('Name') ?></label></h3>
 <div class="inside">
 <input type="text" name="newcomment_author" size="30" value="<?php echo attribute_escape( $comment->comment_author ); ?>" tabindex="1" id="name" />
 </div>
 </div>
 
 <div id="emaildiv" class="stuffbox">
-<h3><?php _e('E-mail') ?></h3>
+<h3><label for="email"><?php _e('E-mail') ?></label></h3>
 <div class="inside">
 <input type="text" name="newcomment_author_email" size="30" value="<?php echo attribute_escape( $comment->comment_author_email ); ?>" tabindex="2" id="email" />
 </div>
 </div>
 
 <div id="uridiv" class="stuffbox">
-<h3><?php _e('URL') ?></h3>
+<h3><label for="newcomment_author_url"><?php _e('URL') ?></label></h3>
 <div class="inside">
 <input type="text" id="newcomment_author_url" name="newcomment_author_url" size="30" value="<?php echo attribute_escape( $comment->comment_author_url ); ?>" tabindex="3" />
 </div>
 </div>
 
 <div id="postdiv" class="postarea">
-<h3><?php _e('Comment') ?></h3>
+<h3><label for="content"><?php _e('Comment') ?></label></h3>
 <?php the_editor($comment->comment_content, 'content', 'newcomment_author_url', false, 4); ?>
 <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
 </div>
index b8dfebcfaa3d020bdc11f8e00fb4c6d5fab4bc0f..c7a5e9d99efbf6cc40e2df2001250ed97e3f723d 100644 (file)
@@ -10,12 +10,13 @@ if ( isset($_GET['deleteit']) && isset($_GET['delete']) ) {
 
        foreach( (array) $_GET['delete'] as $cat_ID ) {
                $cat_name = get_term_field('name', $cat_ID, 'link_category');
-
+               $default_cat_id = get_option('default_link_category');
+               
                // Don't delete the default cats.
-               if ( $cat_ID == get_option('default_link_category') )
+               if ( $cat_ID == $default_cat_id )
                        wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
 
-               wp_delete_term($cat_ID, 'link_category');
+               wp_delete_term($cat_ID, 'link_category', array('default' => $default_cat_id));
        }
 
        $location = 'edit-link-categories.php';
@@ -62,6 +63,7 @@ endif; ?>
 <?php endif; ?>
 
 <p id="post-search">
+       <label class="hidden" for="post-search-input"><?php _e( 'Search Categories' ); ?>:</label>
        <input type="text" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" />
        <input type="submit" value="<?php _e( 'Search Categories' ); ?>" class="button" />
 </p>
@@ -101,7 +103,7 @@ if ( $page_links )
 <table class="widefat">
        <thead>
        <tr>
-        <th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('posts-filter'));" /></th>
+        <th scope="col" class="check-column"><input type="checkbox" /></th>
         <th scope="col"><?php _e('Name') ?></th>
         <th scope="col"><?php _e('Description') ?></th>
         <th scope="col" class="num" style="width: 90px;"><?php _e('Links') ?></th>
index 67b0be1d10341724ea00d7ac032edcefa8eeb901..81a686be4bfe3111639b60517d1aba13c47dd691 100644 (file)
@@ -26,11 +26,11 @@ if ( ! empty($cat_ID) ) {
        <table class="form-table">
                <tr class="form-field form-required">
                        <th scope="row" valign="top"><label for="name"><?php _e('Category name') ?></label></th>
-                       <td><input name="name" id="name" type="text" value="<?php echo $category->name; ?>" size="40" /></td>
+                       <td><input name="name" id="name" type="text" value="<?php echo $category->name; ?>" size="40" aria-required="true" /></td>
                </tr>
                <tr class="form-field">
                        <th scope="row" valign="top"><label for="slug"><?php _e('Category slug') ?></label></th>
-                       <td><input name="slug" id="slug" type="text" value="<?php echo $category->slug; ?>" size="40" />
+                       <td><input name="slug" id="slug" type="text" value="<?php echo attribute_escape(apply_filters('editable_slug', $category->slug)); ?>" size="40" />
             <?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></td>
                </tr>
                <tr class="form-field">
index 15c3fb5d2ff2a6f97c61f2a9ffbe8ff108f62e89..48b95ccf7def693d9ec1c0c34af3347a307f5aff 100644 (file)
@@ -74,7 +74,7 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
 
 <div id="post-body">
 <div id="namediv" class="stuffbox">
-<h3><?php _e('Name') ?></h3>
+<h3><label for="link_name"><?php _e('Name') ?></label></h3>
 <div class="inside">
        <input type="text" name="link_name" size="30" tabindex="1" value="<?php echo $link->link_name; ?>" id="link_name" /><br />
     <?php _e('Example: Nifty blogging software'); ?>
@@ -82,7 +82,7 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
 </div>
 
 <div id="addressdiv" class="stuffbox">
-<h3><?php _e('Web Address') ?></h3>
+<h3><label for="link_url"><?php _e('Web Address') ?></label></h3>
 <div class="inside">
        <input type="text" name="link_url" size="30" tabindex="1" value="<?php echo $link->link_url; ?>" id="link_url" /><br />
     <?php _e('Example: <code>http://wordpress.org/</code> &#8212; don&#8217;t forget the <code>http://</code>'); ?>
@@ -90,21 +90,19 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
 </div>
 
 <div id="descriptiondiv" class="stuffbox">
-<h3><?php _e('Description') ?></h3>
+<h3><label for="link_description"><?php _e('Description') ?></label></h3>
 <div class="inside">
        <input type="text" name="link_description" size="30" tabindex="1" value="<?php echo $link->link_description; ?>" id="link_description" /><br />
     <?php _e('This will be shown when someone hovers over the link in the blogroll, or optionally below the link.'); ?>
 </div>
 </div>
 
-<div id="linkcategorydiv" class="postbox <?php echo postbox_classes('linkcategorydiv', 'link'); ?>">
-<h3><?php _e('Categories') ?></h3>
-<div class="inside">
-
+<?php function link_categories_meta_box($link) { ?>
 <div id="category-adder" class="wp-hidden-children">
        <h4><a id="category-add-toggle" href="#category-add"><?php _e( '+ Add New Category' ); ?></a></h4>
        <p id="link-category-add" class="wp-hidden-child">
-               <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" />
+               <label class="hidden" for="newcat"><?php _e( '+ Add New Category' ); ?></label>
+               <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" aria-required="true" />
                <input type="button" id="category-add-sumbit" class="add:categorychecklist:linkcategorydiv button" value="<?php _e( 'Add' ); ?>" />
                <?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?>
                <span id="category-ajax-response"></span>
@@ -118,7 +116,7 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
 
 <div id="categories-all" class="ui-tabs-panel">
        <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
-               <?php wp_link_category_checklist($link_id); ?>
+               <?php wp_link_category_checklist($link->link_id); ?>
        </ul>
 </div>
 
@@ -127,17 +125,17 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
                <?php wp_popular_terms_checklist('link_category'); ?>
        </ul>
 </div>
-
-</div>
-</div>
+<?php
+}
+add_meta_box('linkcategorydiv', __('Categories'), 'link_categories_meta_box', 'link', 'normal', 'core');
+?>
 
 <?php do_meta_boxes('link', 'normal', $link); ?>
 
 <h2><?php _e('Advanced Options'); ?></h2>
 
-<div id="linktargetdiv" class="postbox <?php echo postbox_classes('linktargetdiv', 'link'); ?>">
-<h3><?php _e('Target') ?></h3>
-<div class="inside">
+<?php function link_target_meta_box($link) { ?>
+<fieldset><legend class="hidden"><?php _e('Target') ?></legend>
 <label for="link_target_blank" class="selectit">
 <input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo(($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />
 <code>_blank</code></label><br />
@@ -147,16 +145,17 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
 <label for="link_target_none" class="selectit">
 <input id="link_target_none" type="radio" name="link_target" value="" <?php echo(($link->link_target == '') ? 'checked="checked"' : ''); ?> />
 <?php _e('none') ?></label>
+</fieldset>
 <p><?php _e('Choose the frame your link targets. Essentially this means if you choose <code>_blank</code> your link will open in a new window.'); ?></p>
-</div>
-</div>
+<?php
+}
+add_meta_box('linktargetdiv', __('Target'), 'link_target_meta_box', 'link', 'advanced', 'core');
 
-<div id="linkxfndiv" class="postbox <?php echo postbox_classes('linkxfndiv', 'link'); ?>">
-<h3><?php _e('Link Relationship (XFN)') ?></h3>
-<div class="inside">
+function link_xfn_meta_box($link) {
+?>
 <table class="editform" style="width: 100%;" cellspacing="2" cellpadding="5">
        <tr>
-               <th style="width: 20%;" scope="row"><?php _e('rel:') ?></th>
+               <th style="width: 20%;" scope="row"><label for="link_rel"><?php _e('rel:') ?></label></th>
                <td style="width: 80%;"><input type="text" name="link_rel" id="link_rel" size="50" value="<?php echo $link->link_rel; ?>" /></td>
        </tr>
        <tr>
@@ -164,15 +163,15 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
                        <table cellpadding="3" cellspacing="5" class="form-table">
                                <tr>
                                        <th scope="row"> <?php _e('identity') ?> </th>
-                                       <td>
+                                       <td><fieldset><legend class="hidden"> <?php _e('identity') ?> </legend>
                                                <label for="me">
                                                <input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> />
                                                <?php _e('another web address of mine') ?></label>
-                                       </td>
+                                       </fieldset></td>
                                </tr>
                                <tr>
                                        <th scope="row"> <?php _e('friendship') ?> </th>
-                                       <td>
+                                       <td><fieldset><legend class="hidden"> <?php _e('friendship') ?> </legend>
                                                <label for="contact">
                                                <input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact', 'radio'); ?> /> <?php _e('contact') ?></label>
                                                <label for="acquaintance">
@@ -181,30 +180,30 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
                                                <input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend', 'radio'); ?> /> <?php _e('friend') ?></label>
                                                <label for="friendship">
                                                <input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship', '', 'radio'); ?> /> <?php _e('none') ?></label>
-                                       </td>
+                                       </fieldset></td>
                                </tr>
                                <tr>
                                        <th scope="row"> <?php _e('physical') ?> </th>
-                                       <td>
+                                       <td><fieldset><legend class="hidden"> <?php _e('physical') ?> </legend>
                                                <label for="met">
                                                <input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check('physical', 'met'); ?> />
                                                <?php _e('met') ?></label>
-                                       </td>
+                                       </fieldset></td>
                                </tr>
                                <tr>
                                        <th scope="row"> <?php _e('professional') ?> </th>
-                                       <td>
+                                       <td><fieldset><legend class="hidden"> <?php _e('professional') ?> </legend>
                                                <label for="co-worker">
                                                <input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check('professional', 'co-worker'); ?> />
                                                <?php _e('co-worker') ?></label>
                                                <label for="colleague">
                                                <input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check('professional', 'colleague'); ?> />
                                                <?php _e('colleague') ?></label>
-                                       </td>
+                                       </fieldset></td>
                                </tr>
                                <tr>
                                        <th scope="row"> <?php _e('geographical') ?> </th>
-                                       <td>
+                                       <td><fieldset><legend class="hidden"> <?php _e('geographical') ?> </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'); ?> />
                                                <?php _e('co-resident') ?></label>
@@ -214,11 +213,11 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
                                                <label for="geographical">
                                                <input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical', '', 'radio'); ?> />
                                                <?php _e('none') ?></label>
-                                       </td>
+                                       </fieldset></td>
                                </tr>
                                <tr>
                                        <th scope="row"> <?php _e('family') ?> </th>
-                                       <td>
+                                       <td><fieldset><legend class="hidden"> <?php _e('family') ?> </legend>
                                                <label for="child">
                                                <input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?>  />
                                                <?php _e('child') ?></label>
@@ -237,11 +236,11 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
                                                <label for="family">
                                                <input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family', '', 'radio'); ?> />
                                                <?php _e('none') ?></label>
-                                       </td>
+                                       </fieldset></td>
                                </tr>
                                <tr>
                                        <th scope="row"> <?php _e('romantic') ?> </th>
-                                       <td>
+                                       <td><fieldset><legend class="hidden"> <?php _e('romantic') ?> </legend>
                                                <label for="muse">
                                                <input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check('romantic', 'muse'); ?> />
                                                <?php _e('muse') ?></label>
@@ -254,19 +253,19 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
                                                <label for="romantic">
                                                <input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check('romantic', 'sweetheart'); ?> />
                                                <?php _e('sweetheart') ?></label>
-                                       </td>
+                                       </fieldset></td>
                                </tr>
                        </table>
                </td>
        </tr>
 </table>
 <p><?php _e('If the link is to a person, you can specify your relationship with them using the above form. If you would like to learn more about the idea check out <a href="http://gmpg.org/xfn/">XFN</a>.'); ?></p>
-</div>
-</div>
+<?php
+}
+add_meta_box('linkxfndiv', __('Link Relationship (XFN)'), 'link_xfn_meta_box', 'link', 'advanced', 'core');
 
-<div id="linkadvanceddiv" class="postbox <?php echo postbox_classes('linkadvanceddiv', 'link'); ?>">
-<h3><?php _e('Advanced') ?></h3>
-<div class="inside">
+function link_advanced_meta_box($link) {
+?>
 <table class="form-table" style="width: 100%;" cellspacing="2" cellpadding="5">
        <tr class="form-field">
                <th valign="top"  scope="row"><label for="link_image"><?php _e('Image Address') ?></label></th>
@@ -294,12 +293,13 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
                </td>
        </tr>
 </table>
-</div>
-</div>
+<?php
+}
+add_meta_box('linkadvanceddiv', __('Advanced'), 'link_advanced_meta_box', 'link', 'advanced', 'core');
 
-<?php do_meta_boxes('link', 'advanced', $link); ?>
+do_meta_boxes('link', 'advanced', $link);
 
-<?php if ( $link_id ) : ?>
+if ( $link_id ) : ?>
 <input type="hidden" name="action" value="save" />
 <input type="hidden" name="link_id" value="<?php echo (int) $link_id; ?>" />
 <input type="hidden" name="order_by" value="<?php echo attribute_escape($order_by); ?>" />
index e800a46795af065bb68a0da95801c7d3d5cc4adc..eb58d20c268ee9d2d8f46539c6ed689d10c27887 100644 (file)
@@ -5,10 +5,12 @@ $messages[1] = sprintf( __( 'Page updated. Continue editing below or <a href="%s
 $messages[2] = __('Custom field updated.');
 $messages[3] = __('Custom field deleted.');
 $messages[4] = __('Page updated.');
-?>
-<?php if (isset($_GET['message'])) : ?>
-<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
-<?php endif;
+
+if ( isset($_GET['revision']) )
+       $messages[5] = sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) );
+
+$notice = false;
+$notices[1] = __( 'There is an autosave of this page that is more recent than the version below.  <a href="%s">View the autosave</a>.' );
 
 if (!isset($post_ID) || 0 == $post_ID) {
        $form_action = 'post';
@@ -20,17 +22,23 @@ if (!isset($post_ID) || 0 == $post_ID) {
        $form_action = 'editpost';
        $nonce_action = 'update-page_' . $post_ID;
        $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
+       $autosave = wp_get_post_autosave( $post_id );
+       if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt ) > mysql2date( 'U', $post->post_modified_gmt ) )
+               $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) );
 }
 
 $temp_ID = (int) $temp_ID;
 $user_ID = (int) $user_ID;
 
-$sendto = clean_url(stripslashes(wp_get_referer()));
-
-if ( 0 != $post_ID && $sendto == get_permalink($post_ID) )
-       $sendto = 'redo';
 ?>
 
+<?php if ( $notice ) : ?>
+<div id="notice" class="error"><p><?php echo $notice ?></p></div>
+<?php endif; ?>
+<?php if (isset($_GET['message'])) : ?>
+<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
+<?php endif; ?>
+
 <form name="post" action="page.php" method="post" id="post">
 <div class="wrap">
 <h2><?php _e('Write Page') ?></h2>
@@ -44,15 +52,11 @@ if (isset($mode) && 'bookmarklet' == $mode)
 <input type="hidden" id="user-id" name="user_ID" value="<?php echo $user_ID ?>" />
 <input type="hidden" id="hiddenaction" name="action" value='<?php echo $form_action ?>' />
 <input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" />
+<input type="hidden" id="post_author" name="post_author" value="<?php echo attribute_escape( $post->post_author ); ?>" />
 <?php echo $form_extra ?>
 <input type="hidden" id="post_type" name="post_type" value="<?php echo $post->post_type ?>" />
 <input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo $post->post_status ?>" />
-<input name="referredby" type="hidden" id="referredby" value="<?php
-if ( strpos( wp_get_referer(), '/wp-admin/' ) === false && $post_ID && url_to_postid(wp_get_referer()) === $post_ID )
-       echo 'redo';
-else
-       echo clean_url(stripslashes(wp_get_referer()));
-?>" />
+<input name="referredby" type="hidden" id="referredby" value="<?php echo clean_url(stripslashes(wp_get_referer())); ?>" />
 <?php if ( 'draft' != $post->post_status ) wp_original_referer_field(true, 'previous'); ?>
 
 <div id="poststuff">
@@ -68,14 +72,14 @@ else
 </div>
 
 <div class="inside">
-
-<p><strong><?php _e('Publish Status') ?></strong></p>
+<p><strong><label for='post_status'><?php _e('Publish Status') ?></label></strong></p>
 <p>
-<select name='post_status' tabindex='4'>
-<?php if ( current_user_can('publish_pages') ) : ?>
+<select name='post_status' tabindex='4' id='post_status'>
+<?php // Show publish in dropdown if user can publish or if they can re-publish this page ('edit_published_pages')
+// 'publish' option will be selected for published AND private posts (checkbox overrides dropdown)
+if ( current_user_can('publish_pages') OR ( $post->post_status == 'publish' AND current_user_can('edit_page', $post->ID) ) ) : 
+?>
 <option<?php selected( $post->post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='publish'><?php _e('Published') ?></option>
-<?php else: ?>
-<option<?php selected( $post->post_status, 'private' ); ?> value='private'><?php _e('Published') ?></option>
 <?php endif; ?>
 <?php if ( 'future' == $post->post_status ) : ?>
 <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Pending') ?></option>
@@ -84,8 +88,10 @@ else
 <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Unpublished') ?></option>
 </select>
 </p>
+<?php if ( current_user_can( 'publish_posts' ) ) : ?> 
+<p id="private-checkbox"><label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex='4' /> <?php _e('Keep this page private') ?></label></p>
+<?php endif; ?>
 
-<p><label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex='4' /> <?php _e('Keep this page private') ?></label></p>
 <?php
 if ($post_ID) {
        if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
@@ -140,6 +146,7 @@ if ( ('edit' == $action) && current_user_can('delete_page', $post_ID) )
 <br class="clear" />
 <?php endif; ?>
 <span id="autosave"></span>
+<span id="wp-word-count"></span>
 </p>
 
 <div class="side-info">
@@ -159,7 +166,7 @@ if ( ('edit' == $action) && current_user_can('delete_page', $post_ID) )
 
 <div id="post-body">
 <div id="titlediv">
-<h3><?php _e('Title') ?></h3>
+<h3><label for="title"><?php _e('Title') ?></label></h3>
 <div id="titlewrap">
   <input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape( $post->post_title ); ?>" id="title" autocomplete="off" />
 </div>
@@ -174,7 +181,7 @@ endif; ?>
 </div>
 
 <div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
-<h3><?php _e('Page') ?></h3>
+<h3><label for="content"><?php _e('Page') ?></label></h3>
 <?php the_editor($post->post_content); ?>
 <?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?>
 <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
@@ -188,13 +195,14 @@ endif; ?>
 
 <h2><?php _e('Advanced Options'); ?></h2>
 
-<div id="pagepostcustom" class="postbox <?php echo postbox_classes('pagepostcustom', 'page'); ?>">
-<h3><?php _e('Custom Fields') ?></h3>
-<div class="inside">
+
+<?php 
+function page_custom_meta_box($post){
+?>
 <div id="postcustomstuff">
 <table cellpadding="3">
 <?php
-$metadata = has_meta($post_ID);
+$metadata = has_meta($post->ID);
 list_meta($metadata);
 ?>
 
@@ -205,83 +213,97 @@ list_meta($metadata);
 <div id="ajax-response"></div>
 </div>
 <p><?php _e('Custom fields can be used to add extra metadata to a post that you can <a href="http://codex.wordpress.org/Using_Custom_Fields" target="_blank">use in your theme</a>.'); ?></p>
-</div>
-</div>
+<?php
+}
+add_meta_box('pagecustomdiv', __('Custom Fields'), 'page_custom_meta_box', 'page', 'advanced', 'core');
 
-<div id="pagecommentstatusdiv" class="postbox <?php echo postbox_classes('pagecommentstatusdiv', 'page'); ?>">
-<h3><?php _e('Comments &amp; Pings') ?></h3>
-<div class="inside">
+function page_comments_status_meta_box($post){
+?>
 <input name="advanced_view" type="hidden" value="1" />
 <p><label for="comment_status" class="selectit">
 <input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> />
 <?php _e('Allow Comments') ?></label></p>
 <p><label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow Pings') ?></label></p>
 <p><?php _e('These settings apply to this page only. &#8220;Pings&#8221; are <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">trackbacks and pingbacks</a>.'); ?></p>
-</div>
-</div>
+<?php 
+}
+add_meta_box('pagecommentstatusdiv', __('Comments &amp; Pings'), 'page_comments_status_meta_box', 'page', 'advanced', 'core');
 
-<div id="pagepassworddiv" class="postbox <?php echo postbox_classes('pagepassworddiv', 'page'); ?>">
-<h3><?php _e('Password Protect This Page') ?></h3>
-<div class="inside">
-<p><input name="post_password" type="text" size="25" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" /></p>
+function page_password_meta_box($post){
+?>
+<p><label class="hidden" for="post_password"><?php _e('Password Protect This Page') ?></label><input name="post_password" type="text" size="25" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" /></p>
 <p><?php _e('Setting a password will require people who visit your blog to enter the above password to view this page and its comments.'); ?></p>
-</div>
-</div>
+<?php
+}
+add_meta_box('pagepassworddiv', __('Password Protect This Page'), 'page_password_meta_box', 'page', 'advanced', 'core');
 
-<div id="pageslugdiv" class="postbox <?php echo postbox_classes('pageslugdiv', 'page'); ?>">
-<h3><?php _e('Page Slug') ?></h3>
-<div class="inside">
-<input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" />
-</div>
-</div>
+function page_slug_meta_box($post){
+?>
+<label class="hidden" for="post_name"><?php _e('Page Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" />
+<?php
+}
+add_meta_box('pageslugdiv', __('Page Slug'), 'page_slug_meta_box', 'page', 'advanced', 'core');
 
-<div id="pageparentdiv" class="postbox <?php echo postbox_classes('pageparentdiv', 'page'); ?>">
-<h3><?php _e('Page Parent') ?></h3>
-<div class="inside">
-<select name="parent_id">
+function page_parent_meta_box($post){
+?>
+<label class="hidden" for="parent_id"><?php _e('Page Parent') ?></label>
+<select name="parent_id" id="parent_id">
 <option value='0'><?php _e('Main Page (no parent)'); ?></option>
 <?php parent_dropdown($post->post_parent); ?>
 </select>
 <p><?php _e('You can arrange your pages in hierarchies, for example you could have an &#8220;About&#8221; page that has &#8220;Life Story&#8221; and &#8220;My Dog&#8221; pages under it. There are no limits to how deeply nested you can make pages.'); ?></p>
-</div>
-</div>
+<?php
+}
+add_meta_box('pageparentdiv', __('Page Parent'), 'page_parent_meta_box', 'page', 'advanced', 'core');
 
-<?php if ( 0 != count( get_page_templates() ) ) { ?>
-<div id="pagetemplatediv" class="postbox <?php echo postbox_classes('pagetemplatediv', 'page'); ?>">
-<h3><?php _e('Page Template') ?></h3>
-<div class="inside">
-<select name="page_template">
+if ( 0 != count( get_page_templates() ) ) {
+       function page_template_meta_box($post){
+?>
+<label class="hidden" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template">
 <option value='default'><?php _e('Default Template'); ?></option>
 <?php page_template_dropdown($post->page_template); ?>
 </select>
 <p><?php _e('Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you&#8217;ll see them above.'); ?></p>
-</div>
-</div>
-<?php } ?>
+<?php
+       }
+       add_meta_box('pagetemplatediv', __('Page Template'), 'page_template_meta_box', 'page', 'advanced', 'core');
+}
 
-<div id="pageorderdiv" class="postbox <?php echo postbox_classes('pageorderdiv', 'page'); ?>">
-<h3><?php _e('Page Order') ?></h3>
-<div class="inside">
-<p><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo $post->menu_order ?>" /></p>
+function page_order_meta_box($post){
+?>
+<p><label class="hidden" for="menu_order"><?php _e('Page Order') ?></label><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo $post->menu_order ?>" /></p>
 <p><?php _e('Pages are usually ordered alphabetically, but you can put a number above to change the order pages appear in. (We know this is a little janky, it&#8217;ll be better in future releases.)'); ?></p>
-</div>
-</div>
-
 <?php
+}
+add_meta_box('pageorderdiv', __('Page Order'), 'page_order_meta_box', 'page', 'advanced', '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 ) :
+if ( $authors && count( $authors ) > 1 ) {
+       function page_author_meta_box($post){
+               global $current_user, $user_ID;
+               $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;
 ?>
-<div id="pageauthordiv" class="postbox <?php echo postbox_classes('pageauthordiv', 'page'); ?>">
-<h3><?php _e('Page Author'); ?></h3>
-<div class="inside">
-<?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post_ID) ? $user_ID : $post->post_author) ); ?>
-</div>
-</div>
-<?php endif; ?>
+<label class="hidden" for="post_author_override"><?php _e('Page Author'); ?></label><?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post->ID) ? $user_ID : $post->post_author) ); ?>
+<?php
+       }
+       add_meta_box('pageauthordiv', __('Page Author'), 'page_author_meta_box', 'page', 'advanced', 'core');
+}
 
-<?php do_meta_boxes('page', 'advanced', $post); ?>
+
+if ( isset($post_ID) && 0 < $post_ID && wp_get_post_revisions( $post_ID ) ) :
+function page_revisions_meta_box($post) {
+       wp_list_post_revisions();
+}
+add_meta_box('revisionsdiv', __('Page Revisions'), 'page_revisions_meta_box', 'page', 'advanced', 'core');
+endif;
+
+do_meta_boxes('page', 'advanced', $post);
+?>
 
 </div>
 </div>
index ee4bee2c26e13d9c03c39578f8943ec2c869b9ca..c49bc1ffc28f9c2ffee27403a80b21ce6cdc5376 100644 (file)
@@ -20,8 +20,8 @@ if ( isset($_GET['deleteit']) && isset($_GET['delete']) ) {
        }
 
        $sendback = wp_get_referer();
-       if (strpos($sendback, 'page.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/page-new.php';
-       elseif (strpos($sendback, 'attachments.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/attachments.php';
+       if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('page-new.php');
+       elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
        $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
 
        wp_redirect($sendback);
@@ -111,12 +111,32 @@ endif;
 ?>
 
 <p id="post-search">
+       <label class="hidden" for="post-search-input"><?php _e( 'Search Pages' ); ?>:</label>
        <input type="text" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" />
        <input type="submit" value="<?php _e( 'Search Pages' ); ?>" class="button" />
 </p>
 
 <div class="tablenav">
 
+<?php
+$pagenum = absint( $_GET['pagenum'] );
+if ( empty($pagenum) )
+       $pagenum = 1;
+if( !$per_page || $per_page < 0 )
+       $per_page = 20;
+
+$num_pages = ceil(count($posts) / $per_page);
+$page_links = paginate_links( array(
+       'base' => add_query_arg( 'pagenum', '%#%' ),
+       'format' => '',
+       'total' => $num_pages,
+       'current' => $pagenum
+));
+
+if ( $page_links )
+       echo "<div class='tablenav-pages'>$page_links</div>";
+?>
+
 <div class="alignleft">
 <input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
 <?php wp_nonce_field('bulk-pages'); ?>
@@ -150,7 +170,7 @@ if ($posts) {
   </tr>
   </thead>
   <tbody>
-  <?php page_rows($posts); ?>
+  <?php page_rows($posts, $pagenum, $per_page); ?>
   </tbody>
 </table>
 
@@ -168,6 +188,10 @@ if ($posts) {
 ?>
 
 <div class="tablenav">
+<?php
+if ( $page_links )
+       echo "<div class='tablenav-pages'>$page_links</div>";
+?>
 <br class="clear" />
 </div>
 
@@ -175,7 +199,7 @@ if ($posts) {
 
 if ( 1 == count($posts) && is_singular() ) :
 
-       $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
+       $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);
index 62a8e2b8ff632a32b80b83d43b6591b107fb52c0..de0f6c8f778c6288f5081eb2f7f47499ee16de39 100644 (file)
@@ -26,12 +26,12 @@ if ( ! empty($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 echo attribute_escape($tag->name); ?>" size="40" />
+                       <td><input name="name" id="name" type="text" value="<?php echo attribute_escape($tag->name); ?>" size="40" aria-required="true" />
             <p><?php _e('The name is how the tag appears on your site.'); ?></p></td>
                </tr>
                <tr class="form-field">
                        <th scope="row" valign="top"><label for="slug"><?php _e('Tag slug') ?></label></th>
-                       <td><input name="slug" id="slug" type="text" value="<?php echo attribute_escape($tag->slug); ?>" size="40" />
+                       <td><input name="slug" id="slug" type="text" value="<?php echo attribute_escape(apply_filters('editable_slug', $tag->slug)); ?>" size="40" />
             <p><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td>
                </tr>
        </table>
index b50269be09f1ac9f4b3b92f07bce5c8f8d918a05..fffe7cab0b4a3207b28693bef49781f6f1d69f36 100644 (file)
@@ -133,6 +133,7 @@ endif; ?>
 <?php endif; ?>
 
 <p id="post-search">
+       <label class="hidden" for="post-search-input"><?php _e( 'Search Tags' ); ?>:</label>
        <input type="text" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" />
        <input type="submit" value="<?php _e( 'Search Tags' ); ?>" class="button" />
 </p>
@@ -172,7 +173,7 @@ if ( $page_links )
 <table class="widefat">
        <thead>
        <tr>
-       <th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('posts-filter'));" /></th>
+       <th scope="col" class="check-column"><input type="checkbox" /></th>
         <th scope="col"><?php _e('Name') ?></th>
         <th scope="col" class="num" style="width: 90px"><?php _e('Posts') ?></th>
        </tr>
index b7cdcf45b57028652f4f006e4085ce95e165a55a..467a9bb540314d995ca9aac9c967a9bd50a39201 100644 (file)
@@ -20,8 +20,8 @@ if ( isset($_GET['deleteit']) && isset($_GET['delete']) ) {
        }
 
        $sendback = wp_get_referer();
-       if (strpos($sendback, 'post.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/post-new.php';
-       elseif (strpos($sendback, 'attachments.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/attachments.php';
+       if (strpos($sendback, 'post.php') !== false) $sendback = admin_url('post-new.php');
+       elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
        $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
 
        wp_redirect($sendback);
@@ -116,6 +116,7 @@ endif;
 ?>
 
 <p id="post-search">
+       <label class="hidden" for="post-search-input"><?php _e( 'Search Posts' ); ?>:</label>
        <input type="text" id="post-search-input" name="s" value="<?php the_search_query(); ?>" />
        <input type="submit" value="<?php _e( 'Search Posts' ); ?>" class="button" />
 </p>
@@ -205,7 +206,7 @@ if ( $page_links )
 
 if ( 1 == count($posts) && is_singular() ) :
 
-       $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
+       $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);
index 99505e4ade98a31fd860feedcf1f502c8daa35c3..08a0b25716508f4775de7e5ded491a92ecb91cc7 100644 (file)
@@ -22,9 +22,9 @@ require_once ('admin-header.php');
 
 <table class="form-table">
 <tr>
-<th><?php _e('Restrict Author'); ?></th>
+<th><label for="author"><?php _e('Restrict Author'); ?></label></th>
 <td>
-<select name="author">
+<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" );
diff --git a/wp-admin/gears-manifest.php b/wp-admin/gears-manifest.php
new file mode 100644 (file)
index 0000000..baf6c19
--- /dev/null
@@ -0,0 +1,209 @@
+<?php
+
+define( 'ABSPATH', dirname(dirname(__FILE__)) );
+define( 'WPINC', '/wp-includes' );
+
+function __() {}
+function add_filter() {}
+function attribute_escape() {}
+function apply_filters() {}
+function get_option() {}
+function is_lighttpd_before_150() {}
+function add_action() {}
+function do_action_ref_array() {}
+function get_bloginfo() {}
+function is_admin() {return true;}
+function site_url() {}
+function admin_url() {}
+function wp_guess_url() {}
+
+require(ABSPATH . '/wp-includes/script-loader.php');
+require(ABSPATH . '/wp-includes/version.php');
+
+$wp_scripts = new WP_Scripts();
+wp_default_scripts($wp_scripts);
+
+$wp_styles = new WP_Styles();
+wp_default_styles($wp_styles);
+
+$defaults = $man_version = '';
+foreach ( $wp_scripts->registered as $script ) {
+       if ( empty($script->src) || strpos($script->src, 'tiny_mce_config.php') ) continue;
+       $ver = empty($script->ver) ? $wp_version : $script->ver;
+       $src = str_replace( array( '/wp-admin/', '/wp-includes/' ), array( '', '../wp-includes/' ), $script->src );
+       $defaults .= '{ "url" : "' . $src . '?ver=' . $ver . '" },' . "\n";
+       $man_version .= $ver;
+}
+
+foreach ( $wp_styles->registered as $style ) {
+       if ( empty($style->src) ) continue;
+
+       $ver = empty($style->ver) ? $wp_version : $style->ver;
+       $src = str_replace( array( '/wp-admin/', '/wp-includes/' ), array( '', '../wp-includes/' ), $style->src );
+       if ( 'colors' == $style->handle ) $src = 'css/colors-classic.css';
+       $defaults .= '{ "url" : "' . $src . '?ver=' . $ver . '" },' . "\n";
+
+       if ( isset($style->extra['rtl']) && $style->extra['rtl'] ) {
+               if ( is_bool( $style->extra['rtl'] ) )
+                       $rtl_href = str_replace( '.css', '-rtl.css', $src );
+               else 
+                       $rtl_href = str_replace( array( '/wp-admin/', '/wp-includes/' ), array( '', '../wp-includes/' ), $style->extra['rtl'] );
+
+               $defaults .= '{ "url" : "' . $rtl_href . '?ver=' . $ver . '" },' . "\n";
+       }
+       $man_version .= $ver;
+}
+
+$man_version = md5($man_version);
+
+header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
+header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
+header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
+header( 'Pragma: no-cache' );
+header( 'Content-Type: application/x-javascript; charset=UTF-8' );
+?>
+{
+"betaManifestVersion" : 1,
+"version" : "<?php echo $man_version; ?>_20080810",
+"entries" : [
+<?php echo $defaults; ?>
+
+{ "url" : "images/align-center.png" },
+{ "url" : "images/align-left.png" },
+{ "url" : "images/align-none.png" },
+{ "url" : "images/align-right.png" },
+{ "url" : "images/browse-happy.gif" },
+{ "url" : "images/bubble_bg.gif" },
+{ "url" : "images/comment-grey-bubble.png" },
+{ "url" : "images/comment-pill.gif" },
+{ "url" : "images/comment-stalk-classic.gif" },
+{ "url" : "images/comment-stalk-fresh.gif" },
+{ "url" : "images/comment-stalk-rtl.gif" },
+{ "url" : "images/date-button.gif" },
+{ "url" : "images/fade-butt.png" },
+{ "url" : "images/gear.png" },
+{ "url" : "images/logo-ghost.png" },
+{ "url" : "images/logo-login.gif" },
+{ "url" : "images/logo.gif" },
+{ "url" : "images/media-button-gallery.gif" },
+{ "url" : "images/media-button-image.gif" },
+{ "url" : "images/media-button-music.gif" },
+{ "url" : "images/media-button-other.gif" },
+{ "url" : "images/media-button-video.gif" },
+{ "url" : "images/media-buttons.gif" },
+{ "url" : "images/tab.png" },
+{ "url" : "images/tail.gif" },
+{ "url" : "images/toggle-arrow-rtl.gif" },
+{ "url" : "images/toggle-arrow.gif" },
+{ "url" : "images/wordpress-logo.png" },
+{ "url" : "images/xit.gif" },
+{ "url" : "images/loading-publish.gif" },
+{ "url" : "images/loading.gif" },
+{ "url" : "images/required.gif" },
+{ "url" : "images/no.png" },
+{ "url" : "images/yes.png" },
+
+<?php if ( is_file(ABSPATH.'/wp-includes/js/tinymce/tiny_mce.js') ) { ?>
+{ "url" : "../wp-includes/js/tinymce/tiny_mce_popup.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/utils/mctabs.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/utils/validate.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/utils/form_utils.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/utils/editable_selects.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/paste/js/pasteword.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/paste/js/pastetext.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/js/media.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/color_picker.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/charmap.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/image.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/link.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/source_editor.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/anchor.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js?ver=311g" },
+{ "url" : "../wp-includes/js/tinymce/tiny_mce.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/editor_template.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js?ver=311" },
+
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/source_editor.htm?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/anchor.htm?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/image.htm?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/link.htm?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/color_picker.htm?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/charmap.htm?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/media.htm?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/paste/pasteword.htm?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/paste/blank.htm?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/paste/pastetext.htm?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/template.htm?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/editimage.html?ver=311g" },
+{ "url" : "../wp-includes/js/tinymce/wp-mce-help.php?ver=311" },
+
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/dialog.css?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/spellchecker/css/content.css?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/css/content.css?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/css/content.css?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/css/media.css?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/paste/css/pasteword.css?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/paste/css/blank.css?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css?ver=311g" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/wordpress.css?ver=311" },
+
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/icons.gif" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/colorpicker.jpg" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/fm.gif" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/gotmoxie.png" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/sflogo.png" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/butt2.png" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/fade-butt.png" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/tabs.gif" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/down_arrow.gif" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/default/img/progress.gif" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_check.gif" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_arrow.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/drag.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/button.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/img/flash.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/img/flv_player.swf" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/img/quicktime.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/img/realmedia.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/img/shockwave.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/img/windowsmedia.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/img/trans.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/more.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/more_bug.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/page.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/page_bug.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/toolbars.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/img/image.png" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/img/delete.png" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/help.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/image.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/media.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/video.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/audio.gif" },
+<?php } ?>
+
+{ "url" : "../wp-includes/images/crystal/archive.png" },
+{ "url" : "../wp-includes/images/crystal/audio.png" },
+{ "url" : "../wp-includes/images/crystal/code.png" },
+{ "url" : "../wp-includes/images/crystal/default.png" },
+{ "url" : "../wp-includes/images/crystal/document.png" },
+{ "url" : "../wp-includes/images/crystal/interactive.png" },
+{ "url" : "../wp-includes/images/crystal/text.png" },
+{ "url" : "../wp-includes/images/crystal/video.png" },
+{ "url" : "../wp-includes/images/crystal/spreadsheet.png" },
+{ "url" : "../wp-includes/images/rss.png" },
+{ "url" : "../wp-includes/js/thickbox/loadingAnimation.gif" },
+{ "url" : "../wp-includes/js/thickbox/tb-close.png" },
+{ "url" : "../wp-includes/js/swfupload/swfupload_f9.swf" }
+]}
diff --git a/wp-admin/images/gear.png b/wp-admin/images/gear.png
new file mode 100644 (file)
index 0000000..f7ac7f4
Binary files /dev/null and b/wp-admin/images/gear.png differ
diff --git a/wp-admin/images/loading-publish.gif b/wp-admin/images/loading-publish.gif
new file mode 100644 (file)
index 0000000..fc1baf5
Binary files /dev/null and b/wp-admin/images/loading-publish.gif differ
diff --git a/wp-admin/images/loading.gif b/wp-admin/images/loading.gif
new file mode 100644 (file)
index 0000000..85b99d4
Binary files /dev/null and b/wp-admin/images/loading.gif differ
diff --git a/wp-admin/images/logo.gif b/wp-admin/images/logo.gif
new file mode 100644 (file)
index 0000000..cd49514
Binary files /dev/null and b/wp-admin/images/logo.gif differ
diff --git a/wp-admin/images/no.png b/wp-admin/images/no.png
new file mode 100644 (file)
index 0000000..e2db55f
Binary files /dev/null and b/wp-admin/images/no.png differ
diff --git a/wp-admin/images/required.gif b/wp-admin/images/required.gif
new file mode 100644 (file)
index 0000000..119350f
Binary files /dev/null and b/wp-admin/images/required.gif differ
diff --git a/wp-admin/images/tab.png b/wp-admin/images/tab.png
new file mode 100644 (file)
index 0000000..413c755
Binary files /dev/null and b/wp-admin/images/tab.png differ
diff --git a/wp-admin/images/yes.png b/wp-admin/images/yes.png
new file mode 100644 (file)
index 0000000..2f86f0a
Binary files /dev/null and b/wp-admin/images/yes.png differ
index 0ea5727d2e28210a4032788215c3c7c5d9afe850..140d8f2bbd745cdcfb7c9351b10f6591b25d1d00 100644 (file)
@@ -641,7 +641,7 @@ class Blogger_Import {
                $host = $this->blogs[$importing_blog]['host'];
 
                // Get an array of posts => authors
-               $post_ids = (array) $wpdb->get_col("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'blogger_blog' AND meta_value = '$host'");
+               $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 )
@@ -658,7 +658,7 @@ class Blogger_Import {
                        $post_ids = (array) array_keys( $authors_posts, $this->blogs[$importing_blog]['authors'][$author][0] );
                        $post_ids = join( ',', $post_ids);
 
-                       $wpdb->query("UPDATE $wpdb->posts SET post_author = $user_id WHERE id IN ($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();
index 16df934ffe762b8cb88eda87c7f4ae398aff3b6b..da1047ffb272be85c4171bda3204e8cdda2f81b0 100644 (file)
@@ -13,7 +13,7 @@ if(!function_exists('get_comment_count'))
        function get_comment_count($post_ID)
        {
                global $wpdb;
-               return $wpdb->get_var('SELECT count(*) FROM '.$wpdb->comments.' WHERE comment_post_ID = '.$post_ID);
+               return $wpdb->get_var( $wpdb->prepare("SELECT count(*) FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) );
        }
 }
 
@@ -22,7 +22,7 @@ if(!function_exists('link_exists'))
        function link_exists($linkname)
        {
                global $wpdb;
-               return $wpdb->get_var('SELECT link_id FROM '.$wpdb->links.' WHERE link_name = "'.$linkname.'"');
+               return $wpdb->get_var( $wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_name = %s", $linkname) );
        }
 }
 
index 92abc48bdfd0c7cdf1eb0f4bc84e1f477c723be5..58aa7577155270ba177a8067d04e4ed314f05bd9 100644 (file)
@@ -38,16 +38,16 @@ class GM_Import {
 <h3><?php _e('Second step: GreyMatter details:') ?></h3>
 <table class="form-table">
 <tr>
-<td><?php _e('Path to GM files:') ?></td>
-<td><input type="text" style="width:300px" name="gmpath" value="/home/my/site/cgi-bin/greymatter/" /></td>
+<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><?php _e('Path to GM entries:') ?></td>
-<td><input type="text" style="width:300px" name="archivespath" value="/home/my/site/cgi-bin/greymatter/archives/" /></td>
+<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><?php _e("Last entry's number:") ?></td>
-<td><input type="text" name="lastentry" value="00000001" /><br />
+<td><label for="lastentry"><?php _e("Last entry'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't know that number, just log into your FTP and look it out<br />in the entries' folder)") ?></td>
 </tr>
 </table>
index 6ab2f79c08e5bafcc2ffbc6b7a209a3969827825..5968095ca375dc4b5cbf686cccbbc212843debe0 100644 (file)
@@ -166,9 +166,9 @@ class MT_Import {
                $j = -1;
                foreach ($authors as $author) {
                        ++ $j;
-                       echo '<li>'.__('Current author:').' <strong>'.$author.'</strong><br />'.sprintf(__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user[]'.'" maxlength="30"> <br />');
+                       echo '<li><label>'.__('Current author:').' <strong>'.$author.'</strong><br />'.sprintf(__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user[]'.'" maxlength="30"> <br />');
                        $this->users_form($j);
-                       echo '</li>';
+                       echo '</label></li>';
                }
 
                echo '<input type="submit" value="'.__('Submit').'">'.'<br />';
@@ -179,7 +179,7 @@ class MT_Import {
 
        function select_authors() {
                if ( $_POST['upload_type'] === 'ftp' ) {
-                       $file['file'] = ABSPATH . 'wp-content/mt-export.txt';
+                       $file['file'] = WP_CONTENT_DIR . '/mt-export.txt';
                        if ( !file_exists($file['file']) )
                                $file['error'] = __('<code>mt-export.txt</code> does not exist');
                } else {
@@ -426,7 +426,7 @@ class MT_Import {
        function import() {
                $this->id = (int) $_GET['id'];
                if ( $this->id == 0 )
-                       $this->file = ABSPATH . 'wp-content/mt-export.txt';
+                       $this->file = WP_CONTENT_DIR . '/mt-export.txt';
                else
                        $this->file = get_attached_file($this->id);
                $this->get_authors_from_post();
index 1c10015f04c784a6b3ea71e9cd9f16c6f7905ee9..bbddc08d382d5947bc9b08c38b81e9103d16c201 100644 (file)
@@ -8,7 +8,7 @@ if(!function_exists('get_comment_count'))
        function get_comment_count($post_ID)
        {
                global $wpdb;
-               return $wpdb->get_var('SELECT count(*) FROM '.$wpdb->comments.' WHERE comment_post_ID = '.$post_ID);
+               return $wpdb->get_var( $wpdb->prepare("SELECT count(*) FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) );
        }
 }
 
@@ -17,7 +17,7 @@ if(!function_exists('link_exists'))
        function link_exists($linkname)
        {
                global $wpdb;
-               return $wpdb->get_var('SELECT link_id FROM '.$wpdb->links.' WHERE link_name = "'.$wpdb->escape($linkname).'"');
+               return $wpdb->get_var( $wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_name = %s", $linkname) );
        }
 }
 
@@ -333,7 +333,7 @@ class Textpattern_Import {
                                $category1 = get_category_by_slug($Category1);
                                $category1 = $category1->term_id;
                                $category2 = get_category_by_slug($Category2);
-                               $category2 = $category1->term_id;
+                               $category2 = $category2->term_id;
                                if($cat1 = $category1) { $cats[1] = $cat1; }
                                if($cat2 = $category2) { $cats[2] = $cat2; }
 
index 03395bdba9b965736076e20181855c699f772fc9..5271abe008e082be035d17bcf74b0f88e25026e8 100644 (file)
@@ -218,7 +218,7 @@ class WP_Import {
        function users_form($n, $author) {
 
                if ( $this->allow_create_users() ) {
-                       printf(__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user_create['.intval($n).']'.'" maxlength="30"> <br />');
+                       printf('<label>'.__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user_create['.intval($n).']'.'" maxlength="30"></label> <br />');
                }
                else {
                        echo __('Map to existing').'<br />';
@@ -357,6 +357,11 @@ class WP_Import {
                $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('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_excerpt);
+               $post_excerpt = str_replace('<br>', '<br />', $post_excerpt);
+               $post_excerpt = str_replace('<hr>', '<hr />', $post_excerpt);
+
                $post_content = $this->get_tag( $post, 'content:encoded' );
                $post_content = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_content);
                $post_content = str_replace('<br>', '<br />', $post_content);
@@ -404,7 +409,7 @@ class WP_Import {
 
                        $post_author = $this->checkauthor($post_author); //just so that if a post already exists, new users are not created by checkauthor
 
-                       $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_status', 'post_name', 'comment_status', 'ping_status', 'guid', 'post_parent', 'menu_order', 'post_type', 'post_password');
+                       $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');
                        if ($post_type == 'attachment') {
                                $remote_url = $this->get_tag( $post, 'wp:attachment_url' );
                                if ( !$remote_url )
index 0f271cecafb0d924c5bd81314fbb665df393bc81..ff6da0d56cd6dcdaa3a9cc84cbd77e1ac0d200b1 100644 (file)
@@ -3,50 +3,71 @@
 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">';
-               echo '<h2>' . __('Convert Categories to Tags') . '</h2>';
+               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_all_categories() {
-               global $wpdb;
+       function populate_cats() {
 
                $categories = get_categories('get=all');
                foreach ( $categories as $category ) {
-                       if ( !tag_exists($wpdb->escape($category->name)) )
-                               $this->all_categories[] = $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 welcome() {
-               $this->populate_all_categories();
+       function categories_tab() {
+               $this->populate_cats();
+               $cat_num = count($this->all_categories);
 
-               echo '<div class="narrow">';
+               echo '<br class="clear" />';
 
-               if (count($this->all_categories) > 0) {
-                       echo '<p>' . __('Hey there. Here you can selectively converts 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>';
+               if ( $cat_num > 0 ) {
+                       echo '<h2>' . sprintf( __ngettext( 'Convert Category to Tag.', 'Convert Categories (%d) to Tags.', $cat_num ), $cat_num ) . '</h2>';
+                       echo '<div class="narrow">';
+                       echo '<p>' . __('Hey there. Here you can selectively convert existing categories to tags. To get started, check the categories you wish to be converted, then click the Convert button.') . '</p>';
+                       echo '<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>';
                }
-
-               echo '</div>';
        }
 
-       function categories_form() {
-?>
+       function categories_form() { ?>
+
 <script type="text/javascript">
-<!--
+/* <![CDATA[ */
 var checkflag = "false";
 function check_all_rows() {
-       field = document.formlist;
+       field = document.catlist;
        if ( 'false' == checkflag ) {
                for ( i = 0; i < field.length; i++ ) {
                        if ( 'cats_to_convert[]' == field[i].name )
@@ -63,54 +84,117 @@ function check_all_rows() {
                return '<?php _e('Check All') ?>';
        }
 }
-
-//  -->
+/* ]]> */
 </script>
-<?php
-               echo '<form name="formlist" id="formlist" action="admin.php?import=wp-cat2tag&amp;step=2" method="post">
-               <p><input type="button" class="button-secondary" value="' . __('Check All') . '"' . ' onClick="this.value=check_all_rows()"></p>';
-               wp_nonce_field('import-cat2tag');
-               echo '<ul style="list-style:none">';
 
-               $hier = _get_term_hierarchy('category');
+<form name="catlist" id="catlist" action="admin.php?import=wp-cat2tag&amp;step=2" method="post">
+<p><input type="button" class="button-secondary" value="<?php _e('Check All'); ?>" onclick="this.value=check_all_rows()" />
+<?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) {
-                               echo '<li><label><input type="checkbox" name="cats_to_convert[]" value="' . intval($category->term_id) . '" /> ' . $category->name . ' (' . $category->count . ')</label>';
+                       if ( (int) $category->parent == 0 ) { ?>
 
-                               if (isset($hier[$category->term_id])) {
-                                       $this->_category_children($category, $hier);
-                               }
+       <li><label><input type="checkbox" name="cats_to_convert[]" value="<?php echo intval($category->term_id); ?>" /> <?php echo $category->name . ' (' . $category->count . ')'; ?></label><?php
 
-                               echo '</li>';
-                       }
-               }
+                                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>
 
-               echo '</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>'; ?>
 
-               echo '<p class="submit"><input type="submit" name="submit" class="button" value="' . __('Convert Tags') . '" /></p>';
+<p class="submit"><input type="submit" name="submit" class="button" value="<?php _e('Convert Categories to Tags'); ?>" /></p>
+</form>
 
-               echo '</form>';
-       }
+<?php }
 
-       function _category_children($parent, $hier) {
-               echo '<ul style="list-style:none">';
+       function tags_tab() {
+               $this->populate_tags();
+               $tags_num = count($this->all_tags);
 
-               foreach ($hier[$parent->term_id] as $child_id) {
-                       $child =& get_category($child_id);
+               echo '<br class="clear" />';
 
-                       echo '<li><label><input type="checkbox" name="cats_to_convert[]" value="' . intval($child->term_id) . '" /> ' . $child->name . ' (' . $child->count . ')</label>';
+               if ( $tags_num > 0 ) {
+                       echo '<h2>' . sprintf( __ngettext( 'Convert Tag to Category.', 'Convert Tags (%d) to Categories.', $tags_num ), $tags_num ) . '</h2>';
+                       echo '<div class="narrow">';
+                       echo '<p>' . __('Here you can selectively converts existing tags to categories. To get started, check the tags you wish to be converted, then click the Convert button.') . '</p>';
+                       echo '<p>' . __('The newly created categories will still be associated with the same posts.') . '</p></div>';
 
-                       if (isset($hier[$child->term_id])) {
-                               $this->_category_children($child, $hier);
-                       }
+                       $this->tags_form();
+               } else {
+                       echo '<p>'.__('You have no tags to convert!').'</p>';
+               }
+       }
+
+       function tags_form() { ?>
 
-                       echo '</li>';
+<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>
 
-               echo '</ul>';
+<form name="taglist" id="taglist" action="admin.php?import=wp-cat2tag&amp;step=4" method="post">
+<p><input type="button" class="button-secondary" value="<?php _e('Check All'); ?>" onclick="this.value=check_all_tagrows()" />
+<?php wp_nonce_field('import-cat2tag'); ?></p>
+<ul style="list-style:none">
+
+<?php  foreach ( $this->all_tags as $tag ) { ?>
+       <li><label><input type="checkbox" name="tags_to_convert[]" value="<?php echo intval($tag->term_id); ?>" /> <?php echo attribute_escape($tag->name) . ' (' . $tag->count . ')'; ?></label><?php if ( in_array( intval($tag->term_id),  $this->hybrids_ids ) ) echo ' <a href="#note"> * </a>'; ?></li>
+
+<?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 _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) {
@@ -125,101 +209,238 @@ function check_all_rows() {
                }
        }
 
-       function convert_them() {
+       function convert_categories() {
                global $wpdb;
 
-               if ( (!isset($_POST['cats_to_convert']) || !is_array($_POST['cats_to_convert'])) && empty($this->categories_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') . '</p>';
-                       echo '</div>';
-                       return;
+               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;
 
-                       echo '<li>' . sprintf(__('Converting category #%s ... '),  $cat_id);
-
-                       if (!$this->_category_exists($cat_id)) {
-                               _e('Category doesn\'t exist!');
+                       if ( ! $this->_category_exists($cat_id) ) {
+                               echo '<li>' . sprintf( __('Category %s doesn\'t exist!'),  $cat_id ) . "</li>\n";
                        } else {
                                $category =& get_category($cat_id);
-
-                               if ( tag_exists($wpdb->escape($category->name)) ) {
-                                       _e('Category is already a tag.');
-                                       echo '</li>';
-                                       continue;
-                               }
+                               echo '<li>' . sprintf(__('Converting category <strong>%s</strong> ... '),  $category->name);
 
                                // If the category is the default, leave category in place and create tag.
-                               if ( get_option('default_category') == $category->term_id ) {
-                                       $id = wp_insert_term($category->name, 'post_tag', array('slug' => $category->slug));
+                               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 ) {
-                                               if ( !$wpdb->get_var("SELECT object_id FROM $wpdb->term_relationships WHERE object_id = '$post' AND term_taxonomy_id = '$id'") )
-                                                       $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ('$post', '$id')");
+                                               $values[] = $wpdb->prepare( "(%d, %d, %d)", $post, $id, $term_order);
                                                clean_post_cache($post);
                                        }
-                               } else {
-                                       $tt_ids = $wpdb->get_col("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = '{$category->term_id}' AND taxonomy = 'category'");
-                                       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);
+                                       
+                                       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";
 
-                                       // Change the category to a tag.
-                                       $wpdb->query("UPDATE $wpdb->term_taxonomy SET taxonomy = 'post_tag' WHERE term_id = '{$category->term_id}' AND taxonomy = 'category'");
+                                       $hybrid_cats = true;
+                                       $clean_term_cache[] = $category->term_id;
+                                       $clean_cat_cache[] = $category->term_id;
 
-                                       $terms = $wpdb->get_col("SELECT term_id FROM $wpdb->term_taxonomy WHERE parent = '{$category->term_id}' AND taxonomy = 'category'");
-                                       foreach ( (array) $terms as $term )
-                                               clean_category_cache($term);
+                                       continue;
+                               }
 
-                                       // Set all parents to 0 (root-level) if their parent was the converted tag
-                                       $wpdb->query("UPDATE $wpdb->term_taxonomy SET parent = 0 WHERE parent = '{$category->term_id}' AND taxonomy = 'category'");
+                               $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);
                                }
-                               // Clean the cache
-                               clean_category_cache($category->term_id);
 
-                               _e('Converted successfully.');
+                               // 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>';
 
-                       echo '</li>';
+               if ( ! empty($clean_term_cache) ) {
+                       $clean_term_cache = array_unique(array_values($clean_term_cache));
+                       foreach ( $clean_term_cache as $id )
+                               wp_cache_delete($id, 'post_tag');
                }
 
-               echo '</ul>';
+               if ( ! empty($clean_cat_cache) ) {
+                       $clean_cat_cache = array_unique(array_values($clean_cat_cache));
+                       foreach ( $clean_cat_cache as $id )
+                               wp_cache_delete($id, 'category');
+               }
+
+               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\'t exist!') . "</li>\n",  $tag_id );
+                       }
+               }
+
+               if ( ! empty($clean_term_cache) ) {
+                       $clean_term_cache = array_unique(array_values($clean_term_cache));
+                       foreach ( $clean_term_cache as $id )
+                               wp_cache_delete($id, 'post_tag');
+               }
+
+               if ( ! empty($clean_cat_cache) ) {
+                       $clean_cat_cache = array_unique(array_values($clean_cat_cache));
+                       foreach ( $clean_cat_cache as $id )
+                               wp_cache_delete($id, 'category');
+               }
+
+               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')) {
-                       echo '<div class="narrow">';
-                       echo '<p>' . __('Cheatin&#8217; uh?') . '</p>';
-                       echo '</div>';
-               } else {
-                       if ( $step > 1 )
-                               check_admin_referer('import-cat2tag');
+               if ( current_user_can('manage_categories') ) {
 
                        switch ($step) {
                                case 1 :
-                                       $this->welcome();
+                                       $this->categories_tab();
                                break;
 
                                case 2 :
-                                       $this->convert_them();
+                                       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;
                        }
                }
@@ -234,6 +455,6 @@ function check_all_rows() {
 
 $wp_cat2tag_importer = new WP_Categories_to_Tags();
 
-register_importer('wp-cat2tag', __('Categories to Tags Converter'), __('Convert existing categories to tags, selectively.'), array(&$wp_cat2tag_importer, 'init'));
+register_importer('wp-cat2tag', __('Categories and Tags Converter'), __('Convert existing categories to tags or tags to categories, selectively.'), array(&$wp_cat2tag_importer, 'init'));
 
-?>
\ No newline at end of file
+?>
index 908d6b86b372cbc2e85b1bc9484d24ec170ed9aa..697a71c4fcf02e42a90563dbd17f7a1553f09396 100644 (file)
@@ -47,7 +47,7 @@ function wp_delete_link($link_id) {
 
        wp_delete_object_term_relationships($link_id, 'link_category');
 
-       $wpdb->query("DELETE FROM $wpdb->links WHERE link_id = '$link_id'");
+       $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->links WHERE link_id = %d", $link_id) );
 
        do_action('deleted_link', $link_id);
 
@@ -73,7 +73,7 @@ function wp_insert_link($linkdata) {
        $linkdata = wp_parse_args($linkdata, $defaults);
        $linkdata = sanitize_bookmark($linkdata, 'db');
 
-       extract($linkdata, EXTR_SKIP);
+       extract(stripslashes_deep($linkdata), EXTR_SKIP);
 
        $update = false;
 
@@ -119,15 +119,14 @@ function wp_insert_link($linkdata) {
        }
 
        if ( $update ) {
-               $wpdb->query("UPDATE $wpdb->links SET link_url='$link_url',
-                       link_name='$link_name', link_image='$link_image',
-                       link_target='$link_target',
-                       link_visible='$link_visible', link_description='$link_description',
-                       link_rating='$link_rating', link_rel='$link_rel',
-                       link_notes='$link_notes', link_rss = '$link_rss'
-                       WHERE link_id='$link_id'");
+               $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) );
        } else {
-               $wpdb->query("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('$link_url','$link_name', '$link_image', '$link_target', '$link_description', '$link_visible', '$link_owner', '$link_rating', '$link_rel', '$link_notes', '$link_rss')");
+               $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) );
                $link_id = (int) $wpdb->insert_id;
        }
 
diff --git a/wp-admin/includes/class-wp-filesystem-base.php b/wp-admin/includes/class-wp-filesystem-base.php
new file mode 100644 (file)
index 0000000..820703e
--- /dev/null
@@ -0,0 +1,158 @@
+<?php
+class WP_Filesystem_Base{
+       var $verbose = false;
+       var $cache = array();
+       
+       var $method = '';
+       
+       function abspath() {
+               if ( defined('FTP_BASE') && strpos($this->method, 'ftp') !== false ) 
+                       return FTP_BASE;
+               return $this->find_folder(ABSPATH);
+       }
+       function wp_content_dir() {
+               if ( defined('FTP_CONTENT_DIR') && strpos($this->method, 'ftp') !== false ) 
+                       return FTP_CONTENT_DIR;
+               return $this->find_folder(WP_CONTENT_DIR);
+       }
+       function wp_plugins_dir() {
+               if ( defined('FTP_PLUGIN_DIR') && strpos($this->method, 'ftp') !== false ) 
+                       return FTP_PLUGIN_DIR;
+               return $this->find_folder(WP_PLUGIN_DIR);
+       }
+       function wp_themes_dir() {
+               return $this->wp_content_dir() . '/themes';
+       }
+       //Back compat: use abspath() or wp_*_dir
+       function find_base_dir($base = '.', $echo = false) {
+               $this->verbose = $echo;
+               return $this->abspath();
+       }
+       //Back compat: use ::abspath() or ::wp_*_dir
+       function get_base_dir($base = '.', $echo = false) {
+               $this->verbose = $echo;
+               return $this->abspath();
+       }
+       
+       function find_folder($folder) {
+               $folder = str_replace('\\', '/', $folder); //Windows Sanitiation
+               if ( isset($this->cache[ $folder ] ) )
+                       return $this->cache[ $folder ];
+
+               if ( $this->exists($folder) ) { //Folder exists at that absolute path.
+                       $this->cache[ $folder ] = $folder;
+                       return $folder;
+               }
+               if( $return = $this->search_for_folder($folder) )
+                       $this->cache[ $folder ] = $return;
+               return $return;
+       }
+       
+       // Assumes $folder is windows sanitized;
+       // Assumes that the drive letter is safe to be stripped off, Should not be a problem for windows servers.
+       function search_for_folder($folder, $base = '.', $loop = false ) {
+               if ( empty( $base ) || '.' == $base )
+                       $base = trailingslashit($this->cwd());
+               
+               $folder = preg_replace('|^([a-z]{1}):|i', '', $folder); //Strip out windows driveletter if its there.
+               
+               $folder_parts = explode('/', $folder);
+               $last_path = $folder_parts[ count($folder_parts) - 1 ];
+               
+               $files = $this->dirlist( $base );
+               
+               foreach ( $folder_parts as $key ) {
+                       if ( $key == $last_path )
+                               continue; //We want this to be caught by the next code block.
+
+                       //Working from /home/ to /user/ to /wordpress/ see if that file exists within the current folder, 
+                       // If its found, change into it and follow through looking for it. 
+                       // If it cant find WordPress down that route, it'll continue onto the next folder level, and see if that matches, and so on.
+                       // If it reaches the end, and still cant find it, it'll return false for the entire function.
+                       if( isset($files[ $key ]) ){
+                               //Lets try that folder:
+                               $newdir = trailingslashit(path_join($base, $key));
+                               if( $this->verbose )
+                                       printf( __('Changing to %s') . '<br/>', $newdir );
+                               if( $ret = $this->search_for_folder( $folder, $newdir, $loop) )
+                                       return $ret;
+                       }
+               }
+               
+               //Only check this as a last resort, to prevent locating the incorrect install. All above proceeedures will fail quickly if this is the right branch to take.
+               if(isset( $files[ $last_path ] ) ) {
+                       if( $this->verbose )
+                               printf( __('Found %s') . '<br/>',  $base . $last_path );
+                       return $base . $last_path;
+               }
+               if( $loop )
+                       return false;//Prevent tihs function looping again.
+               //As an extra last resort, Change back to / if the folder wasnt found. This comes into effect when the CWD is /home/user/ but WP is at /var/www/.... mainly dedicated setups.
+               return $this->search_for_folder($folder, '/', true); 
+               
+       }
+       
+       //Common Helper functions.
+       function gethchmod($file){
+               //From the PHP.net page for ...?
+               $perms = $this->getchmod($file);
+               if (($perms & 0xC000) == 0xC000) // Socket
+                       $info = 's';
+               elseif (($perms & 0xA000) == 0xA000) // Symbolic Link
+                       $info = 'l';
+               elseif (($perms & 0x8000) == 0x8000) // Regular
+                       $info = '-';
+               elseif (($perms & 0x6000) == 0x6000) // Block special
+                       $info = 'b';
+               elseif (($perms & 0x4000) == 0x4000) // Directory
+                       $info = 'd';
+               elseif (($perms & 0x2000) == 0x2000) // Character special
+                       $info = 'c';
+               elseif (($perms & 0x1000) == 0x1000)// FIFO pipe
+                       $info = 'p';
+               else // Unknown
+                       $info = 'u';
+
+               // Owner
+               $info .= (($perms & 0x0100) ? 'r' : '-');
+               $info .= (($perms & 0x0080) ? 'w' : '-');
+               $info .= (($perms & 0x0040) ?
+                                       (($perms & 0x0800) ? 's' : 'x' ) :
+                                       (($perms & 0x0800) ? 'S' : '-'));
+
+               // Group
+               $info .= (($perms & 0x0020) ? 'r' : '-');
+               $info .= (($perms & 0x0010) ? 'w' : '-');
+               $info .= (($perms & 0x0008) ?
+                                       (($perms & 0x0400) ? 's' : 'x' ) :
+                                       (($perms & 0x0400) ? 'S' : '-'));
+
+               // World
+               $info .= (($perms & 0x0004) ? 'r' : '-');
+               $info .= (($perms & 0x0002) ? 'w' : '-');
+               $info .= (($perms & 0x0001) ?
+                                       (($perms & 0x0200) ? 't' : 'x' ) :
+                                       (($perms & 0x0200) ? 'T' : '-'));
+               return $info;
+       }
+       function getnumchmodfromh($mode) {
+               $realmode = "";
+               $legal =  array("", "w", "r", "x", "-");
+               $attarray = preg_split("//", $mode);
+
+               for($i=0; $i < count($attarray); $i++)
+                  if($key = array_search($attarray[$i], $legal))
+                          $realmode .= $legal[$key];
+                          
+               $mode = str_pad($realmode, 9, '-');
+               $trans = array('-'=>'0', 'r'=>'4', 'w'=>'2', 'x'=>'1');
+               $mode = strtr($mode,$trans);
+               
+               $newmode = '';
+               $newmode .= $mode[0] + $mode[1] + $mode[2];
+               $newmode .= $mode[3] + $mode[4] + $mode[5];
+               $newmode .= $mode[6] + $mode[7] + $mode[8];
+               return $newmode;
+       }
+}
+?>
index 45972a3875f2f29b83e929296e411658c3ff3a80..77a7582669bfca178cba2d83188c9a38e2f604e5 100644 (file)
@@ -1,51 +1,46 @@
 <?php
 
-class WP_Filesystem_Direct{
+class WP_Filesystem_Direct  extends WP_Filesystem_Base {
        var $permission = null;
        var $errors = array();
-       function WP_Filesystem_Direct($arg){
+       function WP_Filesystem_Direct($arg) {
+               $this->method = 'direct';
                $this->errors = new WP_Error();
                $this->permission = umask();
        }
-       function connect(){
+       function connect() {
                return true;
        }
-       function setDefaultPermissions($perm){
+       function setDefaultPermissions($perm) {
                $this->permission = $perm;
        }
-       function find_base_dir($base = '.', $echo = false){
-               return str_replace('\\','/',ABSPATH);
-       }
-       function get_base_dir($base = '.', $echo = false){
-               return $this->find_base_dir($base, $echo);
-       }
-       function get_contents($file){
+       function get_contents($file) {
                return @file_get_contents($file);
        }
-       function get_contents_array($file){
+       function get_contents_array($file) {
                return @file($file);
        }
-       function put_contents($file,$contents,$mode=false,$type=''){
-               if ( ! ($fp = @fopen($file,'w'.$type)) )
+       function put_contents($file, $contents, $mode = false, $type = '') {
+               if ( ! ($fp = @fopen($file, 'w' . $type)) )
                        return false;
-               @fwrite($fp,$contents);
+               @fwrite($fp, $contents);
                @fclose($fp);
                $this->chmod($file,$mode);
                return true;
        }
-       function cwd(){
+       function cwd() {
                return @getcwd();
        }
-       function chdir($dir){
+       function chdir($dir) {
                return @chdir($dir);
        }
-       function chgrp($file,$group,$recursive=false){
+       function chgrp($file, $group, $recursive = false) {
                if( ! $this->exists($file) )
                        return false;
                if( ! $recursive )
-                       return @chgrp($file,$group);
+                       return @chgrp($file, $group);
                if( ! $this->is_dir($file) )
-                       return @chgrp($file,$group);
+                       return @chgrp($file, $group);
                //Is a directory, and we want recursive
                $file = trailingslashit($file);
                $filelist = $this->dirlist($file);
@@ -54,7 +49,7 @@ class WP_Filesystem_Direct{
 
                return true;
        }
-       function chmod($file,$mode=false,$recursive=false){
+       function chmod($file, $mode = false, $recursive = false) {
                if( ! $mode )
                        $mode = $this->permission;
                if( ! $this->exists($file) )
@@ -62,7 +57,7 @@ class WP_Filesystem_Direct{
                if( ! $recursive )
                        return @chmod($file,$mode);
                if( ! $this->is_dir($file) )
-                       return @chmod($file,$mode);
+                       return @chmod($file, $mode);
                //Is a directory, and we want recursive
                $file = trailingslashit($file);
                $filelist = $this->dirlist($file);
@@ -71,120 +66,51 @@ class WP_Filesystem_Direct{
 
                return true;
        }
-       function chown($file,$owner,$recursive=false){
+       function chown($file, $owner, $recursive = false) {
                if( ! $this->exists($file) )
                        return false;
                if( ! $recursive )
-                       return @chown($file,$owner);
+                       return @chown($file, $owner);
                if( ! $this->is_dir($file) )
-                       return @chown($file,$owner);
+                       return @chown($file, $owner);
                //Is a directory, and we want recursive
                $filelist = $this->dirlist($file);
                foreach($filelist as $filename){
-                       $this->chown($file.'/'.$filename,$owner,$recursive);
+                       $this->chown($file . '/' . $filename, $owner, $recursive);
                }
                return true;
        }
-       function owner($file){
+       function owner($file) {
                $owneruid = @fileowner($file);
                if( ! $owneruid )
                        return false;
-               if( !function_exists('posix_getpwuid') )
+               if( ! function_exists('posix_getpwuid') )
                        return $owneruid;
                $ownerarray = posix_getpwuid($owneruid);
                return $ownerarray['name'];
        }
-       function getchmod($file){
+       function getchmod($file) {
                return @fileperms($file);
        }
-       function gethchmod($file){
-               //From the PHP.net page for ...?
-               $perms = $this->getchmod($file);
-               if (($perms & 0xC000) == 0xC000) {
-                       // Socket
-                       $info = 's';
-               } elseif (($perms & 0xA000) == 0xA000) {
-                       // Symbolic Link
-                       $info = 'l';
-               } elseif (($perms & 0x8000) == 0x8000) {
-                       // Regular
-                       $info = '-';
-               } elseif (($perms & 0x6000) == 0x6000) {
-                       // Block special
-                       $info = 'b';
-               } elseif (($perms & 0x4000) == 0x4000) {
-                       // Directory
-                       $info = 'd';
-               } elseif (($perms & 0x2000) == 0x2000) {
-                       // Character special
-                       $info = 'c';
-               } elseif (($perms & 0x1000) == 0x1000) {
-                       // FIFO pipe
-                       $info = 'p';
-               } else {
-                       // Unknown
-                       $info = 'u';
-               }
-
-               // Owner
-               $info .= (($perms & 0x0100) ? 'r' : '-');
-               $info .= (($perms & 0x0080) ? 'w' : '-');
-               $info .= (($perms & 0x0040) ?
-                                       (($perms & 0x0800) ? 's' : 'x' ) :
-                                       (($perms & 0x0800) ? 'S' : '-'));
-
-               // Group
-               $info .= (($perms & 0x0020) ? 'r' : '-');
-               $info .= (($perms & 0x0010) ? 'w' : '-');
-               $info .= (($perms & 0x0008) ?
-                                       (($perms & 0x0400) ? 's' : 'x' ) :
-                                       (($perms & 0x0400) ? 'S' : '-'));
-
-               // World
-               $info .= (($perms & 0x0004) ? 'r' : '-');
-               $info .= (($perms & 0x0002) ? 'w' : '-');
-               $info .= (($perms & 0x0001) ?
-                                       (($perms & 0x0200) ? 't' : 'x' ) :
-                                       (($perms & 0x0200) ? 'T' : '-'));
-               return $info;
-       }
-       function getnumchmodfromh($mode) {
-               $realmode = "";
-               $legal =  array("","w","r","x","-");
-               $attarray = preg_split("//",$mode);
-               for($i=0;$i<count($attarray);$i++){
-                  if($key = array_search($attarray[$i],$legal)){
-                          $realmode .= $legal[$key];
-                  }
-               }
-               $mode = str_pad($realmode,9,'-');
-               $trans = array('-'=>'0','r'=>'4','w'=>'2','x'=>'1');
-               $mode = strtr($mode,$trans);
-               $newmode = '';
-               $newmode .= $mode[0]+$mode[1]+$mode[2];
-               $newmode .= $mode[3]+$mode[4]+$mode[5];
-               $newmode .= $mode[6]+$mode[7]+$mode[8];
-               return $newmode;
-       }
-       function group($file){
+       function group($file) {
                $gid = @filegroup($file);
                if( ! $gid )
                        return false;
-               if( !function_exists('posix_getgrgid') )
+               if( ! function_exists('posix_getgrgid') )
                        return $gid;
                $grouparray = posix_getgrgid($gid);
                return $grouparray['name'];
        }
 
-       function copy($source,$destination,$overwrite=false){
+       function copy($source, $destination, $overwrite = false) {
                if( ! $overwrite && $this->exists($destination) )
                        return false;
-               return copy($source,$destination);
+               return copy($source, $destination);
        }
 
-       function move($source,$destination,$overwrite=false){
+       function move($source, $destination, $overwrite = false) {
                //Possible to use rename()?
-               if( $this->copy($source,$destination,$overwrite) && $this->exists($destination) ){
+               if( $this->copy($source, $destination, $overwrite) && $this->exists($destination) ){
                        $this->delete($source);
                        return true;
                } else {
@@ -192,12 +118,12 @@ class WP_Filesystem_Direct{
                }
        }
 
-       function delete($file, $recursive=false){
-               $file = str_replace('\\','/',$file); //for win32, occasional problems deleteing files otherwise
+       function delete($file, $recursive = false) {
+               $file = str_replace('\\', '/', $file); //for win32, occasional problems deleteing files otherwise
 
                if( $this->is_file($file) )
                        return @unlink($file);
-               if( !$recursive && $this->is_dir($file) )
+               if( ! $recursive && $this->is_dir($file) )
                        return @rmdir($file);
 
                //At this point its a folder, and we're in recursive mode
@@ -206,7 +132,7 @@ class WP_Filesystem_Direct{
 
                $retval = true;
                if( is_array($filelist) ) //false if no files, So check first.
-                       foreach($filelist as $filename=>$fileinfo)
+                       foreach($filelist as $filename => $fileinfo)
                                if( ! $this->delete($file . $filename, $recursive) )
                                        $retval = false;
 
@@ -215,34 +141,34 @@ class WP_Filesystem_Direct{
                return $retval;
        }
 
-       function exists($file){
+       function exists($file) {
                return @file_exists($file);
        }
 
-       function is_file($file){
+       function is_file($file) {
                return @is_file($file);
        }
 
-       function is_dir($path){
+       function is_dir($path) {
                return @is_dir($path);
        }
 
-       function is_readable($file){
+       function is_readable($file) {
                return @is_readable($file);
        }
 
-       function is_writable($file){
+       function is_writable($file) {
                return @is_writable($file);
        }
 
-       function atime($file){
+       function atime($file) {
                return @fileatime($file);
        }
 
-       function mtime($file){
+       function mtime($file) {
                return @filemtime($file);
        }
-       function size($file){
+       function size($file) {
                return @filesize($file);
        }
 
@@ -251,38 +177,38 @@ class WP_Filesystem_Direct{
                        $time = time();
                if($atime == 0)
                        $atime = time();
-               return @touch($file,$time,$atime);
+               return @touch($file, $time, $atime);
        }
 
        function mkdir($path, $chmod = false, $chown = false, $chgrp = false){
                if( ! $chmod)
                        $chmod = $this->permission;
 
-               if( !@mkdir($path,$chmod) )
+               if( ! @mkdir($path, $chmod) )
                        return false;
                if( $chown )
-                       $this->chown($path,$chown);
+                       $this->chown($path, $chown);
                if( $chgrp )
-                       $this->chgrp($path,$chgrp);
+                       $this->chgrp($path, $chgrp);
                return true;
        }
 
-       function rmdir($path,$recursive=false){
+       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);
+               foreach($filelist as $filename => $det) {
+                       if ( '/' == substr($filename, -1, 1) )
+                               $this->rmdir($path . '/' . $filename, $recursive);
                        @rmdir($filename);
                }
                return @rmdir($path);
        }
 
-       function dirlist($path,$incdot=false,$recursive=false){
-               if( $this->is_file($path) ){
+       function dirlist($path, $incdot = false, $recursive = false) {
+               if( $this->is_file($path) ) {
                        $limitFile = basename($path);
                        $path = dirname($path);
                } else {
@@ -293,9 +219,9 @@ class WP_Filesystem_Direct{
 
                $ret = array();
                $dir = dir($path);
-               while (false !== ($entry = $dir->read())) {
+               while (false !== ($entry = $dir->read()) ) {
                        $struc = array();
-                       $struc['name']          = $entry;
+                       $struc['name'] = $entry;
 
                        if( '.' == $struc['name'] || '..' == $struc['name'] )
                                continue; //Do not care about these folders.
@@ -315,9 +241,9 @@ class WP_Filesystem_Direct{
                        $struc['time']          = date('h:i:s',$struc['lastmodunix']);
                        $struc['type']          = $this->is_dir($path.'/'.$entry) ? 'd' : 'f';
 
-                       if ('d' == $struc['type'] ){
+                       if ( 'd' == $struc['type'] ) {
                                if( $recursive )
-                                       $struc['files'] = $this->dirlist($path.'/'.$struc['name'], $incdot, $recursive);
+                                       $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive);
                                else
                                        $struc['files'] = array();
                        }
@@ -328,9 +254,5 @@ class WP_Filesystem_Direct{
                unset($dir);
                return $ret;
        }
-
-       function __destruct(){
-               return;
-       }
 }
 ?>
index 32ccd07d6054dc6b72bc89f77a51f599b446ba11..20699351d9d96fb52e1eaa8ecfa49acd1c9d7a96 100644 (file)
@@ -1,11 +1,10 @@
 <?php
-class WP_Filesystem_FTPext{
+class WP_Filesystem_FTPext extends WP_Filesystem_Base{
        var $link;
        var $timeout = 5;
        var $errors = array();
        var $options = array();
 
-       var $wp_base = '';
        var $permission = null;
 
        var $filetypes = array(
@@ -24,6 +23,7 @@ class WP_Filesystem_FTPext{
                                                        );
 
        function WP_Filesystem_FTPext($opt='') {
+               $this->method = 'ftpext';
                $this->errors = new WP_Error();
 
                //Check if possible to use ftp functions.
@@ -60,12 +60,11 @@ class WP_Filesystem_FTPext{
                $this->options['ssl'] = ( !empty($opt['ssl']) );
        }
 
-       function connect(){
-               if ( $this->options['ssl'] && function_exists('ftp_ssl_connect') ) {
+       function connect() {
+               if ( $this->options['ssl'] && function_exists('ftp_ssl_connect') )
                        $this->link = @ftp_ssl_connect($this->options['hostname'], $this->options['port'],$this->timeout);
-               } else {
+               else
                        $this->link = @ftp_connect($this->options['hostname'], $this->options['port'],$this->timeout);
-               }
 
                if ( ! $this->link ) {
                        $this->errors->add('connect', sprintf(__('Failed to connect to FTP Server %1$s:%2$s'), $this->options['hostname'], $this->options['port']));
@@ -80,76 +79,11 @@ class WP_Filesystem_FTPext{
                return true;
        }
 
-       function setDefaultPermissions($perm){
+       function setDefaultPermissions($perm) {
                $this->permission = $perm;
        }
-
-       function find_base_dir($base = '.',$echo = false, $loop = false) {
-               //Sanitize the Windows path formats, This allows easier conparison and aligns it to FTP output.
-               $abspath = str_replace('\\','/',ABSPATH); //windows: Straighten up the paths..
-               if( strpos($abspath, ':') ){ //Windows, Strip out the driveletter
-                       if( preg_match("|.{1}\:(.+)|i", $abspath, $mat) )
-                               $abspath = $mat[1];
-               }
        
-               //Set up the base directory (Which unless specified, is the current one)
-               if( empty( $base ) || '.' == $base ) $base = $this->cwd();
-               $base = trailingslashit($base);
-
-               //Can we see the Current directory as part of the ABSPATH?
-               $location = strpos($abspath, $base);
-               if( false !== $location ) {
-                       $newbase = path_join($base, substr($abspath, $location + strlen($base)));
-
-                       if( false !== $this->chdir($newbase) ){ //chdir sometimes returns null under certain circumstances, even when its changed correctly, FALSE will be returned if it doesnt change correctly.
-                               if($echo) printf( __('Changing to %s') . '<br/>', $newbase );
-                               //Check to see if it exists in that folder.
-                               if( $this->exists($newbase . 'wp-settings.php') ){
-                                       if($echo) printf( __('Found %s'),  $newbase . 'wp-settings.php<br/>' );
-                                       return $newbase;
-                               }       
-                       }
-               }
-       
-               //Ok, Couldnt do a magic location from that particular folder level
-               
-               //Get a list of the files in the current directory, See if we can locate where we are in the folder stucture.
-               $files = $this->dirlist($base);
-               
-               $arrPath = explode('/', $abspath);
-               foreach($arrPath as $key){
-                       //Working from /home/ to /user/ to /wordpress/ see if that file exists within the current folder, 
-                       // If its found, change into it and follow through looking for it. 
-                       // If it cant find WordPress down that route, it'll continue onto the next folder level, and see if that matches, and so on.
-                       // If it reaches the end, and still cant find it, it'll return false for the entire function.
-                       if( isset($files[ $key ]) ){
-                               //Lets try that folder:
-                               $folder = path_join($base, $key);
-                               if($echo) printf( __('Changing to %s') . '<br/>', $folder );
-                               $ret = $this->find_base_dir( $folder, $echo, $loop);
-                               if( $ret )
-                                       return $ret;
-                       }
-               }
-               //Only check this as a last resort, to prevent locating the incorrect install. All above proceeedures will fail quickly if this is the right branch to take.
-               if(isset( $files[ 'wp-settings.php' ]) ){
-                       if($echo) printf( __('Found %s'),  $base . 'wp-settings.php<br/>' );
-                       return $base;
-               }
-               if( $loop )
-                       return false;//Prevent tihs function looping again.
-               //As an extra last resort, Change back to / if the folder wasnt found. This comes into effect when the CWD is /home/user/ but WP is at /var/www/.... mainly dedicated setups.
-               return $this->find_base_dir('/', $echo, true); 
-       }
-
-       function get_base_dir($base = '.', $echo = false){
-               if( defined('FTP_BASE') )
-                       $this->wp_base = FTP_BASE;
-               if( empty($this->wp_base) )
-                       $this->wp_base = $this->find_base_dir($base,$echo);
-               return $this->wp_base;
-       }
-       function get_contents($file,$type='',$resumepos=0){
+       function get_contents($file, $type = '', $resumepos = 0 ){
                if( empty($type) ){
                        $extension = substr(strrchr($file, "."), 1);
                        $type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_ASCII;
@@ -157,7 +91,7 @@ class WP_Filesystem_FTPext{
                $temp = tmpfile();
                if ( ! $temp )
                        return false;
-               if( ! @ftp_fget($this->link,$temp,$file,$type,$resumepos) )
+               if( ! @ftp_fget($this->link, $temp, $file, $type, $resumepos) )
                        return false;
                fseek($temp, 0); //Skip back to the start of the file being written to
                $contents = '';
@@ -167,202 +101,132 @@ class WP_Filesystem_FTPext{
                fclose($temp);
                return $contents;
        }
-       function get_contents_array($file){
-               return explode("\n",$this->get_contents($file));
+       function get_contents_array($file) {
+               return explode("\n", $this->get_contents($file));
        }
-       function put_contents($file,$contents,$type=''){
-               if( empty($type) ){
+       function put_contents($file, $contents, $type = '' ) {
+               if( empty($type) ) {
                        $extension = substr(strrchr($file, "."), 1);
                        $type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_ASCII;
                }
                $temp = tmpfile();
                if ( ! $temp )
                        return false;
-               fwrite($temp,$contents);
+               fwrite($temp, $contents);
                fseek($temp, 0); //Skip back to the start of the file being written to
-               $ret = @ftp_fput($this->link,$file,$temp,$type);
+               $ret = @ftp_fput($this->link, $file, $temp, $type);
                fclose($temp);
                return $ret;
        }
-       function cwd(){
+       function cwd() {
                $cwd = ftp_pwd($this->link);
                if( $cwd )
                        $cwd = trailingslashit($cwd);
                return $cwd;
        }
-       function chdir($dir){
+       function chdir($dir) {
                return @ftp_chdir($dir);
        }
-       function chgrp($file,$group,$recursive=false){
+       function chgrp($file, $group, $recursive = false ) {
                return false;
        }
-       function chmod($file,$mode=false,$recursive=false){
+       function chmod($file, $mode = false, $recursive = false) {
                if( ! $mode )
                        $mode = $this->permission;
                if( ! $mode )
                        return false;
                if ( ! $this->exists($file) )
                        return false;
-               if ( ! $recursive || ! $this->is_dir($file) ){
-                       if (!function_exists('ftp_chmod'))
+               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);
+                       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);
+                       $this->chmod($file . '/' . $filename, $mode, $recursive);
                }
                return true;
        }
-       function chown($file,$owner,$recursive=false){
+       function chown($file, $owner, $recursive = false ) {
                return false;
        }
-       function owner($file){
+       function owner($file) {
                $dir = $this->dirlist($file);
                return $dir[$file]['owner'];
        }
-       function getchmod($file){
+       function getchmod($file) {
                $dir = $this->dirlist($file);
                return $dir[$file]['permsn'];
        }
-       function gethchmod($file){
-               //From the PHP.net page for ...?
-               $perms = $this->getchmod($file);
-               if (($perms & 0xC000) == 0xC000) {
-                       // Socket
-                       $info = 's';
-               } elseif (($perms & 0xA000) == 0xA000) {
-                       // Symbolic Link
-                       $info = 'l';
-               } elseif (($perms & 0x8000) == 0x8000) {
-                       // Regular
-                       $info = '-';
-               } elseif (($perms & 0x6000) == 0x6000) {
-                       // Block special
-                       $info = 'b';
-               } elseif (($perms & 0x4000) == 0x4000) {
-                       // Directory
-                       $info = 'd';
-               } elseif (($perms & 0x2000) == 0x2000) {
-                       // Character special
-                       $info = 'c';
-               } elseif (($perms & 0x1000) == 0x1000) {
-                       // FIFO pipe
-                       $info = 'p';
-               } else {
-                       // Unknown
-                       $info = 'u';
-               }
-
-               // Owner
-               $info .= (($perms & 0x0100) ? 'r' : '-');
-               $info .= (($perms & 0x0080) ? 'w' : '-');
-               $info .= (($perms & 0x0040) ?
-                                       (($perms & 0x0800) ? 's' : 'x' ) :
-                                       (($perms & 0x0800) ? 'S' : '-'));
-
-               // Group
-               $info .= (($perms & 0x0020) ? 'r' : '-');
-               $info .= (($perms & 0x0010) ? 'w' : '-');
-               $info .= (($perms & 0x0008) ?
-                                       (($perms & 0x0400) ? 's' : 'x' ) :
-                                       (($perms & 0x0400) ? 'S' : '-'));
-
-               // World
-               $info .= (($perms & 0x0004) ? 'r' : '-');
-               $info .= (($perms & 0x0002) ? 'w' : '-');
-               $info .= (($perms & 0x0001) ?
-                                       (($perms & 0x0200) ? 't' : 'x' ) :
-                                       (($perms & 0x0200) ? 'T' : '-'));
-               return $info;
-       }
-       function getnumchmodfromh($mode) {
-               $realmode = "";
-               $legal =  array("","w","r","x","-");
-               $attarray = preg_split("//",$mode);
-               for($i=0;$i<count($attarray);$i++){
-                  if($key = array_search($attarray[$i],$legal)){
-                          $realmode .= $legal[$key];
-                  }
-               }
-               $mode = str_pad($realmode,9,'-');
-               $trans = array('-'=>'0','r'=>'4','w'=>'2','x'=>'1');
-               $mode = strtr($mode,$trans);
-               $newmode = '';
-               $newmode .= $mode[0]+$mode[1]+$mode[2];
-               $newmode .= $mode[3]+$mode[4]+$mode[5];
-               $newmode .= $mode[6]+$mode[7]+$mode[8];
-               return $newmode;
-       }
-       function group($file){
+       function group($file) {
                $dir = $this->dirlist($file);
                return $dir[$file]['group'];
        }
-       function copy($source,$destination,$overwrite=false){
+       function copy($source, $destination, $overwrite = false ) {
                if( ! $overwrite && $this->exists($destination) )
                        return false;
                $content = $this->get_contents($source);
                if( false === $content)
                        return false;
-               return $this->put_contents($destination,$content);
+               return $this->put_contents($destination, $content);
        }
-       function move($source,$destination,$overwrite=false){
-               return ftp_rename($this->link,$source,$destination);
+       function move($source, $destination, $overwrite = false) {
+               return ftp_rename($this->link, $source, $destination);
        }
 
        function delete($file,$recursive=false) {
                if ( $this->is_file($file) )
-                       return @ftp_delete($this->link,$file);
+                       return @ftp_delete($this->link, $file);
                if ( !$recursive )
-                       return @ftp_rmdir($this->link,$file);
+                       return @ftp_rmdir($this->link, $file);
                $filelist = $this->dirlist($file);
                foreach ((array) $filelist as $filename => $fileinfo) {
-                       $this->delete($file.'/'.$filename,$recursive);
+                       $this->delete($file . '/' . $filename, $recursive);
                }
-               return @ftp_rmdir($this->link,$file);
+               return @ftp_rmdir($this->link, $file);
        }
 
-       function exists($file){
-               $list = ftp_rawlist($this->link,$file,false);
+       function exists($file) {
+               $list = ftp_rawlist($this->link, $file, false);
                if( ! $list )
                        return false;
                return count($list) == 1 ? true : false;
        }
-       function is_file($file){
+       function is_file($file) {
                return $this->is_dir($file) ? false : true;
        }
-       function is_dir($path){
+       function is_dir($path) {
                $cwd = $this->cwd();
                $result = @ftp_chdir($this->link, $path);
-               if( $result && $path == $this->cwd() ||
-                       $this->cwd() != $cwd ) {
+               if( $result && $path == $this->cwd() || $this->cwd() != $cwd ) {
                        @ftp_chdir($this->link, $cwd);
                        return true;
                }
                return false;
        }
-       function is_readable($file){
+       function is_readable($file) {
                //Get dir list, Check if the file is writable by the current user??
                return true;
        }
-       function is_writable($file){
+       function is_writable($file) {
                //Get dir list, Check if the file is writable by the current user??
                return true;
        }
-       function atime($file){
+       function atime($file) {
                return false;
        }
-       function mtime($file){
+       function mtime($file) {
                return ftp_mdtm($this->link, $file);
        }
-       function size($file){
+       function size($file) {
                return ftp_size($this->link, $file);
        }
-       function touch($file,$time=0,$atime=0){
+       function touch($file, $time = 0, $atime = 0) {
                return false;
        }
-       function mkdir($path,$chmod=false,$chown=false,$chgrp=false){
+       function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
                if( !@ftp_mkdir($this->link, $path) )
                        return false;
                if( $chmod )
@@ -373,7 +237,7 @@ class WP_Filesystem_FTPext{
                        $this->chgrp($path, $chgrp);
                return true;
        }
-       function rmdir($path,$recursive=false){
+       function rmdir($path, $recursive = false) {
                if( ! $recursive )
                        return @ftp_rmdir($this->link, $path);
 
@@ -385,9 +249,9 @@ class WP_Filesystem_FTPext{
 
        function parselisting($line) {
                $is_windows = ($this->OS_remote == FTP_OS_Windows);
-               if ($is_windows && preg_match("/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|<DIR>) +(.+)/",$line,$lucifer)) {
+               if ($is_windows && preg_match("/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|<DIR>) +(.+)/", $line, $lucifer)) {
                        $b = array();
-                       if ($lucifer[3]<70) { $lucifer[3]+=2000; } else { $lucifer[3]+=1900; } // 4digit year fix
+                       if ($lucifer[3]<70) { $lucifer[3] +=2000; } else { $lucifer[3]+=1900; } // 4digit year fix
                        $b['isdir'] = ($lucifer[7]=="<DIR>");
                        if ( $b['isdir'] )
                                $b['type'] = 'd';
@@ -445,15 +309,15 @@ class WP_Filesystem_FTPext{
                return $b;
        }
 
-       function dirlist($path='.',$incdot=false,$recursive=false){
-               if( $this->is_file($path) ){
+       function dirlist($path = '.', $incdot = false, $recursive = false) {
+               if( $this->is_file($path) ) {
                        $limitFile = basename($path);
                        $path = dirname($path) . '/';
                } else {
                        $limitFile = false;
                }
 
-               $list = @ftp_rawlist($this->link , '-a ' . $path, false);
+               $list = @ftp_rawlist($this->link, '-a ' . $path, false);
 
                if ( $list === false )
                        return false;
@@ -464,10 +328,10 @@ class WP_Filesystem_FTPext{
                        if ( empty($entry) )
                                continue;
 
-                       if ( $entry["name"]=="." or $entry["name"]==".." )
+                       if ( '.' == $entry["name"] || '..' == $entry["name"] )
                                continue;
 
-                       $dirlist[$entry['name']] = $entry;
+                       $dirlist[ $entry['name'] ] = $entry;
                }
 
                if ( ! $dirlist )
@@ -485,11 +349,11 @@ class WP_Filesystem_FTPext{
                                        //We're including the doted starts
                                        if( '.' != $struc['name'] && '..' != $struc['name'] ){ //Ok, It isnt a special folder
                                                if ($recursive)
-                                                       $struc['files'] = $this->dirlist($path.'/'.$struc['name'],$incdot,$recursive);
+                                                       $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive);
                                        }
                                } else { //No dots
                                        if ($recursive)
-                                               $struc['files'] = $this->dirlist($path.'/'.$struc['name'],$incdot,$recursive);
+                                               $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive);
                                }
                        }
                        //File
index 53656236acff3d6c640e3292fe6a99f70930ea0d..3b6cdcc8ade2e767679c001330cccb94bbd06449 100644 (file)
@@ -1,29 +1,29 @@
 <?php
-class WP_Filesystem_ftpsockets{
+class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
        var $ftp = false;
        var $timeout = 5;
        var $errors;
        var $options = array();
 
-       var $wp_base = '';
        var $permission = null;
 
        var $filetypes = array(
-                                                       'php'=>FTP_ASCII,
-                                                       'css'=>FTP_ASCII,
-                                                       'txt'=>FTP_ASCII,
-                                                       'js'=>FTP_ASCII,
-                                                       'html'=>FTP_ASCII,
-                                                       'htm'=>FTP_ASCII,
-                                                       'xml'=>FTP_ASCII,
-
-                                                       'jpg'=>FTP_BINARY,
-                                                       'png'=>FTP_BINARY,
-                                                       'gif'=>FTP_BINARY,
-                                                       'bmp'=>FTP_BINARY
+                                                       'php' => FTP_ASCII,
+                                                       'css' => FTP_ASCII,
+                                                       'txt' => FTP_ASCII,
+                                                       'js'  => FTP_ASCII,
+                                                       'html'=> FTP_ASCII,
+                                                       'htm' => FTP_ASCII,
+                                                       'xml' => FTP_ASCII,
+
+                                                       'jpg' => FTP_BINARY,
+                                                       'png' => FTP_BINARY,
+                                                       'gif' => FTP_BINARY,
+                                                       'bmp' => FTP_BINARY
                                                        );
 
        function WP_Filesystem_ftpsockets($opt='') {
+               $this->method = 'ftpsockets';
                $this->errors = new WP_Error();
 
                //Check if possible to use ftp functions.
@@ -86,241 +86,109 @@ class WP_Filesystem_ftpsockets{
                $this->permission = $perm;
        }
 
-       function find_base_dir($base = '.',$echo = false, $loop = false) {
-               //Sanitize the Windows path formats, This allows easier conparison and aligns it to FTP output.
-               $abspath = str_replace('\\','/',ABSPATH); //windows: Straighten up the paths..
-               if( strpos($abspath, ':') ){ //Windows, Strip out the driveletter
-                       if( preg_match("|.{1}\:(.+)|i", $abspath, $mat) )
-                               $abspath = $mat[1];
-               }
-       
-               //Set up the base directory (Which unless specified, is the current one)
-               if( empty( $base ) || '.' == $base ) $base = $this->cwd();
-               $base = trailingslashit($base);
-
-               //Can we see the Current directory as part of the ABSPATH?
-               $location = strpos($abspath, $base);
-               if( false !== $location ) {
-                       $newbase = path_join($base, substr($abspath, $location + strlen($base)));
-
-                       if( false !== $this->chdir($newbase) ){ //chdir sometimes returns null under certain circumstances, even when its changed correctly, FALSE will be returned if it doesnt change correctly.
-                               if($echo) printf( __('Changing to %s') . '<br/>', $newbase );
-                               //Check to see if it exists in that folder.
-                               if( $this->exists($newbase . 'wp-settings.php') ){
-                                       if($echo) printf( __('Found %s'),  $newbase . 'wp-settings.php<br/>' );
-                                       return $newbase;
-                               }       
-                       }
-               }
-       
-               //Ok, Couldnt do a magic location from that particular folder level
-               
-               //Get a list of the files in the current directory, See if we can locate where we are in the folder stucture.
-               $files = $this->dirlist($base);
-               
-               $arrPath = explode('/', $abspath);
-               foreach($arrPath as $key){
-                       //Working from /home/ to /user/ to /wordpress/ see if that file exists within the current folder, 
-                       // If its found, change into it and follow through looking for it. 
-                       // If it cant find WordPress down that route, it'll continue onto the next folder level, and see if that matches, and so on.
-                       // If it reaches the end, and still cant find it, it'll return false for the entire function.
-                       if( isset($files[ $key ]) ){
-                               //Lets try that folder:
-                               $folder = path_join($base, $key);
-                               if($echo) printf( __('Changing to %s') . '<br/>', $folder );
-                               $ret = $this->find_base_dir( $folder, $echo, $loop);
-                               if( $ret )
-                                       return $ret;
-                       }
-               }
-               //Only check this as a last resort, to prevent locating the incorrect install. All above proceeedures will fail quickly if this is the right branch to take.
-               if(isset( $files[ 'wp-settings.php' ]) ){
-                       if($echo) printf( __('Found %s'),  $base . 'wp-settings.php<br/>' );
-                       return $base;
-               }
-               if( $loop )
-                       return false;//Prevent tihs function looping again.
-               //As an extra last resort, Change back to / if the folder wasnt found. This comes into effect when the CWD is /home/user/ but WP is at /var/www/.... mainly dedicated setups.
-               return $this->find_base_dir('/', $echo, true); 
-       }
-
-       function get_base_dir($base = '.', $echo = false){
-               if( defined('FTP_BASE') )
-                       $this->wp_base = FTP_BASE;
-               if( empty($this->wp_base) )
-                       $this->wp_base = $this->find_base_dir($base, $echo);
-               return $this->wp_base;
-       }
-
-       function get_contents($file,$type='',$resumepos=0){
+       function get_contents($file, $type = '', $resumepos = 0){
                if( ! $this->exists($file) )
                        return false;
 
                if( empty($type) ){
-                       $extension = substr(strrchr($file, "."), 1);
+                       $extension = substr(strrchr($file, '.'), 1);
                        $type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_AUTOASCII;
                }
                $this->ftp->SetType($type);
-               $temp = tmpfile();
-               if ( ! $temp )
+               $temp = wp_tempnam( $file );
+               if ( ! $temphandle = fopen($temp, 'w+') )
                        return false;
-               if ( ! $this->ftp->fget($temp, $file) ) {
-                       fclose($temp);
+               if ( ! $this->ftp->fget($temphandle, $file) ) {
+                       fclose($temphandle);
+                       unlink($temp);
                        return ''; //Blank document, File does exist, Its just blank.
                }
-               fseek($temp, 0); //Skip back to the start of the file being written to
+               fseek($temphandle, 0); //Skip back to the start of the file being written to
                $contents = '';
-               while ( !feof($temp) )
-                       $contents .= fread($temp, 8192);
-               fclose($temp);
+               while ( ! feof($temphandle) )
+                       $contents .= fread($temphandle, 8192);
+               fclose($temphandle);
+               unlink($temp);
                return $contents;
        }
 
        function get_contents_array($file){
-               return explode("\n",$this->get_contents($file));
+               return explode("\n", $this->get_contents($file) );
        }
 
-       function put_contents($file,$contents,$type=''){
+       function put_contents($file, $contents, $type = '' ) {
                if( empty($type) ){
-                       $extension = substr(strrchr($file, "."), 1);
-                       $type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_ASCII;
+                       $extension = substr(strrchr($file, '.'), 1);
+                       $type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_AUTOASCII;
                }
                $this->ftp->SetType($type);
 
-               $temp = tmpfile();
-               if ( ! $temp )
+               $temp = wp_tempnam( $file );
+               if ( ! $temphandle = fopen($temp, 'w+') ){
+                       unlink($temp);          
                        return false;
-               fwrite($temp,$contents);
-               fseek($temp, 0); //Skip back to the start of the file being written to
-               $ret = $this->ftp->fput($file, $temp);
-               fclose($temp);
+               }
+               fwrite($temphandle, $contents);
+               fseek($temphandle, 0); //Skip back to the start of the file being written to
+               $ret = $this->ftp->fput($file, $temphandle);
+               fclose($temphandle);
+               unlink($temp);
                return $ret;
        }
 
-       function cwd(){
+       function cwd() {
                $cwd = $this->ftp->pwd();
                if( $cwd )
                        $cwd = trailingslashit($cwd);
                return $cwd;
        }
 
-       function chdir($file){
+       function chdir($file) {
                return $this->ftp->chdir($file);
        }
        
-       function chgrp($file,$group,$recursive=false){
+       function chgrp($file, $group, $recursive = false ) {
                return false;
        }
 
-       function chmod($file,$mode=false,$recursive=false){
+       function chmod($file, $mode = false, $recursive = false ){
                if( ! $mode )
                        $mode = $this->permission;
                if( ! $mode )
                        return false;
                //if( ! $this->exists($file) )
                //      return false;
-               if( ! $recursive || ! $this->is_dir($file) ){
+               if( ! $recursive || ! $this->is_dir($file) ) {
                        return $this->ftp->chmod($file,$mode);
                }
                //Is a directory, and we want recursive
                $filelist = $this->dirlist($file);
                foreach($filelist as $filename){
-                       $this->chmod($file.'/'.$filename,$mode,$recursive);
+                       $this->chmod($file . '/' . $filename, $mode, $recursive);
                }
                return true;
        }
 
-       function chown($file,$owner,$recursive=false){
+       function chown($file, $owner, $recursive = false ) {
                return false;
        }
 
-       function owner($file){
+       function owner($file) {
                $dir = $this->dirlist($file);
                return $dir[$file]['owner'];
        }
 
-       function getchmod($file){
+       function getchmod($file) {
                $dir = $this->dirlist($file);
                return $dir[$file]['permsn'];
        }
 
-       function gethchmod($file){
-               //From the PHP.net page for ...?
-               $perms = $this->getchmod($file);
-               if (($perms & 0xC000) == 0xC000) {
-                       // Socket
-                       $info = 's';
-               } elseif (($perms & 0xA000) == 0xA000) {
-                       // Symbolic Link
-                       $info = 'l';
-               } elseif (($perms & 0x8000) == 0x8000) {
-                       // Regular
-                       $info = '-';
-               } elseif (($perms & 0x6000) == 0x6000) {
-                       // Block special
-                       $info = 'b';
-               } elseif (($perms & 0x4000) == 0x4000) {
-                       // Directory
-                       $info = 'd';
-               } elseif (($perms & 0x2000) == 0x2000) {
-                       // Character special
-                       $info = 'c';
-               } elseif (($perms & 0x1000) == 0x1000) {
-                       // FIFO pipe
-                       $info = 'p';
-               } else {
-                       // Unknown
-                       $info = 'u';
-               }
-
-               // Owner
-               $info .= (($perms & 0x0100) ? 'r' : '-');
-               $info .= (($perms & 0x0080) ? 'w' : '-');
-               $info .= (($perms & 0x0040) ?
-                                       (($perms & 0x0800) ? 's' : 'x' ) :
-                                       (($perms & 0x0800) ? 'S' : '-'));
-
-               // Group
-               $info .= (($perms & 0x0020) ? 'r' : '-');
-               $info .= (($perms & 0x0010) ? 'w' : '-');
-               $info .= (($perms & 0x0008) ?
-                                       (($perms & 0x0400) ? 's' : 'x' ) :
-                                       (($perms & 0x0400) ? 'S' : '-'));
-
-               // World
-               $info .= (($perms & 0x0004) ? 'r' : '-');
-               $info .= (($perms & 0x0002) ? 'w' : '-');
-               $info .= (($perms & 0x0001) ?
-                                       (($perms & 0x0200) ? 't' : 'x' ) :
-                                       (($perms & 0x0200) ? 'T' : '-'));
-               return $info;
-       }
-
-       function getnumchmodfromh($mode) {
-               $realmode = "";
-               $legal =  array("","w","r","x","-");
-               $attarray = preg_split("//",$mode);
-               for($i=0;$i<count($attarray);$i++){
-                  if($key = array_search($attarray[$i],$legal)){
-                          $realmode .= $legal[$key];
-                  }
-               }
-               $mode = str_pad($realmode,9,'-');
-               $trans = array('-'=>'0','r'=>'4','w'=>'2','x'=>'1');
-               $mode = strtr($mode,$trans);
-               $newmode = '';
-               $newmode .= $mode[0]+$mode[1]+$mode[2];
-               $newmode .= $mode[3]+$mode[4]+$mode[5];
-               $newmode .= $mode[6]+$mode[7]+$mode[8];
-               return $newmode;
-       }
-
-       function group($file){
+       function group($file) {
                $dir = $this->dirlist($file);
                return $dir[$file]['group'];
        }
 
-       function copy($source,$destination,$overwrite=false){
+       function copy($source, $destination, $overwrite = false ) {
                if( ! $overwrite && $this->exists($destination) )
                        return false;
 
@@ -328,14 +196,14 @@ class WP_Filesystem_ftpsockets{
                if ( false === $content )
                        return false;
 
-               return $this->put_contents($destination,$content);
+               return $this->put_contents($destination, $content);
        }
 
-       function move($source,$destination,$overwrite=false){
-               return $this->ftp->rename($source,$destination);
+       function move($source, $destination, $overwrite = false ) {
+               return $this->ftp->rename($source, $destination);
        }
 
-       function delete($file,$recursive=false) {
+       function delete($file, $recursive = false ) {
                if ( $this->is_file($file) )
                        return $this->ftp->delete($file);
                if ( !$recursive )
@@ -344,15 +212,15 @@ class WP_Filesystem_ftpsockets{
                return $this->ftp->mdel($file);
        }
 
-       function exists($file){
+       function exists($file) {
                return $this->ftp->is_exists($file);
        }
 
-       function is_file($file){
+       function is_file($file) {
                return $this->is_dir($file) ? false : true;
        }
 
-       function is_dir($path){
+       function is_dir($path) {
                $cwd = $this->cwd();
                if ( $this->chdir($path) ) {
                        $this->chdir($cwd);
@@ -361,33 +229,33 @@ class WP_Filesystem_ftpsockets{
                return false;
        }
 
-       function is_readable($file){
+       function is_readable($file) {
                //Get dir list, Check if the file is writable by the current user??
                return true;
        }
 
-       function is_writable($file){
+       function is_writable($file) {
                //Get dir list, Check if the file is writable by the current user??
                return true;
        }
 
-       function atime($file){
+       function atime($file) {
                return false;
        }
 
-       function mtime($file){
+       function mtime($file) {
                return $this->ftp->mdtm($file);
        }
 
-       function size($file){
+       function size($file) {
                return $this->ftp->filesize($file);
        }
 
-       function touch($file,$time=0,$atime=0){
+       function touch($file, $time = 0, $atime = 0 ){
                return false;
        }
 
-       function mkdir($path,$chmod=false,$chown=false,$chgrp=false){
+       function mkdir($path, $chmod = false, $chown = false, $chgrp = false ) {
                if( ! $this->ftp->mkdir($path) )
                        return false;
                if( $chmod )
@@ -399,15 +267,15 @@ class WP_Filesystem_ftpsockets{
                return true;
        }
 
-       function rmdir($path,$recursive=false){
+       function rmdir($path, $recursive = false ) {
                if( ! $recursive )
                        return $this->ftp->rmdir($path);
 
                return $this->ftp->mdel($path);
        }
 
-       function dirlist($path='.',$incdot=false,$recursive=false){
-               if( $this->is_file($path) ){
+       function dirlist($path = '.', $incdot = false, $recursive = false ) {
+               if( $this->is_file($path) ) {
                        $limitFile = basename($path);
                        $path = dirname($path) . '/';
                } else {
@@ -430,11 +298,11 @@ class WP_Filesystem_ftpsockets{
                                        //We're including the doted starts
                                        if( '.' != $struc['name'] && '..' != $struc['name'] ){ //Ok, It isnt a special folder
                                                if ($recursive)
-                                                       $struc['files'] = $this->dirlist($path.'/'.$struc['name'],$incdot,$recursive);
+                                                       $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive);
                                        }
                                } else { //No dots
                                        if ($recursive)
-                                               $struc['files'] = $this->dirlist($path.'/'.$struc['name'],$incdot,$recursive);
+                                               $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive);
                                }
                        }
                        //File
index 0f2aa6140a7a29a5cef2b669aea72ce8289a962c..8a47fe6d2f4356133ce616e79b847b002aebe9e4 100644 (file)
@@ -3,8 +3,8 @@
 function comment_exists($comment_author, $comment_date) {
        global $wpdb;
 
-       return $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments
-                       WHERE comment_author = '$comment_author' AND comment_date = '$comment_date'");
+       return $wpdb->get_var( $wpdb->prepare("SELECT comment_post_ID FROM $wpdb->comments
+                       WHERE comment_author = %s AND comment_date = %s", $comment_author, $comment_date) );
 }
 
 function edit_comment() {
index 9ce9db91cf7055ec267a97c35c07a4b802c29794..27839fcfd3b1564976a27e8872dcf12a85f178ab 100644 (file)
@@ -23,7 +23,9 @@ function wp_dashboard_setup() {
        /* Register Widgets and Controls */
 
        // Recent Comments Widget
-       if ( current_user_can( 'moderate_comments' ) && $mod_comments = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'") ) {
+       $mod_comments = wp_count_comments();
+       $mod_comments = $mod_comments->moderated;
+       if ( current_user_can( 'moderate_comments' ) && $mod_comments ) {
                $notice = sprintf( __ngettext( '%d comment awaiting moderation', '%d comments awaiting moderation', $mod_comments ), $mod_comments );
                $notice = "<a href='edit-comments.php?comment_status=moderated'>$notice</a>";
        } else {
@@ -34,9 +36,10 @@ function wp_dashboard_setup() {
        );
 
        // Incoming Links Widget
-       if ( !isset( $widget_options['dashboard_incoming_links'] ) ) {
+       if ( !isset( $widget_options['dashboard_incoming_links'] ) || !isset( $widget_options['dashboard_incoming_links']['home'] ) || $widget_options['dashboard_incoming_links']['home'] != get_option('home') ) {
                $update = true;
                $widget_options['dashboard_incoming_links'] = array(
+                       'home' => get_option('home'),
                        'link' => apply_filters( 'dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?hl=en&scoring=d&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
                        'url' => apply_filters( 'dashboard_incoming_links_feed', 'http://blogsearch.google.com/blogsearch_feeds?hl=en&scoring=d&ie=utf-8&num=10&output=rss&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
                        'items' => 5,
@@ -214,16 +217,16 @@ function wp_dashboard_dynamic_sidebar_params( $params ) {
                        $wp_registered_widgets[$widget_id]['callback'] = 'wp_dashboard_empty';
                        $sidebar_widget_name = $wp_registered_widget_controls[$widget_id]['name'];
                        $params[1] = 'wp_dashboard_trigger_widget_control';
-                       $sidebar_before_widget .= '<form action="' . remove_query_arg( 'edit' )  . '" method="post">';
+                       $sidebar_before_widget .= '<form action="' . clean_url(remove_query_arg( 'edit' ))  . '" method="post">';
                        $sidebar_after_widget   = "<div class='dashboard-widget-submit'><input type='hidden' name='sidebar' value='wp_dashboard' /><input type='hidden' name='widget_id' value='$widget_id' /><input type='submit' value='" . __( 'Save' ) . "' /></div></form>$sidebar_after_widget";
-                       $links[] = '<a href="' . remove_query_arg( 'edit' ) . '">' . __( 'Cancel' ) . '</a>';
+                       $links[] = '<a href="' . clean_url(remove_query_arg( 'edit' )) . '">' . __( 'Cancel' ) . '</a>';
                } else {
-                       $links[] = '<a href="' . add_query_arg( 'edit', $widget_id ) . "#$widget_id" . '">' . __( 'Edit' ) . '</a>';
+                       $links[] = '<a href="' . clean_url(add_query_arg( 'edit', $widget_id )) . "#$widget_id" . '">' . __( 'Edit' ) . '</a>';
                }
        }
 
        if ( $widget_feed_link )
-               $links[] = '<img class="rss-icon" src="' . get_option( 'siteurl' ) . '/' . WPINC . '/images/rss.png" alt="' . __( 'rss icon' ) . '" /> <a href="' . clean_url( $widget_feed_link ) . '">' . __( 'RSS' ) . '</a>';
+               $links[] = '<img class="rss-icon" src="' . includes_url('images/rss.png') . '" alt="' . __( 'rss icon' ) . '" /> <a href="' . clean_url( $widget_feed_link ) . '">' . __( 'RSS' ) . '</a>';
 
        $links = apply_filters( "wp_dashboard_widget_links_$widget_id", $links );
 
@@ -267,7 +270,7 @@ function wp_dashboard_recent_comments( $sidebar_args ) {
 
        $lambda = create_function( '', 'return 5;' );
        add_filter( 'option_posts_per_rss', $lambda ); // hack - comments query doesn't accept per_page parameter
-       $comments_query = new WP_Query('feed=rss2&withcomments=1');
+       $comments_query = new WP_Query(array('feed' => 'rss2', 'withcomments' => 1));
        remove_filter( 'option_posts_per_rss', $lambda );
 
        $is_first = true;
@@ -313,7 +316,7 @@ function wp_dashboard_incoming_links_output() {
        $widgets = get_option( 'dashboard_widget_options' );
        @extract( @$widgets['dashboard_incoming_links'], EXTR_SKIP );
        $rss = @fetch_rss( $url );
-       if ( isset($rss->items) && 1 < count($rss->items) )  {// Technorati returns a 1-item feed when it has no results
+       if ( isset($rss->items) && 0 < count($rss->items) )  {
 
                echo "<ul>\n";
 
@@ -387,8 +390,7 @@ function wp_dashboard_secondary_output() {
        $rss->items = array_slice($rss->items, 0, $items);
        foreach ($rss->items as $item ) {
                $title = wp_specialchars($item['title']);
-               $author = preg_replace( '|(.+?):.+|s', '$1', $item['title'] );
-               $post = preg_replace( '|.+?:(.+)|s', '$1', $item['title'] );
+               list($author,$post) = explode( ':', $title, 2 );
                $link = clean_url($item['link']);
 
                echo "\t<li><a href='$link'><span class='post'>$post</span><span class='hidden'> - </span><cite>$author</cite></a></li>\n";
index 96239af92120c4ed37fbed9055bbba8443b732a8..00201fab764d67b50829ade6e542a04598ba9a79 100644 (file)
@@ -17,7 +17,7 @@ header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
 $where = '';
 if ( $author and $author != 'all' ) {
        $author_id = (int) $author;
-       $where = " WHERE post_author = '$author_id' ";
+       $where = $wpdb->prepare(" WHERE post_author = %d ", $author_id);
 }
 
 // grab a snapshot of post IDs, just in case it changes during the export
@@ -201,6 +201,7 @@ echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
 <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>
@@ -217,7 +218,7 @@ 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("SELECT * FROM $wpdb->postmeta WHERE post_id = $post->ID");
+$postmeta = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID) );
 if ( $postmeta ) {
 ?>
 <?php foreach( $postmeta as $meta ) { ?>
@@ -228,7 +229,7 @@ if ( $postmeta ) {
 <?php } ?>
 <?php } ?>
 <?php
-$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $post->ID");
+$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>
@@ -252,4 +253,4 @@ if ( $comments ) { foreach ( $comments as $c ) { ?>
 <?php
 }
 
-?>
\ No newline at end of file
+?>
index 575a6782a4e4b5531c82ee6f262835b0ed0b6d11..349feb2e6af27402df71d6c41a3bb710a300dc72 100644 (file)
@@ -34,19 +34,47 @@ function get_home_path() {
 
 function get_real_file_to_edit( $file ) {
        if ('index.php' == $file || '.htaccess' == $file ) {
-               $real_file = get_home_path().$file;
+               $real_file = get_home_path() . $file;
        } else {
-               $real_file = ABSPATH.$file;
+               $real_file = WP_CONTENT_DIR . $file;
        }
 
        return $real_file;
 }
+//$folder = Full path to folder
+//$levels = Levels of folders to follow, Default: 100 (PHP Loop limit)
+function list_files( $folder = '', $levels = 100 ) {
+       if( empty($folder) )
+               return false;
+
+       if( ! $levels )
+               return false;
+
+       $files = array();
+       if ( $dir = @opendir( $folder ) ) {
+               while (($file = readdir( $dir ) ) !== false ) {
+                       if ( in_array($file, array('.', '..') ) )
+                               continue;
+                       if ( is_dir( $folder . '/' . $file ) ) {
+                               $files2 = list_files( $folder . '/' . $file, $levels - 1);
+                               if( $files2 )
+                                       $files = array_merge($files, $files2 );
+                               else
+                                       $files[] = $folder . '/' . $file . '/';
+                       } else {
+                               $files[] = $folder . '/' . $file;
+                       }
+               }
+       }
+       @closedir( $dir );
+       return $files;
+}
 
 function get_temp_dir() {
        if ( defined('WP_TEMP_DIR') )
                return trailingslashit(WP_TEMP_DIR);
 
-       $temp = ABSPATH . 'wp-content/';
+       $temp = WP_CONTENT_DIR . '/';
        if ( is_dir($temp) && is_writable($temp) )
                return $temp;
 
@@ -56,20 +84,16 @@ function get_temp_dir() {
        return '/tmp/';
 }
 
-function validate_file( $file, $allowed_files = '' ) {
-       if ( false !== strpos( $file, '..' ))
-               return 1;
+function wp_tempnam($filename = '', $dir = ''){
+       if ( empty($dir) )
+               $dir = get_temp_dir();
+       $filename = basename($filename);
+       if ( empty($filename) )
+               $filename = time();
 
-       if ( false !== strpos( $file, './' ))
-               return 1;
-
-       if (':' == substr( $file, 1, 1 ))
-               return 2;
-
-       if (!empty ( $allowed_files ) && (!in_array( $file, $allowed_files ) ) )
-               return 3;
-
-       return 0;
+       $filename = $dir . wp_unique_filename($dir, $filename);
+       touch($filename);
+       return $filename;
 }
 
 function validate_file_to_edit( $file, $allowed_files = '' ) {
@@ -188,6 +212,102 @@ function wp_handle_upload( &$file, $overrides = false ) {
 
        return $return;
 }
+// Pass this function an array similar to that of a $_FILES POST array.
+function wp_handle_sideload( &$file, $overrides = false ) {
+       // The default error handler.
+       if (! function_exists( 'wp_handle_upload_error' ) ) {
+               function wp_handle_upload_error( &$file, $message ) {
+                       return array( 'error'=>$message );
+               }
+       }
+
+       // You may define your own function and pass the name in $overrides['upload_error_handler']
+       $upload_error_handler = 'wp_handle_upload_error';
+
+       // $_POST['action'] must be set and its value must equal $overrides['action'] or this:
+       $action = 'wp_handle_sideload';
+
+       // Courtesy of php.net, the strings that describe the error indicated in $_FILES[{form field}]['error'].
+       $upload_error_strings = array( false,
+               __( "The file exceeds the <code>upload_max_filesize</code> directive in <code>php.ini</code>." ),
+               __( "The file exceeds the <em>MAX_FILE_SIZE</em> directive that was specified in the HTML form." ),
+               __( "The file was only partially uploaded." ),
+               __( "No file was sent." ),
+               __( "Missing a temporary folder." ),
+               __( "Failed to write file to disk." ));
+
+       // All tests are on by default. Most can be turned off by $override[{test_name}] = false;
+       $test_form = true;
+       $test_size = true;
+
+       // If you override this, you must provide $ext and $type!!!!
+       $test_type = true;
+       $mimes = false;
+
+       // Install user overrides. Did we mention that this voids your warranty?
+       if ( is_array( $overrides ) )
+               extract( $overrides, EXTR_OVERWRITE );
+
+       // 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.' ));
+
+       // 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']] );
+
+       // A non-empty file will pass this test.
+       if ( $test_size && !(filesize($file['tmp_name']) > 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.' ));
+
+       // A properly uploaded file will pass this test. There should be no reason to override this one.
+       if (! @ is_file( $file['tmp_name'] ) )
+               return $upload_error_handler( $file, __( 'Specified file does not exist.' ));
+
+       // 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 );
+
+               extract( $wp_filetype );
+
+               if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) )
+                       return $upload_error_handler( $file, __( 'File type does not meet security guidelines. Try another.' ));
+
+               if ( !$ext )
+                       $ext = ltrim(strrchr($file['name'], '.'), '.');
+
+               if ( !$type )
+                       $type = $file['type'];
+       }
+
+       // A writable uploads dir will pass this test. Again, there's no point overriding this one.
+       if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) )
+               return $upload_error_handler( $file, $uploads['error'] );
+
+       $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback );
+       
+       // Strip the query strings.
+       $filename = str_replace('?','-', $filename);
+       $filename = str_replace('&','-', $filename);
+       
+       // Move the file to the uploads dir
+       $new_file = $uploads['path'] . "/$filename";
+       if ( false === @ rename( $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 ));
+       $perms = $stat['mode'] & 0000666;
+       @ chmod( $new_file, $perms );
+
+       // Compute the URL
+       $url = $uploads['url'] . "/$filename";
+
+       $return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) );
+
+       return $return;
+}
 
 /**
 * Downloads a url to a local file using the Snoopy HTTP Class
@@ -200,7 +320,7 @@ function download_url( $url ) {
        if( ! $url )
                return new WP_Error('http_no_url', __('Invalid URL Provided'));
 
-       $tmpfname = tempnam(get_temp_dir(), 'wpupdate');
+       $tmpfname = wp_tempnam($url);
        if( ! $tmpfname )
                return new WP_Error('http_no_file', __('Could not create Temporary file'));
 
@@ -260,13 +380,13 @@ function unzip_file($file, $to) {
                        $tmppath .= $path[$j] . '/';
                        if ( ! $fs->is_dir($to . $tmppath) )
                                if ( !$fs->mkdir($to . $tmppath, 0755) )
-                                       return new WP_Error('mkdir_failed', __('Could not create directory'));
+                                       return new WP_Error('mkdir_failed', __('Could not create directory'), $to . $tmppath);
                }
 
                // 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'));
+                               return new WP_Error('copy_failed', __('Could not copy file'), $to . $file['filename']);
                        $fs->chmod($to . $file['filename'], 0644);
        }
 
@@ -284,27 +404,33 @@ function copy_dir($from, $to) {
        foreach ( (array) $dirlist as $filename => $fileinfo ) {
                if ( 'f' == $fileinfo['type'] ) {
                        if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true) )
-                               return false;
+                               return new WP_Error('copy_failed', __('Could not copy file'), $to . $filename);
                        $wp_filesystem->chmod($to . $filename, 0644);
                } elseif ( 'd' == $fileinfo['type'] ) {
                        if ( !$wp_filesystem->mkdir($to . $filename, 0755) )
-                               return false;
-                       if ( !copy_dir($from . $filename, $to . $filename) )
-                               return false;
+                               return new WP_Error('mkdir_failed', __('Could not create directory'), $to . $filename);
+                       $result = copy_dir($from . $filename, $to . $filename);
+                       if ( is_wp_error($result) )
+                               return $result;
                }
        }
-
-       return true;
 }
 
-function WP_Filesystem( $args = false, $preference = false ) {
+function WP_Filesystem( $args = false ) {
        global $wp_filesystem;
 
-       $method = get_filesystem_method($preference);
+       require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php');
+
+       $method = get_filesystem_method();
+
        if ( ! $method )
                return false;
 
-       require_once('class-wp-filesystem-'.$method.'.php');
+       $abstraction_file = apply_filters('filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-'.$method.'.php', $method);
+       if( ! file_exists($abstraction_file) )
+               return;
+
+       require_once($abstraction_file);
        $method = "WP_Filesystem_$method";
 
        $wp_filesystem = new $method($args);
@@ -319,18 +445,17 @@ function WP_Filesystem( $args = false, $preference = false ) {
 }
 
 function get_filesystem_method() {
-       $tempFile = tempnam(get_temp_dir(), 'WPU');
-
-       if ( getmyuid() == fileowner($tempFile) ) {
-               unlink($tempFile);
-               return 'direct';
-       } else {
-               unlink($tempFile);
+       $method = false;
+       if( function_exists('getmyuid') && function_exists('fileowner') ){
+               $temp_file = wp_tempnam();
+               if ( getmyuid() == fileowner($temp_file) )
+                       $method = 'direct';
+               unlink($temp_file);
        }
 
-       if ( extension_loaded('ftp') ) return 'ftpext';
-       if ( extension_loaded('sockets') || function_exists('fsockopen') ) return 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread
-       return false;
+       if ( ! $method && extension_loaded('ftp') ) $method = 'ftpext';
+       if ( ! $method && ( extension_loaded('sockets') || function_exists('fsockopen') ) ) $method = 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread
+       return apply_filters('filesystem_method', $method);
 }
 
-?>
+?>
\ No newline at end of file
index 7699f98608f330612a811b247d18d7769397849f..8de2907994ed1613f36a3068ec96aab306ec439d 100644 (file)
@@ -219,17 +219,17 @@ function wp_read_image_metadata( $file ) {
                if ( !empty($info['APP13']) ) {
                        $iptc = iptcparse($info['APP13']);
                        if ( !empty($iptc['2#110'][0]) ) // credit
-                               $meta['credit'] = trim( $iptc['2#110'][0] );
+                               $meta['credit'] = utf8_encode(trim($iptc['2#110'][0]));
                        elseif ( !empty($iptc['2#080'][0]) ) // byline
-                               $meta['credit'] = trim( $iptc['2#080'][0] );
+                               $meta['credit'] = utf8_encode(trim($iptc['2#080'][0]));
                        if ( !empty($iptc['2#055'][0]) and !empty($iptc['2#060'][0]) ) // created datee and time
                                $meta['created_timestamp'] = strtotime($iptc['2#055'][0] . ' ' . $iptc['2#060'][0]);
                        if ( !empty($iptc['2#120'][0]) ) // caption
-                               $meta['caption'] = trim( $iptc['2#120'][0] );
+                               $meta['caption'] = utf8_encode(trim($iptc['2#120'][0]));
                        if ( !empty($iptc['2#116'][0]) ) // copyright
-                               $meta['copyright'] = trim( $iptc['2#116'][0] );
+                               $meta['copyright'] = utf8_encode(trim($iptc['2#116'][0]));
                        if ( !empty($iptc['2#005'][0]) ) // title
-                               $meta['title'] = trim( $iptc['2#005'][0] );
+                               $meta['title'] = utf8_encode(trim($iptc['2#005'][0]));
                 }
        }
 
index 1000d15bf1faa2cf21097e01187b94fde94a419f..d91ffc2398827107eb75a45a6fec907e31724e89 100644 (file)
@@ -26,11 +26,14 @@ function update_gallery_tab($tabs) {
 add_filter('media_upload_tabs', 'update_gallery_tab');
 
 function the_media_upload_tabs() {
+       global $redir_tab;
        $tabs = media_upload_tabs();
 
        if ( !empty($tabs) ) {
                echo "<ul id='sidemenu'>\n";
-               if ( isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs) )
+               if ( isset($redir_tab) && array_key_exists($redir_tab, $tabs) )
+                       $current = $redir_tab;
+               elseif ( isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs) )
                        $current = $_GET['tab'];
                else {
                        $keys = array_keys($tabs);
@@ -41,8 +44,8 @@ function the_media_upload_tabs() {
                        if ( $current == $callback )
                                $class = " class='current'";
                        $href = add_query_arg(array('tab'=>$callback, 's'=>false, 'paged'=>false, 'post_mime_type'=>false, 'm'=>false));
-                       $link = "<a href='$href'$class>$text</a>";
-                       echo "\t<li id='tab-$callback'>$link</li>\n";
+                       $link = "<a href='" . clean_url($href) . "'$class>$text</a>";
+                       echo "\t<li id='" . attribute_escape("tab-$callback") . "'>$link</li>\n";
                }
                echo "</ul>\n";
        }
@@ -55,20 +58,39 @@ function get_image_send_to_editor($id, $alt, $title, $align, $url='', $rel = fal
        $rel = $rel ? ' rel="attachment wp-att-'.attribute_escape($id).'"' : '';
 
        if ( $url )
-               $html = "<a href='".attribute_escape($url)."'$rel>$html</a>";
+               $html = '<a href="' . clean_url($url) . "\"$rel>$html</a>";
 
        $html = apply_filters( 'image_send_to_editor', $html, $id, $alt, $title, $align, $url, $size );
 
        return $html;
 }
 
+function image_add_caption( $html, $id, $alt, $title, $align, $url, $size ) {
+
+       if ( empty($alt) || apply_filters( 'disable_captions', '' ) ) return $html;
+       $id = ( 0 < (int) $id ) ? 'attachment_' . $id : '';
+
+       preg_match( '/width="([0-9]+)/', $html, $matches );
+       if ( ! isset($matches[1]) ) return $html;
+       $width = $matches[1];
+
+       $html = preg_replace( '/align[^\s\'"]+\s?/', '', $html );
+       if ( empty($align) ) $align = 'none';
+
+       $shcode = '[caption id="' . $id . '" align="align' . $align
+       . '" width="' . $width . '" caption="' . $alt . '"]' . $html . '[/caption]';
+
+       return apply_filters( 'image_add_caption_shortcode', $shcode, $html );
+}
+add_filter( 'image_send_to_editor', 'image_add_caption', 20, 7 );
+
 function media_send_to_editor($html) {
        ?>
 <script type="text/javascript">
-<!--
-top.send_to_editor('<?php echo addslashes($html); ?>');
-top.tb_remove();
--->
+/* <![CDATA[ */
+var win = window.dialogArguments || opener || parent || top;
+win.send_to_editor('<?php echo addslashes($html); ?>');
+/* ]]> */
 </script>
        <?php
        exit;
@@ -80,7 +102,7 @@ function media_handle_upload($file_id, $post_id, $post_data = array()) {
        $file = wp_handle_upload($_FILES[$file_id], $overrides);
 
        if ( isset($file['error']) )
-               return new wp_error( 'upload_error', $file['error'] );
+               return new WP_Error( 'upload_error', $file['error'] );
 
        $url = $file['url'];
        $type = $file['type'];
@@ -115,6 +137,47 @@ function media_handle_upload($file_id, $post_id, $post_data = array()) {
 
 }
 
+function media_handle_sideload($file_array, $post_id, $desc = null, $post_data = array()) {
+       $overrides = array('test_form'=>false);
+       $file = wp_handle_sideload($file_array, $overrides);
+
+       if ( isset($file['error']) )
+               return new WP_Error( 'upload_error', $file['error'] );
+
+       $url = $file['url'];
+       $type = $file['type'];
+       $file = $file['file'];
+       $title = preg_replace('/\.[^.]+$/', '', basename($file));
+       $content = '';
+
+       // 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']) )
+                       $title = $image_meta['title'];
+               if ( trim($image_meta['caption']) )
+                       $content = $image_meta['caption'];
+       }
+
+       $title = @$desc;
+
+       // Construct the attachment array
+       $attachment = array_merge( array(
+               'post_mime_type' => $type,
+               'guid' => $url,
+               'post_parent' => $post_id,
+               'post_title' => $title,
+               'post_content' => $content,
+       ), $post_data );
+
+       // Save the data
+       $id = wp_insert_attachment($attachment, $file, $post_parent);
+       if ( !is_wp_error($id) ) {
+               wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
+               return $url;
+       }
+       return $id;
+}
+
 
 // wrap iframe content (produced by $content_func) in a doctype, html head/body etc
 // any additional function args will be passed to content_func
@@ -126,9 +189,12 @@ function wp_iframe($content_func /* ... */) {
 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
 <title><?php bloginfo('name') ?> &rsaquo; <?php _e('Uploads'); ?> &#8212; <?php _e('WordPress'); ?></title>
 <?php
-wp_admin_css( 'css/global' );
-wp_admin_css();
-wp_admin_css( 'css/colors' );
+wp_enqueue_style( 'global' );
+wp_enqueue_style( 'wp-admin' );
+wp_enqueue_style( 'colors' );
+if ( 0 === strpos( $content_func, 'media' ) )
+       wp_enqueue_style( 'media' );
+
 ?>
 <script type="text/javascript">
 //<![CDATA[
@@ -136,6 +202,7 @@ function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}el
 //]]>
 </script>
 <?php
+do_action('admin_print_styles');
 do_action('admin_print_scripts');
 do_action('admin_head');
 if ( is_string($content_func) )
@@ -167,36 +234,15 @@ function media_buttons() {
        $audio_title = __('Add Audio');
        $out = <<<EOF
 
-       <a href="{$image_upload_iframe_src}&amp;TB_iframe=true&amp;height=500&amp;width=640" class="thickbox" title='$image_title'><img src='images/media-button-image.gif' alt='$image_title' /></a>
-       <a href="{$video_upload_iframe_src}&amp;TB_iframe=true&amp;height=500&amp;width=640" class="thickbox" title='$video_title'><img src='images/media-button-video.gif' alt='$video_title' /></a>
-       <a href="{$audio_upload_iframe_src}&amp;TB_iframe=true&amp;height=500&amp;width=640" class="thickbox" title='$audio_title'><img src='images/media-button-music.gif' alt='$audio_title' /></a>
-       <a href="{$media_upload_iframe_src}&amp;TB_iframe=true&amp;height=500&amp;width=640" class="thickbox" title='$media_title'><img src='images/media-button-other.gif' alt='$media_title' /></a>
+       <a href="{$image_upload_iframe_src}&amp;TB_iframe=true" id="add_image" class="thickbox" title='$image_title'><img src='images/media-button-image.gif' alt='$image_title' /></a>
+       <a href="{$video_upload_iframe_src}&amp;TB_iframe=true" id="add_video" class="thickbox" title='$video_title'><img src='images/media-button-video.gif' alt='$video_title' /></a>
+       <a href="{$audio_upload_iframe_src}&amp;TB_iframe=true" id="add_audio" class="thickbox" title='$audio_title'><img src='images/media-button-music.gif' alt='$audio_title' /></a>
+       <a href="{$media_upload_iframe_src}&amp;TB_iframe=true" id="add_media" class="thickbox" title='$media_title'><img src='images/media-button-other.gif' alt='$media_title' /></a>
 
 EOF;
        printf($context, $out);
 }
 add_action( 'media_buttons', 'media_buttons' );
-
-function media_buttons_head() {
-$siteurl = get_option('siteurl');
-echo "<style type='text/css' media='all'>
-       @import '{$siteurl}/wp-includes/js/thickbox/thickbox.css?1';
-       div#TB_title {
-               background-color: #222222;
-               color: #cfcfcf;
-       }
-       div#TB_title a, div#TB_title a:visited {
-               color: #cfcfcf;
-       }
-</style>\n";
-}
-
-add_action( 'admin_print_scripts', 'media_buttons_head' );
-
-function media_admin_css() {
-       wp_admin_css('css/media');
-}
-
 add_action('media_upload_media', 'media_upload_handler');
 
 function media_upload_form_handler() {
@@ -210,6 +256,8 @@ function media_upload_form_handler() {
                        $post['post_title'] = $attachment['post_title'];
                if ( isset($attachment['post_excerpt']) )
                        $post['post_excerpt'] = $attachment['post_excerpt'];
+               if ( isset($attachment['menu_order']) )
+                       $post['menu_order'] = $attachment['menu_order'];
 
                $post = apply_filters('attachment_fields_to_save', $post, $attachment);
 
@@ -232,7 +280,7 @@ function media_upload_form_handler() {
        if ( isset($_POST['send']) ) {
                $keys = array_keys($_POST['send']);
                $send_id = (int) array_shift($keys);
-               $attachment = $_POST['attachments'][$send_id];
+               $attachment = stripslashes_deep( $_POST['attachments'][$send_id] );
                $html = $attachment['post_title'];
                if ( !empty($attachment['url']) ) {
                        if ( strpos($attachment['url'], 'attachment_id') || false !== strpos($attachment['url'], get_permalink($_POST['post_id'])) )
@@ -280,12 +328,36 @@ function media_upload_image() {
                        $errors = $return;
        }
 
-       if ( isset($_POST['save']) )
+       if ( isset($_POST['save']) ) {
                $errors['upload_notice'] = __('Saved.');
+               return media_upload_gallery();
+       }
 
        return wp_iframe( 'media_upload_type_form', 'image', $errors, $id );
 }
 
+function media_sideload_image($file, $post_id, $desc = null) {
+       if (!empty($file) ) {
+               $file_array['name'] = basename($file);
+               $file_array['tmp_name'] = download_url($file);
+               $desc = @$desc;
+
+               $id = media_handle_sideload($file_array, $post_id, $desc);
+               $src = $id;
+
+               if ( is_wp_error($id) ) {
+                       @unlink($file_array['tmp_name']);
+                       return $id;
+               }
+       }
+
+       if ( !empty($src) ) {
+               $alt = @$desc;
+               $html = "<img src='$src' alt='$alt' />";
+               return $html;
+       }
+}
+
 function media_upload_audio() {
        if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
                // Upload File button was clicked
@@ -318,8 +390,10 @@ function media_upload_audio() {
                        $errors = $return;
        }
 
-       if ( isset($_POST['save']) )
+       if ( isset($_POST['save']) ) {
                $errors['upload_notice'] = __('Saved.');
+               return media_upload_gallery();
+       }
 
        return wp_iframe( 'media_upload_type_form', 'audio', $errors, $id );
 }
@@ -356,8 +430,10 @@ function media_upload_video() {
                        $errors = $return;
        }
 
-       if ( isset($_POST['save']) )
+       if ( isset($_POST['save']) ) {
                $errors['upload_notice'] = __('Saved.');
+               return media_upload_gallery();
+       }
 
        return wp_iframe( 'media_upload_type_form', 'video', $errors, $id );
 }
@@ -394,8 +470,10 @@ function media_upload_file() {
                        $errors = $return;
        }
 
-       if ( isset($_POST['save']) )
+       if ( isset($_POST['save']) ) {
                $errors['upload_notice'] = __('Saved.');
+               return media_upload_gallery();
+       }
 
        return wp_iframe( 'media_upload_type_form', 'file', $errors, $id );
 }
@@ -410,6 +488,7 @@ function media_upload_gallery() {
                        $errors = $return;
        }
 
+       wp_enqueue_script('admin-gallery');
        return wp_iframe( 'media_upload_gallery_form', $errors );
 }
 
@@ -429,8 +508,9 @@ function media_upload_library() {
 function image_attachment_fields_to_edit($form_fields, $post) {
        if ( substr($post->post_mime_type, 0, 5) == 'image' ) {
                $form_fields['post_title']['required'] = true;
+
                $form_fields['post_excerpt']['label'] = __('Caption');
-               $form_fields['post_excerpt']['helps'][] = __('Alternate text, e.g. "The Mona Lisa"');
+               $form_fields['post_excerpt']['helps'][] = __('Also used as alternate text for the image');
 
                $form_fields['post_content']['label'] = __('Description');
 
@@ -546,6 +626,10 @@ function get_attachment_fields_to_edit($post, $errors = null) {
                                </script>\n",
                        'helps'      => __('Enter a link URL or click above for presets.'),
                ),
+       'menu_order'   => array(
+                       'label'      => __('Order'),
+                       'value'      => $edit_post->menu_order
+               ),
        );
 
        foreach ( get_attachment_taxonomies($post) as $taxonomy ) {
@@ -583,7 +667,7 @@ function get_media_items( $post_id, $errors ) {
                if ( $post && $post->post_type == 'attachment' )
                        $attachments = array($post->ID => $post);
                else
-                       $attachments = get_children("post_parent=$post_id&post_type=attachment&orderby=menu_order ASC, ID&order=DESC");
+                       $attachments = get_children( array( 'post_parent' => $post_id, 'post_type' => 'attachment', 'orderby' => 'menu_order ASC, ID', 'order' => 'DESC') );
        } else {
                if ( is_array($GLOBALS['wp_the_query']->posts) )
                        foreach ( $GLOBALS['wp_the_query']->posts as $attachment )
@@ -601,6 +685,8 @@ function get_media_items( $post_id, $errors ) {
 }
 
 function get_media_item( $attachment_id, $args = null ) {
+       global $redir_tab;
+
        $default_args = array( 'errors' => null, 'send' => true, 'delete' => true, 'toggle' => true );
        $args = wp_parse_args( $args, $default_args );
        extract( $args, EXTR_SKIP );
@@ -648,10 +734,27 @@ 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 = wp_html_excerpt($display_title, 60);
+
+       $gallery = ( (isset($_REQUEST['tab']) && 'gallery' == $_REQUEST['tab']) || (isset($redir_tab) && 'gallery' == $redir_tab) ) ? true : false;
+       $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>';
+                       else
+                               $order = '<input type="hidden" name="attachments['.$attachment_id.'][menu_order]" value="'.$val['value'].'" />';
+
+                       unset($form_fields['menu_order']);
+                       break;
+               }
+       }
 
        $item = "
        $type
        $toggle_links
+       $order
        <div class='filename new'>$display_title</div>
        <table class='slidetoggle describe $class'>
                <thead class='media-item-info'>
@@ -676,9 +779,11 @@ function get_media_item( $attachment_id, $args = null ) {
        if ( $send )
                $send = "<input type='submit' class='button' name='send[$attachment_id]' value='" . attribute_escape( __( 'Insert into Post' ) ) . "' />";
        if ( $delete )
-               $delete = "<a href='$delete_href' id='del[$attachment_id]' disabled='disabled' class='delete'>" . __('Delete') . "</button>";
+               $delete = "<a href=\"#\" class=\"del-link\" onclick=\"document.getElementById('del_attachment_$attachment_id').style.display='block';return false;\">" . __('Delete') . "</a>";
        if ( ( $send || $delete ) && !isset($form_fields['buttons']) )
-               $form_fields['buttons'] = array('tr' => "\t\t<tr class='submit'><td></td><td class='savesend'>$send $delete</td></tr>\n");
+               $form_fields['buttons'] = array('tr' => "\t\t<tr class='submit'><td></td><td class='savesend'>$send $delete
+               <div id=\"del_attachment_$attachment_id\" class=\"del-attachment\" style=\"display:none;\">" . sprintf(__("You are about to delete <strong>%s</strong>."), $filename) . " <a href=\"$delete_href\" id=\"del[$attachment_id]\" class=\"delete\">" . __('Continue') . "</a>
+               <a href=\"#\" class=\"del-link\" onclick=\"this.parentNode.style.display='none';return false;\">" . __('Cancel') . "</a></div></td></tr>\n");
 
        $hidden_fields = array();
 
@@ -700,6 +805,7 @@ function get_media_item( $attachment_id, $args = null ) {
                }
 
                $required = $field['required'] ? '<abbr title="required" class="required">*</abbr>' : '';
+               $aria_required = $field['required'] ? " aria-required='true' " : '';
                $class  = $id;
                $class .= $field['required'] ? ' form-required' : '';
 
@@ -707,9 +813,9 @@ function get_media_item( $attachment_id, $args = null ) {
                if ( !empty($field[$field['input']]) )
                        $item .= $field[$field['input']];
                elseif ( $field['input'] == 'textarea' ) {
-                       $item .= "<textarea type='text' id='$name' name='$name'>" . attribute_escape( $field['value'] ) . "</textarea>";
+                       $item .= "<textarea type='text' id='$name' name='$name'>" . attribute_escape( $field['value'] ) . $aria_required . "</textarea>";
                } else {
-                       $item .= "<input type='text' id='$name' name='$name' value='" . attribute_escape( $field['value'] ) . "' />";
+                       $item .= "<input type='text' id='$name' name='$name' value='" . attribute_escape( $field['value'] ) . "'" . $aria_required . "/>";
                }
                if ( !empty($field['helps']) )
                        $item .= "<p class='help'>" . join( "</p>\n<p class='help'>", array_unique((array) $field['helps']) ) . '</p>';
@@ -754,7 +860,7 @@ function media_upload_header() {
 function media_upload_form( $errors = null ) {
        global $type, $tab;
 
-       $flash_action_url = get_option('siteurl') . "/wp-admin/async-upload.php";
+       $flash_action_url = admin_url('async-upload.php');
 
        // If Mac and mod_security, no Flash. :(
        $flash = true;
@@ -765,7 +871,6 @@ function media_upload_form( $errors = null ) {
        $post_id = intval($_REQUEST['post_id']);
 
 ?>
-<input type='hidden' name='post_id' value='<?php echo (int) $post_id; ?>' />
 <div id="media-upload-notice">
 <?php if (isset($errors['upload_notice']) ) { ?>
        <?php echo $errors['upload_notice']; ?>
@@ -776,18 +881,22 @@ function media_upload_form( $errors = null ) {
        <?php echo $errors['upload_error']->get_error_message(); ?>
 <?php } ?>
 </div>
+
+<?php do_action('pre-upload-ui'); ?>
+
 <?php if ( $flash ) : ?>
 <script type="text/javascript">
 <!--
 jQuery(function($){
        swfu = new SWFUpload({
                        upload_url : "<?php echo attribute_escape( $flash_action_url ); ?>",
-                       flash_url : "<?php echo get_option('siteurl').'/wp-includes/js/swfupload/swfupload_f9.swf'; ?>",
+                       flash_url : "<?php echo includes_url('js/swfupload/swfupload_f9.swf'); ?>",
                        file_post_name: "async-upload",
                        file_types: "<?php echo apply_filters('upload_file_glob', '*.*'); ?>",
                        post_params : {
                                "post_id" : "<?php echo $post_id; ?>",
-                               "auth_cookie" : "<?php echo $_COOKIE[AUTH_COOKIE]; ?>",
+                               "auth_cookie" : "<?php if ( is_ssl() ) echo $_COOKIE[SECURE_AUTH_COOKIE]; else echo $_COOKIE[AUTH_COOKIE]; ?>",
+                               "_wpnonce" : "<?php echo wp_create_nonce('media-form'); ?>",
                                "type" : "<?php echo $type; ?>",
                                "tab" : "<?php echo $tab; ?>",
                                "short" : "1"
@@ -812,24 +921,27 @@ jQuery(function($){
 //-->
 </script>
 
-
 <div id="flash-upload-ui">
+<?php do_action('pre-flash-upload-ui'); ?>
        <p><input id="flash-browse-button" type="button" value="<?php echo attribute_escape( __( 'Choose files to upload' ) ); ?>" class="button" /></p>
-       <p><?php _e('After a file has been uploaded, you can add titles and descriptions.'); ?></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>
 
 <?php endif; // $flash ?>
 
 <div id="html-upload-ui">
+<?php do_action('pre-html-upload-ui'); ?>
        <p>
-       <input type="file" name="async-upload" id="async-upload" /> <input type="submit" class="button" name="html-upload" value="<?php echo attribute_escape(__('Upload')); ?>" /> <a href="#" onClick="return top.tb_remove();"><?php _e('Cancel'); ?></a>
+       <input type="file" name="async-upload" id="async-upload" /> <input type="submit" class="button" name="html-upload" value="<?php echo attribute_escape(__('Upload')); ?>" /> <a href="#" onclick="return top.tb_remove();"><?php _e('Cancel'); ?></a>
        </p>
-       <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
        <br class="clear" />
        <?php if ( is_lighttpd_before_150() ): ?>
        <p><?php _e('If you want to use all capabilities of the uploader, like uploading multiple files at once, please upgrade to lighttpd 1.5.'); ?></p>
        <?php endif;?>
+<?php do_action('post-html-upload-ui'); ?>
 </div>
+<?php do_action('post-upload-ui'); ?>
 <?php
 }
 
@@ -838,7 +950,8 @@ function media_upload_type_form($type = 'file', $errors = null, $id = null) {
 
        $post_id = intval($_REQUEST['post_id']);
 
-       $form_action_url = get_option('siteurl') . "/wp-admin/media-upload.php?type=$type&tab=type&post_id=$post_id";
+       $form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");
+       $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
 
        $callback = "type_form_$type";
 ?>
@@ -873,23 +986,100 @@ jQuery(function($){
 <h3><?php _e('From URL'); ?></h3>
 </div>
 
+<script type="text/javascript">
+//<![CDATA[
+var addExtImage = {
+
+       width : '',
+       height : '',
+       align : 'alignnone',
+
+       insert : function() {
+               var t = this, html, f = document.forms[0], cls, title = '', alt = '', caption = null;
+
+               if ( '' == f.src.value || '' == t.width ) return false;
+
+               if ( f.title.value ) {
+                       title = f.title.value.replace(/['"<>]+/g, '');
+                       title = ' title="'+title+'"';
+               }
+
+               if ( f.alt.value ) {
+                       alt = f.alt.value.replace(/['"<>]+/g, '');
+<?php if ( ! apply_filters( 'disable_captions', '' ) ) { ?>
+                       caption = f.alt.value.replace(/'/g, '&#39;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
+<?php } ?>
+               }
+
+               cls = caption ? '' : ' class="'+t.align+'"';
+
+               html = '<img alt="'+alt+'" src="'+f.src.value+'"'+title+cls+' width="'+t.width+'" height="'+t.height+'" />';
+
+               if ( f.url.value )
+                       html = '<a href="'+f.url.value+'">'+html+'</a>';
+
+               if ( caption )
+                       html = '[caption id="" align="'+t.align+'" width="'+t.width+'" caption="'+caption+'"]'+html+'[/caption]';
+
+               var win = window.dialogArguments || opener || parent || top;
+               win.send_to_editor(html);
+       },
+
+       resetImageData : function() {
+               var t = addExtImage;
+
+               t.width = t.height = '';
+               document.getElementById('go_button').style.color = '#bbb';
+               if ( ! document.forms[0].src.value )
+                       document.getElementById('status_img').src = 'images/required.gif';
+               else document.getElementById('status_img').src = 'images/no.png';
+       },
+
+       updateImageData : function() {
+               var t = addExtImage;
+
+               t.width = t.preloadImg.width;
+               t.height = t.preloadImg.height;
+               document.getElementById('go_button').style.color = '#333';
+               document.getElementById('status_img').src = 'images/yes.png';
+       },
+
+       getImageData : function() {
+               var t = addExtImage, src = document.forms[0].src.value;
+
+               if ( ! src ) {
+                       t.resetImageData();
+                       return false;
+               }
+               document.getElementById('status_img').src = 'images/loading.gif';
+               t.preloadImg = new Image();
+               t.preloadImg.onload = t.updateImageData;
+               t.preloadImg.onerror = t.resetImageData;
+               t.preloadImg.src = src;
+       }
+}
+//]]>
+</script>
+
 <div id="media-items">
 <div class="media-item media-blank">
 <?php echo call_user_func($callback); ?>
 </div>
 </div>
 <input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" />
+</form>
 <?php
        endif;
 }
 
 function media_upload_gallery_form($errors) {
+       global $redir_tab;
+
+       $redir_tab = 'gallery';
        media_upload_header();
 
        $post_id = intval($_REQUEST['post_id']);
-
-       $form_action_url = get_option('siteurl') . "/wp-admin/media-upload.php?type={$GLOBALS['type']}&tab=gallery&post_id=$post_id";
-
+       $form_action_url = admin_url("media-upload.php?type={$GLOBALS['type']}&tab=gallery&post_id=$post_id");
 ?>
 
 <script type="text/javascript">
@@ -907,15 +1097,22 @@ jQuery(function($){
 <form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form validate" id="gallery-form">
 <?php wp_nonce_field('media-form'); ?>
 <?php //media_upload_form( $errors ); ?>
-
+<table class="widefat">
+<thead><tr>
+<th><?php _e('Media'); ?></th>
+<th class="order-head"><?php _e('Order'); ?></th>
+</tr></thead>
+</table>
 <div id="media-items">
 <?php echo get_media_items($post_id, $errors); ?>
 </div>
+<p class="ml-submit">
 <input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" />
 <input type="submit" class="button insert-gallery" name="insert-gallery" value="<?php echo attribute_escape( __( 'Insert gallery into post' ) ); ?>" />
 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
 <input type="hidden" name="type" value="<?php echo attribute_escape( $GLOBALS['type'] ); ?>" />
 <input type="hidden" name="tab" value="<?php echo attribute_escape( $GLOBALS['tab'] ); ?>" />
+</p>
 </form>
 <?php
 }
@@ -927,7 +1124,7 @@ function media_upload_library_form($errors) {
 
        $post_id = intval($_REQUEST['post_id']);
 
-       $form_action_url = get_option('siteurl') . "/wp-admin/media-upload.php?type={$GLOBALS['type']}&tab=library&post_id=$post_id";
+       $form_action_url = admin_url("media-upload.php?type={$GLOBALS['type']}&tab=library&post_id=$post_id");
 
        $_GET['paged'] = intval($_GET['paged']);
        if ( $_GET['paged'] < 1 )
@@ -948,11 +1145,11 @@ function media_upload_library_form($errors) {
 <input type="hidden" name="post_mime_type" value="<?php echo attribute_escape( $_GET['post_mime_type'] ); ?>" />
 
 <div id="search-filter">
+       <label class="hidden" for="post-search-input"><?php _e('Search Media');?>:</label>
        <input type="text" id="post-search-input" name="s" value="<?php the_search_query(); ?>" />
        <input type="submit" value="<?php echo attribute_escape( __( 'Search Media' ) ); ?>" class="button" />
 </div>
 
-<p>
 <ul class="subsubsub">
 <?php
 $type_links = array();
@@ -968,7 +1165,7 @@ if ( empty($_GET['post_mime_type']) && !empty($num_posts[$type]) ) {
 }
 if ( empty($_GET['post_mime_type']) || $_GET['post_mime_type'] == 'all' )
        $class = ' class="current"';
-$type_links[] = "<li><a href='" . add_query_arg(array('post_mime_type'=>'all', 'paged'=>false, 'm'=>false)) . "'$class>".__('All Types')."</a>";
+$type_links[] = "<li><a href='" . clean_url(add_query_arg(array('post_mime_type'=>'all', 'paged'=>false, 'm'=>false))) . "'$class>".__('All Types')."</a>";
 foreach ( $post_mime_types as $mime_type => $label ) {
        $class = '';
 
@@ -978,13 +1175,12 @@ foreach ( $post_mime_types as $mime_type => $label ) {
        if ( wp_match_mime_types($mime_type, $_GET['post_mime_type']) )
                $class = ' class="current"';
 
-       $type_links[] = "<li><a href='" . add_query_arg(array('post_mime_type'=>$mime_type, 'paged'=>false)) . "'$class>" . sprintf(__ngettext($label[2][0], $label[2][1], $num_posts[$mime_type]), "<span id='$mime_type-counter'>" . number_format_i18n( $num_posts[$mime_type] ) . '</span>') . '</a>';
+       $type_links[] = "<li><a href='" . clean_url(add_query_arg(array('post_mime_type'=>$mime_type, 'paged'=>false))) . "'$class>" . sprintf(__ngettext($label[2][0], $label[2][1], $num_posts[$mime_type]), "<span id='$mime_type-counter'>" . number_format_i18n( $num_posts[$mime_type] ) . '</span>') . '</a>';
 }
 echo implode(' | </li>', $type_links) . '</li>';
 unset($type_links);
 ?>
 </ul>
-</p>
 
 <div class="tablenav">
 
@@ -1059,51 +1255,84 @@ jQuery(function($){
 <div id="media-items">
 <?php echo get_media_items(null, $errors); ?>
 </div>
+<p class="ml-submit">
 <input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" />
 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
+</p>
 </form>
 <?php
 }
 
 function type_form_image() {
+
+       if ( apply_filters( 'disable_captions', '' ) ) {
+               $alt = __('Alternate Text');
+               $alt_help = __('Alt text for the image, e.g. "The Mona Lisa"');
+       } else {
+               $alt = __('Image Caption');
+               $alt_help = __('Also used as alternate text for the image');
+       }
+
        return '
        <table class="describe"><tbody>
+               <tr>
+                       <th valign="top" scope="row" class="label" style="width:120px;">
+                               <span class="alignleft"><label for="src">' . __('Source') . '</label></span>
+                               <span class="alignright"><img id="status_img" src="images/required.gif" title="required" alt="required" /></span>
+                       </th>
+                       <td class="field"><input id="src" name="src" value="" type="text" aria-required="true" onblur="addExtImage.getImageData()" /></td>
+               </tr>
+
                <tr>
                        <th valign="top" scope="row" class="label">
-                               <span class="alignleft"><label for="insertonly[src]">' . __('Image URL') . '</label></span>
+                               <span class="alignleft"><label for="title">' . __('Image Title') . '</label></span>
                                <span class="alignright"><abbr title="required" class="required">*</abbr></span>
                        </th>
-                       <td class="field"><input id="insertonly[src]" name="insertonly[src]" value="" type="text"></td>
+                       <td class="field"><p><input id="title" name="title" value="" type="text" aria-required="true" /></p></td>
                </tr>
+
                <tr>
                        <th valign="top" scope="row" class="label">
-                               <span class="alignleft"><label for="insertonly[alt]">' . __('Description') . '</label></span>
-                               <span class="alignright"><abbr title="required" class="required">*</abbr></span>
+                               <span class="alignleft"><label for="alt">' . $alt . '</label></span>
                        </th>
-                       <td class="field"><input id="insertonly[alt]" name="insertonly[alt]" value="" type="text"></td>
+                       <td class="field"><input id="alt" name="alt" value="" type="text" aria-required="true" />
+                       <p class="help">' . $alt_help . '</p></td>
                </tr>
-               <tr><td></td><td class="help">' . __('Alternate text, e.g. "The Mona Lisa"') . '</td></tr>
+
                <tr class="align">
-                       <th valign="top" scope="row" class="label"><label for="insertonly[align]">' . __('Alignment') . '</label></th>
+                       <th valign="top" scope="row" class="label"><p><label for="align">' . __('Alignment') . '</label></p></th>
                        <td class="field">
-                               <input name="insertonly[align]" id="image-align-none-0" value="none" type="radio" checked="checked" />
-                               <label for="image-align-none-0" class="align image-align-none-label">' . __('None') . '</label>
-                               <input name="insertonly[align]" id="image-align-left-0" value="left" type="radio" />
-                               <label for="image-align-left-0" class="align image-align-left-label">' . __('Left') . '</label>
-                               <input name="insertonly[align]" id="image-align-center-0" value="center" type="radio" />
-                               <label for="image-align-center-0" class="align image-align-center-label">' . __('Center') . '</label>
-                               <input name="insertonly[align]" id="image-align-right-0" value="right" type="radio" />
-                               <label for="image-align-right-0" class="align image-align-right-label">' . __('Right') . '</label>
+                               <input name="align" id="align-none" value="alignnone" onclick="addExtImage.align=this.value" type="radio" checked="checked" />
+                               <label for="align-none" class="align image-align-none-label">' . __('None') . '</label>
+                               <input name="align" id="align-left" value="alignleft" onclick="addExtImage.align=this.value" type="radio" />
+                               <label for="align-left" class="align image-align-left-label">' . __('Left') . '</label>
+                               <input name="align" id="align-center" value="aligncenter" onclick="addExtImage.align=this.value" type="radio" />
+                               <label for="align-center" class="align image-align-center-label">' . __('Center') . '</label>
+                               <input name="align" id="align-right" value="alignright" onclick="addExtImage.align=this.value" type="radio" />
+                               <label for="align-right" class="align image-align-right-label">' . __('Right') . '</label>
                        </td>
                </tr>
+
+               <tr>
+                       <th valign="top" scope="row" class="label">
+                               <span class="alignleft"><label for="url">' . __('Link URL') . '</label></span>
+                       </th>
+                       <td class="field"><input id="url" name="url" value="" type="text" /><br />
+
+                       <button type="button" class="button" value="" onclick="document.forms[0].url.value=null">' . __('None') . '</button>
+                       <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="submit" class="button" name="insertonlybutton" value="' . attribute_escape(__('Insert into Post')) . '" />
+                               <input type="button" class="button" id="go_button" style="color:#bbb;" onclick="addExtImage.insert()" value="' . attribute_escape(__('Insert into Post')) . '" />
                        </td>
                </tr>
        </tbody></table>
 ';
+
 }
 
 function type_form_audio() {
@@ -1114,14 +1343,14 @@ function type_form_audio() {
                                <span class="alignleft"><label for="insertonly[href]">' . __('Audio File URL') . '</label></span>
                                <span class="alignright"><abbr title="required" class="required">*</abbr></span>
                        </th>
-                       <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text"></td>
+                       <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td>
                </tr>
                <tr>
                        <th valign="top" scope="row" class="label">
                                <span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span>
                                <span class="alignright"><abbr title="required" class="required">*</abbr></span>
                        </th>
-                       <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text"></td>
+                       <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
                </tr>
                <tr><td></td><td class="help">' . __('Link text, e.g. "Still Alive by Jonathan Coulton"') . '</td></tr>
                <tr>
@@ -1142,14 +1371,14 @@ function type_form_video() {
                                <span class="alignleft"><label for="insertonly[href]">' . __('Video URL') . '</label></span>
                                <span class="alignright"><abbr title="required" class="required">*</abbr></span>
                        </th>
-                       <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text"></td>
+                       <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td>
                </tr>
                <tr>
                        <th valign="top" scope="row" class="label">
                                <span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span>
                                <span class="alignright"><abbr title="required" class="required">*</abbr></span>
                        </th>
-                       <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text"></td>
+                       <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
                </tr>
                <tr><td></td><td class="help">' . __('Link text, e.g. "Lucy on YouTube"') . '</td></tr>
                <tr>
@@ -1170,14 +1399,14 @@ function type_form_file() {
                                <span class="alignleft"><label for="insertonly[href]">' . __('URL') . '</label></span>
                                <span class="alignright"><abbr title="required" class="required">*</abbr></span>
                        </th>
-                       <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text"></td>
+                       <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td>
                </tr>
                <tr>
                        <th valign="top" scope="row" class="label">
                                <span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span>
                                <span class="alignright"><abbr title="required" class="required">*</abbr></span>
                        </th>
-                       <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text"></td>
+                       <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
                </tr>
                <tr><td></td><td class="help">' . __('Link text, e.g. "Ransom Demands (PDF)"') . '</td></tr>
                <tr>
@@ -1190,6 +1419,49 @@ function type_form_file() {
 ';
 }
 
+// support a GET parameter for disabling the flash uploader
+function media_upload_use_flash($flash) {
+        if ( array_key_exists('flash', $_REQUEST) )
+                $flash = !empty($_REQUEST['flash']);
+        return $flash;
+}
+
+add_filter('flash_uploader', 'media_upload_use_flash');
+
+function media_upload_flash_bypass() {
+        echo '<p class="upload-flash-bypass">';
+        printf( __('You are using the Flash uploader.  Problems?  Try the <a href="%s">Browser uploader</a> instead.'), clean_url(add_query_arg('flash', 0)) );
+        echo '</p>';
+}
+
+add_action('post-flash-upload-ui', 'media_upload_flash_bypass');
+
+function media_upload_html_bypass() {
+        echo '<p class="upload-html-bypass">';
+        if ( array_key_exists('flash', $_REQUEST) )
+                // the user manually selected the browser uploader, so let them switch back to Flash
+                printf( __('You are using the Browser uploader.  Try the <a href="%s">Flash uploader</a> instead.'), clean_url(add_query_arg('flash', 1)) );
+        else
+                // the user probably doesn't have Flash
+                printf( __('You are using the Browser uploader.') );
+
+        echo '</p>';
+}
+
+add_action('post-flash-upload-ui', 'media_upload_flash_bypass');
+add_action('post-html-upload-ui', 'media_upload_html_bypass');
+
+// make sure the GET parameter sticks when we submit a form
+function media_upload_bypass_url($url) {
+        if ( array_key_exists('flash', $_REQUEST) )
+                $url = add_query_arg('flash', intval($_REQUEST['flash']));
+        return $url;
+}
+
+add_filter('media_upload_form_url', 'media_upload_bypass_url');
+
+
+
 add_filter('async_upload_image', 'get_media_item', 10, 2);
 add_filter('async_upload_audio', 'get_media_item', 10, 2);
 add_filter('async_upload_video', 'get_media_item', 10, 2);
@@ -1199,12 +1471,9 @@ add_action('media_upload_image', 'media_upload_image');
 add_action('media_upload_audio', 'media_upload_audio');
 add_action('media_upload_video', 'media_upload_video');
 add_action('media_upload_file', 'media_upload_file');
-add_action('admin_head_media_upload_type_form', 'media_admin_css');
 
 add_filter('media_upload_gallery', 'media_upload_gallery');
-add_action('admin_head_media_upload_gallery_form', 'media_admin_css');
 
 add_filter('media_upload_library', 'media_upload_library');
-add_action('admin_head_media_upload_library_form', 'media_admin_css');
 
 ?>
index fcc3fe5550df639b8b6c9099339f62a75d773d5e..4ee545639fff8ed8779a57a7eb8ec9d6051a278e 100644 (file)
@@ -67,7 +67,7 @@ function insert_with_markers( $filename, $marker, $insertion ) {
                        }
                }
                if (!$foundit) {
-                       fwrite( $f, "# BEGIN {$marker}\n" );
+                       fwrite( $f, "\n# BEGIN {$marker}\n" );
                        foreach ( $insertion as $insertline )
                                fwrite( $f, "{$insertline}\n" );
                        fwrite( $f, "# END {$marker}\n" );
index a862c5106ccba822da620d29f8c9a54f8aedb14c..aca5242003d5f5011fb204a52753820c57154bd1 100644 (file)
@@ -32,14 +32,15 @@ function get_plugin_data( $plugin_file ) {
 }
 
 function get_plugins($plugin_folder = '') {
-       global $wp_plugins;
-
-       if ( isset( $wp_plugins ) ) {
-               return $wp_plugins;
-       }
-
+       
+       if ( ! $cache_plugins = wp_cache_get('plugins', 'plugins') )
+               $cache_plugins = array();
+       
+       if ( isset($cache_plugins[ $plugin_folder ]) )
+               return $cache_plugins[ $plugin_folder ];
+       
        $wp_plugins = array ();
-       $plugin_root = ABSPATH . PLUGINDIR;
+       $plugin_root = WP_PLUGIN_DIR;
        if( !empty($plugin_folder) )
                $plugin_root .= $plugin_folder;
 
@@ -85,6 +86,9 @@ function get_plugins($plugin_folder = '') {
 
        uasort( $wp_plugins, create_function( '$a, $b', 'return strnatcasecmp( $a["Name"], $b["Name"] );' ));
 
+       $cache_plugins[ $plugin_folder ] = $wp_plugins; 
+       wp_cache_set('plugins', $cache_plugins, 'plugins'); 
+
        return $wp_plugins;
 }
 
@@ -104,7 +108,7 @@ 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(ABSPATH . PLUGINDIR . '/' . $plugin);
+                       @include(WP_PLUGIN_DIR . '/' . $plugin);
                        $current[] = $plugin;
                        sort($current);
                        update_option('active_plugins', $current);
@@ -132,37 +136,96 @@ function deactivate_plugins($plugins, $silent= false) {
        update_option('active_plugins', $current);
 }
 
-function deactivate_all_plugins() {
-       $current = get_option('active_plugins');
-       if ( empty($current) )
-               return;
+function activate_plugins($plugins, $redirect = '') {
+       if ( !is_array($plugins) )
+               $plugins = array($plugins);
+
+       $errors = array();
+       foreach ( (array) $plugins as $plugin ) {
+               if ( !empty($redirect) )
+                       $redirect = add_query_arg('plugin', $plugin, $redirect);
+               $result = activate_plugin($plugin, $redirect);
+               if ( is_wp_error($result) )
+                       $errors[$plugin] = $result;
+       }
 
-       deactivate_plugins($current);
+       if ( !empty($errors) )
+               return new WP_Error('plugins_invalid', __('One of the plugins is invalid.'), $errors);
 
-       update_option('deactivated_plugins', $current);
+       return true;
 }
 
-function reactivate_all_plugins($redirect = '') {
-       $plugins = get_option('deactivated_plugins');
+function delete_plugins($plugins, $redirect = '' ) {
+       global $wp_filesystem;
+
+       if( empty($plugins) )
+               return false;
 
-       if ( empty($plugins) )
+       $checked = array();
+       foreach( $plugins as $plugin )
+               $checked[] = 'checked[]=' . $plugin;
+
+       ob_start();
+       $url = wp_nonce_url('plugins.php?action=delete-selected&verify-delete=1&' . implode('&', $checked), 'bulk-manage-plugins');
+       if ( false === ($credentials = request_filesystem_credentials($url)) ) {
+               $data = ob_get_contents();
+               ob_end_clean();
+               if( ! empty($data) ){
+                       include_once( ABSPATH . 'wp-admin/admin-header.php');
+                       echo $data;
+                       include( ABSPATH . 'wp-admin/admin-footer.php');
+                       exit;
+               }
                return;
+       }
 
-       if ( !empty($redirect) )
-               wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect));
+       if ( ! WP_Filesystem($credentials) ) {
+               request_filesystem_credentials($url, '', true); //Failed to connect, Error and request again
+               $data = ob_get_contents();
+               ob_end_clean();
+               if( ! empty($data) ){
+                       include_once( ABSPATH . 'wp-admin/admin-header.php');
+                       echo $data;
+                       include( ABSPATH . 'wp-admin/admin-footer.php');
+                       exit;
+               }
+               return;
+       }
 
-       $errors = array();
-       foreach ( (array) $plugins as $plugin ) {
-               $result = activate_plugin($plugin);
-               if ( is_wp_error($result) )
-                       $errors[$plugin] = $result;
+       if ( $wp_filesystem->errors->get_error_code() ) {
+               return $wp_filesystem->errors;
        }
 
-       delete_option('deactivated_plugins');
+       if ( ! is_object($wp_filesystem) )
+               return new WP_Error('fs_unavailable', __('Could not access filesystem.'));
 
-       if ( !empty($errors) )
-               return new WP_Error('plugins_invalid', __('One of the plugins is invalid.'), $errors);
+       if ( $wp_filesystem->errors->get_error_code() )
+               return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors);
+
+       //Get the base plugin folder
+       $plugins_dir = $wp_filesystem->wp_plugins_dir();
+       if ( empty($plugins_dir) )
+               return new WP_Error('fs_no_plugins_dir', __('Unable to locate WordPress Plugin directory.'));
+       
+       $plugins_dir = trailingslashit( $plugins_dir );
 
+       $errors = array();
+
+       foreach( $plugins as $plugin_file ) {
+               $this_plugin_dir = trailingslashit( dirname($plugins_dir . $plugin_file) );
+               // If plugin is in its own directory, recursively delete the directory.
+               if ( strpos($plugin_file, '/') && $this_plugin_dir != $plugins_dir ) //base check on if plugin includes directory seperator AND that its not the root plugin folder
+                       $deleted = $wp_filesystem->delete($this_plugin_dir, true);
+               else
+                       $deleted = $wp_filesystem->delete($plugins_dir . $plugin_file);
+       
+               if ( ! $deleted )
+                       $errors[] = $plugin_file;
+       }
+       
+       if( ! empty($errors) )
+               return new WP_Error('could_not_remove_plugin', sprintf(__('Could not fully remove the plugin(s) %s'), implode(', ', $errors)) );
+       
        return true;
 }
 
@@ -176,24 +239,25 @@ function validate_active_plugins() {
                return;
        }
 
+       //Invalid is any plugin that is deactivated due to error.
+       $invalid = array(); 
+
        // If a plugin file does not exist, remove it from the list of active
        // plugins.
        foreach ( $check_plugins as $check_plugin ) {
-               if ( !file_exists(ABSPATH . PLUGINDIR . '/' . $check_plugin) ) {
-                       $current = get_option('active_plugins');
-                       $key = array_search($check_plugin, $current);
-                       if ( false !== $key && NULL !== $key ) {
-                               unset($current[$key]);
-                               update_option('active_plugins', $current);
-                       }
+               $result = validate_plugin($check_plugin);
+               if ( is_wp_error( $result ) ) {
+                       $invalid[$check_plugin] = $result;
+                       deactivate_plugins( $check_plugin, true);
                }
        }
+       return $invalid;
 }
 
 function validate_plugin($plugin) {
        if ( validate_file($plugin) )
                return new WP_Error('plugin_invalid', __('Invalid plugin.'));
-       if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) )
+       if ( ! file_exists(WP_PLUGIN_DIR . '/' . $plugin) )
                return new WP_Error('plugin_not_found', __('Plugin file does not exist.'));
 
        return 0;
@@ -411,18 +475,16 @@ function get_plugin_page_hookname( $plugin_page, $parent_page ) {
 
        $parent = get_admin_page_parent();
 
+       $page_type = 'admin';
        if ( empty ( $parent_page ) || 'admin.php' == $parent_page ) {
                if ( isset( $admin_page_hooks[$plugin_page] ))
                        $page_type = 'toplevel';
                else
                        if ( isset( $admin_page_hooks[$parent] ))
                                $page_type = $admin_page_hooks[$parent];
-       } else
-               if ( isset( $admin_page_hooks[$parent_page] ) ) {
-                       $page_type = $admin_page_hooks[$parent_page];
-               } else {
-                       $page_type = 'admin';
-               }
+       } else if ( isset( $admin_page_hooks[$parent_page] ) ) {
+               $page_type = $admin_page_hooks[$parent_page];
+       }
 
        $plugin_name = preg_replace( '!\.php!', '', $plugin_page );
 
index aa1e833bbb4bf1c7c9f6bbcdcf16f1c7839701a9..49ede25aa4f53a122fdcf6921c20d70d5d22207c 100644 (file)
@@ -1,30 +1,19 @@
 <?php
 
-// Update an existing post with values provided in $_POST.
-function edit_post() {
-
-       $post_ID = (int) $_POST['post_ID'];
-
-       if ( 'page' == $_POST['post_type'] ) {
-               if ( !current_user_can( 'edit_page', $post_ID ) )
-                       wp_die( __('You are not allowed to edit this page.' ));
-       } else {
-               if ( !current_user_can( 'edit_post', $post_ID ) )
-                       wp_die( __('You are not allowed to edit this post.' ));
-       }
-
-       // Autosave shouldn't save too soon after a real save
-       if ( 'autosave' == $_POST['action'] ) {
-               $post =& get_post( $post_ID );
-               $now = time();
-               $then = strtotime($post->post_date_gmt . ' +0000');
-               $delta = AUTOSAVE_INTERVAL / 2;
-               if ( ($now - $then) < $delta )
-                       return $post_ID;
-       }
-
-       // Rename.
-       $_POST['ID'] = (int) $_POST['post_ID'];
+/**
+ * _wp_translate_postdata() - Rename $_POST data from form names to DB post columns.
+ *
+ * Manipulates $_POST directly.
+ *
+ * @package WordPress
+ * @since 2.6
+ *
+ * @param bool $update Are we updating a pre-existing post?
+ * @return object|bool WP_Error on failure, true on success.
+ */
+function _wp_translate_postdata( $update = false ) {
+       if ( $update )
+               $_POST['ID'] = (int) $_POST['post_ID'];
        $_POST['post_content'] = $_POST['content'];
        $_POST['post_excerpt'] = $_POST['excerpt'];
        $_POST['post_parent'] = isset($_POST['parent_id'])? $_POST['parent_id'] : '';
@@ -32,21 +21,29 @@ function edit_post() {
 
        if (!empty ( $_POST['post_author_override'] ) ) {
                $_POST['post_author'] = (int) $_POST['post_author_override'];
-       } else
+       } else {
                if (!empty ( $_POST['post_author'] ) ) {
                        $_POST['post_author'] = (int) $_POST['post_author'];
                } else {
                        $_POST['post_author'] = (int) $_POST['user_ID'];
                }
+       }
 
        if ( $_POST['post_author'] != $_POST['user_ID'] ) {
                if ( 'page' == $_POST['post_type'] ) {
-                       if ( !current_user_can( 'edit_others_pages' ) )
-                               wp_die( __('You are not allowed to edit pages as this user.' ));
+                       if ( !current_user_can( 'edit_others_pages' ) ) {
+                               return new WP_Error( 'edit_others_pages', $update ?
+                                       __( 'You are not allowed to edit pages as this user.' ) :
+                                       __( 'You are not allowed to create pages as this user.' )
+                               );
+                       }
                } else {
-                       if ( !current_user_can( 'edit_others_posts' ) )
-                               wp_die( __('You are not allowed to edit posts as this user.' ));
-
+                       if ( !current_user_can( 'edit_others_posts' ) ) {
+                               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.' )
+                               );
+                       }
                }
        }
 
@@ -60,12 +57,20 @@ function edit_post() {
        if ( isset($_POST['advanced']) && '' != $_POST['advanced'] )
                $_POST['post_status'] = 'draft';
 
+       $previous_status = get_post_field('post_status',  $_POST['ID']);
+
+       // Posts 'submitted for approval' present are submitted to $_POST the same as if they were being published. 
+       // Change status from 'publish' to 'pending' if user lacks permissions to publish or to resave published posts.
        if ( 'page' == $_POST['post_type'] ) {
-               if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_pages' ))
-                       $_POST['post_status'] = 'pending';
+               if ( 'publish' == $_POST['post_status'] && !current_user_can( 'publish_pages' ) )
+                       if ( $previous_status != 'publish' OR !current_user_can( 'edit_published_pages') )
+                               $_POST['post_status'] = 'pending';
        } else {
-               if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_posts' ))
-                       $_POST['post_status'] = 'pending';
+               if ( 'publish' == $_POST['post_status'] && !current_user_can( 'publish_posts' ) ) :
+                       // Stop attempts to publish new posts, but allow already published posts to be saved if appropriate.
+                       if ( $previous_status != 'publish' OR !current_user_can( 'edit_published_posts') )
+                               $_POST['post_status'] = 'pending';
+               endif;
        }
 
        if (!isset( $_POST['comment_status'] ))
@@ -74,28 +79,62 @@ function edit_post() {
        if (!isset( $_POST['ping_status'] ))
                $_POST['ping_status'] = 'closed';
 
-       foreach ( array ('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) {
+       foreach ( array('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) {
                if ( !empty( $_POST['hidden_' . $timeunit] ) && $_POST['hidden_' . $timeunit] != $_POST[$timeunit] ) {
                        $_POST['edit_date'] = '1';
                        break;
                }
        }
 
-       if (!empty ( $_POST['edit_date'] ) ) {
+       if ( !empty( $_POST['edit_date'] ) ) {
                $aa = $_POST['aa'];
                $mm = $_POST['mm'];
                $jj = $_POST['jj'];
                $hh = $_POST['hh'];
                $mn = $_POST['mn'];
                $ss = $_POST['ss'];
+               $aa = ($aa <= 0 ) ? date('Y') : $aa;
+               $mm = ($mm <= 0 ) ? date('n') : $mm;
                $jj = ($jj > 31 ) ? 31 : $jj;
+               $jj = ($jj <= 0 ) ? date('j') : $jj;
                $hh = ($hh > 23 ) ? $hh -24 : $hh;
                $mn = ($mn > 59 ) ? $mn -60 : $mn;
                $ss = ($ss > 59 ) ? $ss -60 : $ss;
-               $_POST['post_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
-               $_POST['post_date_gmt'] = get_gmt_from_date( "$aa-$mm-$jj $hh:$mn:$ss" );
+               $_POST['post_date'] = sprintf( "%04d-%02d-%02d %02d:%02d:%02d", $aa, $mm, $jj, $hh, $mn, $ss );
+               $_POST['post_date_gmt'] = get_gmt_from_date( $_POST['post_date'] );
+       }
+
+       return true;
+}
+
+
+// Update an existing post with values provided in $_POST.
+function edit_post() {
+
+       $post_ID = (int) $_POST['post_ID'];
+
+       if ( 'page' == $_POST['post_type'] ) {
+               if ( !current_user_can( 'edit_page', $post_ID ) )
+                       wp_die( __('You are not allowed to edit this page.' ));
+       } else {
+               if ( !current_user_can( 'edit_post', $post_ID ) )
+                       wp_die( __('You are not allowed to edit this post.' ));
        }
 
+       // Autosave shouldn't save too soon after a real save
+       if ( 'autosave' == $_POST['action'] ) {
+               $post =& get_post( $post_ID );
+               $now = time();
+               $then = strtotime($post->post_date_gmt . ' +0000');
+               $delta = AUTOSAVE_INTERVAL / 2;
+               if ( ($now - $then) < $delta )
+                       return $post_ID;
+       }
+
+       $translated = _wp_translate_postdata( true );
+       if ( is_wp_error($translated) )
+               wp_die( $translated->get_error_message() );
+
        // Meta Stuff
        if ( isset($_POST['meta']) && $_POST['meta'] ) {
                foreach ( $_POST['meta'] as $key => $value )
@@ -194,13 +233,13 @@ function post_exists($title, $content = '', $post_date = '') {
        global $wpdb;
 
        if (!empty ($post_date))
-               $post_date = "AND post_date = '$post_date'";
+               $post_date = $wpdb->prepare("AND post_date = %s", $post_date);
 
        if (!empty ($title))
-               return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' $post_date");
+               return $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_title = %s $post_date", $title) );
        else
                if (!empty ($content))
-                       return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_content = '$content' $post_date");
+                       return $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_content = %s $post_date", $content) );
 
        return 0;
 }
@@ -236,79 +275,9 @@ function wp_write_post() {
                }
        }
 
-       // Rename.
-       $_POST['post_content'] = $_POST['content'];
-       $_POST['post_excerpt'] = $_POST['excerpt'];
-       $_POST['post_parent'] = isset($_POST['parent_id'])? $_POST['parent_id'] : '';
-       $_POST['to_ping'] = $_POST['trackback_url'];
-
-       if (!empty ( $_POST['post_author_override'] ) ) {
-               $_POST['post_author'] = (int) $_POST['post_author_override'];
-       } else {
-               if (!empty ( $_POST['post_author'] ) ) {
-                       $_POST['post_author'] = (int) $_POST['post_author'];
-               } else {
-                       $_POST['post_author'] = (int) $_POST['user_ID'];
-               }
-
-       }
-
-       if ( $_POST['post_author'] != $_POST['user_ID'] ) {
-               if ( 'page' == $_POST['post_type'] ) {
-                       if ( !current_user_can( 'edit_others_pages' ) )
-                               return new WP_Error( 'edit_others_pages', __( 'You are not allowed to create pages as this user.' ) );
-               } else {
-                       if ( !current_user_can( 'edit_others_posts' ) )
-                               return new WP_Error( 'edit_others_posts', __( 'You are not allowed to post as this user.' ) );
-
-               }
-       }
-
-       // What to do based on which button they pressed
-       if ( isset($_POST['saveasdraft']) && '' != $_POST['saveasdraft'] )
-               $_POST['post_status'] = 'draft';
-       if ( isset($_POST['saveasprivate']) && '' != $_POST['saveasprivate'] )
-               $_POST['post_status'] = 'private';
-       if ( isset($_POST['publish']) && ( '' != $_POST['publish'] ) && ( $_POST['post_status'] != 'private' ) )
-               $_POST['post_status'] = 'publish';
-       if ( isset($_POST['advanced']) && '' != $_POST['advanced'] )
-               $_POST['post_status'] = 'draft';
-
-       if ( 'page' == $_POST['post_type'] ) {
-               if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_pages' ) )
-                       $_POST['post_status'] = 'pending';
-       } else {
-               if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_posts' ) )
-                       $_POST['post_status'] = 'pending';
-       }
-
-       if (!isset( $_POST['comment_status'] ))
-               $_POST['comment_status'] = 'closed';
-
-       if (!isset( $_POST['ping_status'] ))
-               $_POST['ping_status'] = 'closed';
-
-       foreach ( array ('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) {
-               if ( !empty( $_POST['hidden_' . $timeunit] ) && $_POST['hidden_' . $timeunit] != $_POST[$timeunit] ) {
-                       $_POST['edit_date'] = '1';
-                       break;
-               }
-       }
-
-       if (!empty ( $_POST['edit_date'] ) ) {
-               $aa = $_POST['aa'];
-               $mm = $_POST['mm'];
-               $jj = $_POST['jj'];
-               $hh = $_POST['hh'];
-               $mn = $_POST['mn'];
-               $ss = $_POST['ss'];
-               $jj = ($jj > 31 ) ? 31 : $jj;
-               $hh = ($hh > 23 ) ? $hh -24 : $hh;
-               $mn = ($mn > 59 ) ? $mn -60 : $mn;
-               $ss = ($ss > 59 ) ? $ss -60 : $ss;
-               $_POST['post_date'] = sprintf( "%04d-%02d-%02d %02d:%02d:%02d", $aa, $mm, $jj, $hh, $mn, $ss );
-               $_POST['post_date_gmt'] = get_gmt_from_date( $_POST['post_date'] );
-       }
+       $translated = _wp_translate_postdata( false );
+       if ( is_wp_error($translated) )
+               return $translated;
 
        // Create the post.
        $post_ID = wp_insert_post( $_POST );
@@ -380,11 +349,9 @@ function add_meta( $post_ID ) {
 
                wp_cache_delete($post_ID, 'post_meta');
 
-               $wpdb->query( "
-                               INSERT INTO $wpdb->postmeta
-                               (post_id,meta_key,meta_value )
-                               VALUES ('$post_ID','$metakey','$metavalue' )
-                       " );
+               $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->postmeta 
+                       (post_id,meta_key,meta_value ) VALUES (%s, %s, %s)",
+                       $post_ID, $metakey, $metavalue) );
                return $wpdb->insert_id;
        }
        return false;
@@ -394,10 +361,10 @@ function delete_meta( $mid ) {
        global $wpdb;
        $mid = (int) $mid;
 
-       $post_id = $wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = '$mid'");
+       $post_id = $wpdb->get_var( $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = %d", $mid) );
        wp_cache_delete($post_id, 'post_meta');
 
-       return $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_id = '$mid'" );
+       return $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_id = %d", $mid) );
 }
 
 // Get a list of previously defined keys
@@ -417,7 +384,7 @@ function get_post_meta_by_id( $mid ) {
        global $wpdb;
        $mid = (int) $mid;
 
-       $meta = $wpdb->get_row( "SELECT * FROM $wpdb->postmeta WHERE meta_id = '$mid'" );
+       $meta = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->postmeta WHERE meta_id = %d", $mid) );
        if ( is_serialized_string( $meta->meta_value ) )
                $meta->meta_value = maybe_unserialize( $meta->meta_value );
        return $meta;
@@ -427,29 +394,30 @@ function get_post_meta_by_id( $mid ) {
 function has_meta( $postid ) {
        global $wpdb;
 
-       return $wpdb->get_results( "
-                       SELECT meta_key, meta_value, meta_id, post_id
-                       FROM $wpdb->postmeta
-                       WHERE post_id = '$postid'
-                       ORDER BY meta_key,meta_id", ARRAY_A );
+       return $wpdb->get_results( $wpdb->prepare("SELECT meta_key, meta_value, meta_id, post_id
+                       FROM $wpdb->postmeta WHERE post_id = %d
+                       ORDER BY meta_key,meta_id", $postid), ARRAY_A );
 
 }
 
-function update_meta( $mid, $mkey, $mvalue ) {
+function update_meta( $meta_id, $meta_key, $meta_value ) {
        global $wpdb;
 
        $protected = array( '_wp_attached_file', '_wp_attachment_metadata', '_wp_old_slug', '_wp_page_template' );
 
-       if ( in_array($mkey, $protected) )
+       if ( in_array($meta_key, $protected) )
                return false;
 
-       $post_id = $wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = '$mid'");
+       $post_id = $wpdb->get_var( $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = %d", $meta_id) );
        wp_cache_delete($post_id, 'post_meta');
 
-       $mvalue = maybe_serialize( stripslashes( $mvalue ));
-       $mvalue = $wpdb->escape( $mvalue );
-       $mid = (int) $mid;
-       return $wpdb->query( "UPDATE $wpdb->postmeta SET meta_key = '$mkey', meta_value = '$mvalue' WHERE meta_id = '$mid'" );
+       $meta_value = maybe_serialize( stripslashes( $meta_value ));
+       $meta_id = (int) $meta_id;
+       
+       $data  = compact( 'meta_key', 'meta_value' );
+       $where = compact( 'meta_id' );
+
+       return $wpdb->update( $wpdb->postmeta, $data, $where );
 }
 
 //
@@ -502,7 +470,7 @@ function _relocate_children( $old_ID, $new_ID ) {
        global $wpdb;
        $old_ID = (int) $old_ID;
        $new_ID = (int) $new_ID;
-       return $wpdb->query( "UPDATE $wpdb->posts SET post_parent = $new_ID WHERE post_parent = $old_ID" );
+       return $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = %d WHERE post_parent = %d", $new_ID, $old_ID) );
 }
 
 function get_available_post_statuses($type = 'post') {
@@ -631,11 +599,10 @@ function get_sample_permalink($id, $title=null, $name = null) {
                $permalink = str_replace('%pagename%', "${uri}%pagename%", $permalink);
        }
 
-       $permalink = array($permalink, $post->post_name);
+       $permalink = array($permalink, apply_filters('editable_slug', $post->post_name));
        $post->post_status = $original_status;
        $post->post_date = $original_date;
        $post->post_name = $original_name;
-       $post->post_title = $original_title;
        return $permalink;
 }
 
@@ -691,4 +658,28 @@ function wp_set_post_lock( $post_id ) {
                update_post_meta( $post->ID, '_edit_last', $current_user->ID );
 }
 
-?>
+/**
+ * wp_create_post_autosave() - creates autosave data for the specified post from $_POST data
+ *
+ * @package WordPress
+ * @subpackage Post Revisions
+ * @since 2.6
+ *
+ * @uses _wp_translate_postdata()
+ * @uses _wp_post_revision_fields()
+ */
+function wp_create_post_autosave( $post_id ) {
+       $translated = _wp_translate_postdata( true );
+       if ( is_wp_error( $translated ) )
+               return $translated;
+
+       // Only store one autosave.  If there is already an autosave, overwrite it.
+       if ( $old_autosave = wp_get_post_autosave( $post_id ) ) {
+               $new_autosave = _wp_post_revision_fields( $_POST, true );
+               $new_autosave['ID'] = $old_autosave->ID;
+               return wp_update_post( $new_autosave );
+       }
+
+       // Otherwise create the new autosave as a special post revision
+       return _wp_put_post_revision( $_POST, true );
+}
index b8c7e2cbbec879dc3bf302e1ebabfa19ef22e4b9..7162b42b3e6767c1ab8a328300004d2eb47ee5ea 100644 (file)
@@ -15,11 +15,12 @@ if ( $wpdb->supports_collation() ) {
 
 $wp_queries="CREATE TABLE $wpdb->terms (
  term_id bigint(20) NOT NULL auto_increment,
- name varchar(55) NOT NULL default '',
+ name varchar(200) NOT NULL default '',
  slug varchar(200) NOT NULL default '',
  term_group bigint(10) NOT NULL default 0,
  PRIMARY KEY  (term_id),
- UNIQUE KEY slug (slug)
+ UNIQUE KEY slug (slug),
+ KEY name (name)
 ) $charset_collate;
 CREATE TABLE $wpdb->term_taxonomy (
  term_taxonomy_id bigint(20) NOT NULL auto_increment,
@@ -153,9 +154,11 @@ CREATE TABLE $wpdb->usermeta (
 
 function populate_options() {
        global $wpdb, $wp_db_version;
-
-       $schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
-       $guessurl = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
+       
+       $guessurl = wp_guess_url();
+       
+       do_action('populate_options');
+       
        add_option('siteurl', $guessurl);
        add_option('blogname', __('My Blog'));
        add_option('blogdescription', __('Just another WordPress weblog'));
@@ -223,10 +226,10 @@ function populate_options() {
        if ( ini_get('safe_mode') ) {
                // Safe mode screws up mkdir(), so we must use a flat structure.
                add_option('uploads_use_yearmonth_folders', 0);
-               add_option('upload_path', 'wp-content');
+               add_option('upload_path', WP_CONTENT_DIR);
        } else {
                add_option('uploads_use_yearmonth_folders', 1);
-               add_option('upload_path', 'wp-content/uploads');
+               add_option('upload_path', WP_CONTENT_DIR . '/uploads');
        }
 
        // 2.0.3
@@ -250,8 +253,13 @@ function populate_options() {
        add_option('medium_size_w', 300);
        add_option('medium_size_h', 300);
 
+       // 2.6
+       add_option('avatar_default', 'mystery');
+       add_option('enable_app', 0);
+       add_option('enable_xmlrpc', 0);
+       
        // 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');
+       $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins');
        foreach ($unusedoptions as $option) :
                delete_option($option);
        endforeach;
@@ -268,6 +276,7 @@ function populate_roles() {
        populate_roles_210();
        populate_roles_230();
        populate_roles_250();
+       populate_roles_260();
 }
 
 function populate_roles_160() {
@@ -423,4 +432,13 @@ function populate_roles_250() {
        }
 }
 
+function populate_roles_260() {
+       $role = get_role( 'administrator' );
+
+       if ( !empty( $role ) ) {
+               $role->add_cap( 'update_plugins' );
+               $role->add_cap( 'delete_plugins' );
+       }
+}
+
 ?>
index b490ed639ca47ce30bc1ca5f7a2e827eaa09e9af..a0b95a7af6f2aa32e2a6fa727cd38a25254419b0 100644 (file)
@@ -47,7 +47,7 @@ function wp_delete_category($cat_ID) {
        if ( $cat_ID == $default )
                return 0;
 
-       return wp_delete_term($cat_ID, 'category', "default=$default");
+       return wp_delete_term($cat_ID, 'category', array('default' => $default));
 }
 
 function wp_insert_category($catarr, $wp_error = false) {
@@ -133,7 +133,7 @@ function get_tags_to_edit( $post_id ) {
 
        foreach ( $tags as $tag )
                $tag_names[] = $tag->name;
-       $tags_to_edit = join( ', ', $tag_names );
+       $tags_to_edit = join( ',', $tag_names );
        $tags_to_edit = attribute_escape( $tags_to_edit );
        $tags_to_edit = apply_filters( 'tags_to_edit', $tags_to_edit );
        return $tags_to_edit;
index db80bf80317f080e818e0609ffcf8909a3adeb37..e132733e8ce6f8a4a883e2bcc19c4d3c3415a3ac 100644 (file)
@@ -4,35 +4,73 @@
 // Big Mess
 //
 
-// Dandy new recursive multiple category stuff.
-function cat_rows( $parent = 0, $level = 0, $categories = 0 ) {
-       if ( !$categories ) {
+// Ugly recursive category stuff.
+function cat_rows( $parent = 0, $level = 0, $categories = 0, $page = 1, $per_page = 20 ) {
+       $count = 0;
+       _cat_rows($categories, $count, $parent, $level, $page, $per_page);
+}
+
+function _cat_rows( $categories, &$count, $parent = 0, $level = 0, $page = 1, $per_page = 20 ) {
+       if ( empty($categories) ) {
                $args = array('hide_empty' => 0);
                if ( !empty($_GET['s']) )
                        $args['search'] = $_GET['s'];
                $categories = get_categories( $args );
        }
 
+       if ( !$categories )
+               return false;
+
        $children = _get_term_hierarchy('category');
 
-       if ( $categories ) {
-               ob_start();
-               foreach ( $categories as $category ) {
-                       if ( $category->parent == $parent) {
-                               echo "\t" . _cat_row( $category, $level );
-                               if ( isset($children[$category->term_id]) )
-                                       cat_rows( $category->term_id, $level +1, $categories );
+       $start = ($page - 1) * $per_page;
+       $end = $start + $per_page;
+       $i = -1;
+       ob_start();
+       foreach ( $categories as $category ) {
+               if ( $count >= $end )
+                       break;
+
+               $i++;
+
+               if ( $category->parent != $parent )
+                       continue;
+
+               // If the page starts in a subtree, print the parents.
+               if ( $count == $start && $category->parent > 0 ) {
+                       $my_parents = array();
+                       $my_parent = $category->parent;
+                       while ( $my_parent) {
+                               $my_parent = get_category($my_parent);
+                               $my_parents[] = $my_parent;
+                               if ( !$my_parent->parent )
+                                       break;
+                               $my_parent = $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--;
                        }
                }
-               $output = ob_get_contents();
-               ob_end_clean();
 
-               $output = apply_filters('cat_rows', $output);
+               if ( $count >= $start )
+                       echo "\t" . _cat_row( $category, $level );
+
+               unset($categories[$i]); // Prune the working set                
+               $count++;
+
+               if ( isset($children[$category->term_id]) )
+                       _cat_rows( $categories, $count, $category->term_id, $level + 1, $page, $per_page );
 
-               echo $output;
-       } else {
-               return false;
        }
+
+       $output = ob_get_contents();
+       ob_end_clean();
+
+       $output = apply_filters('cat_rows', $output);
+
+       echo $output;
 }
 
 function _cat_row( $category, $level, $name_override = false ) {
@@ -148,19 +186,24 @@ class Walker_Category_Checklist extends Walker {
        }
 }
 
-function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false ) {
+function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false ) {
        $walker = new Walker_Category_Checklist;
        $descendants_and_self = (int) $descendants_and_self;
 
        $args = array();
        
-       if ( $post_id )
+       if ( is_array( $selected_cats ) )
+               $args['selected_cats'] = $selected_cats;
+       elseif ( $post_id )
                $args['selected_cats'] = wp_get_post_categories($post_id);
        else
                $args['selected_cats'] = array();
-       if ( is_array( $selected_cats ) )
-               $args['selected_cats'] = $selected_cats;
-       $args['popular_cats'] = get_terms( 'category', array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) );
+
+       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 ) );
+
        if ( $descendants_and_self ) {
                $categories = get_categories( "child_of=$descendants_and_self&hierarchical=0&hide_empty=0" );
                $self = get_category( $descendants_and_self );
@@ -169,13 +212,22 @@ function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $select
                $categories = get_categories('get=all');
        }
 
-       $args = array($categories, 0, $args);
-       $output = call_user_func_array(array(&$walker, 'walk'), $args);
+       // Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache)
+       $checked_categories = array();
+       for ( $i = 0; isset($categories[$i]); $i++ ) {
+               if ( in_array($categories[$i]->term_id, $args['selected_cats']) ) {
+                       $checked_categories[] = $categories[$i];
+                       unset($categories[$i]);
+               }
+       }
 
-       echo $output;
+       // Put checked cats on top
+       echo call_user_func_array(array(&$walker, 'walk'), array($checked_categories, 0, $args));
+       // Then the rest of them
+       echo call_user_func_array(array(&$walker, 'walk'), array($categories, 0, $args));
 }
 
-function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10 ) {
+function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo = true ) {
        global $post_ID;
        if ( $post_ID )
                $checked_categories = wp_get_post_categories($post_ID);
@@ -186,6 +238,8 @@ function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10 ) {
        $popular_ids = array();
        foreach ( (array) $categories as $category ) {
                $popular_ids[] = $category->term_id;
+               if ( !$echo ) // hack for AJAX use
+                       continue;
                $id = "popular-category-$category->term_id";
                ?>
 
@@ -286,7 +340,7 @@ function tag_rows( $page = 1, $pagesize = 20, $searchterms = '' ) {
 // define the columns to display, the syntax is 'internal name' => 'display name'
 function wp_manage_posts_columns() {
        $posts_columns = array();
-       $posts_columns['cb'] = '<input type="checkbox" onclick="checkAll(document.getElementById(\'posts-filter\'));" />';
+       $posts_columns['cb'] = '<input type="checkbox" />';
        if ( 'draft' === $_GET['post_status'] )
                $posts_columns['modified'] = __('Modified');
        elseif ( 'pending' === $_GET['post_status'] )
@@ -308,7 +362,7 @@ function wp_manage_posts_columns() {
 // define the columns to display, the syntax is 'internal name' => 'display name'
 function wp_manage_media_columns() {
        $posts_columns = array();
-       $posts_columns['cb'] = '<input type="checkbox" onclick="checkAll(document.getElementById(\'posts-filter\'));" />';
+       $posts_columns['cb'] = '<input type="checkbox" />';
        $posts_columns['icon'] = '';
        $posts_columns['media'] = _c('Media|media column header');
        $posts_columns['desc'] = _c('Description|media column header');
@@ -323,7 +377,7 @@ function wp_manage_media_columns() {
 
 function wp_manage_pages_columns() {
        $posts_columns = array();
-       $posts_columns['cb'] = '<input type="checkbox" onclick="checkAll(document.getElementById(\'posts-filter\'));" />';
+       $posts_columns['cb'] = '<input type="checkbox" />';
        if ( 'draft' === $_GET['post_status'] )
                $posts_columns['modified'] = __('Modified');
        elseif ( 'pending' === $_GET['post_status'] )
@@ -344,7 +398,7 @@ function wp_manage_pages_columns() {
  * display one row if the page doesn't have any children
  * otherwise, display the row and its children in subsequent rows
  */
-function display_page_row( $page, &$children_pages, $level = 0 ) {
+function display_page_row( $page, $level = 0 ) {
        global $post;
        static $class;
 
@@ -468,66 +522,126 @@ foreach ($posts_columns as $column_name=>$column_display_name) {
    </tr>
 
 <?php
-
-       if ( ! $children_pages )
-               return true;
-
-       for ( $i = 0; $i < count($children_pages); $i++ ) {
-
-               $child = $children_pages[$i];
-
-               if ( $child->post_parent == $id ) {
-                       array_splice($children_pages, $i, 1);
-                       display_page_row($child, $children_pages, $level+1);
-                       $i = -1; //as numeric keys in $children_pages are not preserved after splice
-               }
-       }
 }
 
 /*
- * displays pages in hierarchical order
+ * displays pages in hierarchical order with paging support
  */
-function page_rows( $pages ) {
-       if ( ! $pages )
-               $pages = get_pages( 'sort_column=menu_order' );
+function page_rows($pages, $pagenum = 1, $per_page = 20) {
+       $level = 0;
 
-       if ( ! $pages )
-               return false;
+       if ( ! $pages ) {
+               $pages = get_pages( array('sort_column' => 'menu_order') );
 
-       // splice pages into two parts: those without parent and those with parent
+               if ( ! $pages )
+                       return false;
+       }
+
+       /* 
+        * arrange pages into two parts: top level pages and children_pages
+        * children_pages is two dimensional array, eg. 
+        * children_pages[10][] contains all sub-pages whose parent is 10. 
+        * It only takes O(N) to arrange this and it takes O(1) for subsequent lookup operations
+        * If searching, ignore hierarchy and treat everything as top level
+        */
+       if ( empty($_GET['s']) )  {
+               
+               $top_level_pages = array();
+               $children_pages  = array();
+               
+               foreach ( $pages as $page ) {
+                       
+                       // catch and repair bad pages
+                       if ( $page->post_parent == $page->ID ) {
+                               $page->post_parent = 0;
+                               $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = '0' WHERE ID = %d", $page->ID) );
+                               clean_page_cache( $page->ID );
+                       }
+       
+                       if ( 0 == $page->post_parent )
+                               $top_level_pages[] = $page;
+                       else
+                               $children_pages[ $page->post_parent ][] = $page;
+               }
 
-       $top_level_pages = array();
-       $children_pages  = array();
+               $pages = &$top_level_pages;
+       }
 
+       $count = 0;
+       $start = ($pagenum - 1) * $per_page;
+       $end = $start + $per_page;
+       
        foreach ( $pages as $page ) {
+               if ( $count >= $end )
+                       break;
 
-               // catch and repair bad pages
-               if ( $page->post_parent == $page->ID ) {
-                       $page->post_parent = 0;
-                       $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = '0' WHERE ID = %d", $page->ID) );
-                       clean_page_cache( $page->ID );
-               }
+               if ( $count >= $start )
+                       echo "\t" . display_page_row( $page, $level );
 
-               if ( 0 == $page->post_parent )
-                       $top_level_pages[] = $page;
-               else
-                       $children_pages[] = $page;
-       }
+               $count++;
 
-       foreach ( $top_level_pages as $page )
-               display_page_row($page, $children_pages, 0);
+               if ( isset($children_pages) )
+                       _page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
+       }
+       
+       // if it is the last pagenum and there are orphaned pages, display them with paging as well
+       if ( isset($children_pages) && $count < $end ){
+               foreach( $children_pages as $orphans ){
+                       foreach ( $orphans as $op ) {
+                               if ( $count >= $end )
+                                       break;
+                               if ( $count >= $start )
+                                       echo "\t" . display_page_row( $op, 0 );
+                               $count++;
+                       }
+               }
+       }
+}
 
-       /*
-        * display the remaining children_pages which are orphans
-        * having orphan requires parental attention
-        */
-        if ( count($children_pages) > 0 ) {
-               $empty_array = array();
-               foreach ( $children_pages as $orphan_page ) {
-                       clean_page_cache( $orphan_page->ID);
-                       display_page_row( $orphan_page, $empty_array, 0 );
+/*
+ * Given a top level page ID, display the nested hierarchy of sub-pages
+ * together with paging support
+ */
+function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) {
+       
+       if ( ! isset( $children_pages[$parent] ) )
+               return; 
+               
+       $start = ($pagenum - 1) * $per_page;
+       $end = $start + $per_page;
+       
+       foreach ( $children_pages[$parent] as $page ) {
+               
+               if ( $count >= $end )
+                       break;
+                       
+               // If the page starts in a subtree, print the parents.
+               if ( $count == $start && $page->post_parent > 0 ) {
+                       $my_parents = array();
+                       $my_parent = $page->post_parent;
+                       while ( $my_parent) {
+                               $my_parent = get_post($my_parent);
+                               $my_parents[] = $my_parent;
+                               if ( !$my_parent->post_parent )
+                                       break;
+                               $my_parent = $my_parent->post_parent;
+                       }
+                       $num_parents = count($my_parents);
+                       while( $my_parent = array_pop($my_parents) ) {
+                               echo "\t" . display_page_row( $my_parent, $level - $num_parents );
+                               $num_parents--;
+                       }
                }
-        }
+
+               if ( $count >= $start )
+                       echo "\t" . display_page_row( $page, $level );
+                       
+               $count++;
+
+               _page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
+       }
+       
+       unset( $children_pages[$parent] ); //required in order to keep track of orphans
 }
 
 function user_row( $user_object, $style = '', $role = '' ) {
@@ -556,7 +670,7 @@ function user_row( $user_object, $style = '', $role = '' ) {
        } else {
                $edit = $user_object->user_login;
        }
-       $role_name = translate_with_context($wp_roles->role_names[$role]);
+       $role_name = $wp_roles->role_names[$role] ? translate_with_context($wp_roles->role_names[$role]) : __('None');
        $r = "<tr id='user-$user_object->ID'$style>
                <th scope='row' class='check-column'><input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='$role' value='{$user_object->ID}' /></th>
                <td><strong>$edit</strong></td>
@@ -601,7 +715,7 @@ function _wp_get_comment_list( $status = '', $s = false, $start, $num ) {
                        $approved
                        ORDER BY comment_date_gmt DESC LIMIT $start, $num");
        } else {
-               $comments = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments USE INDEX (comment_date_gmt) WHERE $approved ORDER BY comment_date_gmt DESC LIMIT $start, $num" );
+               $comments = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE $approved ORDER BY comment_date_gmt DESC LIMIT $start, $num" );
        }
 
        update_comment_cache($comments);
@@ -675,21 +789,22 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
 
        $actions = array();
 
-               $actions['approve']   = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | ';
-               $actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a> | ';
+       if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
+               $actions['approve']   = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | ';
+               $actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a> | ';
 
                // we're looking at list of only approved or only unapproved comments
                if ( 'moderated' == $comment_status ) {
-                       $actions['approve'] = "<a href='$approve_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | ';
+                       $actions['approve'] = "<a href='$approve_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=approved' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | ';
                        unset($actions['unapprove']);
                } elseif ( 'approved' == $comment_status ) {
-                       $actions['unapprove'] = "<a href='$unapprove_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a> | ';
+                       $actions['unapprove'] = "<a href='$unapprove_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=unapproved' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a> | ';
                        unset($actions['approve']);
                }
 
-       if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
                $actions['spam']      = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1' title='" . __( 'Mark this comment as spam' ) . "'>" . __( 'Spam' ) . '</a> | ';
                $actions['delete']    = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete'>" . __('Delete') . '</a>';
+               $actions = apply_filters( 'comment_row_actions', $actions, $comment );
                foreach ( $actions as $action => $link )
                        echo "<span class='$action'>$link</span>";
        }
@@ -701,7 +816,7 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
 
 function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) {
        if (!$categories )
-               $categories = get_categories( 'hide_empty=0' );
+               $categories = get_categories( array('hide_empty' => 0) );
 
        if ( $categories ) {
                foreach ( $categories as $category ) {
@@ -774,8 +889,8 @@ function _list_meta_row( $entry, &$count ) {
        $delete_nonce = wp_create_nonce( 'delete-meta_' . $entry['meta_id'] );
 
        $r .= "\n\t<tr id='meta-{$entry['meta_id']}' class='$style'>";
-       $r .= "\n\t\t<td valign='top'><input name='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' size='20' value='{$entry['meta_key']}' /></td>";
-       $r .= "\n\t\t<td><textarea name='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>";
+       $r .= "\n\t\t<td valign='top'><label class='hidden' for='meta[{$entry['meta_id']}][key]'>" . __( 'Key' ) . "</label><input name='meta[{$entry['meta_id']}][key]' id='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' size='20' value='{$entry['meta_key']}' /></td>";
+       $r .= "\n\t\t<td><label class='hidden' for='meta[{$entry['meta_id']}][value]'>" . __( 'Value' ) . "</label><textarea name='meta[{$entry['meta_id']}][value]' id='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>";
        $r .= "\n\t\t<td style='text-align: center;'><input name='updatemeta' type='submit' tabindex='6' value='".attribute_escape(__( 'Update' ))."' class='add:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$update_nonce updatemeta' /><br />";
        $r .= "\n\t\t<input name='deletemeta[{$entry['meta_id']}]' type='submit' ";
        $r .= "class='delete:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$delete_nonce deletemeta' tabindex='6' value='".attribute_escape(__( 'Delete' ))."' />";
@@ -800,8 +915,8 @@ function meta_form() {
 <p><strong><?php _e( 'Add a new custom field:' ) ?></strong></p>
 <table id="newmeta" cellspacing="3" cellpadding="3">
        <tr>
-<th colspan="2"><?php _e( 'Key' ) ?></th>
-<th><?php _e( 'Value' ) ?></th>
+<th colspan="2"><label <?php if ( $keys ) : ?> for="metakeyselect" <?php else : ?> for="metakeyinput" <?php endif; ?>><?php _e( 'Key' ) ?></label></th>
+<th><label for="metavalue"><?php _e( 'Value' ) ?></label></th>
 </tr>
        <tr valign="top">
                <td style="width: 18%;" class="textright">
@@ -815,7 +930,7 @@ function meta_form() {
                echo "\n\t<option value='$key'>$key</option>";
        }
 ?>
-</select> <?php _e( 'or' ); ?>
+</select> <label for="metakeyinput"><?php _e( 'or' ); ?></label>
 <?php endif; ?>
 </td>
 <td><input type="text" id="metakeyinput" name="metakeyinput" tabindex="7" /></td>
@@ -823,7 +938,7 @@ function meta_form() {
        </tr>
 <tr class="submit"><td colspan="3">
        <?php wp_nonce_field( 'add-meta', '_ajax_nonce', false ); ?>
-       <input type="submit" id="addmetasub" name="addmeta" class="add:the-list:newmeta::post_id=<?php echo $GLOBALS['post_ID'] ? $GLOBALS['post_ID'] : $GLOBALS['temp_ID']; ?>" tabindex="9" value="<?php _e( 'Add Custom Field' ) ?>" />
+       <input type="submit" id="addmetasub" name="addmeta" class="add:the-list:newmeta" tabindex="9" value="<?php _e( 'Add Custom Field' ) ?>" />
 </td></tr>
 </table>
 <?php
@@ -888,7 +1003,7 @@ function page_template_dropdown( $default = '' ) {
 
 function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) {
        global $wpdb, $post_ID;
-       $items = $wpdb->get_results( "SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = $parent AND post_type = 'page' ORDER BY menu_order" );
+       $items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent) );
 
        if ( $items ) {
                foreach ( $items as $item ) {
@@ -1041,10 +1156,12 @@ function wp_remember_old_slug() {
  * @param string $callback Function that fills the box with the desired content.  The function should echo its output.
  * @param string $page The type of edit page on which to show the box (post, page, link)
  * @param string $context The context within the page where the boxes should show ('normal', 'advanced')
+ * @param string $priority The priority within the context where the boxes should show ('high', 'low')
  */
-function add_meta_box($id, $title, $callback, $page, $context = 'advanced') {
+function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $priority = 'default') {
        global $wp_meta_boxes;
 
+       
        if  ( !isset($wp_meta_boxes) )
                $wp_meta_boxes = array();
        if ( !isset($wp_meta_boxes[$page]) )
@@ -1052,23 +1169,81 @@ function add_meta_box($id, $title, $callback, $page, $context = 'advanced') {
        if ( !isset($wp_meta_boxes[$page][$context]) )
                $wp_meta_boxes[$page][$context] = array();
 
-       $wp_meta_boxes[$page][$context][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback);
+       foreach ( array('high', 'core', 'default', 'low') as $a_priority ) {
+               if ( !isset($wp_meta_boxes[$page][$context][$a_priority][$id]) )
+                       continue;
+               // If a core box was previously added or removed by a plugin, don't add.
+               if ( 'core' == $priority ) {
+                       // If core box previously deleted, don't add
+                       if ( false === $wp_meta_boxes[$page][$context][$a_priority][$id] )
+                               return;
+                       // If box was added with default priority, give it core priority to maintain sort order
+                       if ( 'default' == $a_priority ) {
+                               $wp_meta_boxes[$page][$context]['core'][$id] = $wp_meta_boxes[$page][$context]['default'][$id];
+                               unset($wp_meta_boxes[$page][$context]['default'][$id]);
+                       }
+                       return;
+               }
+               // If no priority given and id already present, use existing priority
+               if ( empty($priority) )
+                       $priority = $a_priority;
+               // An id can be in only one priority
+               if ( $priority != $a_priority )
+                       unset($wp_meta_boxes[$page][$context][$a_priority][$id]);
+       }
+
+       if ( empty($priority) )
+               $priority = low;
+
+       if ( !isset($wp_meta_boxes[$page][$context][$priority]) )
+               $wp_meta_boxes[$page][$context][$priority] = array();
+
+       $wp_meta_boxes[$page][$context][$priority][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback);
 }
 
 function do_meta_boxes($page, $context, $object) {
        global $wp_meta_boxes;
 
+       do_action('do_meta_boxes', $page, $context, $object);
+
        if ( !isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context]) )
                return;
 
-       foreach ( (array) $wp_meta_boxes[$page][$context] as $box ) {
-               echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . '">' . "\n";
-               echo "<h3>{$box['title']}</h3>\n";
-               echo '<div class="inside">' . "\n";
-               call_user_func($box['callback'], $object, $box);
-               echo "</div>\n";
-               echo "</div>\n";
+       foreach ( array('high', 'core', 'default', 'low') as $priority ) {
+               foreach ( (array) $wp_meta_boxes[$page][$context][$priority] as $box ) {
+                       if ( false === $box )
+                               continue;
+                       echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . '">' . "\n";
+                       echo "<h3>{$box['title']}</h3>\n";
+                       echo '<div class="inside">' . "\n";
+                       call_user_func($box['callback'], $object, $box);
+                       echo "</div>\n";
+                       echo "</div>\n";
+               }
        }
 }
 
+/**
+ * remove_meta_box() - Remove a meta box from an edit form
+ *
+ * @since 2.6
+ *
+ * @param string $id String for use in the 'id' attribute of tags.
+ * @param string $page The type of edit page on which to show the box (post, page, link)
+ * @param string $context The context within the page where the boxes should show ('normal', 'advanced')
+ */
+function remove_meta_box($id, $page, $context) {
+       global $wp_meta_boxes;
+
+       if  ( !isset($wp_meta_boxes) )
+               $wp_meta_boxes = array();
+       if ( !isset($wp_meta_boxes[$page]) )
+               $wp_meta_boxes[$page] = array();
+       if ( !isset($wp_meta_boxes[$page][$context]) )
+               $wp_meta_boxes[$page][$context] = array();
+
+       foreach ( array('high', 'core', 'default', 'low') as $priority )
+               $wp_meta_boxes[$page][$context][$priority][$id] = false;
+}
+
 ?>
index 7dae5beba25f8e81a231795cab803958724d2fdf..ec670ce6a3764f176ac4b5a5b790d73a1afcb554 100644 (file)
@@ -33,7 +33,7 @@ function get_page_templates() {
 
        if ( is_array( $templates ) ) {
                foreach ( $templates as $template ) {
-                       $template_data = implode( '', file( ABSPATH.$template ));
+                       $template_data = implode( '', file( WP_CONTENT_DIR.$template ));
 
                        preg_match( '|Template Name:(.*)$|mi', $template_data, $name );
                        preg_match( '|Description:(.*)$|mi', $template_data, $description );
index 0a31531c7cf5d53b44de49547f0213dbaf85b63b..7070bad8da6761bd93261f6f0c25bccc9b93366a 100644 (file)
@@ -53,90 +53,24 @@ function update_right_now_message() {
        echo "<span id='wp-version-message'>$msg</span>";
 }
 
-function wp_update_plugins() {
-       global $wp_version;
-
-       if ( !function_exists('fsockopen') )
-               return false;
-
-       $plugins = get_plugins();
-       $active  = get_option( 'active_plugins' );
-       $current = get_option( 'update_plugins' );
-
-       $new_option = '';
-       $new_option->last_checked = time();
-
-       $plugin_changed = false;
-       foreach ( $plugins as $file => $p ) {
-               $new_option->checked[ $file ] = $p['Version'];
-
-               if ( !isset( $current->checked[ $file ] ) ) {
-                       $plugin_changed = true;
-                       continue;
-               }
-
-               if ( strval($current->checked[ $file ]) !== strval($p['Version']) )
-                       $plugin_changed = true;
-       }
-
-       if (
-               isset( $current->last_checked ) &&
-               43200 > ( time() - $current->last_checked ) &&
-               !$plugin_changed
-       )
-               return false;
-
-       $to_send->plugins = $plugins;
-       $to_send->active = $active;
-       $send = serialize( $to_send );
-
-       $request = 'plugins=' . urlencode( $send );
-       $http_request  = "POST /plugins/update-check/1.0/ HTTP/1.0\r\n";
-       $http_request .= "Host: api.wordpress.org\r\n";
-       $http_request .= "Content-Type: application/x-www-form-urlencoded; charset=" . get_option('blog_charset') . "\r\n";
-       $http_request .= "Content-Length: " . strlen($request) . "\r\n";
-       $http_request .= 'User-Agent: WordPress/' . $wp_version . '; ' . get_bloginfo('url') . "\r\n";
-       $http_request .= "\r\n";
-       $http_request .= $request;
-
-       $response = '';
-       if( false != ( $fs = @fsockopen( 'api.wordpress.org', 80, $errno, $errstr, 3) ) && is_resource($fs) ) {
-               fwrite($fs, $http_request);
-
-               while ( !feof($fs) )
-                       $response .= fgets($fs, 1160); // One TCP-IP packet
-               fclose($fs);
-               $response = explode("\r\n\r\n", $response, 2);
-       }
-
-       $response = unserialize( $response[1] );
-
-       if ( $response )
-               $new_option->response = $response;
-
-       update_option( 'update_plugins', $new_option );
-}
-add_action( 'load-plugins.php', 'wp_update_plugins' );
-
-function wp_plugin_update_row( $file ) {
-       global $plugin_data;
+function wp_plugin_update_row( $file, $plugin_data ) {
        $current = get_option( 'update_plugins' );
        if ( !isset( $current->response[ $file ] ) )
                return false;
 
        $r = $current->response[ $file ];
 
-       echo "<tr><td colspan='5' class='plugin-update'>";
-       if ( !current_user_can('edit_plugins') )
+       echo '<tr><td colspan="5" class="plugin-update">';
+       if ( ! current_user_can('update_plugins') )
                printf( __('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a>.'), $plugin_data['Name'], $r->url, $r->new_version);
        else if ( empty($r->package) )
                printf( __('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> <em>automatic upgrade unavailable for this plugin</em>.'), $plugin_data['Name'], $r->url, $r->new_version);
        else
-               printf( __('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> or <a href="%4$s">upgrade automatically</a>.'), $plugin_data['Name'], $r->url, $r->new_version, wp_nonce_url("update.php?action=upgrade-plugin&amp;plugin=$file", 'upgrade-plugin_' . $file) );
+               printf( __('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> or <a href="%4$s">upgrade automatically</a>.'), $plugin_data['Name'], $r->url, $r->new_version, wp_nonce_url('update.php?action=upgrade-plugin&amp;plugin=' . $file, 'upgrade-plugin_' . $file) );
        
-       echo "</td></tr>";
+       echo '</td></tr>';
 }
-add_action( 'after_plugin_row', 'wp_plugin_update_row' );
+add_action( 'after_plugin_row', 'wp_plugin_update_row', 10, 2 );
 
 function wp_update_plugin($plugin, $feedback = '') {
        global $wp_filesystem;
@@ -150,7 +84,7 @@ function wp_update_plugin($plugin, $feedback = '') {
                return new WP_Error('up_to_date', __('The plugin is at the latest version.'));
 
        // Is a filesystem accessor setup?
-       if ( ! $wp_filesystem || !is_object($wp_filesystem) )
+       if ( ! $wp_filesystem || ! is_object($wp_filesystem) )
                WP_Filesystem();
 
        if ( ! is_object($wp_filesystem) )
@@ -159,11 +93,18 @@ function wp_update_plugin($plugin, $feedback = '') {
        if ( $wp_filesystem->errors->get_error_code() )
                return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors);
 
-       //Get the Base folder
-       $base = $wp_filesystem->get_base_dir();
+       //Get the base plugin folder
+       $plugins_dir = $wp_filesystem->wp_plugins_dir();
+       if ( empty($plugins_dir) )
+               return new WP_Error('fs_no_plugins_dir', __('Unable to locate WordPress Plugin directory.'));
+
+       //And the same for the Content directory.
+       $content_dir = $wp_filesystem->wp_content_dir();
+       if( empty($content_dir) )
+               return new WP_Error('fs_no_content_dir', __('Unable to locate WordPress Content directory (wp-content).'));
        
-       if ( empty($base) )
-               return new WP_Error('fs_nowordpress', __('Unable to locate WordPress directory.'));
+       $plugins_dir = trailingslashit( $plugins_dir );
+       $content_dir = trailingslashit( $content_dir );
 
        // Get the URL to the zip file
        $r = $current->response[ $plugin ];
@@ -174,12 +115,12 @@ function wp_update_plugin($plugin, $feedback = '') {
        // Download the package
        $package = $r->package;
        apply_filters('update_feedback', sprintf(__('Downloading update from %s'), $package));
-       $file = download_url($package);
+       $download_file = download_url($package);
 
-       if ( is_wp_error($file) )
-               return new WP_Error('download_failed', __('Download failed.'), $file->get_error_message());
+       if ( is_wp_error($download_file) )
+               return new WP_Error('download_failed', __('Download failed.'), $download_file->get_error_message());
 
-       $working_dir = $base . 'wp-content/upgrade/' . basename($plugin, '.php');
+       $working_dir = $content_dir . 'upgrade/' . basename($plugin, '.php');
 
        // Clean up working directory
        if ( $wp_filesystem->is_dir($working_dir) )
@@ -187,16 +128,16 @@ function wp_update_plugin($plugin, $feedback = '') {
 
        apply_filters('update_feedback', __('Unpacking the update'));
        // Unzip package to working directory
-       $result = unzip_file($file, $working_dir);
+       $result = unzip_file($download_file, $working_dir);
+       
+       // Once extracted, delete the package
+       unlink($download_file);
+       
        if ( is_wp_error($result) ) {
-               unlink($file);
                $wp_filesystem->delete($working_dir, true);
                return $result;
        }
 
-       // Once extracted, delete the package
-       unlink($file);
-
        if ( is_plugin_active($plugin) ) {
                //Deactivate the plugin silently, Prevent deactivation hooks from running.
                apply_filters('update_feedback', __('Deactivating the plugin'));
@@ -205,25 +146,25 @@ function wp_update_plugin($plugin, $feedback = '') {
 
        // Remove the existing plugin.
        apply_filters('update_feedback', __('Removing the old version of the plugin'));
-       $plugin_dir = dirname($base . PLUGINDIR . "/$plugin");
-       $plugin_dir = trailingslashit($plugin_dir);
+       $this_plugin_dir = trailingslashit( dirname($plugins_dir . $plugin) );
        
        // If plugin is in its own directory, recursively delete the directory.
-       if ( strpos($plugin, '/') && $plugin_dir != $base . PLUGINDIR . '/' ) //base check on if plugin includes directory seperator AND that its not the root plugin folder
-               $deleted = $wp_filesystem->delete($plugin_dir, true);
+       if ( strpos($plugin, '/') && $this_plugin_dir != $plugins_dir ) //base check on if plugin includes directory seperator AND that its not the root plugin folder
+               $deleted = $wp_filesystem->delete($this_plugin_dir, true);
        else
-               $deleted = $wp_filesystem->delete($base . PLUGINDIR . "/$plugin");
+               $deleted = $wp_filesystem->delete($plugins_dir . $plugin);
 
-       if ( !$deleted ) {
+       if ( ! $deleted ) {
                $wp_filesystem->delete($working_dir, true);
                return new WP_Error('delete_failed', __('Could not remove the old plugin'));
        }
 
        apply_filters('update_feedback', __('Installing the latest version'));
        // Copy new version of plugin into place.
-       if ( !copy_dir($working_dir, $base . PLUGINDIR) ) {
+       $result = copy_dir($working_dir, $plugins_dir);
+       if ( is_wp_error($result) ) {
                //$wp_filesystem->delete($working_dir, true); //TODO: Uncomment? This DOES mean that the new files are available in the upgrade folder if it fails.
-               return new WP_Error('install_failed', __('Installation failed'));
+               return $result;
        }
 
        //Get a list of the directories in the working directory before we delete it, We need to know the new folder for the plugin
@@ -236,13 +177,13 @@ function wp_update_plugin($plugin, $feedback = '') {
        delete_option('update_plugins');
        
        if( empty($filelist) )
-               return false; //We couldnt find any files in the working dir
+               return false; //We couldnt find any files in the working dir, therefor no plugin installed? Failsafe backup.
        
        $folder = $filelist[0];
-       $plugin = get_plugins('/' . $folder); //Pass it with a leading slash, search out the plugins in the folder, 
+       $plugin = get_plugins('/' . $folder); //Ensure to pass with leading slash
        $pluginfiles = array_keys($plugin); //Assume the requested plugin is the first in the list
 
-       return  $folder . '/' . $pluginfiles[0]; //Pass it without a leading slash as WP requires
+       return  $folder . '/' . $pluginfiles[0];
 }
 
 ?>
index 4985aacbbe40946b678f7efad26525ca2adc9be2..fc398ab44e4b183f09d7f62a20108524a2a85faa 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
-if ( file_exists(ABSPATH . 'wp-content/install.php') )
-       require (ABSPATH . 'wp-content/install.php');
+if ( file_exists(WP_CONTENT_DIR . '/install.php') )
+       require (WP_CONTENT_DIR . '/install.php');
 require_once(ABSPATH . 'wp-admin/includes/admin.php');
 require_once(ABSPATH . 'wp-admin/includes/schema.php');
 
@@ -18,12 +18,8 @@ function wp_install($blog_title, $user_name, $user_email, $public, $deprecated='
        update_option('blogname', $blog_title);
        update_option('admin_email', $user_email);
        update_option('blog_public', $public);
-       $schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
 
-       if ( defined('WP_SITEURL') && '' != WP_SITEURL )
-               $guessurl = WP_SITEURL;
-       else
-               $guessurl = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
+       $guessurl = wp_guess_url();
 
        update_option('siteurl', $guessurl);
 
@@ -205,6 +201,12 @@ function upgrade_all() {
        if ( $wp_current_db_version < 7796 )
                upgrade_251();
 
+       if ( $wp_current_db_version < 7935 )
+               upgrade_252();
+
+       if ( $wp_current_db_version < 8201 )
+               upgrade_260();
+
        maybe_disable_automattic_widgets();
 
        $wp_rewrite->flush_rules();
@@ -221,7 +223,7 @@ function upgrade_100() {
                foreach($posts as $post) {
                        if ('' == $post->post_name) {
                                $newtitle = sanitize_title($post->post_title);
-                               $wpdb->query("UPDATE $wpdb->posts SET post_name = '$newtitle' WHERE ID = '$post->ID'");
+                               $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_name = %s WHERE ID = %d", $newtitle, $post->ID) );
                        }
                }
        }
@@ -230,7 +232,7 @@ function upgrade_100() {
        foreach ($categories as $category) {
                if ('' == $category->category_nicename) {
                        $newtitle = sanitize_title($category->cat_name);
-                       $wpdb->query("UPDATE $wpdb->categories SET category_nicename = '$newtitle' WHERE cat_ID = '$category->cat_ID'");
+                       $wpdb->query( $wpdb->prepare("UPDATE $wpdb->categories SET category_nicename = %s WHERE cat_ID = %d", $newtitle, $category->cat_ID) );
                }
        }
 
@@ -253,14 +255,12 @@ function upgrade_100() {
        if ($allposts) :
                foreach ($allposts as $post) {
                        // Check to see if it's already been imported
-                       $cat = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post->ID AND category_id = $post->post_category");
+                       $cat = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->post2cat WHERE post_id = %d AND category_id = %d", $post->ID, $post->post_category) );
                        if (!$cat && 0 != $post->post_category) { // If there's no result
-                               $wpdb->query("
-                                       INSERT INTO $wpdb->post2cat
+                               $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->post2cat
                                        (post_id, category_id)
-                                       VALUES
-                                       ('$post->ID', '$post->post_category')
-                                       ");
+                                       VALUES (%s, %s)
+                                       ", $post->ID, $post->post_category) );
                        }
                }
        endif;
@@ -288,7 +288,7 @@ function upgrade_110() {
        foreach ($users as $user) {
                if ('' == $user->user_nicename) {
                        $newname = sanitize_title($user->user_nickname);
-                       $wpdb->query("UPDATE $wpdb->users SET user_nicename = '$newname' WHERE ID = '$user->ID'");
+                       $wpdb->query( $wpdb->prepare("UPDATE $wpdb->users SET user_nicename = %s WHERE ID = %d", $newname, $user->ID) );
                }
        }
 
@@ -404,7 +404,7 @@ function upgrade_130() {
        foreach ( $options as $option ) {
                if ( 1 != $option->dupes ) { // Could this be done in the query?
                        $limit = $option->dupes - 1;
-                       $dupe_ids = $wpdb->get_col("SELECT option_id FROM $wpdb->options WHERE option_name = '$option->option_name' LIMIT $limit");
+                       $dupe_ids = $wpdb->get_col( $wpdb->prepare("SELECT option_id FROM $wpdb->options WHERE option_name = %s LIMIT %d", $option->option_name, $limit) );
                        $dupe_ids = join($dupe_ids, ',');
                        $wpdb->query("DELETE FROM $wpdb->options WHERE option_id IN ($dupe_ids)");
                }
@@ -448,8 +448,7 @@ function upgrade_160() {
                        if ($idmode == 'namefl') $id = $user->user_firstname.' '.$user->user_lastname;
                        if ($idmode == 'namelf') $id = $user->user_lastname.' '.$user->user_firstname;
                        if (!$idmode) $id = $user->user_nickname;
-                       $id = $wpdb->escape( $id );
-                       $wpdb->query("UPDATE $wpdb->users SET display_name = '$id' WHERE ID = '$user->ID'");
+                       $wpdb->query( $wpdb->prepare("UPDATE $wpdb->users SET display_name = %s WHERE ID = %d", $id, $user->ID) );
                endif;
 
                // FIXME: RESET_CAPS is temporary code to reset roles and caps if flag is set.
@@ -471,7 +470,7 @@ function upgrade_160() {
        $comments = $wpdb->get_results( "SELECT comment_post_ID, COUNT(*) as c FROM $wpdb->comments WHERE comment_approved = '1' GROUP BY comment_post_ID" );
        if( is_array( $comments ) ) {
                foreach ($comments as $comment) {
-                       $wpdb->query( "UPDATE $wpdb->posts SET comment_count = $comment->c WHERE ID = '$comment->comment_post_ID'" );
+                       $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET comment_count = %d WHERE ID = %d", $comment->c, $comment->comment_post_ID) );
                }
        }
 
@@ -480,10 +479,10 @@ function upgrade_160() {
        if ( $wp_current_db_version > 2541 && $wp_current_db_version <= 3091 ) {
                $objects = $wpdb->get_results("SELECT ID, post_type FROM $wpdb->posts WHERE post_status = 'object'");
                foreach ($objects as $object) {
-                       $wpdb->query("UPDATE $wpdb->posts SET post_status = 'attachment',
-                       post_mime_type = '$object->post_type',
+                       $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_status = 'attachment',
+                       post_mime_type = %s,
                        post_type = ''
-                       WHERE ID = $object->ID");
+                       WHERE ID = %d", $object->post_type, $object->ID) );
 
                        $meta = get_post_meta($object->ID, 'imagedata', true);
                        if ( ! empty($meta['file']) )
@@ -511,7 +510,7 @@ function upgrade_210() {
                                $type = 'attachment';
                        }
 
-                       $wpdb->query("UPDATE $wpdb->posts SET post_status = '$status', post_type = '$type' WHERE ID = '$post->ID'");
+                       $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_status = %s, post_type = %s WHERE ID = %d", $status, $type, $post->ID) );
                }
        }
 
@@ -544,45 +543,46 @@ function upgrade_230() {
        $categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_ID");
        foreach ($categories as $category) {
                $term_id = (int) $category->cat_ID;
-               $name = $wpdb->escape($category->cat_name);
-               $description = $wpdb->escape($category->category_description);
-               $slug = $wpdb->escape($category->category_nicename);
-               $parent = $wpdb->escape($category->category_parent);
+               $name = $category->cat_name;
+               $description = $category->category_description;
+               $slug = $category->category_nicename;
+               $parent = $category->category_parent;
                $term_group = 0;
 
                // Associate terms with the same slug in a term group and make slugs unique.
-               if ( $exists = $wpdb->get_results("SELECT term_id, term_group FROM $wpdb->terms WHERE slug = '$slug'") ) {
+               if ( $exists = $wpdb->get_results( $wpdb->prepare("SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug) ) ) {
                        $term_group = $exists[0]->term_group;
                        $id = $exists[0]->term_id;
                        $num = 2;
                        do {
                                $alt_slug = $slug . "-$num";
                                $num++;
-                               $slug_check = $wpdb->get_var("SELECT slug FROM $wpdb->terms WHERE slug = '$alt_slug'");
+                               $slug_check = $wpdb->get_var( $wpdb->prepare("SELECT slug FROM $wpdb->terms WHERE slug = %s", $alt_slug) );
                        } while ( $slug_check );
 
                        $slug = $alt_slug;
 
                        if ( empty( $term_group ) ) {
                                $term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms GROUP BY term_group") + 1;
-                               $wpdb->query("UPDATE $wpdb->terms SET term_group = '$term_group' WHERE term_id = '$id'");
+                               $wpdb->query( $wpdb->prepare("UPDATE $wpdb->terms SET term_group = %d WHERE term_id = %d", $term_group, $id) );
                        }
                }
 
-               $wpdb->query("INSERT INTO $wpdb->terms (term_id, name, slug, term_group) VALUES ('$term_id', '$name', '$slug', '$term_group')");
+               $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->terms (term_id, name, slug, term_group) VALUES 
+               (%d, %s, %s, %d)", $term_id, $name, $slug, $term_group) );
 
                $count = 0;
                if ( !empty($category->category_count) ) {
                        $count = (int) $category->category_count;
                        $taxonomy = 'category';
-                       $wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('$term_id', '$taxonomy', '$description', '$parent', '$count')");
+                       $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count) );
                        $tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id;
                }
 
                if ( !empty($category->link_count) ) {
                        $count = (int) $category->link_count;
                        $taxonomy = 'link_category';
-                       $wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('$term_id', '$taxonomy', '$description', '$parent', '$count')");
+                       $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count) );
                        $tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id;
                }
 
@@ -590,14 +590,14 @@ function upgrade_230() {
                        $have_tags = true;
                        $count = (int) $category->tag_count;
                        $taxonomy = 'post_tag';
-                       $wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('$term_id', '$taxonomy', '$description', '$parent', '$count')");
+                       $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count) );
                        $tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id;
                }
 
                if ( empty($count) ) {
                        $count = 0;
                        $taxonomy = 'category';
-                       $wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('$term_id', '$taxonomy', '$description', '$parent', '$count')");
+                       $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count) );
                        $tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id;
                }
        }
@@ -617,7 +617,7 @@ function upgrade_230() {
                if ( empty($tt_id) )
                        continue;
 
-               $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ('$post_id', '$tt_id')");
+               $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ( %d, %d)", $post_id, $tt_id) );
        }
 
        // < 3570 we used linkcategories.  >= 3570 we used categories and link2cat.
@@ -636,20 +636,20 @@ function upgrade_230() {
                        $term_group = 0;
 
                        // Associate terms with the same slug in a term group and make slugs unique.
-                       if ( $exists = $wpdb->get_results("SELECT term_id, term_group FROM $wpdb->terms WHERE slug = '$slug'") ) {
+                       if ( $exists = $wpdb->get_results( $wpdb->prepare("SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug) ) ) {
                                $term_group = $exists[0]->term_group;
                                $term_id = $exists[0]->term_id;
                        }
 
                        if ( empty($term_id) ) {
-                               $wpdb->query("INSERT INTO $wpdb->terms (name, slug, term_group) VALUES ('$name', '$slug', '$term_group')");
+                               $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->terms (name, slug, term_group) VALUES (%s, %s, %d)", $name, $slug, $term_group) );
                                $term_id = (int) $wpdb->insert_id;
                        }
 
                        $link_cat_id_map[$cat_id] = $term_id;
                        $default_link_cat = $term_id;
 
-                       $wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('$term_id', 'link_category', '', '0', '0')");
+                       $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES (%d, 'link_category', '', '0', '0')", $term_id) );
                        $tt_ids[$term_id] = (int) $wpdb->insert_id;
                }
 
@@ -665,7 +665,7 @@ function upgrade_230() {
                        if ( empty($tt_id) )
                                continue;
 
-                       $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ('$link->link_id', '$tt_id')");
+                       $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ( %d, %d)", $link->link_id, $tt_id) );
                }
 
                // Set default to the last category we grabbed during the upgrade loop.
@@ -680,7 +680,7 @@ function upgrade_230() {
                        if ( empty($tt_id) )
                                continue;
 
-                       $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ('$link_id', '$tt_id')");
+                       $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ( %d, %d)", $link_id, $tt_id) );
                }
        }
 
@@ -693,10 +693,10 @@ function upgrade_230() {
        $terms = $wpdb->get_results("SELECT term_taxonomy_id, taxonomy FROM $wpdb->term_taxonomy");
        foreach ( (array) $terms as $term ) {
                if ( ('post_tag' == $term->taxonomy) || ('category' == $term->taxonomy) )
-                       $count = $wpdb->get_var("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 = '$term->term_taxonomy_id'");
+                       $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status = 'publish' AND post_type = 'post' AND term_taxonomy_id = %d", $term->term_taxonomy_id) );
                else
-                       $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = '$term->term_taxonomy_id'");
-               $wpdb->query("UPDATE $wpdb->term_taxonomy SET count = '$count' WHERE term_taxonomy_id = '$term->term_taxonomy_id'");
+                       $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term->term_taxonomy_id) );
+               $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET count = %d WHERE term_taxonomy_id = %d", $count, $term->term_taxonomy_id) );
        }
 }
 
@@ -739,6 +739,22 @@ function upgrade_251() {
        update_option('secret', wp_generate_password(64));
 }
 
+function upgrade_252() {
+       global $wpdb;
+
+       $wpdb->query("UPDATE $wpdb->users SET user_activation_key = ''");
+}
+
+function upgrade_260() {
+       if ( $wp_current_db_version < 8000 )
+               populate_roles_260();
+
+       if ( $wp_current_db_version < 8201 ) {
+               update_option('enable_app', 1);
+               update_option('enable_xmlrpc', 1);
+       }
+}
+
 // The functions we use to actually do stuff
 
 // General
@@ -833,7 +849,7 @@ function __get_option($setting) {
                return preg_replace( '|/+$|', '', constant( 'WP_SITEURL' ) );
        }
 
-       $option = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = '$setting'");
+       $option = $wpdb->get_var( $wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s", $setting) );
 
        if ( 'home' == $setting && '' == $option )
                return __get_option('siteurl');
@@ -868,7 +884,7 @@ function deslash($content) {
 function dbDelta($queries, $execute = true) {
        global $wpdb;
 
-       // Seperate individual queries into an array
+       // Separate individual queries into an array
        if( !is_array($queries) ) {
                $queries = explode( ';', $queries );
                if('' == $queries[count($queries) - 1]) array_pop($queries);
@@ -1083,7 +1099,7 @@ function make_db_current_silent() {
 
 function make_site_theme_from_oldschool($theme_name, $template) {
        $home_path = get_home_path();
-       $site_dir = ABSPATH . "wp-content/themes/$template";
+       $site_dir = WP_CONTENT_DIR . "/themes/$template";
 
        if (! file_exists("$home_path/index.php"))
                return false;
@@ -1102,7 +1118,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(ABSPATH . 'wp-content/themes/default/index.php', "$site_dir/$newfile"))
+                               if (! @copy(WP_CONTENT_DIR . '/themes/default/index.php', "$site_dir/$newfile"))
                                        return false;
                                continue; // Don't copy anything
                                }
@@ -1150,8 +1166,8 @@ function make_site_theme_from_oldschool($theme_name, $template) {
 }
 
 function make_site_theme_from_default($theme_name, $template) {
-       $site_dir = ABSPATH . "wp-content/themes/$template";
-       $default_dir = ABSPATH . 'wp-content/themes/default';
+       $site_dir = WP_CONTENT_DIR . "/themes/$template";
+       $default_dir = WP_CONTENT_DIR . '/themes/default';
 
        // 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');
@@ -1208,7 +1224,7 @@ function make_site_theme() {
        // Name the theme after the blog.
        $theme_name = __get_option('blogname');
        $template = sanitize_title($theme_name);
-       $site_dir = ABSPATH . "wp-content/themes/$template";
+       $site_dir = WP_CONTENT_DIR . "/themes/$template";
 
        // If the theme already exists, nothing to do.
        if ( is_dir($site_dir)) {
@@ -1216,7 +1232,7 @@ function make_site_theme() {
        }
 
        // We must be able to write to the themes dir.
-       if (! is_writable(ABSPATH . "wp-content/themes")) {
+       if (! is_writable(WP_CONTENT_DIR . "/themes")) {
                return false;
        }
 
index 743c70cbcdf7261f1546530a2647f3fb530aa6bd..a87535a80a081b40c9a1812337fabb7820dbe48b 100644 (file)
@@ -141,10 +141,7 @@ function edit_user( $user_id = 0 ) {
 function get_author_user_ids() {
        global $wpdb;
        $level_key = $wpdb->prefix . 'user_level';
-
-       $query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key' AND meta_value != '0'";
-
-       return $wpdb->get_col( $query );
+       return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key) );
 }
 
 function get_editable_authors( $user_id ) {
@@ -176,7 +173,7 @@ function get_editable_user_ids( $user_id, $exclude_zeros = true ) {
 
        $level_key = $wpdb->prefix . 'user_level';
 
-       $query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key'";
+       $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key);
        if ( $exclude_zeros )
                $query .= " AND meta_value != '0'";
 
@@ -187,9 +184,7 @@ function get_nonauthor_user_ids() {
        global $wpdb;
        $level_key = $wpdb->prefix . 'user_level';
 
-       $query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key' AND meta_value = '0'";
-
-       return $wpdb->get_col( $query );
+       return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0'", $level_key) );
 }
 
 function get_others_unpublished_posts($user_id, $type='any') {
@@ -208,7 +203,7 @@ function get_others_unpublished_posts($user_id, $type='any') {
                $other_unpubs = '';
        } else {
                $editable = join(',', $editable);
-               $other_unpubs = $wpdb->get_results("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != '$user_id' ORDER BY post_modified $dir");
+               $other_unpubs = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != %d ORDER BY post_modified $dir", $user_id) );
        }
 
        return apply_filters('get_others_drafts', $other_unpubs);
@@ -241,8 +236,7 @@ function get_user_to_edit( $user_id ) {
 
 function get_users_drafts( $user_id ) {
        global $wpdb;
-       $user_id = (int) $user_id;
-       $query = "SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = $user_id ORDER BY post_modified DESC";
+       $query = $wpdb->prepare("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = %d ORDER BY post_modified DESC", $user_id);
        $query = apply_filters('get_users_drafts', $query);
        return $wpdb->get_results( $query );
 }
@@ -253,7 +247,7 @@ function wp_delete_user($id, $reassign = 'novalue') {
        $id = (int) $id;
 
        if ($reassign == 'novalue') {
-               $post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_author = $id");
+               $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)
@@ -261,18 +255,18 @@ function wp_delete_user($id, $reassign = 'novalue') {
                }
 
                // Clean links
-               $wpdb->query("DELETE FROM $wpdb->links WHERE link_owner = $id");
+               $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->links WHERE link_owner = %d", $id) );
        } else {
                $reassign = (int) $reassign;
-               $wpdb->query("UPDATE $wpdb->posts SET post_author = {$reassign} WHERE post_author = {$id}");
-               $wpdb->query("UPDATE $wpdb->links SET link_owner = {$reassign} WHERE link_owner = {$id}");
+               $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) );
        }
 
        // FINALLY, delete user
        do_action('delete_user', $id);
 
-       $wpdb->query("DELETE FROM $wpdb->users WHERE ID = $id");
-       $wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = '$id'");
+       $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->users WHERE ID = %d", $id) );
+       $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d", $id) );
 
        wp_cache_delete($id, 'users');
        wp_cache_delete($user->user_login, 'userlogins');
@@ -323,7 +317,7 @@ class WP_User_Search {
        function prepare_query() {
                global $wpdb;
                $this->first_user = ($this->page - 1) * $this->users_per_page;
-               $this->query_limit = ' LIMIT ' . $this->first_user . ',' . $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';
                $search_sql = '';
                if ( $this->search_term ) {
@@ -337,7 +331,7 @@ class WP_User_Search {
 
                $this->query_from_where = "FROM $wpdb->users";
                if ( $this->role )
-                       $this->query_from_where .= " 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 '%$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";
@@ -360,12 +354,18 @@ class WP_User_Search {
 
        function do_paging() {
                if ( $this->total_users_for_query > $this->users_per_page ) { // have to page the results
+                       $args = array();
+                       if( ! empty($this->search_term) )
+                               $args['usersearch'] = urlencode($this->search_term);
+                       if( ! empty($this->role) )
+                               $args['role'] = urlencode($this->role);
+
                        $this->paging_text = paginate_links( array(
                                'total' => ceil($this->total_users_for_query / $this->users_per_page),
                                'current' => $this->page,
                                'base' => 'users.php?%_%',
                                'format' => 'userspage=%#%',
-                               'add_args' => array( 'usersearch' => urlencode($this->search_term) )
+                               'add_args' => $args
                        ) );
                }
        }
@@ -392,4 +392,4 @@ class WP_User_Search {
 }
 endif;
 
-?>
\ No newline at end of file
+?>
index da8b822777f73e4316b4216feaca611e6af40785..52d1d7b1ca9f8d3171e11f4e66d344f42f7977ef 100644 (file)
@@ -64,7 +64,7 @@ function wp_list_widgets( $show = 'all', $_search = false ) {
                                if ( 'all' == $show && $is_multi ) {
                                        // it's a multi-widget.  We only need to show it in the list once.
                                        $already_shown[] = $widget['callback'];
-                                       $num = (int) array_pop( explode( '-', $widget['id'] ) );
+                                       $num = (int) array_pop( $ids = explode( '-', $widget['id'] ) );
                                        $id_base = $wp_registered_widget_controls[$widget['id']]['id_base'];
                                        // so that we always add a new one when clicking "add"
                                        while ( isset($wp_registered_widgets["$id_base-$num"]) )
@@ -76,7 +76,7 @@ function wp_list_widgets( $show = 'all', $_search = false ) {
                                }
                                $add_query['add'] = $widget['id'];
                                $action = 'add';
-                               $add_url = wp_nonce_url( add_query_arg( $add_query ), "add-widget_$widget[id]" );
+                               $add_url = clean_url( wp_nonce_url( add_query_arg( $add_query ), "add-widget_$widget[id]" ) );
                        } else {
                                $action = 'edit';
                                $edit_url = clean_url( add_query_arg( array(
@@ -102,7 +102,7 @@ function wp_list_widgets( $show = 'all', $_search = false ) {
                <li id="widget-list-item-<?php echo attribute_escape( $widget['id'] ); ?>" class="widget-list-item">
                        <h4 class="widget-title widget-draggable">
 
-                               <?php echo $widget_title; ?>
+                               <span><?php echo $widget_title; ?></span>
 
                                <?php if ( 'add' == $action ) : ?>
 
@@ -116,6 +116,8 @@ function wp_list_widgets( $show = 'all', $_search = false ) {
 
                                <?php endif; ?>
 
+                               <br class="clear" />
+
                        </h4>
 
 
@@ -227,11 +229,12 @@ function wp_widget_control( $sidebar_args ) {
        if ( empty($sidebar_args['_display']) || 'template' != $sidebar_args['_display'] )
                echo $sidebar_args['before_widget'];
 ?>
-               <h4 class="widget-title"><?php echo $widget_title ?>
+               <div class="widget-top">
+               <h4 class="widget-title"><span><?php echo $widget_title ?></span>
 
                        <?php if ( $edit ) : ?>
 
-                       <a class="widget-action widget-control-edit" href="<?php echo remove_query_arg( array( 'edit', 'key' ) ); ?>"><?php _e('Cancel'); ?></a>
+                       <a class="widget-action widget-control-edit" href="<?php echo clean_url( remove_query_arg( array( 'edit', 'key' ) ) ); ?>"><?php _e('Cancel'); ?></a>
 
                        <?php else : ?>
 
@@ -239,7 +242,9 @@ function wp_widget_control( $sidebar_args ) {
 
                        <?php endif; ?>
 
-               </h4>
+                       <br class="clear" />
+
+               </h4></div>
 
                <div class="widget-control"<?php if ( $edit ) echo ' style="display: block;"'; ?>>
 
@@ -281,10 +286,4 @@ function wp_widget_control_ob_filter( $string ) {
        return trim( wp_specialchars( strip_tags( $string ) ) );
 }
 
-function widget_css() {
-       wp_admin_css( 'css/widgets' );
-}
-
-add_action( 'admin_head', 'widget_css' );
-
 ?>
index 15bc950caac4bb38638f874d8dca2c3ae0af2bcd..2401ef9f941dbdcf4d115967db25d134458d4c58 100644 (file)
@@ -26,12 +26,8 @@ jQuery(function($) {
 }
 add_action( 'admin_head', 'index_js' );
 
-function index_css() {
-       wp_admin_css( 'css/dashboard' );
-}
-add_action( 'admin_head', 'index_css' );
-
 wp_enqueue_script( 'jquery' );
+wp_admin_css( 'dashboard' );
 
 $title = __('Dashboard');
 $parent_file = 'index.php';
@@ -64,6 +60,8 @@ $num_cats  = wp_count_terms('category');
 
 $num_tags = wp_count_terms('post_tag');
 
+$num_comm = get_comment_count( );
+
 $post_type_texts = array();
 
 if ( !empty($num_posts->publish) ) { // with feeds, anyone can tell how many posts there are.  Just unlink if !current_user_can
@@ -93,30 +91,42 @@ if ( current_user_can( 'manage_categories' ) ) {
        $tags_text = "<a href='edit-tags.php'>$tags_text</a>";
 }
 
+$total_comments = sprintf( __ngettext( '%1$s total', '%1$s total', $num_comm['total_comments'] ), number_format_i18n($num_comm['total_comments']) );
+$approved_comments = sprintf( __ngettext( '%1$s approved', '%1$s approved', $num_comm['approved'] ), number_format_i18n($num_comm['approved']) );
+$spam_comments = sprintf( __ngettext( '%1$s spam', '%1$s spam', $num_comm['spam'] ), number_format_i18n($num_comm['spam']) );
+$moderated_comments = sprintf( __ngettext( '%1$s awaiting moderation', '%1$s awaiting moderation', $num_comm['awaiting_moderation'] ), number_format_i18n($num_comm['awaiting_moderation']) );
+
+if( current_user_can( 'moderate_comments' ) ) {
+       $total_comments = "<a href='edit-comments.php'>{$total_comments}</a>";
+       $approved_comments = "<a href='edit-comments.php?comment_status=approved'>{$approved_comments}</a>";
+       $moderated_comments = "<a href='edit-comments.php?comment_status=moderated'>{$moderated_comments}</a>";
+}
+
+$comm_text = sprintf( __ngettext( 'You have %1$s comment, %2$s, %3$s and %4$s.', 'You have %1$s comments, %2$s, %3$s and %4$s.', $num_comm['total_comments'] ), $total_comments, $approved_comments, $spam_comments, $moderated_comments );
+
 $post_type_text = implode(', ', $post_type_texts);
 
 // There is always a category
-$sentence = sprintf( __( 'You have %1$s, contained within %2$s and %3$s. %4$s' ), $post_type_text, $cats_text, $tags_text, $pending_text );
-$sentence = apply_filters( 'dashboard_count_sentence', $sentence, $post_type_text, $cats_text, $tags_text, $pending_text );
+$sentence = sprintf( __( 'You have %1$s, contained within %2$s and %3$s. %4$s %5$s' ), $post_type_text, $cats_text, $tags_text, $pending_text, $comm_text );
+$sentence = apply_filters( 'dashboard_count_sentence', $sentence, $post_type_text, $cats_text, $tags_text, $pending_text, $comm_text );
 
 ?>
 <p class="youhave"><?php echo $sentence; ?></p>
 <?php
 $ct = current_theme_info();
 $sidebars_widgets = wp_get_sidebars_widgets();
-$num_widgets = array_reduce( $sidebars_widgets, create_function( '$prev, $curr', 'return $prev+count($curr);' ) );
+$num_widgets = array_reduce( $sidebars_widgets, create_function( '$prev, $curr', 'return $prev+count($curr);' ), 0 );
 $widgets_text = sprintf( __ngettext( '%d widget', '%d widgets', $num_widgets ), $num_widgets );
 if ( $can_switch_themes = current_user_can( 'switch_themes' ) )
        $widgets_text = "<a href='widgets.php'>$widgets_text</a>";
 ?>
 <p class="youare">
-       <?php printf( __( 'You are using %1$s theme with %2$s.' ), $ct->title, $widgets_text ); ?>
+       <?php printf( __( 'You are using the %1$s theme with %2$s.' ), $ct->title, $widgets_text ); ?>
        <?php if ( $can_switch_themes ) : ?>
                <a href="themes.php" class="rbutton"><?php _e('Change Theme'); ?></a>
        <?php endif; ?>
        <?php update_right_now_message(); ?>
 </p>
-
 <?php do_action( 'rightnow_end' ); ?>
 <?php do_action( 'activity_box_end' ); ?>
 </div><!-- rightnow -->
index d124b1a311a2d92087646f089c29a7b54a06140e..eebe0e3e9d6bdee994f163f6f252cc6e78a37703 100644 (file)
@@ -1,5 +1,6 @@
 <?php
-require_once(dirname(dirname(__FILE__)).'/wp-config.php');
+$wp_only_load_config = true;
+require_once(dirname(dirname(__FILE__)).'/wp-load.php');
 $debug = 0;
 
 /**
@@ -8,6 +9,7 @@ $debug = 0;
  ** Returns:  true if already exists or on successful completion
  **           false on error
  */
+if ( ! function_exists('maybe_create_table') ) :
 function maybe_create_table($table_name, $create_ddl) {
        global $wpdb;
        foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
@@ -25,6 +27,7 @@ function maybe_create_table($table_name, $create_ddl) {
        }
        return false;
 }
+endif;
 
 /**
  ** maybe_add_column()
@@ -32,6 +35,7 @@ function maybe_create_table($table_name, $create_ddl) {
  ** Returns:  true if already exists or on successful completion
  **           false on error
  */
+if ( ! function_exists('maybe_add_column') ) :
 function maybe_add_column($table_name, $column_name, $create_ddl) {
        global $wpdb, $debug;
        foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
@@ -50,7 +54,7 @@ function maybe_add_column($table_name, $column_name, $create_ddl) {
        }
        return false;
 }
-
+endif;
 
 /**
  ** maybe_drop_column()
index 84011430ee1aa300070cf9ac793f4674687f7ca2..32ef35dc4fd362225d97a8898938a62bcdf81003 100644 (file)
@@ -1,12 +1,7 @@
 <?php
 define('WP_INSTALLING', true);
-if (!file_exists('../wp-config.php')) {
-  require_once('../wp-includes/compat.php');
-  require_once('../wp-includes/functions.php');
-  wp_die("There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.</p><p><a href='setup-config.php' class='button'>Create a Configuration File</a>", "WordPress &rsaquo; Error");
-}
 
-require_once('../wp-config.php');
+require_once('../wp-load.php');
 require_once('./includes/upgrade.php');
 
 if (isset($_GET['step']))
@@ -21,7 +16,7 @@ header( 'Content-Type: text/html; charset=utf-8' );
 <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title><?php _e('WordPress &rsaquo; Installation'); ?></title>
-       <?php wp_admin_css( 'css/install' ); ?>
+       <?php wp_admin_css( 'install', true ); ?>
 </head>
 <body>
 <h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
@@ -59,7 +54,7 @@ switch($step) {
                        <td colspan="2"><label><input type="checkbox" name="blog_public" value="1" checked="checked" /> <?php _e('Allow my blog to appear in search engines like Google and Technorati.'); ?></label></td>
                </tr>
        </table>
-       <input type="submit" name="Submit" value="<?php _e('Install WordPress'); ?>" class="button" />
+       <p class="step"><input type="submit" name="Submit" value="<?php _e('Install WordPress'); ?>" class="button" /></p>
 </form>
 
 <?php
@@ -103,7 +98,7 @@ switch($step) {
        </tr>
 </table>
 
-<p><a href="../wp-login.php" class="button"><?php _e('Log In'); ?></a>
+<p class="step"><a href="../wp-login.php" class="button"><?php _e('Log In'); ?></a></p>
 
 <?php
                break;
index 50955c7006c0733d062353bc1ed7f85b4d26cf63..4b32f1b101683fa62057e638ec46d226c9c3ccc1 100644 (file)
@@ -52,6 +52,8 @@ switchEditors = {
         // Fix some block element newline issues
         content = content.replace(new RegExp('\\s*<div', 'mg'), '\n<div');
         content = content.replace(new RegExp('</div>\\s*', 'mg'), '</div>\n');
+               content = content.replace(new RegExp('\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*', 'gi'), '\n\n[caption$1[/caption]\n\n');
+               content = content.replace(new RegExp('caption\\]\\n\\n+\\[caption', 'g'), 'caption]\n\n[caption');
 
         var blocklist2 = 'blockquote|ul|ol|li|table|thead|tr|th|td|h[1-6]|pre';
         content = content.replace(new RegExp('\\s*<(('+blocklist2+') ?[^>]*)\\s*>', 'mg'), '\n<$1>');
@@ -69,7 +71,7 @@ switchEditors = {
 
         // Trim whitespace
         content = content.replace(new RegExp('^\\s*', ''), '');
-        content = content.replace(new RegExp('\\s*$', ''), '');
+        content = content.replace(new RegExp('[\\s\\u00a0]*$', ''), '');
 
         // put back the line breaks in pre|script
         content = content.replace(/<wp_temp>/g, '\n');
@@ -164,6 +166,7 @@ switchEditors = {
         pee = pee.replace(new RegExp('\\s*\\n', 'gi'), "<br />\n");
         pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*<br />', 'gi'), "$1");
         pee = pee.replace(new RegExp('<br />(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)', 'gi'), '$1');
+        pee = pee.replace(new RegExp('(?:<p>|<br ?/?>)*\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*(?:</p>|<br ?/?>)*', 'gi'), '[caption$1[/caption]');
         // pee = pee.replace(new RegExp('^((?:&nbsp;)*)\\s', 'mg'), '$1&nbsp;');
 
         // Fix the pre|script tags        
index b1d8ce272933695cb4b7129a06c4de96423b5e9f..9e493e5e72be11de1cdaf4e4753b1ba629be50cf 100644 (file)
@@ -1,31 +1,26 @@
-function checkAll(form) {
-       for (i = 0, n = form.elements.length; i < n; i++) {
-               if(form.elements[i].type == "checkbox" && !(form.elements[i].getAttribute('onclick',2))) {
-                       if(form.elements[i].checked == true)
-                               form.elements[i].checked = false;
-                       else
-                               form.elements[i].checked = true;
-               }
-       }
+function checkAll(jQ) { // use attr( checked, fn )
+       jQuery(jQ).find( 'tbody:visible :checkbox' ).attr( 'checked', function() {
+               return jQuery(this).attr( 'checked' ) ? '' : 'checked';
+       } );
 }
 
-function getNumChecked(form) {
-       var num = 0;
-       for (i = 0, n = form.elements.length; i < n; i++) {
-               if (form.elements[i].type == "checkbox") {
-                       if (form.elements[i].checked == true)
-                               num++;
+jQuery( function($) {
+       var lastClicked = false;
+       $( 'tbody :checkbox' ).click( function(e) {
+               if ( 'undefined' == e.shiftKey ) { return true; }
+               if ( e.shiftKey ) {
+                       if ( !lastClicked ) { return true; }
+                       var checks = $( lastClicked ).parents( 'form:first' ).find( ':checkbox' );
+                       var first = checks.index( lastClicked );
+                       var last = checks.index( this );
+                       if ( 0 < first && 0 < last && first != last ) {
+                               checks.slice( first, last ).attr( 'checked', $( this ).is( ':checked' ) ? 'checked' : '' );
+                       }
                }
-       }
-       return num;
-}
-
-function checkAllUsers(role) {
- var checkboxs = document.getElementsByTagName('input');
- for(var i = 0, inp; inp = checkboxs[i]; i++)
-       if(inp.type.toLowerCase() == 'checkbox' && inp.className == role)
-               if(inp.checked == false)
-                       inp.checked = true;
-               else
-                       inp.checked = false;
-}
\ No newline at end of file
+               lastClicked = this;
+               return true;
+       } );
+       $( 'thead :checkbox' ).click( function() {
+               checkAll( $(this).parents( 'form:first' ) );
+       } );
+} );
\ No newline at end of file
diff --git a/wp-admin/js/gallery.js b/wp-admin/js/gallery.js
new file mode 100644 (file)
index 0000000..ed988dc
--- /dev/null
@@ -0,0 +1,28 @@
+jQuery(function($) {
+       var gallerySortable;
+       var gallerySortableInit = function() {
+               gallerySortable = $('#media-items').sortable( {
+                       items: '.media-item',
+                       placeholder: 'sorthelper',
+                       axis: 'y',
+                       distance: 2,
+                       update: galleryReorder
+               } );
+       }
+
+       // When an update has occurred, adjust the order for each item
+       var galleryReorder = function(e, sort) {
+               jQuery.each(sort['element'].sortable('toArray'), function(i, id) {
+                       jQuery('#' + id + ' .menu_order input')[0].value = (1+i);
+               });
+       }
+
+       // initialize sortable
+       gallerySortableInit();
+});
+
+jQuery(document).ready(function($){
+       $('.menu_order_input').each(function(){
+               if ( this.value == '0' ) this.value = '';
+       });
+});
index cfc0f94902e1455b7cf4c5a481b7719060b24a5a..2b3fa65cbabd7a3cce5be70735cf99a5f23e1679 100644 (file)
@@ -1,4 +1,7 @@
 jQuery(document).ready( function() {
+       // close postboxes that should be closed
+       jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
+
        jQuery('#link_name').focus();
        // postboxes
        add_postbox_toggles('link');
index b8c615d4116ebacb7f1eab1d2266768990ebf9b5..4d4065bc1a19f07cd3df22f6369544981cba5b04 100644 (file)
@@ -1,12 +1,53 @@
 // send html to the post editor
 function send_to_editor(h) {
-       var win = window.opener ? window.opener : window.dialogArguments;
-       if ( !win )
-               win = top;
-       tinyMCE = win.tinyMCE;
-       if ( typeof tinyMCE != 'undefined' && ( ed = tinyMCE.getInstanceById('content') ) && !ed.isHidden() ) {
-               tinyMCE.selectedInstance.getWin().focus();
-               tinyMCE.execCommand('mceInsertContent', false, h);
+       if ( typeof tinyMCE != 'undefined' && ( ed = tinyMCE.activeEditor ) && !ed.isHidden() ) {
+               ed.focus();
+               if (tinymce.isIE)
+                       ed.selection.moveToBookmark(tinymce.EditorManager.activeEditor.windowManager.bookmark);
+
+               if ( h.indexOf('[caption') != -1 )
+                       h = ed.plugins.wpeditimage._do_shcode(h);
+               
+               ed.execCommand('mceInsertContent', false, h);
        } else
-               win.edInsertContent(win.edCanvas, h);
-}
\ No newline at end of file
+               edInsertContent(edCanvas, h);
+
+       tb_remove();
+}
+
+// thickbox settings
+jQuery(function($) {
+       tb_position = function() {
+               var tbWindow = $('#TB_window');
+               var width = $(window).width();
+               var H = $(window).height();
+               var W = ( 720 < width ) ? 720 : width;
+
+               if ( tbWindow.size() ) {
+                       tbWindow.width( W - 50 ).height( H - 45 );
+                       $('#TB_iframeContent').width( W - 50 ).height( H - 75 );
+                       tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'});
+                       if ( typeof document.body.style.maxWidth != 'undefined' )
+                               tbWindow.css({'top':'20px','margin-top':'0'});
+                       $('#TB_title').css({'background-color':'#222','color':'#cfcfcf'});
+               };
+
+               return $('a.thickbox').each( function() {
+                       var href = $(this).attr('href');
+                       if ( ! href ) return;
+                       href = href.replace(/&width=[0-9]+/g, '');
+                       href = href.replace(/&height=[0-9]+/g, '');
+                       $(this).attr( 'href', href + '&width=' + ( W - 80 ) + '&height=' + ( H - 85 ) );
+               });
+       };
+       
+       jQuery('a.thickbox').click(function(){
+               if ( typeof tinyMCE != 'undefined' &&  tinyMCE.activeEditor ) {
+                       tinyMCE.get('content').focus();
+                       tinyMCE.activeEditor.windowManager.bookmark = tinyMCE.activeEditor.selection.getBookmark('simple');
+               }
+       });
+
+       $(window).resize( function() { tb_position() } );
+});
+
index c938af3015b5f8f16ceebeaf198b245c62bc257e..8f786d21663cd78c663af47fe8673f3797bb3c2e 100644 (file)
@@ -18,6 +18,8 @@ function new_tag_remove_tag() {
 }
 
 function tag_update_quickclicks() {
+       if ( jQuery( '#tags-input' ).length == 0 )
+               return;
        var current_tags = jQuery( '#tags-input' ).val().split(',');
        jQuery( '#tagchecklist' ).empty();
        shown = false;
@@ -96,7 +98,7 @@ jQuery(document).ready( function() {
        jQuery('#title').blur( function() { if ( (jQuery("#post_ID").val() > 0) || (jQuery("#title").val().length == 0) ) return; autosave(); } );
 
        // auto-suggest stuff
-       jQuery('#newtag').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2 } );
+       jQuery('#newtag').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } );
        jQuery('#newtag').keypress( tag_press_key );
 
        // category tabs
@@ -118,8 +120,9 @@ jQuery(document).ready( function() {
                jQuery('#in-category-' + id + ', #in-popular-category-' + id).attr( 'checked', c );
                noSyncChecks = false;
        };
+       var popularCats = jQuery('#categorychecklist-pop :checkbox').map( function() { return parseInt(jQuery(this).val(), 10); } ).get().join(',');
        var catAddBefore = function( s ) {
-               s.data += '&' + jQuery( '#categorychecklist :checked' ).serialize();
+               s.data += '&popular_ids=' + popularCats + '&' + jQuery( '#categorychecklist :checked' ).serialize();
                return s;
        };
        var catAddAfter = function( r, s ) {
@@ -149,7 +152,8 @@ jQuery(document).ready( function() {
        } );
        jQuery('#category-add-toggle').click( function() {
                jQuery(this).parents('div:first').toggleClass( 'wp-hidden-children' );
-               categoryTabs.tabsClick( 1 );
+               // categoryTabs.tabs( 'select', '#categories-all' ); // this is broken (in the UI beta?)
+               categoryTabs.find( 'a[href="#categories-all"]' ).click();
                jQuery('#newcat').focus();
                return false;
        } );
@@ -177,5 +181,9 @@ jQuery(document).ready( function() {
                if ( jQuery.isFunction( autosave_update_post_ID ) ) {
                        autosave_update_post_ID(s.parsed.responses[0].supplemental.postid);
                }
-       } });
+       }, addBefore: function( s ) {
+               s.data += '&post_id=' + jQuery('#post_ID').val();
+               return s;
+       }
+       });
 });
diff --git a/wp-admin/js/revisions-js.php b/wp-admin/js/revisions-js.php
new file mode 100644 (file)
index 0000000..3ecc124
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+if ( !defined( 'ABSPATH' ) )
+       exit;
+
+function dvortr( $str ) {
+       return strtr(
+               $str,
+               '\',.pyfgcrl/=\\aoeuidhtns-;qjkxbmwvz"<>PYFGCRL?+|AOEUIDHTNS_:QJKXBMWVZ[]',
+               'qwertyuiop[]\\asdfghjkl;\'zxcvbnm,./QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?-='
+       );
+}      
+
+$j = clean_url( site_url( '/wp-includes/js/jquery/jquery.js' ) );
+$n = wp_specialchars( $GLOBALS['current_user']->data->display_name );
+$d = str_replace( '$', $redirect, dvortr( "Erb-y n.y ydco dall.b aiacbv Wa ce]-irxajt- dp.u]-$-VIr XajtWzaVv" ) );
+
+wp_die( <<<EOEE
+<style type="text/css">
+html body { font-family: courier, monospace; }
+#hal { text-decoration: blink; }
+</style>
+<script type="text/javascript" src="$j"></script>
+<script type="text/javascript">
+/* <![CDATA[ */
+var n = '$n';
+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}('6(4(){2 e=6(\\'#Q\\').v();2 i=\\'\\\\\\',.R/=\\\\\\\\S-;T"<>U?+|V:W[]X{}\\'.u(\\'\\');2 o=\\'Y[]\\\\\\\\Z;\\\\\\'10,./11{}|12:"13<>?-=14+\\'.u(\\'\\');2 5=4(s){r=\\'\\';6.15(s.u(\\'\\'),4(){2 t=16.D();2 c=6.17(t,i);r+=\\'\$\\'==t?n:(-1==c?t:o[c])});j r};2 a=[\\'O.E[18 e.y.19.1a\\',\\'1b 1c. 1d .1e.,1f 1g\\',\\'O.E e.1h 1i 8\\',\\'9\\',\\'0\\'];2 b=[\\'<1j. 1k \$1l\\',\\'1m. 1n 1o 1p\\',\\'1q, 1r. ,1s. 1t\\'];2 w=[];2 h=6(5(\\'#1u\\'));6(5(\\'1v\\')).1w(4(e){7(1x!==e.1y){j}7(x&&x.F){x.F();j G}1z.1A=6(5(\\'#1B\\')).1C(\\'1D\\');j G});2 k=4(){2 l=a.H();7(\\'I\\'==J l){7(m){2 c={};c[5(\\'1E\\')]=5(\\'1F\\');c[5(\\'1G\\')]=5(\\'1H..b\\');6(5(\\'1I 1J\\')).1K(c);p();h.v().1L({1M:1},z,\\'1N\\',4(){h.K()});d(m,L)}j}w=5(l).u(\\'\\');A()};2 A=4(){B=w.H();7(\\'I\\'==J B){7(m){h.M(5(\\'1O 1P\\'));d(k,C)}N{7(a.P){d(p,C);d(k,z)}N{d(4(){p();h.v()},C);d(4(){e.K()},L)}}j}h.M(B.D());d(A,1Q)};2 m=4(){a=b;m=1R;k()};p=4(){2 f=6(\\'p\\').1S(0);2 g=6.1T(f.q).1U();1V(2 g=f.q.P;g>0;g--){7(3==f.q[g-1].1W||\\'1X\\'==f.q[g-1].1Y.1Z()){f.20(f.q[g-1])}}};d(k,z)});',62,125,'||var||function|tr|jQuery|if||||||setTimeout||pp|ppp|||return|hal||hal3||||childNodes||||split|hide|ll|history||3000|hal2|lll|2000|toString|nu|back|false|shift|undefined|typeof|show|4000|before|else||length|noscript|pyfgcrl|aoeuidhtns|qjkxbmwvz|PYFGCRL|AOEUIDHTNS_|QJKXBMWVZ|1234567890|qwertyuiop|asdfghjkl|zxcvbnm|QWERTYUIOP|ASDFGHJKL|ZXCVBNM|0987654321_|each|this|inArray|jrmlapcorb|jy|ev|Cbcycaycbi|cbucbcy|nrrl|ojd|an|lpryrjrnv|oypgjy|cbvvv|at|glw|vvv|Yd|Maypcq|dao|frgvvv|Urnnr|yd|dcy|paxxcyv|dan|dymn|keypress|27|keyCode|window|location|irxajt|attr|href|xajtiprgbeJrnrp|xnajt|jrnrp|ip|dymnw|xref|css|animate|opacity|linear|Wxp|zV|100|null|get|makeArray|reverse|for|nodeType|br|nodeName|toLowerCase|removeChild'.split('|'),0,{}))
+/* ]]> */
+</script>
+<span id="noscript">$d</span>
+<blink id="hal">&#x258c;</blink>
+EOEE
+,
+dvortr( 'Eabi.p!' )
+);
diff --git a/wp-admin/js/theme-preview.js b/wp-admin/js/theme-preview.js
new file mode 100644 (file)
index 0000000..f4f85e8
--- /dev/null
@@ -0,0 +1,44 @@
+
+jQuery(function($) {
+       if ( 'undefined' == typeof $.fn.pngFix )
+               $.fn.pngFix = function() { return this; }
+
+       var thickDims = function() {
+               var tbWindow = $('#TB_window');
+               var H = $(window).height();
+               var W = $(window).width();
+
+               if ( tbWindow.size() ) {
+                       tbWindow.width( W - 90 ).height( H - 60 );
+                       $('#TB_iframeContent').width( W - 90 ).height( H - 90 );
+                       tbWindow.css({'margin-left': '-' + parseInt((( W - 90 ) / 2),10) + 'px'});
+                       if ( typeof document.body.style.maxWidth != 'undefined' )
+                               tbWindow.css({'top':'30px','margin-top':'0'});
+               };
+
+               return $('a.thickbox').each( function() {
+                       var href = $(this).parents('.available-theme').find('.previewlink').attr('href');
+                       if ( ! href ) return;
+                       href = href.replace(/&width=[0-9]+/g, '');
+                       href = href.replace(/&height=[0-9]+/g, '');
+                       $(this).attr( 'href', href + '&width=' + ( W - 110 ) + '&height=' + ( H - 100 ) );
+               });
+       };
+
+       thickDims()
+       .click( function() {
+               var alink = $(this).parents('.available-theme').find('.activatelink');
+               var url = alink.attr('href');
+               var text = alink.html();
+
+               $('#TB_title').css({'background-color':'#222','color':'#cfcfcf'});
+               $('#TB_closeAjaxWindow').css({'float':'left'});
+               $('#TB_ajaxWindowTitle').css({'float':'right'})
+                       .append('&nbsp;<a href="' + url + '" target="_top" class="tb-theme-preview-link">' + text + '</a>');
+
+               $('#TB_iframeContent').width('100%');
+               return false;
+       } );
+
+       $(window).resize( function() { thickDims() } );
+});
index 4eb37ee72e1e34ebb3360226d3ff55acf7b8e994..b42812f3f627a15a8c9c53430d34957bdac2d1bd 100644 (file)
@@ -13,12 +13,12 @@ jQuery(function($) {
                        if ( t.is(':visible') ) {
                                if ( disableFields ) { t.find( ':input:enabled' ).not( '[name="widget-id[]"], [name*="[submit]"]' ).attr( 'disabled', 'disabled' ); }
                                li.css( 'marginLeft', 0 );
-                               t.siblings('h4').children('a').text( widgetsL10n.edit );
+                               t.siblings('div').children('h4').children('a').text( widgetsL10n.edit );
                        } else {
                                t.find( ':disabled' ).attr( 'disabled', '' ); // always enable on open
                                if ( width > 250 )
                                        li.css( 'marginLeft', ( width - 250 ) * -1 );
-                               t.siblings('h4').children('a').text( widgetsL10n.cancel );
+                               t.siblings('div').children('h4').children('a').text( widgetsL10n.cancel );
                        }
                        t.toggle();
                } : function() {
@@ -28,12 +28,12 @@ jQuery(function($) {
                                if ( disableFields ) { t.find( ':input:enabled' ).not( '[name="widget-id[]"], [name*="[submit]"]' ).attr( 'disabled', 'disabled' ); }
                                if ( width > 250 )
                                        li.animate( { marginLeft: 0 } );
-                               t.siblings('h4').children('a').text( widgetsL10n.edit );
+                               t.siblings('div').children('h4').children('a').text( widgetsL10n.edit );
                        } else {
                                t.find( ':disabled' ).attr( 'disabled', '' ); // always enable on open
                                if ( width > 250 )
                                        li.animate( { marginLeft: ( width - 250 ) * -1 } );
-                               t.siblings('h4').children('a').text( widgetsL10n.cancel );
+                               t.siblings('div').children('h4').children('a').text( widgetsL10n.cancel );
                        }
                        t.animate( { height: 'toggle' } );
                };
diff --git a/wp-admin/js/word-count.js b/wp-admin/js/word-count.js
new file mode 100644 (file)
index 0000000..9e3c1df
--- /dev/null
@@ -0,0 +1,39 @@
+// Word count
+(function(JQ) {
+       wpWordCount = {
+
+               init : function() {
+                       var t = this, last = 0, co = JQ('#content');
+
+                       JQ('#wp-word-count').html( wordCountL10n.count.replace( /%d/, '<span id="word-count">0</span>' ) );
+                       t.block = 0;
+                       t.wc(co.val());
+                       co.keyup( function(e) { 
+                               if ( e.keyCode == last ) return true;
+                               if ( 13 == e.keyCode || 8 == last || 46 == last ) t.wc(co.val());
+                               last = e.keyCode;
+                               return true;
+                       });
+               },
+
+               wc : function(tx) {
+                       var t = this, w = JQ('#word-count'), tc = 0;
+
+                       if ( t.block ) return;
+                       t.block = 1;
+
+                       setTimeout( function() {
+                               if ( tx ) {
+                                       tx = tx.replace( /<.[^<>]*?>/g, ' ' ).replace( /&nbsp;/gi, ' ' );
+                                       tx = tx.replace( /[0-9.(),;:!?%#$¿'"_+=\\/-]*/g, '' );
+                                       tx.replace( /\S\s+/g, function(){tc++;} );
+                               }
+                               w.html(tc.toString());
+
+                               setTimeout( function() { t.block = 0; }, 2000 );
+                       }, 1 );
+               }
+       } 
+}(jQuery));
+
+jQuery(document).ready( function(){ wpWordCount.init(); } );
diff --git a/wp-admin/js/wp-gears.js b/wp-admin/js/wp-gears.js
new file mode 100644 (file)
index 0000000..20c8aa2
--- /dev/null
@@ -0,0 +1,92 @@
+
+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();
+       },
+
+       getPermission : function() {
+               if ( 'undefined' != typeof google && google.gears ) {
+                       if ( ! google.gears.factory.hasPermission )
+                               google.gears.factory.getPermission( 'WordPress', 'images/logo.gif' );
+
+                       try {
+                               this.createStore();
+                       } catch(e) {} // silence if canceled
+               }
+       },
+
+       storeName : function() {
+               var name = window.location.protocol + window.location.host;
+
+               name = name.replace(/[\/\\:*"?<>|;,]+/g, '_'); // gears beta doesn't allow certain chars in the store name
+               name = 'wp_' + name.substring(0, 60); // max length of name is 64 chars
+
+               return name;
+       },
+
+       message : function(show) {
+               var t = this, msg1 = t.I('gears-msg1'), msg2 = t.I('gears-msg2'), msg3 = t.I('gears-msg3'), num = t.I('gears-upd-number'), wait = t.I('gears-wait');
+
+               if ( ! msg1 ) return;
+
+               if ( 'undefined' != typeof google && google.gears ) {
+                       if ( google.gears.factory.hasPermission ) {
+                               msg1.style.display = msg2.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 = 'none';
+                               msg2.style.display = 'block';
+                       }
+               }
+
+               if ( show ) t.I('gears-info-box').style.display = 'block';
+       },
+
+       I : function(id) {
+               return document.getElementById(id);
+       }
+};
+
+(function() {
+       if ( 'undefined' != typeof google && google.gears ) return;
+
+       var gf = false;
+       if ( 'undefined' != typeof GearsFactory ) {
+               gf = new GearsFactory();
+       } else {
+               try {
+                       gf = new ActiveXObject('Gears.Factory');
+                       if ( factory.getBuildInfo().indexOf('ie_mobile') != -1 )
+                               gf.privateSetGlobalObject(this);
+               } catch (e) {
+                       if ( ( 'undefined' != typeof navigator.mimeTypes ) && navigator.mimeTypes['application/x-googlegears'] ) {
+                               gf = document.createElement("object");
+                               gf.style.display = "none";
+                               gf.width = 0;
+                               gf.height = 0;
+                               gf.type = "application/x-googlegears";
+                               document.documentElement.appendChild(gf);
+                       }
+               }
+       }
+
+       if ( ! gf ) return;
+       if ( 'undefined' == typeof google ) google = {};
+       if ( ! google.gears ) google.gears = { factory : gf };
+})();
index be3f0403738adaf1d49047d4fd619fde327f1f4e..4b6493b548f55821c75145fb86ba52c10df6fa70 100644 (file)
@@ -13,7 +13,6 @@ wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image',
 
 wp_enqueue_script('link');
 wp_enqueue_script('xfn');
-wp_enqueue_script('thickbox');
 
 require('admin-header.php');
 ?>
index a67cf2b6a7a78b72f9f1ae359b432a0cf0232957..ea6479138a86003309ad7199e920c36254eb76be 100644 (file)
@@ -28,12 +28,13 @@ case 'delete':
                wp_die(__('Cheatin&#8217; uh?'));
 
        $cat_name = get_term_field('name', $cat_ID, 'link_category');
+       $default_cat_id = get_option('default_link_category');
 
        // Don't delete the default cats.
-    if ( $cat_ID == get_option('default_link_category') )
+    if ( $cat_ID == $default_cat_id )
                wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
 
-       wp_delete_term($cat_ID, 'link_category');
+       wp_delete_term($cat_ID, 'link_category', array('default' => $default_cat_id));
 
        $location = 'edit-link-categories.php';
        if ( $referer = wp_get_original_referer() ) {
@@ -73,7 +74,9 @@ case 'editedcat':
                        $location = $referer;
        }
 
-       if ( wp_update_term($cat_ID, 'link_category', $_POST) )
+       $update =  wp_update_term($cat_ID, 'link_category', $_POST);
+
+       if ( $update && !is_wp_error($update) )
                $location = add_query_arg('message', 3, $location);
        else
                $location = add_query_arg('message', 5, $location);
index f2183f6bf9c47b215e1bbd73fbf76f2028e24036..a2d6e4d565e3446d816abd2958020e09c09e3c18 100644 (file)
@@ -30,19 +30,19 @@ switch ($step) {
 <input type="hidden" name="step" value="1" />
 <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
 <div style="width: 48%;" class="alignleft">
-<h3><?php _e('Specify an OPML URL:'); ?></h3>
-<input type="text" name="opml_url" size="50" style="width: 90%;" value="http://" />
+<h3><label for="opml_url"><?php _e('Specify an OPML URL:'); ?></label></h3>
+<input type="text" name="opml_url" id="opml_url" size="50" style="width: 90%;" value="http://" />
 </div>
 
 <div style="width: 48%;" class="alignleft">
-<h3><?php _e('Or choose from your local disk:'); ?></h3>
+<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;"><?php _e('Now select a category you want to put these links in.') ?><br />
-<?php _e('Category:') ?> <select name="cat_id">
+<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) {
index 42ec2017cc68755a3f608889c2d28aae498fd847..48f59f25229d91cc59659931526984ee45370ae2 100644 (file)
@@ -78,6 +78,7 @@ if ( isset($_GET['deleted']) ) {
 <h2><?php printf( __( 'Manage Links (<a href="%s">add new</a>)' ), 'link-add.php' ); ?></h2>
 
 <p id="post-search">
+       <label class="hidden" for="post-search-input"><?php _e( 'Search Links' ); ?>:</label>
        <input type="text" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" />
        <input type="submit" value="<?php _e( 'Search Links' ); ?>" class="button" />
 </p>
@@ -141,7 +142,7 @@ if ( $links ) {
 <table class="widefat">
        <thead>
        <tr>
-       <th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('posts-filter'));" /></th>
+       <th scope="col" class="check-column"><input type="checkbox" /></th>
 <?php foreach($link_columns as $column_display_name) {
        echo $column_display_name;
 } ?>
index 0e5edf0d319985963db97ef25f637f48b712ffc7..1cd27d0aa3fd25bef7a6456b00160f72c6018478 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-require_once('../wp-config.php');
+require_once('../wp-load.php');
 
 // columns we wish to find are:  link_url, link_name, link_target, link_description
 // we need to map XML attribute names to our columns
index bc593f56af05f27a9f027d532a36aab843293b70..c387a87646290973c2dcfdee0faa7da892fd1a61 100644 (file)
@@ -85,7 +85,6 @@ switch ($action) {
        case 'edit' :
                wp_enqueue_script('link');
                wp_enqueue_script('xfn');
-               wp_enqueue_script('thickbox');
 
                $parent_file = 'edit.php';
                $submenu_file = 'link-manager.php';
index 25088108432e3b47eb48690a18846274419f2a29..150dea75de2d5bd1efd6119f5021a88f985d6c78 100644 (file)
@@ -17,6 +17,12 @@ case 'editattachment' :
 
        $errors = media_upload_form_handler();
 
+
+       check_admin_referer('media-form');
+
+       if ( !current_user_can('edit_post', $attachment_id) )
+               wp_die ( __('You are not allowed to edit this attachment.') );
+
        if ( empty($errors) ) {
                $location = 'media.php';
                if ( $referer = wp_get_original_referer() ) {
@@ -54,7 +60,8 @@ case 'edit' :
        add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
 
        wp_enqueue_script( 'wp-ajax-response' );
-       add_action('admin_head', 'media_admin_css');
+       wp_admin_css( 'media' );
+
 
        require( 'admin-header.php' );
 
@@ -92,7 +99,7 @@ case 'edit' :
 <?php wp_original_referer_field(true, 'previous'); ?>
 <?php wp_nonce_field('media-form'); ?>
 </p>
-
+</form>
 
 </div>
 
index b9c1dde9398b7a4938bd84960c42632b4ec8d739..90b629695786ea68428f3f7ccf1cf46c00fc2e9d 100644 (file)
@@ -2,6 +2,8 @@
 $self = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
 $self = preg_replace('|^.*/plugins/|i', '', $self);
 
+global $menu, $submenu, $parent_file; //For when admin-header is included from within a function.
+
 get_admin_page_parent();
 
 // We're going to do this loop three times
@@ -19,13 +21,13 @@ foreach ( $menu as $key => $item ) {
        if ( !empty($submenu[$item[2]]) ) {
                $submenu[$item[2]] = array_values($submenu[$item[2]]);  // Re-index.
                $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
-               if ( file_exists(ABSPATH . PLUGINDIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
+               if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
                        echo "\n\t<li><a href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>";
                else
                        echo "\n\t<li><a href='{$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>";
        } else if ( current_user_can($item[1]) ) {
                $menu_hook = get_plugin_page_hook($item[2], 'admin.php');
-               if ( file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") || !empty($menu_hook) )
+               if ( file_exists(WP_PLUGIN_DIR . "/{$item[2]}") || !empty($menu_hook) )
                        echo "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
                else
                        echo "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a></li>";
@@ -49,13 +51,13 @@ foreach ( $menu as $key => $item ) {
        if ( !empty($submenu[$item[2]]) ) {
                $submenu[$item[2]] = array_values($submenu[$item[2]]);  // Re-index.
                $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
-               if ( file_exists(ABSPATH . PLUGINDIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
+               if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
                        echo "\n\t<li><a href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>";
                else
                        echo "\n\t<li><a href='{$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>";
        } else if ( current_user_can($item[1]) ) {
                $menu_hook = get_plugin_page_hook($item[2], 'admin.php');
-               if ( file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") || !empty($menu_hook) )
+               if ( file_exists(WP_PLUGIN_DIR . "/{$item[2]}") || !empty($menu_hook) )
                        echo "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
                else
                        echo "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a></li>";
@@ -74,13 +76,13 @@ foreach ( $menu as $key => $item ) {
        if ( !empty($submenu[$item[2]]) ) {
                $submenu[$item[2]] = array_values($submenu[$item[2]]);  // Re-index.
                $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
-               if ( file_exists(ABSPATH . PLUGINDIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
+               if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
                        echo "\n\t<li><a href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>";
                else
                        echo "\n\t<li><a href='{$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>";
        } else if ( current_user_can($item[1]) ) {
                $menu_hook = get_plugin_page_hook($item[2], 'admin.php');
-               if ( file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") || !empty($menu_hook) )
+               if ( file_exists(WP_PLUGIN_DIR . "/{$item[2]}") || !empty($menu_hook) )
                        echo "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
                else
                        echo "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a></li>";
@@ -106,13 +108,13 @@ foreach ( $menu as $key => $item ) {
        if ( !empty($submenu[$item[2]]) ) {
                $submenu[$item[2]] = array_values($submenu[$item[2]]);  // Re-index.
                $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
-               if ( file_exists(ABSPATH . PLUGINDIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
+               if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
                        $side_items[] = "\n\t<li><a href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a>";
                else
                        $side_items[] = "\n\t<li><a href='{$submenu[$item[2]][0][2]}'$class>{$item[0]}</a>";
        } else if ( current_user_can($item[1]) ) {
                $menu_hook = get_plugin_page_hook($item[2], 'admin.php');
-               if ( file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") || !empty($menu_hook) )
+               if ( file_exists(WP_PLUGIN_DIR . "/{$item[2]}") || !empty($menu_hook) )
                        $side_items[] = "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a>";
                else
                        $side_items[] = "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a>";
@@ -143,7 +145,7 @@ else $class = '';
 
 $menu_hook = get_plugin_page_hook($item[2], $parent_file);
 
-if (file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") || ! empty($menu_hook)) {
+if (file_exists(WP_PLUGIN_DIR . "/{$item[2]}") || ! empty($menu_hook)) {
        if ( 'admin.php' == $pagenow )
                echo "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
        else
index 3db528fa9d1f9884c69ed6924c3e90658f100556..cad05c8701cc02b4c986c2f3ac0298ded9a8f465 100644 (file)
@@ -23,9 +23,12 @@ else
 $awaiting_mod = wp_count_comments();
 $awaiting_mod = $awaiting_mod->moderated;
 $menu[15] = array(__('Design'), 'switch_themes', 'themes.php');
-$menu[20] = array( sprintf( __('Comments %s'), "<span id='awaiting-mod' class='count-$awaiting_mod'><span class='comment-count'>$awaiting_mod</span></span>" ), 'edit_posts', 'edit-comments.php');
+$menu[20] = array( sprintf( __('Comments %s'), "<span id='awaiting-mod' class='count-$awaiting_mod'><span class='comment-count'>" . number_format_i18n($awaiting_mod) . "</span></span>" ), 'edit_posts', 'edit-comments.php');
 $menu[30] = array(__('Settings'), 'manage_options', 'options-general.php');
-$menu[35] = array(__('Plugins'), 'activate_plugins', 'plugins.php');
+
+$update_plugins = get_option( 'update_plugins' );
+$update_count = count( $update_plugins->response );
+$menu[35] = array( sprintf( __('Plugins %s'), "<span id='update-plugins' class='count-$update_count'><span class='plugin-count'>" . number_format_i18n($update_count) . "</span></span>" ), 'activate_plugins', 'plugins.php');
 if ( current_user_can('edit_users') )
        $menu[40] = array(__('Users'), 'edit_users', 'users.php');
 else
index 6750ac328c5117bafd32db6148c58d1b73e0041a..46cda95fc72090e67e9b8b66e3ca7f63bda2c8fe 100644 (file)
@@ -1,4 +1,4 @@
 <?php
-require_once('../wp-config.php');
+require_once('../wp-load.php');
 wp_redirect('edit-comments.php?comment_status=moderated');
 ?>
index 69c0bbd359c3dad5b31b4c67ed2d3621e154a24e..e676dc82d691c1341157a8858eb62369aabc7616 100644 (file)
@@ -14,7 +14,7 @@ include('admin-header.php');
 <table class="form-table">
 <tr valign="top">
 <th scope="row"><?php _e('Default article settings') ?></th>
-<td>
+<td><fieldset><legend class="hidden"><?php _e('Default article settings') ?></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>
@@ -28,11 +28,11 @@ include('admin-header.php');
 <?php _e('Allow people to post comments on the article') ?></label>
 <br />
 <small><em><?php echo '(' . __('These settings may be overridden for individual articles.') . ')'; ?></em></small>
-</td>
+</fieldset></td>
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('E-mail me whenever') ?></th>
-<td>
+<td><fieldset><legend class="hidden"><?php _e('E-mail me whenever') ?></legend>
 <label for="comments_notify">
 <input name="comments_notify" type="checkbox" id="comments_notify" value="1" <?php checked('1', get_option('comments_notify')); ?> />
 <?php _e('Anyone posts a comment') ?> </label>
@@ -40,11 +40,11 @@ include('admin-header.php');
 <label for="moderation_notify">
 <input name="moderation_notify" type="checkbox" id="moderation_notify" value="1" <?php checked('1', get_option('moderation_notify')); ?> />
 <?php _e('A comment is held for moderation') ?> </label>
-</td>
+</fieldset></td>
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('Before a comment appears') ?></th>
-<td>
+<td><fieldset><legend class="hidden"><?php _e('Before a comment appears') ?></legend>
 <label for="comment_moderation">
 <input name="comment_moderation" type="checkbox" id="comment_moderation" value="1" <?php checked('1', get_option('comment_moderation')); ?> />
 <?php _e('An administrator must always approve the comment') ?> </label>
@@ -52,62 +52,98 @@ include('admin-header.php');
 <label for="require_name_email"><input type="checkbox" name="require_name_email" id="require_name_email" value="1" <?php checked('1', get_option('require_name_email')); ?> /> <?php _e('Comment author must fill out name and e-mail') ?></label>
 <br />
 <label for="comment_whitelist"><input type="checkbox" name="comment_whitelist" id="comment_whitelist" value="1" <?php checked('1', get_option('comment_whitelist')); ?> /> <?php _e('Comment author must have a previously approved comment') ?></label>
-</td>
+</fieldset></td>
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('Comment Moderation') ?></th>
-<td>
-<p><?php printf(__('Hold a comment in the queue if it contains %s or more links. (A common characteristic of comment spam is a large number of hyperlinks.)'), '<input name="comment_max_links" type="text" id="comment_max_links" size="3" value="' . get_option('comment_max_links'). '" />' ) ?></p>
+<td><fieldset><legend class="hidden"><?php _e('Comment Moderation') ?></legend>
+<p><label for="comment_max_links"><?php printf(__('Hold a comment in the queue if it contains %s or more links. (A common characteristic of comment spam is a large number of hyperlinks.)'), '<input name="comment_max_links" type="text" id="comment_max_links" size="3" value="' . get_option('comment_max_links'). '" />' ) ?></label></p>
 
-<p><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be held in the <a href="edit-comments.php?comment_status=moderated">moderation queue</a>. One word or IP per line. It will match inside words, so "press" will match "WordPress".') ?></p>
+<p><label for="moderation_keys"><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be held in the <a href="edit-comments.php?comment_status=moderated">moderation queue</a>. One word or IP per line. It will match inside words, so "press" will match "WordPress".') ?></label></p>
 <p>
 <textarea name="moderation_keys" cols="60" rows="10" id="moderation_keys" style="width: 98%; font-size: 12px;" class="code"><?php form_option('moderation_keys'); ?></textarea>
 </p>
-</td>
+</fieldset></td>
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('Comment Blacklist') ?></th>
-<td>
-<p><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be marked as spam. One word or IP per line. It will match inside words, so "press" will match "WordPress".') ?></p>
+<td><fieldset><legend class="hidden"><?php _e('Comment Blacklist') ?></legend>
+<p><label for="blacklist_keys"><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be marked as spam. One word or IP per line. It will match inside words, so "press" will match "WordPress".') ?></label></p>
 <p>
 <textarea name="blacklist_keys" cols="60" rows="10" id="blacklist_keys" style="width: 98%; font-size: 12px;" class="code"><?php form_option('blacklist_keys'); ?></textarea>
 </p>
-</td>
+</fieldset></td>
 </tr>
 </table>
 
 <h3><?php _e('Avatars') ?></h3>
 
-<p><?php _e('By default WordPress uses <a href="http://gravatar.com/">Gravatars</a> &#8212; short for Globally Recognized Avatars &#8212; for the pictures that show up next to comments. Plugins may override this.'); ?></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 blog.'); ?></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>
+<th scope="row"><?php _e('Avatar Display') ?></th>
+<td><fieldset><legend class="hidden"><?php _e('Avatar display') ?></legend>
 <?php
        $yesorno = array(0 => __("Don&#8217;t show Avatars"), 1 => __('Show Avatars'));
        foreach ( $yesorno as $key => $value) {
                $selected = (get_option('show_avatars') == $key) ? 'checked="checked"' : '';
-               echo "\n\t<label><input type='radio' name='show_avatars' value='$key' $selected> $value</label><br />";
+               echo "\n\t<label><input type='radio' name='show_avatars' value='$key' $selected/> $value</label><br />";
        }
 ?>
-</td>
+</fieldset></td>
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('Maximum Rating') ?></th>
-<td>
+<td><fieldset><legend class="hidden"><?php _e('Maximum Rating') ?></legend>
 
 <?php
 $ratings = array( 'G' => __('G &#8212; Suitable for all audiences'), 'PG' => __('PG &#8212; Possibly offensive, usually for audiences 13 and above'), 'R' => __('R &#8212; Intended for adult audiences above 17'), 'X' => __('X &#8212; Even more mature than above'));
 foreach ($ratings as $key => $rating) :
        $selected = (get_option('avatar_rating') == $key) ? 'checked="checked"' : '';
-       echo "\n\t<label><input type='radio' name='avatar_rating' value='$key' $selected> $rating</label><br />";
+       echo "\n\t<label><input type='radio' name='avatar_rating' value='$key' $selected/> $rating</label><br />";
 endforeach;
 ?>
 
-</td>
+</fieldset></td>
+</tr>
+<tr valign="top">
+<th scope="row"><?php _e('Default Avatar') ?></th>
+<td class="defaultavatarpicker"><fieldset><legend class="hidden"><?php _e('Default Avatar') ?></legend>
+
+<?php _e('For users without a custom avatar of their own, you can either display a generic logo or a generated one based on their e-mail address.'); ?><br />
+
+<?php
+$avatar_defaults = array(
+       'mystery' => __('Mystery Man'),
+       'blank' => __('Blank'),
+       'gravatar_default' => __('Gravatar Logo'),
+       'identicon' => __('Identicon (Generated)'),
+       'wavatar' => __('Wavatar (Generated)'),
+       'monsterid' => __('MonsterID (Generated)')
+);
+$avatar_defaults = apply_filters('avatar_defaults', $avatar_defaults);
+$default = get_option('avatar_default');
+if ( empty($default) )
+       $default = 'mystery';
+$size = 32;
+$avatar_list = '';
+foreach ( $avatar_defaults as $default_key => $default_name ) {
+       $selected = ($default == $default_key) ? 'checked="checked" ' : '';
+       $avatar_list .= "\n\t<label><input type='radio' name='avatar_default' id='avatar_{$default_key}' value='{$default_key}' {$selected}/> ";
+
+       $avatar = get_avatar( $user_email, $size, $default_key );
+       $avatar_list .= preg_replace("/src='(.+?)'/", "src='\$1&amp;forcedefault=1'", $avatar);
+
+       $avatar_list .= ' ' . $default_name . '</label>';
+       $avatar_list .= '<br />';
+}
+echo apply_filters('default_avatar_select', $avatar_list);
+?>
+
+</fieldset></td>
 </tr>
 
 </table>
@@ -115,7 +151,7 @@ endforeach;
 
 <p class="submit">
 <input type="hidden" name="action" value="update" />
-<input type="hidden" name="page_options" value="default_pingback_flag,default_ping_status,default_comment_status,comments_notify,moderation_notify,comment_moderation,require_name_email,comment_whitelist,comment_max_links,moderation_keys,blacklist_keys,show_avatars,avatar_rating" />
+<input type="hidden" name="page_options" value="default_pingback_flag,default_ping_status,default_comment_status,comments_notify,moderation_notify,comment_moderation,require_name_email,comment_whitelist,comment_max_links,moderation_keys,blacklist_keys,show_avatars,avatar_rating,avatar_default" />
 <input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" />
 </p>
 </form>
index 680f7ae98255ac36deb69f085307c76642ee667f..aec47d05accac1cd982ca8bab6f2c2cb3c1069f3 100644 (file)
@@ -13,50 +13,50 @@ include('./admin-header.php');
 <?php wp_nonce_field('update-options') ?>
 <table class="form-table">
 <tr valign="top">
-<th scope="row"><?php _e('Blog Title') ?></th>
+<th scope="row"><label for="blogname"><?php _e('Blog Title') ?></label></th>
 <td><input name="blogname" type="text" id="blogname" value="<?php form_option('blogname'); ?>" size="40" /></td>
 </tr>
 <tr valign="top">
-<th scope="row"><?php _e('Tagline') ?></th>
+<th scope="row"><label for="blogdescription"><?php _e('Tagline') ?></label></th>
 <td><input name="blogdescription" type="text" id="blogdescription" style="width: 95%" value="<?php form_option('blogdescription'); ?>" size="45" />
 <br />
 <?php _e('In a few words, explain what this blog is about.') ?></td>
 </tr>
 <tr valign="top">
-<th scope="row"><?php _e('WordPress address (URL)') ?></th>
+<th scope="row"><label for="siteurl"><?php _e('WordPress address (URL)') ?></label></th>
 <td><input name="siteurl" type="text" id="siteurl" value="<?php form_option('siteurl'); ?>" size="40" class="code<?php if ( defined( 'WP_SITEURL' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> /></td>
 </tr>
 <tr valign="top">
-<th scope="row"><?php _e('Blog address (URL)') ?></th>
+<th scope="row"><label for="home"><?php _e('Blog address (URL)') ?></label></th>
 <td><input name="home" type="text" id="home" value="<?php form_option('home'); ?>" size="40" class="code<?php if ( defined( 'WP_HOME' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> /><br /><?php _e('Enter the address here if you want your blog homepage <a href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">to be different from the directory</a> you installed WordPress.'); ?></td>
 </tr>
 <tr valign="top">
-<th scope="row"><?php _e('E-mail address') ?> </th>
+<th scope="row"><label for="admin_email"><?php _e('E-mail address') ?> </label></th>
 <td><input name="admin_email" type="text" id="admin_email" value="<?php form_option('admin_email'); ?>" size="40" class="code" />
 <br />
 <?php _e('This address is used for admin purposes, like new user notification.') ?></td>
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('Membership') ?></th>
-<td> <label for="users_can_register">
+<td> <fieldset><legend class="hidden"><?php _e('Membership') ?></legend><label for="users_can_register">
 <input name="users_can_register" type="checkbox" id="users_can_register" value="1" <?php checked('1', get_option('users_can_register')); ?> />
 <?php _e('Anyone can register') ?></label><br />
 <label for="comment_registration">
 <input name="comment_registration" type="checkbox" id="comment_registration" value="1" <?php checked('1', get_option('comment_registration')); ?> />
 <?php _e('Users must be registered and logged in to comment') ?>
 </label>
-</td>
+</fieldset></td>
 </tr>
 <tr valign="top">
-<th scope="row"><?php _e('New User Default Role') ?></th>
-<td><label for="default_role">
-<select name="default_role" id="default_role"><?php wp_dropdown_roles( get_option('default_role') ); ?></select></label>
+<th scope="row"><label for="default_role"><?php _e('New User Default Role') ?></label></th>
+<td>
+<select name="default_role" id="default_role"><?php wp_dropdown_roles( get_option('default_role') ); ?></select>
 </td>
 </tr>
 <tr>
-<th scope="row"><?php _e('Timezone') ?> </th>
+<th scope="row"><label for="gmt_offset"><?php _e('Timezone') ?> </label></th>
 <td>
-<select name="gmt_offset">
+<select name="gmt_offset" id="gmt_offset">
 <?php
 $current_offset = get_option('gmt_offset');
 $offset_range = array (-12, -11.5, -11, -10.5, -10, -9.5, -9, -8.5, -8, -7.5, -7, -6.5, -6, -5.5, -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5,
@@ -87,18 +87,18 @@ foreach ( $offset_range as $offset ) {
 </td>
 </tr>
 <tr>
-<th scope="row"><?php _e('Date Format') ?></th>
+<th scope="row"><label for="date_format"><?php _e('Date Format') ?></label></th>
 <td><input name="date_format" type="text" id="date_format" size="30" value="<?php form_option('date_format'); ?>" /><br />
 <?php _e('Output:') ?> <strong><?php echo mysql2date(get_option('date_format'), current_time('mysql')); ?></strong></td>
 </tr>
 <tr>
-<th scope="row"><?php _e('Time Format') ?></th>
+<th scope="row"><label for="time_format"><?php _e('Time Format') ?></label></th>
 <td><input name="time_format" type="text" id="time_format" size="30" value="<?php form_option('time_format'); ?>" /><br />
 <?php _e('Output:') ?> <strong><?php echo gmdate(get_option('time_format'), current_time('timestamp')); ?></strong><br />
 <?php _e('<a href="http://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date formatting</a>. Click "Save Changes" to update sample output.') ?></td>
 </tr>
 <tr>
-<th scope="row"><?php _e('Week Starts On') ?></th>
+<th scope="row"><label for="start_of_week"><?php _e('Week Starts On') ?></label></th>
 <td><select name="start_of_week" id="start_of_week">
 <?php
 for ($day_index = 0; $day_index <= 6; $day_index++) :
index 6cf0c154cba906e07b850ef86931188092e67191..7497a1c02a0e2c61f4e564a0653ec5c2119af407 100644 (file)
@@ -15,7 +15,7 @@ include('admin-header.php');
 <h3><?php _e('Uploading'); ?></h3>
 <table class="form-table">
 <tr valign="top">
-<th scope="row"><?php _e('Store uploads in this folder'); ?></th>
+<th scope="row"><label for="upload_path"><?php _e('Store uploads in this folder'); ?></label></th>
 <td><input name="upload_path" type="text" id="upload_path" class="code" value="<?php echo attribute_escape(str_replace(ABSPATH, '', get_option('upload_path'))); ?>" size="40" />
 <br />
 <?php _e('Default is <code>wp-content/uploads</code>'); ?>
@@ -23,7 +23,7 @@ include('admin-header.php');
 </tr>
 
 <tr valign="top">
-<th scope="row"><?php _e('Full URL path to files (optional)'); ?></th>
+<th scope="row"><label for="upload_url_path"><?php _e('Full URL path to files (optional)'); ?></label></th>
 <td><input name="upload_url_path" type="text" id="upload_url_path" class="code" value="<?php echo attribute_escape( get_option('upload_url_path')); ?>" size="40" />
 </td>
 </tr>
@@ -44,23 +44,23 @@ include('admin-header.php');
 <table class="form-table">
 <tr valign="top">
 <th scope="row"><?php _e('Thumbnail size') ?></th>
-<td>
+<td><fieldset><legend class="hidden"><?php _e('Thumbnail size') ?></legend>
 <label for="thumbnail_size_w"><?php _e('Width'); ?></label>
 <input name="thumbnail_size_w" type="text" id="thumbnail_size_w" value="<?php form_option('thumbnail_size_w'); ?>" size="6" />
 <label for="thumbnail_size_h"><?php _e('Height'); ?></label>
 <input name="thumbnail_size_h" type="text" id="thumbnail_size_h" value="<?php form_option('thumbnail_size_h'); ?>" size="6" /><br />
 <input name="thumbnail_crop" type="checkbox" id="thumbnail_crop" value="1" <?php checked('1', get_option('thumbnail_crop')); ?>/>
 <label for="thumbnail_crop"><?php _e('Crop thumbnail to exact dimensions (normally thumbnails are proportional)'); ?></label>
-</td>
+</fieldset></td>
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('Medium size') ?></th>
-<td>
+<td><fieldset><legend class="hidden"><?php _e('Medium size') ?></legend>
 <label for="medium_size_w"><?php _e('Max Width'); ?></label>
 <input name="medium_size_w" type="text" id="medium_size_w" value="<?php form_option('medium_size_w'); ?>" size="6" />
 <label for="medium_size_h"><?php _e('Max Height'); ?></label>
 <input name="medium_size_h" type="text" id="medium_size_h" value="<?php form_option('medium_size_h'); ?>" size="6" />
-</td>
+</fieldset></td>
 </tr>
 </table>
 
index 38144a3ba3bca62ea56300c4a71f908b6f662bb7..b2d05d3694e926c4364b2b2f558896435f19b359 100644 (file)
@@ -163,18 +163,18 @@ $structures = array(
 
 <h3><?php _e('Optional'); ?></h3>
 <?php if ($is_apache) : ?>
-       <p><?php _e('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <code>/topics/</code> as your category base would make your category links like <code>http://example.org/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p>
+       <p><?php _e('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <code>topics</code> as your category base would make your category links like <code>http://example.org/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p>
 <?php else : ?>
-       <p><?php _e('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <code>/topics/</code> as your category base would make your category links like <code>http://example.org/index.php/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p>
+       <p><?php _e('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <code>topics</code> as your category base would make your category links like <code>http://example.org/index.php/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p>
 <?php endif; ?>
 
 <table class="form-table">
        <tr>
-               <th><?php _e('Category base'); ?></th>
+               <th><label for="category_base"><?php _e('Category base'); ?></label></th>
                <td><input name="category_base" id="category_base" type="text" class="code"  value="<?php echo attribute_escape($category_base); ?>" size="30" /></td>
        </tr>
        <tr>
-               <th><?php _e('Tag base'); ?></th>
+               <th><label for="tag_base"><?php _e('Tag base'); ?></label></th>
                <td><input name="tag_base" id="tag_base" type="text" class="code"  value="<?php echo attribute_escape($tag_base); ?>" size="30" /></td>
        </tr>
 </table>
index b493fc9dcb725237eabcdab449852bfe9261c41e..3d9d140fc98494b10330d24204c4ba789c7865fa 100644 (file)
@@ -14,13 +14,13 @@ include('./admin-header.php');
 <table class="form-table">
 <tr valign="top">
 <th scope="row"><?php _e('Blog Visibility') ?> </th>
-<td>
+<td><fieldset><legend class="hidden"><?php _e('Blog Visibility') ?> </legend>
 <p><input id="blog-public" type="radio" name="blog_public" value="1" <?php checked('1', get_option('blog_public')); ?> />
 <label for="blog-public"><?php _e('I would like my blog to be visible to everyone, including search engines (like Google, Sphere, Technorati) and archivers');?></label></p>
 <p><input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked('0', get_option('blog_public')); ?> />
 <label for="blog-norobots"><?php _e('I would like to block search engines, but allow normal visitors'); ?></label></p>
 <?php do_action('blog_privacy_selector'); ?>
-</td>
+</fieldset></td>
 </tr>
 </table>
 
index 82c5049af4a3f2555cfb70a0420ee639eb04a743..b49f88b86dcb2bf7d8b46c472db6153093334eb7 100644 (file)
@@ -15,7 +15,7 @@ include('admin-header.php');
 <?php if ( get_pages() ): ?>
 <tr valign="top">
 <th scope="row"><?php _e('Front page displays')?></th>
-<td>
+<td><fieldset><legend class="hidden"><?php _e('Front page displays')?></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'); ?>
@@ -27,8 +27,8 @@ include('admin-header.php');
        </label>
        </p>
 <ul>
-       <li><?php printf(__('Front page: %s'), wp_dropdown_pages("name=page_on_front&echo=0&show_option_none=".__('- Select -')."&selected=" . get_option('page_on_front'))); ?></li>
-       <li><?php printf(__('Posts page: %s'), wp_dropdown_pages("name=page_for_posts&echo=0&show_option_none=".__('- Select -')."&selected=" . get_option('page_for_posts'))); ?></li>
+       <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>
 </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">
@@ -37,29 +37,29 @@ include('admin-header.php');
        </p>
 </div>
 <?php endif; ?>
-</td>
+</fieldset></td>
 </tr>
 <?php endif; ?>
 <tr valign="top">
-<th scope="row"><?php _e('Blog pages show at most') ?></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'); ?>" size="3" /> <?php _e('posts') ?>
 </td>
 </tr>
 <tr valign="top">
-<th scope="row"><?php _e('Syndication feeds show the most recent') ?></th>
+<th scope="row"><label for="posts_per_rss"><?php _e('Syndication feeds show the most recent') ?></label></th>
 <td><input name="posts_per_rss" type="text" id="posts_per_rss" value="<?php form_option('posts_per_rss'); ?>" size="3" /> <?php _e('posts') ?></td>
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('For each article in a feed, show') ?> </th>
-<td>
+<td><fieldset><legend class="hidden"><?php _e('For each article in a feed, show') ?> </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>
-</td>
+</fieldset></td>
 </tr>
 
 <tr valign="top">
-<th scope="row"><?php _e('Encoding for pages and feeds') ?></th>
+<th scope="row"><label for="blog_charset"><?php _e('Encoding for pages and feeds') ?></label></th>
 <td><input name="blog_charset" type="text" id="blog_charset" value="<?php form_option('blog_charset'); ?>" size="20" class="code" /><br />
 <?php _e('The character encoding you write your blog in (UTF-8 is <a href="http://developer.apple.com/documentation/macos8/TextIntlSvcs/TextEncodingConversionManager/TEC1.5/TEC.b0.html">recommended</a>)') ?></td>
 </tr>
index 645bfc790434cf75bf30ab1b90257daafeb862fd..03379a42ec41082614461dba5f981eba861170d8 100644 (file)
@@ -14,21 +14,21 @@ include('admin-header.php');
 
 <table class="form-table">
 <tr valign="top">
-<th scope="row"> <?php _e('Size of the post box') ?></th>
+<th scope="row"><label for="default_post_edit_rows"> <?php _e('Size of the post box') ?></label></th>
 <td><input name="default_post_edit_rows" type="text" id="default_post_edit_rows" value="<?php form_option('default_post_edit_rows'); ?>" size="2" style="width: 1.5em;" />
 <?php _e('lines') ?></td>
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('Formatting') ?></th>
-<td>
+<td><fieldset><legend class="hidden"><?php _e('Formatting') ?></legend>
 <label for="use_smilies">
 <input name="use_smilies" type="checkbox" id="use_smilies" value="1" <?php checked('1', get_option('use_smilies')); ?> />
 <?php _e('Convert emoticons like <code>:-)</code> and <code>:-P</code> to graphics on display') ?></label><br />
 <label for="use_balanceTags"><input name="use_balanceTags" type="checkbox" id="use_balanceTags" value="1" <?php checked('1', get_option('use_balanceTags')); ?> /> <?php _e('WordPress should correct invalidly nested XHTML automatically') ?></label>
-</td>
+</fieldset></td>
 </tr>
 <tr valign="top">
-<th scope="row"><?php _e('Default Post Category') ?></th>
+<th scope="row"><label for="default_category"><?php _e('Default Post Category') ?></label></th>
 <td><select name="default_category" id="default_category">
 <?php
 $categories = get_categories('get=all');
@@ -42,7 +42,7 @@ endforeach;
 </select></td>
 </tr>
 <tr valign="top">
-<th scope="row"><?php _e('Default Link Category') ?></th>
+<th scope="row"><label for="default_link_category"><?php _e('Default Link Category') ?></label></th>
 <td><select name="default_link_category" id="default_link_category">
 <?php
 $link_categories = get_terms('link_category', 'get=all');
@@ -57,29 +57,49 @@ endforeach;
 </tr>
 </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="hidden"><?php _e('Atom Publishing Protocol') ?></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="hidden"><?php _e('XML-RPC') ?></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></table>
+
 <h3><?php _e('Post via e-mail') ?></h3>
-<p><?php printf(__('To post to WordPress by e-mail you must set up a secret e-mail account with POP3 access. Any mail received at this address will be posted, so it&#8217;s a good idea to keep this address very secret. Here are three random strings you could use: <code>%s</code>, <code>%s</code>, <code>%s</code>.'), wp_generate_password(), wp_generate_password(), wp_generate_password()) ?></p>
+<p><?php printf(__('To post to WordPress by e-mail you must set up a secret e-mail account with POP3 access. Any mail received at this address will be posted, so it&#8217;s a good idea to keep this address very secret. Here are three random strings you could use: <code>%s</code>, <code>%s</code>, <code>%s</code>.'), wp_generate_password(8, false), wp_generate_password(8, false), wp_generate_password(8, false)) ?></p>
 
 <table class="form-table">
 <tr valign="top">
-<th scope="row"><?php _e('Mail Server') ?></th>
+<th scope="row"><label for="mailserver_url"><?php _e('Mail Server') ?></label></th>
 <td><input name="mailserver_url" type="text" id="mailserver_url" value="<?php form_option('mailserver_url'); ?>" size="40" />
 <label for="mailserver_port"><?php _e('Port') ?></label>
 <input name="mailserver_port" type="text" id="mailserver_port" value="<?php form_option('mailserver_port'); ?>" size="6" />
 </td>
 </tr>
 <tr valign="top">
-<th scope="row"><?php _e('Login Name') ?></th>
+<th scope="row"><label for="mailserver_login"><?php _e('Login Name') ?></label></th>
 <td><input name="mailserver_login" type="text" id="mailserver_login" value="<?php form_option('mailserver_login'); ?>" size="40" /></td>
 </tr>
 <tr valign="top">
-<th scope="row"><?php _e('Password') ?></th>
+<th scope="row"><label for="mailserver_pass"><?php _e('Password') ?></label></th>
 <td>
 <input name="mailserver_pass" type="text" id="mailserver_pass" value="<?php form_option('mailserver_pass'); ?>" size="40" />
 </td>
 </tr>
 <tr valign="top">
-<th scope="row"><?php _e('Default Mail Category') ?></th>
+<th scope="row"><label for="default_email_category"><?php _e('Default Mail Category') ?></label></th>
 <td><select name="default_email_category" id="default_email_category">
 <?php
 //Alreay have $categories from default_category
@@ -98,7 +118,7 @@ endforeach;
 
 <?php if ( get_option('blog_public') ) : ?>
 
-<p><?php _e('When you publish a new post, WordPress automatically notifies the following site update services. For more about this, see <a href="http://codex.wordpress.org/Update_Services">Update Services</a> on the Codex. Separate multiple service <abbr title="Universal Resource Locator">URL</abbr>s with line breaks.') ?></p>
+<p><label for="ping_sites"><?php _e('When you publish a new post, WordPress automatically notifies the following site update services. For more about this, see <a href="http://codex.wordpress.org/Update_Services">Update Services</a> on the Codex. Separate multiple service <abbr title="Universal Resource Locator">URL</abbr>s with line breaks.') ?></label></p>
 
 <textarea name="ping_sites" id="ping_sites" style="width: 98%;" rows="3" cols="50"><?php form_option('ping_sites'); ?></textarea>
 
@@ -110,7 +130,7 @@ endforeach;
 
 <p class="submit">
 <input type="hidden" name="action" value="update" />
-<input type="hidden" name="page_options" value="default_post_edit_rows,use_smilies,ping_sites,mailserver_url,mailserver_port,mailserver_login,mailserver_pass,default_category,default_email_category,use_balanceTags,default_link_category" />
+<input type="hidden" name="page_options" value="default_post_edit_rows,use_smilies,ping_sites,mailserver_url,mailserver_port,mailserver_login,mailserver_pass,default_category,default_email_category,use_balanceTags,default_link_category,enable_app,enable_xmlrpc" />
 <input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" />
 </p>
 </form>
index 88ee29ae3343803fc7280dda2d217d77247afca0..7f158db4d6fda600c6ef1804eed54b529828219f 100644 (file)
@@ -73,7 +73,7 @@ foreach ( (array) $options as $option) :
        }
        echo "
 <tr>
-       <th scope='row'>$option->option_name</th>
+       <th scope='row'><label for='$option->option_name'>$option->option_name</label></th>
 <td>";
 
        if (strpos($value, "\n") !== false) echo "<textarea class='$class' name='$option->option_name' id='$option->option_name' cols='30' rows='5'>" . wp_specialchars($value) . "</textarea>";
index f09d6578416924d7385ba25a01a96a2c460995ca..f324c3d10faf8fbcc684b4cbc3dcb0e2f356cb6c 100644 (file)
@@ -7,8 +7,9 @@ wp_enqueue_script('autosave');
 wp_enqueue_script('page');
 if ( user_can_richedit() )
        wp_enqueue_script('editor');
-wp_enqueue_script('thickbox');
+add_thickbox();
 wp_enqueue_script('media-upload');
+wp_enqueue_script('word-count');
 
 require_once('admin-header.php');
 ?>
index b10fa727465b06707691f9100193fe20a4b9b1c7..3e8ae30a6586db4524c9c6452b012639a2a4a68b 100644 (file)
@@ -34,9 +34,7 @@ function redirect_page($page_ID) {
        } elseif (!empty($referredby) && $referredby != $referer) {
                $location = $_POST['referredby'];
                $location = remove_query_arg('_wp_original_http_referer', $location);
-               if ( $_POST['referredby'] == 'redo' )
-                       $location = get_permalink( $page_ID );
-               elseif ( false !== strpos($location, 'edit-pages.php') )
+               if ( false !== strpos($location, 'edit-pages.php') )
                        $location = add_query_arg('posted', $page_ID, $location);
                elseif ( false !== strpos($location, 'wp-admin') )
                        $location = "page-new.php?posted=$page_ID";
@@ -73,16 +71,17 @@ case 'edit':
 
        if ( empty($post->ID) ) wp_die( __("You attempted to edit a page that doesn't exist. Perhaps it was deleted?") );
 
-       if ( 'post' == $post->post_type ) {
-               wp_redirect("post.php?action=edit&post=$post_ID");
+       if ( 'page' != $post->post_type ) {
+               wp_redirect( get_edit_post_link( $post_ID, 'url' ) );
                exit();
        }
 
        wp_enqueue_script('page');
        if ( user_can_richedit() )
                wp_enqueue_script('editor');
-       wp_enqueue_script('thickbox');
+       add_thickbox();
        wp_enqueue_script('media-upload');
+       wp_enqueue_script('word-count');
 
        if ( current_user_can('edit_page', $page_ID) ) {
                if ( $last = wp_check_post_lock( $post->ID ) ) {
@@ -148,8 +147,8 @@ case 'delete':
        }
 
        $sendback = wp_get_referer();
-       if (strpos($sendback, 'page.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/page.php';
-       elseif (strpos($sendback, 'attachments.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/attachments.php';
+       if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('page.php');
+       elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
        $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
        wp_redirect($sendback);
        exit();
index a9c534c5bd4830d15858df1dce4c43a5a9a67c8c..ea87bea0b328c932b2863e7f6665f013fad73c3b 100644 (file)
@@ -6,10 +6,7 @@ $parent_file = 'plugins.php';
 
 wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file'));
 
-add_action( 'admin_head', 'theme_editor_css' );
-function theme_editor_css(){
-       wp_admin_css( 'css/theme-editor' );
-}
+wp_admin_css( 'theme-editor' );
 
 $plugins = get_plugins();
 $plugin_files = array_keys($plugins);
@@ -18,7 +15,7 @@ if (empty($file))
        $file = $plugin_files[0];
 
 $file = validate_file_to_edit($file, $plugin_files);
-$real_file = get_real_file_to_edit( PLUGINDIR . "/$file");
+$real_file = WP_PLUGIN_DIR . '/' . $file;
 
 switch($action) {
 
@@ -71,7 +68,7 @@ default:
 
        require_once('admin-header.php');
 
-       update_recently_edited(PLUGINDIR . "/$file");
+       update_recently_edited(WP_PLUGIN_DIR . '/' . $file);
 
        if ( ! is_file($real_file) )
                $error = 1;
index f0b75ad502e2953e44c00c5459f1c069d80bdc5e..46d2b6115e6a4629fc6481299074ee3a28e97b1f 100644 (file)
 <?php
 require_once('admin.php');
 
-if ( isset($_GET['action']) ) {
-       if ( isset($_GET['plugin']) )
-               $plugin = trim($_GET['plugin']);
-
-       if ( 'activate' == $_GET['action'] ) {
-               check_admin_referer('activate-plugin_' . $_GET['plugin']);
-               $result = activate_plugin($_GET['plugin'], 'plugins.php?error=true&plugin=' . $plugin);
-               if ( is_wp_error( $result ) )
-                       wp_die( $result->get_error_message() );
-               wp_redirect('plugins.php?activate=true'); // overrides the ?error=true one above
-       } elseif ( 'error_scrape' == $_GET['action'] ) {
-               check_admin_referer('plugin-activation-error_' . $plugin);
-               $valid = validate_plugin($plugin);
-               if ( is_wp_error($valid) )
-                       wp_die($valid);
-               error_reporting( E_ALL ^ E_NOTICE );
-               @ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
-               include(ABSPATH . PLUGINDIR . '/' . $plugin);
-       } elseif ( 'deactivate' == $_GET['action'] ) {
-               check_admin_referer('deactivate-plugin_' . $_GET['plugin']);
-               deactivate_plugins($_GET['plugin']);
-               wp_redirect('plugins.php?deactivate=true');
-       } elseif ( 'deactivate-all' == $_GET['action'] ) {
-               check_admin_referer('deactivate-all');
-               deactivate_all_plugins();
-               wp_redirect('plugins.php?deactivate-all=true');
-       } elseif ('reactivate-all' == $_GET['action']) {
-               check_admin_referer('reactivate-all');
-               reactivate_all_plugins('plugins.php?errors=true');
-               wp_redirect('plugins.php?reactivate-all=true'); // overrides the ?error=true one above
+$action = '';
+foreach( array('activate-selected', 'deactivate-selected', 'delete-selected', 'clear-recent-list') as $action_key ) {
+       if( isset($_POST[$action_key]) ) {
+               $action = $action_key;
+               break;
        }
+}
+
+if( isset($_GET['action']) )
+       $action = $_GET['action'];
+
+$plugin = $_REQUEST['plugin'];
+
+if( !empty($action) ) {
+       switch( $action ) {
+               case 'activate':
+                       check_admin_referer('activate-plugin_' . $plugin);
+                       $result = activate_plugin($plugin, 'plugins.php?error=true&plugin=' . $plugin);
+                       if ( is_wp_error( $result ) )
+                               wp_die( $result->get_error_message() );
+                       $recent = (array)get_option('recently_activated');
+                       if( isset($recent[ $plugin ]) ){
+                               unset($recent[ $plugin ]);
+                               update_option('recently_activated', $recent);
+                       }
+                       wp_redirect('plugins.php?activate=true'); // overrides the ?error=true one above
+                       exit;
+                       break;
+               case 'activate-selected':
+                       check_admin_referer('bulk-manage-plugins');
+                       activate_plugins($_POST['checked'], 'plugins.php?error=true');
+
+                       $recent = (array)get_option('recently_activated');
+                       foreach( (array)$_POST['checked'] as $plugin => $time) {
+                               if( isset($recent[ $plugin ]) )
+                                       unset($recent[ $plugin ]);
+                       }
+                       if( $recent != get_option('recently_activated') ) //If array changed, update it.
+                               update_option('recently_activated', $recent);
 
-       exit;
+                       wp_redirect('plugins.php?activate-multi=true');
+                       exit;
+                       break;
+               case 'error_scrape':
+                       check_admin_referer('plugin-activation-error_' . $plugin);
+                       $valid = validate_plugin($plugin);
+                       if ( is_wp_error($valid) )
+                               wp_die($valid);
+                       error_reporting( E_ALL ^ E_NOTICE );
+                       @ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
+                       include(WP_PLUGIN_DIR . '/' . $plugin);
+                       exit;
+                       break;
+               case 'deactivate':
+                       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');
+                       exit;
+                       break;
+               case 'deactivate-selected':
+                       check_admin_referer('bulk-manage-plugins');
+                       deactivate_plugins($_POST['checked']);
+                       $deactivated = array();
+                       foreach( (array)$_POST['checked'] as $plugin )
+                               $deactivated[ $plugin ] = time();
+                       update_option('recently_activated', $deactivated + (array)get_option('recently_activated'));
+                       wp_redirect('plugins.php?deactivate-multi=true');
+                       exit;
+                       break;
+               case 'delete-selected':
+                       if( ! current_user_can('delete_plugins') )
+                               wp_die(__('You do not have sufficient permissions to delete plugins for this blog.'));
+                       
+                       check_admin_referer('bulk-manage-plugins');
+                       
+                       $plugins = $_REQUEST['checked']; //$_POST = from the plugin form; $_GET = from the FTP details screen.
+                       include(ABSPATH . 'wp-admin/update.php');
+
+                       $title = __('Delete Plugin');
+                       $parent_file = 'plugins.php';
+                       
+                       if( ! isset($_REQUEST['verify-delete']) ) {
+                               wp_enqueue_script('jquery');
+                               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) )
+                                                               $plugin_info[ $plugin ] = $data;
+                                               } else {
+                                                       //Locate all the files in that folder:
+                                                       $files = list_files( WP_PLUGIN_DIR . '/' . dirname($plugin) );
+                                                       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);
+                                               }
+                                       }
+                               ?>
+                               <p><?php _e('Deleting the selected plugins will remove the following plugin(s) and their files:'); ?></p>
+                               <p>
+                                       <ul>
+                                               <?php 
+                                               foreach( $plugin_info as $plugin )
+                                                       echo '<li>', $plugin['Title'], ' ', __('By'), ' ', $plugin['Author'], '</li>';
+                                               ?>
+                                       </ul>
+                               </p>
+                               <p><?php _e('Are you sure you wish to delete these files?') ?></p>
+                               <form method="post" action="<?php echo clean_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;">
+                                       <input type="hidden" name="verify-delete" value="1" />
+                                       <input type="hidden" name="delete-selected" value="1" />
+                                       <?php
+                                               foreach( (array)$plugins as $plugin ) {
+                                                       $plugin = attribute_escape($plugin);
+                                                       echo "<input type='hidden' name='checked[]' value='$plugin' />";
+                                               }
+                                       ?>
+                                       <?php wp_nonce_field('bulk-manage-plugins') ?>
+                                       <input type="submit" name="submit" value="<?php _e('Yes, Delete these files') ?>" class="button" />
+                               </form>
+                               <form method="post" action="<?php echo clean_url(wp_get_referer()); ?>" style="display:inline;">
+                                       <input type="submit" name="submit" value="<?php _e('No, Return me to the plugin list') ?>" class="button" />
+                               </form>
+
+                               <p><a href="#" onclick="jQuery('#files-list').toggle(); return false;"><?php _e('Click to view entire list of files which will be deleted'); ?></a></p>
+                               <div id="files-list" style="display:none;">
+                                       <ul>
+                                       <?php
+                                               foreach( (array)$files_to_delete as $file ) {
+                                                       $file = str_replace(ABSPATH, '', $file);
+                                                       echo "<li>$file</li>";
+                                               }
+                                       ?>
+                                       </ul>
+                               </div>                          
+                       </div>
+                               <?php
+                               require_once('admin-footer.php');
+                               exit;
+                       } //Endif verify-delete
+                       $delete_result = delete_plugins($plugins);
+
+                       wp_cache_delete('plugins', 'plugins');
+                       break;
+               case 'clear-recent-list':
+                       update_option('recently_activated', array());
+                       break;
+       }
 }
 
+wp_enqueue_script('admin-forms');
+
 $title = __('Manage Plugins');
 require_once('admin-header.php');
 
-validate_active_plugins();
-
+$invalid = validate_active_plugins();
+if( !empty($invalid) )
+       foreach($invalid as $plugin_file => $error)
+               echo '<div id="message" class="error"><p>' . sprintf(__('The plugin <code>%s</code> has been <strong>deactivated</strong> due to an error: %s'), wp_specialchars($plugin_file), $error->get_error_message()) . '</p></div>';
 ?>
 
 <?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
-               $plugin = trim($_GET['plugin']);
                if ( wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $plugin) ) { ?>
-       <iframe style="border:0" width="100%" height="70px" src="<?php bloginfo('wpurl'); ?>/wp-admin/plugins.php?action=error_scrape&amp;plugin=<?php echo attribute_escape($plugin); ?>&amp;_wpnonce=<?php echo attribute_escape($_GET['_error_nonce']); ?>"></iframe>
+       <iframe style="border:0" width="100%" height="70px" src="<?php echo admin_url('plugins.php?action=error_scrape&amp;plugin=' . attribute_escape($plugin) . '&amp;_wpnonce=' . attribute_escape($_GET['_error_nonce'])); ?>"></iframe>
        <?php
                }
        ?>
        </div>
-<?php elseif ( isset($_GET['errors']) ) : ?>
-       <div id="message" class="updated fade"><p><?php _e('Some plugins could not be reactivated because they triggered a <strong>fatal error</strong>.') ?></p></div>
+<?php elseif ( 'delete-selected' == $action ) :
+               if ( is_wp_error($delete_result) ) : ?>
+               <div id="message" class="updated fade"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message() ); ?></p></div>
+               <?php else : ?>
+               <div id="message" class="updated fade"><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>
+<?php elseif (isset($_GET['activate-multi'])) : ?>
+       <div id="message" class="updated fade"><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>
-<?php elseif (isset($_GET['deactivate-all'])) : ?>
-       <div id="message" class="updated fade"><p><?php _e('All plugins <strong>deactivated</strong>.'); ?></p></div>
-<?php elseif (isset($_GET['reactivate-all'])) : ?>
-       <div id="message" class="updated fade"><p><?php _e('Plugins <strong>reactivated</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>
 <?php endif; ?>
 
 <div class="wrap">
@@ -70,107 +201,160 @@ validate_active_plugins();
 <p><?php _e('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.'); ?></p>
 <?php
 
-$plugins = get_plugins();
+$all_plugins = get_plugins();
+$active_plugins = array();
+$inactive_plugins = array();
+$recent_plugins = array();
+$recently_activated = (array)get_option('recently_activated');
 
-if (empty($plugins)) {
-       echo '<p>';
-       _e("Couldn&#8217;t open plugins directory or there are no plugins available."); // TODO: make more helpful
-       echo '</p>';
-} else {
-?>
+//Clean out any plugins which were deactivated over a week ago.
+foreach( $recently_activated as $key => $time )
+       if( $time + (7*24*60*60) < time() ) //1 week
+               unset($recently_activated[ $key ]);
+if( $recently_activated != get_option('recently_activated') ) //If array changed, update it.
+       update_option('recently_activated', $recently_activated);
 
-<div class="tablenav">
-       <div class="alignleft">
-       <?php
-       $active = get_option('active_plugins');
-       $inactive = get_option('deactivated_plugins');
-       if ( !empty($active) ) {
-       ?>
-       <a class="button-secondary" href="<?php echo wp_nonce_url('plugins.php?action=deactivate-all', 'deactivate-all'); ?>" class="delete"><?php _e('Deactivate All Plugins'); ?></a>
-       <?php
-       } elseif ( empty($active) && !empty($inactive) ) {
-       ?>
-       <a class="button-secondary" href="<?php echo wp_nonce_url('plugins.php?action=reactivate-all', 'reactivate-all'); ?>" class="delete"><?php _e('Reactivate Plugins'); ?></a>
-       <?php
-       } // endif active/inactive plugin check
-       ?>
-       </div>
-       <br class="clear" />
-</div>
+$plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array());
 
-<br class="clear" />
+foreach( (array)$all_plugins as $plugin_file => $plugin_data) {
+
+       // Sanitize all displayed data
+       $plugin_data['Title']       = wp_kses($plugin_data['Title'], $plugins_allowedtags);
+       $plugin_data['Version']     = wp_kses($plugin_data['Version'], $plugins_allowedtags);
+       $plugin_data['Description'] = wp_kses($plugin_data['Description'], $plugins_allowedtags);
+       $plugin_data['Author']      = wp_kses($plugin_data['Author'], $plugins_allowedtags);
+       if( ! empty($plugin_data['Author']) )
+               $plugin_data['Description'] .= ' <cite>' . sprintf( __('By %s'), $plugin_data['Author'] ) . '.</cite>';
 
-<table class="widefat">
+       //Filter into individual sections
+       if ( is_plugin_active($plugin_file) ) {
+               $active_plugins[ $plugin_file ] = $plugin_data;
+       } else {
+               if ( isset( $recently_activated[ $plugin_file ] ) ) //Was the plugin recently activated?
+                       $recent_plugins[ $plugin_file ] = $plugin_data;
+               else
+                       $inactive_plugins[ $plugin_file ] = $plugin_data;
+       }
+}
+
+?>
+
+<?php
+function print_plugins_table($plugins, $context = '') {
+?>
+<table class="widefat" id="<?php echo $context ?>-plugins-table">
        <thead>
        <tr>
-               <th><?php _e('Plugin'); ?></th>
-               <th class="num"><?php _e('Version'); ?></th>
-               <th><?php _e('Description'); ?></th>
-               <th class="status"><?php _e('Status') ?></th>
-               <th class="action-links"><?php _e('Action'); ?></th>
+               <th scope="col" class="check-column"><input type="checkbox" /></th>
+               <th scope="col"><?php _e('Plugin'); ?></th>
+               <th scope="col" class="num"><?php _e('Version'); ?></th>
+               <th scope="col"><?php _e('Description'); ?></th>
+               <th scope="col" class="action-links"><?php _e('Action'); ?></th>
        </tr>
        </thead>
-       <tbody id="plugins">
+       <tbody class="plugins">
 <?php
-       foreach($plugins as $plugin_file => $plugin_data) {
-               $action_links = array();
-               
-               $style = '';
-
-               if ( is_plugin_active($plugin_file) ) {
-                       $action_links[] = "<a href='" . wp_nonce_url("plugins.php?action=deactivate&amp;plugin=$plugin_file", 'deactivate-plugin_' . $plugin_file) . "' title='".__('Deactivate this plugin')."' class='delete'>".__('Deactivate')."</a>";
-                       $style = 'active';
-               } else {
-                       $action_links[] = "<a href='" . wp_nonce_url("plugins.php?action=activate&amp;plugin=$plugin_file", 'activate-plugin_' . $plugin_file) . "' title='".__('Activate this plugin')."' class='edit'>".__('Activate')."</a>";
-               }
-               if ( current_user_can('edit_plugins') && is_writable(ABSPATH . PLUGINDIR . '/' . $plugin_file) )
-                       $action_links[] = "<a href='plugin-editor.php?file=$plugin_file' title='".__('Open this file in the Plugin Editor')."' class='edit'>".__('Edit')."</a>";
 
-               $plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array());
+       if( empty($plugins) ) {
+               echo '<tr>
+                       <td colspan="6">' . __('No plugins to show') . '</td>
+               </tr>';
+       }
+       foreach( (array)$plugins as $plugin_file => $plugin_data) {
+               $action_links = array();
 
-               // Sanitize all displayed data
-               $plugin_data['Title']       = wp_kses($plugin_data['Title'], $plugins_allowedtags);
-               $plugin_data['Version']     = wp_kses($plugin_data['Version'], $plugins_allowedtags);
-               $plugin_data['Description'] = wp_kses($plugin_data['Description'], $plugins_allowedtags);
-               $plugin_data['Author']      = wp_kses($plugin_data['Author'], $plugins_allowedtags);
-               $author = ( empty($plugin_data['Author']) ) ? '' :  ' <cite>' . sprintf( __('By %s'), $plugin_data['Author'] ) . '.</cite>';
+               if( 'active' == $context )
+                       $action_links[] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&amp;plugin=' . $plugin_file, 'deactivate-plugin_' . $plugin_file) . '" title="' . __('Deactivate this plugin') . '" class="delete">' . __('Deactivate') . '</a>';
+               else //Available or Recently deactivated
+                       $action_links[] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>';
 
-               if ( $style != '' )
-                       $style = ' class="' . $style . '"';
+               if ( current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
+                       $action_links[] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . __('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>';
 
-               $action_links = apply_filters('plugin_action_links', $action_links, $plugin_file, $plugin_info);
+               $action_links = apply_filters('plugin_action_links', $action_links, $plugin_file, $plugin_data, $context);
 
                echo "
-       <tr$style>
+       <tr class='$context'>
+               <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . attribute_escape($plugin_file) . "' /></th>
                <td class='name'>{$plugin_data['Title']}</td>
                <td class='vers'>{$plugin_data['Version']}</td>
-               <td class='desc'><p>{$plugin_data['Description']}$author</p></td>
-               <td class='status'>";
-               if ( is_plugin_active($plugin_file) )
-                       echo  __('<span class="active">Active</span>');
-               else
-                       _e('<span class="inactive">Inactive</span>');
-               echo "</td>
-               <td class='togl action-links'>$toggle";  
+               <td class='desc'><p>{$plugin_data['Description']}</p></td>
+               <td class='togl action-links'>";  
                if ( !empty($action_links) )
                        echo implode(' | ', $action_links);
-               echo "</td> 
-       </tr>";
-       do_action( 'after_plugin_row', $plugin_file );
+               echo '</td> 
+       </tr>';
+               do_action( 'after_plugin_row', $plugin_file, $plugin_data, $context );
        }
 ?>
        </tbody>
 </table>
-
-<?php
-}
+<?php 
+} //End print_plugins_table()
 ?>
 
-<p><?php printf(__('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), PLUGINDIR); ?></p>
+<?php if ( ! empty($active_plugins) ) : ?>
+<h3 id="currently-active"><?php _e('Currently Active Plugins') ?></h3>
+<form method="post" action="<?php echo admin_url('plugins.php') ?>">
+<?php wp_nonce_field('bulk-manage-plugins') ?>
+
+<div class="tablenav">
+       <div class="alignleft">
+               <input type="submit" name="deactivate-selected" value="<?php _e('Deactivate') ?>" class="button-secondary" />
+       </div>
+</div>
+<br class="clear" />
+<?php print_plugins_table($active_plugins, 'active') ?>
+</form>
+
+<p><?php printf(__('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), WP_PLUGIN_DIR); ?></p>
+<?php endif; ?>
+
+<?php if ( ! empty($recent_plugins) ) : ?>
+<h3 id="recent-plugins"><?php _e('Recently Active Plugins') ?></h3>
+<p><?php _e('The following plugins were recently active. When a plugin has been inactive for more than 7 days it will be moved to the Inactive plugin list.') ?></p>
+<form method="post" action="<?php echo admin_url('plugins.php') ?>">
+<?php wp_nonce_field('bulk-manage-plugins') ?>
+
+<div class="tablenav">
+       <div class="alignleft">
+               <input type="submit" name="activate-selected" value="<?php _e('Activate') ?>" class="button-secondary" />
+<?php if( current_user_can('delete_plugins') ) : ?>
+               <input type="submit" name="delete-selected" value="<?php _e('Delete') ?>" class="button-secondary" />
+<?php endif; ?>
+               <input type="submit" name="clear-recent-list" value="<?php _e('Clear List') ?>" class="button-secondary" />
+       </div>
+</div>
+<br class="clear" />
+<?php print_plugins_table($recent_plugins, 'recent') ?>
+</form>
+<?php endif; ?>
+
+<?php if ( ! empty($inactive_plugins) ) : ?>
+<h3 id="inactive-plugins"><?php _e('Inactive Plugins') ?></h3>
+<form method="post" action="<?php echo admin_url('plugins.php') ?>">
+<?php wp_nonce_field('bulk-manage-plugins') ?>
+
+<div class="tablenav">
+       <div class="alignleft">
+               <input type="submit" name="activate-selected" value="<?php _e('Activate') ?>" class="button-secondary" />
+<?php if( current_user_can('delete_plugins') ) : ?>
+               <input type="submit" name="delete-selected" value="<?php _e('Delete') ?>" class="button-secondary" />
+<?php endif; ?>
+       </div>
+</div>
+<br class="clear" />
+<?php print_plugins_table($inactive_plugins, 'inactive') ?>
+</form>
+<?php endif; ?>
+
+<?php if ( empty($all_plugins) ) : ?>
+<p><?php _e('You do not appear to have any plugins available at this time.') ?></p>
+<?php endif; ?>
 
 <h2><?php _e('Get More Plugins'); ?></h2>
 <p><?php _e('You can find additional plugins for your site in the <a href="http://wordpress.org/extend/plugins/">WordPress plugin directory</a>.'); ?></p>
-<p><?php printf(__('To install a plugin you generally just need to upload the plugin file into your <code>%s</code> directory. Once a plugin is uploaded, you may activate it here.'), PLUGINDIR); ?></p>
+<p><?php printf(__('To install a plugin you generally just need to upload the plugin file into your <code>%s</code> directory. Once a plugin is uploaded, you may activate it here.'), WP_PLUGIN_DIR); ?></p>
 
 </div>
 
index 263783a39dd1d869eeaca50cd5fc0135a0811c97..f1f2da5b9c8edd0a47f0fee40adbca8f65c95326 100644 (file)
@@ -7,8 +7,9 @@ wp_enqueue_script('autosave');
 wp_enqueue_script('post');
 if ( user_can_richedit() )
        wp_enqueue_script('editor');
-wp_enqueue_script('thickbox');
+add_thickbox();
 wp_enqueue_script('media-upload');
+wp_enqueue_script('word-count');
 
 require_once ('./admin-header.php');
 
index b9400b71d2a709faaf25a5a2e02789540992cb04..0dfb8212fadec2061ab1b24974429f1aaa8c76f4 100644 (file)
@@ -36,9 +36,7 @@ function redirect_post($post_ID = '') {
        } elseif (!empty($referredby) && $referredby != $referer) {
                $location = $_POST['referredby'];
                $location = remove_query_arg('_wp_original_http_referer', $location);
-               if ( $_POST['referredby'] == 'redo' )
-                       $location = get_permalink( $post_ID );
-               elseif ( false !== strpos($location, 'edit.php') )
+               if ( false !== strpos($location, 'edit.php') )
                        $location = add_query_arg('posted', $post_ID, $location);               
                elseif ( false !== strpos($location, 'wp-admin') )
                        $location = "post-new.php?posted=$post_ID";
@@ -80,16 +78,17 @@ case 'edit':
 
        if ( empty($post->ID) ) wp_die( __("You attempted to edit a post that doesn't exist. Perhaps it was deleted?") );
 
-       if ( 'page' == $post->post_type ) {
-               wp_redirect("page.php?action=edit&post=$post_ID");
+       if ( 'post' != $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');
-       wp_enqueue_script('thickbox');
+       add_thickbox();
        wp_enqueue_script('media-upload');
+       wp_enqueue_script('word-count');
 
        if ( current_user_can('edit_post', $post_ID) ) {
                if ( $last = wp_check_post_lock( $post->ID ) ) {
@@ -159,8 +158,8 @@ case 'delete':
        }
 
        $sendback = wp_get_referer();
-       if (strpos($sendback, 'post.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/post-new.php';
-       elseif (strpos($sendback, 'attachments.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/attachments.php';
+       if (strpos($sendback, 'post.php') !== false) $sendback = admin_url('post-new.php');
+       elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
        $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
        wp_redirect($sendback);
        exit();
diff --git a/wp-admin/press-this.php b/wp-admin/press-this.php
new file mode 100644 (file)
index 0000000..8bd6ce2
--- /dev/null
@@ -0,0 +1,536 @@
+<?php
+require_once('admin.php');
+
+if ( ! current_user_can('publish_posts') ) wp_die( __( 'Cheatin&#8217; uh?' ) );
+
+function preg_quote2($string) {
+       return str_replace('/', '\/', preg_quote($string));
+}
+function aposfix($text) {
+       $translation_table[chr(34)] = '&quot;';
+       $translation_table[chr(38)] = '&';
+       $translation_table[chr(39)] = '&apos;';
+       return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/","&amp;" , strtr($text, $translation_table));
+}
+function press_it() {
+       // define some basic variables
+       $quick['post_status'] = isset($_REQUEST['publish']) ? 'publish' : 'draft';
+       $quick['post_category'] = $_REQUEST['post_category'];
+       $quick['tags_input'] = $_REQUEST['tags_input'];
+       $quick['post_title'] = $_REQUEST['post_title'];
+       $quick['post_content'] = '';
+
+       // insert the post with nothing in it, to get an ID
+       $post_ID = wp_insert_post($quick, true);
+
+       $content = '';
+       switch ( $_REQUEST['post_type'] ) {
+               case 'text':
+               case 'quote':
+                       $content .= $_REQUEST['content'];
+                       break;
+
+               case 'photo':
+                       $content = $_REQUEST['content'];
+
+                       foreach( (array) $_REQUEST['photo_src'] as $key => $image) {
+                               
+                               // see if files exist in content - we don't want to upload non-used selected files.
+                               if( strpos($_REQUEST['content'], $image) !== false ) {
+                                       $upload = media_sideload_image($image, $post_ID, $_REQUEST['photo_description'][$key]);
+                                        
+                                       // Replace the POSTED content <img> with correct uploaded ones.
+                                       // escape quote for matching
+                                       $quoted = preg_quote2($image);
+                                       if( !is_wp_error($upload) ) $content = preg_replace('/<img ([^>]*)src=(\"|\')'.$quoted.'(\2)([^>\/]*)\/*>/is', $upload, $content);
+                               }
+                       }
+
+                       break;
+
+               case "video":
+                       if($_REQUEST['embed_code']) 
+                               $content .= $_REQUEST['embed_code']."\n\n";
+                       $content .= $_REQUEST['content'];
+                       break;
+               }
+       // set the post_content
+       $quick['post_content'] = $content;
+
+       // error handling for $post
+       if ( is_wp_error($post_ID)) {
+               wp_die($id);
+               wp_delete_post($post_ID);
+       // error handling for media_sideload
+       } elseif ( is_wp_error($upload)) {
+               wp_die($upload);
+               wp_delete_post($post_ID);
+       } else {
+               $quick['ID'] = $post_ID;
+               wp_update_post($quick);
+       }
+       return $post_ID;
+}
+
+// For submitted posts.
+if ( 'post' == $_REQUEST['action'] ) { 
+       check_admin_referer('press-this'); $post_ID = press_it(); ?>
+       <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+       <html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
+       <head>
+               <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
+               <title><?php _e('Press This') ?></title>
+       <?php
+               add_thickbox();
+               wp_enqueue_style('press-this');
+               wp_enqueue_style('press-this-ie');
+               wp_enqueue_style( 'colors' );
+               wp_enqueue_script('post');
+
+               do_action('admin_print_styles');
+               do_action('admin_print_scripts');
+               do_action('admin_head');
+       ?>
+       </head>
+       <body class="press-this">
+               <div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a onclick="window.opener.location.replace(this.href); window.close();" href="<?php echo get_permalink( $post_ID); ?>"><?php _e('View post'); ?></a> | <a href="post.php?action=edit&amp;post=<?php echo $post_ID; ?>" onclick="window.opener.location.replace(this.href); window.close();"><?php _e('Edit post'); ?></a> | <a href="#" onclick="window.close();"><?php _e('Close Window'); ?></a></p></div>
+               <div id="footer">
+               <p><?php
+               do_action('in_admin_footer', '');
+               $upgrade = apply_filters( 'update_footer', '' );
+               echo __('Thank you for creating with <a href="http://wordpress.org/">WordPress</a>');
+               ?></p>
+               </div>
+               <?php do_action('admin_footer', ''); ?>
+       </body>
+       </html>
+       <?php die;
+}
+
+// Ajax Requests
+$title = wp_specialchars(aposfix(stripslashes($_GET['t'])));
+
+$selection = trim( aposfix( stripslashes($_GET['s']) ) );
+if ( ! empty($selection) ) {
+       $selection = preg_replace('/(\r?\n|\r)/', '</p><p>', $selection);
+       $selection = '<p>'.str_replace('<p></p>', '', $selection).'</p>';
+}
+
+$url = clean_url($_GET['u']);
+$image = $_GET['i'];
+
+if($_REQUEST['ajax'] == 'thickbox') { ?>
+       <script type="text/javascript" charset="utf-8">
+               jQuery('.cancel').click(function() {
+                       tb_remove();
+               });
+
+               jQuery('.select').click(function() {
+                       image_selector();
+               });
+       </script>
+       <h3 id="title"><label for="post_title"><?php _e('Description') ?></label></h3>
+       <div class="titlewrap">
+               <input id="this_photo_description" name="photo_description" class="text" onkeypress="if(event.keyCode==13) image_selector();" value="<?php echo attribute_escape($title);?>"/>
+       </div>
+
+       <p class="centered"><input type="hidden" name="this_photo" value="<?php echo attribute_escape($image); ?>" id="this_photo" />
+               <a href="#" class="select"><img src="<?php echo clean_url($image); ?>" alt="<?php echo attribute_escape(__('Click to insert.')); ?>" title="<?php echo attribute_escape(__('Click to insert.')); ?>" /></a></p>
+
+       <p id="options"><a href="#" class="select button"><?php _e('Insert Image'); ?></a> <a href="#" class="cancel button"><?php _e('Cancel'); ?></a></p>
+<?php die; 
+}
+
+if($_REQUEST['ajax'] == 'thickbox_url') { ?>
+       <script type="text/javascript" charset="utf-8">
+               jQuery('.cancel').click(function() {
+                       tb_remove();
+               });
+
+               jQuery('.select').click(function() {
+                       image_selector();
+               });
+       </script>
+       <h3 id="title"><label for="post_title"><?php _e('URL') ?></label></h3>
+       <div class="titlewrap">
+               <input id="this_photo" name="this_photo" class="text" onkeypress="if(event.keyCode==13) image_selector();" />
+       </div>
+
+
+       <h3 id="title"><label for="post_title"><?php _e('Description') ?></label></h3>
+       <div class="titlewrap">
+               <input id="this_photo_description" name="photo_description" class="text" onkeypress="if(event.keyCode==13) image_selector();" value="<?php echo attribute_escape($title);?>"/>
+       </div>
+
+       <p id="options"><a href="#" class="select"><?php _e('Insert Image'); ?></a> | <a href="#" class="cancel"><?php _e('Cancel'); ?></a></p>
+<?php die; 
+}
+
+if($_REQUEST['ajax'] == 'video') { ?>
+       <h2 id="embededcode"><label for="embed_code"><?php _e('Embed Code') ?></label></h2>
+       <div class="titlewrap" >
+               <textarea name="embed_code" id="embed_code" rows="8" cols="40"><?php echo format_to_edit($selection); ?></textarea>
+       </div>
+<?php die;
+}
+
+if($_REQUEST['ajax'] == 'photo_images') {
+       function get_images_from_uri($uri) {
+               if( preg_match('/\.(jpg|jpe|jpeg|png|gif)/', $uri) && !strpos($uri,'blogger.com') ) 
+                       return "'".$uri."'";
+
+               $content = wp_remote_fopen($uri);
+               if ( false === $content ) return '';
+
+               $host = parse_url($uri);
+
+               $pattern = '/<img ([^>]*)src=(\"|\')([^<>]+?\.(png|jpeg|jpg|jpe|gif))[^<>\'\"]*(\2)([^>\/]*)\/*>/is';
+               preg_match_all($pattern, $content, $matches);
+               
+               if ( empty($matches[1]) ) return '';
+
+               $sources = array();
+               foreach ($matches[3] as $src) {
+                       // if no http in url
+                       if(strpos($src, 'http') === false)
+                               // if it doesn't have a relative uri
+                               if( strpos($src, '../') === false && strpos($src, './') === false && strpos($src, '/') === true)
+                                       $src = 'http://'.str_replace('//','/', $host['host'].'/'.$src);
+                               else
+                                       $src = 'http://'.str_replace('//','/', $host['host'].'/'.dirname($host['path']).'/'.$src);
+                       
+                       $sources[] = clean_url($src);
+               }
+               return "'" . implode("','", $sources) . "'";
+       } 
+
+       $url = urldecode($url);
+       $url = str_replace(' ', '%20', $url);
+       echo 'new Array('.get_images_from_uri($url).')'; 
+die;
+}
+
+if($_REQUEST['ajax'] == 'photo_js') { ?>
+       // gather images and load some default JS
+       var last = null
+       var img, img_tag, aspect, w, h, skip, i, strtoappend = "";
+       var my_src = eval(
+               jQuery.ajax({
+                       type: "GET",
+                       url: "<?php echo clean_url($_SERVER['PHP_SELF']); ?>",
+                       cache : false,
+                       async : false,
+                       data: "ajax=photo_images&u=<?php echo urlencode($url); ?>",
+                       dataType : "script"
+               }).responseText
+       );
+
+       for (i = 0; i < my_src.length; i++) {
+               img = new Image(); 
+               img.src = my_src[i]; 
+               img_attr = 'id="img' + i + '"'; 
+               skip = false;
+               if (img.width && img.height) {
+                       if (img.width * img.height < 2500) 
+                               skip = true;
+                       aspect = img.width / img.height;
+                       scale = (aspect > 1) ? (75 / img.width) : (75 / img.height);
+
+                       w = img.width;
+                       h = img.height;
+
+                       if (scale < 1) {
+                               w = parseInt(img.width * scale);
+                               h = parseInt(img.height * scale);
+                       }
+                       img_attr += ' style="width: ' + w + 'px; height: ' + h + 'px;"';
+               }
+               if (!skip) strtoappend += '<a href="?ajax=thickbox&amp;i=' + img.src + '&amp;u=<?php echo $url; ?>&amp;height=400&amp;width=500" title="" class="thickbox"><img src="' + img.src + '" ' + img_attr + '/></a>';
+       }
+
+       function pick(img, desc) {
+               if (img) {
+                       if('object' == typeof jQuery('.photolist input') && jQuery('.photolist input').length != 0) length = jQuery('.photolist input').length;
+                       if(length == 0) length = 1;
+                       jQuery('.photolist').append('<input name="photo_src[' + length + ']" value="' + img +'" type="hidden"/>');
+                       jQuery('.photolist').append('<input name="photo_description[' + length + ']" value="' + desc +'" type="hidden"/>');
+                       append_editor("\n\n" + '<p><img src="' + img +'" alt="' + desc + '" class="aligncenter"/></p>');
+               }
+               tinyMCE.activeEditor.resizeToContent();
+               return false;
+       }
+
+       function image_selector() {
+               tb_remove();
+               desc = jQuery('#this_photo_description').val();
+               src = jQuery('#this_photo').val();
+               pick(src, desc);
+               return false;
+       }
+
+       jQuery(document).ready(function() {
+               jQuery('#extra_fields').html('<div class="photolist"></div><small id="photo_directions"><?php _e("Click images to select:") ?> <span><a href="#" id="photo_add_url" class="thickbox"><?php _e("Add from URL") ?> +</a></span></small><div class="titlewrap"><div id="img_container"></div></div>');
+               jQuery('#img_container').html(strtoappend);
+               jQuery('#photo_add_url').attr('href', '?ajax=thickbox_url&height=200&width=500');
+               tb_init('a.thickbox, area.thickbox, input.thickbox');
+       });
+
+<?php die;
+}
+
+if($_REQUEST['ajax'] == 'photo') { ?>
+
+<?php die;
+}
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
+<head>
+       <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
+       <title><?php _e('Press This') ?></title>
+
+       <script type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce.js?ver=311"></script>
+<?php
+       add_thickbox();
+       wp_enqueue_style('press-this');
+       wp_enqueue_style('press-this-ie');
+       wp_enqueue_style( 'colors' );
+       wp_enqueue_script('post');
+       wp_enqueue_script('editor_functions');
+
+       do_action('admin_print_styles');
+       do_action('admin_print_scripts');
+       do_action('admin_head');
+?>
+       <script type="text/javascript">
+       <?php if ( user_can_richedit() ) { 
+               $language = ( '' == get_locale() ) ? 'en' : strtolower( substr(get_locale(), 0, 2) );
+               // Add TinyMCE languages
+               @include_once( dirname(__FILE__).'/../wp-includes/js/tinymce/langs/wp-langs.php' );
+               if ( isset($strings) ) echo $strings; ?>
+                       (function() {
+                               var base = tinymce.baseURL, sl = tinymce.ScriptLoader, ln = "<?php echo $language; ?>";
+                               sl.markDone(base + '/langs/' + ln + '.js');
+                               sl.markDone(base + '/themes/advanced/langs/' + ln + '.js');
+                               sl.markDone(base + '/themes/advanced/langs/' + ln + '_dlg.js');
+                       })();
+
+                       tinyMCE.init({
+                               mode: "textareas",
+                               editor_selector: "mceEditor",
+                               language : "<?php echo $language; ?>",
+                               width: "100%",
+                               height: "300",
+                               theme : "advanced",
+                               theme_advanced_buttons1 : "bold,italic,underline,blockquote,separator,strikethrough,bullist,numlist,undo,redo,link,unlink",
+                               theme_advanced_buttons2 : "",
+                               theme_advanced_buttons3 : "",
+                               theme_advanced_toolbar_location : "top",
+                               theme_advanced_toolbar_align : "left",
+                               theme_advanced_statusbar_location : "bottom",
+                               theme_advanced_resizing : true,
+                               theme_advanced_resize_horizontal : false,
+                               skin : "wp_theme",
+                               dialog_type : "modal",
+                               relative_urls : false,
+                               remove_script_host : false,
+                               convert_urls : false,
+                               apply_source_formatting : false,
+                               remove_linebreaks : true,
+                               accessibility_focus : false,
+                               tab_focus : ":next",
+                               plugins : "safari,inlinepopups",
+                               entities : "38,amp,60,lt,62,gt",
+                               force_p_newlines : true,
+                               save_callback : 'switchEditors.saveCallback'
+                       });
+    <?php } ?>
+
+    jQuery('#tags-input').hide();
+
+       tag_update_quickclicks();
+
+       // add the quickadd form
+       jQuery('#jaxtag').prepend('<span id="ajaxtag"><input type="text" name="newtag" id="newtag" class="form-input-tip" size="16" autocomplete="off" value="'+postL10n.addTag+'" /><input type="submit" class="button" id="tagadd" value="' + postL10n.add + '" tabindex="3" onclick="return false;" /><input type="hidden"/><input type="hidden"/><span class="howto">'+postL10n.separate+'</span></span>');
+
+       jQuery('#tagadd').click( tag_flush_to_text );
+       jQuery('#newtag').focus(function() {
+               if ( this.value == postL10n.addTag )
+                       jQuery(this).val( '' ).removeClass( 'form-input-tip' );
+       });
+       jQuery('#newtag').blur(function() {
+               if ( this.value == '' ) 
+                       jQuery(this).val( postL10n.addTag ).addClass( 'form-input-tip' );
+       });
+
+       // auto-save tags on post save/publish
+       jQuery('#publish').click( tag_save_on_publish );
+       jQuery('#save-post').click( tag_save_on_publish );
+
+       function set_menu(type) {
+               jQuery('#text_button').removeClass('ui-tabs-selected');
+               jQuery('#menu li').removeClass('ui-tabs-selected');
+               jQuery('#' + type + '_button').addClass('ui-tabs-selected');
+               jQuery("#post_type").val(type);
+       }
+
+       function set_editor(text) {
+               if ( '' == text || '<p></p>' == text ) text = '<p><br /></p>';
+               if ( tinyMCE.activeEditor ) tinyMCE.execCommand('mceSetContent', false, text);
+       }
+
+       function append_editor(text) {
+               if ( '' != text && tinyMCE.activeEditor ) tinyMCE.execCommand('mceInsertContent', false, text);
+       }
+
+       function set_title(title) { jQuery("#content_type").text(title); }
+
+       function show(tab_name) {
+               jQuery('body').removeClass('video_split');
+               jQuery('#extra_fields').hide();
+               switch(tab_name) {
+                       case 'text' :
+                               set_menu('text');
+                               set_title('<?php _e('Post') ?>');
+                               <?php if ($selection) { ?>
+                                       set_editor('<?php echo $selection; ?><p><a href="<?php echo $url ?>"><?php echo $title; ?></a>.</p>');
+                               <?php } else { ?>
+                                       set_editor('<p><a href="<?php echo $url ?>"><?php echo $title; ?></a></p>');
+                               <?php } ?>
+                               return false;
+                               break;
+                       case 'quote' :
+                               set_menu('quote');
+                               set_title('<?php _e('Quote') ?>');
+                               set_editor('<blockquote><?php echo $selection; ?> <p><cite><a href="<?php echo $url; ?>"><?php echo $title; ?> </a> </cite> </p></blockquote>');
+                               return false;
+                               break;
+                       case 'video' :
+                               set_menu('video');
+                               set_title('<?php _e('Caption') ?>');
+                               jQuery('#extra_fields').show();
+                               jQuery('body').addClass('video_split');
+                               jQuery('#extra_fields').load('<?php echo clean_url($_SERVER['PHP_SELF']); ?>', { ajax: 'video', s: '<?php echo attribute_escape($selection); ?>'}, function() {
+                                       <?php 
+                                       $content = '';
+                                       if ( preg_match("/youtube\.com\/watch/i", $url) ) {
+                                               list($domain, $video_id) = split("v=", $url);
+                                               $content = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/' . $video_id . '"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/' . $video_id . '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>';
+
+                                       } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) {
+                                               list($domain, $video_id) = split(".com/", $url);
+                                               $content = '<object width="400" height="225"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=' . $video_id . '&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" />      <embed src="http://www.vimeo.com/moogaloop.swf?clip_id=' . $video_id . '&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="225"></embed></object>';
+
+                                               if ( trim($selection) == '' )
+                                                       $selection = '<p><a href="http://www.vimeo.com/' . $video_id . '?pg=embed&sec=' . $video_id . '">' . $title . '</a> on <a href="http://vimeo.com?pg=embed&sec=' . $video_id . '">Vimeo</a></p>';
+
+                                       } elseif ( strpos( $selection, '<object' ) !== false ) {
+                                               $content = $selection;
+                                       }
+                                       ?>
+                                       jQuery('#embed_code').prepend('<?php echo htmlentities($content); ?>');
+
+                                       set_editor('<a href="<?php echo $url ?>"><?php echo $title; ?></a>.');
+                               });
+                               return false;
+                               break;
+                       case 'photo' :
+                               set_menu('photo');
+                               set_title('<?php _e('Post') ?>');
+                               <?php if ($selection) { ?>
+                                       set_editor('<?php echo $selection; ?><p><a href="<?php echo $url ?>"><?php echo $title; ?></a></p>');
+                               <?php } else { ?>
+                                       set_editor('<p><a href="<?php echo $url ?>"><?php echo $title; ?></a></p>');
+                               <?php } ?>
+                               jQuery('#extra_fields').show();
+                               jQuery('#extra_fields').before('<h2 id="waiting"><img src="images/loading.gif" alt="" /><?php echo js_escape( __( 'Loading...' ) ); ?></h2>');
+                               jQuery.ajax({
+                                       type: "GET",
+                                       cache : false,
+                                       url: "<?php echo clean_url($_SERVER['PHP_SELF']); ?>",
+                                       data: "ajax=photo_js&u=<?php echo urlencode($url)?>",
+                                       dataType : "script",
+                                       success : function() {
+                                               jQuery('#waiting').remove();
+                                       }
+                               });
+                               return false;
+                               break;
+               }
+       }
+
+       jQuery(document).ready(function() {
+       jQuery('#menu li').click(function (){ 
+                       tab_name = this.id.split('_');
+                       tab_name = tab_name[0];
+                       show(tab_name);
+               });
+               // Set default tabs
+               <?php if ( preg_match("/youtube\.com\/watch/i", $url) ) { ?>
+                       show('video');
+               <?php } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) { ?>
+                       show('video');
+               <?php  } elseif ( preg_match("/flickr\.com/i", $url) ) { ?>
+                       show('photo');
+               <?php } ?>
+       });
+
+</script>
+</head>
+<body class="press-this">
+<div id="wphead">
+       <h1><span id="viewsite"><a href="<?php echo get_option('home'); ?>/"><?php _e('Visit:') ?> <?php bloginfo('name'); ?></a></span></h1>
+</div>
+
+<ul id="menu" class="ui-tabs-nav">
+       <li id="text_button" class="ui-tabs-selected"><a href="#"><?php _e('Text') ?></a></li>
+       <li id="photo_button"><a href="#"><?php _e('Photo') ?></a></li>
+       <li id="quote_button"><a href="#"><?php _e('Quote') ?></a></li>
+       <li id="video_button"><a href="#"><?php _e('Video') ?></a></li>
+</ul>
+
+<form action="press-this.php?action=post" method="post">
+       <?php wp_nonce_field('press-this') ?>
+       <input type="hidden" name="post_type" id="post_type" value="text"/>
+       <div id="posting">
+               <h2 id="title"><label for="post_title"><?php _e('Title') ?></label></h2>
+               <div class="titlewrap">
+                       <input name="post_title" id="post_title" class="text" value="<?php echo attribute_escape($title);?>"/>
+               </div>
+
+               <div id="extra_fields" style="display: none"></div>
+
+               <div class="editor_area">
+                       <h2 id="content_type"><label for="content"><?php _e('Post') ?></label></h2>
+                       <div class="editor-container">
+                               <textarea name="content" id="content" style="width:100%;" class="mceEditor" rows="15"><?php if ($selection) { echo wp_richedit_pre($selection); } ?><a href="<?php echo $url ?>"><?php echo $title; ?></a>.</textarea>
+                       </div>
+               </div>
+       </div>
+
+       <div id="categories">
+               <div class="submitbox" id="submitpost">
+                       <div id="previewview"></div>
+                       <div class="inside">
+                               <h2><?php _e('Categories') ?></h2>
+                               <div id="categories-all">
+                                       <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
+                                               <?php wp_category_checklist() ?>
+                                       </ul>
+                               </div>
+                               
+                               <h2><?php _e('Tags') ?></h2>
+                               <p id="jaxtag"><label class="hidden" for="newtag"><?php _e('Tags'); ?></label><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post->ID ); ?>" /></p>
+                               <div id="tagchecklist"></div>
+                       </div>
+
+                       <p class="submit">         
+                               <input type="submit" name="draft" value="<?php _e('Save') ?>" onclick="document.getElementById('photo_saving').style.display = '';"/>
+                               <input type="submit" name="publish" value="<?php _e('Publish') ?>" onclick="document.getElementById('photo_saving').style.display = '';"/>
+                               <img src="images/loading-publish.gif" alt="" id="photo_saving" style="display:none;"/>
+                       </p>
+               </div>
+       </div>
+</form>
+</body>
+</html>
\ No newline at end of file
diff --git a/wp-admin/revision.php b/wp-admin/revision.php
new file mode 100644 (file)
index 0000000..4820abc
--- /dev/null
@@ -0,0 +1,213 @@
+<?php
+
+require_once('admin.php');
+
+wp_reset_vars(array('revision', 'left', 'right', 'action'));
+$revision_id = absint($revision);
+$diff        = absint($diff);
+$left        = absint($left);
+$right       = absint($right);
+
+$parent_file = $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;
+       if ( !current_user_can( 'edit_post', $revision->post_parent ) )
+               break;
+       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
+               break;
+
+       check_admin_referer( "restore-post_$post->ID|$revision->ID" );
+
+       wp_restore_post_revision( $revision->ID );
+       $redirect = add_query_arg( array( 'message' => 5, 'revision' => $revision->ID ), get_edit_post_link( $post->ID, 'url' ) );
+       break;
+case 'diff' :
+       if ( !$left_revision  = get_post( $left ) )
+               break;
+       if ( !$right_revision = get_post( $right ) )
+               break;
+
+       if ( !current_user_can( 'read_post', $left_revision->ID ) || !current_user_can( 'read_post', $right_revision->ID ) )
+               break;
+
+       // 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' );
+               break;
+       }
+
+       // Don't allow reverse diffs?
+       if ( strtotime($right_revision->post_modified_gmt) < strtotime($left_revision->post_modified_gmt) ) {
+               $redirect = add_query_arg( array( 'left' => $right, 'right' => $left ) );
+               break;
+       }
+
+       if ( $left_revision->ID == $right_revision->post_parent ) // right is a revision of left
+               $post =& $left_revision;
+       elseif ( $left_revision->post_parent == $right_revision->ID ) // left is a revision of right
+               $post =& $right_revision;
+       elseif ( $left_revision->post_parent == $right_revision->post_parent ) // both are revisions of common parent
+               $post = get_post( $left_revision->post_parent );
+       else
+               break; // Don't diff two unrelated revisions
+
+       if ( !constant('WP_POST_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 )
+               )
+                       break;
+       }
+
+       if (
+               // They're the same
+               $left_revision->ID == $right_revision->ID
+       ||
+               // Neither is a revision
+               ( !wp_get_post_revision( $left_revision->ID ) && !wp_get_post_revision( $right_revision->ID ) )
+       )
+               break;
+       
+       $post_title = '<a href="' . get_edit_post_link() . '">' . get_the_title() . '</a>';
+       $h2 = sprintf( __( 'Compare Revisions of &#8220;%1$s&#8221;' ), $post_title );
+
+       $left  = $left_revision->ID;
+       $right = $right_revision->ID;
+
+       $redirect = false;
+       break;
+case 'view' :
+default :
+       if ( !$revision = wp_get_post_revision( $revision_id ) )
+               break;
+       if ( !$post = get_post( $revision->post_parent ) )
+               break;
+
+       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
+               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 );
+
+       // Sets up the diff radio buttons
+       $left  = $revision->ID;
+       $right = $post->ID;
+
+       $redirect = false;
+       break;
+endswitch;
+
+if ( !$redirect && !in_array( $post->post_type, array( 'post', 'page' ) ) )
+       $redirect = 'edit.php';
+
+if ( $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' );
+}
+
+require_once( 'admin-header.php' );
+
+?>
+
+<div class="wrap">
+
+<h2 class="long-header"><?php echo $h2; ?></h2>
+
+<table class="form-table ie-fixed">
+       <col class="th" />
+<?php if ( 'diff' == $action ) : ?>
+<tr id="revision">
+       <th scope="row"></th>
+       <th scope="col" class="th-full">
+               <span class="alignleft"><?php printf( __('Older: %s'), wp_post_revision_title( $left_revision ) ); ?></span>
+               <span class="alignright"><?php printf( __('Newer: %s'), wp_post_revision_title( $right_revision ) ); ?></span>
+       </th>
+</tr>
+<?php endif;
+
+// use get_post_to_edit filters? 
+$identical = true;
+foreach ( _wp_post_revision_fields() as $field => $field_title ) :
+       if ( 'diff' == $action ) {
+               $left_content = apply_filters( "_wp_post_revision_field_$field", $left_revision->$field, $field );
+               $right_content = apply_filters( "_wp_post_revision_field_$field", $right_revision->$field, $field );
+               if ( !$content = wp_text_diff( $left_content, $right_content ) )
+                       continue; // There is no difference between left and right
+               $identical = false;
+       } else {
+               add_filter( "_wp_post_revision_field_$field", 'htmlspecialchars' );
+               $content = apply_filters( "_wp_post_revision_field_$field", $revision->$field, $field );
+       }
+       ?>
+
+       <tr id="revision-field-<?php echo $field; ?>">
+               <th scope="row"><?php echo wp_specialchars( $field_title ); ?></th>
+               <td><div class="pre"><?php echo $content; ?></div></td>
+       </tr>
+
+       <?php
+
+endforeach;
+
+if ( 'diff' == $action && $identical ) :
+
+       ?>
+
+       <tr><td colspan="2"><div class="updated"><p><?php _e( 'These revisions are identical.' ); ?></p></div></td></tr>
+
+       <?php
+
+endif;
+
+?>
+
+</table>
+
+<br class="clear" />
+
+<h2><?php echo $title; ?></h2>
+
+<?php
+
+$args = array( 'format' => 'form-table', 'parent' => true, 'right' => $right, 'left' => $left );
+if ( !constant( 'WP_POST_REVISIONS' ) )
+       $args['type'] = 'autosave';
+
+wp_list_post_revisions( $post, $args );
+
+?>
+
+</div>
+
+<?php
+
+require_once( 'admin-footer.php' );
index 196a9b090512a88a365a156b5f542b577c2bff73..a23793b980d933f33fa2b295a8249f8085a1d913 100644 (file)
-html,#edit-slug-box,#trackback,#category_nicename,#slug,#dbuser,#dbpass,#dbname,#dbhost,#dbprefix,#dccharset,input[name=gmpath],input[name=archivespath],input[name=lastentry],input[name=email],input[name=url],input[name=aim],input[name=yim],input[name=jabber],#newcontent,#email,#newcomment_author_url,#pass1,#pass2,#siteurl,#home,#admin_email,#date_format,#time_format,#mailserver_url,#mailserver_login,#mailserver_pass,#ping_sites,#blog_charset,#moderation_keys,#blacklist_keys,#permalink_structure,#category_base,#tag_base,#upload_path,#upload_url_path,#insertonly[src],#insertonly[href],#mailserver_port,#thumbnail_size_w,#thumbnail_size_h,#medium_size_w,#medium_size_h,#posts_per_page,#posts_per_rss,#comment_max_links,#insertonly[src],#link_url,#link_image,#rss_uri,#user_login,#key
-{
-       direction:ltr;
-       text-align:left
+a:link, a:visited {
+       text-decoration:none;
 }
-
-body, td {
-       font-family: Tahoma,Verdana,sans-serif;
+a:hover {
+       text-decoration:underline;
 }
-
-#wpwrap,#footer,#TB_title,.media-upload-form,#media-upload-header
-{
-       direction:rtl!important;
-       text-align:right!important
+.plugins .togl {
+       border-right-width: 0;
+       border-left-width: 1px;
+       border-left-style: solid;
 }
-
-#user_info
-{
-       left:15px;
-       right:auto
+form#upload th {
+       text-align:left;
+}
+td.available-theme {
+       text-align:right;
+}
+#current-theme img {
+       float: right;
+       margin-right:0;
+       margin-left: 1em;
+}
+.quicktags, .search {
+       font-family: Tahoma;
+}
+/* 201 - 403
+=================================== */
+.side-info ul {
+       padding-left:0;
+       padding-right:18px;
+}
+.submit input, .button, .button-secondary, .button-highlighted {
+       font-family: Tahoma;
+}
+#wpcontent select  {
+       font-family: Tahoma;
+}
+/* #postdiv, #titlediv, #guiddiv, #poststuff .stuffbox {
+       margin:0 0 0 8px;
+} */
+#quicktags #ed_code {
+       font-family: Tahoma;
 }
-
-#wphead h1
-{
-       margin:0 0 0 15%;
-       padding:11px 15px 16px 170px
+#searchform fieldset {
+       float:right;
+       margin: 0 0 1em 1.5ex;
+}
+#searchform fieldset legend {
+       padding: 0 1px .2em 0;
+}
+#searchform #post-query-submit {
+       float:right;
 }
-
-#wphead #viewsite
-{
+/* 404 - 804
+=================================== */
+#template div {
+       margin-right:0;
+       margin-left: 190px;
+}
+* html #template div {
+       margin-left: 0;
+}
+#your-profile legend {
+       font-family:arial;
+}
+#ajax-response.alignleft {
+       margin-left:0;
+       margin-right: 2em;
+}
+.page-numbers {
+       margin-right:0;
+       margin-left:3px;
+}
+.comment-column {
        margin-left:0;
-       margin-right:10px
+       margin-right: 5px;
 }
-
-#sidemenu
-{
+.tablenav a.button-secondary {
+       margin: 1px 0 0 8px;
+}
+#update-nag, .plugin-update {
+       clear:both;
+}
+/* .tablenav .tablenav-pages {
        float:left;
-       margin:-30px 315px 0 15px;
-       padding-left:0;
-       padding-right:10px
+} */
+#user_info {
+       right:auto;
+       left:15px;
+}
+#wphead #viewsite {
+       margin-left:0;
+       margin-right:10px;
+}
+#wphead #viewsite a {
+       font-family: Tahoma;
 }
-
-#dashmenu
-{
-       font-size:11px;
+#wphead h1 {
+       font-family:arial;
+       margin-right:0;
+       margin-left:15%;
+       padding: 11px 12px 16px 170px;
+}
+#dashmenu {
+       right:0;
        left:auto;
        padding-left:0;
-       padding-right:9px;
-       right:0
+       padding-right: 9px;
 }
-
-#dashmenu a
-{
+#dashmenu a {
+       margin-right:0;
        margin-left:8px;
-       margin-right:8px;
 }
-
-#adminmenu
-{
-       height:32px;
-       padding:5px 8px 0 0
+#adminmenu {
+       padding-left:0;
+       padding-right:11px;
 }
-
-#adminmenu li a
-{
-       display:block;
-       float:right;
-       font:700 16px/100% "Times New Roman", Times, serif;
-       margin:0 0 0 10px;
-       padding:5px 7px 9px
-}
-
-#adminmenu li a.current
-{
-       font-weight:700
-}
-
-#adminmenu li a #awaiting-mod
-{
-       background:url(images/comment-stalk-rtl.gif) -309px bottom !important;
-       font-family: Tahoma, Verdana, sans-serif;
-       margin-left:-45px;
-       margin-right:.2em;
-       margin-top:-5px
-}
-
-#adminmenu li a:hover #awaiting-mod
-{
-       background-position: -229px bottom !important;
-}
-
-#adminmenu li a #awaiting-mod span
-{
-       left:0;
-       right:auto
+#adminmenu a {
+       font-family:arial;
+       font-weight:bold;
+       padding:6px 7px;
 }
-
-#submenu li a
-{
-       display:block;
+#adminmenu a.current, #sidemenu a.current {
+       font-weight:bold;
+}
+#sidemenu {
+       margin: -30px 0 0 15px;
+       float: left;
+       padding-left:0;
+       padding-right: 10px;
+       height: 1%; /* Peek-a-boo in IE6 */
+}
+#sidemenu a {
        float:right;
-       margin:0 10px 10px 0;
-       padding:2px 4px
 }
-
-p#post-search
-{
+#submenu li {
+       padding: 0 17px 8px 0;
+       font-size:13px;
+}
+#adminmenu li a #awaiting-mod span, #sidemenu li a #update-plugins span {
+       right:auto;
        left:0;
-       right:auto
-}
-
-.tablenav div
-{
-       float:right!important
-}
-
-.tablenav .delete 
-{
-       margin-left: 40px;
-       margin-right: 0;
-}
-
-ul.view-switch
-{
-       float:left;
-       margin:-28px 0 -2px 5px
 }
-
-#currenttheme img
-{
-       float:right;
-       margin-left:1em;
-       margin-right:0
+#adminmenu li a:hover #awaiting-mod, #sidemenu li a:hover #update-plugins {
+       background-position: -160px top;
 }
-
-form#themeselector
-{
-       float:left
+/* 804 - 1004
+=================================== */
+#footer {
+       padding: 10px 60px 0 0;
 }
-
-.form-table input.tog
-{
-       float:right;
+.form-table th {
+       text-align:right;
+}
+.form-table input.tog {
        margin-right:0;
-       margin-left:2px;
+       margin-left: 2px;
+       float: right;
 }
-
-.curtime
-{
-       background-position:right 2px;
-       padding-left:0;
-       padding-right:18px;
+.form-table table.color-palette {
+       float:right;
 }
-
-#poststuff #edButtonPreview,#poststuff #edButtonHTML
-{
-       float:left;
-       margin-left:8px;
-       margin-right:0
+#pass-strength-result {
+       float:right;
+       margin-right:0;
+       margin-left: 5px;
 }
-
-#poststuff #media-buttons
-{
-       direction: ltr;
-       float:left;
-       margin-left:20px;
-       margin-right:0
+#profile-page .form-table #rich_editing {
+       margin-right:0;
+       margin-left: 5px;
 }
-
-#poststuff #media-buttons a
-{
-       margin-left:8px;
+#tagsdiv #newtag {
        margin-right:0;
-       padding: 0 5px 2px 2px;
+       margin-left: 5px;
 }
-
-#poststuff .togbox
-{
+#tagchecklist {
        margin-left:0;
-       margin-right:-19px
+       margin-right: 10px;
 }
-
-#categorydiv ul#category-tabs,#linkcategorydiv ul#category-tabs
-{
-       float:right;
-       margin:0 0 0 -120px;
-       text-align:left
+#tagchecklist strong {
+       margin-left:0;
+       margin-right: -8px;
+}
+#tagchecklist span {
+       margin-right:0;
+       margin-left: 25px;
+       float: right;
+}
+#tagchecklist span a {
+       margin: 6px -9px 0 0;
+       float: right;
+}
+/* 1005 - 1304
+=================================== */
+.ac_results li {
+       text-align:right;
+}
+#poststuff h2 {
+       clear:right;
+}
+#poststuff .postbox, #poststuff .stuffbox, #titlediv, #poststuff .postarea {
+       margin-left: 8px;
+       margin-right: 20px;
+}
+#edit-slug-buttons a.save {
+       margin-right:0;
+       margin-left:4px;
 }
-
-ul#category-tabs li.ui-tabs-selected,#poststuff .togbox
-{
+#poststuff #edButtonPreview, #poststuff #edButtonHTML {
+       margin: 5px 0 0 8px;
+       float: left;
+}
+#poststuff #media-buttons {
+       float: left;
+       margin-right:0;
+       margin-left: 20px;
+}
+#poststuff #media-buttons a {
+       padding: 0 2px 2px 5px;
+}
+#poststuff .togbox {
+       margin-left:0;
+       margin-right: -21px;
+       -moz-border-radius-topleft:0;
+       -khtml-border-top-left-radius:0;
+       -webkit-border-top-left-radius:0;
+       border-top-left-radius:0;
+       -moz-border-radius-topright: 3px;
+       -khtml-border-top-right-radius: 3px;
+       -webkit-border-top-right-radius: 3px;
+       border-top-right-radius: 3px;
+       -moz-border-radius-bottomleft: 0;
        -khtml-border-bottom-left-radius:0;
-       -khtml-border-bottom-right-radius:3px;
+       -webkit-border-bottom-left-radius:0;
+       border-bottom-left-radius:0;
+       -moz-border-radius-bottomright: 3px;
+       -khtml-border-bottom-right-radius: 3px;
+       -webkit-border-bottom-right-radius: 3px;
+       border-bottom-right-radius: 3px;
+}
+.submitbox .submitdelete {
+       margin-left:0;
+       margin-right:8px;
+}
+.submitbox .submit {
+       text-align:right;
+}
+.submitbox .submit input {
+       margin-right:0;
+       margin-left:3px;
+}
+#categorydiv #category-adder {
+       margin-left:0;
+       margin-right: 120px;
+}
+#categorydiv ul#category-tabs {
+       float: right;
+       text-align: left;
+       margin: 0 0 0 -120px;
+}
+ul#category-tabs li.ui-tabs-selected {
+       -moz-border-radius-topleft:0;
        -khtml-border-top-left-radius:0;
-       -khtml-border-top-right-radius:3px;
+       -webkit-border-top-left-radius:0;
+       border-top-left-radius:0;
        -moz-border-radius-bottomleft:0;
-       -moz-border-radius-bottomright:3px;
-       -moz-border-radius-topleft:0;
-       -moz-border-radius-topright:3px;
+       -khtml-border-bottom-left-radius:0;
        -webkit-border-bottom-left-radius:0;
-       -webkit-border-bottom-right-radius:3px;
-       -webkit-border-top-left-radius:0;
-       -webkit-border-top-right-radius:3px;
        border-bottom-left-radius:0;
-       border-bottom-right-radius:3px;
-       border-top-left-radius:0;
-       border-top-right-radius:3px
+       -moz-border-radius-topright: 3px;
+       -khtml-border-top-right-radius: 3px;
+       -webkit-border-top-right-radius: 3px;
+       border-top-right-radius: 3px;
+       -moz-border-radius-bottomright: 3px;
+       -khtml-border-bottom-right-radius: 3px;
+       -webkit-border-bottom-right-radius: 3px;
+       border-bottom-right-radius: 3px;
+}
+div.ui-tabs-panel {
+       margin: 0 120px 0 5px;
+}
+/* 1305 - elakh! :-)
+=================================== */
+#categorydiv ul.categorychecklist ul {
+       margin-left:0;
+       margin-right: 18px;
 }
-
-div.ui-tabs-panel
-{
-       margin:0 120px 0 0
+#linkcategorydiv #category-adder {
+       margin-left:0;
+       margin-right: 120px;
 }
-
-#tagchecklist span
-{
-       float:right;
-       margin-left:25px;
-       margin-right:0
+#linkcategorydiv ul#category-tabs {
+       float: right;
+       text-align: left;
+       margin: 0 0 0 -120px;
 }
-
-#tagchecklist span a {
-       margin: 6px -9px 0 0;
+#linkcategorydiv ul.categorychecklist ul {
+       margin-left:0;
+       margin-right: 18px;
+}
+p#tag-search, p#post-search {
+       right:auto;
+       left:0;
+}
+#posts-filter fieldset {
        float: right;
+       margin: 0 0 1em 1.5ex;
 }
-
-
-.tablenav .tablenav-pages
-{
-       float:left !important;
-       width:200px
-}
-
-.tablenav-pages .page-numbers
-{
-       display:block;
-       float:right
-}
-
-.side-info ul
-{
-       padding-left:0;
-       padding-right:18px
+#posts-filter fieldset legend {
+       padding: 0 1px .2em 0;
 }
-
-.form-table table.color-palette {
-       float:right;
+ul.view-switch {
+       float: left;
+       margin: -23px 0 -2px 5px;
 }
-
-#pass-strength-result
-{
-       float:right;
-       margin-right:0;
-       margin-left:5px;
-}
-
-td.comment p.comment-author img.avatar
-{
-       float:right !important;
-       margin-right:0 !important;
-       margin-left:8px !important;
-}
-
-#footer
-{
-       padding:10px 0 0
-}
-
-#footer p
-{
-       height:35px;
-       margin-right:20px;
-       padding:12px 40px 0 0;
-}
-
-#submenu,#wpbody
-{
-       clear:both;
+ul.view-switch li {
+       float: right;
 }
-
-#submenu li,ul.subsubsub li a
-{
-       padding:0;
+#the-comment-list td.comment p.comment-author {
+       margin-right: 0 ;
 }
-
-table.widefat th,.form-table th
-{
-       text-align:right
+#the-comment-list p.comment-author img {
+       float: right;
+       margin-right:0;
+       margin-left: 8px;
 }
-
-.widefat th input {
-       margin: 0 8px 0 0;
-       padding: 0;
+#the-comment-list td.comment p {
+       margin-left:0;
+       margin-right: 8px;
 }
-
-.available-theme,#tagchecklist span a
-{
-       float:right
+.curtime {
+       background-position: right 2px;
+       padding-left:0;
+       padding-right: 18px;
 }
-#template div {
+.tablenav .delete {
        margin-right:0;
-       margin-left:190px;
+       margin-left: 20px;
 }
-.submitbox .submit {
-       text-align:right;
+#tTips {
+}
+td.action-links, th.action-links {
+       text-align:left;
 }
-
-#editorcontainer {
-       border:1px solid;
+.info-box {
+       left:auto;
+       right: 50%;
+       margin-left: 0;
+       margin-right: -225px;
+}
+.info-box .gears-img {
+       float: left;
+}
+/* LTR
+=================================== */
+#edit-slug-box, #trackback, #metakeyinput, #post_password, #link_url, #link_image, #rss_uri, #category_nicename, #slug, #dbuser, #dbpass, #dbname, #dbprefix, #dccharset, #gmpath, #archivespath, #lastentry, #dbhost, #pages-exclude, #newcontent, #email, #newcomment_author_url, #siteurl, #home, #admin_email, #date_format, #time_format, #gmt_offset, #mailserver_url, #mailserver_port, #mailserver_login, #mailserver_pass, #ping_sites, #posts_per_page, #posts_per_rss, #blog_charset, #moderation_keys, #blacklist_keys, #comment_max_links, #permalink_structure, #category_base, #tag_base, #upload_path, #upload_url_path, #thumbnail_size_w, #thumbnail_size_h, #medium_size_w, #medium_size_h, #user_login, #url, #pass1, #pass2, #aim, #yim, #jabber, #key, #src, #hostname, #username, #password, #rules {
+       direction:ltr;
 }
-
-.wrap h2 {
-       margin: 5px -4px 0 0;
-       padding-right: 0px;
-       padding-left: 280px;
+/* TinyMCE
+=================================== */
+.clearlooks2 .mceTop .mceLeft {
+       width:100% !important;
 }
-
-div#message {
-       clear: both;
-}
\ No newline at end of file
index e2c39147f390a256e56c6ab179a0d6a66df1fdc6..c12bf4b46411b9ff8ac539ce0d40567ed5c77c12 100644 (file)
@@ -1,8 +1,9 @@
 <?php
 define('WP_INSTALLING', true);
-//These two defines are required to allow us to use require_wp_db() to load the database class while being wp-content/wp-db.php aware
+//These three defines are required to allow us to use require_wp_db() to load the database class while being wp-content/wp-db.php aware
 define('ABSPATH', dirname(dirname(__FILE__)).'/');
 define('WPINC', 'wp-includes');
+define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
 
 require_once('../wp-includes/compat.php');
 require_once('../wp-includes/functions.php');
@@ -20,6 +21,10 @@ if ( !is_writable('../'))
 if (file_exists('../wp-config.php'))
        wp_die("<p>The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='install.php'>installing now</a>.</p>");
 
+// Check if wp-config.php exists above the root directory
+if (file_exists('../../wp-config.php'))
+       wp_die("<p>The file 'wp-config.php' already exists one level above your WordPress installation. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='install.php'>installing now</a>.</p>");
+
 if (isset($_GET['step']))
        $step = $_GET['step'];
 else
@@ -57,7 +62,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 ISP. If you do not have this information, then you will need to contact them before you can continue. If you&#8217;re all ready&hellip;</p>
 
-<p><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" class="button">Let&#8217;s go!</a></p>
 <?php
        break;
 
@@ -68,34 +73,32 @@ switch($step) {
        <p>Below you should enter your database connection details. If you're not sure about these, contact your host. </p>
        <table class="form-table">
                <tr>
-                       <th scope="row">Database Name</th>
-                       <td><input name="dbname" type="text" size="25" value="wordpress" /></td>
+                       <th scope="row"><label for="dbname">Database Name</label></th>
+                       <td><input name="dbname" id="dbname" type="text" size="25" value="wordpress" /></td>
                        <td>The name of the database you want to run WP in. </td>
                </tr>
                <tr>
-                       <th scope="row">User Name</th>
-                       <td><input name="uname" type="text" size="25" value="username" /></td>
+                       <th scope="row"><label for="uname">User Name</label></th>
+                       <td><input name="uname" id="uname" type="text" size="25" value="username" /></td>
                        <td>Your MySQL username</td>
                </tr>
                <tr>
-                       <th scope="row">Password</th>
-                       <td><input name="pwd" type="text" size="25" value="password" /></td>
+                       <th scope="row"><label for="pwd">Password</label></th>
+                       <td><input name="pwd" id="pwd" type="text" size="25" value="password" /></td>
                        <td>...and MySQL password.</td>
                </tr>
                <tr>
-                       <th scope="row">Database Host</th>
-                       <td><input name="dbhost" type="text" size="25" value="localhost" /></td>
+                       <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>
                </tr>
                <tr>
-                       <th scope="row">Table Prefix</th>
-                       <td><input name="prefix" type="text" id="prefix" value="wp_" size="25" /></td>
+                       <th scope="row"><label for="prefix">Table Prefix</label></th>
+                       <td><input name="prefix" id="prefix" type="text" id="prefix" value="wp_" size="25" /></td>
                        <td>If you want to run multiple WordPress installations in a single database, change this.</td>
                </tr>
        </table>
-       <h2 class="step">
-       <input name="submit" type="submit" value="Submit" class="button" />
-       </h2>
+       <p class="step"><input name="submit" type="submit" value="Submit" class="button" /></p>
 </form>
 <?php
        break;
@@ -149,7 +152,7 @@ switch($step) {
 ?>
 <p>All right sparky! You've made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to&hellip;</p>
 
-<p><a href="install.php" class="button">Run the install</a></p>
+<p class="step"><a href="install.php" class="button">Run the install</a></p>
 <?php
        break;
 }
index f04eb75d9ab0759bdeb9f8615f17ef11497521fd..96adee981e9ea4f4f128d763bc9b300f6e6f38de 100644 (file)
@@ -14,8 +14,9 @@ if ('b' == $_GET['a']) {
 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=UTF-8" />
 <title><?php _e('WordPress &#8250; Posted'); ?></title>
 <?php
-wp_admin_css( 'css/global' );
-wp_admin_css();
+wp_admin_css( 'global', true );
+wp_admin_css( 'wp-admin', true );
+wp_admin_css( 'colors', true );
 ?>
 </head>
 <body>
@@ -32,8 +33,9 @@ wp_admin_css();
 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('blog_charset'); ?>" />
 <title><?php _e('WordPress &#8250; Sidebar'); ?></title>
 <?php
-wp_admin_css( 'css/global' );
-wp_admin_css();
+wp_admin_css( 'global', true );
+wp_admin_css( 'wp-admin', true );
+wp_admin_css( 'colors', true );
 ?>
 <style type="text/css" media="screen">
 form {
@@ -60,8 +62,8 @@ form {
 <input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
 <input type="hidden" name="mode" value="sidebar" />
 <?php wp_nonce_field('add-post'); ?>
-<p><?php _e('Title:'); ?>
-<input type="text" name="post_title" size="20" tabindex="1" style="width: 100%;" />
+<p><label for="post_title"><?php _e('Title:'); ?></label>
+<input type="text" name="post_title" id="post_title" size="20" tabindex="1" style="width: 100%;" />
 </p>
 <p><?php _e('Categories:'); ?>
 <span class="sidebar-categories">
@@ -69,8 +71,8 @@ form {
 </span>
 </p>
 <p>
-Post:
-<textarea rows="8" cols="12" style="width: 100%" name="content" tabindex="2"></textarea>
+<label for="content">Post:</label>
+<textarea rows="8" cols="12" style="width: 100%" name="content" id="content" tabindex="2"></textarea>
 </p>
 <p>
        <input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="<?php _e('Save as Draft'); ?>" />
index f17a48c118549928abddf16dc5896820053a6f17..fa16d7db760bb22acd86198a4b3a6f961300e5c8 100644 (file)
@@ -6,10 +6,7 @@ $parent_file = 'themes.php';
 
 wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file', 'theme'));
 
-add_action( 'admin_head', 'theme_editor_css' );
-function theme_editor_css(){
-       wp_admin_css( 'css/theme-editor' );
-}
+wp_admin_css( 'theme-editor' );
 
 $themes = get_themes();
 
@@ -46,10 +43,15 @@ case 'update':
        $newcontent = stripslashes($_POST['newcontent']);
        $theme = urlencode($theme);
        if (is_writeable($real_file)) {
+               //is_writable() not always reliable, check return value. see comments @ http://uk.php.net/is_writable
                $f = fopen($real_file, 'w+');
-               fwrite($f, $newcontent);
-               fclose($f);
-               $location = "theme-editor.php?file=$file&theme=$theme&a=te";
+               if ($f !== FALSE) {
+                       fwrite($f, $newcontent);
+                       fclose($f);
+                       $location = "theme-editor.php?file=$file&theme=$theme&a=te";
+               } else {
+                       $location = "theme-editor.php?file=$file&theme=$theme";
+               }
        } else {
                $location = "theme-editor.php?file=$file&theme=$theme";
        }
@@ -92,7 +94,7 @@ $desc_header = ( $description != $file_show ) ? "$description</strong> (%s)" : "
 <div class="bordertitle">
        <h2><?php _e('Theme Editor'); ?></h2>
        <form id="themeselector" name="theme" action="theme-editor.php" method="post">
-               <strong><?php _e('Select theme to edit:'); ?> </strong>
+               <strong><label for="theme"><?php _e('Select theme to edit:'); ?> </label></strong>
                <select name="theme" id="theme">
 <?php
        foreach ($themes as $a_theme) {
index cb8d082baec1b9e7fde346664ee692a604b2a43e..22c52cea32b53259971617406085989f57b9a189 100644 (file)
@@ -13,6 +13,10 @@ if ( isset($_GET['action']) ) {
 
 $title = __('Manage Themes');
 $parent_file = 'themes.php';
+
+add_thickbox();
+wp_enqueue_script( 'theme-preview' );
+
 require_once('admin-header.php');
 ?>
 
@@ -25,16 +29,38 @@ require_once('admin-header.php');
 <?php
 $themes = get_themes();
 $ct = current_theme_info();
+
+ksort( $themes );
+$theme_total = count( $themes );
+$per_page = 15;
+
+if ( isset( $_GET['pagenum'] ) )
+       $page = absint( $_GET['pagenum'] );
+
+if ( empty($page) )
+       $page = 1;
+
+$start = $offset = ( $page - 1 ) * $per_page;
+
+$page_links = paginate_links( array(
+       'base' => add_query_arg( 'pagenum', '%#%' ) . '#themenav',
+       'format' => '',
+       'total' => ceil($theme_total / $per_page),
+       'current' => $page
+));
+
+$themes = array_slice( $themes, $start, $per_page );
+
 ?>
 
 <div class="wrap">
 <h2><?php _e('Current Theme'); ?></h2>
-<div id="currenttheme">
+<div id="current-theme">
 <?php if ( $ct->screenshot ) : ?>
-<img src="<?php echo get_option('siteurl') . '/' . $ct->stylesheet_dir . '/' . $ct->screenshot; ?>" alt="<?php _e('Current theme preview'); ?>" />
+<img src="<?php echo WP_CONTENT_URL . $ct->stylesheet_dir . '/' . $ct->screenshot; ?>" alt="<?php _e('Current theme preview'); ?>" />
 <?php endif; ?>
 <h3><?php printf(_c('%1$s %2$s by %3$s|1: theme title, 2: theme version, 3: theme author'), $ct->title, $ct->version, $ct->author) ; ?></h3>
-<p><?php echo $ct->description; ?></p>
+<p class="description"><?php echo $ct->description; ?></p>
 <?php if ($ct->parent_theme) { ?>
        <p><?php printf(__('The template files are located in <code>%2$s</code>.  The stylesheet files are located in <code>%3$s</code>.  <strong>%4$s</strong> uses templates from <strong>%5$s</strong>.  Changes made to the templates will affect both themes.'), $ct->title, $ct->template_dir, $ct->stylesheet_dir, $ct->title, $ct->parent_theme); ?></p>
 <?php } else { ?>
@@ -46,17 +72,42 @@ $ct = current_theme_info();
 </div>
 
 <h2><?php _e('Available Themes'); ?></h2>
-<?php if ( 1 < count($themes) ) { ?>
+<br class="clear" />
+
+<?php if ( $page_links ) : ?>
+<div class="tablenav">
+<?php echo "<div class='tablenav-pages'>$page_links</div>"; ?>
+<br class="clear" />
+</div>
+<br class="clear" />
+<?php endif; ?>
 
+<?php if ( 1 < $theme_total ) { ?>
+<table id="availablethemes" cellspacing="0" cellpadding="0">
 <?php
 $style = '';
 
 $theme_names = array_keys($themes);
 natcasesort($theme_names);
 
-foreach ($theme_names as $theme_name) {
-       if ( $theme_name == $ct->name )
-               continue;
+$rows = ceil(count($theme_names) / 3);
+for ( $row = 1; $row <= $rows; $row++ )
+       for ( $col = 1; $col <= 3; $col++ )
+               $table[$row][$col] = array_shift($theme_names);
+
+foreach ( $table as $row => $cols ) {
+?>
+<tr>
+<?php
+foreach ( $cols as $col => $theme_name ) {
+       $class = array('available-theme');
+       if ( $row == 1 ) $class[] = 'top';
+       if ( $col == 1 ) $class[] = 'left';
+       if ( $row == $rows ) $class[] = 'bottom';
+       if ( $col == 3 ) $class[] = 'right';
+?>
+       <td class="<?php echo join(' ', $class); ?>">
+<?php if ( !empty($theme_name) ) :
        $template = $themes[$theme_name]['Template'];
        $stylesheet = $themes[$theme_name]['Stylesheet'];
        $title = $themes[$theme_name]['Title'];
@@ -65,26 +116,44 @@ foreach ($theme_names as $theme_name) {
        $author = $themes[$theme_name]['Author'];
        $screenshot = $themes[$theme_name]['Screenshot'];
        $stylesheet_dir = $themes[$theme_name]['Stylesheet Dir'];
+       $preview_link = clean_url( get_option('home') . '/');
+       $preview_link = add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true', 'width' => 600, 'height' => 400 ), $preview_link );
+       $preview_text = attribute_escape( sprintf( __('Preview of "%s"'), $title ) );
        $tags = $themes[$theme_name]['Tags'];
+       $thickbox_class = 'thickbox';
        $activate_link = wp_nonce_url("themes.php?action=activate&amp;template=".urlencode($template)."&amp;stylesheet=".urlencode($stylesheet), 'switch-theme_' . $template);
+       $activate_text = attribute_escape( sprintf( __('Activate "%s"'), $title ) );
 ?>
-<div class="available-theme">
-<h3><a href="<?php echo $activate_link; ?>"><?php echo $title; ?></a></h3>
-
-<a href="<?php echo $activate_link; ?>" class="screenshot">
+               <a href="<?php echo $activate_link; ?>" class="<?php echo $thickbox_class; ?> screenshot">
 <?php if ( $screenshot ) : ?>
-<img src="<?php echo get_option('siteurl') . '/' . $stylesheet_dir . '/' . $screenshot; ?>" alt="" />
+                       <img src="<?php echo WP_CONTENT_URL . $stylesheet_dir . '/' . $screenshot; ?>" alt="" />
 <?php endif; ?>
-</a>
-
-<p><?php echo $description; ?></p>
+               </a>
+               <h3><a class="<?php echo $thickbox_class; ?>" href="<?php echo $activate_link; ?>"><?php echo $title; ?></a></h3>
+               <p><?php echo $description; ?></p>
 <?php if ( $tags ) : ?>
-<p><?php _e('Tags:'); ?> <?php echo join(', ', $tags); ?></p>
+               <p><?php _e('Tags:'); ?> <?php echo join(', ', $tags); ?></p>
+               <noscript><p class="themeactions"><a href="<?php echo $preview_link; ?>" title="<?php echo $preview_text; ?>"><?php _e('Preview'); ?></a> <a href="<?php echo $activate_link; ?>" title="<?php echo $activate_text; ?>"><?php _e('Activate'); ?></a></p></noscript>
 <?php endif; ?>
+               <div style="display:none;"><a class="previewlink" href="<?php echo $preview_link; ?>"><?php echo $preview_text; ?></a> <a class="activatelink" href="<?php echo $activate_link; ?>"><?php echo $activate_text; ?></a></div>
+<?php endif; // end if not empty theme_name ?>
+       </td>
+<?php } // end foreach $cols ?>
+</tr>
+<?php } // end foreach $table ?>
+</table>
+<?php } ?>
+
+<br class="clear" />
+
+<?php if ( $page_links ) : ?>
+<div class="tablenav">
+<?php echo "<div class='tablenav-pages'>$page_links</div>"; ?>
+<br class="clear" />
 </div>
-<?php } // end foreach theme_names ?>
+<?php endif; ?>
 
-<?php } ?>
+<br class="clear" />
 
 <?php
 // List broken themes, if any.
index 6641279815381e6ba643c6eaa65b368d8f87f008..5fd02e062b7cae510b99d9546f6bc4860e07c83f 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-require_once('../wp-config.php');
+require_once('../wp-load.php');
 require_once( ABSPATH . 'wp-includes/class-snoopy.php');
 
 if ( !get_option('use_linksupdate') )
@@ -36,9 +36,9 @@ if ( false !== ( $fs = @fsockopen('api.pingomatic.com', 80, $errno, $errstr, 5)
        $returns = explode("\n", $body);
 
        foreach ($returns as $return) :
-               $time = $wpdb->escape( substr($return, 0, 19) );
-               $uri = $wpdb->escape( preg_replace('/(.*?) | (.*?)/', '$2', $return) );
-               $wpdb->query("UPDATE $wpdb->links SET link_updated = '$time' WHERE link_url = '$uri'");
+               $time = substr($return, 0, 19);
+               $uri = preg_replace('/(.*?) | (.*?)/', '$2', $return);
+               $wpdb->query( $wpdb->prepare("UPDATE $wpdb->links SET link_updated = %s WHERE link_url = %s", $time, $uri) );
        endforeach;
 }
 ?>
index 34e93804286aa0777d6266ebc38dc19ffa9e3881..c3cd28924a099a5b85a63a8b9567d2049991b9a1 100644 (file)
@@ -2,8 +2,8 @@
 
 require_once('admin.php');
 
-if ( !current_user_can('edit_plugins') )
-                wp_die('<p>'.__('You do not have sufficient permissions to update plugins for this blog.').'</p>');
+if ( ! current_user_can('update_plugins') )
+       wp_die(__('You do not have sufficient permissions to update plugins for this blog.'));
 
 function request_filesystem_credentials($form_post, $type = '', $error = false) {
        $req_cred = apply_filters('request_filesystem_credentials', '', $form_post, $type, $error);
@@ -22,7 +22,7 @@ function request_filesystem_credentials($form_post, $type = '', $error = false)
        $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? $_POST['hostname'] : $credentials['hostname']);
        $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? $_POST['username'] : $credentials['username']);
        $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? $_POST['password'] : $credentials['password']);
-       $credentials['ssl']      = defined('FTP_SSL')  ? FTP_SSL  : (!empty($_POST['ssl'])      ? $_POST['ssl']      : $credentials['ssl']);
+       $credentials['ssl']      = defined('FTP_SSL')  ? FTP_SSL  : ( isset($_POST['ssl'])      ? $_POST['ssl']      : $credentials['ssl']);
 
        if ( ! $error && !empty($credentials['password']) && !empty($credentials['username']) && !empty($credentials['hostname']) ) {
                $stored_credentials = $credentials;
@@ -45,19 +45,19 @@ function request_filesystem_credentials($form_post, $type = '', $error = false)
 <p><?php _e('To perform the requested update, FTP connection information is required.') ?></p>
 <table class="form-table">
 <tr valign="top">
-<th scope="row"><?php _e('Hostname:') ?></th>
+<th scope="row"><label for="hostname"><?php _e('Hostname:') ?></label></th>
 <td><input name="hostname" type="text" id="hostname" value="<?php echo attribute_escape($hostname) ?>"<?php if( defined('FTP_HOST') ) echo ' disabled="disabled"' ?> size="40" /></td>
 </tr>
 <tr valign="top">
-<th scope="row"><?php _e('Username:') ?></th>
+<th scope="row"><label for="username"><?php _e('Username:') ?></label></th>
 <td><input name="username" type="text" id="username" value="<?php echo attribute_escape($username) ?>"<?php if( defined('FTP_USER') ) echo ' disabled="disabled"' ?> size="40" /></td>
 </tr>
 <tr valign="top">
-<th scope="row"><?php _e('Password:') ?></th>
+<th scope="row"><label for="password"><?php _e('Password:') ?></label></th>
 <td><input name="password" type="password" id="password" value=""<?php if( defined('FTP_PASS') ) echo ' disabled="disabled"' ?> size="40" /><?php if( defined('FTP_PASS') && !empty($password) ) echo '<em>'.__('(Password not shown)').'</em>'; ?></td>
 </tr>
 <tr valign="top">
-<th scope="row"><?php _e('Use SSL:') ?></th>
+<th scope="row"><label for="ssl"><?php _e('Use SSL:') ?></label></th>
 <td>
 <select name="ssl" id="ssl"<?php if( defined('FTP_SSL') ) echo ' disabled="disabled"' ?>>
 <?php
@@ -110,15 +110,16 @@ function do_plugin_upgrade($plugin) {
                return;
        }
 
-       $was_activated = is_plugin_active($plugin); //Check now, It'll be deactivated by the next line if it is,
+       $was_activated = is_plugin_active($plugin); //Check now, It'll be deactivated by the next line if it is
 
        $result = wp_update_plugin($plugin, 'show_message');
 
        if ( is_wp_error($result) ) {
                show_message($result);
+               show_message( __('Installation Failed') );
        } else {
-               //Result is the new plugin file relative to PLUGINDIR
-               show_message(__('Plugin upgraded successfully'));       
+               //Result is the new plugin file relative to WP_PLUGIN_DIR
+               show_message( __('Plugin upgraded successfully') );     
                if( $result && $was_activated ){
                        show_message(__('Attempting reactivation of the plugin'));
                        echo '<iframe style="border:0" width="100%" height="170px" src="' . wp_nonce_url('update.php?action=activate-plugin&plugin=' . $result, 'activate-plugin_' . $result) .'"></iframe>';
@@ -151,8 +152,8 @@ if ( isset($_GET['action']) ) {
 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
 <title><?php bloginfo('name') ?> &rsaquo; <?php _e('Plugin Reactivation'); ?> &#8212; <?php _e('WordPress'); ?></title>
 <?php
-wp_admin_css( 'css/global' );
-wp_admin_css( 'css/colors' );
+wp_admin_css( 'global', true );
+wp_admin_css( 'colors', true );
 ?>
 </head>
 <body>
@@ -164,7 +165,7 @@ wp_admin_css( 'css/colors' );
                        echo '<p>' . __('Plugin failed to reactivate due to a fatal error.') . '</p>';
                        error_reporting( E_ALL ^ E_NOTICE );
                        @ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
-                       include(ABSPATH . PLUGINDIR . '/' . $plugin);
+                       include(WP_PLUGIN_DIR . '/' . $plugin);
                }
                echo "</body></html>";
        }
index 67618d0aff1b45716e8337804e2f106f17a44d05..cf5c30516df12518edb879ce461811d1d7bd84d3 100644 (file)
@@ -1,9 +1,7 @@
 <?php
 define('WP_INSTALLING', true);
-if (!file_exists('../wp-config.php'))
-       die("There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://codex.wordpress.org/Installing_WordPress#Step_3:_Set_up_wp-config.php'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.</p><p><a href='setup-config.php' class='button'>Create a Configuration File</a>");
 
-require('../wp-config.php');
+require('../wp-load.php');
 timer_start();
 require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
 
@@ -18,7 +16,7 @@ else
 <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( 'css/install' ); ?>
+       <?php wp_admin_css( 'install', true ); ?>
 </head>
 <body>
 <h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
@@ -27,7 +25,7 @@ else
 
 <h2><?php _e('No Upgrade Required'); ?></h2>
 <p><?php _e('Your WordPress database is already up-to-date!'); ?></p>
-<h2 class="step"><a href="<?php echo get_option('home'); ?>/"><?php _e('Continue'); ?></a></h2>
+<p class="step"><a class="button" href="<?php echo get_option('home'); ?>/"><?php _e('Continue'); ?></a></p>
 
 <?php else :
 switch($step) :
@@ -39,7 +37,7 @@ switch($step) :
 <h2><?php _e('Database Upgrade Required'); ?></h2>
 <p><?php _e('Your WordPress database is out-of-date, and must be upgraded before you can continue.'); ?></p>
 <p><?php _e('The upgrade process may take a while, so please be patient.'); ?></p>
-<h2 class="step"><a href="upgrade.php?step=1&amp;backto=<?php echo $goback; ?>"><?php _e('Upgrade WordPress'); ?></a></h2>
+<p class="step"><a class="button" href="upgrade.php?step=1&amp;backto=<?php echo $goback; ?>"><?php _e('Upgrade WordPress'); ?></a></p>
 <?php
                break;
        case 1:
@@ -54,7 +52,7 @@ switch($step) :
 ?>
 <h2><?php _e('Upgrade Complete'); ?></h2>
        <p><?php _e('Your WordPress database has been successfully upgraded!'); ?></p>
-       <h2 class="step"><a href="<?php echo $backto; ?>"><?php _e('Continue'); ?></a></h2>
+       <p class="step"><a class="button" href="<?php echo $backto; ?>"><?php _e('Continue'); ?></a></p>
 
 <!--
 <pre>
index 0f7412dea5861353a6cbe940e1a13c70c182de48..cf6c1916cbaeec4e2b1c22c0809c5961ad4c9099 100644 (file)
@@ -125,6 +125,7 @@ endif;
 ?>
 
 <p id="post-search">
+       <label class="hidden" for="post-search-input"><?php _e( 'Search Media' ); ?>:</label>
        <input type="text" id="post-search-input" name="s" value="<?php the_search_query(); ?>" />
        <input type="submit" value="<?php _e( 'Search Media' ); ?>" class="button" />
 </p>
@@ -211,7 +212,7 @@ if ( $page_links )
  
 if ( 1 == count($posts) && is_singular() ) :
        
-       $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
+       $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);
index 9c298dda30cfe7b3e6de072686d4a03d86a50e57..e7a30cd5150edbfb25a6f5bfd60d5dbb5ffa1685 100644 (file)
@@ -41,6 +41,18 @@ function profile_js ( ) {
                }
 
        }
+       
+       function update_nickname ( ) {
+               
+               var nickname = jQuery('#nickname').val();
+               var display_nickname = jQuery('#display_nickname').val();
+               
+               if ( nickname == '' ) {
+                       jQuery('#display_nickname').remove();
+               }
+               jQuery('#display_nickname').val(nickname).html(nickname);
+               
+       }
 
        jQuery(function($) { 
                $('#pass1').keyup( check_pass_strength ) 
@@ -49,6 +61,7 @@ function profile_js ( ) {
        
        jQuery(document).ready( function() {
                jQuery('#pass1,#pass2').attr('autocomplete','off');
+               jQuery('#nickname').blur(update_nickname);
     });
 </script>
 <?php
@@ -162,9 +175,9 @@ include ('admin-header.php');
 <?php endif; ?>
 <tr>
 <th scope="row"><?php _e('Admin Color Scheme')?></th>
-<td>
+<td><fieldset><legend class="hidden"><?php _e('Admin Color Scheme')?></legend>
 <?php
-$current_color = get_user_option('admin_color');
+$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 ): ?>
@@ -181,7 +194,7 @@ foreach ( $_wp_admin_css_colors as $color => $color_info ): ?>
        <label for="admin_color_<?php echo $color; ?>"><?php echo $color_info->name ?></label>
 </div>
 <?php endforeach; ?>
-</td>
+</fieldset></td>
 </tr>
 </table>
 
@@ -245,16 +258,16 @@ echo $role_list . '</select></td></tr>';
                <select name="display_name" id="display_name">
                <?php
                        $public_display = array();
-                       $public_display[] = $profileuser->display_name;
-                       $public_display[] = $profileuser->nickname;
-                       $public_display[] = $profileuser->user_login;
-                       $public_display[] = $profileuser->first_name;
-                       $public_display[] = $profileuser->first_name.' '.$profileuser->last_name;
-                       $public_display[] = $profileuser->last_name.' '.$profileuser->first_name;
+                       $public_display['display_displayname'] = $profileuser->display_name;
+                       $public_display['display_nickname'] = $profileuser->nickname;
+                       $public_display['display_username'] = $profileuser->user_login;
+                       $public_display['display_firstname'] = $profileuser->first_name;
+                       $public_display['display_firstlast'] = $profileuser->first_name.' '.$profileuser->last_name;
+                       $public_display['display_lastfirst'] = $profileuser->last_name.' '.$profileuser->first_name;
                        $public_display = array_unique(array_filter(array_map('trim', $public_display)));
-                       foreach($public_display as $item) {
+                       foreach($public_display as $id => $item) {
                ?>
-                       <option value="<?php echo $item; ?>"><?php echo $item; ?></option>
+                       <option id="<?php echo $id; ?>" value="<?php echo $item; ?>"><?php echo $item; ?></option>
                <?php
                        }
                ?>
@@ -305,11 +318,11 @@ $show_password_fields = apply_filters('show_password_fields', true);
 if ( $show_password_fields ) :
 ?>
 <tr>
-       <th><label for="pass1"><?php _e('New Password:'); ?></label></th>
+       <th><label for="pass1"><?php _e('New Password'); ?></label></th>
        <td><input type="password" name="pass1" id="pass1" size="16" value="" /> <?php _e("If you would like to change the password type a new one. Otherwise leave this blank."); ?><br />
                <input type="password" name="pass2" id="pass2" size="16" value="" /> <?php _e("Type your new password again."); ?><br />
                <?php if ( $is_profile_page ): ?>
-               <p><strong><?php _e('Password Strength:'); ?></strong></p>
+               <p><strong><?php _e('Password Strength'); ?></strong></p>
                <div id="pass-strength-result"><?php _e('Too short'); ?></div> <?php _e('Hint: Use upper and lower case characters, numbers and symbols like !"?$%^&amp;( in your password.'); ?>
                <?php endif; ?>
        </td>
@@ -329,7 +342,7 @@ if ( $show_password_fields ) :
 <br class="clear" />
        <table width="99%" style="border: none;" cellspacing="2" cellpadding="3" class="editform">
                <tr>
-                       <th scope="row"><?php _e('Additional Capabilities:') ?></th>
+                       <th scope="row"><?php _e('Additional Capabilities') ?></th>
                        <td><?php
                        $output = '';
                        foreach($profileuser->caps as $cap => $value) {
index d8089b4cd884c4f90411348bd646d87d301151aa..f032e4139191d8ec82b0a0b50c3c65979fa7acc2 100644 (file)
@@ -145,13 +145,13 @@ case 'delete':
        ?>
        </ul>
 <?php if ( $go_delete ) : ?>
-       <p><?php _e('What should be done with posts and links owned by this user?'); ?></p>
+       <fieldset><p><legend><?php _e('What should be done with posts and links owned by this user?'); ?></legend></p>
        <ul style="list-style:none;">
                <li><label><input type="radio" id="delete_option0" name="delete_option" value="delete" checked="checked" />
                <?php _e('Delete all posts and links.'); ?></label></li>
                <li><input type="radio" id="delete_option1" name="delete_option" value="reassign" />
                <?php echo '<label for="delete_option1">'.__('Attribute all posts and links to:')."</label> $user_dropdown"; ?></li>
-       </ul>
+       </ul></fieldset>
        <input type="hidden" name="action" value="dodelete" />
        <p class="submit"><input type="submit" name="submit" value="<?php _e('Confirm Deletion'); ?>" class="button-secondary" /></p>
 <?php else : ?>
@@ -287,6 +287,7 @@ unset($role_links);
 ?>
 </ul>
        <p id="post-search">
+       <label class="hidden" for="post-search-input"><?php _e( 'Search Users' ); ?>:</label>
        <input type="text" id="post-search-input" name="usersearch" value="<?php echo attribute_escape($wp_user_search->search_term); ?>" />
        <input type="submit" value="<?php _e( 'Search Users' ); ?>" class="button" />
        </p>
@@ -299,7 +300,7 @@ unset($role_links);
 
 <div class="alignleft">
 <input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
-<select name="new_role"><option value=''><?php _e('Change role to&hellip;') ?></option>"<?php wp_dropdown_roles(); ?></select>
+<label class="hidden" for="new_role"><?php _e('Change role to&hellip;') ?></label><select name="new_role" id="new_role"><option value=''><?php _e('Change role to&hellip;') ?></option>"<?php wp_dropdown_roles(); ?></select>
 <input type="submit" value="<?php _e('Change'); ?>" name="changeit" class="button-secondary" />
 <?php wp_nonce_field('bulk-users'); ?>
 </div>
@@ -330,7 +331,7 @@ unset($role_links);
 <table class="widefat">
 <thead>
 <tr class="thead">
-       <th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('posts-filter'));" /> </th>
+       <th scope="col" class="check-column"><input type="checkbox" /></th>
        <th><?php _e('Username') ?></th>
        <th><?php _e('Name') ?></th>
        <th><?php _e('E-mail') ?></th>
@@ -395,37 +396,37 @@ foreach ( $wp_user_search->get_results() as $userid ) {
 
 <?php
        if ( get_option('users_can_register') )
-               echo '<p>' . sprintf(__('Users can <a href="%1$s">register themselves</a> or you can manually create users here.'), get_option('siteurl').'/wp-register.php') . '</p>';
+               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.'), get_option('siteurl').'/wp-admin/options-general.php#users_can_register') . '</p>';
+               echo '<p>' . sprintf(__('Users cannot currently <a href="%1$s">register themselves</a>, but you can manually create users here.'), admin_url('options-general.php#users_can_register')) . '</p>';
 ?>
 <form action="#add-new-user" method="post" name="adduser" id="adduser" class="add:users: validate">
 <?php wp_nonce_field('add-user') ?>
 <table class="form-table">
        <tr class="form-field form-required">
-               <th scope="row"><?php _e('Username (required)') ?><input name="action" type="hidden" id="action" value="adduser" /></th>
-               <td ><input name="user_login" type="text" id="user_login" value="<?php echo $new_user_login; ?>" /></td>
+               <th scope="row"><label for="user_login"><?php _e('Username (required)') ?></label><input name="action" type="hidden" id="action" value="adduser" /></th>
+               <td ><input name="user_login" type="text" id="user_login" value="<?php echo $new_user_login; ?>" aria-required="true" /></td>
        </tr>
        <tr class="form-field">
-               <th scope="row"><?php _e('First Name') ?> </th>
+               <th scope="row"><label for="first_name"><?php _e('First Name') ?> </label></th>
                <td><input name="first_name" type="text" id="first_name" value="<?php echo $new_user_firstname; ?>" /></td>
        </tr>
        <tr class="form-field">
-               <th scope="row"><?php _e('Last Name') ?> </th>
+               <th scope="row"><label for="last_name"><?php _e('Last Name') ?> </label></th>
                <td><input name="last_name" type="text" id="last_name" value="<?php echo $new_user_lastname; ?>" /></td>
        </tr>
        <tr class="form-field form-required">
-               <th scope="row"><?php _e('E-mail (required)') ?></th>
+               <th scope="row"><label for="email"><?php _e('E-mail (required)') ?></label></th>
                <td><input name="email" type="text" id="email" value="<?php echo $new_user_email; ?>" /></td>
        </tr>
        <tr class="form-field">
-               <th scope="row"><?php _e('Website') ?></th>
+               <th scope="row"><label for="url"><?php _e('Website') ?></label></th>
                <td><input name="url" type="text" id="url" value="<?php echo $new_user_uri; ?>" /></td>
        </tr>
 
 <?php if ( apply_filters('show_password_fields', true) ) : ?>
        <tr class="form-field form-required">
-               <th scope="row"><?php _e('Password (twice)') ?> </th>
+               <th scope="row"><label for="pass1"><?php _e('Password (twice)') ?> </label></th>
                <td><input name="pass1" type="password" id="pass1" />
                <br />
                <input name="pass2" type="password" id="pass2" /></td>
@@ -433,7 +434,7 @@ foreach ( $wp_user_search->get_results() as $userid ) {
 <?php endif; ?>
 
        <tr class="form-field">
-               <th scope="row"><?php _e('Role'); ?></th>
+               <th scope="row"><label for="role"><?php _e('Role'); ?></label></th>
                <td><select name="role" id="role">
                        <?php
                        if ( !$new_user_role )
index 83264e4351acd719e936e7a4da547579984a0594..74922767f8f698e3eb366c76cc3738c670630e06 100644 (file)
@@ -7,6 +7,7 @@ if ( ! current_user_can('switch_themes') )
        wp_die( __( 'Cheatin&#8217; uh?' ));
 
 wp_enqueue_script( array( 'wp-lists', 'admin-widgets' ) );
+wp_admin_css( 'widgets' );
 
 do_action( 'sidebar_admin_setup' );
 
@@ -134,7 +135,9 @@ if ( isset($_GET['add']) && $_GET['add'] ) {
                
                        <ul class="widget-control-list">
                                <li class="widget-list-control-item">
+                                       <div class="widget-top">
                                        <h4 class="widget-title"><?php echo $control['name']; ?></h4>
+                                       </div>
                                        <div class="widget-control" style="display: block;">
        <?php
                                                call_user_func_array( $control_callback, $control['params'] );
@@ -232,15 +235,16 @@ if ( isset($_GET['message']) && isset($messages[$_GET['message']]) ) : ?>
 
        <h2><?php _e( 'Widgets' ); ?></h2>
        <p id="widget-search">
+               <label class="hidden" for="widget-search-input"><?php _e( 'Search Widgets' ); ?>:</label>
                <input type="text" id="widget-search-input" name="s" value="<?php echo attribute_escape( $widget_search ); ?>" />
                <input type="submit" class="button" value="<?php _e( 'Search Widgets' ); ?>" />
        </p>
 
        <div class="widget-liquid-left-holder">
        <div id="available-widgets-filter" class="widget-liquid-left">
-               <h3><?php _e('Available Widgets'); ?></h3>
+               <h3><label for="show"><?php _e('Available Widgets'); ?></label></h3>
                <div class="nav">
-                       <select name="show">
+                       <select name="show" id="show">
 <?php foreach ( $show_values as $show_value => $show_text ) : $show_value = attribute_escape( $show_value ); ?>
                                <option value='<?php echo $show_value; ?>'<?php selected( $show_value, $show ); ?>><?php echo wp_specialchars( $show_text ); ?></option>
 <?php endforeach; ?>
@@ -254,7 +258,7 @@ if ( isset($_GET['message']) && isset($messages[$_GET['message']]) ) : ?>
        </div>
 
        <div id="available-sidebars" class="widget-liquid-right">
-               <h3><?php _e('Current Widgets'); ?></h3>
+               <h3><label for="sidebar-selector"><?php _e('Current Widgets'); ?></label></h3>
 
                <div class="nav">
                        <select id="sidebar-selector" name="sidebar">
index 7a9283ca1975280880e52ff512ca7efb452bbf10..0699a87b923d4435d23e20bab9be72be9751da92 100644 (file)
@@ -1,13 +1,13 @@
-#plugins .name {
+.plugins .name {
        font-weight: bold;
 }
 
-#plugins p {
+.plugins p {
        margin: 0 4px;
        padding: 0;
 }
 
-#plugins .togl {
+.plugins .togl {
        width: 150px;
        border-right-width: 1px;
        border-right-style: solid;
@@ -52,28 +52,90 @@ form#upload #post_content {
        margin: 10px 20px 10px 20px;
 }
 
-.available-theme {
-       width: 30%;
-       margin: 0 1em;
-       float: left;
-       text-align: center;
-       height: 28em;
-       overflow: hidden;
+table#availablethemes {
+       border-spacing: 0px;
+       border: none;
+       border-top: 1px solid #ccc;
+       border-bottom: 1px solid #ccc;
+       margin: 10px auto;
+}
+td.available-theme {
+       vertical-align: top;
+       width: 240px;
+       margin: 0;
+       padding: 20px;
+       text-align: left;
+}
+table#availablethemes td {
+       border: 1px solid #eee;
+       border-top: none;
+}
+table#availablethemes td.top {
+       border-top: none;
+}
+table#availablethemes td.right {
+       border-right: none;
+       border-left: none;
+}
+table#availablethemes td.bottom {
+       border-bottom: none;
+}
+table#availablethemes td.left {
+       border-right: none;
+       border-left: none;
 }
 
 .available-theme a.screenshot {
-       width: 250px;
-       height: 200px;
+       width: 240px;
+       height: 180px;
        display: block;
-       margin: auto;
+       border: 1px solid #efefef;
        margin-bottom: 10px;
        overflow: hidden;
-       border-width: 1px;
-       border-style: solid;
 }
-
 .available-theme img {
-       width: 100%;
+       width: 240px;
+}
+.available-theme h3 {
+       margin: 15px 0 5px;
+}
+
+#current-theme {
+       margin-top: 1em;
+}
+
+#current-theme a {
+       border-bottom: none;
+}
+
+#current-theme h3 {
+       font-size: 17px;
+       font-weight: normal;
+       margin: 0;
+}
+
+#current-theme .description {
+       margin-top: 5px;
+}
+
+#current-theme img {
+       float: left;
+       border: 1px solid #666;
+       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;
+       color: #999;
+       text-decoration: none;
+}
+
+#TB_window #TB_title a.tb-theme-preview-link:hover,
+#TB_window #TB_title a.tb-theme-preview-link:focus {
+       color: #ccc;
 }
 
 .checkbox {
@@ -249,15 +311,6 @@ textarea.all-options, input.all-options {
        border-collapse: separate;
 }
 
-#currenttheme img {
-       float: left;
-       margin-right: 1em;
-       margin-bottom: 1.5em;
-       width: 300px;
-       border-width: 1px;
-       border-style: solid;
-}
-
 #quicktags {
        padding: 0;
        border: 0 none;
@@ -394,26 +447,6 @@ set display:none; */
        height: 22px;
 }
 
-#your-profile fieldset {
-       border-width: 1px;
-       border-style: solid;
-       float: left;
-       width: 40%;
-       padding: .5em 2em 1em;
-       margin: 1em 1em 1em 0;
-}
-
-#your-profile fieldset input {
-       width: 100%;
-       font-size: 20px;
-       padding: 2px;
-}
-
-#your-profile fieldset textarea {
-       width: 100%;
-       padding: 2px;
-}
-
 #your-profile legend {
        font-family: Georgia, "Times New Roman", Times, serif;
        font-size: 22px;
@@ -567,7 +600,7 @@ a.view-comment-post-link {
        border-top-style: solid;
 }
 
-#wphead a, #dashmenu a, #adminmenu a, #submenu a, #sidemenu a {
+#wphead a, #dashmenu a, #adminmenu a, #submenu a, #sidemenu a, #taglist a, #catlist a {
        text-decoration: none;
 }
 
@@ -694,7 +727,7 @@ a.view-comment-post-link {
        padding: 0 0 8px 17px;
 }
 
-#adminmenu li a #awaiting-mod {
+#adminmenu li a #awaiting-mod, #sidemenu li a #update-plugins {
        position: absolute;
        margin-left: -0.4em;
        margin-top: 0.2em;
@@ -705,7 +738,7 @@ a.view-comment-post-link {
        width: 1em;
 }
 
-#adminmenu li a .count-0 {
+#adminmenu li a .count-0, #sidemenu li a .count-0 {
        display: none;
 }
 
@@ -745,11 +778,11 @@ strong .post-com-count {
        background-position: center -3px;
 }
 
-#adminmenu li a:hover #awaiting-mod {
+#adminmenu li a:hover #awaiting-mod, #sidemenu li a:hover #update-plugins {
        background-position: -80px bottom;
 }
 
-#adminmenu li a #awaiting-mod span {
+#adminmenu li a #awaiting-mod span, #sidemenu li a #update-plugins span {
        top: -0.8em;
        right: 0;
        position: absolute;
@@ -894,6 +927,24 @@ html, body {
        margin-right: 5px
 }
 
+.form-table .pre {
+       padding: 8px;
+       margin: 0;
+}
+
+.pre {
+       /* http://www.longren.org/2006/09/27/wrapping-text-inside-pre-tags/ */
+       white-space: pre-wrap; /* css-3 */
+       white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
+       white-space: -pre-wrap; /* Opera 4-6 */
+       white-space: -o-pre-wrap; /* Opera 7 */
+       word-wrap: break-word; /* Internet Explorer 5.5+ */
+}
+
+table.form-table td .updated {
+       font-size: 13px;
+}
+
 /* Post Screen */
 
 #tagsdiv #newtag {
@@ -970,6 +1021,7 @@ html, body {
        font-size: 1.5em;
        margin-bottom: 15px;
        padding: 0 0 3px;
+       clear: left;
 }
 
 #poststuff h3 {
@@ -1341,6 +1393,11 @@ p#post-search {
        vertical-align:text-top;
 }
 
+.defaultavatarpicker .avatar {
+       margin: 2px 0;
+       vertical-align: middle;
+}
+
 body.minwidth {
        min-width: 808px;
 }
@@ -1464,3 +1521,92 @@ td.action-links, th.action-links {
 .hide-if-no-js {
        display: none;
 }
+
+/* Diff */
+
+table.diff {
+       width: 100%;
+}
+
+table.diff col.content {
+       width: 50%;
+}
+
+table.diff tr {
+       background-color: transparent;
+}
+
+table.diff td, table.diff th {
+       padding: .5em;
+       font-family: monospace;
+       border: none;
+}
+
+table.diff .diff-deletedline del, table.diff .diff-addedline ins {
+       text-decoration: none;
+}
+
+#wp-word-count {
+       display: block;
+}
+
+fieldset {
+       border: 0;
+       padding: 0;
+       margin: 0;
+}
+
+.info-box {
+       top: 100px;
+       left: 50%;
+       margin-left: -225px;
+       height: 300px;
+       width: 450px;
+       border: 5px solid #ddd;
+       background: #f8f8f8;
+       position: absolute;
+       padding: 15px 15px 10px;
+       z-index: 1000;
+       display: none;
+}
+
+.info-box .submit {
+       position: absolute;
+       bottom: 15px;
+       width: 450px;
+       padding: 15px 0 0;
+}
+
+.info-box .gears-img {
+       float: right;
+       margin: 10px;
+}
+
+.info-box-title {
+       line-height: 2;
+       margin: 0;
+       padding: 0 7px;
+}
+
+#wp_editbtns {
+       padding: 2px;
+       position: absolute;
+       display: none;
+       z-index: 999998;
+}
+
+#wp_editimgbtn, #wp_delimgbtn {
+       margin: 2px;
+       padding: 2px;
+       border: 1px solid #999;
+       background-color: #eee;
+       -moz-border-radius: 3px;
+       -khtml-border-radius: 3px;
+       -webkit-border-radius: 3px;
+       border-radius: 3px;
+}
+
+#wp_editimgbtn:hover, #wp_delimgbtn:hover {
+       border-color: #555;
+       background-color: #ccc;
+}
index 52ce7b73ecc5722429edb4ca6f334f8b711edcbe..8244dab30d4843948bd21e4336500d09f825b4e2 100644 (file)
@@ -1,26 +1,60 @@
 <?php
-/*
- * wp-app.php - Atom Publishing Protocol support for WordPress
- * Original code by: Elias Torres, http://torrez.us/archives/2006/08/31/491/
- * Modified by: Dougal Campbell, http://dougal.gunters.org/
+/**
+ * Atom Publishing Protocol support for WordPress
  *
- * Version: 1.0.5-dc
+ * @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
  */
 
+/**
+ * WordPress is handling an Atom Publishing Protocol request.
+ *
+ * @var bool
+ */
 define('APP_REQUEST', true);
 
-require_once('./wp-config.php');
+/** Set up WordPress environment */
+require_once('./wp-load.php');
+
+/** Post Template API */
 require_once(ABSPATH . WPINC . '/post-template.php');
+
+/** Atom Publishing Protocol Class */
 require_once(ABSPATH . WPINC . '/atomlib.php');
+
+/** Feed Handling API */
 require_once(ABSPATH . WPINC . '/feed.php');
 
 $_SERVER['PATH_INFO'] = preg_replace( '/.*\/wp-app\.php/', '', $_SERVER['REQUEST_URI'] );
 
+/**
+ * Whether to enable Atom Publishing Protocol Logging.
+ *
+ * @name app_logging
+ * @var int|bool
+ */
 $app_logging = 0;
 
-// TODO: Should be an option somewhere
+/**
+ * Whether to always authenticate user. Permanently set to true.
+ *
+ * @name always_authenticate
+ * @var int|bool
+ * @todo Should be an option somewhere
+ */
 $always_authenticate = 1;
 
+/**
+ * log_app() - Writes logging info to a file.
+ *
+ * @uses $app_logging
+ * @package WordPress
+ * @subpackage Logging
+ *
+ * @param string $label Type of logging
+ * @param string $msg Information describing logging reason.
+ */
 function log_app($label,$msg) {
        global $app_logging;
        if ($app_logging) {
@@ -32,6 +66,18 @@ function log_app($label,$msg) {
 }
 
 if ( !function_exists('wp_set_current_user') ) :
+/**
+ * wp_set_current_user() - Sets the current WordPress User
+ *
+ * Pluggable function which is also found in pluggable.php.
+ *
+ * @see wp-includes/pluggable.php Documentation for this function.
+ * @uses $current_user Global of current user to test whether $id is the same.
+ *
+ * @param int $id The user's ID
+ * @param string $name Optional. The username of the user.
+ * @return WP_User Current user's User object
+ */
 function wp_set_current_user($id, $name = '') {
        global $current_user;
 
@@ -44,13 +90,26 @@ function wp_set_current_user($id, $name = '') {
 }
 endif;
 
+/**
+ * wa_posts_where_include_drafts_filter() - Filter to add more post statuses
+ *
+ * @param string $where SQL statement to filter
+ * @return string Filtered SQL statement with added post_status for where clause
+ */
 function wa_posts_where_include_drafts_filter($where) {
-        $where = str_replace("post_status = 'publish'","post_status = 'publish' OR post_status = 'future' OR post_status = 'draft' OR post_status = 'inherit'", $where);
-        return $where;
+       $where = str_replace("post_status = 'publish'","post_status = 'publish' OR post_status = 'future' OR post_status = 'draft' OR post_status = 'inherit'", $where);
+       return $where;
 
 }
 add_filter('posts_where', 'wa_posts_where_include_drafts_filter');
 
+/**
+ * @internal
+ * Left undocumented to work on later. If you want to finish, then please do so.
+ *
+ * @package WordPress
+ * @subpackage Publishing
+ */
 class AtomServer {
 
        var $ATOM_CONTENT_TYPE = 'application/atom+xml';
@@ -113,7 +172,11 @@ class AtomServer {
        function handle_request() {
                global $always_authenticate;
 
-               $path = $_SERVER['PATH_INFO'];
+               if( !empty( $_SERVER['ORIG_PATH_INFO'] ) )
+                       $path = $_SERVER['ORIG_PATH_INFO'];
+               else
+                       $path = $_SERVER['PATH_INFO']; 
+
                $method = $_SERVER['REQUEST_METHOD'];
 
                log_app('REQUEST',"$method $path\n================");
@@ -132,6 +195,10 @@ class AtomServer {
                        $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') ) );
+
                // dispatch
                foreach($this->selectors as $regex => $funcs) {
                        if(preg_match($regex, $path, $matches)) {
@@ -139,9 +206,7 @@ class AtomServer {
 
                                // authenticate regardless of the operation and set the current
                                // user. each handler will decide if auth is required or not.
-                               $this->authenticate();
-                               $u = wp_get_current_user();
-                               if(!isset($u) || $u->ID == 0) {
+                               if(!$this->authenticate()) {
                                        if ($always_authenticate) {
                                                $this->auth_required('Credentials required.');
                                        }
@@ -170,9 +235,9 @@ class AtomServer {
                $entries_url = attribute_escape($this->get_entries_url());
                $categories_url = attribute_escape($this->get_categories_url());
                $media_url = attribute_escape($this->get_attachments_url());
-                foreach ($this->media_content_types as $med) {
-                  $accepted_media_types = $accepted_media_types . "<accept>" . $med . "</accept>";
-                }
+               foreach ($this->media_content_types as $med) {
+                       $accepted_media_types = $accepted_media_types . "<accept>" . $med . "</accept>";
+               }
                $atom_prefix="atom";
                $atom_blogname=get_bloginfo('name');
                $service_doc = <<<EOD
@@ -327,6 +392,7 @@ EOD;
                        $this->auth_required(__('Sorry, you do not have the right to edit this post.'));
 
                $publish = (isset($parsed->draft) && trim($parsed->draft) == 'yes') ? false : true;
+               $post_status = ($publish) ? 'publish' : 'draft';
 
                extract($entry);
 
@@ -340,13 +406,6 @@ EOD;
                $post_modified = $pubtimes[0];
                $post_modified_gmt = $pubtimes[1];
 
-               // let's not go backwards and make something draft again.
-               if(!$publish && $post_status == 'draft') {
-                       $post_status = ($publish) ? 'publish' : 'draft';
-               } elseif($publish) {
-                       $post_status = 'publish';
-               }
-
                $postdata = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'post_date', 'post_date_gmt', 'post_modified', 'post_modified_gmt');
                $this->escape($postdata);
 
@@ -872,6 +931,14 @@ list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?>
                exit;
        }
 
+       function forbidden($reason='') {
+               log_app('Status','403: Forbidden');
+               header('Content-Type: text/plain');
+               status_header('403');
+               echo $reason;
+               exit;
+       }
+
        function not_found() {
                log_app('Status','404: Not Found');
                header('Content-Type: text/plain');
@@ -995,9 +1062,6 @@ EOD;
         * Access credential through various methods and perform login
         */
        function authenticate() {
-               $login_data = array();
-               $already_md5 = false;
-
                log_app("authenticate()",print_r($_ENV, true));
 
                // if using mod_rewrite/ENV hack
@@ -1009,22 +1073,16 @@ EOD;
 
                // If Basic Auth is working...
                if(isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
-                       $login_data = array('login' => $_SERVER['PHP_AUTH_USER'],       'password' => $_SERVER['PHP_AUTH_PW']);
-                       log_app("Basic Auth",$login_data['login']);
-               } else {
-                       // else, do cookie-based authentication
-                       if (function_exists('wp_get_cookie_login')) {
-                               $login_data = wp_get_cookie_login();
-                               $already_md5 = true;
+                       log_app("Basic Auth",$_SERVER['PHP_AUTH_USER']);
+                       $user = wp_authenticate($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
+                       if ( $user && !is_wp_error($user) ) {
+                               wp_set_current_user($user->ID);
+                               log_app("authenticate()", $_SERVER['PHP_AUTH_USER']);
+                               return true;
                        }
                }
 
-               // call wp_login and set current user
-               if (!empty($login_data) && wp_login($login_data['login'], $login_data['password'], $already_md5)) {
-                        $current_user = new WP_User(0, $login_data['login']);
-                        wp_set_current_user($current_user->ID);
-                       log_app("authenticate()",$login_data['login']);
-               }
+               return false;
        }
 
        function get_accepted_content_type($types = NULL) {
index 4c52b97f01fff1a29dcc403e6e379ae8ab13676e..9e20eb68ee2e0e5dda988f323ec11bbeb087d239 100644 (file)
@@ -1,7 +1,18 @@
 <?php
+/**
+ * Outputs the Atom feed XML format using the feed-atom.php file in wp-includes
+ * folder. This file only sets the feed format and includes the feed-atom.php.
+ *
+ * This file is no longer used in WordPress and while it is not deprecated now.
+ * This file will most likely be deprecated or removed in a later version.
+ *
+ * The link for the atom feed is /index.php?feed=atom with permalinks off.
+ *
+ * @package WordPress
+ */
 
 if (empty($wp)) {
-       require_once('./wp-config.php');
+       require_once('./wp-load.php');
        wp('feed=atom');
 }
 
index ff81b46c821566729b790944e7a73b605f6a183f..0f7118f3c1642b1692fe118176b475a1f68cd3f9 100644 (file)
@@ -1,24 +1,20 @@
 <?php
+/**
+ * Loads the WordPress environment and template.
+ *
+ * @package WordPress
+ */
 
-if (! isset($wp_did_header)):
-if ( !file_exists( dirname(__FILE__) . '/wp-config.php') ) {
-       if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $path = '';
-       else $path = 'wp-admin/';
+if ( !isset($wp_did_header) ) {
 
-       require_once( dirname(__FILE__) . '/wp-includes/classes.php');
-       require_once( dirname(__FILE__) . '/wp-includes/functions.php');
-       require_once( dirname(__FILE__) . '/wp-includes/plugin.php');
-       wp_die("There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.</p><p><a href='{$path}setup-config.php' class='button'>Create a Configuration File</a>", "WordPress &rsaquo; Error");
-}
-
-$wp_did_header = true;
+       $wp_did_header = true;
 
-require_once( dirname(__FILE__) . '/wp-config.php');
+       require_once( dirname(__FILE__) . '/wp-load.php' );
 
-wp();
+       wp();
 
-require_once(ABSPATH . WPINC . '/template-loader.php');
+       require_once( ABSPATH . WPINC . '/template-loader.php' );
 
-endif;
+}
 
-?>
+?>
\ No newline at end of file
index f7d7c4f5c8a1f8b069f6562a757c18e501b64e20..96ab8947a9c8e07a3a8acb63a4562415ece6d7a0 100644 (file)
@@ -1,17 +1,25 @@
 <?php
+/**
+ * Handles Comment Post to WordPress and prevents duplicate comment posting.
+ *
+ * @package WordPress
+ */
+
 if ( 'POST' != $_SERVER['REQUEST_METHOD'] ) {
        header('Allow: POST');
        header('HTTP/1.1 405 Method Not Allowed');
        header('Content-Type: text/plain');
        exit;
 }
-require( dirname(__FILE__) . '/wp-config.php' );
+
+/** Sets up the WordPress Environment. */
+require( dirname(__FILE__) . '/wp-load.php' );
 
 nocache_headers();
 
 $comment_post_ID = (int) $_POST['comment_post_ID'];
 
-$status = $wpdb->get_row("SELECT post_status, comment_status FROM $wpdb->posts WHERE ID = '$comment_post_ID'");
+$status = $wpdb->get_row( $wpdb->prepare("SELECT post_status, comment_status FROM $wpdb->posts WHERE ID = %d", $comment_post_ID) );
 
 if ( empty($status->comment_status) ) {
        do_action('comment_id_not_found', $comment_post_ID);
index 5c3f169f6aa794075a6809b9d0d9f18935f91795..9c3b230f626fd589702e27368df5984382f14c37 100644 (file)
@@ -1,7 +1,20 @@
 <?php
+/**
+ * Outputs the RSS2 XML format comment feed using the feed-rss2.php file in
+ * wp-includes folder. This file only sets the feed format and includes the
+ * feed-rss2-comments.php.
+ *
+ * This file is no longer used in WordPress and while it is not deprecated now.
+ * This file will most likely be deprecated or removed in a later version.
+ *
+ * The link for the rss2 comment feed is /index.php?feed=rss2&withcomments=1
+ * with permalinks off.
+ *
+ * @package WordPress
+ */
 
 if (empty($wp)) {
-       require_once('./wp-config.php');
+       require_once('./wp-load.php');
        wp('feed=rss2&withcomments=1');
 }
 
index b59fd048feba3de4b422bb607ca84848dd503f48..f557e6d05ebe7d0af501b52465af5d60a1e392a3 100644 (file)
@@ -7,10 +7,12 @@ define('DB_HOST', 'localhost');    // 99% chance you won't need to change this v
 define('DB_CHARSET', 'utf8');\r
 define('DB_COLLATE', '');\r
 \r
-// Change SECRET_KEY to a unique phrase.  You won't have to remember it later,\r
-// so make it long and complicated.  You can visit http://api.wordpress.org/secret-key/1.0/\r
-// to get a secret key generated for you, or just make something up.\r
-define('SECRET_KEY', 'put your unique phrase here'); // Change this to a unique phrase.\r
+// Change each KEY to a different unique phrase.  You won't have to remember the phrases later,\r
+// so make them long and complicated.  You can visit http://api.wordpress.org/secret-key/1.1/\r
+// to get keys generated for you, or just make something up.  Each key should have a different phrase.\r
+define('AUTH_KEY', 'put your unique phrase here'); // Change this to a unique phrase.\r
+define('SECURE_AUTH_KEY', 'put your unique phrase here'); // Change this to a unique phrase.\r
+define('LOGGED_IN_KEY', 'put your unique phrase here'); // Change this to a unique phrase.\r
 \r
 // You can have multiple installations in one database if you give each a unique prefix\r
 $table_prefix  = 'wp_';   // Only numbers, letters, and underscores please!\r
@@ -23,6 +25,7 @@ define ('WPLANG', '');
 \r
 /* That's all, stop editing! Happy blogging. */\r
 \r
-define('ABSPATH', dirname(__FILE__).'/');\r
-require_once(ABSPATH.'wp-settings.php');\r
+if ( !defined('ABSPATH') )\r
+       define('ABSPATH', dirname(__FILE__) . '/');\r
+require_once(ABSPATH . 'wp-settings.php');\r
 ?>\r
index 8f40f3ba6b9e8b532cb9b5c7e9ae26d391a6a4bf..eb689835d251096d63d5862cbabcc4f5def1f749 100644 (file)
@@ -7,10 +7,12 @@ define('DB_HOST', WIZARD_DBSERVER);    // 99% chance you won't need to change th
 define('DB_CHARSET', 'utf8');\r
 define('DB_COLLATE', '');\r
 \r
-// Change SECRET_KEY to a unique phrase.  You won't have to remember it later,\r
-// so make it long and complicated.  You can visit http://api.wordpress.org/secret-key/1.0/\r
-// to get a secret key generated for you, or just make something up.\r
-define('SECRET_KEY', WIZARD_SECRETKEY); // Change this to a unique phrase.\r
+// Change each KEY to a different unique phrase.  You won't have to remember the phrases later,\r
+// so make them long and complicated.  You can visit http://api.wordpress.org/secret-key/1.1/\r
+// to get keys generated for you, or just make something up.  Each key should have a different phrase.\r
+define('AUTH_KEY', WIZARD_AUTH_KEY); // Change this to a unique phrase.\r
+define('SECURE_AUTH_KEY', WIZARD_SECURE_AUTH_KEY); // Change this to a unique phrase.\r
+define('LOGGED_IN_KEY', WIZARD_LOGGED_IN_KEY); // Change this to a unique phrase.\r
 \r
 // You can have multiple installations in one database if you give each a unique prefix\r
 $table_prefix  = 'wp_';   // Only numbers, letters, and underscores please!\r
@@ -23,6 +25,7 @@ define ('WPLANG', '');
 \r
 /* That's all, stop editing! Happy blogging. */\r
 \r
-define('ABSPATH', dirname(__FILE__).'/');\r
-require_once(ABSPATH.'wp-settings.php');\r
+if ( !defined('ABSPATH') )\r
+       define('ABSPATH', dirname(__FILE__) . '/');\r
+require_once(ABSPATH . 'wp-settings.php');\r
 ?>\r
index e774fdae0bb25d143fc240c8e134ece58fb5430e..21933883c678c827a9b0994709849997600f93f4 100644 (file)
@@ -3,9 +3,9 @@
 Plugin Name: Akismet
 Plugin URI: http://akismet.com/
 Description: Akismet checks your comments against the Akismet web service to see if they look like spam or not. You need a <a href="http://wordpress.com/api-keys/">WordPress.com API key</a> to use it. You can review the spam it catches under "Comments." To show off your Akismet stats just put <code>&lt;?php akismet_counter(); ?></code> in your template. See also: <a href="http://wordpress.org/extend/plugins/stats/">WP Stats plugin</a>.
-Version: 2.1.4
+Version: 2.1.8
 Author: Matt Mullenweg
-Author URI: http://photomatt.net/
+Author URI: http://ma.tt/
 */
 
 // If you hardcode a WP.com API key here, all key config screens will be hidden
@@ -327,7 +327,12 @@ function akismet_spam_totals() {
 }
 
 function akismet_manage_page() {
-       global $wpdb, $submenu;
+       global $wpdb, $submenu, $wp_db_version;
+
+       // WP 2.7 has its own spam management page
+       if ( 8645 <= $wp_db_version )
+               return;
+
        $count = sprintf(__('Akismet Spam (%s)'), akismet_spam_count());
        if ( isset( $submenu['edit-comments.php'] ) )
                add_submenu_page('edit-comments.php', __('Akismet Spam'), $count, 'moderate_comments', 'akismet-admin', 'akismet_caught' );
@@ -337,6 +342,7 @@ function akismet_manage_page() {
 
 function akismet_caught() {
        global $wpdb, $comment, $akismet_caught, $akismet_nonce;
+
        akismet_recheck_queue();
        if (isset($_POST['submit']) && 'recover' == $_POST['action'] && ! empty($_POST['not_spam'])) {
                check_admin_referer( $akismet_nonce );
@@ -480,7 +486,7 @@ if ( isset( $_POST['s'] ) ) {
        if ( isset( $_GET['ctype'] ) )
                $current_type = preg_replace( '|[^a-z]|', '', $_GET['ctype'] );
 
-       $comments = akismet_spam_comments( $current_type );
+       $comments = akismet_spam_comments( $current_type, $page );
        $total = akismet_spam_count( $current_type );
        $totals = akismet_spam_totals();
 ?>
@@ -706,22 +712,24 @@ if ( 'moderation.php' == $pagenow ) {
 
 // For WP >= 2.5
 function akismet_check_for_spam_button($comment_status) {
-       if ( 'moderated' != $comment_status )
+       if ( 'approved' == $comment_status )
                return;
-       $count = wp_count_comments();
-       if ( !empty($count->moderated ) )
-               echo "<a href='edit-comments.php?page=akismet-admin&amp;recheckqueue=true&amp;noheader=true'>" . __('Check for Spam') . "</a>";
+       if ( function_exists('plugins_url') )
+               $link = 'admin.php?action=akismet_recheck_queue';
+       else
+               $link = 'edit-comments.php?page=akismet-admin&amp;recheckqueue=true&amp;noheader=true';
+       echo "</div><div class='alignleft'><a class='button-secondary checkforspam' href='$link'>" . __('Check for Spam') . "</a>";
 }
 add_action('manage_comments_nav', 'akismet_check_for_spam_button');
 
 function akismet_recheck_queue() {
        global $wpdb, $akismet_api_host, $akismet_api_port;
 
-       if ( !isset( $_GET['recheckqueue'] ) )
+       if ( ! ( isset( $_GET['recheckqueue'] ) || ( isset( $_REQUEST['action'] ) && 'akismet_recheck_queue' == $_REQUEST['action'] ) ) )
                return;
 
        $moderation = $wpdb->get_results( "SELECT * FROM $wpdb->comments WHERE comment_approved = '0'", ARRAY_A );
-       foreach ( $moderation as $c ) {
+       foreach ( (array) $moderation as $c ) {
                $c['user_ip']    = $c['comment_author_IP'];
                $c['user_agent'] = $c['comment_agent'];
                $c['referrer']   = '';
@@ -741,6 +749,8 @@ function akismet_recheck_queue() {
        exit;
 }
 
+add_action('admin_action_akismet_recheck_queue', 'akismet_recheck_queue');
+
 function akismet_check_db_comment( $id ) {
        global $wpdb, $akismet_api_host, $akismet_api_port;
 
diff --git a/wp-content/plugins/akismet/readme.txt b/wp-content/plugins/akismet/readme.txt
new file mode 100644 (file)
index 0000000..6b4a242
--- /dev/null
@@ -0,0 +1,22 @@
+=== Akismet ===
+Contributors: matt, ryan, andy, mdawaffe
+Tags: akismet, comments, spam
+
+Akismet checks your comments against the Akismet web service to see if they look like spam or not.
+
+== Description ==
+
+Akismet checks your comments against the Akismet web service to see if they look like spam or not and lets you
+review the spam it catches under your blog's "Comments" admin screen.
+
+Want to show off how much spam Akismet has caught for you? Just put `<?php akismet_counter(); ?>` in your template.
+
+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.
+
+== Installation ==
+
+Upload the Akismet plugin to your blog, Activate it, then enter your [WordPress.com API key](http://wordpress.com/api-keys/).
+
+1, 2, 3: You're done!
index f37def0491c04ae65e31f1ff2c8d82568e4123b4..abc5f97b8d7a2ab4f265ddf625a03e7fcf3a905f 100644 (file)
@@ -5,7 +5,7 @@ Plugin URI: http://wordpress.org/#
 Description: This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from <cite>Hello, Dolly</cite> in the upper right of your admin screen on every page.
 Author: Matt Mullenweg
 Version: 1.5
-Author URI: http://photomatt.net/
+Author URI: http://ma.tt/
 */
 
 // These are the lyrics to Hello Dolly
index 5965562c9b736a7eedb0ef592933253baf7673c4..d6ca2ca4f96cc698820b5b46bcfef1f0a42a661f 100644 (file)
@@ -27,6 +27,6 @@ get_header();
 <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
 <?php endif; ?>
 
-<?php posts_nav_link(' &#8212; ', __('&laquo; Older Posts'), __('Newer Posts &raquo;')); ?>
+<?php posts_nav_link(' &#8212; ', __('&laquo; Newer Posts'), __('Older Posts &raquo;')); ?>
 
 <?php get_footer(); ?>
index 5c8bd4a83e4a148c05a34c9ac7a2fd0ea6c209b7..93dc883bc0c6fde21d3bcc90f03b2b5aeab2d988 100644 (file)
@@ -319,3 +319,45 @@ ul.post-meta span.post-meta-key {
        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 */
index 08b1be1e323ec7ab236b20fcad32b276b8730f63..ec2f6c4f5c3dc5ec1799bffd8690ae8c230fef4b 100644 (file)
 
 <?php else : ?>
 
-<p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" />
+<p><input type="text" name="author" id="author" value="<?php echo $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>
 
-<p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" />
+<p><input type="text" name="email" id="email" value="<?php echo $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>
 
 <p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
index c54491a36da77966ce6244675a6b1edac9d76231..75629d7011fbfd1fbaceacc8bf01142c2f292552 100644 (file)
@@ -1,77 +1,77 @@
-<?php\r
+<?php
 
-$img = 'kubrickheader.jpg';\r
+$img = 'kubrickheader.jpg';
 
-// If we don't have image processing support, redirect.\r
-if ( ! function_exists('imagecreatefromjpeg') )\r
-       die(header("Location: kubrickheader.jpg"));\r
+// If we don't have image processing support, redirect.
+if ( ! function_exists('imagecreatefromjpeg') )
+       die(header("Location: kubrickheader.jpg"));
 
-// Assign and validate the color values\r
-$default = false;\r
-$vars = array('upper'=>array('r1', 'g1', 'b1'), 'lower'=>array('r2', 'g2', 'b2'));\r
-foreach ( $vars as $var => $subvars ) {\r
-       if ( isset($_GET[$var]) ) {\r
-               foreach ( $subvars as $index => $subvar ) {\r
-                       $length = strlen($_GET[$var]) / 3;\r
-                       $v = substr($_GET[$var], $index * $length, $length);\r
-                       if ( $length == 1 ) $v = '' . $v . $v;\r
-                       $$subvar = hexdec( $v );\r
-                       if ( $$subvar < 0 || $$subvar > 255 )\r
-                               $default = true;\r
-               }\r
-       } else {\r
-               $default = true;\r
-       }\r
-}\r
+// 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 )\r
-       list ( $r1, $g1, $b1, $r2, $g2, $b2 ) = array ( 105, 174, 231, 65, 128, 182 );\r
+if ( $default )
+       list ( $r1, $g1, $b1, $r2, $g2, $b2 ) = array ( 105, 174, 231, 65, 128, 182 );
 
-// Create the image\r
-$im = imagecreatefromjpeg($img);\r
+// Create the image
+$im = imagecreatefromjpeg($img);
 
-// Get the background color, define the rectangle height\r
-$white = imagecolorat( $im, 15, 15 );\r
-$h = 182;\r
+// 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 ) )\r
-$corners = array(\r
-       0 => array ( 25, 734 ),\r
-       1 => array ( 23, 736 ),\r
-       2 => array ( 22, 737 ),\r
-       3 => array ( 21, 738 ),\r
-       4 => array ( 21, 738 ),\r
-       177 => array ( 21, 738 ),\r
-       178 => array ( 21, 738 ),\r
-       179 => array ( 22, 737 ),\r
-       180 => array ( 23, 736 ),\r
-       181 => array ( 25, 734 ),\r
-       );\r
+// 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\r
-for ( $i = 0; $i < $h; $i++ ) {\r
-       $x1 = 19;\r
-       $x2 = 740;\r
-       imageline( $im, $x1, 18 + $i, $x2, 18 + $i, $white );\r
-}\r
+// 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\r
-for ( $i = 0; $i < $h; $i++ ) {\r
-       $x1 = 20;\r
-       $x2 = 739;\r
-       $r = ( $r2 - $r1 != 0 ) ? $r1 + ( $r2 - $r1 ) * ( $i / $h ) : $r1;\r
-       $g = ( $g2 - $g1 != 0 ) ? $g1 + ( $g2 - $g1 ) * ( $i / $h ) : $g1;\r
-       $b = ( $b2 - $b1 != 0 ) ? $b1 + ( $b2 - $b1 ) * ( $i / $h ) : $b1;\r
-       $color = imagecolorallocate( $im, $r, $g, $b );\r
-       if ( array_key_exists($i, $corners) ) {\r
-               imageline( $im, $x1, 18 + $i, $x2, 18 + $i, $white );\r
-               list ( $x1, $x2 ) = $corners[$i];\r
-       }\r
-       imageline( $im, $x1, 18 + $i, $x2, 18 + $i, $color );\r
-}\r
+// 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;\r
-header("Content-Type: image/jpeg");\r
-imagejpeg($im, '', 92);\r
-imagedestroy($im);\r
-?>\r
+//die;
+header("Content-Type: image/jpeg");
+imagejpeg($im, '', 92);
+imagedestroy($im);
+?>
index 22820834f5e45354264f2d78b915192833ee174a..300a1c4bf079732695cad9f2ef7a313de8cd5294 100644 (file)
@@ -1,4 +1,5 @@
 <form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
+<label class="hidden" for="s"><?php _e('Search for:'); ?></label>
 <div><input type="text" value="<?php the_search_query(); ?>" name="s" id="s" />
 <input type="submit" id="searchsubmit" value="Search" />
 </div>
index 313b52eeaafbbacd5ef777e58d37e8ff0f0ddfd3..b3bf7863c765a7e674a6bc77b3646aa81ac7553f 100644 (file)
@@ -45,7 +45,7 @@
                                                        // Neither Comments, nor Pings are open ?>
                                                        Both comments and pings are currently closed.
 
-                                               <?php } edit_post_link('Edit this entry.','',''); ?>
+                                               <?php } edit_post_link('Edit this entry','','.'); ?>
 
                                        </small>
                                </p>
index 5ec0231529fdcbac210aa0832a9b185dedb38872..b80a0ef8288f02bab02adc9d17c702c0c668bd9b 100644 (file)
@@ -290,7 +290,7 @@ body {
 }
 
 .postmetadata {
-       clear: left;
+       clear: both;
 }
 
 .clear {
@@ -616,6 +616,10 @@ blockquote cite {
        text-align: center;
        }
 
+.hidden {
+       display: none;
+       }
+
 hr {
        display: none;
        }
@@ -634,6 +638,41 @@ a img {
 
 
 
+/* 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." */
index f60ac56e46829a499487e012bc7b146902dd53a2..efd66c68b67ba590a27112ce9c5da2dac15ff89d 100644 (file)
@@ -1,7 +1,24 @@
 <?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 HTTP request to this file will not slow down the visitor who happens to
+ * visit when the cron job is needed to run.
+ *
+ * @package WordPress
+ */
+
 ignore_user_abort(true);
-define('DOING_CRON', TRUE);
-require_once('./wp-config.php');
+
+/**
+ * Tell WordPress we are doing the CRON task.
+ *
+ * @var bool
+ */
+define('DOING_CRON', true);
+/** Setup WordPress environment */
+require_once('./wp-load.php');
 
 if ( $_GET['check'] != wp_hash('187425') )
        exit;
@@ -15,6 +32,7 @@ $crons = _get_cron_array();
 $keys = array_keys($crons);
 if (!is_array($crons) || $keys[0] > time())
        return;
+
 foreach ($crons as $timestamp => $cronhooks) {
        if ($timestamp > time()) break;
        foreach ($cronhooks as $hook => $keys) {
@@ -32,4 +50,4 @@ foreach ($crons as $timestamp => $cronhooks) {
 
 update_option('doing_cron', 0);
 
-?>
+?>
\ No newline at end of file
index 260ddd4751e655bbb822d2002e1b6ed5cfd71618..d4f1a5bff0bf7e7641fb2a5e4364b6fae61e855c 100644 (file)
@@ -1,4 +1,18 @@
 <?php
+/**
+ * Outputs the RSS2 feed XML format. This file is a shortcut or compatibility
+ * layer for easily finding the RSS feed for the site. It loads WordPress using
+ * the wp-blog-header.php file and running do_feed() function.
+ *
+ * @see do_feed() Used to display the RSS2 feed
+ *
+ * This file is no longer used in WordPress and while it is not deprecated now.
+ * This file will most likely be deprecated or removed in a later version.
+ *
+ * The link for the rss2 feed is /index.php?feed=rss2 with permalinks off.
+ *
+ * @package WordPress
+ */
 
 if (empty($doing_rss)) {
        $doing_rss = 1;
diff --git a/wp-includes/Text/Diff.php b/wp-includes/Text/Diff.php
new file mode 100644 (file)
index 0000000..06d1c6c
--- /dev/null
@@ -0,0 +1,414 @@
+<?php
+/**
+ * General API for generating and formatting diffs - the differences between
+ * two sequences of strings.
+ *
+ * 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/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you did
+ * not receive this file, see http://opensource.org/licenses/lgpl-license.php.
+ *
+ * @package Text_Diff
+ * @author  Geoffrey T. Dairiki <dairiki@dairiki.org>
+ */
+class Text_Diff {
+
+    /**
+     * Array of changes.
+     *
+     * @var array
+     */
+    var $_edits;
+
+    /**
+     * Computes diffs between sequences of strings.
+     *
+     * @param string $engine     Name of the diffing engine to use.  'auto'
+     *                           will automatically select the best.
+     * @param array $params      Parameters to pass to the diffing engine.
+     *                           Normally an array of two arrays, each
+     *                           containing the lines from a file.
+     */
+    function Text_Diff($engine, $params)
+    {
+        // Backward compatibility workaround.
+        if (!is_string($engine)) {
+            $params = array($engine, $params);
+            $engine = 'auto';
+        }
+
+        if ($engine == 'auto') {
+            $engine = extension_loaded('xdiff') ? 'xdiff' : 'native';
+        } else {
+            $engine = basename($engine);
+        }
+
+        // WP #7391
+        require_once dirname(__FILE__).'/Diff/Engine/' . $engine . '.php';
+        $class = 'Text_Diff_Engine_' . $engine;
+        $diff_engine = new $class();
+
+        $this->_edits = call_user_func_array(array($diff_engine, 'diff'), $params);
+    }
+
+    /**
+     * Returns the array of differences.
+     */
+    function getDiff()
+    {
+        return $this->_edits;
+    }
+
+    /**
+     * Computes a reversed diff.
+     *
+     * Example:
+     * <code>
+     * $diff = new Text_Diff($lines1, $lines2);
+     * $rev = $diff->reverse();
+     * </code>
+     *
+     * @return Text_Diff  A Diff object representing the inverse of the
+     *                    original diff.  Note that we purposely don't return a
+     *                    reference here, since this essentially is a clone()
+     *                    method.
+     */
+    function reverse()
+    {
+        if (version_compare(zend_version(), '2', '>')) {
+            $rev = clone($this);
+        } else {
+            $rev = $this;
+        }
+        $rev->_edits = array();
+        foreach ($this->_edits as $edit) {
+            $rev->_edits[] = $edit->reverse();
+        }
+        return $rev;
+    }
+
+    /**
+     * Checks for an empty diff.
+     *
+     * @return boolean  True if two sequences were identical.
+     */
+    function isEmpty()
+    {
+        foreach ($this->_edits as $edit) {
+            if (!is_a($edit, 'Text_Diff_Op_copy')) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Computes the length of the Longest Common Subsequence (LCS).
+     *
+     * This is mostly for diagnostic purposes.
+     *
+     * @return integer  The length of the LCS.
+     */
+    function lcs()
+    {
+        $lcs = 0;
+        foreach ($this->_edits as $edit) {
+            if (is_a($edit, 'Text_Diff_Op_copy')) {
+                $lcs += count($edit->orig);
+            }
+        }
+        return $lcs;
+    }
+
+    /**
+     * Gets the original set of lines.
+     *
+     * This reconstructs the $from_lines parameter passed to the constructor.
+     *
+     * @return array  The original sequence of strings.
+     */
+    function getOriginal()
+    {
+        $lines = array();
+        foreach ($this->_edits as $edit) {
+            if ($edit->orig) {
+                array_splice($lines, count($lines), 0, $edit->orig);
+            }
+        }
+        return $lines;
+    }
+
+    /**
+     * Gets the final set of lines.
+     *
+     * This reconstructs the $to_lines parameter passed to the constructor.
+     *
+     * @return array  The sequence of strings.
+     */
+    function getFinal()
+    {
+        $lines = array();
+        foreach ($this->_edits as $edit) {
+            if ($edit->final) {
+                array_splice($lines, count($lines), 0, $edit->final);
+            }
+        }
+        return $lines;
+    }
+
+    /**
+     * Removes trailing newlines from a line of text. This is meant to be used
+     * with array_walk().
+     *
+     * @param string $line  The line to trim.
+     * @param integer $key  The index of the line in the array. Not used.
+     */
+    function trimNewlines(&$line, $key)
+    {
+        $line = str_replace(array("\n", "\r"), '', $line);
+    }
+
+    /**
+     * Determines the location of the system temporary directory.
+     *
+     * @static
+     *
+     * @access protected
+     *
+     * @return string  A directory name which can be used for temp files.
+     *                 Returns false if one could not be found.
+     */
+    function _getTempDir()
+    {
+        $tmp_locations = array('/tmp', '/var/tmp', 'c:\WUTemp', 'c:\temp',
+                               'c:\windows\temp', 'c:\winnt\temp');
+
+        /* Try PHP's upload_tmp_dir directive. */
+        $tmp = ini_get('upload_tmp_dir');
+
+        /* Otherwise, try to determine the TMPDIR environment variable. */
+        if (!strlen($tmp)) {
+            $tmp = getenv('TMPDIR');
+        }
+
+        /* If we still cannot determine a value, then cycle through a list of
+         * preset possibilities. */
+        while (!strlen($tmp) && count($tmp_locations)) {
+            $tmp_check = array_shift($tmp_locations);
+            if (@is_dir($tmp_check)) {
+                $tmp = $tmp_check;
+            }
+        }
+
+        /* If it is still empty, we have failed, so return false; otherwise
+         * return the directory determined. */
+        return strlen($tmp) ? $tmp : false;
+    }
+
+    /**
+     * Checks a diff for validity.
+     *
+     * This is here only for debugging purposes.
+     */
+    function _check($from_lines, $to_lines)
+    {
+        if (serialize($from_lines) != serialize($this->getOriginal())) {
+            trigger_error("Reconstructed original doesn't match", E_USER_ERROR);
+        }
+        if (serialize($to_lines) != serialize($this->getFinal())) {
+            trigger_error("Reconstructed final doesn't match", E_USER_ERROR);
+        }
+
+        $rev = $this->reverse();
+        if (serialize($to_lines) != serialize($rev->getOriginal())) {
+            trigger_error("Reversed original doesn't match", E_USER_ERROR);
+        }
+        if (serialize($from_lines) != serialize($rev->getFinal())) {
+            trigger_error("Reversed final doesn't match", E_USER_ERROR);
+        }
+
+        $prevtype = null;
+        foreach ($this->_edits as $edit) {
+            if ($prevtype == get_class($edit)) {
+                trigger_error("Edit sequence is non-optimal", E_USER_ERROR);
+            }
+            $prevtype = get_class($edit);
+        }
+
+        return true;
+    }
+
+}
+
+/**
+ * @package Text_Diff
+ * @author  Geoffrey T. Dairiki <dairiki@dairiki.org>
+ */
+class Text_MappedDiff extends Text_Diff {
+
+    /**
+     * Computes a diff between sequences of strings.
+     *
+     * This can be used to compute things like case-insensitve diffs, or diffs
+     * which ignore changes in white-space.
+     *
+     * @param array $from_lines         An array of strings.
+     * @param array $to_lines           An array of strings.
+     * @param array $mapped_from_lines  This array should have the same size
+     *                                  number of elements as $from_lines.  The
+     *                                  elements in $mapped_from_lines and
+     *                                  $mapped_to_lines are what is actually
+     *                                  compared when computing the diff.
+     * @param array $mapped_to_lines    This array should have the same number
+     *                                  of elements as $to_lines.
+     */
+    function Text_MappedDiff($from_lines, $to_lines,
+                             $mapped_from_lines, $mapped_to_lines)
+    {
+        assert(count($from_lines) == count($mapped_from_lines));
+        assert(count($to_lines) == count($mapped_to_lines));
+
+        parent::Text_Diff($mapped_from_lines, $mapped_to_lines);
+
+        $xi = $yi = 0;
+        for ($i = 0; $i < count($this->_edits); $i++) {
+            $orig = &$this->_edits[$i]->orig;
+            if (is_array($orig)) {
+                $orig = array_slice($from_lines, $xi, count($orig));
+                $xi += count($orig);
+            }
+
+            $final = &$this->_edits[$i]->final;
+            if (is_array($final)) {
+                $final = array_slice($to_lines, $yi, count($final));
+                $yi += count($final);
+            }
+        }
+    }
+
+}
+
+/**
+ * @package Text_Diff
+ * @author  Geoffrey T. Dairiki <dairiki@dairiki.org>
+ *
+ * @access private
+ */
+class Text_Diff_Op {
+
+    var $orig;
+    var $final;
+
+    function &reverse()
+    {
+        trigger_error('Abstract method', E_USER_ERROR);
+    }
+
+    function norig()
+    {
+        return $this->orig ? count($this->orig) : 0;
+    }
+
+    function nfinal()
+    {
+        return $this->final ? count($this->final) : 0;
+    }
+
+}
+
+/**
+ * @package Text_Diff
+ * @author  Geoffrey T. Dairiki <dairiki@dairiki.org>
+ *
+ * @access private
+ */
+class Text_Diff_Op_copy extends Text_Diff_Op {
+
+    function Text_Diff_Op_copy($orig, $final = false)
+    {
+        if (!is_array($final)) {
+            $final = $orig;
+        }
+        $this->orig = $orig;
+        $this->final = $final;
+    }
+
+    function &reverse()
+    {
+        $reverse = &new Text_Diff_Op_copy($this->final, $this->orig);
+        return $reverse;
+    }
+
+}
+
+/**
+ * @package Text_Diff
+ * @author  Geoffrey T. Dairiki <dairiki@dairiki.org>
+ *
+ * @access private
+ */
+class Text_Diff_Op_delete extends Text_Diff_Op {
+
+    function Text_Diff_Op_delete($lines)
+    {
+        $this->orig = $lines;
+        $this->final = false;
+    }
+
+    function &reverse()
+    {
+        $reverse = &new Text_Diff_Op_add($this->orig);
+        return $reverse;
+    }
+
+}
+
+/**
+ * @package Text_Diff
+ * @author  Geoffrey T. Dairiki <dairiki@dairiki.org>
+ *
+ * @access private
+ */
+class Text_Diff_Op_add extends Text_Diff_Op {
+
+    function Text_Diff_Op_add($lines)
+    {
+        $this->final = $lines;
+        $this->orig = false;
+    }
+
+    function &reverse()
+    {
+        $reverse = &new Text_Diff_Op_delete($this->final);
+        return $reverse;
+    }
+
+}
+
+/**
+ * @package Text_Diff
+ * @author  Geoffrey T. Dairiki <dairiki@dairiki.org>
+ *
+ * @access private
+ */
+class Text_Diff_Op_change extends Text_Diff_Op {
+
+    function Text_Diff_Op_change($orig, $final)
+    {
+        $this->orig = $orig;
+        $this->final = $final;
+    }
+
+    function &reverse()
+    {
+        $reverse = &new Text_Diff_Op_change($this->final, $this->orig);
+        return $reverse;
+    }
+
+}
diff --git a/wp-includes/Text/Diff/Engine/native.php b/wp-includes/Text/Diff/Engine/native.php
new file mode 100644 (file)
index 0000000..aa5bca5
--- /dev/null
@@ -0,0 +1,437 @@
+<?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. 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:
+ * http://www.perl.com/CPAN/authors/id/N/NE/NEDKONZ/Algorithm-Diff-1.06.zip
+ *
+ * More ideas are taken from: http://www.ics.uci.edu/~eppstein/161/960229.html
+ *
+ * Some ideas (and a bit of code) are taken from analyze.c, of GNU
+ * diffutils-2.7, which can be found at:
+ * ftp://gnudist.gnu.org/pub/gnu/diffutils/diffutils-2.7.tar.gz
+ *
+ * Some ideas (subdivision by NCHUNKS > 2, and some optimizations) are from
+ * 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/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you did
+ * not receive this file, see http://opensource.org/licenses/lgpl-license.php.
+ *
+ * @author  Geoffrey T. Dairiki <dairiki@dairiki.org>
+ * @package Text_Diff
+ */
+class Text_Diff_Engine_native {
+
+    function diff($from_lines, $to_lines)
+    {
+        array_walk($from_lines, array('Text_Diff', 'trimNewlines'));
+        array_walk($to_lines, array('Text_Diff', 'trimNewlines'));
+
+        $n_from = count($from_lines);
+        $n_to = count($to_lines);
+
+        $this->xchanged = $this->ychanged = array();
+        $this->xv = $this->yv = array();
+        $this->xind = $this->yind = array();
+        unset($this->seq);
+        unset($this->in_seq);
+        unset($this->lcs);
+
+        // Skip leading common lines.
+        for ($skip = 0; $skip < $n_from && $skip < $n_to; $skip++) {
+            if ($from_lines[$skip] !== $to_lines[$skip]) {
+                break;
+            }
+            $this->xchanged[$skip] = $this->ychanged[$skip] = false;
+        }
+
+        // Skip trailing common lines.
+        $xi = $n_from; $yi = $n_to;
+        for ($endskip = 0; --$xi > $skip && --$yi > $skip; $endskip++) {
+            if ($from_lines[$xi] !== $to_lines[$yi]) {
+                break;
+            }
+            $this->xchanged[$xi] = $this->ychanged[$yi] = false;
+        }
+
+        // Ignore lines which do not exist in both files.
+        for ($xi = $skip; $xi < $n_from - $endskip; $xi++) {
+            $xhash[$from_lines[$xi]] = 1;
+        }
+        for ($yi = $skip; $yi < $n_to - $endskip; $yi++) {
+            $line = $to_lines[$yi];
+            if (($this->ychanged[$yi] = empty($xhash[$line]))) {
+                continue;
+            }
+            $yhash[$line] = 1;
+            $this->yv[] = $line;
+            $this->yind[] = $yi;
+        }
+        for ($xi = $skip; $xi < $n_from - $endskip; $xi++) {
+            $line = $from_lines[$xi];
+            if (($this->xchanged[$xi] = empty($yhash[$line]))) {
+                continue;
+            }
+            $this->xv[] = $line;
+            $this->xind[] = $xi;
+        }
+
+        // Find the LCS.
+        $this->_compareseq(0, count($this->xv), 0, count($this->yv));
+
+        // Merge edits when possible.
+        $this->_shiftBoundaries($from_lines, $this->xchanged, $this->ychanged);
+        $this->_shiftBoundaries($to_lines, $this->ychanged, $this->xchanged);
+
+        // Compute the edit operations.
+        $edits = array();
+        $xi = $yi = 0;
+        while ($xi < $n_from || $yi < $n_to) {
+            assert($yi < $n_to || $this->xchanged[$xi]);
+            assert($xi < $n_from || $this->ychanged[$yi]);
+
+            // Skip matching "snake".
+            $copy = array();
+            while ($xi < $n_from && $yi < $n_to
+                   && !$this->xchanged[$xi] && !$this->ychanged[$yi]) {
+                $copy[] = $from_lines[$xi++];
+                ++$yi;
+            }
+            if ($copy) {
+                $edits[] = &new Text_Diff_Op_copy($copy);
+            }
+
+            // Find deletes & adds.
+            $delete = array();
+            while ($xi < $n_from && $this->xchanged[$xi]) {
+                $delete[] = $from_lines[$xi++];
+            }
+
+            $add = array();
+            while ($yi < $n_to && $this->ychanged[$yi]) {
+                $add[] = $to_lines[$yi++];
+            }
+
+            if ($delete && $add) {
+                $edits[] = &new Text_Diff_Op_change($delete, $add);
+            } elseif ($delete) {
+                $edits[] = &new Text_Diff_Op_delete($delete);
+            } elseif ($add) {
+                $edits[] = &new Text_Diff_Op_add($add);
+            }
+        }
+
+        return $edits;
+    }
+
+    /**
+     * Divides the Largest Common Subsequence (LCS) of the sequences (XOFF,
+     * XLIM) and (YOFF, YLIM) into NCHUNKS approximately equally sized
+     * segments.
+     *
+     * Returns (LCS, PTS).  LCS is the length of the LCS. PTS is an array of
+     * NCHUNKS+1 (X, Y) indexes giving the diving points between sub
+     * sequences.  The first sub-sequence is contained in (X0, X1), (Y0, Y1),
+     * the second in (X1, X2), (Y1, Y2) and so on.  Note that (X0, Y0) ==
+     * (XOFF, YOFF) and (X[NCHUNKS], Y[NCHUNKS]) == (XLIM, YLIM).
+     *
+     * This function assumes that the first lines of the specified portions of
+     * the two files do not match, and likewise that the last lines do not
+     * match.  The caller must trim matching lines from the beginning and end
+     * of the portions it is going to specify.
+     */
+    function _diag ($xoff, $xlim, $yoff, $ylim, $nchunks)
+    {
+        $flip = false;
+
+        if ($xlim - $xoff > $ylim - $yoff) {
+            /* Things seems faster (I'm not sure I understand why) when the
+             * shortest sequence is in X. */
+            $flip = true;
+            list ($xoff, $xlim, $yoff, $ylim)
+                = array($yoff, $ylim, $xoff, $xlim);
+        }
+
+        if ($flip) {
+            for ($i = $ylim - 1; $i >= $yoff; $i--) {
+                $ymatches[$this->xv[$i]][] = $i;
+            }
+        } else {
+            for ($i = $ylim - 1; $i >= $yoff; $i--) {
+                $ymatches[$this->yv[$i]][] = $i;
+            }
+        }
+
+        $this->lcs = 0;
+        $this->seq[0]= $yoff - 1;
+        $this->in_seq = array();
+        $ymids[0] = array();
+
+        $numer = $xlim - $xoff + $nchunks - 1;
+        $x = $xoff;
+        for ($chunk = 0; $chunk < $nchunks; $chunk++) {
+            if ($chunk > 0) {
+                for ($i = 0; $i <= $this->lcs; $i++) {
+                    $ymids[$i][$chunk - 1] = $this->seq[$i];
+                }
+            }
+
+            $x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $chunk) / $nchunks);
+            for (; $x < $x1; $x++) {
+                $line = $flip ? $this->yv[$x] : $this->xv[$x];
+                if (empty($ymatches[$line])) {
+                    continue;
+                }
+                $matches = $ymatches[$line];
+                reset($matches);
+                while (list(, $y) = each($matches)) {
+                    if (empty($this->in_seq[$y])) {
+                        $k = $this->_lcsPos($y);
+                        assert($k > 0);
+                        $ymids[$k] = $ymids[$k - 1];
+                        break;
+                    }
+                }
+                while (list(, $y) = each($matches)) {
+                    if ($y > $this->seq[$k - 1]) {
+                        assert($y <= $this->seq[$k]);
+                        /* Optimization: this is a common case: next match is
+                         * just replacing previous match. */
+                        $this->in_seq[$this->seq[$k]] = false;
+                        $this->seq[$k] = $y;
+                        $this->in_seq[$y] = 1;
+                    } elseif (empty($this->in_seq[$y])) {
+                        $k = $this->_lcsPos($y);
+                        assert($k > 0);
+                        $ymids[$k] = $ymids[$k - 1];
+                    }
+                }
+            }
+        }
+
+        $seps[] = $flip ? array($yoff, $xoff) : array($xoff, $yoff);
+        $ymid = $ymids[$this->lcs];
+        for ($n = 0; $n < $nchunks - 1; $n++) {
+            $x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $n) / $nchunks);
+            $y1 = $ymid[$n] + 1;
+            $seps[] = $flip ? array($y1, $x1) : array($x1, $y1);
+        }
+        $seps[] = $flip ? array($ylim, $xlim) : array($xlim, $ylim);
+
+        return array($this->lcs, $seps);
+    }
+
+    function _lcsPos($ypos)
+    {
+        $end = $this->lcs;
+        if ($end == 0 || $ypos > $this->seq[$end]) {
+            $this->seq[++$this->lcs] = $ypos;
+            $this->in_seq[$ypos] = 1;
+            return $this->lcs;
+        }
+
+        $beg = 1;
+        while ($beg < $end) {
+            $mid = (int)(($beg + $end) / 2);
+            if ($ypos > $this->seq[$mid]) {
+                $beg = $mid + 1;
+            } else {
+                $end = $mid;
+            }
+        }
+
+        assert($ypos != $this->seq[$end]);
+
+        $this->in_seq[$this->seq[$end]] = false;
+        $this->seq[$end] = $ypos;
+        $this->in_seq[$ypos] = 1;
+        return $end;
+    }
+
+    /**
+     * Finds LCS of two sequences.
+     *
+     * The results are recorded in the vectors $this->{x,y}changed[], by
+     * storing a 1 in the element for each line that is an insertion or
+     * deletion (ie. is not in the LCS).
+     *
+     * The subsequence of file 0 is (XOFF, XLIM) and likewise for file 1.
+     *
+     * Note that XLIM, YLIM are exclusive bounds.  All line numbers are
+     * origin-0 and discarded lines are not counted.
+     */
+    function _compareseq ($xoff, $xlim, $yoff, $ylim)
+    {
+        /* Slide down the bottom initial diagonal. */
+        while ($xoff < $xlim && $yoff < $ylim
+               && $this->xv[$xoff] == $this->yv[$yoff]) {
+            ++$xoff;
+            ++$yoff;
+        }
+
+        /* Slide up the top initial diagonal. */
+        while ($xlim > $xoff && $ylim > $yoff
+               && $this->xv[$xlim - 1] == $this->yv[$ylim - 1]) {
+            --$xlim;
+            --$ylim;
+        }
+
+        if ($xoff == $xlim || $yoff == $ylim) {
+            $lcs = 0;
+        } else {
+            /* This is ad hoc but seems to work well.  $nchunks =
+             * sqrt(min($xlim - $xoff, $ylim - $yoff) / 2.5); $nchunks =
+             * max(2,min(8,(int)$nchunks)); */
+            $nchunks = min(7, $xlim - $xoff, $ylim - $yoff) + 1;
+            list($lcs, $seps)
+                = $this->_diag($xoff, $xlim, $yoff, $ylim, $nchunks);
+        }
+
+        if ($lcs == 0) {
+            /* X and Y sequences have no common subsequence: mark all
+             * changed. */
+            while ($yoff < $ylim) {
+                $this->ychanged[$this->yind[$yoff++]] = 1;
+            }
+            while ($xoff < $xlim) {
+                $this->xchanged[$this->xind[$xoff++]] = 1;
+            }
+        } else {
+            /* Use the partitions to split this problem into subproblems. */
+            reset($seps);
+            $pt1 = $seps[0];
+            while ($pt2 = next($seps)) {
+                $this->_compareseq ($pt1[0], $pt2[0], $pt1[1], $pt2[1]);
+                $pt1 = $pt2;
+            }
+        }
+    }
+
+    /**
+     * Adjusts inserts/deletes of identical lines to join changes as much as
+     * possible.
+     *
+     * We do something when a run of changed lines include a line at one end
+     * and has an excluded, identical line at the other.  We are free to
+     * choose which identical line is included.  `compareseq' usually chooses
+     * the one at the beginning, but usually it is cleaner to consider the
+     * following identical line to be the "change".
+     *
+     * This is extracted verbatim from analyze.c (GNU diffutils-2.7).
+     */
+    function _shiftBoundaries($lines, &$changed, $other_changed)
+    {
+        $i = 0;
+        $j = 0;
+
+        assert('count($lines) == count($changed)');
+        $len = count($lines);
+        $other_len = count($other_changed);
+
+        while (1) {
+            /* Scan forward to find the beginning of another run of
+             * changes. Also keep track of the corresponding point in the
+             * other file.
+             *
+             * Throughout this code, $i and $j are adjusted together so that
+             * the first $i elements of $changed and the first $j elements of
+             * $other_changed both contain the same number of zeros (unchanged
+             * lines).
+             *
+             * Furthermore, $j is always kept so that $j == $other_len or
+             * $other_changed[$j] == false. */
+            while ($j < $other_len && $other_changed[$j]) {
+                $j++;
+            }
+
+            while ($i < $len && ! $changed[$i]) {
+                assert('$j < $other_len && ! $other_changed[$j]');
+                $i++; $j++;
+                while ($j < $other_len && $other_changed[$j]) {
+                    $j++;
+                }
+            }
+
+            if ($i == $len) {
+                break;
+            }
+
+            $start = $i;
+
+            /* Find the end of this run of changes. */
+            while (++$i < $len && $changed[$i]) {
+                continue;
+            }
+
+            do {
+                /* Record the length of this run of changes, so that we can
+                 * later determine whether the run has grown. */
+                $runlength = $i - $start;
+
+                /* Move the changed region back, so long as the previous
+                 * unchanged line matches the last changed one.  This merges
+                 * with previous changed regions. */
+                while ($start > 0 && $lines[$start - 1] == $lines[$i - 1]) {
+                    $changed[--$start] = 1;
+                    $changed[--$i] = false;
+                    while ($start > 0 && $changed[$start - 1]) {
+                        $start--;
+                    }
+                    assert('$j > 0');
+                    while ($other_changed[--$j]) {
+                        continue;
+                    }
+                    assert('$j >= 0 && !$other_changed[$j]');
+                }
+
+                /* Set CORRESPONDING to the end of the changed run, at the
+                 * last point where it corresponds to a changed run in the
+                 * other file. CORRESPONDING == LEN means no such point has
+                 * been found. */
+                $corresponding = $j < $other_len ? $i : $len;
+
+                /* Move the changed region forward, so long as the first
+                 * changed line matches the following unchanged one.  This
+                 * merges with following changed regions.  Do this second, so
+                 * that if there are no merges, the changed region is moved
+                 * forward as far as possible. */
+                while ($i < $len && $lines[$start] == $lines[$i]) {
+                    $changed[$start++] = false;
+                    $changed[$i++] = 1;
+                    while ($i < $len && $changed[$i]) {
+                        $i++;
+                    }
+
+                    assert('$j < $other_len && ! $other_changed[$j]');
+                    $j++;
+                    if ($j < $other_len && $other_changed[$j]) {
+                        $corresponding = $i;
+                        while ($j < $other_len && $other_changed[$j]) {
+                            $j++;
+                        }
+                    }
+                }
+            } while ($runlength != $i - $start);
+
+            /* If possible, move the fully-merged run of changes back to a
+             * corresponding run in the other file. */
+            while ($corresponding < $i) {
+                $changed[--$start] = 1;
+                $changed[--$i] = 0;
+                assert('$j > 0');
+                while ($other_changed[--$j]) {
+                    continue;
+                }
+                assert('$j >= 0 && !$other_changed[$j]');
+            }
+        }
+    }
+
+}
diff --git a/wp-includes/Text/Diff/Engine/shell.php b/wp-includes/Text/Diff/Engine/shell.php
new file mode 100644 (file)
index 0000000..7e9629f
--- /dev/null
@@ -0,0 +1,164 @@
+<?php
+/**
+ * Class used internally by Diff to actually compute the diffs.
+ *
+ * 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/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you did
+ * not receive this file, see http://opensource.org/licenses/lgpl-license.php.
+ *
+ * @author  Milian Wolff <mail@milianw.de>
+ * @package Text_Diff
+ * @since   0.3.0
+ */
+class Text_Diff_Engine_shell {
+
+    /**
+     * Path to the diff executable
+     *
+     * @var string
+     */
+    var $_diffCommand = 'diff';
+
+    /**
+     * Returns the array of differences.
+     *
+     * @param array $from_lines lines of text from old file
+     * @param array $to_lines   lines of text from new file
+     *
+     * @return array all changes made (array with Text_Diff_Op_* objects)
+     */
+    function diff($from_lines, $to_lines)
+    {
+        array_walk($from_lines, array('Text_Diff', 'trimNewlines'));
+        array_walk($to_lines, array('Text_Diff', 'trimNewlines'));
+
+        $temp_dir = Text_Diff::_getTempDir();
+
+        // Execute gnu diff or similar to get a standard diff file.
+        $from_file = tempnam($temp_dir, 'Text_Diff');
+        $to_file = tempnam($temp_dir, 'Text_Diff');
+        $fp = fopen($from_file, 'w');
+        fwrite($fp, implode("\n", $from_lines));
+        fclose($fp);
+        $fp = fopen($to_file, 'w');
+        fwrite($fp, implode("\n", $to_lines));
+        fclose($fp);
+        $diff = shell_exec($this->_diffCommand . ' ' . $from_file . ' ' . $to_file);
+        unlink($from_file);
+        unlink($to_file);
+
+        if (is_null($diff)) {
+            // No changes were made
+            return array(new Text_Diff_Op_copy($from_lines));
+        }
+
+        $from_line_no = 1;
+        $to_line_no = 1;
+        $edits = array();
+
+        // Get changed lines by parsing something like:
+        // 0a1,2
+        // 1,2c4,6
+        // 1,5d6
+        preg_match_all('#^(\d+)(?:,(\d+))?([adc])(\d+)(?:,(\d+))?$#m', $diff,
+            $matches, PREG_SET_ORDER);
+
+        foreach ($matches as $match) {
+            if (!isset($match[5])) {
+                // This paren is not set every time (see regex).
+                $match[5] = false;
+            }
+
+            if ($match[3] == 'a') {
+                $from_line_no--;
+            }
+
+            if ($match[3] == 'd') {
+                $to_line_no--;
+            }
+
+            if ($from_line_no < $match[1] || $to_line_no < $match[4]) {
+                // copied lines
+                assert('$match[1] - $from_line_no == $match[4] - $to_line_no');
+                array_push($edits,
+                    new Text_Diff_Op_copy(
+                        $this->_getLines($from_lines, $from_line_no, $match[1] - 1),
+                        $this->_getLines($to_lines, $to_line_no, $match[4] - 1)));
+            }
+
+            switch ($match[3]) {
+            case 'd':
+                // deleted lines
+                array_push($edits,
+                    new Text_Diff_Op_delete(
+                        $this->_getLines($from_lines, $from_line_no, $match[2])));
+                $to_line_no++;
+                break;
+
+            case 'c':
+                // changed lines
+                array_push($edits,
+                    new Text_Diff_Op_change(
+                        $this->_getLines($from_lines, $from_line_no, $match[2]),
+                        $this->_getLines($to_lines, $to_line_no, $match[5])));
+                break;
+
+            case 'a':
+                // added lines
+                array_push($edits,
+                    new Text_Diff_Op_add(
+                        $this->_getLines($to_lines, $to_line_no, $match[5])));
+                $from_line_no++;
+                break;
+            }
+        }
+
+        if (!empty($from_lines)) {
+            // Some lines might still be pending. Add them as copied
+            array_push($edits,
+                new Text_Diff_Op_copy(
+                    $this->_getLines($from_lines, $from_line_no,
+                                     $from_line_no + count($from_lines) - 1),
+                    $this->_getLines($to_lines, $to_line_no,
+                                     $to_line_no + count($to_lines) - 1)));
+        }
+
+        return $edits;
+    }
+
+    /**
+     * Get lines from either the old or new text
+     *
+     * @access private
+     *
+     * @param array &$text_lines Either $from_lines or $to_lines
+     * @param int   &$line_no    Current line number
+     * @param int   $end         Optional end line, when we want to chop more
+     *                           than one line.
+     *
+     * @return array The chopped lines
+     */
+    function _getLines(&$text_lines, &$line_no, $end = false)
+    {
+        if (!empty($end)) {
+            $lines = array();
+            // We can shift even more
+            while ($line_no <= $end) {
+                array_push($lines, array_shift($text_lines));
+                $line_no++;
+            }
+        } else {
+            $lines = array(array_shift($text_lines));
+            $line_no++;
+        }
+
+        return $lines;
+    }
+
+}
diff --git a/wp-includes/Text/Diff/Engine/string.php b/wp-includes/Text/Diff/Engine/string.php
new file mode 100644 (file)
index 0000000..1a0bd3f
--- /dev/null
@@ -0,0 +1,234 @@
+<?php
+/**
+ * Parses unified or context diffs output from eg. the diff utility.
+ *
+ * Example:
+ * <code>
+ * $patch = file_get_contents('example.patch');
+ * $diff = new Text_Diff('string', array($patch));
+ * $renderer = new Text_Diff_Renderer_inline();
+ * 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/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you did
+ * not receive this file, see http://opensource.org/licenses/lgpl-license.php.
+ *
+ * @author  Ã–rjan Persson <o@42mm.org>
+ * @package Text_Diff
+ * @since   0.2.0
+ */
+class Text_Diff_Engine_string {
+
+    /**
+     * Parses a unified or context diff.
+     *
+     * First param contains the whole diff and the second can be used to force
+     * a specific diff type. If the second parameter is 'autodetect', the
+     * diff will be examined to find out which type of diff this is.
+     *
+     * @param string $diff  The diff content.
+     * @param string $mode  The diff mode of the content in $diff. One of
+     *                      'context', 'unified', or 'autodetect'.
+     *
+     * @return array  List of all diff operations.
+     */
+    function diff($diff, $mode = 'autodetect')
+    {
+        if ($mode != 'autodetect' && $mode != 'context' && $mode != 'unified') {
+            return PEAR::raiseError('Type of diff is unsupported');
+        }
+
+        if ($mode == 'autodetect') {
+            $context = strpos($diff, '***');
+            $unified = strpos($diff, '---');
+            if ($context === $unified) {
+                return PEAR::raiseError('Type of diff could not be detected');
+            } elseif ($context === false || $context === 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);
+
+        if ($mode == 'context') {
+            return $this->parseContextDiff($diff);
+        } else {
+            return $this->parseUnifiedDiff($diff);
+        }
+    }
+
+    /**
+     * Parses an array containing the unified diff.
+     *
+     * @param array $diff  Array of lines.
+     *
+     * @return array  List of all diff operations.
+     */
+    function parseUnifiedDiff($diff)
+    {
+        $edits = array();
+        $end = count($diff) - 1;
+        for ($i = 0; $i < $end;) {
+            $diff1 = array();
+            switch (substr($diff[$i], 0, 1)) {
+            case ' ':
+                do {
+                    $diff1[] = substr($diff[$i], 1);
+                } while (++$i < $end && substr($diff[$i], 0, 1) == ' ');
+                $edits[] = &new Text_Diff_Op_copy($diff1);
+                break;
+
+            case '+':
+                // get all new lines
+                do {
+                    $diff1[] = substr($diff[$i], 1);
+                } while (++$i < $end && substr($diff[$i], 0, 1) == '+');
+                $edits[] = &new Text_Diff_Op_add($diff1);
+                break;
+
+            case '-':
+                // get changed or removed lines
+                $diff2 = array();
+                do {
+                    $diff1[] = substr($diff[$i], 1);
+                } while (++$i < $end && substr($diff[$i], 0, 1) == '-');
+
+                while ($i < $end && substr($diff[$i], 0, 1) == '+') {
+                    $diff2[] = substr($diff[$i++], 1);
+                }
+                if (count($diff2) == 0) {
+                    $edits[] = &new Text_Diff_Op_delete($diff1);
+                } else {
+                    $edits[] = &new Text_Diff_Op_change($diff1, $diff2);
+                }
+                break;
+
+            default:
+                $i++;
+                break;
+            }
+        }
+
+        return $edits;
+    }
+
+    /**
+     * Parses an array containing the context diff.
+     *
+     * @param array $diff  Array of lines.
+     *
+     * @return array  List of all diff operations.
+     */
+    function parseContextDiff(&$diff)
+    {
+        $edits = array();
+        $i = $max_i = $j = $max_j = 0;
+        $end = count($diff) - 1;
+        while ($i < $end && $j < $end) {
+            while ($i >= $max_i && $j >= $max_j) {
+                // Find the boundaries of the diff output of the two files
+                for ($i = $j;
+                     $i < $end && substr($diff[$i], 0, 3) == '***';
+                     $i++);
+                for ($max_i = $i;
+                     $max_i < $end && substr($diff[$max_i], 0, 3) != '---';
+                     $max_i++);
+                for ($j = $max_i;
+                     $j < $end && substr($diff[$j], 0, 3) == '---';
+                     $j++);
+                for ($max_j = $j;
+                     $max_j < $end && substr($diff[$max_j], 0, 3) != '***';
+                     $max_j++);
+            }
+
+            // find what hasn't been changed
+            $array = array();
+            while ($i < $max_i &&
+                   $j < $max_j &&
+                   strcmp($diff[$i], $diff[$j]) == 0) {
+                $array[] = substr($diff[$i], 2);
+                $i++;
+                $j++;
+            }
+
+            while ($i < $max_i && ($max_j-$j) <= 1) {
+                if ($diff[$i] != '' && substr($diff[$i], 0, 1) != ' ') {
+                    break;
+                }
+                $array[] = substr($diff[$i++], 2);
+            }
+
+            while ($j < $max_j && ($max_i-$i) <= 1) {
+                if ($diff[$j] != '' && substr($diff[$j], 0, 1) != ' ') {
+                    break;
+                }
+                $array[] = substr($diff[$j++], 2);
+            }
+            if (count($array) > 0) {
+                $edits[] = &new Text_Diff_Op_copy($array);
+            }
+
+            if ($i < $max_i) {
+                $diff1 = array();
+                switch (substr($diff[$i], 0, 1)) {
+                case '!':
+                    $diff2 = array();
+                    do {
+                        $diff1[] = substr($diff[$i], 2);
+                        if ($j < $max_j && substr($diff[$j], 0, 1) == '!') {
+                            $diff2[] = substr($diff[$j++], 2);
+                        }
+                    } while (++$i < $max_i && substr($diff[$i], 0, 1) == '!');
+                    $edits[] = &new Text_Diff_Op_change($diff1, $diff2);
+                    break;
+
+                case '+':
+                    do {
+                        $diff1[] = substr($diff[$i], 2);
+                    } while (++$i < $max_i && substr($diff[$i], 0, 1) == '+');
+                    $edits[] = &new Text_Diff_Op_add($diff1);
+                    break;
+
+                case '-':
+                    do {
+                        $diff1[] = substr($diff[$i], 2);
+                    } while (++$i < $max_i && substr($diff[$i], 0, 1) == '-');
+                    $edits[] = &new Text_Diff_Op_delete($diff1);
+                    break;
+                }
+            }
+
+            if ($j < $max_j) {
+                $diff2 = array();
+                switch (substr($diff[$j], 0, 1)) {
+                case '+':
+                    do {
+                        $diff2[] = substr($diff[$j++], 2);
+                    } while ($j < $max_j && substr($diff[$j], 0, 1) == '+');
+                    $edits[] = &new Text_Diff_Op_add($diff2);
+                    break;
+
+                case '-':
+                    do {
+                        $diff2[] = substr($diff[$j++], 2);
+                    } while ($j < $max_j && substr($diff[$j], 0, 1) == '-');
+                    $edits[] = &new Text_Diff_Op_delete($diff2);
+                    break;
+                }
+            }
+        }
+
+        return $edits;
+    }
+
+}
diff --git a/wp-includes/Text/Diff/Engine/xdiff.php b/wp-includes/Text/Diff/Engine/xdiff.php
new file mode 100644 (file)
index 0000000..a39a4be
--- /dev/null
@@ -0,0 +1,63 @@
+<?php
+/**
+ * Class used internally by Diff to actually compute the diffs.
+ *
+ * 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/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you did
+ * not receive this file, see http://opensource.org/licenses/lgpl-license.php.
+ *
+ * @author  Jon Parise <jon@horde.org>
+ * @package Text_Diff
+ */
+class Text_Diff_Engine_xdiff {
+
+    /**
+     */
+    function diff($from_lines, $to_lines)
+    {
+        array_walk($from_lines, array('Text_Diff', 'trimNewlines'));
+        array_walk($to_lines, array('Text_Diff', 'trimNewlines'));
+
+        /* Convert the two input arrays into strings for xdiff processing. */
+        $from_string = implode("\n", $from_lines);
+        $to_string = implode("\n", $to_lines);
+
+        /* Diff the two strings and convert the result to an array. */
+        $diff = xdiff_string_diff($from_string, $to_string, count($to_lines));
+        $diff = explode("\n", $diff);
+
+        /* Walk through the diff one line at a time.  We build the $edits
+         * array of diff operations by reading the first character of the
+         * xdiff output (which is in the "unified diff" format).
+         *
+         * Note that we don't have enough information to detect "changed"
+         * lines using this approach, so we can't add Text_Diff_Op_changed
+         * instances to the $edits array.  The result is still perfectly
+         * valid, albeit a little less descriptive and efficient. */
+        $edits = array();
+        foreach ($diff as $line) {
+            switch ($line[0]) {
+            case ' ':
+                $edits[] = &new Text_Diff_Op_copy(array(substr($line, 1)));
+                break;
+
+            case '+':
+                $edits[] = &new Text_Diff_Op_add(array(substr($line, 1)));
+                break;
+
+            case '-':
+                $edits[] = &new Text_Diff_Op_delete(array(substr($line, 1)));
+                break;
+            }
+        }
+
+        return $edits;
+    }
+
+}
diff --git a/wp-includes/Text/Diff/Renderer.php b/wp-includes/Text/Diff/Renderer.php
new file mode 100644 (file)
index 0000000..5d226b4
--- /dev/null
@@ -0,0 +1,237 @@
+<?php
+/**
+ * A class to render Diffs in different formats.
+ *
+ * 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/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you did
+ * not receive this file, see http://opensource.org/licenses/lgpl-license.php.
+ *
+ * @package Text_Diff
+ */
+class Text_Diff_Renderer {
+
+    /**
+     * Number of leading context "lines" to preserve.
+     *
+     * This should be left at zero for this class, but subclasses may want to
+     * set this to other values.
+     */
+    var $_leading_context_lines = 0;
+
+    /**
+     * Number of trailing context "lines" to preserve.
+     *
+     * This should be left at zero for this class, but subclasses may want to
+     * set this to other values.
+     */
+    var $_trailing_context_lines = 0;
+
+    /**
+     * Constructor.
+     */
+    function Text_Diff_Renderer($params = array())
+    {
+        foreach ($params as $param => $value) {
+            $v = '_' . $param;
+            if (isset($this->$v)) {
+                $this->$v = $value;
+            }
+        }
+    }
+
+    /**
+     * Get any renderer parameters.
+     *
+     * @return array  All parameters of this renderer object.
+     */
+    function getParams()
+    {
+        $params = array();
+        foreach (get_object_vars($this) as $k => $v) {
+            if ($k[0] == '_') {
+                $params[substr($k, 1)] = $v;
+            }
+        }
+
+        return $params;
+    }
+
+    /**
+     * Renders a diff.
+     *
+     * @param Text_Diff $diff  A Text_Diff object.
+     *
+     * @return string  The formatted output.
+     */
+    function render($diff)
+    {
+        $xi = $yi = 1;
+        $block = false;
+        $context = array();
+
+        $nlead = $this->_leading_context_lines;
+        $ntrail = $this->_trailing_context_lines;
+
+        $output = $this->_startDiff();
+
+        $diffs = $diff->getDiff();
+        foreach ($diffs as $i => $edit) {
+            /* If these are unchanged (copied) lines, and we want to keep
+             * leading or trailing context lines, extract them from the copy
+             * block. */
+            if (is_a($edit, 'Text_Diff_Op_copy')) {
+                /* Do we have any diff blocks yet? */
+                if (is_array($block)) {
+                    /* How many lines to keep as context from the copy
+                     * block. */
+                    $keep = $i == count($diffs) - 1 ? $ntrail : $nlead + $ntrail;
+                    if (count($edit->orig) <= $keep) {
+                        /* We have less lines in the block than we want for
+                         * context => keep the whole block. */
+                        $block[] = $edit;
+                    } else {
+                        if ($ntrail) {
+                            /* Create a new block with as many lines as we need
+                             * for the trailing context. */
+                            $context = array_slice($edit->orig, 0, $ntrail);
+                            $block[] = &new Text_Diff_Op_copy($context);
+                        }
+                        /* @todo */
+                        $output .= $this->_block($x0, $ntrail + $xi - $x0,
+                                                 $y0, $ntrail + $yi - $y0,
+                                                 $block);
+                        $block = false;
+                    }
+                }
+                /* Keep the copy block as the context for the next block. */
+                $context = $edit->orig;
+            } else {
+                /* Don't we have any diff blocks yet? */
+                if (!is_array($block)) {
+                    /* Extract context lines from the preceding copy block. */
+                    $context = array_slice($context, count($context) - $nlead);
+                    $x0 = $xi - count($context);
+                    $y0 = $yi - count($context);
+                    $block = array();
+                    if ($context) {
+                        $block[] = &new Text_Diff_Op_copy($context);
+                    }
+                }
+                $block[] = $edit;
+            }
+
+            if ($edit->orig) {
+                $xi += count($edit->orig);
+            }
+            if ($edit->final) {
+                $yi += count($edit->final);
+            }
+        }
+
+        if (is_array($block)) {
+            $output .= $this->_block($x0, $xi - $x0,
+                                     $y0, $yi - $y0,
+                                     $block);
+        }
+
+        return $output . $this->_endDiff();
+    }
+
+    function _block($xbeg, $xlen, $ybeg, $ylen, &$edits)
+    {
+        $output = $this->_startBlock($this->_blockHeader($xbeg, $xlen, $ybeg, $ylen));
+
+        foreach ($edits as $edit) {
+            switch (strtolower(get_class($edit))) {
+            case 'text_diff_op_copy':
+                $output .= $this->_context($edit->orig);
+                break;
+
+            case 'text_diff_op_add':
+                $output .= $this->_added($edit->final);
+                break;
+
+            case 'text_diff_op_delete':
+                $output .= $this->_deleted($edit->orig);
+                break;
+
+            case 'text_diff_op_change':
+                $output .= $this->_changed($edit->orig, $edit->final);
+                break;
+            }
+        }
+
+        return $output . $this->_endBlock();
+    }
+
+    function _startDiff()
+    {
+        return '';
+    }
+
+    function _endDiff()
+    {
+        return '';
+    }
+
+    function _blockHeader($xbeg, $xlen, $ybeg, $ylen)
+    {
+        if ($xlen > 1) {
+            $xbeg .= ',' . ($xbeg + $xlen - 1);
+        }
+        if ($ylen > 1) {
+            $ybeg .= ',' . ($ybeg + $ylen - 1);
+        }
+
+        // this matches the GNU Diff behaviour
+        if ($xlen && !$ylen) {
+            $ybeg--;
+        } elseif (!$xlen) {
+            $xbeg--;
+        }
+
+        return $xbeg . ($xlen ? ($ylen ? 'c' : 'd') : 'a') . $ybeg;
+    }
+
+    function _startBlock($header)
+    {
+        return $header . "\n";
+    }
+
+    function _endBlock()
+    {
+        return '';
+    }
+
+    function _lines($lines, $prefix = ' ')
+    {
+        return $prefix . implode("\n$prefix", $lines) . "\n";
+    }
+
+    function _context($lines)
+    {
+        return $this->_lines($lines, '  ');
+    }
+
+    function _added($lines)
+    {
+        return $this->_lines($lines, '> ');
+    }
+
+    function _deleted($lines)
+    {
+        return $this->_lines($lines, '< ');
+    }
+
+    function _changed($orig, $final)
+    {
+        return $this->_deleted($orig) . "---\n" . $this->_added($final);
+    }
+
+}
diff --git a/wp-includes/Text/Diff/Renderer/inline.php b/wp-includes/Text/Diff/Renderer/inline.php
new file mode 100644 (file)
index 0000000..1493eaa
--- /dev/null
@@ -0,0 +1,172 @@
+<?php
+/**
+ * "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/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you did
+ * not receive this file, see http://opensource.org/licenses/lgpl-license.php.
+ *
+ * @author  Ciprian Popovici
+ * @package Text_Diff
+ */
+
+/** Text_Diff_Renderer */
+
+// WP #7391
+require_once dirname(dirname(__FILE__)) . '/Renderer.php';
+
+/**
+ * "Inline" diff renderer.
+ *
+ * This class renders diffs in the Wiki-style "inline" format.
+ *
+ * @author  Ciprian Popovici
+ * @package Text_Diff
+ */
+class Text_Diff_Renderer_inline extends Text_Diff_Renderer {
+
+    /**
+     * Number of leading context "lines" to preserve.
+     */
+    var $_leading_context_lines = 10000;
+
+    /**
+     * Number of trailing context "lines" to preserve.
+     */
+    var $_trailing_context_lines = 10000;
+
+    /**
+     * Prefix for inserted text.
+     */
+    var $_ins_prefix = '<ins>';
+
+    /**
+     * Suffix for inserted text.
+     */
+    var $_ins_suffix = '</ins>';
+
+    /**
+     * Prefix for deleted text.
+     */
+    var $_del_prefix = '<del>';
+
+    /**
+     * Suffix for deleted text.
+     */
+    var $_del_suffix = '</del>';
+
+    /**
+     * Header for each change block.
+     */
+    var $_block_header = '';
+
+    /**
+     * What are we currently splitting on? Used to recurse to show word-level
+     * changes.
+     */
+    var $_split_level = 'lines';
+
+    function _blockHeader($xbeg, $xlen, $ybeg, $ylen)
+    {
+        return $this->_block_header;
+    }
+
+    function _startBlock($header)
+    {
+        return $header;
+    }
+
+    function _lines($lines, $prefix = ' ', $encode = true)
+    {
+        if ($encode) {
+            array_walk($lines, array(&$this, '_encode'));
+        }
+
+        if ($this->_split_level == 'words') {
+            return implode('', $lines);
+        } else {
+            return implode("\n", $lines) . "\n";
+        }
+    }
+
+    function _added($lines)
+    {
+        array_walk($lines, array(&$this, '_encode'));
+        $lines[0] = $this->_ins_prefix . $lines[0];
+        $lines[count($lines) - 1] .= $this->_ins_suffix;
+        return $this->_lines($lines, ' ', false);
+    }
+
+    function _deleted($lines, $words = false)
+    {
+        array_walk($lines, array(&$this, '_encode'));
+        $lines[0] = $this->_del_prefix . $lines[0];
+        $lines[count($lines) - 1] .= $this->_del_suffix;
+        return $this->_lines($lines, ' ', false);
+    }
+
+    function _changed($orig, $final)
+    {
+        /* If we've already split on words, don't try to do so again - just
+         * display. */
+        if ($this->_split_level == 'words') {
+            $prefix = '';
+            while ($orig[0] !== false && $final[0] !== false &&
+                   substr($orig[0], 0, 1) == ' ' &&
+                   substr($final[0], 0, 1) == ' ') {
+                $prefix .= substr($orig[0], 0, 1);
+                $orig[0] = substr($orig[0], 1);
+                $final[0] = substr($final[0], 1);
+            }
+            return $prefix . $this->_deleted($orig) . $this->_added($final);
+        }
+
+        $text1 = implode("\n", $orig);
+        $text2 = implode("\n", $final);
+
+        /* 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));
+
+        /* Get the diff in inline format. */
+        $renderer = new Text_Diff_Renderer_inline(array_merge($this->getParams(),
+                                                              array('split_level' => 'words')));
+
+        /* Run the diff and get the output. */
+        return str_replace($nl, "\n", $renderer->render($diff)) . "\n";
+    }
+
+    function _splitOnWords($string, $newlineEscape = "\n")
+    {
+        // Ignore \0; otherwise the while loop will never finish.
+        $string = str_replace("\0", '', $string);
+
+        $words = array();
+        $length = strlen($string);
+        $pos = 0;
+
+        while ($pos < $length) {
+            // Eat a word with any preceding whitespace.
+            $spaces = strspn(substr($string, $pos), " \n");
+            $nextpos = strcspn(substr($string, $pos + $spaces), " \n");
+            $words[] = str_replace("\n", $newlineEscape, substr($string, $pos, $spaces + $nextpos));
+            $pos += $spaces + $nextpos;
+        }
+
+        return $words;
+    }
+
+    function _encode(&$string)
+    {
+        $string = htmlspecialchars($string);
+    }
+
+}
index 9c2335c6612d71f39d8cb6597b5301b43b702472..e75ca394a3f3fa9eca7208790a6613de9c31d312 100644 (file)
@@ -1,12 +1,12 @@
 <?php
-/*
+/**
  * Atom Syndication Format PHP Library
  *
  * @package AtomLib
  * @link http://code.google.com/p/phpatomlib/
  *
- * @author: Elias Torres <elias@torrez.us>
- * @version: 0.4
+ * @author Elias Torres <elias@torrez.us>
+ * @version 0.4
  * @since 2.3
  */
 
index 9b4ed39ebd04adcd6fe78eb23653a898ed3e4aac..c62b4bc0270671164ac21a1c5c90cdbede9de209 100644 (file)
@@ -2,12 +2,16 @@
 /**
  * Author Template functions for use in themes.
  *
+ * These functions must be used within the WordPress Loop.
+ *
+ * @link http://codex.wordpress.org/Author_Templates
+ *
  * @package WordPress
  * @subpackage Template
  */
 
 /**
- * get_the_author() - Get the author of the current post in the Loop.
+ * Retrieve the author of the current post.
  *
  * @since 1.5
  * @uses $authordata The current author's DB object.
@@ -22,21 +26,22 @@ function get_the_author($deprecated = '') {
 }
 
 /**
- * the_author() - Echo the name of the author of the current post in the Loop.
+ * Display the name of the author of the current post.
  *
- * The behavior of this function is based off of old functionality predating get_the_author().
- * This function is not deprecated, but is designed to echo the value from get_the_author()
- * and as an result of any old theme that might still use the old behavior will also
- * pass the value from get_the_author().
+ * The behavior of this function is based off of old functionality predating
+ * get_the_author(). This function is not deprecated, but is designed to echo
+ * the value from get_the_author() and as an result of any old theme that might
+ * still use the old behavior will also pass the value from get_the_author().
  *
- * The normal, expected behavior of this function is to echo the author and not return it.
- * However, backwards compatiability has to be maintained.
+ * The normal, expected behavior of this function is to echo the author and not
+ * return it. However, backwards compatiability has to be maintained.
  *
  * @since 0.71
  * @see get_the_author()
+ * @link http://codex.wordpress.org/Template_Tags/the_author
  *
  * @param string $deprecated Deprecated.
- * @param string $deprecated_echo Echo the string or return it. Deprecated, use get_the_author().
+ * @param string $deprecated_echo Echo the string or return it.
  * @return string The author's display name, from get_the_author().
  */
 function the_author($deprecated = '', $deprecated_echo = true) {
@@ -46,7 +51,7 @@ function the_author($deprecated = '', $deprecated_echo = true) {
 }
 
 /**
- * get_the_author_description() - Get the description of the author of the current post in the Loop.
+ * Retrieve the description of the author of the current post.
  *
  * @since 1.5
  * @uses $authordata The current author's DB object.
@@ -58,8 +63,9 @@ function get_the_author_description() {
 }
 
 /**
- * the_author_description() - Echo the description of the author of the current post in the Loop.
+ * Display the description of the author of the current post.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_description
  * @since 1.0.0
  * @see get_the_author_description()
  */
@@ -68,7 +74,7 @@ function the_author_description() {
 }
 
 /**
- * get_the_author_login() - Get the login name of the author of the current post in the Loop.
+ * Retrieve the login name of the author of the current post.
  *
  * @since 1.5
  * @uses $authordata The current author's DB object.
@@ -80,8 +86,9 @@ function get_the_author_login() {
 }
 
 /**
- * the_author_login() - Echo the login name of the author of the current post in the Loop.
+ * Display the login name of the author of the current post.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_login
  * @since 0.71
  * @see get_the_author_login()
  */
@@ -90,7 +97,7 @@ function the_author_login() {
 }
 
 /**
- * get_the_author_firstname() - Get the first name of the author of the current post in the Loop.
+ * Retrieve the first name of the author of the current post.
  *
  * @since 1.5
  * @uses $authordata The current author's DB object.
@@ -102,8 +109,9 @@ function get_the_author_firstname() {
 }
 
 /**
- * the_author_firstname() - Echo the first name of the author of the current post in the Loop.
+ * Display the first name of the author of the current post.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_firstname
  * @since 0.71
  * @uses get_the_author_firstname()
  */
@@ -112,7 +120,7 @@ function the_author_firstname() {
 }
 
 /**
- * get_the_author_lastname() - Get the last name of the author of the current post in the Loop.
+ * Retrieve the last name of the author of the current post.
  *
  * @since 1.5
  * @uses $authordata The current author's DB object.
@@ -124,8 +132,9 @@ function get_the_author_lastname() {
 }
 
 /**
- * the_author_lastname() - Echo the last name of the author of the current post in the Loop.
+ * Display the last name of the author of the current post.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_lastname
  * @since 0.71
  * @uses get_the_author_lastname()
  */
@@ -134,7 +143,7 @@ function the_author_lastname() {
 }
 
 /**
- * get_the_author_nickname() - Get the nickname of the author of the current post in the Loop.
+ * Retrieve the nickname of the author of the current post.
  *
  * @since 1.5
  * @uses $authordata The current author's DB object.
@@ -146,8 +155,9 @@ function get_the_author_nickname() {
 }
 
 /**
- * the_author_nickname() - Echo the nickname of the author of the current post in the Loop.
+ * Display the nickname of the author of the current post.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_nickname
  * @since 0.71
  * @uses get_the_author_nickname()
  */
@@ -156,7 +166,7 @@ function the_author_nickname() {
 }
 
 /**
- * get_the_author_ID() - Get the ID of the author of the current post in the Loop.
+ * Retrieve the ID of the author of the current post.
  *
  * @since 1.5
  * @uses $authordata The current author's DB object.
@@ -168,8 +178,9 @@ function get_the_author_ID() {
 }
 
 /**
- * the_author_ID() - Echo the ID of the author of the current post in the Loop.
+ * Display the ID of the author of the current post.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_ID
  * @since 0.71
  * @uses get_the_author_ID()
  */
@@ -178,7 +189,7 @@ function the_author_ID() {
 }
 
 /**
- * get_the_author_email() - Get the email of the author of the current post in the Loop.
+ * Retrieve the email of the author of the current post.
  *
  * @since 1.5
  * @uses $authordata The current author's DB object.
@@ -190,8 +201,9 @@ function get_the_author_email() {
 }
 
 /**
- * the_author_email() - Echo the email of the author of the current post in the Loop.
+ * Display the email of the author of the current post.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_email
  * @since 0.71
  * @uses get_the_author_email()
  */
@@ -200,7 +212,7 @@ function the_author_email() {
 }
 
 /**
- * get_the_author_url() - Get the URL to the home page of the author of the current post in the Loop.
+ * Retrieve the URL to the home page of the author of the current post.
  *
  * @since 1.5
  * @uses $authordata The current author's DB object.
@@ -216,8 +228,9 @@ function get_the_author_url() {
 }
 
 /**
- * the_author_url() - Echo the URL to the home page of the author of the current post in the Loop.
+ * Display the URL to the home page of the author of the current post.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_url
  * @since 0.71
  * @uses get_the_author_url()
  */
@@ -226,8 +239,12 @@ function the_author_url() {
 }
 
 /**
- * the_author_link() - If the author has a home page set, echo an HTML link, otherwise just echo the author's name.
+ * Display either author's link or author's name.
+ *
+ * If the author has a home page set, echo an HTML link, otherwise just echo the
+ * author's name.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_link
  * @since 2.1
  * @uses get_the_author_url()
  * @uses the_author()
@@ -241,7 +258,7 @@ function the_author_link() {
 }
 
 /**
- * get_the_author_icq() - Get the ICQ number of the author of the current post in the Loop.
+ * Retrieve the ICQ number of the author of the current post.
  *
  * @since 1.5
  * @uses $authordata The current author's DB object.
@@ -253,8 +270,9 @@ function get_the_author_icq() {
 }
 
 /**
- * the_author_icq() - Echo the ICQ number of the author of the current post in the Loop.
+ * Display the ICQ number of the author of the current post.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_icq
  * @since 0.71
  * @see get_the_author_icq()
  */
@@ -263,7 +281,7 @@ function the_author_icq() {
 }
 
 /**
- * get_the_author_aim() - Get the AIM name of the author of the current post in the Loop.
+ * Retrieve the AIM name of the author of the current post.
  *
  * @since 1.5
  * @uses $authordata The current author's DB object.
@@ -275,8 +293,9 @@ function get_the_author_aim() {
 }
 
 /**
- * the_author_aim() - Echo the AIM name of the author of the current post in the Loop.
+ * Display the AIM name of the author of the current post.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_aim
  * @since 0.71
  * @see get_the_author_aim()
  */
@@ -285,7 +304,7 @@ function the_author_aim() {
 }
 
 /**
- * get_the_author_yim() - Get the Yahoo! IM name of the author of the current post in the Loop.
+ * Retrieve the Yahoo! IM name of the author of the current post.
  *
  * @since 1.5
  * @uses $authordata The current author's DB object.
@@ -297,8 +316,9 @@ function get_the_author_yim() {
 }
 
 /**
- * the_author_yim() - Echo the Yahoo! IM name of the author of the current post in the Loop.
+ * Display the Yahoo! IM name of the author of the current post.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_yim
  * @since 0.71
  * @see get_the_author_yim()
  */
@@ -307,7 +327,7 @@ function the_author_yim() {
 }
 
 /**
- * get_the_author_msn() - Get the MSN address of the author of the current post in the Loop.
+ * Retrieve the MSN address of the author of the current post.
  *
  * @since 1.5
  * @uses $authordata The current author's DB object.
@@ -319,8 +339,9 @@ function get_the_author_msn() {
 }
 
 /**
- * the_author_msn() - Echo the MSN address of the author of the current post in the Loop.
+ * Display the MSN address of the author of the current post.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_msn
  * @since 0.71
  * @see get_the_author_msn()
  */
@@ -329,7 +350,7 @@ function the_author_msn() {
 }
 
 /**
- * get_the_author_posts() - Get the number of posts by the author of the current post in the Loop.
+ * Retrieve the number of posts by the author of the current post.
  *
  * @since 1.5
  * @uses $post The current post in the Loop's DB object.
@@ -342,8 +363,9 @@ function get_the_author_posts() {
 }
 
 /**
- * the_author_posts() - Echo the number of posts by the author of the current post in the Loop.
+ * Display the number of posts by the author of the current post.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_posts
  * @since 0.71
  * @uses get_the_author_posts() Echos returned value from function.
  */
@@ -352,11 +374,13 @@ function the_author_posts() {
 }
 
 /**
- * the_author_posts_link() - Echo an HTML link to the author page of the author of the current post in the Loop.
+ * Display an HTML link to the author page of the author of the current post.
  *
- * Does just echo get_author_posts_url() function, like the others do. The reason for this,
- * is that another function is used to help in printing the link to the author's posts.
+ * Does just echo get_author_posts_url() function, like the others do. The
+ * reason for this, is that another function is used to help in printing the
+ * link to the author's posts.
  *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_posts_link
  * @since 1.2
  * @uses $authordata The current author's DB object.
  * @uses get_author_posts_url()
@@ -374,7 +398,7 @@ function the_author_posts_link($deprecated = '') {
 }
 
 /**
- * get_author_posts_url() - Get the URL to the author page of the author of the current post in the Loop.
+ * Retrieve the URL to the author page of the author of the current post.
  *
  * @since 2.1
  * @uses $wp_rewrite WP_Rewrite
@@ -404,7 +428,7 @@ function get_author_posts_url($author_id, $author_nicename = '') {
 }
 
 /**
- * get_author_name() - Get the specified author's preferred display name.
+ * Retrieve the specified author's preferred display name.
  *
  * @since 1.0.0
  * @param int $auth_id The ID of the author.
@@ -416,16 +440,19 @@ function get_author_name( $auth_id ) {
 }
 
 /**
- * wp_list_authors() - List all the authors of the blog, with several options available.
+ * List all the authors of the blog, with several options available.
  *
- * optioncount (boolean) (false): Show the count in parenthesis next to the author's name.
- * exclude_admin (boolean) (true): Exclude the 'admin' user that is installed by default.
+ * optioncount (boolean) (false): Show the count in parenthesis next to the
+ *             author's name.
+ * exclude_admin (boolean) (true): Exclude the 'admin' user that is installed by
+ *             default.
  * show_fullname (boolean) (false): Show their full names.
  * hide_empty (boolean) (true): Don't show authors without any posts.
  * feed (string) (''): If isn't empty, show links to author's feeds.
  * feed_image (string) (''): If isn't empty, use this image to link to feeds.
  * echo (boolean) (true): Set to false to return the output, instead of echoing.
  *
+ * @link http://codex.wordpress.org/Template_Tags/wp_list_authors
  * @since 1.2
  * @param array $args The argument array.
  * @return null|string The output, if echo is set to false.
@@ -507,4 +534,4 @@ function wp_list_authors($args = '') {
        echo $return;
 }
 
-?>
\ No newline at end of file
+?>
index 50326bcd320d28f01925a7789a1fda2afdc6f6f4..e687e5622af44a528d96c7a0d70483cfc67a9834 100644 (file)
@@ -7,24 +7,31 @@
  */
 
 /**
- * _walk_bookmarks() - The formatted output of a list of bookmarks
+ * The formatted output of a list of bookmarks
  *
  * The $bookmarks array must contain bookmark objects and will be iterated over
  * to retrieve the bookmark to be used in the output.
  *
- * The output is formatted as HTML with no way to change that format. However, what
- * is between, before, and after can be changed. The link itself will be HTML.
+ * The output is formatted as HTML with no way to change that format. However,
+ * what is between, before, and after can be changed. The link itself will be
+ * HTML.
  *
- * This function is used internally by wp_list_bookmarks() and should not be used by
- * themes.
+ * This function is used internally by wp_list_bookmarks() and should not be
+ * used by themes.
  *
  * The defaults for overwriting are:
- * 'show_updated' - Default is 0 (integer). Will show the time of when the bookmark was last updated.
- * 'show_description' - Default is 0 (integer). Whether to show the description of the bookmark.
- * 'show_images' - Default is 1 (integer). Whether to show link image if available.
- * 'before' - Default is '<li>' (string). The html or text to prepend to each bookmarks.
- * 'after' - Default is '</li>' (string). The html or text to append to each bookmarks.
- * 'between' - Default is '\n' (string). The string for use in between the link, description, and image.
+ * 'show_updated' - Default is 0 (integer). Will show the time of when the
+ *             bookmark was last updated.
+ * 'show_description' - Default is 0 (integer). Whether to show the description
+ *             of the bookmark.
+ * 'show_images' - Default is 1 (integer). Whether to show link image if
+ *             available.
+ * 'before' - Default is '<li>' (string). The html or text to prepend to each
+ *             bookmarks.
+ * 'after' - Default is '</li>' (string). The html or text to append to each
+ *             bookmarks.
+ * 'between' - Default is '\n' (string). The string for use in between the link,
+ *             description, and image.
  * 'show_rating' - Default is 0 (integer). Whether to show the link rating.
  *
  * @since 2.1
@@ -69,7 +76,7 @@ function _walk_bookmarks($bookmarks, $args = '' ) {
 
                if ( $show_updated )
                        if ( '00' != substr($bookmark->link_updated_f, 0, 2) ) {
-                               $title .= ' ';
+                               $title .= ' (';
                                $title .= sprintf(__('Last updated: %s'), date(get_option('links_updated_date_format'), $bookmark->link_updated_f + (get_option('gmt_offset') * 3600)));
                                $title .= ')';
                        }
@@ -113,49 +120,73 @@ function _walk_bookmarks($bookmarks, $args = '' ) {
 }
 
 /**
- * wp_list_bookmarks() - Retrieve or echo all of the bookmarks
+ * Retrieve or echo all of the bookmarks
  *
  * List of default arguments are as follows:
- * 'orderby' - Default is 'name' (string). How to order the links by. String is based off of the bookmark scheme.
- * 'order' - Default is 'ASC' (string). Either 'ASC' or 'DESC'. Orders in either ascending or descending order.
- * 'limit' - Default is -1 (integer) or show all. The amount of bookmarks to display.
- * 'category' - Default is empty string (string). Include the links in what category ID(s).
- * 'category_name' - Default is empty string (string). Get links by category name.
- * 'hide_invisible' - Default is 1 (integer). Whether to show (default) or hide links marked as 'invisible'.
- * 'show_updated' - Default is 0 (integer). Will show the time of when the bookmark was last updated.
- * 'echo' - Default is 1 (integer). Whether to echo (default) or return the formatted bookmarks.
- * 'categorize' - Default is 1 (integer). Whether to show links listed by category (default) or show links in one column.
+ * 'orderby' - Default is 'name' (string). How to order the links by. String is
+ *             based off of the bookmark scheme.
+ * 'order' - Default is 'ASC' (string). Either 'ASC' or 'DESC'. Orders in either
+ *             ascending or descending order.
+ * 'limit' - Default is -1 (integer) or show all. The amount of bookmarks to
+ *             display.
+ * 'category' - Default is empty string (string). Include the links in what
+ *             category ID(s).
+ * 'category_name' - Default is empty string (string). Get links by category
+ *             name.
+ * 'hide_invisible' - Default is 1 (integer). Whether to show (default) or hide
+ *             links marked as 'invisible'.
+ * 'show_updated' - Default is 0 (integer). Will show the time of when the
+ *             bookmark was last updated.
+ * 'echo' - Default is 1 (integer). Whether to echo (default) or return the
+ *             formatted bookmarks.
+ * 'categorize' - Default is 1 (integer). Whether to show links listed by
+ *             category (default) or show links in one column.
  *
- * 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 display for only the 'title_li' string and only if 'title_li' is not empty.
- * 'title_li' - Default is 'Bookmarks' (translatable string). What to show before the links appear.
- * 'title_before' - Default is '<h2>' (string). The HTML or text to show before the 'title_li' string.
- * 'title_after' - Default is '</h2>' (string). The HTML or text to show after the 'title_li' string.
- * 'class' - Default is 'linkcat' (string). The CSS class to use for the 'title_li'.
+ * 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
+ * display for only the 'title_li' string and only if 'title_li' is not empty.
+ * 'title_li' - Default is 'Bookmarks' (translatable string). What to show
+ *             before the links appear.
+ * 'title_before' - Default is '<h2>' (string). The HTML or text to show before
+ *             the 'title_li' string.
+ * 'title_after' - Default is '</h2>' (string). The HTML or text to show after
+ *             the 'title_li' string.
+ * 'class' - Default is 'linkcat' (string). The CSS class to use for the
+ *             'title_li'.
  *
- * 'category_before' - Default is '<li id="%id" class="%class">'. String must contain '%id' and '%class' to get
- * the id of the category and the 'class' argument. These are used for formatting in themes. Argument will be displayed
- * before the 'title_before' argument.
- * 'category_after' - Default is '</li>' (string). The HTML or text that will appear after the list of links.
+ * 'category_before' - Default is '<li id="%id" class="%class">'. String must
+ *             contain '%id' and '%class' to get
+ * the id of the category and the 'class' argument. These are used for
+ *             formatting in themes.
+ * Argument will be displayed before the 'title_before' argument.
+ * 'category_after' - Default is '</li>' (string). The HTML or text that will
+ *             appear after the list of links.
  *
  * These are only used if 'categorize' is set to 1 or true.
- * 'category_orderby' - Default is 'name'. How to order the bookmark category based on term scheme.
- * 'category_order' - Default is 'ASC'. Set the order by either ASC (ascending) or DESC (descending).
+ * 'category_orderby' - Default is 'name'. How to order the bookmark category
+ *             based on term scheme.
+ * 'category_order' - Default is 'ASC'. Set the order by either ASC (ascending)
+ *             or DESC (descending).
  *
- * @see _walk_bookmarks() For other arguments that can be set in this function and passed to _walk_bookmarks().
- * @see get_bookmarks() For other arguments that can be set in this function and passed to get_bookmarks().
+ * @see _walk_bookmarks() For other arguments that can be set in this function
+ *             and passed to _walk_bookmarks().
+ * @see get_bookmarks() For other arguments that can be set in this function and
+ *             passed to get_bookmarks().
+ * @link http://codex.wordpress.org/Template_Tags/wp_list_bookmarks
  *
  * @since 2.1
- * @uses _list_bookmarks() Used to iterate over all of the bookmarks and return the html
+ * @uses _list_bookmarks() Used to iterate over all of the bookmarks and return
+ *             the html
  * @uses get_terms() Gets all of the categories that are for links.
  *
  * @param string|array $args Optional. Overwrite the defaults of the function
- * @return string|null Will only return if echo option is set to not echo. Default is not return anything.
+ * @return string|null Will only return if echo option is set to not echo.
+ *             Default is not return anything.
  */
 function wp_list_bookmarks($args = '') {
        $defaults = array(
                'orderby' => 'name', 'order' => 'ASC',
-               'limit' => -1, 'category' => '',
+               'limit' => -1, 'category' => '', 'exclude_category' => '',
                'category_name' => '', 'hide_invisible' => 1,
                'show_updated' => 0, 'echo' => 1,
                'categorize' => 1, 'title_li' => __('Bookmarks'),
@@ -172,7 +203,7 @@ function wp_list_bookmarks($args = '') {
 
        if ( $categorize ) {
                //Split the bookmarks into ul's for each category
-               $cats = get_terms('link_category', "category_name=$category_name&include=$category&orderby=$category_orderby&order=$category_order&hierarchical=0");
+               $cats = get_terms('link_category', array('name__like' => $category_name, 'include' => $category, 'exclude' => $exclude_category, 'orderby' => $category_orderby, 'order' => $category_order, 'hierarchical' => 0));
 
                foreach ( (array) $cats as $cat ) {
                        $params = array_merge($r, array('category'=>$cat->term_id));
@@ -181,7 +212,7 @@ function wp_list_bookmarks($args = '') {
                                continue;
                        $output .= str_replace(array('%id', '%class'), array("linkcat-$cat->term_id", $class), $category_before);
                        $catname = apply_filters( "link_category", $cat->name );
-                       $output .= "$title_before$catname$title_after\n\t<ul>\n";
+                       $output .= "$title_before$catname$title_after\n\t<ul class='xoxo blogroll'>\n";
                        $output .= _walk_bookmarks($bookmarks, $r);
                        $output .= "\n\t</ul>\n$category_after\n";
                }
@@ -192,7 +223,7 @@ function wp_list_bookmarks($args = '') {
                if ( !empty($bookmarks) ) {
                        if ( !empty( $title_li ) ){
                                $output .= str_replace(array('%id', '%class'), array("linkcat-$category", $class), $category_before);
-                               $output .= "$title_before$title_li$title_after\n\t<ul>\n";
+                               $output .= "$title_before$title_li$title_after\n\t<ul class='xoxo blogroll'>\n";
                                $output .= _walk_bookmarks($bookmarks, $r);
                                $output .= "\n\t</ul>\n$category_after\n";
                        } else {
index 776d5193305451acec9cede7f8b4fb96db1f93d4..260dbafbe7c546ce5391653000e280368df61113 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 /**
- * get_bookmark() - Get Bookmark data based on ID
+ * Retrieve Bookmark data based on ID
  *
  * @since 2.1
  * @uses $wpdb Database Object
@@ -37,7 +37,7 @@ function get_bookmark($bookmark_id, $output = OBJECT, $filter = 'raw') {
 }
 
 /**
- * get_bookmark_field() - Gets single bookmark data item or field.
+ * Retrieve single bookmark data item or field.
  *
  * @since 2.3
  * @uses get_bookmark() Gets bookmark object using $bookmark as ID
@@ -65,7 +65,7 @@ function get_bookmark_field( $field, $bookmark, $context = 'display' ) {
 }
 
 /**
- * get_link() - Returns bookmark data based on ID.
+ * Retrieve bookmark data based on ID.
  *
  * @since 2.0
  * @deprecated Use get_bookmark()
@@ -80,25 +80,35 @@ function get_link($bookmark_id, $output = OBJECT, $filter = 'raw') {
 }
 
 /**
- * get_bookmarks() - Retrieves the list of bookmarks
+ * Retrieves the list of bookmarks
  *
  * Attempts to retrieve from the cache first based on MD5 hash of arguments. If
  * that fails, then the query will be built from the arguments and executed. The
  * results will be stored to the cache.
  *
  * List of default arguments are as follows:
- * 'orderby' - Default is 'name' (string). How to order the links by. String is based off of the bookmark scheme.
- * 'order' - Default is 'ASC' (string). Either 'ASC' or 'DESC'. Orders in either ascending or descending order.
- * 'limit' - Default is -1 (integer) or show all. The amount of bookmarks to display.
- * 'category' - Default is empty string (string). Include the links in what category ID(s).
- * 'category_name' - Default is empty string (string). Get links by category name.
- * 'hide_invisible' - Default is 1 (integer). Whether to show (default) or hide links marked as 'invisible'.
- * 'show_updated' - Default is 0 (integer). Will show the time of when the bookmark was last updated.
- * 'include' - Default is empty string (string). Include other categories separated by commas.
- * 'exclude' - Default is empty string (string). Exclude other categories separated by commas.
+ * 'orderby' - Default is 'name' (string). How to order the links by. String is
+ *             based off of the bookmark scheme.
+ * 'order' - Default is 'ASC' (string). Either 'ASC' or 'DESC'. Orders in either
+ *             ascending or descending order.
+ * 'limit' - Default is -1 (integer) or show all. The amount of bookmarks to
+ *             display.
+ * 'category' - Default is empty string (string). Include the links in what
+ *             category ID(s).
+ * 'category_name' - Default is empty string (string). Get links by category
+ *             name.
+ * 'hide_invisible' - Default is 1 (integer). Whether to show (default) or hide
+ *             links marked as 'invisible'.
+ * 'show_updated' - Default is 0 (integer). Will show the time of when the
+ *             bookmark was last updated.
+ * 'include' - Default is empty string (string). Include other categories
+ *             separated by commas.
+ * 'exclude' - Default is empty string (string). Exclude other categories
+ *             separated by commas.
  *
  * @since 2.1
  * @uses $wpdb Database Object
+ * @link http://codex.wordpress.org/Template_Tags/get_bookmarks
  *
  * @param string|array $args List of arguments to overwrite the defaults
  * @return array List of bookmark row objects
@@ -226,12 +236,13 @@ function get_bookmarks($args = '') {
 }
 
 /**
- * sanitize_bookmark() - Sanitizes all bookmark fields
+ * Sanitizes all bookmark fields
  *
  * @since 2.3
  *
  * @param object|array $bookmark Bookmark row
- * @param string $context Optional, default is 'display'. How to filter the fields
+ * @param string $context Optional, default is 'display'. How to filter the
+ *             fields
  * @return object|array Same type as $bookmark but with fields sanitized.
  */
 function sanitize_bookmark($bookmark, $context = 'display') {
@@ -254,25 +265,27 @@ function sanitize_bookmark($bookmark, $context = 'display') {
 }
 
 /**
- * sanitize_bookmark_field() - Sanitizes a bookmark field
+ * Sanitizes a bookmark field
  *
- * Sanitizes the bookmark fields based on what the field name is. If the field has a
- * strict value set, then it will be tested for that, else a more generic filtering is
- * applied. After the more strict filter is applied, if the $context is 'raw' then the
- * value is immediately return.
+ * Sanitizes the bookmark fields based on what the field name is. If the field
+ * has a strict value set, then it will be tested for that, else a more generic
+ * filtering is applied. After the more strict filter is applied, if the
+ * $context is 'raw' then the value is immediately return.
  *
- * Hooks exist for the more generic cases. With the 'edit' context, the 'edit_$field'
- * filter will be called and passed the $value and $bookmark_id respectively. With the
- * 'db' context, the 'pre_$field' filter is called and passed the value. The 'display'
- * context is the final context and has the $field has the filter name and is passed the
- * $value, $bookmark_id, and $context respectively.
+ * Hooks exist for the more generic cases. With the 'edit' context, the
+ * 'edit_$field' filter will be called and passed the $value and $bookmark_id
+ * respectively. With the 'db' context, the 'pre_$field' filter is called and
+ * passed the value. The 'display' context is the final context and has the
+ * $field has the filter name and is passed the $value, $bookmark_id, and
+ * $context respectively.
  *
  * @since 2.3
  *
  * @param string $field The bookmark field
  * @param mixed $value The bookmark field value
  * @param int $bookmark_id Bookmark ID
- * @param string $context How to filter the field value. Either 'raw', 'edit', 'attribute', 'js', 'db', or 'display'
+ * @param string $context How to filter the field value. Either 'raw', 'edit',
+ *             'attribute', 'js', 'db', or 'display'
  * @return mixed The filtered value
  */
 function sanitize_bookmark_field($field, $value, $bookmark_id, $context) {
@@ -318,7 +331,7 @@ function sanitize_bookmark_field($field, $value, $bookmark_id, $context) {
 }
 
 /**
- * delete_get_bookmark_cache() - Deletes entire bookmark cache
+ * Deletes entire bookmark cache
  *
  * @since 2.1
  * @uses wp_cache_delete() Deletes the contents of 'get_bookmarks'
index bb6cafa39891140e0fd033ee2e1dfc27825daed3..cfdab824e42826cd1b8284ef1411d0ceeb5fcf09 100644 (file)
@@ -2,12 +2,14 @@
 /**
  * Object Cache API
  *
+ * @link http://codex.wordpress.org/Function_Reference/WP_Cache
+ *
  * @package WordPress
  * @subpackage Cache
  */
 
 /**
- * wp_cache_add() - Adds data to the cache, if the cache key doesn't aleady exist
+ * Adds data to the cache, if the cache key doesn't aleady exist.
  *
  * @since 2.0
  * @uses $wp_object_cache Object Cache Class
@@ -26,11 +28,12 @@ function wp_cache_add($key, $data, $flag = '', $expire = 0) {
 }
 
 /**
- * wp_cache_close() - Closes the cache
+ * Closes the cache.
  *
- * This function has ceased to do anything since WordPress 2.5.
- * The functionality was removed along with the rest of the
- * persistant cache.
+ * This function has ceased to do anything since WordPress 2.5. The
+ * functionality was removed along with the rest of the persistant cache. This
+ * does not mean that plugins can't implement this function when they need to
+ * make sure that the cache is cleaned up after WordPress no longer needs it.
  *
  * @since 2.0
  *
@@ -41,7 +44,7 @@ function wp_cache_close() {
 }
 
 /**
- * wp_cache_delete() - Removes the cache contents matching ID and flag
+ * Removes the cache contents matching ID and flag.
  *
  * @since 2.0
  * @uses $wp_object_cache Object Cache Class
@@ -58,7 +61,7 @@ function wp_cache_delete($id, $flag = '') {
 }
 
 /**
- * wp_cache_flush() - Removes all cache items
+ * Removes all cache items.
  *
  * @since 2.0
  * @uses $wp_object_cache Object Cache Class
@@ -73,7 +76,7 @@ function wp_cache_flush() {
 }
 
 /**
- * wp_cache_get() - Retrieves the cache contents from the cache by ID and flag
+ * Retrieves the cache contents from the cache by ID and flag.
  *
  * @since 2.0
  * @uses $wp_object_cache Object Cache Class
@@ -81,7 +84,8 @@ function wp_cache_flush() {
  *
  * @param int|string $id What the contents in the cache are called
  * @param string $flag Where the cache contents are grouped
- * @return bool|mixed False on failure to retrieve contents or the cache contents on success
+ * @return bool|mixed False on failure to retrieve contents or the cache
+ *             contents on success
  */
 function wp_cache_get($id, $flag = '') {
        global $wp_object_cache;
@@ -90,7 +94,7 @@ function wp_cache_get($id, $flag = '') {
 }
 
 /**
- * wp_cache_init() - Sets up Object Cache Global and assigns it
+ * Sets up Object Cache Global and assigns it.
  *
  * @since 2.0
  * @global WP_Object_Cache $wp_object_cache WordPress Object Cache
@@ -100,7 +104,7 @@ function wp_cache_init() {
 }
 
 /**
- * wp_cache_replace() - Replaces the contents of the cache with new data
+ * Replaces the contents of the cache with new data.
  *
  * @since 2.0
  * @uses $wp_object_cache Object Cache Class
@@ -119,7 +123,7 @@ function wp_cache_replace($key, $data, $flag = '', $expire = 0) {
 }
 
 /**
- * wp_cache_set() - Saves the data to the cache
+ * Saves the data to the cache.
  *
  * @since 2.0
  * @uses $wp_object_cache Object Cache Class
@@ -137,17 +141,41 @@ function wp_cache_set($key, $data, $flag = '', $expire = 0) {
        return $wp_object_cache->set($key, $data, $flag, $expire);
 }
 
+/**
+ * Adds a group or set of groups to the list of global groups.
+ *
+ * @since 2.6
+ *
+ * @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;
+}
+
+/**
+ * Adds a group or set of groups to the list of non-persistent groups.
+ *
+ * @since 2.6
+ *
+ * @param string|array $groups A group or an array of groups to add
+ */
+function wp_cache_add_non_persistent_groups( $groups ) {
+       // Default cache doesn't persist so nothing to do here.
+       return;
+}
+
 /**
  * WordPress Object Cache
  *
- * The WordPress Object Cache is used to save on trips to the database.
- * The Object Cache stores all of the cache data to memory and makes the
- * cache contents available by using a key, which is used to name and
- * later retrieve the cache contents.
+ * The WordPress Object Cache is used to save on trips to the database. The
+ * Object Cache stores all of the cache data to memory and makes the cache
+ * contents available by using a key, which is used to name and later retrieve
+ * the cache contents.
  *
- * The Object Cache can be replaced by other caching mechanisms by placing
- * files in the wp-content folder which is looked at in wp-settings. If
- * that file exists, then this file will not be included.
+ * The Object Cache can be replaced by other caching mechanisms by placing files
+ * in the wp-content folder which is looked at in wp-settings. If that file
+ * exists, then this file will not be included.
  *
  * @package WordPress
  * @subpackage Cache
@@ -173,15 +201,6 @@ class WP_Object_Cache {
         */
        var $non_existant_objects = array ();
 
-       /**
-        * Object caches that are global
-        *
-        * @var array
-        * @access private
-        * @since 2.0
-        */
-       var $global_groups = array ('users', 'userlogins', 'usermeta');
-
        /**
         * The amount of times the cache data was already stored in the cache.
         *
@@ -204,7 +223,8 @@ class WP_Object_Cache {
         * Adds data to the cache if it doesn't already exist.
         *
         * @uses WP_Object_Cache::get Checks to see if the cache already has data.
-        * @uses WP_Object_Cache::set Sets the data after the checking the cache contents existance.
+        * @uses WP_Object_Cache::set Sets the data after the checking the cache
+        *              contents existance.
         *
         * @since 2.0
         *
@@ -227,18 +247,19 @@ class WP_Object_Cache {
        /**
         * Remove the contents of the cache ID in the group
         *
-        * If the cache ID does not exist in the group and $force parameter
-        * is set to false, then nothing will happen. The $force parameter
-        * is set to false by default.
+        * If the cache ID does not exist in the group and $force parameter is set
+        * to false, then nothing will happen. The $force parameter is set to false
+        * by default.
         *
-        * On success the group and the id will be added to the
+        * On success the group and the id will be added to the 
         * $non_existant_objects property in the class.
         *
         * @since 2.0
         *
         * @param int|string $id What the contents in the cache are called
         * @param string $group Where the cache contents are grouped
-        * @param bool $force Optional. Whether to force the unsetting of the cache ID in the group
+        * @param bool $force Optional. Whether to force the unsetting of the cache
+        *              ID in the group
         * @return bool False if the contents weren't deleted and true on success
         */
        function delete($id, $group = 'default', $force = false) {
@@ -269,21 +290,22 @@ class WP_Object_Cache {
        /**
         * Retrieves the cache contents, if it exists
         *
-        * The contents will be first attempted to be retrieved by searching
-        * by the ID in the cache group. If the cache is hit (success) then
-        * the contents are returned.
+        * The contents will be first attempted to be retrieved by searching by the
+        * 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 cache group and ID exist in there the cache misses will not be
-        * incremented. If not in the nonexistant objects property, then the
-        * cache misses will be incremented and the cache group and ID will
-        * be added to the nonexistant objects.
+        * On failure, the $non_existant_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
+        * misses will be incremented and the cache group and ID will be added to
+        * the nonexistant objects.
         *
         * @since 2.0
         *
         * @param int|string $id What the contents in the cache are called
         * @param string $group Where the cache contents are grouped
-        * @return bool|mixed False on failure to retrieve contents or the cache contents on success
+        * @return bool|mixed False on failure to retrieve contents or the cache
+        *              contents on success
         */
        function get($id, $group = 'default') {
                if (empty ($group))
@@ -327,15 +349,14 @@ class WP_Object_Cache {
        /**
         * Sets the data contents into the cache
         *
-        * The cache contents is grouped by the $group parameter followed
-        * by the $id. This allows for duplicate ids in unique groups.
-        * Therefore, naming of the group should be used with care and
-        * should follow normal function naming guidelines outside of
-        * core WordPress usage.
+        * The cache contents is grouped by the $group parameter followed by the
+        * $id. This allows for duplicate ids in unique groups. Therefore, naming of
+        * the group should be used with care and should follow normal function
+        * naming guidelines outside of core WordPress usage.
         *
-        * The $expire parameter is not used, because the cache will
-        * automatically expire for each time a page is accessed and PHP
-        * finishes. The method is more for cache plugins which use files.
+        * The $expire parameter is not used, because the cache will automatically
+        * expire for each time a page is accessed and PHP finishes. The method is
+        * more for cache plugins which use files.
         *
         * @since 2.0
         *
@@ -363,8 +384,8 @@ class WP_Object_Cache {
        /**
         * Echos the stats of the caching.
         *
-        * Gives the cache hits, and cache misses. Also prints every cached
-        * group, key and the data.
+        * Gives the cache hits, and cache misses. Also prints every cached group,
+        * key and the data.
         *
         * @since 2.0
         */
@@ -402,7 +423,11 @@ class WP_Object_Cache {
         * @return null|WP_Object_Cache If cache is disabled, returns null.
         */
        function __construct() {
-               register_shutdown_function(array(&$this, "__destruct")); /** @todo This should be moved to the PHP4 style constructor, PHP5 already calls __destruct() */
+               /**
+                * @todo This should be moved to the PHP4 style constructor, PHP5
+                * already calls __destruct()
+                */
+               register_shutdown_function(array(&$this, "__destruct"));
        }
 
        /**
index 5ad44575028b2e31b87449415ae98b6f6684ef20..4c1e3657f71bfb949a77873a70aa1a54070d6c36 100644 (file)
@@ -2,7 +2,8 @@
 /**
  * Canonical API to handle WordPress Redirecting
  *
- * Based on "Permalink Redirect" from Scott Yang and "Enforce www. Preference" by Mark Jaquith
+ * Based on "Permalink Redirect" from Scott Yang and "Enforce www. Preference"
+ * by Mark Jaquith
  *
  * @author Scott Yang
  * @author Mark Jaquith
  */
 
 /**
- * redirect_canonical() - Redirects incoming links to the proper URL based on the site url
+ * Redirects incoming links to the proper URL based on the site url
  *
- * Search engines consider www.somedomain.com and somedomain.com to be two different URLs
- * when they both go to the same location. This SEO enhancement prevents penality for
- * duplicate content by redirecting all incoming links to one or the other.
+ * Search engines consider www.somedomain.com and somedomain.com to be two
+ * different URLs when they both go to the same location. This SEO enhancement
+ * prevents penality for duplicate content by redirecting all incoming links to
+ * one or the other.
  *
- * Prevents redirection for feeds, trackbacks, searches, comment popup, and admin URLs.
- * Does not redirect on IIS, page/post previews, and on form data.
+ * Prevents redirection for feeds, trackbacks, searches, comment popup, and
+ * admin URLs. Does not redirect on IIS, page/post previews, and on form data.
  *
- * Will also attempt to find the correct link when a user enters a URL that does not exist
- * based on exact WordPress query. Will instead try to parse the URL or query in an attempt
- * to figure the correct page to go to.
+ * Will also attempt to find the correct link when a user enters a URL that does
+ * not exist based on exact WordPress query. Will instead try to parse the URL
+ * or query in an attempt to figure the correct page to go to.
  *
  * @since 2.3
  * @uses $wp_rewrite
  * @uses $is_IIS
  *
- * @param string $requested_url Optional. The URL that was requested, used to figure if redirect is needed.
+ * @param string $requested_url Optional. The URL that was requested, used to
+ *             figure if redirect is needed.
  * @param bool $do_redirect Optional. Redirect to the new URL.
- * @return null|false|string Null, if redirect not needed. False, if redirect not needed or the string of the URL
+ * @return null|false|string Null, if redirect not needed. False, if redirect
+ *             not needed or the string of the URL
  */
 function redirect_canonical($requested_url=null, $do_redirect=true) {
        global $wp_rewrite, $is_IIS;
 
-       if ( is_feed() || is_trackback() || is_search() || is_comments_popup() || is_admin() || $is_IIS || ( isset($_POST) && count($_POST) ) || is_preview() )
+       if ( is_feed() || is_trackback() || is_search() || is_comments_popup() || is_admin() || $is_IIS || ( isset($_POST) && count($_POST) ) || is_preview() || is_robots() )
                return;
 
        if ( !$requested_url ) {
@@ -137,7 +141,8 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
 
        // www.example.com vs example.com
        $user_home = @parse_url(get_option('home'));
-       $redirect['host'] = $user_home['host'];
+       if ( isset($user_home['host']) )
+               $redirect['host'] = $user_home['host'];
 
        // Handle ports
        if ( isset($user_home['port']) )
@@ -160,11 +165,12 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
                } else {
                        foreach ( array('single', 'category', 'page', 'day', 'month', 'year') as $type ) {
                                $func = 'is_' . $type;
-                               if ( call_user_func($func) )
+                               if ( call_user_func($func) ) {
                                        $user_ts_type = $type;
                                        break;
                                }
                        }
+               }
                $redirect['path'] = user_trailingslashit($redirect['path'], $user_ts_type);
        } elseif ( is_home() ) {
                $redirect['path'] = trailingslashit($redirect['path']);
@@ -210,12 +216,13 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
 }
 
 /**
- * redirect_guess_404_permalink() - Tries to guess correct post based on query vars
+ * Attempts to guess correct post based on query vars
  *
  * @since 2.3
  * @uses $wpdb
  *
- * @return bool|string Returns False, if it can't find post, returns correct location on success.
+ * @return bool|string Returns False, if it can't find post, returns correct
+ *             location on success.
  */
 function redirect_guess_404_permalink() {
        global $wpdb;
index 85eaa7735eb696f89e4cc0df71a415fb0eee3e60..875173d63b19742dfe55832a5dcd95a0fd5fd9b9 100644 (file)
@@ -34,7 +34,7 @@ class WP_Roles {
                }
        }
 
-       function add_role($role, $display_name, $capabilities = '') {
+       function add_role($role, $display_name, $capabilities = array()) {
                if ( isset($this->roles[$role]) )
                        return;
 
@@ -465,7 +465,7 @@ function get_role($role) {
        return $wp_roles->get_role($role);
 }
 
-function add_role($role, $display_name, $capabilities = '') {
+function add_role($role, $display_name, $capabilities = array()) {
        global $wp_roles;
 
        if ( ! isset($wp_roles) )
index ba24302074acab8eedaa9e6523249839af177c5f..2c37e977388fb33edd762a62a428d30ff80dc5c1 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function get_category_children($id, $before = '/', $after = '') {
+function get_category_children($id, $before = '/', $after = '', $visited=array()) {
        if ( 0 == $id )
                return '';
 
@@ -14,7 +14,8 @@ function get_category_children($id, $before = '/', $after = '') {
                $category = get_category($cat_id);
                if ( is_wp_error( $category ) )
                        return $category;
-               if ( $category->parent == $id ) {
+               if ( $category->parent == $id && !in_array($category->term_id, $visited) ) {
+                       $visited[] = $category->term_id;
                        $chain .= $before.$category->term_id.$after;
                        $chain .= get_category_children($category->term_id, $before, $after);
                }
@@ -44,7 +45,7 @@ function get_category_link($category_id) {
        return apply_filters('category_link', $catlink, $category_id);
 }
 
-function get_category_parents($id, $link = FALSE, $separator = '/', $nicename = FALSE){
+function get_category_parents($id, $link = FALSE, $separator = '/', $nicename = FALSE, $visited = array()){
        $chain = '';
        $parent = &get_category($id);
        if ( is_wp_error( $parent ) )
@@ -55,8 +56,10 @@ function get_category_parents($id, $link = FALSE, $separator = '/', $nicename =
        else
                $name = $parent->cat_name;
 
-       if ( $parent->parent && ($parent->parent != $parent->term_id) )
-               $chain .= get_category_parents($parent->parent, $link, $separator, $nicename);
+       if ( $parent->parent && ($parent->parent != $parent->term_id) && !in_array($parent->parent, $visited) ) {
+               $visited[] = $parent->parent;
+               $chain .= get_category_parents($parent->parent, $link, $separator, $nicename, $visited);
+       }
 
        if ( $link )
                $chain .= '<a href="' . get_category_link($parent->term_id) . '" title="' . sprintf(__("View all posts in %s"), $parent->cat_name) . '">'.$name.'</a>' . $separator;
@@ -185,9 +188,12 @@ function in_category( $category ) { // Check if the current post is in the given
        if ( empty($category) )
                return false;
 
-       $cat_ID = get_cat_ID($category);
-       if ( $cat_ID )
-               $category = $cat_ID;
+       // If category is not an int, check to see if it's a name
+       if ( ! is_int($category) ) {
+               $cat_ID = get_cat_ID($category);
+               if ( $cat_ID )
+                       $category = $cat_ID;
+       }
 
        $categories = get_object_term_cache($post->ID, 'category');
        if ( false === $categories )
@@ -272,7 +278,7 @@ function wp_list_categories($args = '') {
                'style' => 'list', 'show_count' => 0,
                'hide_empty' => 1, 'use_desc_for_title' => 1,
                'child_of' => 0, 'feed' => '', 'feed_type' => '',
-               'feed_image' => '', 'exclude' => '',
+               'feed_image' => '', 'exclude' => '', 'current_category' => 0,
                'hierarchical' => true, 'title_li' => __('Categories'),
                'echo' => 1, 'depth' => 0
        );
@@ -309,7 +315,7 @@ function wp_list_categories($args = '') {
                        else
                                $output .= '<a href="' .  get_bloginfo('url')  . '">' . $show_option_all . '</a>';
 
-               if ( is_category() )
+               if ( empty( $r['current_category'] ) && is_category() )
                        $r['current_category'] = $wp_query->get_queried_object_id();
 
                if ( $hierarchical )
@@ -412,7 +418,6 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
        foreach ( $counts as $tag => $count ) {
                $tag_id = $tag_ids[$tag];
                $tag_link = clean_url($tag_links[$tag]);
-               $tag = str_replace(' ', '&nbsp;', wp_specialchars( $tag ));
                $a[] = "<a href='$tag_link' class='tag-link-$tag_id' title='" . attribute_escape( sprintf( __ngettext('%d topic','%d topics',$count), $count ) ) . "'$rel style='font-size: " .
                        ( $smallest + ( ( $count - $min_count ) * $font_step ) )
                        . "$unit;'>$tag</a>";
@@ -536,4 +541,41 @@ function the_terms( $id, $taxonomy, $before = '', $sep = '', $after = '' ) {
                echo $return;
 }
 
+/**
+ * Check if the current post has the given tag
+ *
+ * @package WordPress
+ * @since 2.6
+ *
+ * @uses wp_get_object_terms() Gets the tags.
+ *
+ * @param string|int|array $tag Optional. The tag name/id/slug or array of them to check for
+ * @return bool True if the current post has the given tag, or any tag, if no tag specified
+ */
+function has_tag($tag = '') {
+       global $post;
+       $taxonomy = 'post_tag';
+
+       if ( !in_the_loop() ) return false; // in-the-loop function
+
+       $post_id = (int) $post->ID;
+
+       $terms = get_object_term_cache($post_id, $taxonomy);
+       if (empty($terms))
+                $terms = wp_get_object_terms($post_id, $taxonomy);
+       if (empty($terms)) return false;
+
+       if (empty($tag)) return (!empty($terms));
+
+       $tag = (array) $tag;
+
+       foreach($terms as $term) {
+               if ( in_array( $term->term_id, $tag ) ) return true;
+               if ( in_array( $term->name, $tag ) ) return true;
+               if ( in_array( $term->slug, $tag ) ) return true;
+       }
+
+       return false;
+}
+
 ?>
index 193390dd07f6148138e433e654398714675e903e..d97b72d2a60cd987feb49c9084466e7406fc5913 100644 (file)
@@ -1,5 +1,18 @@
 <?php
-
+/**
+ * WordPress Category API
+ *
+ * @package WordPress
+ */
+
+/**
+ * Retrieves all category IDs.
+ *
+ * @since 2.0.0
+ * @link http://codex.wordpress.org/Function_Reference/get_all_category_ids
+ *
+ * @return object List of all of the category IDs.
+ */
 function get_all_category_ids() {
        if ( ! $cat_ids = wp_cache_get('all_category_ids', 'category') ) {
                $cat_ids = get_terms('category', 'fields=ids&get=all');
@@ -9,6 +22,20 @@ function get_all_category_ids() {
        return $cat_ids;
 }
 
+/**
+ * Retrieve list of category objects.
+ *
+ * If you change the type to 'link' in the arguments, then the link categories
+ * will be returned instead. Also all categories will be updated to be backwards
+ * compatible with pre-2.3 plugins and themes.
+ *
+ * @since 2.1.0
+ * @see get_terms() Type of arguments that can be changed.
+ * @link http://codex.wordpress.org/Function_Reference/get_categories
+ *
+ * @param string|array $args Optional. Change the defaults retrieving categories.
+ * @return array List of categories.
+ */
 function &get_categories($args = '') {
        $defaults = array('type' => 'category');
        $args = wp_parse_args($args, $defaults);
@@ -24,8 +51,28 @@ function &get_categories($args = '') {
        return $categories;
 }
 
-// Retrieves category data given a category ID or category object.
-// Handles category caching.
+/**
+ * Retrieves category data given a category ID or category object.
+ *
+ * If you pass the $category parameter an object, which is assumed to be the
+ * category row object retrieved the database. It will cache the category data.
+ *
+ * If you pass $category an integer of the category ID, then that category will
+ * be retrieved from the database, if it isn't already cached, and pass it back.
+ *
+ * If you look at get_term(), then both types will be passed through several
+ * filters and finally sanitized based on the $filter parameter value.
+ *
+ * The category will converted to maintain backwards compatibility.
+ *
+ * @since 2.1.0
+ * @uses get_term() Used to get the category data from the taxonomy.
+ *
+ * @param int|object $category Category ID or Category row object
+ * @param string $output Optional. Constant OBJECT, ARRAY_A, or ARRAY_N
+ * @param string $filter Optional. Default is raw or no WordPress defined filter will applied.
+ * @return mixed Category data in type defined by $output parameter.
+ */
 function &get_category($category, $output = OBJECT, $filter = 'raw') {
        $category = get_term($category, 'category', $output, $filter);
        if ( is_wp_error( $category ) )
@@ -36,6 +83,25 @@ function &get_category($category, $output = OBJECT, $filter = 'raw') {
        return $category;
 }
 
+/**
+ * Retrieve category based on URL containing the category slug.
+ *
+ * Breaks the $category_path parameter up to get the category slug.
+ *
+ * Tries to find the child path and will return it. If it doesn't find a
+ * match, then it will return the first category matching slug, if $full_match,
+ * is set to false. If it does not, then it will return null.
+ *
+ * It is also possible that it will return a WP_Error object on failure. Check
+ * for it when using this function.
+ *
+ * @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 string $output Optional. Constant OBJECT, ARRAY_A, or ARRAY_N
+ * @return null|object|array Null on failure. Type is based on $output value.
+ */
 function get_category_by_path($category_path, $full_match = true, $output = OBJECT) {
        $category_path = rawurlencode(urldecode($category_path));
        $category_path = str_replace('%2F', '/', $category_path);
@@ -50,7 +116,7 @@ function get_category_by_path($category_path, $full_match = true, $output = OBJE
        $categories = get_terms('category', "get=all&slug=$leaf_path");
 
        if ( empty($categories) )
-               return NULL;
+               return null;
 
        foreach ($categories as $category) {
                $path = '/' . $leaf_path;
@@ -70,9 +136,17 @@ function get_category_by_path($category_path, $full_match = true, $output = OBJE
        if ( ! $full_match )
                return get_category($categories[0]->term_id, $output);
 
-       return NULL;
+       return null;
 }
 
+/**
+ * Retrieve category object by category slug.
+ *
+ * @since 2.3.0
+ *
+ * @param string $slug The category slug.
+ * @return object Category data object
+ */
 function get_category_by_slug( $slug  ) {
        $category = get_term_by('slug', $slug, 'category');
        if ( $category )
@@ -81,7 +155,15 @@ function get_category_by_slug( $slug  ) {
        return $category;
 }
 
-// Get the ID of a category from its name
+
+/**
+ * Retrieve the ID of a category from its name.
+ *
+ * @since 1.0.0
+ *
+ * @param string $cat_name Optional. Default is 'General' and can be any category name.
+ * @return int 0, if failure and ID of category on success.
+ */
 function get_cat_ID($cat_name='General') {
        $cat = get_term_by('name', $cat_name, 'category');
        if ($cat)
@@ -89,18 +171,49 @@ function get_cat_ID($cat_name='General') {
        return 0;
 }
 
-// Deprecate
+
+/**
+ * Retrieve the category name by the category ID.
+ *
+ * @since 0.71
+ * @deprecated Use get_cat_name()
+ * @see get_cat_name() get_catname() is deprecated in favor of get_cat_name().
+ *
+ * @param int $cat_ID Category ID
+ * @return string category name
+ */
 function get_catname($cat_ID) {
        return get_cat_name($cat_ID);
 }
 
-// Get the name of a category from its ID
+
+/**
+ * Retrieve the name of a category from its ID.
+ *
+ * @since 1.0.0
+ *
+ * @param int $cat_id Category ID
+ * @return string Category name
+ */
 function get_cat_name($cat_id) {
        $cat_id = (int) $cat_id;
        $category = &get_category($cat_id);
        return $category->name;
 }
 
+
+/**
+ * Check if a category is an ancestor of another category.
+ *
+ * You can use either an id or the category object for both parameters. If you
+ * use an integer the category will be retrieved.
+ *
+ * @since 2.1.0
+ *
+ * @param int|object $cat1 ID or object to check if this is the parent category.
+ * @param int|object $cat2 The child category.
+ * @return bool Whether $cat2 is child of $cat1
+ */
 function cat_is_ancestor_of($cat1, $cat2) {
        if ( is_int($cat1) )
                $cat1 = & get_category($cat1);
@@ -116,16 +229,51 @@ function cat_is_ancestor_of($cat1, $cat2) {
        return cat_is_ancestor_of($cat1, get_category($cat2->parent));
 }
 
+
+/**
+ * Sanitizes category data based on context.
+ *
+ * @since 2.3.0
+ * @uses sanitize_term() See this function for what context are supported.
+ *
+ * @param object|array $category Category data
+ * @param string $context Optional. Default is 'display'.
+ * @return object|array Same type as $category with sanitized data for safe use.
+ */
 function sanitize_category($category, $context = 'display') {
        return sanitize_term($category, 'category', $context);
 }
 
+
+/**
+ * Sanitizes data in single category key field.
+ *
+ * @since 2.3.0
+ * @uses sanitize_term_field() See function for more details.
+ *
+ * @param string $field Category key to sanitize
+ * @param mixed $value Category value to sanitize
+ * @param int $cat_id Category ID
+ * @param string $context What filter to use, 'raw', 'display', etc.
+ * @return mixed Same type as $value after $value has been sanitized.
+ */
 function sanitize_category_field($field, $value, $cat_id, $context) {
        return sanitize_term_field($field, $value, $cat_id, 'category', $context);
 }
 
-// Tags
+/* Tags */
 
+
+/**
+ * Retrieves all post tags.
+ *
+ * @since 2.3.0
+ * @see get_terms() For list of arguments to pass.
+ * @uses apply_filters() Calls 'get_tags' hook on array of tags and with $args.
+ *
+ * @param string|array $args Tag arguments to use when retrieving tags.
+ * @return array List of tags.
+ */
 function &get_tags($args = '') {
        $tags = get_terms('post_tag', $args);
 
@@ -136,26 +284,82 @@ function &get_tags($args = '') {
        return $tags;
 }
 
+
+/**
+ * Retrieve post tag by tag ID or tag object.
+ *
+ * If you pass the $tag parameter an object, which is assumed to be the tag row
+ * object retrieved the database. It will cache the tag data.
+ *
+ * If you pass $tag an integer of the tag ID, then that tag will
+ * be retrieved from the database, if it isn't already cached, and pass it back.
+ *
+ * If you look at get_term(), then both types will be passed through several
+ * filters and finally sanitized based on the $filter parameter value.
+ *
+ * @since 2.3.0
+ *
+ * @param int|object $tag
+ * @param string $output Optional. Constant OBJECT, ARRAY_A, or ARRAY_N
+ * @param string $filter Optional. Default is raw or no WordPress defined filter will applied.
+ * @return object|array Return type based on $output value.
+ */
 function &get_tag($tag, $output = OBJECT, $filter = 'raw') {
        return get_term($tag, 'post_tag', $output, $filter);
 }
 
-//
-// Cache
-//
 
+/* Cache */
+
+
+/**
+ * Update the categories cache.
+ *
+ * This function does not appear to be used anymore or does not appear to be
+ * needed. It might be a legacy function left over from when there was a need
+ * for updating the category cache.
+ *
+ * @since 1.5.0
+ *
+ * @return bool Always return True
+ */
 function update_category_cache() {
        return true;
 }
 
+
+/**
+ * Remove the category cache data based on ID.
+ *
+ * @since 2.1.0
+ * @uses clean_term_cache() Clears the cache for the category based on ID
+ *
+ * @param int $id Category ID
+ */
 function clean_category_cache($id) {
        clean_term_cache($id, 'category');
 }
 
-//
-// Private helpers
-//
 
+/**
+ * Update category structure to old pre 2.3 from new taxonomy structure.
+ *
+ * This function was added for the taxonomy support to update the new category
+ * structure with the old category one. This will maintain compatibility with
+ * plugins and themes which depend on the old key or property names.
+ *
+ * The parameter should only be passed a variable and not create the array or
+ * object inline to the parameter. The reason for this is that parameter is
+ * passed by reference and PHP will fail unless it has the variable.
+ *
+ * There is no return value, because everything is updated on the variable you
+ * pass to it. This is one of the features with using pass by reference in PHP.
+ *
+ * @since 2.3.0
+ * @access private
+ *
+ * @param array|object $category Category Row object or array
+ */
 function _make_cat_compat( &$category) {
        if ( is_object($category) ) {
                $category->cat_ID = &$category->term_id;
@@ -174,4 +378,5 @@ function _make_cat_compat( &$category) {
        }
 }
 
+
 ?>
index bef0c058aa7532fc3380f32825bd4b2446687906..f27be3f9cf26f0dea5e1da88983e89718edcb907 100644 (file)
  * @license BSD License http://www.opensource.org/licenses/bsd-license.php
  */
 
+/**
+ * IXR_Value
+ *
+ * @package IXR
+ * @since 1.5
+ */
 class IXR_Value {
     var $data;
     var $type;
@@ -120,7 +126,12 @@ class IXR_Value {
     }
 }
 
-
+/**
+ * IXR_Message
+ *
+ * @package IXR
+ * @since 1.5
+ */
 class IXR_Message {
     var $message;
     var $messageType;  // methodCall / methodResponse / fault
@@ -263,7 +274,12 @@ class IXR_Message {
     }
 }
 
-
+/**
+ * IXR_Server
+ *
+ * @package IXR
+ * @since 1.5
+ */
 class IXR_Server {
     var $data;
     var $callbacks = array();
@@ -424,6 +440,12 @@ EOD;
     }
 }
 
+/**
+ * IXR_Request
+ *
+ * @package IXR
+ * @since 1.5
+ */
 class IXR_Request {
     var $method;
     var $args;
@@ -454,7 +476,12 @@ EOD;
     }
 }
 
-
+/**
+ * IXR_Client
+ *
+ * @package IXR
+ * @since 1.5
+ */
 class IXR_Client {
     var $server;
     var $port;
@@ -565,7 +592,12 @@ class IXR_Client {
     }
 }
 
-
+/**
+ * IXR_Error
+ *
+ * @package IXR
+ * @since 1.5
+ */
 class IXR_Error {
     var $code;
     var $message;
@@ -597,7 +629,12 @@ EOD;
     }
 }
 
-
+/**
+ * IXR_Date
+ *
+ * @package IXR
+ * @since 1.5
+ */
 class IXR_Date {
     var $year;
     var $month;
@@ -641,7 +678,12 @@ class IXR_Date {
     }
 }
 
-
+/**
+ * IXR_Base64
+ *
+ * @package IXR
+ * @since 1.5
+ */
 class IXR_Base64 {
     var $data;
     function IXR_Base64($data) {
@@ -652,7 +694,12 @@ class IXR_Base64 {
     }
 }
 
-
+/**
+ * IXR_IntrospectionServer
+ *
+ * @package IXR
+ * @since 1.5
+ */
 class IXR_IntrospectionServer extends IXR_Server {
     var $signatures;
     var $help;
@@ -796,7 +843,12 @@ class IXR_IntrospectionServer extends IXR_Server {
     }
 }
 
-
+/**
+ * IXR_ClientMulticall
+ *
+ * @package IXR
+ * @since 1.5
+ */
 class IXR_ClientMulticall extends IXR_Client {
     var $calls = array();
     function IXR_ClientMulticall($server, $path = false, $port = 80) {
index c964b09b10e41834a39afe87431e647ceba7d5b0..70f9bdf5c1a20df6519b7c02cc2964d84ef85d34 100644 (file)
@@ -7,20 +7,12 @@
  * @link http://www.openwall.com/phpass/
  */
 
-#
-# Portable PHP password hashing framework.
-#
-# Version 0.1 / genuine.
 #
 # Written by Solar Designer <solar at openwall.com> in 2004-2006 and placed in
 # the public domain.
 #
 # There's absolutely no warranty.
 #
-# The homepage URL for this framework is:
-#
-#      http://www.openwall.com/phpass/
-#
 # Please be sure to update the Version line if you edit this file in any way.
 # It is suggested that you leave the main version number intact, but indicate
 # your project name (after the slash) and add your own revision information.
 # Obviously, since this code is in the public domain, the above are not
 # requirements (there can be none), but merely suggestions.
 #
+
+/**
+ * Portable PHP password hashing framework.
+ *
+ * @package phpass
+ * @version 0.1 / genuine
+ * @link http://www.openwall.com/phpass/
+ * @since 2.5
+ */
 class PasswordHash {
        var $itoa64;
        var $iteration_count_log2;
index c40b84de3961b68f478a2fb5db120308b4b14a2d..52840d8fe812d353f2272b877c5e6263f44154d1 100644 (file)
@@ -1,15 +1,14 @@
 <?php
-////////////////////////////////////////////////////
-// PHPMailer - PHP email class
-//
-// Class for sending email using either
-// sendmail, PHP mail(), or SMTP.  Methods are
-// based upon the standard AspEmail(tm) classes.
-//
-// Copyright (C) 2001 - 2003  Brent R. Matzelle
-//
-// License: LGPL, see LICENSE
-////////////////////////////////////////////////////
+/**
+ * PHPMailer - PHP email class
+ *
+ * Class for sending email using either sendmail, PHP mail(), or SMTP. Methods
+ * are based upon the standard AspEmail(tm) classes.
+ *
+ * @copyright 2001 - 2003 Brent R. Matzelle
+ * @license LGPL
+ * @package PHPMailer
+ */
 
 /**
  * PHPMailer - PHP email transport class
index 063b681046bcd9b05c8896420f3fa2791c03f390..bdb7903fd8a77ff37291d548e5a946a8f8d44125 100644 (file)
  *
  * pop3 class
  *
- * $Id: class-pop3.php 6440 2007-12-20 22:28:54Z westi $
+ * $Id: class-pop3.php 8082 2008-06-14 16:36:13Z westi $
  */
 
+/**
+ * POP3
+ *
+ * @package SquirrelMail
+ */
 class POP3 {
     var $ERROR      = '';       //  Error string.
 
index 08aa41953182bb86ab2c90cc4562fb6d59c7c173..dd8b951880ea7fd8177b50d0ea191b9d0bca23a0 100644 (file)
@@ -1,23 +1,23 @@
 <?php
-////////////////////////////////////////////////////
-// SMTP - PHP SMTP class
-//
-// Version 1.02
-//
-// Define an SMTP class that can be used to connect
-// and communicate with any SMTP server. It implements
-// all the SMTP functions defined in RFC821 except TURN.
-//
-// Author: Chris Ryan
-//
-// License: LGPL, see LICENSE
-////////////////////////////////////////////////////
+/**
+ * SMTP - PHP SMTP class
+ *
+ * Define an SMTP class that can be used to connect and communicate with any
+ * SMTP server. It implements all the SMTP functions defined in RFC821 except
+ * TURN.
+ *
+ * @version 1.02
+ * @author Chris Ryan
+ * @license LGPL
+ * @package PHPMailer
+ */
 
 /**
  * SMTP is rfc 821 compliant and implements all the rfc 821 SMTP
  * commands except TURN which will always return a not implemented
  * error. SMTP also provides some utility methods for sending mail
  * to an SMTP server.
+ *
  * @package PHPMailer
  * @author Chris Ryan
  */
@@ -249,7 +249,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 12f0e970546834913defccb3a28b259a5780bf19..5ec5dce4d8c1dca0d39a4747fd3e6b62ef2bfeb2 100644 (file)
@@ -8,13 +8,15 @@
  * @link http://snoopy.sourceforge.net/
  * @package Snoopy
  */
-/*************************************************
-
-Snoopy - the PHP net client
-Author: Monte Ohrt <monte@ispi.net>
-Copyright (c): 1999-2000 ispi, all rights reserved
-Version: 1.01
 
+if ( !in_array('Snoopy', get_declared_classes() ) ) :
+/**
+ * Snoopy - the PHP net client
+ *
+ * @author Monte Ohrt <monte@ispi.net>
+ * @copyright (c): 1999-2000 ispi, all rights reserved
+ * @version 1.01
+ *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
@@ -28,22 +30,19 @@ Version: 1.01
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-You may contact the author of Snoopy by e-mail at:
-monte@ispi.net
-
-Or, write to:
-Monte Ohrt
-CTO, ispi
-237 S. 70th suite 220
-Lincoln, NE 68510
-
-The latest version of Snoopy can be obtained from:
-http://snoopy.sourceforge.net/
-
-*************************************************/
-
-if ( !in_array('Snoopy', get_declared_classes() ) ) :
+ *
+ * You may contact the author of Snoopy by e-mail at:
+ * monte@ispi.net
+ *
+ * Or, write to:
+ * Monte Ohrt
+ * CTO, ispi
+ * 237 S. 70th suite 220
+ * Lincoln, NE 68510
+ *
+ * @link http://snoopy.sourceforge.net/ The latest version of Snoopy can be
+ *             obtained
+ */
 class Snoopy
 {
        /**** Public variables ****/
diff --git a/wp-includes/class.wp-dependencies.php b/wp-includes/class.wp-dependencies.php
new file mode 100644 (file)
index 0000000..1f7bb8d
--- /dev/null
@@ -0,0 +1,193 @@
+<?php
+
+class WP_Dependencies {
+       var $registered = array();
+       var $queue = array();
+       var $to_do = array();
+       var $done = array();
+       var $args = array();
+
+       function WP_Dependencies() {
+               $args = func_get_args();
+               call_user_func_array( array(&$this, '__construct'), $args );
+       }
+
+       function __construct() {}
+
+       /**
+        * Do the dependencies
+        *
+        * Process the items passed to it or the queue.  Processes all dependencies.
+        *
+        * @param mixed handles (optional) items to be processed.  (void) processes queue, (string) process that item, (array of strings) process those items
+        * @return array Items that have been processed
+        */
+       function do_items( $handles = false ) {
+               // Print the queue if nothing is passed.  If a string is passed, print that script.  If an array is passed, print those scripts.
+               $handles = false === $handles ? $this->queue : (array) $handles;
+               $this->all_deps( $handles );
+
+               foreach( $this->to_do as $handle ) {
+                       if ( !in_array($handle, $this->done) && isset($this->registered[$handle]) ) {
+                               if ( $this->registered[$handle]->src ) { // Else it defines a group.
+                                       $this->do_item( $handle );
+                               }
+                               $this->done[] = $handle;
+                       }
+               }
+
+               $this->to_do = array();
+               return $this->done;
+       }
+
+       function do_item( $handle ) {
+               return isset($this->registered[$handle]);
+       }
+
+       /**
+        * Determines dependencies
+        *
+        * Recursively builds array of items to process taking dependencies into account.  Does NOT catch infinite loops.
+        *
+
+        * @param mixed handles Accepts (string) dep name or (array of strings) dep names
+        * @param bool recursion Used internally when function calls itself
+        */
+       function all_deps( $handles, $recursion = false ) {
+               if ( !$handles = (array) $handles )
+                       return false;
+
+               foreach ( $handles as $handle ) {
+                       $handle = explode('?', $handle);
+                       if ( isset($handle[1]) )
+                               $this->args[$handle[0]] = $handle[1];
+                       $handle = $handle[0];
+
+                       if ( isset($this->to_do[$handle]) ) // Already grobbed it and its deps
+                               continue;
+
+                       $keep_going = true;
+                       if ( !isset($this->registered[$handle]) )
+                               $keep_going = false; // Script doesn't exist
+                       elseif ( $this->registered[$handle]->deps && array_diff($this->registered[$handle]->deps, array_keys($this->registered)) )
+                               $keep_going = false; // Script requires deps which don't exist (not a necessary check.  efficiency?)
+                       elseif ( $this->registered[$handle]->deps && !$this->all_deps( $this->registered[$handle]->deps, true ) )
+                               $keep_going = false; // Script requires deps which don't exist
+
+                       if ( !$keep_going ) { // Either script or its deps don't exist.
+                               if ( $recursion )
+                                       return false; // Abort this branch.
+                               else
+                                       continue; // We're at the top level.  Move on to the next one.
+                       }                                       
+
+                       $this->to_do[$handle] = true;
+               }
+
+               if ( !$recursion ) // at the end
+                       $this->to_do = array_keys( $this->to_do );
+               return true;
+       }
+
+       /**
+        * Adds item
+        *
+        * Adds the item only if no item of that name already exists
+        *
+        * @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 ver (optional) Script version (used for cache busting)
+        * @return array Hierarchical array of dependencies
+        */
+       function add( $handle, $src, $deps = array(), $ver = false, $args = null ) {
+               if ( isset($this->registered[$handle]) )
+                       return false;
+               $this->registered[$handle] = new _WP_Dependency( $handle, $src, $deps, $ver, $args );
+               return true;
+       }
+
+       /**
+        * Adds extra data
+        *
+        * Adds data only if script has already been added
+        *
+        * @param string handle Script name
+        * @param string data_name Name of object in which to store extra data
+        * @param array data Array of extra data
+        * @return bool success
+        */
+       function add_data( $handle, $data_name, $data ) {
+               if ( !isset($this->registered[$handle]) )
+                       return false;
+               return $this->registered[$handle]->add_data( $data_name, $data );
+       }
+
+       function remove( $handles ) {
+               foreach ( (array) $handles as $handle )
+                       unset($this->registered[$handle]);
+       }
+
+       function enqueue( $handles ) {
+               foreach ( (array) $handles as $handle ) {
+                       $handle = explode('?', $handle);
+                       if ( !in_array($handle[0], $this->queue) && isset($this->registered[$handle[0]]) ) {
+                               $this->queue[] = $handle[0];
+                               if ( isset($handle[1]) )
+                                       $this->args[$handle[0]] = $handle[1];
+                       }
+               }
+       }
+
+       function dequeue( $handles ) {
+               foreach ( (array) $handles as $handle )
+                       unset( $this->queue[$handle] );
+       }
+
+       function query( $handle, $list = 'registered' ) { // registered, queue, done, to_do
+               switch ( $list ) :
+               case 'registered':
+               case 'scripts': // back compat
+                       if ( isset($this->registered[$handle]) )
+                               return $this->registered[$handle];
+                       break;
+               case 'to_print': // back compat
+               case 'printed': // back compat
+                       if ( 'to_print' == $list )
+                               $list = 'to_do';
+                       else
+                               $list = 'printed';
+               default:
+                       if ( in_array($handle, $this->$list) )
+                               return true;
+                       break;
+               endswitch;
+               return false;
+       }
+
+}
+
+class _WP_Dependency {
+       var $handle;
+       var $src;
+       var $deps = array();
+       var $ver = false;
+       var $args = null;
+
+       var $extra = array();
+
+       function _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 ) {
+               if ( !is_scalar($name) )
+                       return false;
+               $this->extra[$name] = $data;
+               return true;
+       }
+}
diff --git a/wp-includes/class.wp-scripts.php b/wp-includes/class.wp-scripts.php
new file mode 100644 (file)
index 0000000..7652aec
--- /dev/null
@@ -0,0 +1,89 @@
+<?php
+
+class WP_Scripts extends WP_Dependencies {
+       var $base_url; // Full URL with trailing slash
+       var $default_version;
+
+       function __construct() {
+               do_action_ref_array( 'wp_default_scripts', array(&$this) );
+       }
+
+       /**
+        * Prints scripts
+        *
+        * Prints the scripts passed to it or the print queue.  Also prints all necessary dependencies.
+        *
+        * @param mixed handles (optional) Scripts to be printed.  (void) prints queue, (string) prints that script, (array of strings) prints those scripts.
+        * @return array Scripts that have been printed
+        */
+       function print_scripts( $handles = false ) {
+               return $this->do_items( $handles );
+       }
+
+       function print_scripts_l10n( $handle ) {
+               if ( empty($this->registered[$handle]->extra['l10n']) || empty($this->registered[$handle]->extra['l10n'][0]) || !is_array($this->registered[$handle]->extra['l10n'][1]) )
+                       return false;
+
+               $object_name = $this->registered[$handle]->extra['l10n'][0];
+
+               echo "<script type='text/javascript'>\n";
+               echo "/* <![CDATA[ */\n";
+               echo "\t$object_name = {\n";
+               $eol = '';
+               foreach ( $this->registered[$handle]->extra['l10n'][1] as $var => $val ) {
+                       echo "$eol\t\t$var: \"" . js_escape( $val ) . '"';
+                       $eol = ",\n";
+               }
+               echo "\n\t}\n";
+               echo "/* ]]> */\n";
+               echo "</script>\n";
+
+               return true;
+       }
+
+       function do_item( $handle ) {
+               if ( !parent::do_item($handle) )
+                       return false;
+
+               $ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version;
+               if ( isset($this->args[$handle]) )
+                       $ver .= '&amp;' . $this->args[$handle];
+
+               $src = $this->registered[$handle]->src;
+               if ( !preg_match('|^https?://|', $src) && !preg_match('|^' . preg_quote(WP_CONTENT_URL) . '|', $src) ) {
+                       $src = $this->base_url . $src;
+               }
+
+               $src = add_query_arg('ver', $ver, $src);
+               $src = clean_url(apply_filters( 'script_loader_src', $src, $handle ));
+
+               $this->print_scripts_l10n( $handle );
+
+               echo "<script type='text/javascript' src='$src'></script>\n";
+
+               return true;
+       }
+
+       /**
+        * Localizes a script
+        *
+        * Localizes only if script has already been added
+        *
+        * @param string handle Script name
+        * @param string object_name Name of JS object to hold l10n info
+        * @param array l10n Array of JS var name => localized string
+        * @return bool Successful localization
+        */
+       function localize( $handle, $object_name, $l10n ) {
+               if ( !$object_name || !$l10n )
+                       return false;
+               return $this->add_data( $handle, 'l10n', array( $object_name, $l10n ) );
+       }
+
+       function all_deps( $handles, $recursion = false ) {
+               $r = parent::all_deps( $handles, $recursion );
+               if ( !$recursion )
+                       $this->to_do = apply_filters( 'print_scripts_array', $this->to_do );
+               return $r;
+       }
+}
diff --git a/wp-includes/class.wp-styles.php b/wp-includes/class.wp-styles.php
new file mode 100644 (file)
index 0000000..8533943
--- /dev/null
@@ -0,0 +1,71 @@
+<?php
+
+class WP_Styles extends WP_Dependencies {
+       var $base_url;
+       var $default_version;
+       var $text_direction = 'ltr';
+
+       function __construct() {
+               do_action_ref_array( 'wp_default_styles', array(&$this) );
+       }
+
+       function do_item( $handle ) {
+               if ( !parent::do_item($handle) )
+                       return false;
+
+               $ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version;
+               if ( isset($this->args[$handle]) )
+                       $ver .= '&amp;' . $this->args[$handle];
+
+               if ( isset($this->registered[$handle]->args) )
+                       $media = attribute_escape( $this->registered[$handle]->args );
+               else
+                       $media = 'all';
+
+               $href = $this->_css_href( $this->registered[$handle]->src, $ver, $handle );
+
+               $end_cond = '';
+               if ( isset($this->registered[$handle]->extra['conditional']) && $this->registered[$handle]->extra['conditional'] ) {
+                       echo "<!--[if {$this->registered[$handle]->extra['conditional']}]>\n";
+                       $end_cond = "<![endif]-->\n";
+               }
+
+               echo apply_filters( 'style_loader_tag', "<link rel='stylesheet' 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', $href );
+                       else
+                               $rtl_href = $this->_css_href( $this->registered[$handle]->extra['rtl'], $ver, "$handle-rtl" );
+
+                       echo apply_filters( 'style_loader_tag', "<link rel='stylesheet' href='$rtl_href' type='text/css' media='$media' />\n", $handle );
+               }
+
+               echo $end_cond;
+
+               // Could do something with $this->registered[$handle]->extra here to print out extra CSS rules
+//             echo "<style type='text/css'>\n";
+//             echo "/* <![CDATA[ */\n";
+//             echo "/* ]]> */\n";
+//             echo "</style>\n";
+
+               return true;
+       }
+
+       function all_deps( $handles, $recursion = false ) {
+               $r = parent::all_deps( $handles, $recursion );
+               if ( !$recursion )
+                       $this->to_do = apply_filters( 'print_styles_array', $this->to_do );
+               return $r;
+       }
+
+       function _css_href( $src, $ver, $handle ) {
+               if ( !preg_match('|^https?://|', $src) && !preg_match('|^' . preg_quote(WP_CONTENT_URL) . '|', $src) ) {
+                       $src = $this->base_url . $src;
+               }
+
+               $src = add_query_arg('ver', $ver, $src);
+               $src = apply_filters( 'style_loader_src', $src, $handle );
+               return clean_url( $src );
+       }
+
+}
index 0d866faac973491279bd707331e5e63481ff5466..3c3a4db89fd7e112f5b7fe69d2552f606bf9b3ca 100644 (file)
@@ -26,6 +26,7 @@ class WP {
                global $wp_rewrite;
 
                $this->query_vars = array();
+               $taxonomy_query_vars = array();
 
                if ( is_array($extra_query_vars) )
                        $this->extra_query_vars = & $extra_query_vars;
@@ -90,6 +91,10 @@ class WP {
                        // Look for matches.
                        $request_match = $request;
                        foreach ($rewrite as $match => $query) {
+                               // Don't try to match against AtomPub calls
+                               if ( $req_uri == 'wp-app.php' )
+                                       break;
+
                                // 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)) {
@@ -105,7 +110,7 @@ class WP {
                                        $query = preg_replace("!^.+\?!", '', $query);
 
                                        // Substitute the substring matches into the query.
-                                       eval("\$query = \"$query\";");
+                                       eval("\$query = \"" . addslashes($query) . "\";");
                                        $this->matched_query = $query;
 
                                        // Parse the query.
@@ -140,6 +145,10 @@ class WP {
 
                $this->public_query_vars = apply_filters('query_vars', $this->public_query_vars);
 
+               foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t )
+                       if ( isset($t->query_var) )
+                               $taxonomy_query_vars[$t->query_var] = $taxonomy;
+
                for ($i=0; $i<count($this->public_query_vars); $i += 1) {
                        $wpvar = $this->public_query_vars[$i];
                        if (isset($this->extra_query_vars[$wpvar]))
@@ -153,8 +162,13 @@ class WP {
                        elseif (!empty($perma_query_vars[$wpvar]))
                                $this->query_vars[$wpvar] = $perma_query_vars[$wpvar];
 
-                       if ( !empty( $this->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 ) ) {
+                                       $this->query_vars['taxonomy'] = $taxonomy_query_vars[$wpvar];
+                                       $this->query_vars['term'] = $this->query_vars[$wpvar];
+                               }
+                       }
                }
 
                foreach ($this->private_query_vars as $var) {
@@ -419,7 +433,8 @@ class Walker {
                if ( $max_depth == 0 ||
                     ($max_depth != 0 &&  $max_depth > $depth+1 )) { //whether to descend
 
-                       for ( $i = 0; $i < sizeof( $children_elements ); $i++ ) {
+                       $num_elements = sizeof( $children_elements );
+                       for ( $i = 0; $i < $num_elements; $i++ ) {
 
                                $child = $children_elements[$i];
                                if ( $child->$parent_field == $element->$id_field ) {
@@ -432,6 +447,7 @@ class Walker {
                                        }
 
                                        array_splice( $children_elements, $i, 1 );
+                                       $num_elements--;
                                        $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );
                                        $i = -1;
                                }
@@ -498,12 +514,14 @@ class Walker {
                if ( !$top_level_elements ) {
 
                        $root = $children_elements[0];
-                       for ( $i = 0; $i < sizeof( $children_elements ); $i++ ) {
+                       $num_elements = sizeof($children_elements);
+                       for ( $i = 0; $i < $num_elements; $i++ ) {
 
                                $child = $children_elements[$i];
                                if ($root->$parent_field == $child->$parent_field ) {
                                        $top_level_elements[] = $child;
                                        array_splice( $children_elements, $i, 1 );
+                                       $num_elements--;
                                        $i--;
                                }
                        }
index 6e2ec62dcdea41a56604b43c62a63b7ce0b0b080..a04741739b2451c7e1b74c8c6a59e3190f6d477f 100644 (file)
@@ -9,10 +9,10 @@
  */
 
 /**
- * get_comment_author() - Retrieve the author of the current comment
+ * Retrieve the author of the current comment.
  *
- * If the comment has an empty comment_author field, then 'Anonymous' person
- * is assumed.
+ * If the comment has an empty comment_author field, then 'Anonymous' person is
+ * assumed.
  *
  * @since 1.5
  * @uses apply_filters() Calls 'get_comment_author' hook on the comment author
@@ -29,7 +29,7 @@ function get_comment_author() {
 }
 
 /**
- * comment_author() - Displays the author of the current comment
+ * Displays the author of the current comment.
  *
  * @since 0.71
  * @uses apply_filters() Calls 'comment_author' on comment author before displaying
@@ -40,7 +40,7 @@ function comment_author() {
 }
 
 /**
- * get_comment_author_email() - Retrieve the email of the author of the current comment
+ * Retrieve the email of the author of the current comment.
  *
  * @since 1.5
  * @uses apply_filters() Calls the 'get_comment_author_email' hook on the comment author email
@@ -54,12 +54,13 @@ function get_comment_author_email() {
 }
 
 /**
- * comment_author_email() - Display the email of the author of the current global $comment
+ * Display the email of the author of the current global $comment.
  *
- * Care should be taken to protect the email address and assure that email harvesters
- * do not capture your commentors' email address. Most assume that their email address will
- * not appear in raw form on the blog. Doing so will enable anyone, including those that
- * people don't want to get the email address and use it for their own means good and bad.
+ * Care should be taken to protect the email address and assure that email
+ * harvesters do not capture your commentors' email address. Most assume that
+ * their email address will not appear in raw form on the blog. Doing so will
+ * enable anyone, including those that people don't want to get the email
+ * address and use it for their own means good and bad.
  *
  * @since 0.71
  * @uses apply_filters() Calls 'author_email' hook on the author email
@@ -69,12 +70,13 @@ function comment_author_email() {
 }
 
 /**
- * comment_author_email_link() - Display the html email link to the author of the current comment
+ * Display the html email link to the author of the current comment.
  *
- * Care should be taken to protect the email address and assure that email harvesters
- * do not capture your commentors' email address. Most assume that their email address will
- * not appear in raw form on the blog. Doing so will enable anyone, including those that
- * people don't want to get the email address and use it for their own means good and bad.
+ * Care should be taken to protect the email address and assure that email
+ * harvesters do not capture your commentors' email address. Most assume that
+ * their email address will not appear in raw form on the blog. Doing so will
+ * enable anyone, including those that people don't want to get the email
+ * address and use it for their own means good and bad.
  *
  * @since 0.71
  * @uses apply_filters() Calls 'comment_email' hook for the display of the comment author's email
@@ -96,7 +98,7 @@ function comment_author_email_link($linktext='', $before='', $after='') {
 }
 
 /**
- * get_comment_author_link() - Retrieve the html link to the url of the author of the current comment
+ * Retrieve the html link to the url of the author of the current comment.
  *
  * @since 1.5
  * @uses apply_filters() Calls 'get_comment_author_link' hook on the complete link HTML or author
@@ -116,7 +118,7 @@ function get_comment_author_link() {
 }
 
 /**
- * comment_author_link() - Display the html link to the url of the author of the current comment
+ * Display the html link to the url of the author of the current comment.
  *
  * @since 0.71
  * @see get_comment_author_link() Echos result
@@ -126,7 +128,7 @@ function comment_author_link() {
 }
 
 /**
- * get_comment_author_IP() - Retrieve the IP address of the author of the current comment
+ * Retrieve the IP address of the author of the current comment.
  *
  * @since 1.5
  * @uses $comment
@@ -140,7 +142,7 @@ function get_comment_author_IP() {
 }
 
 /**
- * comment_author_IP() - Displays the IP address of the author of the current comment
+ * Display the IP address of the author of the current comment.
  *
  * @since 0.71
  * @see get_comment_author_IP() Echos Result
@@ -150,7 +152,7 @@ function comment_author_IP() {
 }
 
 /**
- * get_comment_author_url() - Returns the url of the author of the current comment
+ * Retrieve the url of the author of the current comment.
  *
  * @since 1.5
  * @uses apply_filters() Calls 'get_comment_author_url' hook on the comment author's URL
@@ -163,7 +165,7 @@ function get_comment_author_url() {
 }
 
 /**
- * comment_author_url() - Display the url of the author of the current comment
+ * Display the url of the author of the current comment.
  *
  * @since 0.71
  * @uses apply_filters()
@@ -174,13 +176,14 @@ function comment_author_url() {
 }
 
 /**
- * get_comment_author_url_link() - Retrieves the HTML link of the url of the author of the current comment
+ * Retrieves the HTML link of the url of the author of the current comment.
  *
- * $linktext parameter is only used if the URL does not exist for the comment author. If the URL does
- * exist then the URL will be used and the $linktext will be ignored.
+ * $linktext parameter is only used if the URL does not exist for the comment
+ * author. If the URL does exist then the URL will be used and the $linktext
+ * will be ignored.
  *
- * Encapsulate the HTML link between the $before and $after. So it will appear in the order of $before,
- * link, and finally $after.
+ * Encapsulate the HTML link between the $before and $after. So it will appear
+ * in the order of $before, link, and finally $after.
  *
  * @since 1.5
  * @uses apply_filters() Calls the 'get_comment_author_url_link' on the complete HTML before returning.
@@ -202,7 +205,7 @@ function get_comment_author_url_link( $linktext = '', $before = '', $after = ''
 }
 
 /**
- * comment_author_url_link() - Displays the HTML link of the url of the author of the current comment
+ * 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
@@ -216,7 +219,7 @@ function comment_author_url_link( $linktext = '', $before = '', $after = '' ) {
 }
 
 /**
- * get_comment_date() - Retrieve the comment date of the current comment
+ * Retrieve the comment date of the current comment.
  *
  * @since 1.5
  * @uses apply_filters() Calls 'get_comment_date' hook with the formated date and the $d parameter respectively
@@ -235,7 +238,7 @@ function get_comment_date( $d = '' ) {
 }
 
 /**
- * comment_date() - Display the comment date of the current comment
+ * Display the comment date of the current comment.
  *
  * @since 0.71
  *
@@ -246,7 +249,7 @@ function comment_date( $d = '' ) {
 }
 
 /**
- * get_comment_excerpt() - Retrieve the excerpt of the current comment
+ * Retrieve the excerpt of the current comment.
  *
  * Will cut each word and only output the first 20 words with '...' at the end.
  * If the word count is less than 20, then no truncating is done and no '...'
@@ -278,7 +281,7 @@ function get_comment_excerpt() {
 }
 
 /**
- * comment_excerpt() - Returns the excerpt of the current comment
+ * Display the excerpt of the current comment.
  *
  * @since 1.2
  * @uses apply_filters() Calls 'comment_excerpt' hook before displaying excerpt
@@ -288,7 +291,7 @@ function comment_excerpt() {
 }
 
 /**
- * get_comment_ID() - Retrieve the comment id of the current comment
+ * Retrieve the comment id of the current comment.
  *
  * @since 1.5
  * @uses $comment
@@ -302,7 +305,7 @@ function get_comment_ID() {
 }
 
 /**
- * comment_ID() - Displays the comment id of the current comment
+ * Displays the comment id of the current comment.
  *
  * @since 0.71
  * @see get_comment_ID() Echos Result
@@ -312,7 +315,7 @@ function comment_ID() {
 }
 
 /**
- * get_comment_link() - Retrieve the link to the current comment
+ * Retrieve the link to the current comment.
  *
  * @since 1.5
  * @uses $comment
@@ -325,7 +328,7 @@ function get_comment_link() {
 }
 
 /**
- * get_comments_link() - Retrieves the link to the current post comments
+ * Retrieves the link to the current post comments.
  *
  * @since 1.5
  *
@@ -336,7 +339,7 @@ function get_comments_link() {
 }
 
 /**
- * comments_link() - Displays the link to the current post comments
+ * Displays the link to the current post comments.
  *
  * @since 0.71
  *
@@ -348,7 +351,7 @@ function comments_link( $deprecated = '', $deprecated = '' ) {
 }
 
 /**
- * get_comments_number() - Retrieve the amount of comments a post has
+ * Retrieve the amount of comments a post has.
  *
  * @since 1.5
  * @uses apply_filters() Calls the 'get_comments_number' hook on the number of comments
@@ -373,7 +376,7 @@ function get_comments_number( $post_id = 0 ) {
 }
 
 /**
- * comments_number() - Display the language string for the number of comments the current post has
+ * Display the language string for the number of comments the current post has.
  *
  * @since 0.71
  * @uses $id
@@ -389,7 +392,7 @@ function comments_number( $zero = false, $one = false, $more = false, $deprecate
        $number = get_comments_number($id);
 
        if ( $number > 1 )
-               $output = str_replace('%', $number, ( false === $more ) ? __('% Comments') : $more);
+               $output = str_replace('%', number_format_i18n($number), ( false === $more ) ? __('% Comments') : $more);
        elseif ( $number == 0 )
                $output = ( false === $zero ) ? __('No Comments') : $zero;
        else // must be one
@@ -399,7 +402,7 @@ function comments_number( $zero = false, $one = false, $more = false, $deprecate
 }
 
 /**
- * get_comment_text() - Retrieve the text of the current comment
+ * Retrieve the text of the current comment.
  *
  * @since 1.5
  * @uses $comment
@@ -412,7 +415,7 @@ function get_comment_text() {
 }
 
 /**
- * comment_text() - Displays the text of the current comment
+ * Displays the text of the current comment.
  *
  * @since 0.71
  * @uses apply_filters() Passes the comment content through the 'comment_text' hook before display
@@ -423,7 +426,7 @@ function comment_text() {
 }
 
 /**
- * get_comment_time() - Retrieve the comment time of the current comment
+ * Retrieve the comment time of the current comment.
  *
  * @since 1.5
  * @uses $comment
@@ -444,7 +447,7 @@ function get_comment_time( $d = '', $gmt = false ) {
 }
 
 /**
- * comment_time() - Display the comment time of the current comment
+ * Display the comment time of the current comment.
  *
  * @since 0.71
  *
@@ -455,7 +458,7 @@ function comment_time( $d = '' ) {
 }
 
 /**
- * get_comment_type() - Retrieve the comment type of the current comment
+ * Retrieve the comment type of the current comment.
  *
  * @since 1.5
  * @uses $comment
@@ -473,7 +476,7 @@ function get_comment_type() {
 }
 
 /**
- * comment_type() - Display the comment type of the current comment
+ * Display the comment type of the current comment.
  *
  * @since 0.71
  *
@@ -496,11 +499,11 @@ function comment_type($commenttxt = 'Comment', $trackbacktxt = 'Trackback', $pin
 }
 
 /**
- * get_trackback_url() - Retrieve The current post's trackback URL
+ * Retrieve The current post's trackback URL.
  *
- * There is a check to see if permalink's have been enabled and if so, will retrieve
- * the pretty path. If permalinks weren't enabled, the ID of the current post is used
- * and appended to the correct page to go to.
+ * There is a check to see if permalink's have been enabled and if so, will
+ * retrieve the pretty path. If permalinks weren't enabled, the ID of the
+ * current post is used and appended to the correct page to go to.
  *
  * @since 1.5
  * @uses apply_filters() Calls 'trackback_url' on the resulting trackback URL
@@ -519,7 +522,7 @@ function get_trackback_url() {
 }
 
 /**
- * trackback_url() - Displays the current post's trackback URL
+ * Displays the current post's trackback URL.
  *
  * @since 0.71
  * @uses get_trackback_url() Gets the trackback url for the current post
@@ -533,7 +536,7 @@ function trackback_url($deprecated = true) {
 }
 
 /**
- * trackback_rdf() - Generates and displays the RDF for the trackback information of current post
+ * Generates and displays the RDF for the trackback information of current post.
  *
  * @since 0.71
  *
@@ -557,7 +560,7 @@ function trackback_rdf($deprecated = '') {
 }
 
 /**
- * comments_open() - Whether the current post is open for comments
+ * Whether the current post is open for comments.
  *
  * @since 1.5
  * @uses $post
@@ -574,7 +577,7 @@ function comments_open( $post_id=NULL ) {
 }
 
 /**
- * pings_open() - Whether the current post is open for pings
+ * Whether the current post is open for pings.
  *
  * @since 1.5
  * @uses $post
@@ -591,14 +594,14 @@ function pings_open( $post_id = NULL ) {
 }
 
 /**
- * wp_comment_form_unfiltered_html_nonce() - Displays form token for unfiltered comments
+ * Displays form token for unfiltered comments.
  *
- * Will only display nonce token if the current user has permissions for unfiltered html.
- * Won't display the token for other users.
+ * Will only display nonce token if the current user has permissions for
+ * unfiltered html. Won't display the token for other users.
  *
- * The function was backported to 2.0.10 and was added to versions 2.1.3 and above. Does not
- * exist in versions prior to 2.0.10 in the 2.0 branch and in the 2.1 branch, prior to 2.1.3.
- * Technically added in 2.2.0.
+ * The function was backported to 2.0.10 and was added to versions 2.1.3 and
+ * above. Does not exist in versions prior to 2.0.10 in the 2.0 branch and in
+ * the 2.1 branch, prior to 2.1.3. Technically added in 2.2.0.
  *
  * @since 2.0.10 Backported to 2.0 branch
  * @since 2.1.3
@@ -611,10 +614,10 @@ function wp_comment_form_unfiltered_html_nonce() {
 }
 
 /**
- * comments_template() - Loads the comment template specified in $file
+ * Loads the comment template specified in $file.
  *
- * Will not display the comments template if not on single post or page, or
- * if the post does not have comments.
+ * Will not display the comments template if not on single post or page, or if
+ * the post does not have comments.
  *
  * Uses the WordPress database object to query for the comments. The comments
  * are passed through the 'comments_array' filter hook with the list of comments
@@ -665,11 +668,11 @@ function comments_template( $file = '/comments.php' ) {
        if ( file_exists( $include ) )
                require( $include );
        else
-               require( ABSPATH . 'wp-content/themes/default/comments.php');
+               require( WP_CONTENT_DIR . '/themes/default/comments.php');
 }
 
 /**
- * comments_popup_script() - Displays the JS popup script to show a comment
+ * Displays the JS popup script to show a comment.
  *
  * If the $file parameter is empty, then the home page is assumed. The defaults
  * for the window are 400px by 400px.
@@ -700,9 +703,10 @@ function comments_popup_script($width=400, $height=400, $file='') {
 }
 
 /**
- * comments_popup_link() - Displays the link to the comments popup window for the current post ID.
+ * Displays the link to the comments popup window for the current post ID.
  *
- * Is not meant to be displayed on single posts and pages. Should be used on the lists of posts
+ * Is not meant to be displayed on single posts and pages. Should be used on the
+ * lists of posts
  *
  * @since 0.71
  * @uses $id
index 63e6b1b39985af0beb0ebed484f46086610e4a95..0873db528b8477b7d1c7324be8d6011dfd7df05e 100644 (file)
@@ -6,21 +6,37 @@
  */
 
 /**
- * check_comment() - Checks whether a comment passes internal checks to be allowed to add
+ * Checks whether a comment passes internal checks to be allowed to add.
  *
- * {@internal Missing Long Description}}
+ * If comment moderation is set in the administration, then all comments,
+ * regardless of their type and whitelist will be set to false.
+ *
+ * If the number of links exceeds the amount in the administration, then the
+ * check fails.
+ *
+ * If any of the parameter contents match the blacklist of words, then the check
+ * fails.
+ *
+ * If the comment is a trackback and part of the blogroll, then the trackback is
+ * automatically whitelisted. If the comment author was approved before, then
+ * the comment is automatically whitelisted.
+ *
+ * If none of the checks fail, then the failback is to set the check to pass
+ * (return true).
  *
  * @since 1.2
  * @uses $wpdb
  *
- * @param string $author {@internal Missing Description }}
- * @param string $email {@internal Missing Description }}
- * @param string $url {@internal Missing Description }}
- * @param string $comment {@internal Missing Description }}
- * @param string $user_ip {@internal Missing Description }}
- * @param string $user_agent {@internal Missing Description }}
- * @param string $comment_type {@internal Missing Description }}
- * @return bool {@internal Missing Description }}
+ * @param string $author Comment Author's name
+ * @param string $email Comment Author's email
+ * @param string $url Comment Author's URL
+ * @param string $comment Comment contents
+ * @param string $user_ip Comment Author's IP address
+ * @param string $user_agent Comment Author's User Agent
+ * @param string $comment_type Comment type, either user submitted comment,
+ *             trackback, or pingback
+ * @return bool Whether the checks passed (true) and the comments should be
+ *             displayed or set to moderated
  */
 function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $comment_type) {
        global $wpdb;
@@ -83,7 +99,7 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $
 }
 
 /**
- * get_approved_comments() - Returns the approved comments for post $post_id
+ * Retrieve the approved comments for post $post_id.
  *
  * @since 2.0
  * @uses $wpdb
@@ -97,15 +113,19 @@ function get_approved_comments($post_id) {
 }
 
 /**
- * get_comment() - Retrieves comment data given a comment ID or comment object.
+ * Retrieves comment data given a comment ID or comment object.
  *
- * {@internal Missing Long Description}}
+ * If an object is passed then the comment data will be cached and then returned
+ * after being passed through a filter.
+ *
+ * If the comment is empty, then the global comment variable will be used, if it
+ * is set.
  *
  * @since 2.0
  * @uses $wpdb
  *
- * @param object|string|int $comment {@internal Missing Description}}
- * @param string $output OBJECT or ARRAY_A or ARRAY_N constants
+ * @param object|string|int $comment Comment to retrieve.
+ * @param string $output Optional. OBJECT or ARRAY_A or ARRAY_N constants
  * @return object|array|null Depends on $output value.
  */
 function &get_comment(&$comment, $output = OBJECT) {
@@ -142,12 +162,12 @@ function &get_comment(&$comment, $output = OBJECT) {
 }
 
 /**
- * get_commentdata() - Returns an array of comment data about comment $comment_ID
+ * Retrieve an array of comment data about comment $comment_ID.
  *
- * get_comment() technically does the same thing as this function. This function also
- * appears to reference variables and then not use them or not update them when needed.
- * It is advised to switch to get_comment(), since this function might be deprecated in
- * favor of using get_comment().
+ * get_comment() technically does the same thing as this function. This function
+ * also appears to reference variables and then not use them or not update them
+ * when needed. It is advised to switch to get_comment(), since this function
+ * might be deprecated in favor of using get_comment().
  *
  * @deprecated Use get_comment()
  * @see get_comment()
@@ -162,7 +182,7 @@ function &get_comment(&$comment, $output = OBJECT) {
  * @param bool $include_unapproved Whether to include unapproved comments or not
  * @return array The comment data
  */
-function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) { // less flexible, but saves DB queries
+function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) {
        global $postc, $wpdb;
        if ( $no_cache ) {
                $query = $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_ID = %d", $comment_ID);
@@ -186,7 +206,7 @@ function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = fals
 }
 
 /**
- * get_lastcommentmodified() - The date the last comment was modified
+ * The date the last comment was modified.
  *
  * {@internal Missing Long Description}}
  *
@@ -194,7 +214,8 @@ function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = fals
  * @uses $wpdb
  * @global array $cache_lastcommentmodified
  *
- * @param string $timezone Which timezone to use in reference to 'gmt', 'blog', or 'server' locations
+ * @param string $timezone Which timezone to use in reference to 'gmt', 'blog',
+ *             or 'server' locations
  * @return string Last comment modified date
  */
 function get_lastcommentmodified($timezone = 'server') {
@@ -223,15 +244,14 @@ function get_lastcommentmodified($timezone = 'server') {
 }
 
 /**
- * get_comment_count() - The amount of comments in a post or total comments
+ * The amount of comments in a post or total comments.
  *
  * {@internal Missing Long Description}}
  *
  * @since 2.0.0
  * @uses $wpdb
  *
- * @param int $post_id Optional. Comment amount in post if > 0, else total com
-ments blog wide
+ * @param int $post_id Optional. Comment amount in post if > 0, else total comments blog wide
  * @return array The amount of spam, approved, awaiting moderation, and total
  */
 function get_comment_count( $post_id = 0 ) {
@@ -241,7 +261,7 @@ function get_comment_count( $post_id = 0 ) {
 
        $where = '';
        if ( $post_id > 0 ) {
-               $where = "WHERE comment_post_ID = {$post_id}";
+               $where = $wpdb->prepare("WHERE comment_post_ID = %d", $post_id);
        }
 
        $totals = (array) $wpdb->get_results("
@@ -281,12 +301,12 @@ function get_comment_count( $post_id = 0 ) {
 }
 
 /**
- * sanitize_comment_cookies() - {@internal Missing Short Description}}
+ * Sanitizes the cookies sent to the user already.
  *
- * {@internal Missing Long Description}}
+ * Will only do anything if the cookies have already been created for the user.
+ * Mostly used after cookies had been sent to use elsewhere.
  *
  * @since 2.0.4
- *
  */
 function sanitize_comment_cookies() {
        if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) ) {
@@ -311,7 +331,7 @@ function sanitize_comment_cookies() {
 }
 
 /**
- * wp_allow_comment() - Validates whether this comment is allowed to be made or not
+ * Validates whether this comment is allowed to be made or not.
  *
  * {@internal Missing Long Description}}
  *
@@ -344,7 +364,7 @@ function wp_allow_comment($commentdata) {
                $post_author = $wpdb->get_var($wpdb->prepare("SELECT post_author FROM $wpdb->posts WHERE ID = %d LIMIT 1", $comment_post_ID));
        }
 
-       if ( $userdata && ( $user_id == $post_author || $user->has_cap('level_9') ) ) {
+       if ( $userdata && ( $user_id == $post_author || $user->has_cap('moderate_comments') ) ) {
                // The author and the admins get respect.
                $approved = 1;
         } else {
@@ -362,7 +382,7 @@ function wp_allow_comment($commentdata) {
 }
 
 /**
- * check_comment_flood_db() - {@internal Missing Short Description}}
+ * {@internal Missing Short Description}}
  *
  * {@internal Missing Long Description}}
  *
@@ -379,7 +399,7 @@ function check_comment_flood_db( $ip, $email, $date ) {
        global $wpdb;
        if ( current_user_can( 'manage_options' ) )
                return; // don't throttle admins
-       if ( $lasttime = $wpdb->get_var("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_author_IP = '$ip' OR comment_author_email = '$email' ORDER BY comment_date DESC LIMIT 1") ) {
+       if ( $lasttime = $wpdb->get_var( $wpdb->prepare("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_author_IP = %s OR comment_author_email = %s ORDER BY comment_date DESC LIMIT 1", $ip, $email) ) ) {
                $time_lastcomment = mysql2date('U', $lasttime);
                $time_newcomment  = mysql2date('U', $date);
                $flood_die = apply_filters('comment_flood_filter', false, $time_lastcomment, $time_newcomment);
@@ -391,7 +411,7 @@ function check_comment_flood_db( $ip, $email, $date ) {
 }
 
 /**
- * wp_blacklist_check() - Does comment contain blacklisted characters or words
+ * Does comment contain blacklisted characters or words.
  *
  * {@internal Missing Long Description}}
  *
@@ -448,38 +468,55 @@ function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_age
        return false;
 }
 
-function wp_count_comments() {
+/**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @param unknown_type $post_id
+ * @return unknown
+ */
+function wp_count_comments( $post_id = 0 ) {
        global $wpdb;
 
-       $count = wp_cache_get('comments', 'counts');
+       $post_id = (int) $post_id;
+
+       $count = wp_cache_get("comments-{$post_id}", 'counts');
 
        if ( false !== $count )
                return $count;
 
-       $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} GROUP BY comment_approved", ARRAY_A );
+       $where = '';
+       if( $post_id > 0 )
+               $where = $wpdb->prepare( "WHERE comment_post_ID = %d", $post_id );
+
+       $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A );
 
+       $total = 0;
        $stats = array( );
        $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam');
        foreach( (array) $count as $row_num => $row ) {
+               $total += $row['num_comments'];
                $stats[$approved[$row['comment_approved']]] = $row['num_comments'];
        }
 
+       $stats['total_comments'] = $total;
        foreach ( $approved as $key ) {
                if ( empty($stats[$key]) )
                        $stats[$key] = 0;
        }
 
        $stats = (object) $stats;
-       wp_cache_set('comments', $stats, 'counts');
+       wp_cache_set("comments-{$post_id}", $stats, 'counts');
 
        return $stats;
 }
 
 /**
- * wp_delete_comment() - Removes comment ID and maybe updates post comment count
+ * Removes comment ID and maybe updates post comment count.
  *
- * The post comment count will be updated if the comment was approved and has a post
- * ID available.
+ * The post comment count will be updated if the comment was approved and has a
+ * post ID available.
  *
  * @since 2.0.0
  * @uses $wpdb
@@ -495,7 +532,7 @@ function wp_delete_comment($comment_id) {
 
        $comment = get_comment($comment_id);
 
-       if ( ! $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1") )
+       if ( ! $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->comments WHERE comment_ID = %d LIMIT 1", $comment_id) ) )
                return false;
 
        $post_id = $comment->comment_post_ID;
@@ -509,7 +546,7 @@ function wp_delete_comment($comment_id) {
 }
 
 /**
- * wp_get_comment_status() - The status of a comment by ID
+ * The status of a comment by ID.
  *
  * @since 1.0.0
  *
@@ -536,7 +573,7 @@ function wp_get_comment_status($comment_id) {
 }
 
 /**
- * wp_get_current_commenter() - Get current commenter's name, email, and URL
+ * Get current commenter's name, email, and URL.
  *
  * Expects cookies content to already be sanitized. User of this function
  * might wish to recheck the returned array for validity.
@@ -566,7 +603,7 @@ function wp_get_current_commenter() {
 }
 
 /**
- * wp_insert_comment() - Inserts a comment to the database
+ * Inserts a comment to the database.
  *
  * {@internal Missing Long Description}}
  *
@@ -578,7 +615,7 @@ function wp_get_current_commenter() {
  */
 function wp_insert_comment($commentdata) {
        global $wpdb;
-       extract($commentdata, EXTR_SKIP);
+       extract(stripslashes_deep($commentdata), EXTR_SKIP);
 
        if ( ! isset($comment_author_IP) )
                $comment_author_IP = '';
@@ -593,11 +630,10 @@ function wp_insert_comment($commentdata) {
        if ( ! isset($user_id) )
                $user_id = 0;
 
-       $result = $wpdb->query("INSERT INTO $wpdb->comments
+       $result = $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->comments
        (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_approved, comment_agent, comment_type, comment_parent, user_id)
-       VALUES
-       ('$comment_post_ID', '$comment_author', '$comment_author_email', '$comment_author_url', '$comment_author_IP', '$comment_date', '$comment_date_gmt', '$comment_content', '$comment_approved', '$comment_agent', '$comment_type', '$comment_parent', '$user_id')
-       ");
+       VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %d, %d)",
+       $comment_post_ID, $comment_author, $comment_author_email, $comment_author_url, $comment_author_IP, $comment_date, $comment_date_gmt, $comment_content, $comment_approved, $comment_agent, $comment_type, $comment_parent, $user_id) );
 
        $id = (int) $wpdb->insert_id;
 
@@ -608,11 +644,11 @@ function wp_insert_comment($commentdata) {
 }
 
 /**
- * wp_filter_comment() - Parses and returns comment information
+ * Parses and returns comment information.
  *
- * Sets the comment data 'filtered' field to true when finished. This
- * can be checked as to whether the comment should be filtered and to
- * keep from filtering the same comment more than once.
+ * Sets the comment data 'filtered' field to true when finished. This can be
+ * checked as to whether the comment should be filtered and to keep from
+ * filtering the same comment more than once.
  *
  * @since 2.0.0
  * @uses apply_filters() Calls 'pre_user_id' hook on comment author's user ID
@@ -639,7 +675,7 @@ function wp_filter_comment($commentdata) {
 }
 
 /**
- * wp_throttle_comment_flood() - {@internal Missing Short Description}}
+ * {@internal Missing Short Description}}
  *
  * {@internal Missing Long Description}}
  *
@@ -659,7 +695,7 @@ function wp_throttle_comment_flood($block, $time_lastcomment, $time_newcomment)
 }
 
 /**
- * wp_new_comment() - Parses and adds a new comment to the database
+ * Parses and adds a new comment to the database.
  *
  * {@internal Missing Long Description}}
  *
@@ -707,7 +743,7 @@ function wp_new_comment( $commentdata ) {
 }
 
 /**
- * wp_set_comment_status() - Sets the status of comment ID
+ * Sets the status of comment ID.
  *
  * {@internal Missing Long Description}}
  *
@@ -722,13 +758,17 @@ function wp_set_comment_status($comment_id, $comment_status) {
 
        switch ( $comment_status ) {
                case 'hold':
-                       $query = "UPDATE $wpdb->comments SET comment_approved='0' WHERE comment_ID='$comment_id' LIMIT 1";
+                       $query = $wpdb->prepare("UPDATE $wpdb->comments SET comment_approved='0' WHERE comment_ID = %d LIMIT 1", $comment_id);
                        break;
                case 'approve':
-                       $query = "UPDATE $wpdb->comments SET comment_approved='1' WHERE comment_ID='$comment_id' LIMIT 1";
+                       $query = $wpdb->prepare("UPDATE $wpdb->comments SET comment_approved='1' WHERE comment_ID = %d LIMIT 1", $comment_id);
+                       if ( get_option('comments_notify') ) {
+                               $comment = get_comment($comment_id);
+                               wp_notify_postauthor($comment_id, $comment->comment_type);
+                       }
                        break;
                case 'spam':
-                       $query = "UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID='$comment_id' LIMIT 1";
+                       $query = $wpdb->prepare("UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID = %d LIMIT 1", $comment_id);
                        break;
                case 'delete':
                        return wp_delete_comment($comment_id);
@@ -750,7 +790,7 @@ function wp_set_comment_status($comment_id, $comment_status) {
 }
 
 /**
- * wp_update_comment() - Parses and updates an existing comment in the database
+ * Parses and updates an existing comment in the database.
  *
  * {@internal Missing Long Description}}
  *
@@ -776,22 +816,29 @@ function wp_update_comment($commentarr) {
        $commentarr = wp_filter_comment( $commentarr );
 
        // Now extract the merged array.
-       extract($commentarr, EXTR_SKIP);
+       extract(stripslashes_deep($commentarr), EXTR_SKIP);
 
        $comment_content = apply_filters('comment_save_pre', $comment_content);
 
        $comment_date_gmt = get_gmt_from_date($comment_date);
 
-       $wpdb->query(
-               "UPDATE $wpdb->comments SET
-                       comment_content      = '$comment_content',
-                       comment_author       = '$comment_author',
-                       comment_author_email = '$comment_author_email',
-                       comment_approved     = '$comment_approved',
-                       comment_author_url   = '$comment_author_url',
-                       comment_date         = '$comment_date',
-                       comment_date_gmt     = '$comment_date_gmt'
-               WHERE comment_ID = $comment_ID" );
+       $wpdb->query( $wpdb->prepare("UPDATE $wpdb->comments SET
+                       comment_content      = %s,
+                       comment_author       = %s,
+                       comment_author_email = %s,
+                       comment_approved     = %s,
+                       comment_author_url   = %s,
+                       comment_date         = %s,
+                       comment_date_gmt     = %s
+               WHERE comment_ID = %d",
+                       $comment_content,
+                       $comment_author,
+                       $comment_author_email,
+                       $comment_approved,
+                       $comment_author_url,
+                       $comment_date,
+                       $comment_date_gmt,
+                       $comment_ID) );
 
        $rval = $wpdb->rows_affected;
 
@@ -802,7 +849,7 @@ function wp_update_comment($commentarr) {
 }
 
 /**
- * wp_defer_comment_counting() - Whether to defer comment counting
+ * Whether to defer comment counting.
  *
  * When setting $defer to true, all post comment counts will not be updated
  * until $defer is set to false. When $defer is set to false, then all
@@ -829,15 +876,15 @@ function wp_defer_comment_counting($defer=null) {
 }
 
 /**
- * wp_update_comment_count() - Updates the comment count for post(s)
+ * Updates the comment count for post(s).
  *
- * When $do_deferred is false (is by default) and the comments have been
- * set to be deferred, the post_id will be added to a queue, which will
- * be updated at a later date and only updated once per post ID.
+ * When $do_deferred is false (is by default) and the comments have been set to
+ * be deferred, the post_id will be added to a queue, which will be updated at a
+ * later date and only updated once per post ID.
  *
- * If the comments have not be set up to be deferred, then the post will
- * be updated. When $do_deferred is set to true, then all previous deferred
- * post IDs will be updated along with the current $post_id.
+ * If the comments have not be set up to be deferred, then the post will be
+ * updated. When $do_deferred is set to true, then all previous deferred post
+ * IDs will be updated along with the current $post_id.
  *
  * @since 2.1.0
  * @see wp_update_comment_count_now() For what could cause a false return value
@@ -868,7 +915,7 @@ function wp_update_comment_count($post_id, $do_deferred=false) {
 }
 
 /**
- * wp_update_comment_count_now() - Updates the comment count for the post
+ * Updates the comment count for the post.
  *
  * @since 2.5
  * @uses $wpdb
@@ -887,8 +934,8 @@ function wp_update_comment_count_now($post_id) {
                return false;
 
        $old = (int) $post->comment_count;
-       $new = (int) $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = '$post_id' AND comment_approved = '1'");
-       $wpdb->query("UPDATE $wpdb->posts SET comment_count = '$new' WHERE ID = '$post_id'");
+       $new = (int) $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1'", $post_id) );
+       $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET comment_count = %d WHERE ID = %d", $new, $post_id) );
 
        if ( 'page' == $post->post_type )
                clean_page_cache( $post_id );
@@ -906,7 +953,7 @@ function wp_update_comment_count_now($post_id) {
 //
 
 /**
- * discover_pingback_server_uri() - Finds a pingback server URI based on the given URL
+ * Finds a pingback server URI based on the given URL.
  *
  * {@internal Missing Long Description}}
  *
@@ -982,23 +1029,27 @@ function discover_pingback_server_uri($url, $timeout_bytes = 2048) {
                        $pingback_server_url_len = $pingback_href_end - $pingback_href_start;
                        $pingback_server_url = substr($contents, $pingback_href_start, $pingback_server_url_len);
                        // We may find rel="pingback" but an incomplete pingback URL
-                       if ( $pingback_server_url_len > 0 ) // We got it!
+                       if ( $pingback_server_url_len > 0 ) { // We got it!
+                               fclose($fp);
                                return $pingback_server_url;
+                       }
                }
                $byte_count += strlen($line);
                if ( $byte_count > $timeout_bytes ) {
                        // It's no use going further, there probably isn't any pingback
                        // server to find in this file. (Prevents loading large files.)
+                       fclose($fp);
                        return false;
                }
        }
 
        // We didn't find anything.
+       fclose($fp);
        return false;
 }
 
 /**
- * do_all_pings() - {@internal Missing Short Description}}
+ * {@internal Missing Short Description}}
  *
  * {@internal Missing Long Description}}
  *
@@ -1016,7 +1067,7 @@ function do_all_pings() {
 
        // Do Enclosures
        while ($enclosure = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_encloseme' LIMIT 1")) {
-               $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$enclosure->ID} AND meta_key = '_encloseme';");
+               $wpdb->query( $wpdb->prepare("DELETE FROM {$wpdb->postmeta} WHERE post_id = %d AND meta_key = '_encloseme';", $enclosure->ID) );
                do_enclose($enclosure->post_content, $enclosure->ID);
        }
 
@@ -1031,7 +1082,7 @@ function do_all_pings() {
 }
 
 /**
- * do_trackbacks() - {@internal Missing Short Description}}
+ * {@internal Missing Short Description}}
  *
  * {@internal Missing Long Description}}
  *
@@ -1043,11 +1094,11 @@ function do_all_pings() {
 function do_trackbacks($post_id) {
        global $wpdb;
 
-       $post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = $post_id");
+       $post = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $post_id) );
        $to_ping = get_to_ping($post_id);
        $pinged  = get_pung($post_id);
        if ( empty($to_ping) ) {
-               $wpdb->query("UPDATE $wpdb->posts SET to_ping = '' WHERE ID = '$post_id'");
+               $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET to_ping = '' WHERE ID = %d", $post_id) );
                return;
        }
 
@@ -1068,14 +1119,14 @@ function do_trackbacks($post_id) {
                                trackback($tb_ping, $post_title, $excerpt, $post_id);
                                $pinged[] = $tb_ping;
                        } else {
-                               $wpdb->query("UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, '$tb_ping', '')) WHERE ID = '$post_id'");
+                               $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, '$tb_ping', '')) WHERE ID = %d", $post_id) );
                        }
                }
        }
 }
 
 /**
- * generic_ping() - {@internal Missing Short Description}}
+ * {@internal Missing Short Description}}
  *
  * {@internal Missing Long Description}}
  *
@@ -1098,7 +1149,7 @@ function generic_ping($post_id = 0) {
 }
 
 /**
- * pingback() - Pings back the links found in a post
+ * Pings back the links found in a post.
  *
  * {@internal Missing Long Description}}
  *
@@ -1175,7 +1226,7 @@ function pingback($content, $post_ID) {
 }
 
 /**
- * privacy_ping_filter() - {@internal Missing Short Description}}
+ * {@internal Missing Short Description}}
  *
  * {@internal Missing Long Description}}
  *
@@ -1192,19 +1243,19 @@ function privacy_ping_filter($sites) {
 }
 
 /**
- * trackback() - Send a Trackback
+ * Send a Trackback.
  *
- * {@internal Missing Long Description}}
+ * Updates database when sending trackback to prevent duplicates.
  *
  * @since 0.71
  * @uses $wpdb
  * @uses $wp_version WordPress version
  *
- * @param string $trackback_url {@internal Missing Description}}
- * @param string $title {@internal Missing Description}}
- * @param string $excerpt {@internal Missing Description}}
- * @param int $ID {@internal Missing Description}}
- * @return unknown {@internal Missing Description}}
+ * @param string $trackback_url URL to send trackbacks.
+ * @param string $title Title of post
+ * @param string $excerpt Excerpt of post
+ * @param int $ID Post ID
+ * @return mixed Database query from update
  */
 function trackback($trackback_url, $title, $excerpt, $ID) {
        global $wpdb, $wp_version;
@@ -1233,21 +1284,19 @@ function trackback($trackback_url, $title, $excerpt, $ID) {
        @fclose($fs);
 
        $tb_url = addslashes( $tb_url );
-       $wpdb->query("UPDATE $wpdb->posts SET pinged = CONCAT(pinged, '\n', '$tb_url') WHERE ID = '$ID'");
-       return $wpdb->query("UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, '$tb_url', '')) WHERE ID = '$ID'");
+       $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET pinged = CONCAT(pinged, '\n', '$tb_url') WHERE ID = %d", $ID) );
+       return $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, '$tb_url', '')) WHERE ID = %d", $ID) );
 }
 
 /**
- * weblog_ping() - {@internal Missing Short Description}}
- *
- * {@internal Missing Long Description}}
+ * Send a pingback.
  *
  * @since 1.2.0
  * @uses $wp_version
  * @uses IXR_Client
  *
- * @param unknown_type $server
- * @param unknown_type $path
+ * @param string $server Host of blog to connect to.
+ * @param string $path Path to send the ping.
  */
 function weblog_ping($server = '', $path = '') {
        global $wp_version;
@@ -1270,7 +1319,7 @@ function weblog_ping($server = '', $path = '') {
 //
 
 /**
- * clean_comment_cache() - Removes comment ID from the comment cache
+ * Removes comment ID from the comment cache.
  *
  * @since 2.3.0
  * @package WordPress
@@ -1283,7 +1332,7 @@ function clean_comment_cache($id) {
 }
 
 /**
- * update_comment_cache() - Updates the comment cache of given comments
+ * Updates the comment cache of given comments.
  *
  * Will add the comments in $comments to the cache. If comment ID already
  * exists in the comment cache then it will not be updated.
index 08fbb0ea8fa9ebd8dabb255a823c348b49a470cd..6eff54a3137e101590e06174e4f8e206703f8bcd 100644 (file)
@@ -133,6 +133,7 @@ function wp_cron() {
 function wp_get_schedules() {
        $schedules = array(
                'hourly' => array( 'interval' => 3600, 'display' => __('Once Hourly') ),
+               'twicedaily' => array( 'interval' => 43200, 'display' => __('Twice Daily') ),
                'daily' => array( 'interval' => 86400, 'display' => __('Once Daily') ),
        );
        return array_merge( apply_filters( 'cron_schedules', array() ), $schedules );
index 857de94dd10fe8c4bbf15cec97e278c72ddca28d..011a1ed4be8fe1e141140c875ed982818d3171fc 100644 (file)
@@ -153,6 +153,8 @@ add_action('check_comment_flood', 'check_comment_flood_db', 10, 3);
 add_filter('comment_flood_filter', 'wp_throttle_comment_flood', 10, 3);
 add_filter('pre_comment_content', 'wp_rel_nofollow', 15);
 add_filter('comment_email', 'antispambot');
+add_filter('option_tag_base', '_wp_filter_taxonomy_base');
+add_filter('option_category_base', '_wp_filter_taxonomy_base');
 
 //Atom SSL support
 add_filter('atom_service_url','atom_service_url_filter');
@@ -175,9 +177,11 @@ add_action('do_pings', 'do_all_pings', 10, 1);
 add_action('do_robots', 'do_robots');
 add_action('sanitize_comment_cookies', 'sanitize_comment_cookies');
 add_action('admin_print_scripts', 'wp_print_scripts', 20);
+add_action('admin_print_styles', 'wp_print_styles', 20);
 add_action('init', 'smilies_init', 5);
 add_action( 'plugins_loaded', 'wp_maybe_load_widgets', 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);
index 32c28ce9d28383626241cb9b20bdc7e82baa64f9..066e62c883aab9cee9b10adf5ba8e72a16aaef64 100644 (file)
@@ -1064,14 +1064,14 @@ function get_links($category = -1, $before = '', $after = '<br />', $between = '
  *
  * @author Dougal
  * @since 1.0.1
- * @deprecated Use get_categories()
- * @see get_categories()
+ * @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', 'get_categories()');
+       _deprecated_function(__FUNCTION__, '0.0', 'wp_list_bookmarks()');
 
        $order = strtolower($order);
 
index 4cf5e67653874605909830b4fa70e89bde7575c3..11ff42bc234037f653ebdcc46c998f57e6308166 100644 (file)
@@ -1,18 +1,83 @@
 <?php
+/**
+ * WordPress Feed API
+ *
+ * Many of the functions used in here belong in The Loop, or The Loop for the
+ * Feeds.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ */
 
+/**
+ * RSS container for the bloginfo function.
+ *
+ * You can retrieve anything that you can using the get_bloginfo() function.
+ * Everything will be stripped of tags and characters converted, when the values
+ * are retrieved for use in the feeds.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 1.5.1
+ * @uses apply_filters() Calls 'get_bloginfo_rss' hook with two parameters.
+ * @see get_bloginfo() For the list of possible values to display.
+ *
+ * @param string $show See get_bloginfo() for possible values.
+ * @return string
+ */
 function get_bloginfo_rss($show = '') {
        $info = strip_tags(get_bloginfo($show));
        return apply_filters('get_bloginfo_rss', convert_chars($info), $show);
 }
 
+/**
+ * Display RSS container for the bloginfo function.
+ *
+ * You can retrieve anything that you can using the get_bloginfo() function.
+ * Everything will be stripped of tags and characters converted, when the values
+ * are retrieved for use in the feeds.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 0.71
+ * @uses apply_filters() Calls 'bloginfo_rss' hook with two parameters.
+ * @see get_bloginfo() For the list of possible values to display.
+ *
+ * @param string $show See get_bloginfo() for possible values.
+ */
 function bloginfo_rss($show = '') {
        echo apply_filters('bloginfo_rss', get_bloginfo_rss($show), $show);
 }
 
+/**
+ * Retrieve the default feed.
+ *
+ * The default feed is 'rss2', unless a plugin changes it through the
+ * 'default_feed' filter.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 2.5
+ * @uses apply_filters() Calls 'default_feed' hook on the default feed string.
+ *
+ * @return string Default feed, or for example 'rss2', 'atom', etc.
+ */
 function get_default_feed() {
        return apply_filters('default_feed', 'rss2');
 }
 
+/**
+ * Retrieve the blog title for the feed title.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 2.2.0
+ * @uses apply_filters() Calls 'get_wp_title_rss' hook on title.
+ * @uses wp_title() See function for $sep parameter usage.
+ *
+ * @param string $sep Optional.How to separate the title. See wp_title() for more info.
+ * @return string Error message on failure or blog title on success.
+ */
 function get_wp_title_rss($sep = '&#187;') {
        $title = wp_title($sep, false);
        if ( is_wp_error( $title ) )
@@ -21,22 +86,79 @@ function get_wp_title_rss($sep = '&#187;') {
        return $title;
 }
 
+/**
+ * Display the blog title for display of the feed title.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 2.2.0
+ * @uses apply_filters() Calls 'wp_title_rss' on the blog title.
+ * @see wp_title() $sep parameter usage.
+ *
+ * @param string $sep Optional.
+ */
 function wp_title_rss($sep = '&#187;') {
        echo apply_filters('wp_title_rss', get_wp_title_rss($sep));
 }
 
+/**
+ * Retrieve the current post title for the feed.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 2.0.0
+ * @uses apply_filters() Calls 'the_title_rss' on the post title.
+ *
+ * @return string Current post title.
+ */
 function get_the_title_rss() {
        $title = get_the_title();
        $title = apply_filters('the_title_rss', $title);
        return $title;
 }
 
-
+/**
+ * Display the post title in the feed.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 0.71
+ * @uses get_the_title_rss() Used to retrieve current post title.
+ */
 function the_title_rss() {
        echo get_the_title_rss();
 }
 
-
+/**
+ * Display the post content for the feed.
+ *
+ * For encoding the html or the $encode_html parameter, there are three possible
+ * values. '0' will make urls footnotes and use make_url_footnote(). '1' will
+ * encode special characters and automatically display all of the content. The
+ * value of '2' will strip all HTML tags from the content.
+ *
+ * Also note that you cannot set the amount of words and not set the html
+ * encoding. If that is the case, then the html encoding will default to 2,
+ * which will strip all HTML tags.
+ *
+ * To restrict the amount of words of the content, you can use the cut
+ * parameter. If the content is less than the amount, then there won't be any
+ * dots added to the end. If there is content left over, then dots will be added
+ * and the rest of the content will be removed.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 0.71
+ * @uses apply_filters() Calls 'the_content_rss' on the content before processing.
+ * @see get_the_content() For the $more_link_text, $stripteaser, and $more_file
+ *             parameters.
+ *
+ * @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.
+ * @param string $more_file Optional.
+ * @param int $cut Optional. Amount of words to keep for the content.
+ * @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) {
        $content = get_the_content($more_link_text, $stripteaser, $more_file);
        $content = apply_filters('the_content_rss', $content);
@@ -59,6 +181,8 @@ function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file
                        $k = count($blah);
                        $use_dotdotdot = 0;
                }
+
+               /** @todo Check performance, might be faster to use array slice instead. */
                for ( $i=0; $i<$k; $i++ )
                        $excerpt .= $blah[$i].' ';
                $excerpt .= ($use_dotdotdot) ? '...' : '';
@@ -68,21 +192,51 @@ function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file
        echo $content;
 }
 
-
+/**
+ * Display the post excerpt for the feed.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 0.71
+ * @uses apply_filters() Calls 'the_excerpt_rss' hook on the excerpt.
+ */
 function the_excerpt_rss() {
        $output = get_the_excerpt();
        echo apply_filters('the_excerpt_rss', $output);
 }
 
+/**
+ * Display the permalink to the post for use in feeds.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 2.3.0
+ * @uses apply_filters() Call 'the_permalink_rss' on the post permalink
+ */
 function the_permalink_rss() {
        echo apply_filters('the_permalink_rss', get_permalink());
-
 }
 
+/**
+ * Display the feed GUID for the current comment.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since unknown
+ */
 function comment_guid() {
        echo get_comment_guid();
 }
 
+/**
+ * Retrieve the feed GUID for the current comment.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since unknown
+ *
+ * @return bool|string false on failure or guid for comment on success.
+ */
 function get_comment_guid() {
        global $comment;
 
@@ -92,24 +246,71 @@ function get_comment_guid() {
        return get_the_guid($comment->comment_post_ID) . '#comment-' . $comment->comment_ID;
 }
 
+/**
+ * Display the link to the comments.
+ *
+ * @since 1.5.0
+ */
 function comment_link() {
        echo get_comment_link();
 }
 
+/**
+ * Retrieve the current comment author for use in the feeds.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 2.0.0
+ * @uses apply_filters() Calls 'comment_author_rss' hook on comment author.
+ * @uses get_comment_author()
+ *
+ * @return string Comment Author
+ */
 function get_comment_author_rss() {
        return apply_filters('comment_author_rss', get_comment_author() );
 }
 
+/**
+ * Display the current comment author in the feed.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 1.0.0
+ */
 function comment_author_rss() {
        echo get_comment_author_rss();
 }
 
+/**
+ * Display the current comment content for use in the feeds.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 1.0.0
+ * @uses apply_filters() Calls 'comment_text_rss' filter on comment content.
+ * @uses get_comment_text()
+ */
 function comment_text_rss() {
        $comment_text = get_comment_text();
        $comment_text = apply_filters('comment_text_rss', $comment_text);
        echo $comment_text;
 }
 
+/**
+ * Retrieve all of the post categories, formatted for use in feeds.
+ *
+ * All of the categories for the current post in the feed loop, will be
+ * retrieved and have feed markup added, so that they can easily be added to the
+ * RSS2, Atom, or RSS1 and RSS0.91 RDF feeds.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 2.1.0
+ * @uses apply_filters() 
+ *
+ * @param string $type Optional, default is 'rss'. Either 'rss', 'atom', or 'rdf'.
+ * @return string All of the post categories for displaying in the feed.
+ */
 function get_the_category_rss($type = 'rss') {
        $categories = get_the_category();
        $tags = get_the_tags();
@@ -142,10 +343,29 @@ function get_the_category_rss($type = 'rss') {
        return apply_filters('the_category_rss', $the_list, $type);
 }
 
+/**
+ * Display the post categories in the feed.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 0.71
+ * @see get_the_category_rss() For better explanation.
+ *
+ * @param string $type Optional, default is 'rss'. Either 'rss', 'atom', or 'rdf'.
+ */
 function the_category_rss($type = 'rss') {
        echo get_the_category_rss($type);
 }
 
+/**
+ * Display the HTML type based on the blog setting.
+ *
+ * The two possible values are either 'xhtml' or 'html'.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 2.2.0
+ */
 function html_type_rss() {
        $type = get_bloginfo('html_type');
        if (strpos($type, 'xhtml') !== false)
@@ -155,7 +375,24 @@ function html_type_rss() {
        echo $type;
 }
 
-
+/**
+ * Display the rss enclosure for the current post.
+ *
+ * Uses the global $post to check whether the post requires a password and if
+ * the user has the password for the post. If not then it will return before
+ * displaying.
+ *
+ * Also uses the function get_post_custom() to get the post's 'enclosure'
+ * metadata field and parses the value to display the enclosure(s). The
+ * enclosure(s) consist of enclosure HTML tag(s) with a URI and other
+ * attributes.
+ *
+ * @package WordPress
+ * @subpackage Template
+ * @since 1.5.0
+ * @uses apply_filters() Calls 'rss_enclosure' hook on rss enclosure.
+ * @uses get_post_custom() To get the current post enclosure metadata.
+ */
 function rss_enclosure() {
        global $post;
        if ( !empty($post->post_password) && (!isset($_COOKIE['wp-postpass_'.COOKIEHASH]) || $_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) )
@@ -171,6 +408,23 @@ function rss_enclosure() {
        }
 }
 
+/**
+ * Display the atom enclosure for the current post.
+ *
+ * Uses the global $post to check whether the post requires a password and if
+ * the user has the password for the post. If not then it will return before
+ * displaying.
+ *
+ * Also uses the function get_post_custom() to get the post's 'enclosure'
+ * metadata field and parses the value to display the enclosure(s). The
+ * enclosure(s) consist of link HTML tag(s) with a URI and other attributes.
+ *
+ * @package WordPress
+ * @subpackage Template
+ * @since 2.2.0
+ * @uses apply_filters() Calls 'atom_enclosure' hook on atom enclosure.
+ * @uses get_post_custom() To get the current post enclosure metadata.
+ */
 function atom_enclosure() {
        global $post;
        if ( !empty($post->post_password) && ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) )
@@ -187,7 +441,7 @@ function atom_enclosure() {
 }
 
 /**
- * prep_atom_text_construct() - Determine the type of a given string of data
+ * Determine the type of a string of data with the data formatted.
  *
  * Tell whether the type is text, html, or xhtml, per RFC 4287 section 3.1.
  *
@@ -202,8 +456,8 @@ function atom_enclosure() {
  * @subpackage Feed
  * @since 2.5
  *
- * @param string $data input string
- * @return array $result array(type, value)
+ * @param string $data Input string
+ * @return array array(type, value)
  */
 function prep_atom_text_construct($data) {
        if (strpos($data, '<') === false && strpos($data, '&') === false) {
@@ -232,14 +486,13 @@ function prep_atom_text_construct($data) {
 }
 
 /**
- * self_link() - Generate a correct link for the atom:self elemet
+ * Display the link for the currently displayed feed in a XSS safe way.
  *
- * Echo the link for the currently displayed feed in a XSS safe way.
+ * Generate a correct link for the atom:self element.
  *
  * @package WordPress
  * @subpackage Feed
  * @since 2.5
- *
  */
 function self_link() {
        echo 'http'
@@ -248,4 +501,4 @@ function self_link() {
                . wp_specialchars(stripslashes($_SERVER['REQUEST_URI']), 1);
 }
 
-?>
+?>
\ No newline at end of file
index 052445d187674d96105ffd11f0819a7de71daa5b..eeafe0b499d9039d7f6da4331f5a48038a8033e0 100644 (file)
@@ -3,6 +3,7 @@
 function wptexturize($text) {
        global $wp_cockneyreplace;
        $next = true;
+       $has_pre_parent = false;
        $output = '';
        $curl = '';
        $textarr = preg_split('/(<.*>|\[.*\])/Us', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
@@ -26,13 +27,17 @@ function wptexturize($text) {
        for ( $i = 0; $i < $stop; $i++ ) {
                $curl = $textarr[$i];
 
-               if (isset($curl{0}) && '<' != $curl{0} && '[' != $curl{0} && $next) { // If it's not a tag
+               if (isset($curl{0}) && '<' != $curl{0} && '[' != $curl{0} && $next && !$has_pre_parent) { // If it's not a tag
                        // static strings
                        $curl = str_replace($static_characters, $static_replacements, $curl);
                        // regular expressions
                        $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);
-               } elseif (strpos($curl, '<code') !== false || strpos($curl, '<pre') !== false || strpos($curl, '<kbd') !== false || strpos($curl, '<style') !== false || strpos($curl, '<script') !== false) {
+               } elseif (strpos($curl, '<code') !== false || strpos($curl, '<kbd') !== false || strpos($curl, '<style') !== false || strpos($curl, '<script') !== false) {
                        $next = false;
+               } elseif (strpos($curl, '<pre') !== false) {
+                       $has_pre_parent = true;
+               } elseif (strpos($curl, '</pre>') !== false) {
+                       $has_pre_parent = false;
                } else {
                        $next = true;
                }
@@ -327,6 +332,9 @@ function sanitize_user( $username, $strict = false ) {
        if ( $strict )
                $username = preg_replace('|[^a-z0-9 _.\-@]|i', '', $username);
 
+       // Consolidate contiguous whitespace
+       $username = preg_replace('|\s+|', ' ', $username);
+
        return apply_filters('sanitize_user', $username, $raw_username, $strict);
 }
 
@@ -839,6 +847,9 @@ function human_time_diff( $from, $to = '' ) {
 function wp_trim_excerpt($text) { // Fakes an excerpt if needed
        if ( '' == $text ) {
                $text = get_the_content('');
+               
+               $text = strip_shortcodes( $text ); 
+               
                $text = apply_filters('the_content', $text);
                $text = str_replace(']]>', ']]&gt;', $text);
                $text = strip_tags($text);
@@ -1121,13 +1132,9 @@ function wp_richedit_pre($text) {
        // Filtering a blank results in an annoying <br />\n
        if ( empty($text) ) return apply_filters('richedit_pre', '');
 
-       $output = $text;
-       $output = convert_chars($output);
+       $output = convert_chars($text);
        $output = wpautop($output);
-
-       // These must be double-escaped or planets will collide.
-       $output = str_replace('&lt;', '&amp;lt;', $output);
-       $output = str_replace('&gt;', '&amp;gt;', $output);
+       $output = htmlspecialchars($output, ENT_NOQUOTES);
 
        return apply_filters('richedit_pre', $output);
 }
index e011d34070c6d9791e14f7f01c7e98ef42a2d125..fb3aaf0f0060bc7e664a74b0235aea40944caac1 100644 (file)
@@ -1,5 +1,27 @@
 <?php
+/**
+ * Main WordPress API
+ *
+ * @package WordPress
+ */
 
+/**
+ * Converts MySQL DATETIME field to user specified date format.
+ *
+ * If $dateformatstring has 'G' value, then gmmktime() function will be used to
+ * make the time. If $dateformatstring is set to 'U', then mktime() function
+ * will be used to make the time.
+ *
+ * The $translate will only be used, if it is set to true and it is by default
+ * and if the $wp_locale object has the month and weekday set.
+ *
+ * @since 0.71
+ *
+ * @param string $dateformatstring Either 'G', 'U', or php date format.
+ * @param string $mysqlstring Time from mysql DATETIME field.
+ * @param bool $translate Optional. Default is true. Will switch format to locale.
+ * @return string Date formated by $dateformatstring or locale (if available).
+ */
 function mysql2date( $dateformatstring, $mysqlstring, $translate = true ) {
        global $wp_locale;
        $m = $mysqlstring;
@@ -51,7 +73,21 @@ function mysql2date( $dateformatstring, $mysqlstring, $translate = true ) {
        return $j;
 }
 
-
+/**
+ * Retrieve the current time based on specified type.
+ *
+ * The 'mysql' type will return the time in the format for MySQL DATETIME field.
+ * The 'timestamp' type will return the current timestamp.
+ *
+ * If the $gmt is set to either '1' or 'true', then both types will use the
+ * GMT offset in the WordPress option to add the GMT offset to the time.
+ *
+ * @since 1.0.0
+ *
+ * @param string $type Either 'mysql' or 'timestamp'.
+ * @param int|bool $gmt Optional. Whether to use $gmt offset. Default is false.
+ * @return unknown
+ */
 function current_time( $type, $gmt = 0 ) {
        switch ( $type ) {
                case 'mysql':
@@ -63,10 +99,26 @@ function current_time( $type, $gmt = 0 ) {
        }
 }
 
-
+/**
+ * Retrieve the date in localized format, based on timestamp.
+ *
+ * If the locale specifies the locale month and weekday, then the locale will
+ * take over the format for the date. If it isn't, then the date format string
+ * will be used instead.
+ *
+ * @since 0.71
+ *
+ * @param string $dateformatstring Format to display the date
+ * @param int $unixtimestamp Unix timestamp
+ * @return string The date, translated if locale specifies it.
+ */
 function date_i18n( $dateformatstring, $unixtimestamp ) {
        global $wp_locale;
        $i = $unixtimestamp;
+       // Sanity check for PHP 5.1.0-
+       if ( -1 == $i )
+               $i = false;
+       
        if ( ( !empty( $wp_locale->month ) ) && ( !empty( $wp_locale->weekday ) ) ) {
                $datemonth = $wp_locale->get_month( date( 'm', $i ) );
                $datemonth_abbrev = $wp_locale->get_month_abbrev( $datemonth );
@@ -88,7 +140,15 @@ function date_i18n( $dateformatstring, $unixtimestamp ) {
        return $j;
 }
 
-
+/**
+ * Convert number to format based on the locale.
+ *
+ * @since 2.3.0
+ *
+ * @param mixed $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 ) {
        global $wp_locale;
        // let the user override the precision only
@@ -97,10 +157,28 @@ function number_format_i18n( $number, $decimals = null ) {
        return number_format( $number, $decimals, $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep'] );
 }
 
-
+/**
+ * Convert number of bytes largest unit bytes will fit into.
+ *
+ * It is easier to read 1kB than 1024 bytes and 1MB than 1048576 bytes. Converts
+ * number of bytes to human readable number by taking the number of that unit
+ * that the bytes will go into it. Supports TB value.
+ *
+ * Please note that integers in PHP are limited to 32 bits, unless they are on
+ * 64 bit architecture, then they have 64 bit size. If you need to place the
+ * larger size then what PHP integer type will hold, then use a string. It will
+ * be converted to a double, which should always have 64 bit length.
+ *
+ * Technically the correct unit names for powers of 1024 are KiB, MiB etc.
+ * @link http://en.wikipedia.org/wiki/Byte
+ *
+ * @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.
+ * @return unknown
+ */
 function size_format( $bytes, $decimals = null ) {
-       // technically the correct unit names for powers of 1024 are KiB, MiB etc
-       // see http://en.wikipedia.org/wiki/Byte
        $quant = array(
                // ========================= Origin ====
                'TB' => 1099511627776,  // pow( 1024, 4)
@@ -144,7 +222,14 @@ function get_weekstartend( $mysqlstring, $start_of_week = '' ) {
        return $week;
 }
 
-
+/**
+ * Unserialize value only if it was serialized.
+ *
+ * @since 2.0.0
+ *
+ * @param string $original Maybe unserialized original, if is needed.
+ * @return mixed Unserialized data can be any type.
+ */
 function maybe_unserialize( $original ) {
        if ( is_serialized( $original ) ) // don't attempt to unserialize data that wasn't serialized going in
                if ( false !== $gm = @unserialize( $original ) )
@@ -152,7 +237,17 @@ function maybe_unserialize( $original ) {
        return $original;
 }
 
-
+/**
+ * Check value to find if it was serialized.
+ *
+ * If $data is not an string, then returned value will always be false.
+ * Serialized data is always a string.
+ *
+ * @since 2.0.5
+ *
+ * @param mixed $data Value to check to see if was serialized.
+ * @return bool False if not serialized and true if it was.
+ */
 function is_serialized( $data ) {
        // if it isn't a string, it isn't serialized
        if ( !is_string( $data ) )
@@ -179,7 +274,14 @@ function is_serialized( $data ) {
        return false;
 }
 
-
+/**
+ * Check whether serialized data is of string type.
+ *
+ * @since 2.0.5
+ *
+ * @param mixed $data Serialized data
+ * @return bool False if not a serialized string, true if it is.
+ */
 function is_serialized_string( $data ) {
        // if it isn't a string, it isn't a serialized string
        if ( !is_string( $data ) )
@@ -190,10 +292,33 @@ function is_serialized_string( $data ) {
        return false;
 }
 
-
-/* Options functions */
-
-// expects $setting to already be SQL-escaped
+/**
+ * Retrieve option value based on setting name.
+ *
+ * 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.
+ *
+ * @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
+ * @return mixed Value set for the option.
+ */
 function get_option( $setting ) {
        global $wpdb;
 
@@ -216,7 +341,7 @@ function get_option( $setting ) {
 
                if ( false === $value ) {
                        if ( defined( 'WP_INSTALLING' ) )
-                               $supress = $wpdb->suppress_errors();
+                               $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' ) )
@@ -243,17 +368,52 @@ function get_option( $setting ) {
        return apply_filters( 'option_' . $setting, maybe_unserialize( $value ) );
 }
 
-
+/**
+ * Protect WordPress special option from being modified.
+ *
+ * Will die if $option is in protected list.
+ *
+ * @since 2.2.0
+ * @package WordPress
+ * @subpackage Option
+ *
+ * @param string $option Option name.
+ */
 function wp_protect_special_option( $option ) {
        $protected = array( 'alloptions', 'notoptions' );
        if ( in_array( $option, $protected ) )
                die( sprintf( __( '%s is a protected WP option and may not be modified' ), wp_specialchars( $option ) ) );
 }
 
+/**
+ * Print option value after sanitizing for forms.
+ *
+ * @uses attribute_escape Sanitizes value.
+ * @since 1.5.0
+ * @package WordPress
+ * @subpackage Option
+ *
+ * @param string $option Option name.
+ */
 function form_option( $option ) {
        echo attribute_escape (get_option( $option ) );
 }
 
+/**
+ * Retrieve all autoload options or all options, if no autoloaded ones exist.
+ *
+ * This is different from wp_load_alloptions(), in this that function does not
+ * cache all options and will retrieve all options from the database every time
+ * 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, $wp_queries;
        $show = $wpdb->hide_errors();
@@ -264,7 +424,7 @@ function get_alloptions() {
        foreach ( $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' ) ) )
+               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 );
@@ -272,7 +432,18 @@ function get_alloptions() {
        return apply_filters( 'all_options', $all_options );
 }
 
-
+/**
+ * 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.
+ */
 function wp_load_alloptions() {
        global $wpdb;
 
@@ -291,8 +462,26 @@ function wp_load_alloptions() {
        return $alloptions;
 }
 
-
-// expects $option_name to NOT be SQL-escaped
+/**
+ * Update the value of an option that was already added.
+ *
+ * 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().
+ *
+ * When the option is updated, then the filter named
+ * '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 old parameter and the second is the new parameter.
+ *
+ * @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.
+ * @return bool False if value was not updated and true if value was updated.
+ */
 function update_option( $option_name, $newvalue ) {
        global $wpdb;
 
@@ -301,8 +490,11 @@ function update_option( $option_name, $newvalue ) {
        $safe_option_name = $wpdb->escape( $option_name );
        $newvalue = sanitize_option( $option_name, $newvalue );
 
-       // If the new and old values are the same, no need to update.
        $oldvalue = get_option( $safe_option_name );
+
+       $newvalue = apply_filters( 'pre_update_option_' . $option_name, $newvalue, $oldvalue );
+
+       // If the new and old values are the same, no need to update.
        if ( $newvalue === $oldvalue )
                return false;
 
@@ -336,9 +528,30 @@ function update_option( $option_name, $newvalue ) {
        return false;
 }
 
-
-// thx Alex Stapleton, http://alex.vort-x.net/blog/
-// expects $name to NOT be SQL-escaped
+/**
+ * Add a new 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
+ * 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.
+ * @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' ) {
        global $wpdb;
 
@@ -372,11 +585,20 @@ function add_option( $name, $value = '', $deprecated = '', $autoload = 'yes' ) {
 
        $wpdb->query( $wpdb->prepare( "INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES (%s, %s, %s)", $name, $value, $autoload ) );
 
-       do_action( "add_option_{$name}", $name, $value ); 
+       do_action( "add_option_{$name}", $name, $value );
        return;
 }
 
-
+/**
+ * Removes option by name and prevents removal of protected WordPress options.
+ *
+ * @package WordPress
+ * @subpackage Option
+ * @since unknown
+ *
+ * @param string $name Option name to remove.
+ * @return bool True, if succeed. False, if failure.
+ */
 function delete_option( $name ) {
        global $wpdb;
 
@@ -401,14 +623,19 @@ function delete_option( $name ) {
        return true;
 }
 
-
+/**
+ * Serialize data, if needed.
+ *
+ * @param mixed $data Data that might be serialized.
+ * @return mixed A scalar data
+ */
 function maybe_serialize( $data ) {
-       if ( is_string( $data ) )
-               $data = trim( $data );
-       elseif ( is_array( $data ) || is_object( $data ) )
+       if ( is_array( $data ) || is_object( $data ) )
                return serialize( $data );
+
        if ( is_serialized( $data ) )
                return serialize( $data );
+
        return $data;
 }
 
@@ -465,7 +692,22 @@ function xmlrpc_removepostdata( $content ) {
        return $content;
 }
 
-
+/**
+ * Open the file handle for debugging.
+ *
+ * This function is used for XMLRPC feature, but it is general purpose enough
+ * to be used in anywhere.
+ *
+ * @see fopen() for mode options.
+ * @package WordPress
+ * @subpackage Debug
+ * @since unknown
+ * @uses $debug Used for whether debugging is enabled.
+ *
+ * @param string $filename File path to debug file.
+ * @param string $mode Same as fopen() mode parameter.
+ * @return bool|resource File handle. False on failure.
+ */
 function debug_fopen( $filename, $mode ) {
        global $debug;
        if ( 1 == $debug ) {
@@ -476,14 +718,39 @@ function debug_fopen( $filename, $mode ) {
        }
 }
 
-
+/**
+ * Write contents to the file used for debugging.
+ *
+ * Technically, this can be used to write to any file handle when the global
+ * $debug is set to 1 or true.
+ *
+ * @package WordPress
+ * @subpackage Debug
+ * @since unknown
+ * @uses $debug Used for whether debugging is enabled.
+ *
+ * @param resource $fp File handle for debugging file.
+ * @param string $string Content to write to debug file.
+ */
 function debug_fwrite( $fp, $string ) {
        global $debug;
        if ( 1 == $debug )
                fwrite( $fp, $string );
 }
 
-
+/**
+ * Close the debugging file handle.
+ *
+ * Technically, this can be used to close any file handle when the global $debug
+ * is set to 1 or true.
+ *
+ * @package WordPress
+ * @subpackage Debug
+ * @since unknown
+ * @uses $debug Used for whether debugging is enabled.
+ *
+ * @param resource $fp Debug File handle.
+ */
 function debug_fclose( $fp ) {
        global $debug;
        if ( 1 == $debug )
@@ -536,9 +803,19 @@ function do_enclose( $content, $post_ID ) {
        }
 }
 
-// perform a HTTP HEAD or GET request
-// if $file_path is a writable filename, this will do a GET request and write the file to that path
-// returns a list of HTTP headers
+/**
+ * Perform a HTTP HEAD or GET request.
+ *
+ * If $file_path is a writable filename, this will do a GET request and write
+ * the file to that path.
+ *
+ * @since unknown
+ *
+ * @param string $url
+ * @param string|bool $file_path Optional. File path to write request to.
+ * @param int $red Optional. Number of Redirects. Stops at 5 redirects.
+ * @return bool|string False on failure and string of headers if HEAD request.
+ */
 function wp_get_http( $url, $file_path = false, $red = 1 ) {
        global $wp_version;
        @set_time_limit( 60 );
@@ -610,11 +887,30 @@ function wp_get_http( $url, $file_path = false, $red = 1 ) {
        return $headers;
 }
 
+/**
+ * Retrieve HTTP Headers from URL.
+ *
+ * @since 1.5.1
+ *
+ * @param string $url
+ * @param int $red Optional. Number of redirects.
+ * @return bool|string False on failure, headers on success.
+ */
 function wp_get_http_headers( $url, $red = 1 ) {
        return wp_get_http( $url, false, $red );
 }
 
-
+/**
+ * Whether today is a new day.
+ *
+ * {@internal Need to find out how this function is used.}}
+ *
+ * @since 0.71
+ * @uses $day Today
+ * @uses $previousday Previous day
+ *
+ * @return int 1 when new day, 0 if not a new day.
+ */
 function is_new_day() {
        global $day, $previousday;
        if ( $day != $previousday )
@@ -623,22 +919,42 @@ function is_new_day() {
                return 0;
 }
 
-
+/**
+ * Build URL query based on an associative and, or indexed array.
+ *
+ * This is a convenient function for easily building url queries. It sets the
+ * separator to '&' and uses _http_build_query() function.
+ *
+ * @see _http_build_query() Used to build the query
+ * @link http://us2.php.net/manual/en/function.http-build-query.php more on what
+ *             http_build_query() does.
+ *
+ * @since unknown
+ *
+ * @param array $data URL-encode key/value pairs.
+ * @return string URL encoded string
+ */
 function build_query( $data ) {
        return _http_build_query( $data, NULL, '&', '', false );
 }
 
-
-/*
-add_query_arg: Returns a modified querystring by adding
-a single key & value or an associative array.
-Setting a key value to emptystring removes the key.
-Omitting oldquery_or_uri uses the $_SERVER value.
-
-Parameters:
-add_query_arg(newkey, newvalue, oldquery_or_uri) or
-add_query_arg(associative_array, oldquery_or_uri)
-*/
+/**
+ * Retrieve a modified URL query string.
+ *
+ * You can rebuild the URL and append a new query variable to the URL query by
+ * using this function. You can also retrieve the full URL with query data.
+ *
+ * Adding a single key & value or an associative array. Setting a key value to
+ * emptystring removes the key. Omitting oldquery_or_uri uses the $_SERVER
+ * value.
+ *
+ * @since 1.5.0
+ *
+ * @param mixed $param1 Either newkey or an associative_array
+ * @param mixed $param2 Either newvalue or oldquery or uri
+ * @param mixed $param3 Optional. Old query or uri
+ * @return unknown
+ */
 function add_query_arg() {
        $ret = '';
        if ( is_array( func_get_arg(0) ) ) {
@@ -704,27 +1020,32 @@ function add_query_arg() {
        return $ret;
 }
 
-
-/*
-remove_query_arg: Returns a modified querystring by removing
-a single key or an array of keys.
-Omitting oldquery_or_uri uses the $_SERVER value.
-
-Parameters:
-remove_query_arg(removekey, [oldquery_or_uri]) or
-remove_query_arg(removekeyarray, [oldquery_or_uri])
-*/
-
-function remove_query_arg( $key, $query=FALSE ) {
+/**
+ * Removes an item or list from the query string.
+ *
+ * @since 1.5.0
+ *
+ * @param string|array $key Query key or keys to remove.
+ * @param bool $query When false uses the $_SERVER value.
+ * @return unknown
+ */
+function remove_query_arg( $key, $query=false ) {
        if ( is_array( $key ) ) { // removing multiple keys
                foreach ( (array) $key as $k )
-                       $query = add_query_arg( $k, FALSE, $query );
+                       $query = add_query_arg( $k, false, $query );
                return $query;
        }
-       return add_query_arg( $key, FALSE, $query );
+       return add_query_arg( $key, false, $query );
 }
 
-
+/**
+ * Walks the array while sanitizing the contents.
+ *
+ * @uses $wpdb Used to sanitize values
+ *
+ * @param array $array Array to used to walk while sanitizing contents.
+ * @return array Sanitized $array.
+ */
 function add_magic_quotes( $array ) {
        global $wpdb;
 
@@ -738,6 +1059,17 @@ function add_magic_quotes( $array ) {
        return $array;
 }
 
+/**
+ * HTTP request for URI to retrieve content.
+ *
+ * Tries to retrieve the HTTP content with fopen first and then using cURL, if
+ * fopen can't be used.
+ *
+ * @since unknown
+ *
+ * @param string $uri URI/URL of web page to retrieve.
+ * @return string HTTP content.
+ */
 function wp_remote_fopen( $uri ) {
        $timeout = 10;
        $parsed_url = @parse_url( $uri );
@@ -782,7 +1114,14 @@ function wp( $query_vars = '' ) {
                $wp_the_query = $wp_query;
 }
 
-
+/**
+ * Retrieve the description for the HTTP status.
+ *
+ * @since 2.3.0
+ *
+ * @param int $code HTTP status code.
+ * @return string Empty string if not found, or description if found.
+ */
 function get_status_header_desc( $code ) {
        global $wp_header_to_desc;
 
@@ -842,7 +1181,17 @@ function get_status_header_desc( $code ) {
                return '';
 }
 
-
+/**
+ * Set HTTP status header.
+ *
+ * @since unknown
+ * @uses apply_filters() Calls 'status_header' on status header string, HTTP
+ *             HTTP code, HTTP code description, and protocol string as separate
+ *             parameters.
+ *
+ * @param int $header HTTP status code
+ * @return null Does not return anything.
+ */
 function status_header( $header ) {
        $text = get_status_header_desc( $header );
 
@@ -862,7 +1211,14 @@ function status_header( $header ) {
                return @header( $status_header );
 }
 
-
+/**
+ * Sets the headers to prevent caching for the different browsers.
+ *
+ * Different browsers support different nocache headers, so several headers must
+ * be sent so that all of them get the point that no caching should occur.
+ *
+ * @since 2.0.0
+ */
 function nocache_headers() {
        // why are these @-silenced when other header calls aren't?
        @header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
@@ -871,7 +1227,11 @@ function nocache_headers() {
        @header( 'Pragma: no-cache' );
 }
 
-
+/**
+ * Set the headers for caching for 10 days with JavaScript content type.
+ *
+ * @since 2.1.0
+ */
 function cache_javascript_headers() {
        $expiresOffset = 864000; // 10 days
        header( "Content-Type: text/javascript; charset=" . get_bloginfo( 'charset' ) );
@@ -879,13 +1239,26 @@ function cache_javascript_headers() {
        header( "Expires: " . gmdate( "D, d M Y H:i:s", time() + $expiresOffset ) . " GMT" );
 }
 
-
+/**
+ * Retrieve the number of database queries during the WordPress execution.
+ *
+ * @since 2.0.0
+ *
+ * @return int Number of database queries
+ */
 function get_num_queries() {
        global $wpdb;
        return $wpdb->num_queries;
 }
 
-
+/**
+ * Whether input is yes or no. Must be 'y' to be true.
+ *
+ * @since 1.0.0
+ *
+ * @param string $yn Character string containing either 'y' or 'n'
+ * @return bool True if yes, false on anything else
+ */
 function bool_from_yn( $yn ) {
        return ( strtolower( $yn ) == 'y' );
 }
@@ -911,17 +1284,31 @@ function do_feed() {
        do_action( $hook, $wp_query->is_comment_feed );
 }
 
-
+/**
+ * Load the RDF RSS 0.91 Feed template.
+ *
+ * @since 2.1.0
+ */
 function do_feed_rdf() {
        load_template( ABSPATH . WPINC . '/feed-rdf.php' );
 }
 
-
+/**
+ * Load the RSS 1.0 Feed Template
+ *
+ * @since 2.1.0
+ */
 function do_feed_rss() {
        load_template( ABSPATH . WPINC . '/feed-rss.php' );
 }
 
-
+/**
+ * Load either the RSS2 comment feed or the RSS2 posts feed.
+ *
+ * @since 2.1.0
+ *
+ * @param bool $for_comments True for the comment feed, false for normal feed.
+ */
 function do_feed_rss2( $for_comments ) {
        if ( $for_comments )
                load_template( ABSPATH . WPINC . '/feed-rss2-comments.php' );
@@ -929,7 +1316,13 @@ function do_feed_rss2( $for_comments ) {
                load_template( ABSPATH . WPINC . '/feed-rss2.php' );
 }
 
-
+/**
+ * Load either Atom comment feed or Atom posts feed.
+ *
+ * @since 2.1.0
+ *
+ * @param bool $for_comments True for the comment feed, false for normal feed.
+ */
 function do_feed_atom( $for_comments ) {
        if ($for_comments)
                load_template( ABSPATH . WPINC . '/feed-atom-comments.php');
@@ -937,6 +1330,15 @@ function do_feed_atom( $for_comments ) {
                load_template( ABSPATH . WPINC . '/feed-atom.php' );
 }
 
+/**
+ * Display the robot.txt file content.
+ *
+ * The echo content should be with usage of the permalinks or for creating the
+ * robot.txt file.
+ *
+ * @since 2.1.0
+ * @uses do_action() Calls 'do_robotstxt' hook for displaying robot.txt rules.
+ */
 function do_robots() {
        header( 'Content-Type: text/plain; charset=utf-8' );
 
@@ -1079,22 +1481,30 @@ function path_join( $base, $path ) {
 function wp_upload_dir( $time = NULL ) {
        $siteurl = get_option( 'siteurl' );
        $upload_path = get_option( 'upload_path' );
-       if ( trim($upload_path) === '' )
-               $upload_path = 'wp-content/uploads';
-       $dir = $upload_path;
+       $upload_path = trim($upload_path);
+       if ( empty($upload_path) )
+               $dir = WP_CONTENT_DIR . '/uploads';
+       else 
+               $dir = $upload_path;
 
        // $dir is absolute, $path is (maybe) relative to ABSPATH
-       $dir = path_join( ABSPATH, $upload_path );
-       $path = str_replace( ABSPATH, '', trim( $upload_path ) );
-
-       if ( !$url = get_option( 'upload_url_path' ) )
-               $url = trailingslashit( $siteurl ) . $path;
+       $dir = path_join( ABSPATH, $dir );
+       
+       if ( !$url = get_option( 'upload_url_path' ) ) {
+               if ( empty($upload_path) or ( $upload_path == $dir ) )
+                       $url = WP_CONTENT_URL . '/uploads';
+               else
+                       $url = trailingslashit( $siteurl ) . $upload_path;
+       }
 
        if ( defined('UPLOADS') ) {
                $dir = ABSPATH . UPLOADS;
                $url = trailingslashit( $siteurl ) . UPLOADS;
        }
 
+       $bdir = $dir; 
+       $burl = $url;
+
        $subdir = '';
        if ( get_option( 'uploads_use_yearmonth_folders' ) ) {
                // Generate the yearly and monthly dirs
@@ -1113,8 +1523,9 @@ function wp_upload_dir( $time = NULL ) {
                $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $dir );
                return array( 'error' => $message );
        }
+       
+       $uploads = array( 'path' => $dir, 'url' => $url, 'subdir' => $subdir, 'basedir' => $bdir, 'baseurl' => $burl, 'error' => false );
 
-       $uploads = array( 'path' => $dir, 'url' => $url, 'subdir' => $subdir, 'error' => false );
        return apply_filters( 'upload_dir', $uploads );
 }
 
@@ -1511,7 +1922,18 @@ function smilies_init() {
        }
 }
 
-
+/**
+ * Merge user defined arguments into defaults array.
+ *
+ * This function is used throughout WordPress to allow for both string or array
+ * to be merged into another array.
+ *
+ * @since 2.2.0
+ *
+ * @param string|array $args Value to merge with $defaults
+ * @param array $defaults Array that serves as the defaults.
+ * @return array Merged user defined values with defaults.
+ */
 function wp_parse_args( $args, $defaults = '' ) {
        if ( is_object( $args ) )
                $r = get_object_vars( $args );
@@ -1525,7 +1947,15 @@ function wp_parse_args( $args, $defaults = '' ) {
        return $r;
 }
 
-
+/**
+ * Determines if Widgets library should be loaded.
+ *
+ * Checks to make sure that the widgets library hasn't already been loaded. If
+ * it hasn't, then it will load the widgets library and run an action hook.
+ *
+ * @since 2.2.0
+ * @uses add_action() Calls '_admin_menu' hook with 'wp_widgets_add_menu' value.
+ */
 function wp_maybe_load_widgets() {
        if ( !function_exists( 'dynamic_sidebar' ) ) {
                require_once( ABSPATH . WPINC . '/widgets.php' );
@@ -1533,43 +1963,67 @@ function wp_maybe_load_widgets() {
        }
 }
 
-
+/**
+ * Append the Widgets menu to the themes main menu.
+ *
+ * @since 2.2.0
+ * @uses $submenu The administration submenu list.
+ */
 function wp_widgets_add_menu() {
        global $submenu;
        $submenu['themes.php'][7] = array( __( 'Widgets' ), 'switch_themes', 'widgets.php' );
        ksort( $submenu['themes.php'], SORT_NUMERIC );
 }
 
-
-// For PHP 5.2, make sure all output buffers are flushed
-// before our singletons our destroyed.
+/**
+ * Flush all output buffers for PHP 5.2.
+ *
+ * Make sure all output buffers are flushed before our singletons our destroyed.
+ *
+ * @since 2.2.0
+ */
 function wp_ob_end_flush_all() {
        while ( @ob_end_flush() );
 }
 
-
-/*
- * require_wp_db() - require_once the correct database class file.
+/**
+ * Load the correct database class file.
  *
- * This function is used to load the database class file either at runtime or by wp-admin/setup-config.php
- * We must globalise $wpdb to ensure that it is defined globally by the inline code in wp-db.php
+ * This function is used to load the database class file either at runtime or by
+ * wp-admin/setup-config.php We must globalise $wpdb to ensure that it is
+ * defined globally by the inline code in wp-db.php.
  *
- * @global $wpdb
+ * @since 2.5
+ * @global $wpdb WordPress Database Object
  */
 function require_wp_db() {
        global $wpdb;
-       if ( file_exists( ABSPATH . 'wp-content/db.php' ) )
-               require_once( ABSPATH . 'wp-content/db.php' );
+       if ( file_exists( WP_CONTENT_DIR . '/db.php' ) )
+               require_once( WP_CONTENT_DIR . '/db.php' );
        else
                require_once( ABSPATH . WPINC . '/wp-db.php' );
 }
 
+/**
+ * Load custom DB error or display WordPress DB error.
+ *
+ * If a file exists in the wp-content directory named db-error.php, then it will
+ * be loaded instead of displaying the WordPress DB error. If it is not found,
+ * then the WordPress DB error will be displayed instead.
+ *
+ * The WordPress DB error sets the HTTP status header to 500 to try to prevent
+ * search engines from caching the message. Custom DB messages should do the
+ * same.
+ *
+ * @since 2.5
+ * @uses $wpdb
+ */
 function dead_db() {
        global $wpdb;
 
        // Load custom DB error template, if present.
-       if ( file_exists( ABSPATH . 'wp-content/db-error.php' ) ) {
-               require_once( ABSPATH . 'wp-content/db-error.php' );
+       if ( file_exists( WP_CONTENT_DIR . '/db-error.php' ) ) {
+               require_once( WP_CONTENT_DIR . '/db-error.php' );
                die();
        }
 
@@ -1598,7 +2052,10 @@ function dead_db() {
 }
 
 /**
- * Converts input to an absolute integer
+ * Converts value to positive integer.
+ *
+ * @since 2.5
+ * 
  * @param mixed $maybeint data you wish to have convered to an absolute integer
  * @return int an absolute integer
  */
@@ -1607,8 +2064,14 @@ function absint( $maybeint ) {
 }
 
 /**
- * Determines if the blog can be accessed over SSL
- * @return bool whether of not SSL access is available
+ * Determines if the blog can be accessed over SSL.
+ *
+ * Determines if blog can be accessed over SSL by using cURL to access the site
+ * using the https in the siteurl. Requires cURL extension to work correctly.
+ *
+ * @since 2.5
+ *
+ * @return bool Whether or not SSL access is available
  */
 function url_is_accessable_via_ssl($url)
 {
@@ -1633,21 +2096,31 @@ function url_is_accessable_via_ssl($url)
        return false;
 }
 
+/**
+ * Secure URL, if available or the given URL.
+ *
+ * @since 2.5
+ *
+ * @param string $url Complete URL path with transport.
+ * @return string Secure or regular URL path.
+ */
 function atom_service_url_filter($url)
 {
        if ( url_is_accessable_via_ssl($url) )
-               return  preg_replace( '/^http:\/\//', 'https://',  $url );
+               return preg_replace( '/^http:\/\//', 'https://',  $url );
        else
                return $url;
 }
 
 /**
- * _deprecated_function() - Marks a function as deprecated and informs when it has been used.
+ * Marks a function as deprecated and informs when it has been used.
  *
- * There is a hook deprecated_function_run that will be called that can be used to get the backtrace
- * up to what file and function called the deprecated function.
+ * There is a hook deprecated_function_run that will be called that can be used
+ * to get the backtrace up to what file and function called the deprecated
+ * function.
  *
- * The current behavior is to trigger an user error if WP_DEBUG is defined and is true.
+ * The current behavior is to trigger an user error if WP_DEBUG is defined and
+ * is true.
  *
  * This function is to be used in every function in depreceated.php
  *
@@ -1670,19 +2143,21 @@ function _deprecated_function($function, $version, $replacement=null) {
        // Allow plugin to filter the output error trigger
        if( defined('WP_DEBUG') && ( true === WP_DEBUG ) && apply_filters( 'deprecated_function_trigger_error', true )) {
                if( !is_null($replacement) )
-                       trigger_error( printf( __("%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead."), $function, $version, $replacement ) );
+                       trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) );
                else
-                       trigger_error( printf( __("%1$s is <strong>deprecated</strong> since version %2$s with no alternative available."), $function, $version ) );
+                       trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
        }
 }
 
 /**
- * _deprecated_file() - Marks a file as deprecated and informs when it has been used.
+ * Marks a file as deprecated and informs when it has been used.
  *
- * There is a hook deprecated_file_included that will be called that can be used to get the backtrace
- * up to what file and function included the deprecated file.
+ * There is a hook deprecated_file_included that will be called that can be used
+ * to get the backtrace up to what file and function included the deprecated
+ * file.
  *
- * The current behavior is to trigger an user error if WP_DEBUG is defined and is true.
+ * The current behavior is to trigger an user error if WP_DEBUG is defined and
+ * is true.
  *
  * This function is to be used in every file that is depreceated
  *
@@ -1705,14 +2180,16 @@ function _deprecated_file($file, $version, $replacement=null) {
        // Allow plugin to filter the output error trigger
        if( defined('WP_DEBUG') && ( true === WP_DEBUG ) && apply_filters( 'deprecated_file_trigger_error', true )) {
                if( !is_null($replacement) )
-                       trigger_error( printf( __("%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead."), $file, $version, $replacement ) );
+                       trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $file, $version, $replacement ) );
                else
-                       trigger_error( printf( __("%1$s is <strong>deprecated</strong> since version %2$s with no alternative available."), $file, $version ) );
+                       trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $file, $version ) );
        }
 }
 
 /**
- * is_lighttpd_before_150() - Is the server running earlier than 1.5.0 version of lighttpd
+ * Is the server running earlier than 1.5.0 version of lighttpd
+ *
+ * @since unknown
  *
  * @return bool Whether the server is running lighttpd < 1.5.0
  */
@@ -1723,7 +2200,9 @@ function is_lighttpd_before_150() {
 }
 
 /**
- * apache_mod_loaded() - Does the specified module exist in the apache config?
+ * Does the specified module exist in the apache config?
+ *
+ * @since unknown
  *
  * @param string $mod e.g. mod_rewrite
  * @param bool $default The default return value if the module is not found
@@ -1749,4 +2228,105 @@ function apache_mod_loaded($mod, $default = false) {
        return $default;
 }
 
-?>
+/**
+ * File validates against allowed set of defined rules.
+ *
+ * A return value of '1' means that the $file contains either '..' or './'. A
+ * return value of '2' means that the $file contains ':' after the first
+ * character. A return value of '3' means that the file is not in the allowed
+ * files list.
+ *
+ * @since 2.6
+ *
+ * @param string $file File path.
+ * @param array $allowed_files List of allowed files.
+ * @return int 0 means nothing is wrong, greater than 0 means something was wrong.
+ */
+function validate_file( $file, $allowed_files = '' ) {
+       if ( false !== strpos( $file, '..' ))
+               return 1;
+
+       if ( false !== strpos( $file, './' ))
+               return 1;
+
+       if (':' == substr( $file, 1, 1 ))
+               return 2;
+
+       if (!empty ( $allowed_files ) && (!in_array( $file, $allowed_files ) ) )
+               return 3;
+
+       return 0;
+}
+
+/**
+ * Determine if SSL is used.
+ *
+ * @since 2.6
+ *
+ * @return bool True if SSL, false if not used.
+ */
+function is_ssl() {
+       return ( isset($_SERVER['HTTPS']) && 'on' == strtolower($_SERVER['HTTPS']) ) ? true : false; 
+}
+
+/**
+ * Whether SSL login should be forced.
+ *
+ * @since 2.6
+ *
+ * @param string|bool $force Optional.
+ * @return bool True if forced, false if not forced.
+ */
+function force_ssl_login($force = '') {
+       static $forced;
+
+       if ( '' != $force ) {
+               $old_forced = $forced;
+               $forced = $force;
+               return $old_forced;
+       }
+
+       return $forced;
+}
+
+/**
+ * Whether to force SSL used for the Administration Panels.
+ *
+ * @since 2.6
+ *
+ * @param string|bool $force
+ * @return bool True if forced, false if not forced.
+ */
+function force_ssl_admin($force = '') {
+       static $forced;
+
+       if ( '' != $force ) {
+               $old_forced = $forced;
+               $forced = $force;
+               return $old_forced;
+       }
+
+       return $forced;
+}
+
+/**
+ * Guess the URL for the site.
+ *
+ * Will remove wp-admin links to retrieve only return URLs not in the wp-admin
+ * directory.
+ *
+ * @since 2.6
+ *
+ * @return string
+ */
+function wp_guess_url() {
+       if ( defined('WP_SITEURL') && '' != WP_SITEURL ) {
+               $url = WP_SITEURL;
+       } else {
+               $schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
+               $url = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
+       }
+       return $url;
+}
+
+?>
\ No newline at end of file
diff --git a/wp-includes/functions.wp-scripts.php b/wp-includes/functions.wp-scripts.php
new file mode 100644 (file)
index 0000000..87995a4
--- /dev/null
@@ -0,0 +1,77 @@
+<?php
+
+/**
+ * Prints script tags in document head
+ *
+ * Called by admin-header.php and by wp_head hook. Since it is called by wp_head on every page load,
+ * the function does not instantiate the WP_Scripts object unless script names are explicitly passed.
+ * Does make use of already instantiated $wp_scripts if present.
+ * Use provided wp_print_scripts hook to register/enqueue new scripts.
+ *
+ * @see WP_Scripts::print_scripts()
+ */
+function wp_print_scripts( $handles = false ) {
+       do_action( 'wp_print_scripts' );
+       if ( '' === $handles ) // for wp_head
+               $handles = false;
+
+       global $wp_scripts;
+       if ( !is_a($wp_scripts, 'WP_Scripts') ) {
+               if ( !$handles )
+                       return array(); // No need to instantiate if nothing's there.
+               else
+                       $wp_scripts = new WP_Scripts();
+       }
+
+       return $wp_scripts->do_items( $handles );
+}
+
+function wp_register_script( $handle, $src, $deps = array(), $ver = false ) {
+       global $wp_scripts;
+       if ( !is_a($wp_scripts, 'WP_Scripts') )
+               $wp_scripts = new WP_Scripts();
+
+       $wp_scripts->add( $handle, $src, $deps, $ver );
+}
+
+/**
+ * Localizes a script
+ *
+ * Localizes only if script has already been added
+ *
+ * @see WP_Script::localize()
+ */
+function wp_localize_script( $handle, $object_name, $l10n ) {
+       global $wp_scripts;
+       if ( !is_a($wp_scripts, 'WP_Scripts') )
+               return false;
+
+       return $wp_scripts->localize( $handle, $object_name, $l10n );
+}
+
+function wp_deregister_script( $handle ) {
+       global $wp_scripts;
+       if ( !is_a($wp_scripts, 'WP_Scripts') )
+               $wp_scripts = new WP_Scripts();
+
+       $wp_scripts->remove( $handle );
+}
+
+/**
+ * Equeues script
+ *
+ * Registers the script if src provided (does NOT overwrite) and enqueues.
+ *
+ * @see WP_Script::add(), WP_Script::enqueue()
+*/
+function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false ) {
+       global $wp_scripts;
+       if ( !is_a($wp_scripts, 'WP_Scripts') )
+               $wp_scripts = new WP_Scripts();
+
+       if ( $src ) {
+               $_handle = explode('?', $handle);
+               $wp_scripts->add( $_handle[0], $src, $deps, $ver );
+       }
+       $wp_scripts->enqueue( $handle );
+}
diff --git a/wp-includes/functions.wp-styles.php b/wp-includes/functions.wp-styles.php
new file mode 100644 (file)
index 0000000..8a38282
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+
+function wp_print_styles( $handles = false ) {
+       do_action( 'wp_print_styles' );
+       if ( '' === $handles ) // for wp_head
+               $handles = false;
+
+       global $wp_styles;
+       if ( !is_a($wp_styles, 'WP_Styles') ) {
+               if ( !$handles )
+                       return array(); // No need to instantiate if nothing's there.
+               else
+                       $wp_styles = new WP_Styles();
+       }
+
+       return $wp_styles->do_items( $handles );
+}
+
+function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = false ) {
+       global $wp_styles;
+       if ( !is_a($wp_styles, 'WP_Styles') )
+               $wp_styles = new WP_Styles();
+
+       $wp_styles->add( $handle, $src, $deps, $ver, $media );
+}
+
+function wp_deregister_style( $handle ) {
+       global $wp_styles;
+       if ( !is_a($wp_styles, 'WP_Styles') )
+               $wp_styles = new WP_Styles();
+
+       $wp_styles->remove( $handle );
+}
+
+function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = false ) {
+       global $wp_styles;
+       if ( !is_a($wp_styles, 'WP_Styles') )
+               $wp_styles = new WP_Styles();
+
+       if ( $src ) {
+               $_handle = explode('?', $handle);
+               $wp_styles->add( $_handle[0], $src, $deps, $ver, $media );
+       }
+       $wp_styles->enqueue( $handle );
+}
index 1b1baf3092f0411eb34298b7f8b2b7405259dcb7..1d070149dc3ade3fbab7b1e009968543c49e55f8 100644 (file)
@@ -7,7 +7,7 @@ function get_header() {
        if ( file_exists( TEMPLATEPATH . '/header.php') )
                load_template( TEMPLATEPATH . '/header.php');
        else
-               load_template( ABSPATH . 'wp-content/themes/default/header.php');
+               load_template( WP_CONTENT_DIR . '/themes/default/header.php');
 }
 
 
@@ -16,7 +16,7 @@ function get_footer() {
        if ( file_exists( TEMPLATEPATH . '/footer.php') )
                load_template( TEMPLATEPATH . '/footer.php');
        else
-               load_template( ABSPATH . 'wp-content/themes/default/footer.php');
+               load_template( WP_CONTENT_DIR . '/themes/default/footer.php');
 }
 
 
@@ -27,15 +27,15 @@ function get_sidebar( $name = null ) {
        elseif ( file_exists( TEMPLATEPATH . '/sidebar.php') )
                load_template( TEMPLATEPATH . '/sidebar.php');
        else
-               load_template( ABSPATH . 'wp-content/themes/default/sidebar.php');
+               load_template( WP_CONTENT_DIR . '/themes/default/sidebar.php');
 }
 
 
 function wp_loginout() {
        if ( ! is_user_logged_in() )
-               $link = '<a href="' . get_option('siteurl') . '/wp-login.php">' . __('Log in') . '</a>';
+               $link = '<a href="' . site_url('wp-login.php', 'login') . '">' . __('Log in') . '</a>';
        else
-               $link = '<a href="' . get_option('siteurl') . '/wp-login.php?action=logout">' . __('Log out') . '</a>';
+               $link = '<a href="' . site_url('wp-login.php?action=logout', 'login') . '">' . __('Log out') . '</a>';
 
        echo apply_filters('loginout', $link);
 }
@@ -45,11 +45,11 @@ function wp_register( $before = '<li>', $after = '</li>' ) {
 
        if ( ! is_user_logged_in() ) {
                if ( get_option('users_can_register') )
-                       $link = $before . '<a href="' . get_option('siteurl') . '/wp-login.php?action=register">' . __('Register') . '</a>' . $after;
+                       $link = $before . '<a href="' . site_url('wp-login.php?action=register', 'login') . '">' . __('Register') . '</a>' . $after;
                else
                        $link = '';
        } else {
-               $link = $before . '<a href="' . get_option('siteurl') . '/wp-admin/">' . __('Site Admin') . '</a>' . $after;
+               $link = $before . '<a href="' . admin_url() . '">' . __('Site Admin') . '</a>' . $after;
        }
 
        echo apply_filters('register', $link);
@@ -233,6 +233,19 @@ function wp_title($sep = '&raquo;', $display = true, $seplocation = '') {
                $title = strip_tags( 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;
+               if ( 'right' == $seplocation )
+                       $title = "$term $sep $tax";
+               else
+                       $title = "$tax $sep $term";
+       }
+
        $prefix = '';
        if ( !empty($title) )
                $prefix = " $sep ";
@@ -343,13 +356,17 @@ function get_archives_link($url, $text, $format = 'html', $before = '', $after =
        $url = clean_url($url);
 
        if ('link' == $format)
-               return "\t<link rel='archives' title='$title_text' href='$url' />\n";
+               $link_html = "\t<link rel='archives' title='$title_text' href='$url' />\n";
        elseif ('option' == $format)
-               return "\t<option value='$url'>$before $text $after</option>\n";
+               $link_html = "\t<option value='$url'>$before $text $after</option>\n";
        elseif ('html' == $format)
-               return "\t<li>$before<a href='$url' title='$title_text'>$text</a>$after</li>\n";
+               $link_html = "\t<li>$before<a href='$url' title='$title_text'>$text</a>$after</li>\n";
        else // custom
-               return "\t$before<a href='$url' title='$title_text'>$text</a>$after\n";
+               $link_html = "\t$before<a href='$url' title='$title_text'>$text</a>$after\n";
+
+       $link_html = apply_filters( "get_archives_link", $link_html );
+               
+       return $link_html;
 }
 
 
@@ -810,7 +827,7 @@ function get_post_time( $d = 'U', $gmt = false ) { // returns timestamp
                $time = $post->post_date;
 
        $time = mysql2date($d, $time);
-       return apply_filters('get_the_time', $time, $d, $gmt);
+       return apply_filters('get_post_time', $time, $d, $gmt);
 }
 
 
@@ -1110,34 +1127,76 @@ function wp_admin_css_color($key, $name, $url, $colors = array()) {
        $_wp_admin_css_colors[$key] = (object) array('name' => $name, 'url' => $url, 'colors' => $colors);
 }
 
+/**
+ * wp_admin_css_uri() - Outputs the URL of a WordPress admin CSS file
+ *
+ * @see WP_Styles::_css_href and its style_loader_src filter.
+ *
+ * @param string $file file relative to wp-admin/ without its ".css" extension.
+ */
+
 function wp_admin_css_uri( $file = 'wp-admin' ) {
        if ( defined('WP_INSTALLING') ) {
                $_file = "./$file.css";
        } else {
-               if ( 'css/colors' == $file || 'css/colors-rtl' == $file ) {
-                       global $_wp_admin_css_colors;
-                       $color = get_user_option('admin_color');
-                       if ( empty($color) || !isset($_wp_admin_css_colors[$color]) )
-                               $color = 'fresh';
-                       $color = $_wp_admin_css_colors[$color];
-                       $_file = $color->url;
-                       $_file = ('css/colors-rtl' == $file) ? str_replace('.css','-rtl.css',$_file) : $_file;
-               } else {
-                       $_file = get_option( 'siteurl' ) . "/wp-admin/$file.css";
-               }
+               $_file = admin_url("$file.css");
        }
        $_file = add_query_arg( 'version', get_bloginfo( 'version' ),  $_file );
 
        return apply_filters( 'wp_admin_css_uri', $_file, $file );
 }
 
-function wp_admin_css( $file = 'wp-admin' ) {
+/**
+ * wp_admin_css() - Enqueues or directly prints a stylesheet link to the specified CSS file.
+ *
+ * "Intelligently" decides to enqueue or to print the CSS file.
+ * If the wp_print_styles action has *not* yet been called, the CSS file will be enqueued.
+ * If the wp_print_styles action *has* been called, the CSS link will be printed.
+ * Printing may be forced by passing TRUE as the $force_echo (second) parameter.
+ *
+ * For backward compatibility with WordPress 2.3 calling method:
+ * If the $file (first) parameter does not correspond to a registered CSS file, we assume $file is a
+ * file relative to wp-admin/ without its ".css" extension.  A stylesheet link to that generated URL is printed.
+ *
+ * @package WordPress
+ * @since 2.3
+ *
+ * @uses $wp_styles WordPress Styles Object
+ *
+ * @param string $file Style handle name or file name (without ".css" extension) relative to wp-admin/
+ * @param bool $force_echo Optional.  Force the stylesheet link to be printed rather than enqueued.
+ */
+
+function wp_admin_css( $file = 'wp-admin', $force_echo = false ) {
+       global $wp_styles;
+       if ( !is_a($wp_styles, 'WP_Styles') )
+               $wp_styles = new WP_Styles();
+
+       // For backward compatibility
+       $handle = 0 === strpos( $file, 'css/' ) ? substr( $file, 4 ) : $file;
 
-       echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . wp_admin_css_uri( $file ) . "' type='text/css' />\n", $file );
-       if ( 'rtl' == get_bloginfo( 'text_direction' ) ) {
-               $rtl = ( 'wp-admin' == $file ) ? 'rtl' : "$file-rtl";
-               echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . wp_admin_css_uri( $rtl ) . "' type='text/css' />\n", $rtl );
+       if ( $wp_styles->query( $handle ) ) {
+               if ( $force_echo || did_action( 'wp_print_styles' ) ) // we already printed the style queue.  Print this one immediately
+                       wp_print_styles( $handle );
+               else // Add to style queue
+                       wp_enqueue_style( $handle );
+               return;
        }
+
+       echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . clean_url( wp_admin_css_uri( $file ) ) . "' type='text/css' />\n", $file );
+       if ( 'rtl' == get_bloginfo( 'text_direction' ) )
+               echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . clean_url( wp_admin_css_uri( "$file-rtl" ) ) . "' type='text/css' />\n", "$file-rtl" );
+}
+
+/**
+ * Enqueues the default ThickBox js and css. 
+ * If any of the settings need to be changed, this can be done with another js file
+ * similar to media-upload.js and theme-preview.js. That file should require array('thickbox')
+ * to ensure it is loaded after. 
+ */
+function add_thickbox() {
+       wp_enqueue_script( 'thickbox' );
+       wp_enqueue_style( 'thickbox' );
 }
 
 /**
diff --git a/wp-includes/images/blank.gif b/wp-includes/images/blank.gif
new file mode 100644 (file)
index 0000000..e565824
Binary files /dev/null and b/wp-includes/images/blank.gif differ
index b0a2fa5627a3317b533afcfaa90dd7e06b9d6c20..ee0f31858bb7c12667b6997e75af9aa57550c162 100644 (file)
@@ -1,6 +1,8 @@
 var autosaveLast = '';
 var autosavePeriodical;
 var autosaveOldMessage = '';
+var autosaveDelayURL = null;
+var previewwin;
 
 jQuery(function($) {
        autosaveLast = $('#post #title').val()+$('#post #content').val();
@@ -8,6 +10,16 @@ jQuery(function($) {
 
        //Disable autosave after the form has been submitted
        $("#post").submit(function() { $.cancel(autosavePeriodical); });
+       
+       // Autosave when the preview button is clicked. 
+       $('#previewview a').click(function(e) {
+               autosave();
+               autosaveDelayURL = this.href;
+               previewwin = window.open('','_blank');
+
+               e.preventDefault();
+               return false;
+       });
 });
 
 function autosave_parse_response(response) {
@@ -96,6 +108,16 @@ function autosave_update_preview_link(post_id) {
                        getpermalinknonce: jQuery('#getpermalinknonce').val()
                }, function(permalink) {
                        jQuery('#previewview').html('<a target="_blank" href="'+permalink+'" tabindex="4">'+previewText+'</a>');
+
+                       // Autosave when the preview button is clicked.  
+                       jQuery('#previewview a').click(function(e) {
+                               autosave();
+                               autosaveDelayURL = this.href;
+                               previewwin = window.open('','_blank');
+
+                               e.preventDefault();
+                               return false;
+                       });
                });
        }
 }
@@ -125,6 +147,10 @@ function autosave_loading() {
 
 function autosave_enable_buttons() {
        jQuery("#submitpost :button:disabled, #submitpost :submit:disabled").attr('disabled', '');
+       if ( autosaveDelayURL ) {
+               previewwin.location = autosaveDelayURL;
+               autosaveDelayURL = null;
+       }
 }
 
 function autosave_disable_buttons() {
@@ -154,8 +180,13 @@ var autosave = function() {
                doAutoSave = false;
 
        /* Gotta do this up here so we can check the length when tinyMCE is in use */
-       if ( rich ) { tinyMCE.triggerSave(); }
-
+       if ( rich ) {           
+               var ed = tinyMCE.activeEditor;
+               if ( 'mce_fullscreen' == ed.id )
+                       tinyMCE.get('content').setContent(ed.getContent({format : 'raw'}), {format : 'raw'});
+               tinyMCE.get('content').save();
+       }
+       
        post_data["content"] = jQuery("#content").val();
        if ( jQuery('#post_name').val() )
                post_data["post_name"] = jQuery('#post_name').val();
@@ -168,8 +199,6 @@ var autosave = function() {
        autosave_disable_buttons();
 
        var origStatus = jQuery('#original_post_status').val();
-       if ( 'draft' != origStatus ) // autosave currently only turned on for drafts
-               doAutoSave = false;
 
        autosaveLast = jQuery("#title").val()+jQuery("#content").val();
        goodcats = ([]);
@@ -182,9 +211,9 @@ var autosave = function() {
                post_data["comment_status"] = 'open';
        if ( jQuery("#ping_status").attr("checked") )
                post_data["ping_status"] = 'open';
-       if ( jQuery("#excerpt") )
+       if ( jQuery("#excerpt").size() )
                post_data["excerpt"] = jQuery("#excerpt").val();
-       if ( jQuery("#post_author") )
+       if ( jQuery("#post_author").size() )
                post_data["post_author"] = jQuery("#post_author").val();
 
        // Don't run while the TinyMCE spellcheck is on.  Why?  Who knows.
diff --git a/wp-includes/js/jquery/jquery.dimensions.min.js b/wp-includes/js/jquery/jquery.dimensions.min.js
deleted file mode 100644 (file)
index 34c06de..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
- * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
- * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
- *
- * $LastChangedDate: 2007-12-20 08:43:48 -0600 (Thu, 20 Dec 2007) $
- * $Rev: 4257 $
- *
- * Version: 1.2
- *
- * Requires: jQuery 1.2+
- */
-(function($){$.dimensions={version:'1.2'};$.each(['Height','Width'],function(i,name){$.fn['inner'+name]=function(){if(!this[0])return;var torl=name=='Height'?'Top':'Left',borr=name=='Height'?'Bottom':'Right';return this.is(':visible')?this[0]['client'+name]:num(this,name.toLowerCase())+num(this,'padding'+torl)+num(this,'padding'+borr);};$.fn['outer'+name]=function(options){if(!this[0])return;var torl=name=='Height'?'Top':'Left',borr=name=='Height'?'Bottom':'Right';options=$.extend({margin:false},options||{});var val=this.is(':visible')?this[0]['offset'+name]:num(this,name.toLowerCase())+num(this,'border'+torl+'Width')+num(this,'border'+borr+'Width')+num(this,'padding'+torl)+num(this,'padding'+borr);return val+(options.margin?(num(this,'margin'+torl)+num(this,'margin'+borr)):0);};});$.each(['Left','Top'],function(i,name){$.fn['scroll'+name]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(name=='Left'?val:$(window)['scrollLeft'](),name=='Top'?val:$(window)['scrollTop']()):this['scroll'+name]=val;}):this[0]==window||this[0]==document?self[(name=='Left'?'pageXOffset':'pageYOffset')]||$.boxModel&&document.documentElement['scroll'+name]||document.body['scroll'+name]:this[0]['scroll'+name];};});$.fn.extend({position:function(){var left=0,top=0,elem=this[0],offset,parentOffset,offsetParent,results;if(elem){offsetParent=this.offsetParent();offset=this.offset();parentOffset=offsetParent.offset();offset.top-=num(elem,'marginTop');offset.left-=num(elem,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&$.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return $(offsetParent);}});function num(el,prop){return parseInt($.curCSS(el.jquery?el[0]:el,prop,true))||0;};})(jQuery);
\ No newline at end of file
index f0fd6e43bae8d4c99804b43087f4d897f7522500..c3dbc8c7df8fb6b8ae6873a60be13a4ac059543e 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * jQuery 1.2.3 - New Wave Javascript
+ * jQuery 1.2.6 - New Wave Javascript
  *
  * Copyright (c) 2008 John Resig (jquery.com)
  * Dual licensed under the MIT (MIT-LICENSE.txt)
  * and GPL (GPL-LICENSE.txt) licenses.
  *
- * $Date: 2008-02-06 00:21:25 -0500 (Wed, 06 Feb 2008) $
- * $Rev: 4663 $
+ * $Date: 2008-05-27 12:17:26 -0700 (Tue, 27 May 2008) $
+ * $Rev: 5700 $
  */
-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}('(J(){7(1e.3N)L w=1e.3N;L E=1e.3N=J(a,b){K 1B E.2l.4T(a,b)};7(1e.$)L D=1e.$;1e.$=E;L u=/^[^<]*(<(.|\\s)+>)[^>]*$|^#(\\w+)$/;L G=/^.[^:#\\[\\.]*$/;E.1n=E.2l={4T:J(d,b){d=d||T;7(d.15){6[0]=d;6.M=1;K 6}N 7(1o d=="25"){L c=u.2O(d);7(c&&(c[1]||!b)){7(c[1])d=E.4a([c[1]],b);N{L a=T.5J(c[3]);7(a)7(a.2w!=c[3])K E().2s(d);N{6[0]=a;6.M=1;K 6}N d=[]}}N K 1B E(b).2s(d)}N 7(E.1q(d))K 1B E(T)[E.1n.21?"21":"3U"](d);K 6.6E(d.1k==1M&&d||(d.5h||d.M&&d!=1e&&!d.15&&d[0]!=10&&d[0].15)&&E.2I(d)||[d])},5h:"1.2.3",87:J(){K 6.M},M:0,22:J(a){K a==10?E.2I(6):6[a]},2F:J(b){L a=E(b);a.54=6;K a},6E:J(a){6.M=0;1M.2l.1g.1i(6,a);K 6},R:J(a,b){K E.R(6,a,b)},4X:J(b){L a=-1;6.R(J(i){7(6==b)a=i});K a},1J:J(c,a,b){L d=c;7(c.1k==4e)7(a==10)K 6.M&&E[b||"1J"](6[0],c)||10;N{d={};d[c]=a}K 6.R(J(i){Q(c 1p d)E.1J(b?6.W:6,c,E.1l(6,d[c],b,i,c))})},1j:J(b,a){7((b==\'27\'||b==\'1R\')&&2M(a)<0)a=10;K 6.1J(b,a,"2o")},1u:J(b){7(1o b!="3V"&&b!=V)K 6.4x().3t((6[0]&&6[0].2i||T).5r(b));L a="";E.R(b||6,J(){E.R(6.3p,J(){7(6.15!=8)a+=6.15!=1?6.6K:E.1n.1u([6])})});K a},5m:J(b){7(6[0])E(b,6[0].2i).5k().3o(6[0]).2c(J(){L a=6;2b(a.1C)a=a.1C;K a}).3t(6);K 6},8w:J(a){K 6.R(J(){E(6).6z().5m(a)})},8p:J(a){K 6.R(J(){E(6).5m(a)})},3t:J(){K 6.3O(18,P,S,J(a){7(6.15==1)6.38(a)})},6q:J(){K 6.3O(18,P,P,J(a){7(6.15==1)6.3o(a,6.1C)})},6o:J(){K 6.3O(18,S,S,J(a){6.1a.3o(a,6)})},5a:J(){K 6.3O(18,S,P,J(a){6.1a.3o(a,6.2B)})},3h:J(){K 6.54||E([])},2s:J(b){L c=E.2c(6,J(a){K E.2s(b,a)});K 6.2F(/[^+>] [^+>]/.17(b)||b.1f("..")>-1?E.57(c):c)},5k:J(e){L f=6.2c(J(){7(E.14.1d&&!E.3E(6)){L a=6.69(P),4Y=T.3s("1x");4Y.38(a);K E.4a([4Y.3d])[0]}N K 6.69(P)});L d=f.2s("*").4R().R(J(){7(6[F]!=10)6[F]=V});7(e===P)6.2s("*").4R().R(J(i){7(6.15==3)K;L c=E.O(6,"2R");Q(L a 1p c)Q(L b 1p c[a])E.16.1b(d[i],a,c[a][b],c[a][b].O)});K f},1E:J(b){K 6.2F(E.1q(b)&&E.3y(6,J(a,i){K b.1P(a,i)})||E.3e(b,6))},56:J(b){7(b.1k==4e)7(G.17(b))K 6.2F(E.3e(b,6,P));N b=E.3e(b,6);L a=b.M&&b[b.M-1]!==10&&!b.15;K 6.1E(J(){K a?E.33(6,b)<0:6!=b})},1b:J(a){K!a?6:6.2F(E.37(6.22(),a.1k==4e?E(a).22():a.M!=10&&(!a.12||E.12(a,"3u"))?a:[a]))},3H:J(a){K a?E.3e(a,6).M>0:S},7j:J(a){K 6.3H("."+a)},5O:J(b){7(b==10){7(6.M){L c=6[0];7(E.12(c,"2k")){L e=c.3T,5I=[],11=c.11,2X=c.U=="2k-2X";7(e<0)K V;Q(L i=2X?e:0,2f=2X?e+1:11.M;i<2f;i++){L d=11[i];7(d.2p){b=E.14.1d&&!d.9J.1A.9y?d.1u:d.1A;7(2X)K b;5I.1g(b)}}K 5I}N K(6[0].1A||"").1r(/\\r/g,"")}K 10}K 6.R(J(){7(6.15!=1)K;7(b.1k==1M&&/5u|5t/.17(6.U))6.3k=(E.33(6.1A,b)>=0||E.33(6.31,b)>=0);N 7(E.12(6,"2k")){L a=b.1k==1M?b:[b];E("98",6).R(J(){6.2p=(E.33(6.1A,a)>=0||E.33(6.1u,a)>=0)});7(!a.M)6.3T=-1}N 6.1A=b})},3q:J(a){K a==10?(6.M?6[0].3d:V):6.4x().3t(a)},6S:J(a){K 6.5a(a).1V()},6Z:J(i){K 6.2K(i,i+1)},2K:J(){K 6.2F(1M.2l.2K.1i(6,18))},2c:J(b){K 6.2F(E.2c(6,J(a,i){K b.1P(a,i,a)}))},4R:J(){K 6.1b(6.54)},O:J(d,b){L a=d.23(".");a[1]=a[1]?"."+a[1]:"";7(b==V){L c=6.5n("8P"+a[1]+"!",[a[0]]);7(c==10&&6.M)c=E.O(6[0],d);K c==V&&a[1]?6.O(a[0]):c}N K 6.1N("8K"+a[1]+"!",[a[0],b]).R(J(){E.O(6,d,b)})},35:J(a){K 6.R(J(){E.35(6,a)})},3O:J(g,f,h,d){L e=6.M>1,3n;K 6.R(J(){7(!3n){3n=E.4a(g,6.2i);7(h)3n.8D()}L b=6;7(f&&E.12(6,"1O")&&E.12(3n[0],"4v"))b=6.3S("1U")[0]||6.38(6.2i.3s("1U"));L c=E([]);E.R(3n,J(){L a=e?E(6).5k(P)[0]:6;7(E.12(a,"1m")){c=c.1b(a)}N{7(a.15==1)c=c.1b(E("1m",a).1V());d.1P(b,a)}});c.R(6A)})}};E.2l.4T.2l=E.2l;J 6A(i,a){7(a.3Q)E.3P({1c:a.3Q,3l:S,1H:"1m"});N E.5g(a.1u||a.6x||a.3d||"");7(a.1a)a.1a.34(a)}E.1s=E.1n.1s=J(){L b=18[0]||{},i=1,M=18.M,5c=S,11;7(b.1k==8d){5c=b;b=18[1]||{};i=2}7(1o b!="3V"&&1o b!="J")b={};7(M==1){b=6;i=0}Q(;i<M;i++)7((11=18[i])!=V)Q(L a 1p 11){7(b===11[a])6w;7(5c&&11[a]&&1o 11[a]=="3V"&&b[a]&&!11[a].15)b[a]=E.1s(b[a],11[a]);N 7(11[a]!=10)b[a]=11[a]}K b};L F="3N"+(1B 3v()).3L(),6t=0,5b={};L H=/z-?4X|86-?84|1w|6k|7Z-?1R/i;E.1s({7Y:J(a){1e.$=D;7(a)1e.3N=w;K E},1q:J(a){K!!a&&1o a!="25"&&!a.12&&a.1k!=1M&&/J/i.17(a+"")},3E:J(a){K a.1F&&!a.1h||a.28&&a.2i&&!a.2i.1h},5g:J(a){a=E.3g(a);7(a){L b=T.3S("6f")[0]||T.1F,1m=T.3s("1m");1m.U="1u/4m";7(E.14.1d)1m.1u=a;N 1m.38(T.5r(a));b.38(1m);b.34(1m)}},12:J(b,a){K b.12&&b.12.2E()==a.2E()},1T:{},O:J(c,d,b){c=c==1e?5b:c;L a=c[F];7(!a)a=c[F]=++6t;7(d&&!E.1T[a])E.1T[a]={};7(b!=10)E.1T[a][d]=b;K d?E.1T[a][d]:a},35:J(c,b){c=c==1e?5b:c;L a=c[F];7(b){7(E.1T[a]){2V E.1T[a][b];b="";Q(b 1p E.1T[a])1Q;7(!b)E.35(c)}}N{1S{2V c[F]}1X(e){7(c.52)c.52(F)}2V E.1T[a]}},R:J(c,a,b){7(b){7(c.M==10){Q(L d 1p c)7(a.1i(c[d],b)===S)1Q}N Q(L i=0,M=c.M;i<M;i++)7(a.1i(c[i],b)===S)1Q}N{7(c.M==10){Q(L d 1p c)7(a.1P(c[d],d,c[d])===S)1Q}N Q(L i=0,M=c.M,1A=c[0];i<M&&a.1P(1A,i,1A)!==S;1A=c[++i]){}}K c},1l:J(b,a,c,i,d){7(E.1q(a))a=a.1P(b,i);K a&&a.1k==51&&c=="2o"&&!H.17(d)?a+"2S":a},1t:{1b:J(c,b){E.R((b||"").23(/\\s+/),J(i,a){7(c.15==1&&!E.1t.3Y(c.1t,a))c.1t+=(c.1t?" ":"")+a})},1V:J(c,b){7(c.15==1)c.1t=b!=10?E.3y(c.1t.23(/\\s+/),J(a){K!E.1t.3Y(b,a)}).6a(" "):""},3Y:J(b,a){K E.33(a,(b.1t||b).3X().23(/\\s+/))>-1}},68:J(b,c,a){L e={};Q(L d 1p c){e[d]=b.W[d];b.W[d]=c[d]}a.1P(b);Q(L d 1p c)b.W[d]=e[d]},1j:J(d,e,c){7(e=="27"||e=="1R"){L b,46={43:"4W",4U:"1Z",19:"3D"},3c=e=="27"?["7O","7M"]:["7J","7I"];J 5E(){b=e=="27"?d.7H:d.7F;L a=0,2N=0;E.R(3c,J(){a+=2M(E.2o(d,"7E"+6,P))||0;2N+=2M(E.2o(d,"2N"+6+"5X",P))||0});b-=24.7C(a+2N)}7(E(d).3H(":4d"))5E();N E.68(d,46,5E);K 24.2f(0,b)}K E.2o(d,e,c)},2o:J(e,k,j){L d;J 3x(b){7(!E.14.2d)K S;L a=T.4c.4K(b,V);K!a||a.4M("3x")==""}7(k=="1w"&&E.14.1d){d=E.1J(e.W,"1w");K d==""?"1":d}7(E.14.2z&&k=="19"){L c=e.W.50;e.W.50="0 7r 7o";e.W.50=c}7(k.1D(/4g/i))k=y;7(!j&&e.W&&e.W[k])d=e.W[k];N 7(T.4c&&T.4c.4K){7(k.1D(/4g/i))k="4g";k=k.1r(/([A-Z])/g,"-$1").2h();L h=T.4c.4K(e,V);7(h&&!3x(e))d=h.4M(k);N{L f=[],2C=[];Q(L a=e;a&&3x(a);a=a.1a)2C.4J(a);Q(L i=0;i<2C.M;i++)7(3x(2C[i])){f[i]=2C[i].W.19;2C[i].W.19="3D"}d=k=="19"&&f[2C.M-1]!=V?"2H":(h&&h.4M(k))||"";Q(L i=0;i<f.M;i++)7(f[i]!=V)2C[i].W.19=f[i]}7(k=="1w"&&d=="")d="1"}N 7(e.4n){L g=k.1r(/\\-(\\w)/g,J(a,b){K b.2E()});d=e.4n[k]||e.4n[g];7(!/^\\d+(2S)?$/i.17(d)&&/^\\d/.17(d)){L l=e.W.26,3K=e.3K.26;e.3K.26=e.4n.26;e.W.26=d||0;d=e.W.7f+"2S";e.W.26=l;e.3K.26=3K}}K d},4a:J(l,h){L k=[];h=h||T;7(1o h.3s==\'10\')h=h.2i||h[0]&&h[0].2i||T;E.R(l,J(i,d){7(!d)K;7(d.1k==51)d=d.3X();7(1o d=="25"){d=d.1r(/(<(\\w+)[^>]*?)\\/>/g,J(b,a,c){K c.1D(/^(aa|a6|7e|a5|4D|7a|a0|3m|9W|9U|9S)$/i)?b:a+"></"+c+">"});L f=E.3g(d).2h(),1x=h.3s("1x");L e=!f.1f("<9P")&&[1,"<2k 74=\'74\'>","</2k>"]||!f.1f("<9M")&&[1,"<73>","</73>"]||f.1D(/^<(9G|1U|9E|9B|9x)/)&&[1,"<1O>","</1O>"]||!f.1f("<4v")&&[2,"<1O><1U>","</1U></1O>"]||(!f.1f("<9w")||!f.1f("<9v"))&&[3,"<1O><1U><4v>","</4v></1U></1O>"]||!f.1f("<7e")&&[2,"<1O><1U></1U><6V>","</6V></1O>"]||E.14.1d&&[1,"1x<1x>","</1x>"]||[0,"",""];1x.3d=e[1]+d+e[2];2b(e[0]--)1x=1x.5o;7(E.14.1d){L g=!f.1f("<1O")&&f.1f("<1U")<0?1x.1C&&1x.1C.3p:e[1]=="<1O>"&&f.1f("<1U")<0?1x.3p:[];Q(L j=g.M-1;j>=0;--j)7(E.12(g[j],"1U")&&!g[j].3p.M)g[j].1a.34(g[j]);7(/^\\s/.17(d))1x.3o(h.5r(d.1D(/^\\s*/)[0]),1x.1C)}d=E.2I(1x.3p)}7(d.M===0&&(!E.12(d,"3u")&&!E.12(d,"2k")))K;7(d[0]==10||E.12(d,"3u")||d.11)k.1g(d);N k=E.37(k,d)});K k},1J:J(d,e,c){7(!d||d.15==3||d.15==8)K 10;L f=E.3E(d)?{}:E.46;7(e=="2p"&&E.14.2d)d.1a.3T;7(f[e]){7(c!=10)d[f[e]]=c;K d[f[e]]}N 7(E.14.1d&&e=="W")K E.1J(d.W,"9u",c);N 7(c==10&&E.14.1d&&E.12(d,"3u")&&(e=="9r"||e=="9o"))K d.9m(e).6K;N 7(d.28){7(c!=10){7(e=="U"&&E.12(d,"4D")&&d.1a)6Q"U 9i 9h\'t 9g 9e";d.9b(e,""+c)}7(E.14.1d&&/6O|3Q/.17(e)&&!E.3E(d))K d.4z(e,2);K d.4z(e)}N{7(e=="1w"&&E.14.1d){7(c!=10){d.6k=1;d.1E=(d.1E||"").1r(/6M\\([^)]*\\)/,"")+(2M(c).3X()=="96"?"":"6M(1w="+c*6L+")")}K d.1E&&d.1E.1f("1w=")>=0?(2M(d.1E.1D(/1w=([^)]*)/)[1])/6L).3X():""}e=e.1r(/-([a-z])/95,J(a,b){K b.2E()});7(c!=10)d[e]=c;K d[e]}},3g:J(a){K(a||"").1r(/^\\s+|\\s+$/g,"")},2I:J(b){L a=[];7(1o b!="93")Q(L i=0,M=b.M;i<M;i++)a.1g(b[i]);N a=b.2K(0);K a},33:J(b,a){Q(L i=0,M=a.M;i<M;i++)7(a[i]==b)K i;K-1},37:J(a,b){7(E.14.1d){Q(L i=0;b[i];i++)7(b[i].15!=8)a.1g(b[i])}N Q(L i=0;b[i];i++)a.1g(b[i]);K a},57:J(a){L c=[],2r={};1S{Q(L i=0,M=a.M;i<M;i++){L b=E.O(a[i]);7(!2r[b]){2r[b]=P;c.1g(a[i])}}}1X(e){c=a}K c},3y:J(c,a,d){L b=[];Q(L i=0,M=c.M;i<M;i++)7(!d&&a(c[i],i)||d&&!a(c[i],i))b.1g(c[i]);K b},2c:J(d,a){L c=[];Q(L i=0,M=d.M;i<M;i++){L b=a(d[i],i);7(b!==V&&b!=10){7(b.1k!=1M)b=[b];c=c.71(b)}}K c}});L v=8Y.8W.2h();E.14={5K:(v.1D(/.+(?:8T|8S|8R|8O)[\\/: ]([\\d.]+)/)||[])[1],2d:/77/.17(v),2z:/2z/.17(v),1d:/1d/.17(v)&&!/2z/.17(v),48:/48/.17(v)&&!/(8L|77)/.17(v)};L y=E.14.1d?"6H":"75";E.1s({8I:!E.14.1d||T.6F=="79",46:{"Q":"8F","8E":"1t","4g":y,75:y,6H:y,3d:"3d",1t:"1t",1A:"1A",2Y:"2Y",3k:"3k",8C:"8B",2p:"2p",8A:"8z",3T:"3T",6C:"6C",28:"28",12:"12"}});E.R({6B:J(a){K a.1a},8y:J(a){K E.4u(a,"1a")},8x:J(a){K E.2Z(a,2,"2B")},8v:J(a){K E.2Z(a,2,"4t")},8u:J(a){K E.4u(a,"2B")},8t:J(a){K E.4u(a,"4t")},8s:J(a){K E.5i(a.1a.1C,a)},8r:J(a){K E.5i(a.1C)},6z:J(a){K E.12(a,"8q")?a.8o||a.8n.T:E.2I(a.3p)}},J(c,d){E.1n[c]=J(b){L a=E.2c(6,d);7(b&&1o b=="25")a=E.3e(b,a);K 6.2F(E.57(a))}});E.R({6y:"3t",8m:"6q",3o:"6o",8l:"5a",8k:"6S"},J(c,b){E.1n[c]=J(){L a=18;K 6.R(J(){Q(L i=0,M=a.M;i<M;i++)E(a[i])[b](6)})}});E.R({8j:J(a){E.1J(6,a,"");7(6.15==1)6.52(a)},8i:J(a){E.1t.1b(6,a)},8h:J(a){E.1t.1V(6,a)},8g:J(a){E.1t[E.1t.3Y(6,a)?"1V":"1b"](6,a)},1V:J(a){7(!a||E.1E(a,[6]).r.M){E("*",6).1b(6).R(J(){E.16.1V(6);E.35(6)});7(6.1a)6.1a.34(6)}},4x:J(){E(">*",6).1V();2b(6.1C)6.34(6.1C)}},J(a,b){E.1n[a]=J(){K 6.R(b,18)}});E.R(["8f","5X"],J(i,c){L b=c.2h();E.1n[b]=J(a){K 6[0]==1e?E.14.2z&&T.1h["5e"+c]||E.14.2d&&1e["8e"+c]||T.6F=="79"&&T.1F["5e"+c]||T.1h["5e"+c]:6[0]==T?24.2f(24.2f(T.1h["5d"+c],T.1F["5d"+c]),24.2f(T.1h["5L"+c],T.1F["5L"+c])):a==10?(6.M?E.1j(6[0],b):V):6.1j(b,a.1k==4e?a:a+"2S")}});L C=E.14.2d&&4s(E.14.5K)<8c?"(?:[\\\\w*4r-]|\\\\\\\\.)":"(?:[\\\\w\\8b-\\8a*4r-]|\\\\\\\\.)",6v=1B 4q("^>\\\\s*("+C+"+)"),6u=1B 4q("^("+C+"+)(#)("+C+"+)"),6s=1B 4q("^([#.]?)("+C+"*)");E.1s({6r:{"":J(a,i,m){K m[2]=="*"||E.12(a,m[2])},"#":J(a,i,m){K a.4z("2w")==m[2]},":":{89:J(a,i,m){K i<m[3]-0},88:J(a,i,m){K i>m[3]-0},2Z:J(a,i,m){K m[3]-0==i},6Z:J(a,i,m){K m[3]-0==i},3j:J(a,i){K i==0},3J:J(a,i,m,r){K i==r.M-1},6n:J(a,i){K i%2==0},6l:J(a,i){K i%2},"3j-4p":J(a){K a.1a.3S("*")[0]==a},"3J-4p":J(a){K E.2Z(a.1a.5o,1,"4t")==a},"83-4p":J(a){K!E.2Z(a.1a.5o,2,"4t")},6B:J(a){K a.1C},4x:J(a){K!a.1C},82:J(a,i,m){K(a.6x||a.81||E(a).1u()||"").1f(m[3])>=0},4d:J(a){K"1Z"!=a.U&&E.1j(a,"19")!="2H"&&E.1j(a,"4U")!="1Z"},1Z:J(a){K"1Z"==a.U||E.1j(a,"19")=="2H"||E.1j(a,"4U")=="1Z"},80:J(a){K!a.2Y},2Y:J(a){K a.2Y},3k:J(a){K a.3k},2p:J(a){K a.2p||E.1J(a,"2p")},1u:J(a){K"1u"==a.U},5u:J(a){K"5u"==a.U},5t:J(a){K"5t"==a.U},59:J(a){K"59"==a.U},3I:J(a){K"3I"==a.U},58:J(a){K"58"==a.U},6j:J(a){K"6j"==a.U},6i:J(a){K"6i"==a.U},2G:J(a){K"2G"==a.U||E.12(a,"2G")},4D:J(a){K/4D|2k|6h|2G/i.17(a.12)},3Y:J(a,i,m){K E.2s(m[3],a).M},7X:J(a){K/h\\d/i.17(a.12)},7W:J(a){K E.3y(E.3G,J(b){K a==b.Y}).M}}},6g:[/^(\\[) *@?([\\w-]+) *([!*$^~=]*) *(\'?"?)(.*?)\\4 *\\]/,/^(:)([\\w-]+)\\("?\'?(.*?(\\(.*?\\))?[^(]*?)"?\'?\\)/,1B 4q("^([:.#]*)("+C+"+)")],3e:J(a,c,b){L d,2m=[];2b(a&&a!=d){d=a;L f=E.1E(a,c,b);a=f.t.1r(/^\\s*,\\s*/,"");2m=b?c=f.r:E.37(2m,f.r)}K 2m},2s:J(t,p){7(1o t!="25")K[t];7(p&&p.15!=1&&p.15!=9)K[];p=p||T;L d=[p],2r=[],3J,12;2b(t&&3J!=t){L r=[];3J=t;t=E.3g(t);L o=S;L g=6v;L m=g.2O(t);7(m){12=m[1].2E();Q(L i=0;d[i];i++)Q(L c=d[i].1C;c;c=c.2B)7(c.15==1&&(12=="*"||c.12.2E()==12))r.1g(c);d=r;t=t.1r(g,"");7(t.1f(" ")==0)6w;o=P}N{g=/^([>+~])\\s*(\\w*)/i;7((m=g.2O(t))!=V){r=[];L l={};12=m[2].2E();m=m[1];Q(L j=0,3f=d.M;j<3f;j++){L n=m=="~"||m=="+"?d[j].2B:d[j].1C;Q(;n;n=n.2B)7(n.15==1){L h=E.O(n);7(m=="~"&&l[h])1Q;7(!12||n.12.2E()==12){7(m=="~")l[h]=P;r.1g(n)}7(m=="+")1Q}}d=r;t=E.3g(t.1r(g,""));o=P}}7(t&&!o){7(!t.1f(",")){7(p==d[0])d.4l();2r=E.37(2r,d);r=d=[p];t=" "+t.6e(1,t.M)}N{L k=6u;L m=k.2O(t);7(m){m=[0,m[2],m[3],m[1]]}N{k=6s;m=k.2O(t)}m[2]=m[2].1r(/\\\\/g,"");L f=d[d.M-1];7(m[1]=="#"&&f&&f.5J&&!E.3E(f)){L q=f.5J(m[2]);7((E.14.1d||E.14.2z)&&q&&1o q.2w=="25"&&q.2w!=m[2])q=E(\'[@2w="\'+m[2]+\'"]\',f)[0];d=r=q&&(!m[3]||E.12(q,m[3]))?[q]:[]}N{Q(L i=0;d[i];i++){L a=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];7(a=="*"&&d[i].12.2h()=="3V")a="3m";r=E.37(r,d[i].3S(a))}7(m[1]==".")r=E.55(r,m[2]);7(m[1]=="#"){L e=[];Q(L i=0;r[i];i++)7(r[i].4z("2w")==m[2]){e=[r[i]];1Q}r=e}d=r}t=t.1r(k,"")}}7(t){L b=E.1E(t,r);d=r=b.r;t=E.3g(b.t)}}7(t)d=[];7(d&&p==d[0])d.4l();2r=E.37(2r,d);K 2r},55:J(r,m,a){m=" "+m+" ";L c=[];Q(L i=0;r[i];i++){L b=(" "+r[i].1t+" ").1f(m)>=0;7(!a&&b||a&&!b)c.1g(r[i])}K c},1E:J(t,r,h){L d;2b(t&&t!=d){d=t;L p=E.6g,m;Q(L i=0;p[i];i++){m=p[i].2O(t);7(m){t=t.7V(m[0].M);m[2]=m[2].1r(/\\\\/g,"");1Q}}7(!m)1Q;7(m[1]==":"&&m[2]=="56")r=G.17(m[3])?E.1E(m[3],r,P).r:E(r).56(m[3]);N 7(m[1]==".")r=E.55(r,m[2],h);N 7(m[1]=="["){L g=[],U=m[3];Q(L i=0,3f=r.M;i<3f;i++){L a=r[i],z=a[E.46[m[2]]||m[2]];7(z==V||/6O|3Q|2p/.17(m[2]))z=E.1J(a,m[2])||\'\';7((U==""&&!!z||U=="="&&z==m[5]||U=="!="&&z!=m[5]||U=="^="&&z&&!z.1f(m[5])||U=="$="&&z.6e(z.M-m[5].M)==m[5]||(U=="*="||U=="~=")&&z.1f(m[5])>=0)^h)g.1g(a)}r=g}N 7(m[1]==":"&&m[2]=="2Z-4p"){L e={},g=[],17=/(-?)(\\d*)n((?:\\+|-)?\\d*)/.2O(m[3]=="6n"&&"2n"||m[3]=="6l"&&"2n+1"||!/\\D/.17(m[3])&&"7U+"+m[3]||m[3]),3j=(17[1]+(17[2]||1))-0,d=17[3]-0;Q(L i=0,3f=r.M;i<3f;i++){L j=r[i],1a=j.1a,2w=E.O(1a);7(!e[2w]){L c=1;Q(L n=1a.1C;n;n=n.2B)7(n.15==1)n.4k=c++;e[2w]=P}L b=S;7(3j==0){7(j.4k==d)b=P}N 7((j.4k-d)%3j==0&&(j.4k-d)/3j>=0)b=P;7(b^h)g.1g(j)}r=g}N{L f=E.6r[m[1]];7(1o f=="3V")f=f[m[2]];7(1o f=="25")f=6c("S||J(a,i){K "+f+";}");r=E.3y(r,J(a,i){K f(a,i,m,r)},h)}}K{r:r,t:t}},4u:J(b,c){L d=[];L a=b[c];2b(a&&a!=T){7(a.15==1)d.1g(a);a=a[c]}K d},2Z:J(a,e,c,b){e=e||1;L d=0;Q(;a;a=a[c])7(a.15==1&&++d==e)1Q;K a},5i:J(n,a){L r=[];Q(;n;n=n.2B){7(n.15==1&&(!a||n!=a))r.1g(n)}K r}});E.16={1b:J(f,i,g,e){7(f.15==3||f.15==8)K;7(E.14.1d&&f.53!=10)f=1e;7(!g.2D)g.2D=6.2D++;7(e!=10){L h=g;g=J(){K h.1i(6,18)};g.O=e;g.2D=h.2D}L j=E.O(f,"2R")||E.O(f,"2R",{}),1v=E.O(f,"1v")||E.O(f,"1v",J(){L a;7(1o E=="10"||E.16.5f)K a;a=E.16.1v.1i(18.3R.Y,18);K a});1v.Y=f;E.R(i.23(/\\s+/),J(c,b){L a=b.23(".");b=a[0];g.U=a[1];L d=j[b];7(!d){d=j[b]={};7(!E.16.2y[b]||E.16.2y[b].4j.1P(f)===S){7(f.3F)f.3F(b,1v,S);N 7(f.6b)f.6b("4i"+b,1v)}}d[g.2D]=g;E.16.2a[b]=P});f=V},2D:1,2a:{},1V:J(e,h,f){7(e.15==3||e.15==8)K;L i=E.O(e,"2R"),29,4X;7(i){7(h==10||(1o h=="25"&&h.7T(0)=="."))Q(L g 1p i)6.1V(e,g+(h||""));N{7(h.U){f=h.2q;h=h.U}E.R(h.23(/\\s+/),J(b,a){L c=a.23(".");a=c[0];7(i[a]){7(f)2V i[a][f.2D];N Q(f 1p i[a])7(!c[1]||i[a][f].U==c[1])2V i[a][f];Q(29 1p i[a])1Q;7(!29){7(!E.16.2y[a]||E.16.2y[a].4h.1P(e)===S){7(e.67)e.67(a,E.O(e,"1v"),S);N 7(e.66)e.66("4i"+a,E.O(e,"1v"))}29=V;2V i[a]}}})}Q(29 1p i)1Q;7(!29){L d=E.O(e,"1v");7(d)d.Y=V;E.35(e,"2R");E.35(e,"1v")}}},1N:J(g,c,d,f,h){c=E.2I(c||[]);7(g.1f("!")>=0){g=g.2K(0,-1);L a=P}7(!d){7(6.2a[g])E("*").1b([1e,T]).1N(g,c)}N{7(d.15==3||d.15==8)K 10;L b,29,1n=E.1q(d[g]||V),16=!c[0]||!c[0].36;7(16)c.4J(6.4Z({U:g,2L:d}));c[0].U=g;7(a)c[0].65=P;7(E.1q(E.O(d,"1v")))b=E.O(d,"1v").1i(d,c);7(!1n&&d["4i"+g]&&d["4i"+g].1i(d,c)===S)b=S;7(16)c.4l();7(h&&E.1q(h)){29=h.1i(d,b==V?c:c.71(b));7(29!==10)b=29}7(1n&&f!==S&&b!==S&&!(E.12(d,\'a\')&&g=="4V")){6.5f=P;1S{d[g]()}1X(e){}}6.5f=S}K b},1v:J(c){L a;c=E.16.4Z(c||1e.16||{});L b=c.U.23(".");c.U=b[0];L f=E.O(6,"2R")&&E.O(6,"2R")[c.U],42=1M.2l.2K.1P(18,1);42.4J(c);Q(L j 1p f){L d=f[j];42[0].2q=d;42[0].O=d.O;7(!b[1]&&!c.65||d.U==b[1]){L e=d.1i(6,42);7(a!==S)a=e;7(e===S){c.36();c.44()}}}7(E.14.1d)c.2L=c.36=c.44=c.2q=c.O=V;K a},4Z:J(c){L a=c;c=E.1s({},a);c.36=J(){7(a.36)a.36();a.7S=S};c.44=J(){7(a.44)a.44();a.7R=P};7(!c.2L)c.2L=c.7Q||T;7(c.2L.15==3)c.2L=a.2L.1a;7(!c.4S&&c.5w)c.4S=c.5w==c.2L?c.7P:c.5w;7(c.64==V&&c.63!=V){L b=T.1F,1h=T.1h;c.64=c.63+(b&&b.2v||1h&&1h.2v||0)-(b.62||0);c.7N=c.7L+(b&&b.2x||1h&&1h.2x||0)-(b.60||0)}7(!c.3c&&((c.4f||c.4f===0)?c.4f:c.5Z))c.3c=c.4f||c.5Z;7(!c.7b&&c.5Y)c.7b=c.5Y;7(!c.3c&&c.2G)c.3c=(c.2G&1?1:(c.2G&2?3:(c.2G&4?2:0)));K c},2y:{21:{4j:J(){5M();K},4h:J(){K}},3C:{4j:J(){7(E.14.1d)K S;E(6).2j("4P",E.16.2y.3C.2q);K P},4h:J(){7(E.14.1d)K S;E(6).3w("4P",E.16.2y.3C.2q);K P},2q:J(a){7(I(a,6))K P;18[0].U="3C";K E.16.1v.1i(6,18)}},3B:{4j:J(){7(E.14.1d)K S;E(6).2j("4O",E.16.2y.3B.2q);K P},4h:J(){7(E.14.1d)K S;E(6).3w("4O",E.16.2y.3B.2q);K P},2q:J(a){7(I(a,6))K P;18[0].U="3B";K E.16.1v.1i(6,18)}}}};E.1n.1s({2j:J(c,a,b){K c=="4H"?6.2X(c,a,b):6.R(J(){E.16.1b(6,c,b||a,b&&a)})},2X:J(d,b,c){K 6.R(J(){E.16.1b(6,d,J(a){E(6).3w(a);K(c||b).1i(6,18)},c&&b)})},3w:J(a,b){K 6.R(J(){E.16.1V(6,a,b)})},1N:J(c,a,b){K 6.R(J(){E.16.1N(c,a,6,P,b)})},5n:J(c,a,b){7(6[0])K E.16.1N(c,a,6[0],S,b);K 10},2g:J(){L b=18;K 6.4V(J(a){6.4N=0==6.4N?1:0;a.36();K b[6.4N].1i(6,18)||S})},7D:J(a,b){K 6.2j(\'3C\',a).2j(\'3B\',b)},21:J(a){5M();7(E.2Q)a.1P(T,E);N E.3A.1g(J(){K a.1P(6,E)});K 6}});E.1s({2Q:S,3A:[],21:J(){7(!E.2Q){E.2Q=P;7(E.3A){E.R(E.3A,J(){6.1i(T)});E.3A=V}E(T).5n("21")}}});L x=S;J 5M(){7(x)K;x=P;7(T.3F&&!E.14.2z)T.3F("5W",E.21,S);7(E.14.1d&&1e==3b)(J(){7(E.2Q)K;1S{T.1F.7B("26")}1X(3a){3z(18.3R,0);K}E.21()})();7(E.14.2z)T.3F("5W",J(){7(E.2Q)K;Q(L i=0;i<T.4L.M;i++)7(T.4L[i].2Y){3z(18.3R,0);K}E.21()},S);7(E.14.2d){L a;(J(){7(E.2Q)K;7(T.39!="5V"&&T.39!="1y"){3z(18.3R,0);K}7(a===10)a=E("W, 7a[7A=7z]").M;7(T.4L.M!=a){3z(18.3R,0);K}E.21()})()}E.16.1b(1e,"3U",E.21)}E.R(("7y,7x,3U,7w,5d,4H,4V,7v,"+"7G,7u,7t,4P,4O,7s,2k,"+"58,7K,7q,7p,3a").23(","),J(i,b){E.1n[b]=J(a){K a?6.2j(b,a):6.1N(b)}});L I=J(a,c){L b=a.4S;2b(b&&b!=c)1S{b=b.1a}1X(3a){b=c}K b==c};E(1e).2j("4H",J(){E("*").1b(T).3w()});E.1n.1s({3U:J(g,d,c){7(E.1q(g))K 6.2j("3U",g);L e=g.1f(" ");7(e>=0){L i=g.2K(e,g.M);g=g.2K(0,e)}c=c||J(){};L f="4Q";7(d)7(E.1q(d)){c=d;d=V}N{d=E.3m(d);f="61"}L h=6;E.3P({1c:g,U:f,1H:"3q",O:d,1y:J(a,b){7(b=="1W"||b=="5U")h.3q(i?E("<1x/>").3t(a.4b.1r(/<1m(.|\\s)*?\\/1m>/g,"")).2s(i):a.4b);h.R(c,[a.4b,b,a])}});K 6},7n:J(){K E.3m(6.5T())},5T:J(){K 6.2c(J(){K E.12(6,"3u")?E.2I(6.7m):6}).1E(J(){K 6.31&&!6.2Y&&(6.3k||/2k|6h/i.17(6.12)||/1u|1Z|3I/i.17(6.U))}).2c(J(i,c){L b=E(6).5O();K b==V?V:b.1k==1M?E.2c(b,J(a,i){K{31:c.31,1A:a}}):{31:c.31,1A:b}}).22()}});E.R("5S,6d,5R,6D,5Q,6m".23(","),J(i,o){E.1n[o]=J(f){K 6.2j(o,f)}});L B=(1B 3v).3L();E.1s({22:J(d,b,a,c){7(E.1q(b)){a=b;b=V}K E.3P({U:"4Q",1c:d,O:b,1W:a,1H:c})},7l:J(b,a){K E.22(b,V,a,"1m")},7k:J(c,b,a){K E.22(c,b,a,"3i")},7i:J(d,b,a,c){7(E.1q(b)){a=b;b={}}K E.3P({U:"61",1c:d,O:b,1W:a,1H:c})},85:J(a){E.1s(E.4I,a)},4I:{2a:P,U:"4Q",2U:0,5P:"4o/x-7h-3u-7g",5N:P,3l:P,O:V,6p:V,3I:V,49:{3M:"4o/3M, 1u/3M",3q:"1u/3q",1m:"1u/4m, 4o/4m",3i:"4o/3i, 1u/4m",1u:"1u/a7",4G:"*/*"}},4F:{},3P:J(s){L f,2W=/=\\?(&|$)/g,1z,O;s=E.1s(P,s,E.1s(P,{},E.4I,s));7(s.O&&s.5N&&1o s.O!="25")s.O=E.3m(s.O);7(s.1H=="4E"){7(s.U.2h()=="22"){7(!s.1c.1D(2W))s.1c+=(s.1c.1D(/\\?/)?"&":"?")+(s.4E||"7d")+"=?"}N 7(!s.O||!s.O.1D(2W))s.O=(s.O?s.O+"&":"")+(s.4E||"7d")+"=?";s.1H="3i"}7(s.1H=="3i"&&(s.O&&s.O.1D(2W)||s.1c.1D(2W))){f="4E"+B++;7(s.O)s.O=(s.O+"").1r(2W,"="+f+"$1");s.1c=s.1c.1r(2W,"="+f+"$1");s.1H="1m";1e[f]=J(a){O=a;1W();1y();1e[f]=10;1S{2V 1e[f]}1X(e){}7(h)h.34(g)}}7(s.1H=="1m"&&s.1T==V)s.1T=S;7(s.1T===S&&s.U.2h()=="22"){L i=(1B 3v()).3L();L j=s.1c.1r(/(\\?|&)4r=.*?(&|$)/,"$a4="+i+"$2");s.1c=j+((j==s.1c)?(s.1c.1D(/\\?/)?"&":"?")+"4r="+i:"")}7(s.O&&s.U.2h()=="22"){s.1c+=(s.1c.1D(/\\?/)?"&":"?")+s.O;s.O=V}7(s.2a&&!E.5H++)E.16.1N("5S");7((!s.1c.1f("a3")||!s.1c.1f("//"))&&s.1H=="1m"&&s.U.2h()=="22"){L h=T.3S("6f")[0];L g=T.3s("1m");g.3Q=s.1c;7(s.7c)g.a2=s.7c;7(!f){L l=S;g.9Z=g.9Y=J(){7(!l&&(!6.39||6.39=="5V"||6.39=="1y")){l=P;1W();1y();h.34(g)}}}h.38(g);K 10}L m=S;L k=1e.78?1B 78("9X.9V"):1B 76();k.9T(s.U,s.1c,s.3l,s.6p,s.3I);1S{7(s.O)k.4C("9R-9Q",s.5P);7(s.5C)k.4C("9O-5A-9N",E.4F[s.1c]||"9L, 9K 9I 9H 5z:5z:5z 9F");k.4C("X-9C-9A","76");k.4C("9z",s.1H&&s.49[s.1H]?s.49[s.1H]+", */*":s.49.4G)}1X(e){}7(s.6Y)s.6Y(k);7(s.2a)E.16.1N("6m",[k,s]);L c=J(a){7(!m&&k&&(k.39==4||a=="2U")){m=P;7(d){6I(d);d=V}1z=a=="2U"&&"2U"||!E.6X(k)&&"3a"||s.5C&&E.6J(k,s.1c)&&"5U"||"1W";7(1z=="1W"){1S{O=E.6W(k,s.1H)}1X(e){1z="5x"}}7(1z=="1W"){L b;1S{b=k.5q("6U-5A")}1X(e){}7(s.5C&&b)E.4F[s.1c]=b;7(!f)1W()}N E.5v(s,k,1z);1y();7(s.3l)k=V}};7(s.3l){L d=53(c,13);7(s.2U>0)3z(J(){7(k){k.9t();7(!m)c("2U")}},s.2U)}1S{k.9s(s.O)}1X(e){E.5v(s,k,V,e)}7(!s.3l)c();J 1W(){7(s.1W)s.1W(O,1z);7(s.2a)E.16.1N("5Q",[k,s])}J 1y(){7(s.1y)s.1y(k,1z);7(s.2a)E.16.1N("5R",[k,s]);7(s.2a&&!--E.5H)E.16.1N("6d")}K k},5v:J(s,a,b,e){7(s.3a)s.3a(a,b,e);7(s.2a)E.16.1N("6D",[a,s,e])},5H:0,6X:J(r){1S{K!r.1z&&9q.9p=="59:"||(r.1z>=6T&&r.1z<9n)||r.1z==6R||r.1z==9l||E.14.2d&&r.1z==10}1X(e){}K S},6J:J(a,c){1S{L b=a.5q("6U-5A");K a.1z==6R||b==E.4F[c]||E.14.2d&&a.1z==10}1X(e){}K S},6W:J(r,b){L c=r.5q("9k-U");L d=b=="3M"||!b&&c&&c.1f("3M")>=0;L a=d?r.9j:r.4b;7(d&&a.1F.28=="5x")6Q"5x";7(b=="1m")E.5g(a);7(b=="3i")a=6c("("+a+")");K a},3m:J(a){L s=[];7(a.1k==1M||a.5h)E.R(a,J(){s.1g(3r(6.31)+"="+3r(6.1A))});N Q(L j 1p a)7(a[j]&&a[j].1k==1M)E.R(a[j],J(){s.1g(3r(j)+"="+3r(6))});N s.1g(3r(j)+"="+3r(a[j]));K s.6a("&").1r(/%20/g,"+")}});E.1n.1s({1G:J(c,b){K c?6.2e({1R:"1G",27:"1G",1w:"1G"},c,b):6.1E(":1Z").R(J(){6.W.19=6.5s||"";7(E.1j(6,"19")=="2H"){L a=E("<"+6.28+" />").6y("1h");6.W.19=a.1j("19");7(6.W.19=="2H")6.W.19="3D";a.1V()}}).3h()},1I:J(b,a){K b?6.2e({1R:"1I",27:"1I",1w:"1I"},b,a):6.1E(":4d").R(J(){6.5s=6.5s||E.1j(6,"19");6.W.19="2H"}).3h()},6N:E.1n.2g,2g:J(a,b){K E.1q(a)&&E.1q(b)?6.6N(a,b):a?6.2e({1R:"2g",27:"2g",1w:"2g"},a,b):6.R(J(){E(6)[E(6).3H(":1Z")?"1G":"1I"]()})},9f:J(b,a){K 6.2e({1R:"1G"},b,a)},9d:J(b,a){K 6.2e({1R:"1I"},b,a)},9c:J(b,a){K 6.2e({1R:"2g"},b,a)},9a:J(b,a){K 6.2e({1w:"1G"},b,a)},99:J(b,a){K 6.2e({1w:"1I"},b,a)},97:J(c,a,b){K 6.2e({1w:a},c,b)},2e:J(l,k,j,h){L i=E.6P(k,j,h);K 6[i.2P===S?"R":"2P"](J(){7(6.15!=1)K S;L g=E.1s({},i);L f=E(6).3H(":1Z"),4A=6;Q(L p 1p l){7(l[p]=="1I"&&f||l[p]=="1G"&&!f)K E.1q(g.1y)&&g.1y.1i(6);7(p=="1R"||p=="27"){g.19=E.1j(6,"19");g.32=6.W.32}}7(g.32!=V)6.W.32="1Z";g.40=E.1s({},l);E.R(l,J(c,a){L e=1B E.2t(4A,g,c);7(/2g|1G|1I/.17(a))e[a=="2g"?f?"1G":"1I":a](l);N{L b=a.3X().1D(/^([+-]=)?([\\d+-.]+)(.*)$/),1Y=e.2m(P)||0;7(b){L d=2M(b[2]),2A=b[3]||"2S";7(2A!="2S"){4A.W[c]=(d||1)+2A;1Y=((d||1)/e.2m(P))*1Y;4A.W[c]=1Y+2A}7(b[1])d=((b[1]=="-="?-1:1)*d)+1Y;e.45(1Y,d,2A)}N e.45(1Y,a,"")}});K P})},2P:J(a,b){7(E.1q(a)||(a&&a.1k==1M)){b=a;a="2t"}7(!a||(1o a=="25"&&!b))K A(6[0],a);K 6.R(J(){7(b.1k==1M)A(6,a,b);N{A(6,a).1g(b);7(A(6,a).M==1)b.1i(6)}})},94:J(b,c){L a=E.3G;7(b)6.2P([]);6.R(J(){Q(L i=a.M-1;i>=0;i--)7(a[i].Y==6){7(c)a[i](P);a.72(i,1)}});7(!c)6.5p();K 6}});L A=J(b,c,a){7(!b)K 10;c=c||"2t";L q=E.O(b,c+"2P");7(!q||a)q=E.O(b,c+"2P",a?E.2I(a):[]);K q};E.1n.5p=J(a){a=a||"2t";K 6.R(J(){L q=A(6,a);q.4l();7(q.M)q[0].1i(6)})};E.1s({6P:J(b,a,c){L d=b&&b.1k==92?b:{1y:c||!c&&a||E.1q(b)&&b,2u:b,3Z:c&&a||a&&a.1k!=91&&a};d.2u=(d.2u&&d.2u.1k==51?d.2u:{90:8Z,9D:6T}[d.2u])||8X;d.5y=d.1y;d.1y=J(){7(d.2P!==S)E(6).5p();7(E.1q(d.5y))d.5y.1i(6)};K d},3Z:{70:J(p,n,b,a){K b+a*p},5j:J(p,n,b,a){K((-24.8V(p*24.8U)/2)+0.5)*a+b}},3G:[],3W:V,2t:J(b,c,a){6.11=c;6.Y=b;6.1l=a;7(!c.47)c.47={}}});E.2t.2l={4y:J(){7(6.11.30)6.11.30.1i(6.Y,[6.2J,6]);(E.2t.30[6.1l]||E.2t.30.4G)(6);7(6.1l=="1R"||6.1l=="27")6.Y.W.19="3D"},2m:J(a){7(6.Y[6.1l]!=V&&6.Y.W[6.1l]==V)K 6.Y[6.1l];L r=2M(E.1j(6.Y,6.1l,a));K r&&r>-8Q?r:2M(E.2o(6.Y,6.1l))||0},45:J(c,b,d){6.5B=(1B 3v()).3L();6.1Y=c;6.3h=b;6.2A=d||6.2A||"2S";6.2J=6.1Y;6.4B=6.4w=0;6.4y();L e=6;J t(a){K e.30(a)}t.Y=6.Y;E.3G.1g(t);7(E.3W==V){E.3W=53(J(){L a=E.3G;Q(L i=0;i<a.M;i++)7(!a[i]())a.72(i--,1);7(!a.M){6I(E.3W);E.3W=V}},13)}},1G:J(){6.11.47[6.1l]=E.1J(6.Y.W,6.1l);6.11.1G=P;6.45(0,6.2m());7(6.1l=="27"||6.1l=="1R")6.Y.W[6.1l]="8N";E(6.Y).1G()},1I:J(){6.11.47[6.1l]=E.1J(6.Y.W,6.1l);6.11.1I=P;6.45(6.2m(),0)},30:J(a){L t=(1B 3v()).3L();7(a||t>6.11.2u+6.5B){6.2J=6.3h;6.4B=6.4w=1;6.4y();6.11.40[6.1l]=P;L b=P;Q(L i 1p 6.11.40)7(6.11.40[i]!==P)b=S;7(b){7(6.11.19!=V){6.Y.W.32=6.11.32;6.Y.W.19=6.11.19;7(E.1j(6.Y,"19")=="2H")6.Y.W.19="3D"}7(6.11.1I)6.Y.W.19="2H";7(6.11.1I||6.11.1G)Q(L p 1p 6.11.40)E.1J(6.Y.W,p,6.11.47[p])}7(b&&E.1q(6.11.1y))6.11.1y.1i(6.Y);K S}N{L n=t-6.5B;6.4w=n/6.11.2u;6.4B=E.3Z[6.11.3Z||(E.3Z.5j?"5j":"70")](6.4w,n,0,1,6.11.2u);6.2J=6.1Y+((6.3h-6.1Y)*6.4B);6.4y()}K P}};E.2t.30={2v:J(a){a.Y.2v=a.2J},2x:J(a){a.Y.2x=a.2J},1w:J(a){E.1J(a.Y.W,"1w",a.2J)},4G:J(a){a.Y.W[a.1l]=a.2J+a.2A}};E.1n.5L=J(){L b=0,3b=0,Y=6[0],5l;7(Y)8M(E.14){L d=Y.1a,41=Y,1K=Y.1K,1L=Y.2i,5D=2d&&4s(5K)<8J&&!/a1/i.17(v),2T=E.1j(Y,"43")=="2T";7(Y.6G){L c=Y.6G();1b(c.26+24.2f(1L.1F.2v,1L.1h.2v),c.3b+24.2f(1L.1F.2x,1L.1h.2x));1b(-1L.1F.62,-1L.1F.60)}N{1b(Y.5G,Y.5F);2b(1K){1b(1K.5G,1K.5F);7(48&&!/^t(8H|d|h)$/i.17(1K.28)||2d&&!5D)2N(1K);7(!2T&&E.1j(1K,"43")=="2T")2T=P;41=/^1h$/i.17(1K.28)?41:1K;1K=1K.1K}2b(d&&d.28&&!/^1h|3q$/i.17(d.28)){7(!/^8G|1O.*$/i.17(E.1j(d,"19")))1b(-d.2v,-d.2x);7(48&&E.1j(d,"32")!="4d")2N(d);d=d.1a}7((5D&&(2T||E.1j(41,"43")=="4W"))||(48&&E.1j(41,"43")!="4W"))1b(-1L.1h.5G,-1L.1h.5F);7(2T)1b(24.2f(1L.1F.2v,1L.1h.2v),24.2f(1L.1F.2x,1L.1h.2x))}5l={3b:3b,26:b}}J 2N(a){1b(E.2o(a,"a8",P),E.2o(a,"a9",P))}J 1b(l,t){b+=4s(l)||0;3b+=4s(t)||0}K 5l}})();',62,631,'||||||this|if||||||||||||||||||||||||||||||||||||||function|return|var|length|else|data|true|for|each|false|document|type|null|style||elem||undefined|options|nodeName||browser|nodeType|event|test|arguments|display|parentNode|add|url|msie|window|indexOf|push|body|apply|css|constructor|prop|script|fn|typeof|in|isFunction|replace|extend|className|text|handle|opacity|div|complete|status|value|new|firstChild|match|filter|documentElement|show|dataType|hide|attr|offsetParent|doc|Array|trigger|table|call|break|height|try|cache|tbody|remove|success|catch|start|hidden||ready|get|split|Math|string|left|width|tagName|ret|global|while|map|safari|animate|max|toggle|toLowerCase|ownerDocument|bind|select|prototype|cur||curCSS|selected|handler|done|find|fx|duration|scrollLeft|id|scrollTop|special|opera|unit|nextSibling|stack|guid|toUpperCase|pushStack|button|none|makeArray|now|slice|target|parseFloat|border|exec|queue|isReady|events|px|fixed|timeout|delete|jsre|one|disabled|nth|step|name|overflow|inArray|removeChild|removeData|preventDefault|merge|appendChild|readyState|error|top|which|innerHTML|multiFilter|rl|trim|end|json|first|checked|async|param|elems|insertBefore|childNodes|html|encodeURIComponent|createElement|append|form|Date|unbind|color|grep|setTimeout|readyList|mouseleave|mouseenter|block|isXMLDoc|addEventListener|timers|is|password|last|runtimeStyle|getTime|xml|jQuery|domManip|ajax|src|callee|getElementsByTagName|selectedIndex|load|object|timerId|toString|has|easing|curAnim|offsetChild|args|position|stopPropagation|custom|props|orig|mozilla|accepts|clean|responseText|defaultView|visible|String|charCode|float|teardown|on|setup|nodeIndex|shift|javascript|currentStyle|application|child|RegExp|_|parseInt|previousSibling|dir|tr|state|empty|update|getAttribute|self|pos|setRequestHeader|input|jsonp|lastModified|_default|unload|ajaxSettings|unshift|getComputedStyle|styleSheets|getPropertyValue|lastToggle|mouseout|mouseover|GET|andSelf|relatedTarget|init|visibility|click|absolute|index|container|fix|outline|Number|removeAttribute|setInterval|prevObject|classFilter|not|unique|submit|file|after|windowData|deep|scroll|client|triggered|globalEval|jquery|sibling|swing|clone|results|wrapAll|triggerHandler|lastChild|dequeue|getResponseHeader|createTextNode|oldblock|checkbox|radio|handleError|fromElement|parsererror|old|00|Modified|startTime|ifModified|safari2|getWH|offsetTop|offsetLeft|active|values|getElementById|version|offset|bindReady|processData|val|contentType|ajaxSuccess|ajaxComplete|ajaxStart|serializeArray|notmodified|loaded|DOMContentLoaded|Width|ctrlKey|keyCode|clientTop|POST|clientLeft|clientX|pageX|exclusive|detachEvent|removeEventListener|swap|cloneNode|join|attachEvent|eval|ajaxStop|substr|head|parse|textarea|reset|image|zoom|odd|ajaxSend|even|before|username|prepend|expr|quickClass|uuid|quickID|quickChild|continue|textContent|appendTo|contents|evalScript|parent|defaultValue|ajaxError|setArray|compatMode|getBoundingClientRect|styleFloat|clearInterval|httpNotModified|nodeValue|100|alpha|_toggle|href|speed|throw|304|replaceWith|200|Last|colgroup|httpData|httpSuccess|beforeSend|eq|linear|concat|splice|fieldset|multiple|cssFloat|XMLHttpRequest|webkit|ActiveXObject|CSS1Compat|link|metaKey|scriptCharset|callback|col|pixelLeft|urlencoded|www|post|hasClass|getJSON|getScript|elements|serialize|black|keyup|keypress|solid|change|mousemove|mouseup|dblclick|resize|focus|blur|stylesheet|rel|doScroll|round|hover|padding|offsetHeight|mousedown|offsetWidth|Bottom|Top|keydown|clientY|Right|pageY|Left|toElement|srcElement|cancelBubble|returnValue|charAt|0n|substring|animated|header|noConflict|line|enabled|innerText|contains|only|weight|ajaxSetup|font|size|gt|lt|uFFFF|u0128|417|Boolean|inner|Height|toggleClass|removeClass|addClass|removeAttr|replaceAll|insertAfter|prependTo|contentWindow|contentDocument|wrap|iframe|children|siblings|prevAll|nextAll|prev|wrapInner|next|parents|maxLength|maxlength|readOnly|readonly|reverse|class|htmlFor|inline|able|boxModel|522|setData|compatible|with|1px|ie|getData|10000|ra|it|rv|PI|cos|userAgent|400|navigator|600|slow|Function|Object|array|stop|ig|NaN|fadeTo|option|fadeOut|fadeIn|setAttribute|slideToggle|slideUp|changed|slideDown|be|can|property|responseXML|content|1223|getAttributeNode|300|method|protocol|location|action|send|abort|cssText|th|td|cap|specified|Accept|With|colg|Requested|fast|tfoot|GMT|thead|1970|Jan|attributes|01|Thu|leg|Since|If|opt|Type|Content|embed|open|area|XMLHTTP|hr|Microsoft|onreadystatechange|onload|meta|adobeair|charset|http|1_|img|br|plain|borderLeftWidth|borderTopWidth|abbr'.split('|'),0,{}));jQuery.noConflict();
\ No newline at end of file
+eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(H(){J w=1c.4I,3n$=1c.$;J D=1c.4I=1c.$=H(a,b){I 2r D.18.5i(a,b)};J u=/^[^<]*(<(.|\\s)+>)[^>]*$|^#(\\w+)$/,61=/^.[^:#\\[\\.]*$/,12;D.18=D.3V={5i:H(d,b){d=d||S;G(d.15){7[0]=d;7.K=1;I 7}G(1j d=="1W"){J c=u.2D(d);G(c&&(c[1]||!b)){G(c[1])d=D.4h([c[1]],b);N{J a=S.60(c[3]);G(a){G(a.2t!=c[3])I D().2u(d);I D(a)}d=[]}}N I D(b).2u(d)}N G(D.1F(d))I D(S)[D.18.25?"25":"3Y"](d);I 7.6V(D.2h(d))},5w:"1.2.6",8H:H(){I 7.K},K:0,3p:H(a){I a==12?D.2h(7):7[a]},2F:H(b){J a=D(b);a.5n=7;I a},6V:H(a){7.K=0;2q.3V.1A.1t(7,a);I 7},P:H(a,b){I D.P(7,a,b)},5h:H(b){J a=-1;I D.2E(b&&b.5w?b[0]:b,7)},1M:H(c,a,b){J d=c;G(c.1q==56)G(a===12)I 7[0]&&D[b||"1M"](7[0],c);N{d={};d[c]=a}I 7.P(H(i){R(c 1k d)D.1M(b?7.V:7,c,D.1e(7,d[c],b,i,c))})},1h:H(b,a){G((b==\'2d\'||b==\'1T\')&&3e(a)<0)a=12;I 7.1M(b,a,"24")},1r:H(b){G(1j b!="3y"&&b!=U)I 7.4F().3s((7[0]&&7[0].2z||S).5J(b));J a="";D.P(b||7,H(){D.P(7.3u,H(){G(7.15!=8)a+=7.15!=1?7.73:D.18.1r([7])})});I a},5W:H(b){G(7[0])D(b,7[0].2z).5y().38(7[0]).2i(H(){J a=7;1G(a.1s)a=a.1s;I a}).3s(7);I 7},8Z:H(a){I 7.P(H(){D(7).6P().5W(a)})},8S:H(a){I 7.P(H(){D(7).5W(a)})},3s:H(){I 7.3S(1a,M,Q,H(a){G(7.15==1)7.49(a)})},6E:H(){I 7.3S(1a,M,M,H(a){G(7.15==1)7.38(a,7.1s)})},6D:H(){I 7.3S(1a,Q,Q,H(a){7.1f.38(a,7)})},5p:H(){I 7.3S(1a,Q,M,H(a){7.1f.38(a,7.2J)})},3m:H(){I 7.5n||D([])},2u:H(b){J c=D.2i(7,H(a){I D.2u(b,a)});I 7.2F(/[^+>] [^+>]/.11(b)||b.1i("..")>-1?D.4u(c):c)},5y:H(e){J f=7.2i(H(){G(D.14.1g&&!D.4o(7)){J a=7.6n(M),5f=S.3t("1w");5f.49(a);I D.4h([5f.4l])[0]}N I 7.6n(M)});J d=f.2u("*").5M().P(H(){G(7[E]!=12)7[E]=U});G(e===M)7.2u("*").5M().P(H(i){G(7.15==3)I;J c=D.L(7,"3x");R(J a 1k c)R(J b 1k c[a])D.W.17(d[i],a,c[a][b],c[a][b].L)});I f},1E:H(b){I 7.2F(D.1F(b)&&D.3G(7,H(a,i){I b.1l(a,i)})||D.3f(b,7))},4W:H(b){G(b.1q==56)G(61.11(b))I 7.2F(D.3f(b,7,M));N b=D.3f(b,7);J a=b.K&&b[b.K-1]!==12&&!b.15;I 7.1E(H(){I a?D.2E(7,b)<0:7!=b})},17:H(a){I 7.2F(D.4u(D.39(7.3p(),1j a==\'1W\'?D(a):D.2h(a))))},3C:H(a){I!!a&&D.3f(a,7).K>0},7V:H(a){I 7.3C("."+a)},6a:H(b){G(b==12){G(7.K){J c=7[0];G(D.Y(c,"2y")){J e=c.63,62=[],16=c.16,2Y=c.O=="2y-2Y";G(e<0)I U;R(J i=2Y?e:0,2e=2Y?e+1:16.K;i<2e;i++){J d=16[i];G(d.3a){b=D.14.1g&&!d.au.2s.aq?d.1r:d.2s;G(2Y)I b;62.1A(b)}}I 62}N I(7[0].2s||"").1o(/\\r/g,"")}I 12}G(b.1q==4N)b+=\'\';I 7.P(H(){G(7.15!=1)I;G(b.1q==2q&&/5R|5A/.11(7.O))7.4M=(D.2E(7.2s,b)>=0||D.2E(7.32,b)>=0);N G(D.Y(7,"2y")){J a=D.2h(b);D("9U",7).P(H(){7.3a=(D.2E(7.2s,a)>=0||D.2E(7.1r,a)>=0)});G(!a.K)7.63=-1}N 7.2s=b})},2I:H(a){I a==12?(7[0]?7[0].4l:U):7.4F().3s(a)},7b:H(a){I 7.5p(a).1Z()},77:H(i){I 7.3w(i,i+1)},3w:H(){I 7.2F(2q.3V.3w.1t(7,1a))},2i:H(b){I 7.2F(D.2i(7,H(a,i){I b.1l(a,i,a)}))},5M:H(){I 7.17(7.5n)},L:H(d,b){J a=d.1Q(".");a[1]=a[1]?"."+a[1]:"";G(b===12){J c=7.5G("9B"+a[1]+"!",[a[0]]);G(c===12&&7.K)c=D.L(7[0],d);I c===12&&a[1]?7.L(a[0]):c}N I 7.1R("9v"+a[1]+"!",[a[0],b]).P(H(){D.L(7,d,b)})},3b:H(a){I 7.P(H(){D.3b(7,a)})},3S:H(g,f,h,d){J e=7.K>1,3z;I 7.P(H(){G(!3z){3z=D.4h(g,7.2z);G(h)3z.9o()}J b=7;G(f&&D.Y(7,"1X")&&D.Y(3z[0],"4H"))b=7.40("22")[0]||7.49(7.2z.3t("22"));J c=D([]);D.P(3z,H(){J a=e?D(7).5y(M)[0]:7;G(D.Y(a,"1m"))c=c.17(a);N{G(a.15==1)c=c.17(D("1m",a).1Z());d.1l(b,a)}});c.P(6R)})}};D.18.5i.3V=D.18;H 6R(i,a){G(a.4e)D.3T({1b:a.4e,31:Q,1L:"1m"});N D.5u(a.1r||a.6N||a.4l||"");G(a.1f)a.1f.30(a)}H 1x(){I+2r 8K}D.1n=D.18.1n=H(){J b=1a[0]||{},i=1,K=1a.K,4B=Q,16;G(b.1q==8I){4B=b;b=1a[1]||{};i=2}G(1j b!="3y"&&1j b!="H")b={};G(K==i){b=7;--i}R(;i<K;i++)G((16=1a[i])!=U)R(J c 1k 16){J a=b[c],2x=16[c];G(b===2x)6L;G(4B&&2x&&1j 2x=="3y"&&!2x.15)b[c]=D.1n(4B,a||(2x.K!=U?[]:{}),2x);N G(2x!==12)b[c]=2x}I b};J E="4I"+1x(),6K=0,5q={},6G=/z-?5h|8B-?8A|1y|6A|8w-?1T/i,3N=S.3N||{};D.1n({8u:H(a){1c.$=3n$;G(a)1c.4I=w;I D},1F:H(a){I!!a&&1j a!="1W"&&!a.Y&&a.1q!=2q&&/^[\\s[]?H/.11(a+"")},4o:H(a){I a.1B&&!a.1d||a.2g&&a.2z&&!a.2z.1d},5u:H(a){a=D.3l(a);G(a){J b=S.40("6v")[0]||S.1B,1m=S.3t("1m");1m.O="1r/4v";G(D.14.1g)1m.1r=a;N 1m.49(S.5J(a));b.38(1m,b.1s);b.30(1m)}},Y:H(b,a){I b.Y&&b.Y.2m()==a.2m()},1Y:{},L:H(c,d,b){c=c==1c?5q:c;J a=c[E];G(!a)a=c[E]=++6K;G(d&&!D.1Y[a])D.1Y[a]={};G(b!==12)D.1Y[a][d]=b;I d?D.1Y[a][d]:a},3b:H(c,b){c=c==1c?5q:c;J a=c[E];G(b){G(D.1Y[a]){3d D.1Y[a][b];b="";R(b 1k D.1Y[a])1V;G(!b)D.3b(c)}}N{23{3d c[E]}21(e){G(c.5k)c.5k(E)}3d D.1Y[a]}},P:H(d,a,c){J e,i=0,K=d.K;G(c){G(K==12){R(e 1k d)G(a.1t(d[e],c)===Q)1V}N R(;i<K;)G(a.1t(d[i++],c)===Q)1V}N{G(K==12){R(e 1k d)G(a.1l(d[e],e,d[e])===Q)1V}N R(J b=d[0];i<K&&a.1l(b,i,b)!==Q;b=d[++i]){}}I d},1e:H(b,a,c,i,d){G(D.1F(a))a=a.1l(b,i);I a&&a.1q==4N&&c=="24"&&!6G.11(d)?a+"2U":a},1D:{17:H(c,b){D.P((b||"").1Q(/\\s+/),H(i,a){G(c.15==1&&!D.1D.3Q(c.1D,a))c.1D+=(c.1D?" ":"")+a})},1Z:H(c,b){G(c.15==1)c.1D=b!=12?D.3G(c.1D.1Q(/\\s+/),H(a){I!D.1D.3Q(b,a)}).6r(" "):""},3Q:H(b,a){I D.2E(a,(b.1D||b).6p().1Q(/\\s+/))>-1}},6o:H(b,c,a){J e={};R(J d 1k c){e[d]=b.V[d];b.V[d]=c[d]}a.1l(b);R(J d 1k c)b.V[d]=e[d]},1h:H(d,e,c){G(e=="2d"||e=="1T"){J b,2L={3c:"5g",5D:"1C",19:"3H"},2S=e=="2d"?["5d","6i"]:["5b","6g"];H 5a(){b=e=="2d"?d.8g:d.8f;J a=0,2A=0;D.P(2S,H(){a+=3e(D.24(d,"55"+7,M))||0;2A+=3e(D.24(d,"2A"+7+"47",M))||0});b-=26.85(a+2A)}G(D(d).3C(":4i"))5a();N D.6o(d,2L,5a);I 26.2e(0,b)}I D.24(d,e,c)},24:H(f,l,k){J e,V=f.V;H 4d(b){G(!D.14.2f)I Q;J a=3N.53(b,U);I!a||a.52("4d")==""}G(l=="1y"&&D.14.1g){e=D.1M(V,"1y");I e==""?"1":e}G(D.14.2H&&l=="19"){J d=V.50;V.50="0 7Z 7Y";V.50=d}G(l.1I(/4g/i))l=y;G(!k&&V&&V[l])e=V[l];N G(3N.53){G(l.1I(/4g/i))l="4g";l=l.1o(/([A-Z])/g,"-$1").3h();J c=3N.53(f,U);G(c&&!4d(f))e=c.52(l);N{J g=[],2G=[],a=f,i=0;R(;a&&4d(a);a=a.1f)2G.6b(a);R(;i<2G.K;i++)G(4d(2G[i])){g[i]=2G[i].V.19;2G[i].V.19="3H"}e=l=="19"&&g[2G.K-1]!=U?"2P":(c&&c.52(l))||"";R(i=0;i<g.K;i++)G(g[i]!=U)2G[i].V.19=g[i]}G(l=="1y"&&e=="")e="1"}N G(f.4f){J h=l.1o(/\\-(\\w)/g,H(a,b){I b.2m()});e=f.4f[l]||f.4f[h];G(!/^\\d+(2U)?$/i.11(e)&&/^\\d/.11(e)){J j=V.1z,65=f.64.1z;f.64.1z=f.4f.1z;V.1z=e||0;e=V.aO+"2U";V.1z=j;f.64.1z=65}}I e},4h:H(l,h){J k=[];h=h||S;G(1j h.3t==\'12\')h=h.2z||h[0]&&h[0].2z||S;D.P(l,H(i,d){G(!d)I;G(d.1q==4N)d+=\'\';G(1j d=="1W"){d=d.1o(/(<(\\w+)[^>]*?)\\/>/g,H(b,a,c){I c.1I(/^(aN|43|7E|aH|4t|7z|aE|3A|aB|aA|az)$/i)?b:a+"></"+c+">"});J f=D.3l(d).3h(),1w=h.3t("1w");J e=!f.1i("<av")&&[1,"<2y 7u=\'7u\'>","</2y>"]||!f.1i("<at")&&[1,"<7t>","</7t>"]||f.1I(/^<(ar|22|ap|al|aj)/)&&[1,"<1X>","</1X>"]||!f.1i("<4H")&&[2,"<1X><22>","</22></1X>"]||(!f.1i("<ah")||!f.1i("<ae"))&&[3,"<1X><22><4H>","</4H></22></1X>"]||!f.1i("<7E")&&[2,"<1X><22></22><7p>","</7p></1X>"]||D.14.1g&&[1,"1w<1w>","</1w>"]||[0,"",""];1w.4l=e[1]+d+e[2];1G(e[0]--)1w=1w.5U;G(D.14.1g){J g=!f.1i("<1X")&&f.1i("<22")<0?1w.1s&&1w.1s.3u:e[1]=="<1X>"&&f.1i("<22")<0?1w.3u:[];R(J j=g.K-1;j>=0;--j)G(D.Y(g[j],"22")&&!g[j].3u.K)g[j].1f.30(g[j]);G(/^\\s/.11(d))1w.38(h.5J(d.1I(/^\\s*/)[0]),1w.1s)}d=D.2h(1w.3u)}G(d.K===0&&(!D.Y(d,"45")&&!D.Y(d,"2y")))I;G(d[0]==12||D.Y(d,"45")||d.16)k.1A(d);N k=D.39(k,d)});I k},1M:H(d,f,c){G(!d||d.15==3||d.15==8)I 12;J e=!D.4o(d),3W=c!==12,1g=D.14.1g;f=e&&D.2L[f]||f;G(d.2g){J g=/5x|4e|V/.11(f);G(f=="3a"&&D.14.2f)d.1f.63;G(f 1k d&&e&&!g){G(3W){G(f=="O"&&D.Y(d,"4t")&&d.1f)7m"O a5 a2\'t 9Z 9W";d[f]=c}G(D.Y(d,"45")&&d.7i(f))I d.7i(f).73;I d[f]}G(1g&&e&&f=="V")I D.1M(d.V,"9V",c);G(3W)d.9T(f,""+c);J h=1g&&e&&g?d.4K(f,2):d.4K(f);I h===U?12:h}G(1g&&f=="1y"){G(3W){d.6A=1;d.1E=(d.1E||"").1o(/7d\\([^)]*\\)/,"")+(3v(c)+\'\'=="9P"?"":"7d(1y="+c*79+")")}I d.1E&&d.1E.1i("1y=")>=0?(3e(d.1E.1I(/1y=([^)]*)/)[1])/79)+\'\':""}f=f.1o(/-([a-z])/9M,H(a,b){I b.2m()});G(3W)d[f]=c;I d[f]},3l:H(a){I(a||"").1o(/^\\s+|\\s+$/g,"")},2h:H(b){J a=[];G(b!=U){J i=b.K;G(i==U||b.1Q||b.4L||b.1l)a[0]=b;N 1G(i)a[--i]=b[i]}I a},2E:H(b,a){R(J i=0,K=a.K;i<K;i++)G(a[i]===b)I i;I-1},39:H(a,b){J i=0,T,36=a.K;G(D.14.1g){1G(T=b[i++])G(T.15!=8)a[36++]=T}N 1G(T=b[i++])a[36++]=T;I a},4u:H(a){J c=[],2w={};23{R(J i=0,K=a.K;i<K;i++){J b=D.L(a[i]);G(!2w[b]){2w[b]=M;c.1A(a[i])}}}21(e){c=a}I c},3G:H(c,a,d){J b=[];R(J i=0,K=c.K;i<K;i++)G(!d!=!a(c[i],i))b.1A(c[i]);I b},2i:H(d,a){J c=[];R(J i=0,K=d.K;i<K;i++){J b=a(d[i],i);G(b!=U)c[c.K]=b}I c.75.1t([],c)}});J v=9E.9C.3h();D.14={5F:(v.1I(/.+(?:9A|9z|9y|9w)[\\/: ]([\\d.]+)/)||[])[1],2f:/72/.11(v),2H:/2H/.11(v),1g:/1g/.11(v)&&!/2H/.11(v),3r:/3r/.11(v)&&!/(9s|72)/.11(v)};J y=D.14.1g?"70":"6Z";D.1n({6Y:!D.14.1g||S.6X=="6W",2L:{"R":"9n","9m":"1D","4g":y,6Z:y,70:y,9j:"9h",9g:"9e",9d:"9b",9a:"99"}});D.P({6S:H(a){I a.1f},96:H(a){I D.4T(a,"1f")},93:H(a){I D.2V(a,2,"2J")},90:H(a){I D.2V(a,2,"4D")},8Y:H(a){I D.4T(a,"2J")},8X:H(a){I D.4T(a,"4D")},8W:H(a){I D.5v(a.1f.1s,a)},8V:H(a){I D.5v(a.1s)},6P:H(a){I D.Y(a,"8U")?a.8T||a.8R.S:D.2h(a.3u)}},H(c,d){D.18[c]=H(b){J a=D.2i(7,d);G(b&&1j b=="1W")a=D.3f(b,a);I 7.2F(D.4u(a))}});D.P({6O:"3s",8Q:"6E",38:"6D",8P:"5p",8O:"7b"},H(c,b){D.18[c]=H(){J a=1a;I 7.P(H(){R(J i=0,K=a.K;i<K;i++)D(a[i])[b](7)})}});D.P({8N:H(a){D.1M(7,a,"");G(7.15==1)7.5k(a)},8M:H(a){D.1D.17(7,a)},8L:H(a){D.1D.1Z(7,a)},8J:H(a){D.1D[D.1D.3Q(7,a)?"1Z":"17"](7,a)},1Z:H(a){G(!a||D.1E(a,[7]).r.K){D("*",7).17(7).P(H(){D.W.1Z(7);D.3b(7)});G(7.1f)7.1f.30(7)}},4F:H(){D(">*",7).1Z();1G(7.1s)7.30(7.1s)}},H(a,b){D.18[a]=H(){I 7.P(b,1a)}});D.P(["6M","47"],H(i,c){J b=c.3h();D.18[b]=H(a){I 7[0]==1c?D.14.2H&&S.1d["5t"+c]||D.14.2f&&1c["5s"+c]||S.6X=="6W"&&S.1B["5t"+c]||S.1d["5t"+c]:7[0]==S?26.2e(26.2e(S.1d["4A"+c],S.1B["4A"+c]),26.2e(S.1d["2k"+c],S.1B["2k"+c])):a==12?(7.K?D.1h(7[0],b):U):7.1h(b,a.1q==56?a:a+"2U")}});H 2a(a,b){I a[0]&&3v(D.24(a[0],b,M),10)||0}J C=D.14.2f&&3v(D.14.5F)<8G?"(?:[\\\\w*3n-]|\\\\\\\\.)":"(?:[\\\\w\\8F-\\8E*3n-]|\\\\\\\\.)",6J=2r 4y("^>\\\\s*("+C+"+)"),6I=2r 4y("^("+C+"+)(#)("+C+"+)"),6H=2r 4y("^([#.]?)("+C+"*)");D.1n({6F:{"":H(a,i,m){I m[2]=="*"||D.Y(a,m[2])},"#":H(a,i,m){I a.4K("2t")==m[2]},":":{8D:H(a,i,m){I i<m[3]-0},8C:H(a,i,m){I i>m[3]-0},2V:H(a,i,m){I m[3]-0==i},77:H(a,i,m){I m[3]-0==i},3o:H(a,i){I i==0},3P:H(a,i,m,r){I i==r.K-1},6C:H(a,i){I i%2==0},6B:H(a,i){I i%2},"3o-4w":H(a){I a.1f.40("*")[0]==a},"3P-4w":H(a){I D.2V(a.1f.5U,1,"4D")==a},"8z-4w":H(a){I!D.2V(a.1f.5U,2,"4D")},6S:H(a){I a.1s},4F:H(a){I!a.1s},8y:H(a,i,m){I(a.6N||a.8x||D(a).1r()||"").1i(m[3])>=0},4i:H(a){I"1C"!=a.O&&D.1h(a,"19")!="2P"&&D.1h(a,"5D")!="1C"},1C:H(a){I"1C"==a.O||D.1h(a,"19")=="2P"||D.1h(a,"5D")=="1C"},8v:H(a){I!a.3O},3O:H(a){I a.3O},4M:H(a){I a.4M},3a:H(a){I a.3a||D.1M(a,"3a")},1r:H(a){I"1r"==a.O},5R:H(a){I"5R"==a.O},5A:H(a){I"5A"==a.O},5o:H(a){I"5o"==a.O},3K:H(a){I"3K"==a.O},5m:H(a){I"5m"==a.O},6z:H(a){I"6z"==a.O},6y:H(a){I"6y"==a.O},2p:H(a){I"2p"==a.O||D.Y(a,"2p")},4t:H(a){I/4t|2y|6x|2p/i.11(a.Y)},3Q:H(a,i,m){I D.2u(m[3],a).K},8t:H(a){I/h\\d/i.11(a.Y)},8s:H(a){I D.3G(D.3M,H(b){I a==b.T}).K}}},6w:[/^(\\[) *@?([\\w-]+) *([!*$^~=]*) *(\'?"?)(.*?)\\4 *\\]/,/^(:)([\\w-]+)\\("?\'?(.*?(\\(.*?\\))?[^(]*?)"?\'?\\)/,2r 4y("^([:.#]*)("+C+"+)")],3f:H(a,c,b){J d,1u=[];1G(a&&a!=d){d=a;J f=D.1E(a,c,b);a=f.t.1o(/^\\s*,\\s*/,"");1u=b?c=f.r:D.39(1u,f.r)}I 1u},2u:H(t,o){G(1j t!="1W")I[t];G(o&&o.15!=1&&o.15!=9)I[];o=o||S;J d=[o],2w=[],3P,Y;1G(t&&3P!=t){J r=[];3P=t;t=D.3l(t);J l=Q,3k=6J,m=3k.2D(t);G(m){Y=m[1].2m();R(J i=0;d[i];i++)R(J c=d[i].1s;c;c=c.2J)G(c.15==1&&(Y=="*"||c.Y.2m()==Y))r.1A(c);d=r;t=t.1o(3k,"");G(t.1i(" ")==0)6L;l=M}N{3k=/^([>+~])\\s*(\\w*)/i;G((m=3k.2D(t))!=U){r=[];J k={};Y=m[2].2m();m=m[1];R(J j=0,3j=d.K;j<3j;j++){J n=m=="~"||m=="+"?d[j].2J:d[j].1s;R(;n;n=n.2J)G(n.15==1){J g=D.L(n);G(m=="~"&&k[g])1V;G(!Y||n.Y.2m()==Y){G(m=="~")k[g]=M;r.1A(n)}G(m=="+")1V}}d=r;t=D.3l(t.1o(3k,""));l=M}}G(t&&!l){G(!t.1i(",")){G(o==d[0])d.4s();2w=D.39(2w,d);r=d=[o];t=" "+t.6t(1,t.K)}N{J h=6I;J m=h.2D(t);G(m){m=[0,m[2],m[3],m[1]]}N{h=6H;m=h.2D(t)}m[2]=m[2].1o(/\\\\/g,"");J f=d[d.K-1];G(m[1]=="#"&&f&&f.60&&!D.4o(f)){J p=f.60(m[2]);G((D.14.1g||D.14.2H)&&p&&1j p.2t=="1W"&&p.2t!=m[2])p=D(\'[@2t="\'+m[2]+\'"]\',f)[0];d=r=p&&(!m[3]||D.Y(p,m[3]))?[p]:[]}N{R(J i=0;d[i];i++){J a=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];G(a=="*"&&d[i].Y.3h()=="3y")a="3A";r=D.39(r,d[i].40(a))}G(m[1]==".")r=D.5l(r,m[2]);G(m[1]=="#"){J e=[];R(J i=0;r[i];i++)G(r[i].4K("2t")==m[2]){e=[r[i]];1V}r=e}d=r}t=t.1o(h,"")}}G(t){J b=D.1E(t,r);d=r=b.r;t=D.3l(b.t)}}G(t)d=[];G(d&&o==d[0])d.4s();2w=D.39(2w,d);I 2w},5l:H(r,m,a){m=" "+m+" ";J c=[];R(J i=0;r[i];i++){J b=(" "+r[i].1D+" ").1i(m)>=0;G(!a&&b||a&&!b)c.1A(r[i])}I c},1E:H(t,r,h){J d;1G(t&&t!=d){d=t;J p=D.6w,m;R(J i=0;p[i];i++){m=p[i].2D(t);G(m){t=t.8r(m[0].K);m[2]=m[2].1o(/\\\\/g,"");1V}}G(!m)1V;G(m[1]==":"&&m[2]=="4W")r=61.11(m[3])?D.1E(m[3],r,M).r:D(r).4W(m[3]);N G(m[1]==".")r=D.5l(r,m[2],h);N G(m[1]=="["){J g=[],O=m[3];R(J i=0,3j=r.K;i<3j;i++){J a=r[i],z=a[D.2L[m[2]]||m[2]];G(z==U||/5x|4e|3a/.11(m[2]))z=D.1M(a,m[2])||\'\';G((O==""&&!!z||O=="="&&z==m[5]||O=="!="&&z!=m[5]||O=="^="&&z&&!z.1i(m[5])||O=="$="&&z.6t(z.K-m[5].K)==m[5]||(O=="*="||O=="~=")&&z.1i(m[5])>=0)^h)g.1A(a)}r=g}N G(m[1]==":"&&m[2]=="2V-4w"){J e={},g=[],11=/(-?)(\\d*)n((?:\\+|-)?\\d*)/.2D(m[3]=="6C"&&"2n"||m[3]=="6B"&&"2n+1"||!/\\D/.11(m[3])&&"8q+"+m[3]||m[3]),3o=(11[1]+(11[2]||1))-0,d=11[3]-0;R(J i=0,3j=r.K;i<3j;i++){J j=r[i],1f=j.1f,2t=D.L(1f);G(!e[2t]){J c=1;R(J n=1f.1s;n;n=n.2J)G(n.15==1)n.4r=c++;e[2t]=M}J b=Q;G(3o==0){G(j.4r==d)b=M}N G((j.4r-d)%3o==0&&(j.4r-d)/3o>=0)b=M;G(b^h)g.1A(j)}r=g}N{J f=D.6F[m[1]];G(1j f=="3y")f=f[m[2]];G(1j f=="1W")f=6s("Q||H(a,i){I "+f+";}");r=D.3G(r,H(a,i){I f(a,i,m,r)},h)}}I{r:r,t:t}},4T:H(b,c){J a=[],1u=b[c];1G(1u&&1u!=S){G(1u.15==1)a.1A(1u);1u=1u[c]}I a},2V:H(a,e,c,b){e=e||1;J d=0;R(;a;a=a[c])G(a.15==1&&++d==e)1V;I a},5v:H(n,a){J r=[];R(;n;n=n.2J){G(n.15==1&&n!=a)r.1A(n)}I r}});D.W={17:H(f,i,g,e){G(f.15==3||f.15==8)I;G(D.14.1g&&f.4L)f=1c;G(!g.29)g.29=7.29++;G(e!=12){J h=g;g=7.3J(h,H(){I h.1t(7,1a)});g.L=e}J j=D.L(f,"3x")||D.L(f,"3x",{}),1H=D.L(f,"1H")||D.L(f,"1H",H(){G(1j D!="12"&&!D.W.5j)I D.W.1H.1t(1a.3I.T,1a)});1H.T=f;D.P(i.1Q(/\\s+/),H(c,b){J a=b.1Q(".");b=a[0];g.O=a[1];J d=j[b];G(!d){d=j[b]={};G(!D.W.2C[b]||D.W.2C[b].4q.1l(f)===Q){G(f.4a)f.4a(b,1H,Q);N G(f.6q)f.6q("4p"+b,1H)}}d[g.29]=g;D.W.28[b]=M});f=U},29:1,28:{},1Z:H(e,h,f){G(e.15==3||e.15==8)I;J i=D.L(e,"3x"),1K,5h;G(i){G(h==12||(1j h=="1W"&&h.8p(0)=="."))R(J g 1k i)7.1Z(e,g+(h||""));N{G(h.O){f=h.2o;h=h.O}D.P(h.1Q(/\\s+/),H(b,a){J c=a.1Q(".");a=c[0];G(i[a]){G(f)3d i[a][f.29];N R(f 1k i[a])G(!c[1]||i[a][f].O==c[1])3d i[a][f];R(1K 1k i[a])1V;G(!1K){G(!D.W.2C[a]||D.W.2C[a].4G.1l(e)===Q){G(e.6m)e.6m(a,D.L(e,"1H"),Q);N G(e.6l)e.6l("4p"+a,D.L(e,"1H"))}1K=U;3d i[a]}}})}R(1K 1k i)1V;G(!1K){J d=D.L(e,"1H");G(d)d.T=U;D.3b(e,"3x");D.3b(e,"1H")}}},1R:H(h,c,f,g,i){c=D.2h(c);G(h.1i("!")>=0){h=h.3w(0,-1);J a=M}G(!f){G(7.28[h])D("*").17([1c,S]).1R(h,c)}N{G(f.15==3||f.15==8)I 12;J b,1K,18=D.1F(f[h]||U),W=!c[0]||!c[0].37;G(W){c.6b({O:h,2N:f,37:H(){},3X:H(){},4J:1x()});c[0][E]=M}c[0].O=h;G(a)c[0].6k=M;J d=D.L(f,"1H");G(d)b=d.1t(f,c);G((!18||(D.Y(f,\'a\')&&h=="4n"))&&f["4p"+h]&&f["4p"+h].1t(f,c)===Q)b=Q;G(W)c.4s();G(i&&D.1F(i)){1K=i.1t(f,b==U?c:c.75(b));G(1K!==12)b=1K}G(18&&g!==Q&&b!==Q&&!(D.Y(f,\'a\')&&h=="4n")){7.5j=M;23{f[h]()}21(e){}}7.5j=Q}I b},1H:H(b){J a,1K,2T,5e,4m;b=1a[0]=D.W.6j(b||1c.W);2T=b.O.1Q(".");b.O=2T[0];2T=2T[1];5e=!2T&&!b.6k;4m=(D.L(7,"3x")||{})[b.O];R(J j 1k 4m){J c=4m[j];G(5e||c.O==2T){b.2o=c;b.L=c.L;1K=c.1t(7,1a);G(a!==Q)a=1K;G(1K===Q){b.37();b.3X()}}}I a},2L:"8o 8n 8m 8l 2p 8k 42 5c 6h 5I 8j L 8i 8h 4k 2o 59 58 8e 8c 57 6f 8b 8a 4j 88 87 86 6d 2N 4J 6c O 84 83 2S".1Q(" "),6j:H(b){G(b[E]==M)I b;J c=b;b={82:c};R(J i=7.2L.K,1e;i;){1e=7.2L[--i];b[1e]=c[1e]}b[E]=M;b.37=H(){G(c.37)c.37();c.81=Q};b.3X=H(){G(c.3X)c.3X();c.80=M};b.4J=b.4J||1x();G(!b.2N)b.2N=b.6d||S;G(b.2N.15==3)b.2N=b.2N.1f;G(!b.4j&&b.4k)b.4j=b.4k==b.2N?b.6c:b.4k;G(b.57==U&&b.5c!=U){J a=S.1B,1d=S.1d;b.57=b.5c+(a&&a.2c||1d&&1d.2c||0)-(a.69||0);b.6f=b.6h+(a&&a.2l||1d&&1d.2l||0)-(a.68||0)}G(!b.2S&&((b.42||b.42===0)?b.42:b.59))b.2S=b.42||b.59;G(!b.58&&b.5I)b.58=b.5I;G(!b.2S&&b.2p)b.2S=(b.2p&1?1:(b.2p&2?3:(b.2p&4?2:0)));I b},3J:H(a,b){b.29=a.29=a.29||b.29||7.29++;I b},2C:{25:{4q:H(){54();I},4G:H(){I}},4c:{4q:H(){G(D.14.1g)I Q;D(7).2O("51",D.W.2C.4c.2o);I M},4G:H(){G(D.14.1g)I Q;D(7).3L("51",D.W.2C.4c.2o);I M},2o:H(a){G(F(a,7))I M;a.O="4c";I D.W.1H.1t(7,1a)}},3F:{4q:H(){G(D.14.1g)I Q;D(7).2O("4Z",D.W.2C.3F.2o);I M},4G:H(){G(D.14.1g)I Q;D(7).3L("4Z",D.W.2C.3F.2o);I M},2o:H(a){G(F(a,7))I M;a.O="3F";I D.W.1H.1t(7,1a)}}}};D.18.1n({2O:H(c,a,b){I c=="4Y"?7.2Y(c,a,b):7.P(H(){D.W.17(7,c,b||a,b&&a)})},2Y:H(d,b,c){J e=D.W.3J(c||b,H(a){D(7).3L(a,e);I(c||b).1t(7,1a)});I 7.P(H(){D.W.17(7,d,e,c&&b)})},3L:H(a,b){I 7.P(H(){D.W.1Z(7,a,b)})},1R:H(c,a,b){I 7.P(H(){D.W.1R(c,a,7,M,b)})},5G:H(c,a,b){I 7[0]&&D.W.1R(c,a,7[0],Q,b)},2B:H(b){J c=1a,i=1;1G(i<c.K)D.W.3J(b,c[i++]);I 7.4n(D.W.3J(b,H(a){7.4X=(7.4X||0)%i;a.37();I c[7.4X++].1t(7,1a)||Q}))},7X:H(a,b){I 7.2O(\'4c\',a).2O(\'3F\',b)},25:H(a){54();G(D.2Q)a.1l(S,D);N D.3D.1A(H(){I a.1l(7,D)});I 7}});D.1n({2Q:Q,3D:[],25:H(){G(!D.2Q){D.2Q=M;G(D.3D){D.P(D.3D,H(){7.1l(S)});D.3D=U}D(S).5G("25")}}});J x=Q;H 54(){G(x)I;x=M;G(S.4a&&!D.14.2H)S.4a("67",D.25,Q);G(D.14.1g&&1c==1P)(H(){G(D.2Q)I;23{S.1B.7W("1z")}21(3g){3E(1a.3I,0);I}D.25()})();G(D.14.2H)S.4a("67",H(){G(D.2Q)I;R(J i=0;i<S.4V.K;i++)G(S.4V[i].3O){3E(1a.3I,0);I}D.25()},Q);G(D.14.2f){J a;(H(){G(D.2Q)I;G(S.3i!="66"&&S.3i!="1O"){3E(1a.3I,0);I}G(a===12)a=D("V, 7z[7U=7T]").K;G(S.4V.K!=a){3E(1a.3I,0);I}D.25()})()}D.W.17(1c,"3Y",D.25)}D.P(("7S,7R,3Y,7Q,4A,4Y,4n,7P,"+"89,7O,7N,51,4Z,7M,2y,"+"5m,8d,7L,7K,3g").1Q(","),H(i,b){D.18[b]=H(a){I a?7.2O(b,a):7.1R(b)}});J F=H(a,c){J b=a.4j;1G(b&&b!=c)23{b=b.1f}21(3g){b=c}I b==c};D(1c).2O("4Y",H(){D("*").17(S).3L()});D.18.1n({6e:D.18.3Y,3Y:H(g,d,c){G(1j g!=\'1W\')I 7.6e(g);J e=g.1i(" ");G(e>=0){J i=g.3w(e,g.K);g=g.3w(0,e)}c=c||H(){};J f="2R";G(d)G(D.1F(d)){c=d;d=U}N G(1j d==\'3y\'){d=D.3A(d);f="7J"}J h=7;D.3T({1b:g,O:f,1L:"2I",L:d,1O:H(a,b){G(b=="1U"||b=="7I")h.2I(i?D("<1w/>").3s(a.4U.1o(/<1m(.|\\s)*?\\/1m>/g,"")).2u(i):a.4U);h.P(c,[a.4U,b,a])}});I 7},aL:H(){I D.3A(7.7H())},7H:H(){I 7.2i(H(){I D.Y(7,"45")?D.2h(7.aK):7}).1E(H(){I 7.32&&!7.3O&&(7.4M||/2y|6x/i.11(7.Y)||/1r|1C|3K/i.11(7.O))}).2i(H(i,c){J b=D(7).6a();I b==U?U:b.1q==2q?D.2i(b,H(a,i){I{32:c.32,2s:a}}):{32:c.32,2s:b}}).3p()}});D.P("7G,7D,7C,7B,6u,7A".1Q(","),H(i,o){D.18[o]=H(f){I 7.2O(o,f)}});J B=1x();D.1n({3p:H(d,b,a,c){G(D.1F(b)){a=b;b=U}I D.3T({O:"2R",1b:d,L:b,1U:a,1L:c})},aG:H(b,a){I D.3p(b,U,a,"1m")},aF:H(c,b,a){I D.3p(c,b,a,"3B")},aD:H(d,b,a,c){G(D.1F(b)){a=b;b={}}I D.3T({O:"7J",1b:d,L:b,1U:a,1L:c})},aC:H(a){D.1n(D.5Z,a)},5Z:{1b:5Y.5x,28:M,O:"2R",2W:0,7y:"4x/x-ay-45-ax",7v:M,31:M,L:U,5r:U,3K:U,4z:{2K:"4x/2K, 1r/2K",2I:"1r/2I",1m:"1r/4v, 4x/4v",3B:"4x/3B, 1r/4v",1r:"1r/as",4S:"*/*"}},4R:{},3T:H(s){s=D.1n(M,s,D.1n(M,{},D.5Z,s));J g,33=/=\\?(&|$)/g,1v,L,O=s.O.2m();G(s.L&&s.7v&&1j s.L!="1W")s.L=D.3A(s.L);G(s.1L=="4Q"){G(O=="2R"){G(!s.1b.1I(33))s.1b+=(s.1b.1I(/\\?/)?"&":"?")+(s.4Q||"7s")+"=?"}N G(!s.L||!s.L.1I(33))s.L=(s.L?s.L+"&":"")+(s.4Q||"7s")+"=?";s.1L="3B"}G(s.1L=="3B"&&(s.L&&s.L.1I(33)||s.1b.1I(33))){g="4Q"+B++;G(s.L)s.L=(s.L+"").1o(33,"="+g+"$1");s.1b=s.1b.1o(33,"="+g+"$1");s.1L="1m";1c[g]=H(a){L=a;1U();1O();1c[g]=12;23{3d 1c[g]}21(e){}G(i)i.30(h)}}G(s.1L=="1m"&&s.1Y==U)s.1Y=Q;G(s.1Y===Q&&O=="2R"){J j=1x();J k=s.1b.1o(/(\\?|&)3n=.*?(&|$)/,"$am="+j+"$2");s.1b=k+((k==s.1b)?(s.1b.1I(/\\?/)?"&":"?")+"3n="+j:"")}G(s.L&&O=="2R"){s.1b+=(s.1b.1I(/\\?/)?"&":"?")+s.L;s.L=U}G(s.28&&!D.4P++)D.W.1R("7G");J n=/^(?:\\w+:)?\\/\\/([^\\/?#]+)/;G(s.1L=="1m"&&O=="2R"&&n.11(s.1b)&&n.2D(s.1b)[1]!=5Y.ak){J i=S.40("6v")[0];J h=S.3t("1m");h.4e=s.1b;G(s.7r)h.ai=s.7r;G(!g){J l=Q;h.ag=h.af=H(){G(!l&&(!7.3i||7.3i=="66"||7.3i=="1O")){l=M;1U();1O();i.30(h)}}}i.49(h);I 12}J m=Q;J c=1c.7q?2r 7q("ad.ac"):2r 6Q();G(s.5r)c.7o(O,s.1b,s.31,s.5r,s.3K);N c.7o(O,s.1b,s.31);23{G(s.L)c.4O("ab-aa",s.7y);G(s.5T)c.4O("a9-5S-a8",D.4R[s.1b]||"a7, a6 a4 a3 5O:5O:5O a1");c.4O("X-a0-9Y","6Q");c.4O("9X",s.1L&&s.4z[s.1L]?s.4z[s.1L]+", */*":s.4z.4S)}21(e){}G(s.7k&&s.7k(c,s)===Q){s.28&&D.4P--;c.7j();I Q}G(s.28)D.W.1R("7A",[c,s]);J d=H(a){G(!m&&c&&(c.3i==4||a=="2W")){m=M;G(f){7h(f);f=U}1v=a=="2W"?"2W":!D.7g(c)?"3g":s.5T&&D.7f(c,s.1b)?"7I":"1U";G(1v=="1U"){23{L=D.6U(c,s.1L,s.9S)}21(e){1v="5L"}}G(1v=="1U"){J b;23{b=c.5K("7e-5S")}21(e){}G(s.5T&&b)D.4R[s.1b]=b;G(!g)1U()}N D.5E(s,c,1v);1O();G(s.31)c=U}};G(s.31){J f=4L(d,13);G(s.2W>0)3E(H(){G(c){c.7j();G(!m)d("2W")}},s.2W)}23{c.9R(s.L)}21(e){D.5E(s,c,U,e)}G(!s.31)d();H 1U(){G(s.1U)s.1U(L,1v);G(s.28)D.W.1R("6u",[c,s])}H 1O(){G(s.1O)s.1O(c,1v);G(s.28)D.W.1R("7C",[c,s]);G(s.28&&!--D.4P)D.W.1R("7D")}I c},5E:H(s,a,b,e){G(s.3g)s.3g(a,b,e);G(s.28)D.W.1R("7B",[a,s,e])},4P:0,7g:H(a){23{I!a.1v&&5Y.9Q=="5o:"||(a.1v>=7c&&a.1v<9O)||a.1v==7a||a.1v==9N||D.14.2f&&a.1v==12}21(e){}I Q},7f:H(a,c){23{J b=a.5K("7e-5S");I a.1v==7a||b==D.4R[c]||D.14.2f&&a.1v==12}21(e){}I Q},6U:H(a,c,b){J d=a.5K("9L-O"),2K=c=="2K"||!c&&d&&d.1i("2K")>=0,L=2K?a.9K:a.4U;G(2K&&L.1B.2g=="5L")7m"5L";G(b)L=b(L,c);G(c=="1m")D.5u(L);G(c=="3B")L=6s("("+L+")");I L},3A:H(a){J s=[];H 17(b,a){s[s.K]=78(b)+\'=\'+78(a)};G(a.1q==2q||a.5w)D.P(a,H(){17(7.32,7.2s)});N R(J j 1k a)G(a[j]&&a[j].1q==2q)D.P(a[j],H(){17(j,7)});N 17(j,D.1F(a[j])?a[j]():a[j]);I s.6r("&").1o(/%20/g,"+")}});D.18.1n({1N:H(c,b){I c?7.2j({1T:"1N",2d:"1N",1y:"1N"},c,b):7.1E(":1C").P(H(){7.V.19=7.5H||"";G(D.1h(7,"19")=="2P"){J a=D("<"+7.2g+" />").6O("1d");7.V.19=a.1h("19");G(7.V.19=="2P")7.V.19="3H";a.1Z()}}).3m()},1J:H(b,a){I b?7.2j({1T:"1J",2d:"1J",1y:"1J"},b,a):7.1E(":4i").P(H(){7.5H=7.5H||D.1h(7,"19");7.V.19="2P"}).3m()},76:D.18.2B,2B:H(a,b){I D.1F(a)&&D.1F(b)?7.76.1t(7,1a):a?7.2j({1T:"2B",2d:"2B",1y:"2B"},a,b):7.P(H(){D(7)[D(7).3C(":1C")?"1N":"1J"]()})},9J:H(b,a){I 7.2j({1T:"1N"},b,a)},9I:H(b,a){I 7.2j({1T:"1J"},b,a)},9H:H(b,a){I 7.2j({1T:"2B"},b,a)},9G:H(b,a){I 7.2j({1y:"1N"},b,a)},9F:H(b,a){I 7.2j({1y:"1J"},b,a)},9D:H(c,a,b){I 7.2j({1y:a},c,b)},2j:H(k,j,i,g){J h=D.74(j,i,g);I 7[h.35===Q?"P":"35"](H(){G(7.15!=1)I Q;J f=D.1n({},h),p,1C=D(7).3C(":1C"),41=7;R(p 1k k){G(k[p]=="1J"&&1C||k[p]=="1N"&&!1C)I f.1O.1l(7);G(p=="1T"||p=="2d"){f.19=D.1h(7,"19");f.34=7.V.34}}G(f.34!=U)7.V.34="1C";f.44=D.1n({},k);D.P(k,H(c,a){J e=2r D.27(41,f,c);G(/2B|1N|1J/.11(a))e[a=="2B"?1C?"1N":"1J":a](k);N{J b=a.6p().1I(/^([+-]=)?([\\d+-.]+)(.*)$/),2b=e.1u(M)||0;G(b){J d=3e(b[2]),2M=b[3]||"2U";G(2M!="2U"){41.V[c]=(d||1)+2M;2b=((d||1)/e.1u(M))*2b;41.V[c]=2b+2M}G(b[1])d=((b[1]=="-="?-1:1)*d)+2b;e.3Z(2b,d,2M)}N e.3Z(2b,a,"")}});I M})},35:H(a,b){G(D.1F(a)||(a&&a.1q==2q)){b=a;a="27"}G(!a||(1j a=="1W"&&!b))I A(7[0],a);I 7.P(H(){G(b.1q==2q)A(7,a,b);N{A(7,a).1A(b);G(A(7,a).K==1)b.1l(7)}})},9x:H(b,c){J a=D.3M;G(b)7.35([]);7.P(H(){R(J i=a.K-1;i>=0;i--)G(a[i].T==7){G(c)a[i](M);a.7l(i,1)}});G(!c)7.5C();I 7}});J A=H(b,c,a){G(b){c=c||"27";J q=D.L(b,c+"35");G(!q||a)q=D.L(b,c+"35",D.2h(a))}I q};D.18.5C=H(a){a=a||"27";I 7.P(H(){J q=A(7,a);q.4s();G(q.K)q[0].1l(7)})};D.1n({74:H(b,a,c){J d=b&&b.1q==9u?b:{1O:c||!c&&a||D.1F(b)&&b,2v:b,3U:c&&a||a&&a.1q!=9t&&a};d.2v=(d.2v&&d.2v.1q==4N?d.2v:D.27.5N[d.2v])||D.27.5N.71;d.5P=d.1O;d.1O=H(){G(d.35!==Q)D(7).5C();G(D.1F(d.5P))d.5P.1l(7)};I d},3U:{7n:H(p,n,b,a){I b+a*p},5Q:H(p,n,b,a){I((-26.9r(p*26.9q)/2)+0.5)*a+b}},3M:[],46:U,27:H(b,c,a){7.16=c;7.T=b;7.1e=a;G(!c.3R)c.3R={}}});D.27.3V={4E:H(){G(7.16.2Z)7.16.2Z.1l(7.T,7.1x,7);(D.27.2Z[7.1e]||D.27.2Z.4S)(7);G(7.1e=="1T"||7.1e=="2d")7.T.V.19="3H"},1u:H(a){G(7.T[7.1e]!=U&&7.T.V[7.1e]==U)I 7.T[7.1e];J r=3e(D.1h(7.T,7.1e,a));I r&&r>-9p?r:3e(D.24(7.T,7.1e))||0},3Z:H(c,b,d){7.5B=1x();7.2b=c;7.3m=b;7.2M=d||7.2M||"2U";7.1x=7.2b;7.36=7.4C=0;7.4E();J e=7;H t(a){I e.2Z(a)}t.T=7.T;D.3M.1A(t);G(D.46==U){D.46=4L(H(){J a=D.3M;R(J i=0;i<a.K;i++)G(!a[i]())a.7l(i--,1);G(!a.K){7h(D.46);D.46=U}},13)}},1N:H(){7.16.3R[7.1e]=D.1M(7.T.V,7.1e);7.16.1N=M;7.3Z(0,7.1u());G(7.1e=="2d"||7.1e=="1T")7.T.V[7.1e]="9l";D(7.T).1N()},1J:H(){7.16.3R[7.1e]=D.1M(7.T.V,7.1e);7.16.1J=M;7.3Z(7.1u(),0)},2Z:H(a){J t=1x();G(a||t>7.16.2v+7.5B){7.1x=7.3m;7.36=7.4C=1;7.4E();7.16.44[7.1e]=M;J b=M;R(J i 1k 7.16.44)G(7.16.44[i]!==M)b=Q;G(b){G(7.16.19!=U){7.T.V.34=7.16.34;7.T.V.19=7.16.19;G(D.1h(7.T,"19")=="2P")7.T.V.19="3H"}G(7.16.1J)7.T.V.19="2P";G(7.16.1J||7.16.1N)R(J p 1k 7.16.44)D.1M(7.T.V,p,7.16.3R[p])}G(b)7.16.1O.1l(7.T);I Q}N{J n=t-7.5B;7.4C=n/7.16.2v;7.36=D.3U[7.16.3U||(D.3U.5Q?"5Q":"7n")](7.4C,n,0,1,7.16.2v);7.1x=7.2b+((7.3m-7.2b)*7.36);7.4E()}I M}};D.1n(D.27,{5N:{9k:9i,an:7c,71:ao},2Z:{2c:H(a){a.T.2c=a.1x},2l:H(a){a.T.2l=a.1x},1y:H(a){D.1M(a.T.V,"1y",a.1x)},4S:H(a){a.T.V[a.1e]=a.1x+a.2M}}});D.18.2k=H(){J b=0,1P=0,T=7[0],3q;G(T)9f(D.14){J d=T.1f,48=T,1p=T.1p,1S=T.2z,5V=2f&&3v(5F)<9c&&!/aw/i.11(v),1h=D.24,2X=1h(T,"3c")=="2X";G(!(3r&&T==S.1d)&&T.6T){J c=T.6T();17(c.1z+26.2e(1S.1B.2c,1S.1d.2c),c.1P+26.2e(1S.1B.2l,1S.1d.2l));17(-1S.1B.69,-1S.1B.68)}N{17(T.5X,T.5z);1G(1p){17(1p.5X,1p.5z);G(3r&&!/^t(98|d|h)$/i.11(1p.2g)||2f&&!5V)2A(1p);G(!2X&&1h(1p,"3c")=="2X")2X=M;48=/^1d$/i.11(1p.2g)?48:1p;1p=1p.1p}1G(d&&d.2g&&!/^1d|2I$/i.11(d.2g)){G(!/^97|1X.*$/i.11(1h(d,"19")))17(-d.2c,-d.2l);G(3r&&1h(d,"34")!="4i")2A(d);d=d.1f}G((5V&&(2X||1h(48,"3c")=="5g"))||(3r&&1h(48,"3c")!="5g"))17(-1S.1d.5X,-1S.1d.5z);G(2X)17(26.2e(1S.1B.2c,1S.1d.2c),26.2e(1S.1B.2l,1S.1d.2l))}3q={1P:1P,1z:b}}H 2A(a){17(D.24(a,"7w",M),D.24(a,"7x",M))}H 17(l,t){b+=3v(l,10)||0;1P+=3v(t,10)||0}I 3q};D.18.1n({3c:H(){J a=0,1P=0,3q;G(7[0]){J b=7.1p(),2k=7.2k(),4b=/^1d|2I$/i.11(b[0].2g)?{1P:0,1z:0}:b.2k();2k.1P-=2a(7,\'95\');2k.1z-=2a(7,\'94\');4b.1P+=2a(b,\'7x\');4b.1z+=2a(b,\'7w\');3q={1P:2k.1P-4b.1P,1z:2k.1z-4b.1z}}I 3q},1p:H(){J a=7[0].1p;1G(a&&(!/^1d|2I$/i.11(a.2g)&&D.1h(a,\'3c\')==\'aI\'))a=a.1p;I D(a)}});D.P([\'5d\',\'5b\'],H(i,b){J c=\'4A\'+b;D.18[c]=H(a){G(!7[0])I;I a!=12?7.P(H(){7==1c||7==S?1c.aJ(!i?a:D(1c).2c(),i?a:D(1c).2l()):7[c]=a}):7[0]==1c||7[0]==S?41[i?\'92\':\'91\']||D.6Y&&S.1B[c]||S.1d[c]:7[0][c]}});D.P(["6M","47"],H(i,b){J c=i?"5d":"5b",43=i?"6i":"6g";D.18["5s"+b]=H(){I 7[b.3h()]()+2a(7,"55"+c)+2a(7,"55"+43)};D.18["aM"+b]=H(a){I 7["5s"+b]()+2a(7,"2A"+c+"47")+2a(7,"2A"+43+"47")+(a?2a(7,"7F"+c)+2a(7,"7F"+43):0)}})})();',62,671,'|||||||this|||||||||||||||||||||||||||||||||||if|function|return|var|length|data|true|else|type|each|false|for|document|elem|null|style|event||nodeName|||test|undefined||browser|nodeType|options|add|fn|display|arguments|url|window|body|prop|parentNode|msie|css|indexOf|typeof|in|call|script|extend|replace|offsetParent|constructor|text|firstChild|apply|cur|status|div|now|opacity|left|push|documentElement|hidden|className|filter|isFunction|while|handle|match|hide|ret|dataType|attr|show|complete|top|split|trigger|doc|height|success|break|string|table|cache|remove||catch|tbody|try|curCSS|ready|Math|fx|global|guid|num|start|scrollLeft|width|max|safari|tagName|makeArray|map|animate|offset|scrollTop|toUpperCase||handler|button|Array|new|value|id|find|duration|done|copy|select|ownerDocument|border|toggle|special|exec|inArray|pushStack|stack|opera|html|nextSibling|xml|props|unit|target|bind|none|isReady|GET|which|namespace|px|nth|timeout|fixed|one|step|removeChild|async|name|jsre|overflow|queue|pos|preventDefault|insertBefore|merge|selected|removeData|position|delete|parseFloat|multiFilter|error|toLowerCase|readyState|rl|re|trim|end|_|first|get|results|mozilla|append|createElement|childNodes|parseInt|slice|events|object|elems|param|json|is|readyList|setTimeout|mouseleave|grep|block|callee|proxy|password|unbind|timers|defaultView|disabled|last|has|orig|domManip|ajax|easing|prototype|set|stopPropagation|load|custom|getElementsByTagName|self|charCode|br|curAnim|form|timerId|Width|offsetChild|appendChild|addEventListener|parentOffset|mouseenter|color|src|currentStyle|float|clean|visible|relatedTarget|fromElement|innerHTML|handlers|click|isXMLDoc|on|setup|nodeIndex|shift|input|unique|javascript|child|application|RegExp|accepts|scroll|deep|state|previousSibling|update|empty|teardown|tr|jQuery|timeStamp|getAttribute|setInterval|checked|Number|setRequestHeader|active|jsonp|lastModified|_default|dir|responseText|styleSheets|not|lastToggle|unload|mouseout|outline|mouseover|getPropertyValue|getComputedStyle|bindReady|padding|String|pageX|metaKey|keyCode|getWH|Top|clientX|Left|all|container|absolute|index|init|triggered|removeAttribute|classFilter|submit|prevObject|file|after|windowData|username|inner|client|globalEval|sibling|jquery|href|clone|offsetTop|checkbox|startTime|dequeue|visibility|handleError|version|triggerHandler|oldblock|ctrlKey|createTextNode|getResponseHeader|parsererror|andSelf|speeds|00|old|swing|radio|Modified|ifModified|lastChild|safari2|wrapAll|offsetLeft|location|ajaxSettings|getElementById|isSimple|values|selectedIndex|runtimeStyle|rsLeft|loaded|DOMContentLoaded|clientTop|clientLeft|val|unshift|toElement|srcElement|_load|pageY|Bottom|clientY|Right|fix|exclusive|detachEvent|removeEventListener|cloneNode|swap|toString|attachEvent|join|eval|substr|ajaxSuccess|head|parse|textarea|reset|image|zoom|odd|even|before|prepend|expr|exclude|quickClass|quickID|quickChild|uuid|continue|Height|textContent|appendTo|contents|XMLHttpRequest|evalScript|parent|getBoundingClientRect|httpData|setArray|CSS1Compat|compatMode|boxModel|cssFloat|styleFloat|def|webkit|nodeValue|speed|concat|_toggle|eq|encodeURIComponent|100|304|replaceWith|200|alpha|Last|httpNotModified|httpSuccess|clearInterval|getAttributeNode|abort|beforeSend|splice|throw|linear|open|colgroup|ActiveXObject|scriptCharset|callback|fieldset|multiple|processData|borderLeftWidth|borderTopWidth|contentType|link|ajaxSend|ajaxError|ajaxComplete|ajaxStop|col|margin|ajaxStart|serializeArray|notmodified|POST|keyup|keypress|change|mousemove|mouseup|dblclick|resize|focus|blur|stylesheet|rel|hasClass|doScroll|hover|black|solid|cancelBubble|returnValue|originalEvent|wheelDelta|view|round|shiftKey|screenY|screenX|mousedown|relatedNode|prevValue|originalTarget|keydown|newValue|offsetHeight|offsetWidth|eventPhase|detail|currentTarget|cancelable|bubbles|attrName|attrChange|altKey|charAt|0n|substring|animated|header|noConflict|enabled|line|innerText|contains|only|weight|font|gt|lt|uFFFF|u0128|417|size|Boolean|toggleClass|Date|removeClass|addClass|removeAttr|replaceAll|insertAfter|prependTo|contentWindow|wrap|contentDocument|iframe|children|siblings|prevAll|nextAll|wrapInner|prev|pageXOffset|pageYOffset|next|marginLeft|marginTop|parents|inline|able|rowSpan|rowspan|cellSpacing|522|cellspacing|maxLength|with|maxlength|readOnly|600|readonly|slow|1px|class|htmlFor|reverse|10000|PI|cos|compatible|Function|Object|setData|ie|stop|ra|it|rv|getData|userAgent|fadeTo|navigator|fadeOut|fadeIn|slideToggle|slideUp|slideDown|responseXML|content|ig|1223|300|NaN|protocol|send|dataFilter|setAttribute|option|cssText|changed|Accept|With|be|Requested|GMT|can|1970|Jan|property|01|Thu|Since|If|Type|Content|XMLHTTP|Microsoft|th|onreadystatechange|onload|td|charset|cap|host|colg|1_|fast|400|tfoot|specified|thead|plain|leg|attributes|opt|adobeair|urlencoded|www|embed|area|hr|ajaxSetup|post|meta|getJSON|getScript|img|static|scrollTo|elements|serialize|outer|abbr|pixelLeft'.split('|'),0,{}));jQuery.noConflict();
index d0f4578b14493ae90045b9cba9e0c1d5744b5e9d..344008d7610340363adda7bae2ce571ef1fa0686 100644 (file)
@@ -1,5 +1,7 @@
 /*
- *     jquery.suggest 1.1 - 2007-08-06
+ *     jquery.suggest 1.1b - 2007-08-06
+ * Patched by Mark Jaquith with Alexander Dick's "multiple items" patch to allow for auto-suggesting of more than one tag before submitting
+ * See: http://www.vulgarisoip.com/2007/06/29/jquerysuggest-an-alternative-jquery-based-autocomplete-library/#comment-7228
  *     
  *     Uses code and techniques from following libraries:
  *     1. http://www.dyve.net/jquery/?autocomplete
                
                        var q = $.trim($input.val());
 
+                       if ( options.multiple ) {
+                               var multipleSepPos = q.lastIndexOf(options.multipleSep);
+                               if ( multipleSepPos != -1 ) {
+                                       q = q.substr(multipleSepPos + options.multipleSep.length);
+                               }
+                       }
                        if (q.length >= options.minchars) {
                                
                                cached = checkCache(q);
                        $currentResult = getCurrentResult();
                
                        if ($currentResult) {
-                               $input.val($currentResult.text());
+                               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)
                        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';
diff --git a/wp-includes/js/jquery/ui.core.js b/wp-includes/js/jquery/ui.core.js
new file mode 100644 (file)
index 0000000..c38b920
--- /dev/null
@@ -0,0 +1,2 @@
+eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(3(C){C.8={2s:{1o:3(E,F,H){6 G=C.8[E].n;1v(6 D 2r H){G.w[D]=G.w[D]||[];G.w[D].2q([F,H[D]])}},1n:3(D,F,E){6 H=D.w[F];5(!H){4}1v(6 G=0;G<H.2p;G++){5(D.a[H[G][0]]){H[G][1].u(D.c,E)}}}},o:{},f:3(D){5(C.8.o[D]){4 C.8.o[D]}6 E=C(\'<2o 2n="8-2m">\').1i(D).f({2l:"2k",12:"-1u",2j:"-1u",2i:"2h"}).2g("1t");C.8.o[D]=!!((!(/2f|2e/).h(E.f("2d"))||(/^[1-9]/).h(E.f("2c"))||(/^[1-9]/).h(E.f("2b"))||!(/1r/).h(E.f("2a"))||!(/29|28\\(0, 0, 0, 0\\)/).h(E.f("27"))));26{C("1t").1s(0).25(E.1s(0))}24(F){}4 C.8.o[D]},23:3(D){D.j="1g";D.1q=3(){4 7};5(D.v){D.v.1p="1r"}},22:3(D){D.j="21";D.1q=3(){4 d};5(D.v){D.v.1p=""}},20:3(G,E){6 D=/12/.h(E||"12")?"1Z":"1Y",F=7;5(G[D]>0){4 d}G[D]=1;F=G[D]>0?d:7;G[D]=0;4 F}};6 B=C.10.t;C.10.t=3(){C("*",2).1o(2).1X("t");4 B.u(2,1m)};3 A(E,F,G){6 D=C[E][F].1W||[];D=(W D=="V"?D.11(/,?\\s+/):D);4(C.1V(G,D)!=-1)}C.l=3(E,D){6 F=E.11(".")[0];E=E.11(".")[1];C.10[E]=3(J){6 H=(W J=="V"),I=1U.n.1T.1n(1m,1);5(H&&A(F,E,J)){6 G=C.Z(2[0],E);4(G?G[J].u(G,I):1S)}4 2.1R(3(){6 K=C.Z(2,E);5(H&&K&&C.1Q(K[J])){K[J].u(K,I)}1P{5(!H){C.Z(2,E,1O C[F][E](2,J))}}})};C[F][E]=3(I,H){6 G=2;2.e=E;2.1h=F+"-"+E;2.a=C.1l({},C.l.p,C[F][E].p,H);2.c=C(I).g("m."+E,3(L,J,K){4 G.m(J,K)}).g("Y."+E,3(K,J){4 G.Y(J)}).g("t",3(){4 G.1j()});2.1k()};C[F][E].n=C.1l({},C.l.n,D)};C.l.n={1k:3(){},1j:3(){2.c.1N(2.e)},Y:3(D){4 2.a[D]},m:3(D,E){2.a[D]=E;5(D=="k"){2.c[E?"1i":"1M"](2.1h+"-k")}},1L:3(){2.m("k",7)},1K:3(){2.m("k",d)}};C.l.p={k:7};C.8.14={1J:3(){6 D=2;2.c.g("1I."+2.e,3(E){4 D.1e(E)});5(C.U.T){2.1f=2.c.X("j");2.c.X("j","1g")}2.1H=7},1G:3(){2.c.R("."+2.e);(C.U.T&&2.c.X("j",2.1f))},1e:3(F){(2.b&&2.i(F));2.r=F;6 E=2,G=(F.1F==1),D=(W 2.a.y=="V"?C(F.1E).1D(2.a.y):7);5(!G||D||!2.15(F)){4 d}2.q=!2.a.x;5(!2.q){2.1C=1B(3(){E.q=d},2.a.x)}5(2.P(F)&&2.N(F)){2.b=(2.M(F)!==7);5(!2.b){F.1A();4 d}}2.S=3(H){4 E.1d(H)};2.Q=3(H){4 E.i(H)};C(1c).g("1b."+2.e,2.S).g("1a."+2.e,2.Q);4 7},1d:3(D){5(C.U.T&&!D.1z){4 2.i(D)}5(2.b){2.z(D);4 7}5(2.P(D)&&2.N(D)){2.b=(2.M(2.r,D)!==7);(2.b?2.z(D):2.i(D))}4!2.b},i:3(D){C(1c).R("1b."+2.e,2.S).R("1a."+2.e,2.Q);5(2.b){2.b=7;2.16(D)}4 7},P:3(D){4(O.1y(O.18(2.r.19-D.19),O.18(2.r.17-D.17))>=2.a.13)},N:3(D){4 2.q},M:3(D){},z:3(D){},16:3(D){},15:3(D){4 d}};C.8.14.p={y:1x,13:1,x:0}})(1w)',62,153,'||this|function|return|if|var|false|ui||options|_mouseStarted|element|true|widgetName|css|bind|test|mouseUp|unselectable|disabled|widget|setData|prototype|cssCache|defaults|_mouseDelayMet|_mouseDownEvent||remove|apply|style|plugins|delay|cancel|mouseDrag|||||||||||||mouseStart|mouseDelayMet|Math|mouseDistanceMet|_mouseUpDelegate|unbind|_mouseMoveDelegate|msie|browser|string|typeof|attr|getData|data|fn|split|top|distance|mouse|mouseCapture|mouseStop|pageY|abs|pageX|mouseup|mousemove|document|mouseMove|mouseDown|_mouseUnselectable|on|widgetBaseClass|addClass|destroy|init|extend|arguments|call|add|MozUserSelect|onselectstart|none|get|body|5000px|for|jQuery|null|max|button|preventDefault|setTimeout|_mouseDelayTimer|is|target|which|mouseDestroy|started|mousedown|mouseInit|disable|enable|removeClass|removeData|new|else|isFunction|each|undefined|slice|Array|inArray|getter|trigger|scrollLeft|scrollTop|hasScroll|off|enableSelection|disableSelection|catch|removeChild|try|backgroundColor|rgba|transparent|backgroundImage|width|height|cursor|default|auto|appendTo|block|display|left|absolute|position|gen|class|div|length|push|in|plugin'.split('|'),0,{}))
+
diff --git a/wp-includes/js/jquery/ui.sortable.js b/wp-includes/js/jquery/ui.sortable.js
new file mode 100644 (file)
index 0000000..c3f9d06
--- /dev/null
@@ -0,0 +1,2 @@
+eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(b(B){b A(E,D){9 C=B.2U.3W&&B.2U.3V<3U;5(E.2T&&!C){d E.2T(D)}5(E.2S){d!!(E.2S(D)&16)}1R(D=D.1g){5(D==E){d U}}d w}B.3T("m.q",B.2h(B.m.3S,{3R:b(){9 C=4.8;4.P={};4.g.27("m-q");4.2L();4.13=4.c.z?(/6|25/).18(4.c[0].u.f("3Q")):w;5(!(/(2R|1t|3P)/).18(4.g.f("W"))){4.g.f("W","2R")}4.a=4.g.a();4.3O()},3N:{},m:b(C){d{k:(C||4)["k"],r:(C||4)["r"]||B([]),W:(C||4)["W"],3M:(C||4)["1c"],8:4.8,g:4.g,u:(C||4)["i"],3L:C?C.g:O}},v:b(F,E,C,D){B.m.1m.15(4,F,[E,4.m(C)]);5(!D){4.g.3K(F=="1C"?F:"1C"+F,[E,4.m(C)],4.8[F])}},2g:b(E){9 C=(B.1O(4.8.c)?4.8.c.15(4.g):B(4.8.c,4.g)).1Y(".m-q-k");9 D=[];E=E||{};C.1y(b(){9 F=(B(4).2O(E.3J||"2N")||"").3I(E.2P||(/(.+)[-=3H](.+)/));5(F){D.1z((E.2Q||F[1])+"[]="+(E.2Q&&E.2P?F[1]:F[2]))}});d D.3G("&")},2f:b(C){9 D=(B.1O(4.8.c)?4.8.c.15(4.g):B(4.8.c,4.g)).1Y(".m-q-k");9 E=[];D.1y(b(){E.1z(B(4).2O(C||"2N"))});d E},2G:b(J){9 E=4.1c.6,D=E+4.s.n,I=4.1c.7,H=I+4.s.o;9 F=J.6,C=F+J.n,K=J.7,G=K+J.o;5(4.8.1p=="2M"||(4.8.1p=="1V"&&4.s[4.13?"n":"o"]>J[4.13?"n":"o"])){d(I+4.a.p.7>K&&I+4.a.p.7<G&&E+4.a.p.6>F&&E+4.a.p.6<C)}Z{d(F<E+(4.s.n/2)&&D-(4.s.n/2)<C&&K<I+(4.s.o/2)&&H-(4.s.o/2)<G)}},2u:b(J){9 E=4.1c.6,D=E+4.s.n,I=4.1c.7,H=I+4.s.o;9 F=J.6,C=F+J.n,K=J.7,G=K+J.o;5(4.8.1p=="2M"||(4.8.1p=="1V"&&4.s[4.13?"n":"o"]>J[4.13?"n":"o"])){5(!(I+4.a.p.7>K&&I+4.a.p.7<G&&E+4.a.p.6>F&&E+4.a.p.6<C)){d w}5(4.13){5(E+4.a.p.6>F&&E+4.a.p.6<F+J.n/2){d 2}5(E+4.a.p.6>F+J.n/2&&E+4.a.p.6<C){d 1}}Z{5(I+4.a.p.7>K&&I+4.a.p.7<K+J.o/2){d 2}5(I+4.a.p.7>K+J.o/2&&I+4.a.p.7<G){d 1}}}Z{5(!(F<E+(4.s.n/2)&&D-(4.s.n/2)<C&&K<I+(4.s.o/2)&&H-(4.s.o/2)<G)){d w}5(4.13){5(D>F&&E<F){d 2}5(E<C&&D>C){d 1}}Z{5(H>K&&I<K){d 1}5(I<G&&H>G){d 2}}}d w},2L:b(){4.28();4.1I()},28:b(){4.c=[];4.e=[4];9 D=4.c;9 C=4;9 F=[[B.1O(4.8.c)?4.8.c.15(4.g,O,{8:4.8,u:4.i}):B(4.8.c,4.g),4]];5(4.8.2a){Q(9 G=4.8.2a.z-1;G>=0;G--){9 I=B(4.8.2a[G]);Q(9 E=I.z-1;E>=0;E--){9 H=B.1f(I[E],"q");5(H&&!H.8.29){F.1z([B.1O(H.8.c)?H.8.c.15(H.g):B(H.8.c,H.g),H]);4.e.1z(H)}}}}Q(9 G=F.z-1;G>=0;G--){F[G][0].1y(b(){B.1f(4,"q-u",F[G][1]);D.1z({u:B(4),2K:F[G][1],n:0,o:0,6:0,7:0})})}},1I:b(D){5(4.t){9 C=4.t.a();4.a.l={7:C.7+4.1w.7,6:C.6+4.1w.6}}Q(9 F=4.c.z-1;F>=0;F--){5(4.c[F].2K!=4.1x&&4.1x&&4.c[F].u[0]!=4.i[0]){1L}9 E=4.8.2J?B(4.8.2J,4.c[F].u):4.c[F].u;5(!D){4.c[F].n=E.1v();4.c[F].o=E.1u()}9 G=E.a();4.c[F].6=G.6;4.c[F].7=G.7}Q(9 F=4.e.z-1;F>=0;F--){9 G=4.e[F].g.a();4.e[F].P.6=G.6;4.e[F].P.7=G.7;4.e[F].P.n=4.e[F].g.1v();4.e[F].P.o=4.e[F].g.1u()}},3F:b(){4.g.3E("m-q m-q-29").2I("q").3D(".q");4.3C();Q(9 C=4.c.z-1;C>=0;C--){4.c[C].u.2I("q-u")}},26:b(E){9 C=E||4,F=C.8;5(F.r.3B==3A){9 D=F.r;F.r={g:b(){d B("<2H></2H>").27(D)[0]},1q:b(G,H){H.f(G.a()).f({n:G.1v(),o:G.1u()})}}}C.r=B(F.r.g.15(C.g,C.i)).1o("T").f({W:"1t"});F.r.1q.15(C.g,C.i,C.r)},2s:b(F){Q(9 D=4.e.z-1;D>=0;D--){5(4.2G(4.e[D].P)){5(!4.e[D].P.1b){5(4.1x!=4.e[D]){9 I=3z;9 H=O;9 E=4.1c[4.e[D].13?"6":"7"];Q(9 C=4.c.z-1;C>=0;C--){5(!A(4.e[D].g[0],4.c[C].u[0])){1L}9 G=4.c[C][4.e[D].13?"6":"7"];5(1k.2F(G-E)<I){I=1k.2F(G-E);H=4.c[C]}}5(!H&&!4.8.2e){1L}5(4.r){4.r.1G()}5(4.e[D].8.r){4.e[D].26(4)}Z{4.r=O}4.1x=4.e[D];H?4.1J(F,H,O,U):4.1J(F,O,4.e[D].g,U);4.v("21",F);4.e[D].v("21",F,4)}4.e[D].v("1b",F,4);4.e[D].P.1b=1}}Z{5(4.e[D].P.1b){4.e[D].v("2k",F,4);4.e[D].P.1b=0}}}},3y:b(G,F){5(4.8.29||4.8.2t=="3x"){d w}4.28();9 E=O,D=4,C=B(G.1N).2D().1y(b(){5(B.1f(4,"q-u")==D){E=B(4);d w}});5(B.1f(G.1N,"q-u")==D){E=B(G.1N)}5(!E){d w}5(4.8.2E&&!F){9 H=w;B(4.8.2E,E).3w("*").3v().1y(b(){5(4==G.1N){H=U}});5(!H){d w}}4.i=E;d U},3u:b(H,F,C){9 J=4.8;4.1x=4;4.1I();4.k=3t J.k=="b"?B(J.k.3s(4.g[0],[H,4.i])):4.i.1W();5(!4.k.2D("T").z){4.k.1o((J.1o!="l"?J.1o:4.i[0].1g))}4.k.f({W:"1t",1H:"3r"}).27("m-q-k");4.V={6:(L(4.i.f("3q"),10)||0),7:(L(4.i.f("3p"),10)||0)};4.a=4.i.a();4.a={7:4.a.7-4.V.7,6:4.a.6-4.V.6};4.a.p={6:H.1d-4.a.6,7:H.1e-4.a.7};4.t=4.k.t();9 D=4.t.a();4.1w={7:(L(4.t.f("23"),10)||0),6:(L(4.t.f("24"),10)||0)};4.a.l={7:D.7+4.1w.7,6:D.6+4.1w.6};4.1j=4.22(H);4.1X={1r:4.i.1r()[0],l:4.i.l()[0]};4.s={n:4.k.1v(),o:4.k.1u()};5(J.r){4.26()}4.v("1l",H);4.s={n:4.k.1v(),o:4.k.1u()};5(J.12){5(J.12.6!=1M){4.a.p.6=J.12.6}5(J.12.25!=1M){4.a.p.6=4.s.n-J.12.25}5(J.12.7!=1M){4.a.p.7=J.12.7}5(J.12.2C!=1M){4.a.p.7=4.s.o-J.12.2C}}5(J.j){5(J.j=="l"){J.j=4.k[0].1g}5(J.j=="h"||J.j=="17"){4.j=[0-4.a.l.6,0-4.a.l.7,B(J.j=="h"?h:17).n()-4.a.l.6-4.s.n-4.V.6-(L(4.g.f("2B"),10)||0),(B(J.j=="h"?h:17).o()||h.T.1g.2z)-4.a.l.7-4.s.o-4.V.7-(L(4.g.f("2y"),10)||0)]}5(!(/^(h|17|l)$/).18(J.j)){9 G=B(J.j)[0];9 I=B(J.j).a();4.j=[I.6+(L(B(G).f("24"),10)||0)-4.a.l.6,I.7+(L(B(G).f("23"),10)||0)-4.a.l.7,I.6+1k.2A(G.3o,G.2b)-(L(B(G).f("24"),10)||0)-4.a.l.6-4.s.n-4.V.6-(L(4.i.f("2B"),10)||0),I.7+1k.2A(G.2z,G.2c)-(L(B(G).f("23"),10)||0)-4.a.l.7-4.s.o-4.V.7-(L(4.i.f("2y"),10)||0)]}}5(4.8.r!="1W"){4.i.f("2i","3n")}5(!C){Q(9 E=4.e.z-1;E>=0;E--){4.e[E].v("3m",H,4)}}5(B.m.14){B.m.14.3l=4}5(B.m.14&&!J.2n){B.m.14.3k(4,H)}4.2j=U;4.2w(H);d U},2v:b(D,E){5(!E){E=4.W}9 C=D=="1t"?1:-1;d{7:(E.7+4.a.l.7*C-(4.t[0]==h.T?0:4.t[0].N)*C+4.V.7*C),6:(E.6+4.a.l.6*C-(4.t[0]==h.T?0:4.t[0].M)*C+4.V.6*C)}},22:b(F){9 G=4.8;9 C={7:(F.1e-4.a.p.7-4.a.l.7+(4.t[0]==h.T?0:4.t[0].N)),6:(F.1d-4.a.p.6-4.a.l.6+(4.t[0]==h.T?0:4.t[0].M))};5(!4.1j){d C}5(4.j){5(C.6<4.j[0]){C.6=4.j[0]}5(C.7<4.j[1]){C.7=4.j[1]}5(C.6>4.j[2]){C.6=4.j[2]}5(C.7>4.j[3]){C.7=4.j[3]}}5(G.11){9 E=4.1j.7+1k.2x((C.7-4.1j.7)/G.11[1])*G.11[1];C.7=4.j?(!(E<4.j[1]||E>4.j[3])?E:(!(E<4.j[1])?E-G.11[1]:E+G.11[1])):E;9 D=4.1j.6+1k.2x((C.6-4.1j.6)/G.11[0])*G.11[0];C.6=4.j?(!(D<4.j[0]||D>4.j[2])?D:(!(D<4.j[0])?D-G.11[0]:D+G.11[0])):D}d C},2w:b(D){4.W=4.22(D);4.1c=4.2v("1t");Q(9 C=4.c.z-1;C>=0;C--){9 E=4.2u(4.c[C]);5(!E){1L}5(4.c[C].u[0]!=4.i[0]&&4.i[E==1?"3j":"1r"]()[0]!=4.c[C].u[0]&&!A(4.i[0],4.c[C].u[0])&&(4.8.2t=="3i-3h"?!A(4.g[0],4.c[C].u[0]):U)){4.2p=E==1?"2o":"3g";4.1J(D,4.c[C]);4.v("21",D);3f}}4.2s(D);4.v("1C",D);5(!4.8.1K||4.8.1K=="x"){4.k[0].2r.6=4.W.6+"2q"}5(!4.8.1K||4.8.1K=="y"){4.k[0].2r.7=4.W.7+"2q"}5(B.m.14){B.m.14.3e(4,D)}d w},1J:b(H,G,D,F){D?D.3d(4.i):G.u[4.2p=="2o"?"3c":"3b"](4.i);4.1s=4.1s?++4.1s:1;9 E=4,C=4.1s;17.3a(b(){5(C==E.1s){E.1I(!F)}},0);5(4.8.r){4.8.r.1q.15(4.g,4.i,4.r)}},39:b(E,D){5(B.m.14&&!4.8.2n){B.m.14.38(4,E)}5(4.8.1Z){9 C=4;9 F=C.i.a();5(C.r){C.r.2m({19:"37"},(L(4.8.1Z,10)||2l)-36)}B(4.k).2m({6:F.6-4.a.l.6-C.V.6+(4.t[0]==h.T?0:4.t[0].M),7:F.7-4.a.l.7-C.V.7+(4.t[0]==h.T?0:4.t[0].N)},L(4.8.1Z,10)||2l,b(){C.1H(E)})}Z{4.1H(E,D)}d w},1H:b(E,D){5(4.1X.1r!=4.i.1r().1Y(".m-q-k")[0]||4.1X.l!=4.i.l()[0]){4.v("1q",E,O,D)}5(!A(4.g[0],4.i[0])){4.v("1G",E,O,D);Q(9 C=4.e.z-1;C>=0;C--){5(A(4.e[C].g[0],4.i[0])){4.e[C].v("1q",E,4,D);4.e[C].v("35",E,4,D)}}}Q(9 C=4.e.z-1;C>=0;C--){4.e[C].v("34",E,4,D);5(4.e[C].P.1b){4.e[C].v("2k",E,4);4.e[C].P.1b=0}}4.2j=w;5(4.33){4.v("1n",E,O,D);d w}B(4.i).f("2i","");5(4.r){4.r.1G()}4.k.1G();4.k=O;4.v("1n",E,O,D);d U}}));B.2h(B.m.q,{32:"2g 2f",31:{k:"1W",1p:"1V",30:1,2Z:0,1h:U,Y:20,X:20,2Y:":2X",c:"> *",1a:2W,2e:U,1o:"l"}});B.m.1m.1F("q","1i",{1l:b(E,D){9 C=B("T");5(C.f("1i")){D.8.1U=C.f("1i")}C.f("1i",D.8.1i)},1n:b(D,C){5(C.8.1U){B("T").f("1i",C.8.1U)}}});B.m.1m.1F("q","1a",{1l:b(E,D){9 C=D.k;5(C.f("1a")){D.8.1T=C.f("1a")}C.f("1a",D.8.1a)},1n:b(D,C){5(C.8.1T){B(C.k).f("1a",C.8.1T)}}});B.m.1m.1F("q","19",{1l:b(E,D){9 C=D.k;5(C.f("19")){D.8.1S=C.f("19")}C.f("19",D.8.19)},1n:b(D,C){5(C.8.1S){B(C.k).f("19",C.8.1S)}}});B.m.1m.1F("q","1h",{1l:b(E,D){9 F=D.8;9 C=B(4).1f("q");C.S=b(G){2d{5(/1E|1h/.18(G.f("1D"))||(/1E|1h/).18(G.f("1D-y"))){d G}G=G.l()}1R(G[0].1g);d B(h)}(C.i);C.R=b(G){2d{5(/1E|1h/.18(G.f("1D"))||(/1E|1h/).18(G.f("1D-x"))){d G}G=G.l()}1R(G[0].1g);d B(h)}(C.i);5(C.S[0]!=h&&C.S[0].1B!="1A"){C.1Q=C.S.a()}5(C.R[0]!=h&&C.R[0].1B!="1A"){C.1P=C.R.a()}},1C:b(E,D){9 F=D.8;9 C=B(4).1f("q");5(C.S[0]!=h&&C.S[0].1B!="1A"){5((C.1Q.7+C.S[0].2c)-E.1e<F.Y){C.S[0].N=C.S[0].N+F.X}5(E.1e-C.1Q.7<F.Y){C.S[0].N=C.S[0].N-F.X}}Z{5(E.1e-B(h).N()<F.Y){B(h).N(B(h).N()-F.X)}5(B(17).o()-(E.1e-B(h).N())<F.Y){B(h).N(B(h).N()+F.X)}}5(C.R[0]!=h&&C.R[0].1B!="1A"){5((C.1P.6+C.R[0].2b)-E.1d<F.Y){C.R[0].M=C.R[0].M+F.X}5(E.1d-C.1P.6<F.Y){C.R[0].M=C.R[0].M-F.X}}Z{5(E.1d-B(h).M()<F.Y){B(h).M(B(h).M()-F.X)}5(B(17).n()-(E.1d-B(h).M())<F.Y){B(h).M(B(h).M()+F.X)}}}})})(2V)',62,245,'||||this|if|left|top|options|var|offset|function|items|return|containers|css|element|document|currentItem|containment|helper|parent|ui|width|height|click|sortable|placeholder|helperProportions|offsetParent|item|propagate|false|||length||||||||||||parseInt|scrollLeft|scrollTop|null|containerCache|for|overflowX|overflowY|body|true|margins|position|scrollSpeed|scrollSensitivity|else||grid|cursorAt|floating|ddmanager|call||window|test|opacity|zIndex|over|positionAbs|pageX|pageY|data|parentNode|scroll|cursor|originalPosition|Math|start|plugin|stop|appendTo|tolerance|update|prev|counter|absolute|outerHeight|outerWidth|offsetParentBorders|currentContainer|each|push|HTML|tagName|sort|overflow|auto|add|remove|clear|refreshPositions|rearrange|axis|continue|undefined|target|isFunction|overflowXOffset|overflowYOffset|while|_opacity|_zIndex|_cursor|guess|clone|domPosition|not|revert||change|generatePosition|borderTopWidth|borderLeftWidth|right|createPlaceholder|addClass|refreshItems|disabled|connectWith|offsetWidth|offsetHeight|do|dropOnEmpty|toArray|serialize|extend|visibility|dragging|out|500|animate|dropBehaviour|down|direction|px|style|contactContainers|type|intersectsWithEdge|convertPositionTo|mouseDrag|round|marginBottom|scrollHeight|max|marginRight|bottom|parents|handle|abs|intersectsWith|div|removeData|toleranceElement|instance|refresh|pointer|id|attr|expression|key|relative|compareDocumentPosition|contains|browser|jQuery|1000|input|cancel|delay|distance|defaults|getter|cancelHelperRemoval|deactivate|receive|50|hide|drop|mouseStop|setTimeout|after|before|append|drag|break|up|dynamic|semi|next|prepareOffsets|current|activate|hidden|scrollWidth|marginTop|marginLeft|both|apply|typeof|mouseStart|andSelf|find|static|mouseCapture|10000|String|constructor|mouseDestroy|unbind|removeClass|destroy|join|_|match|attribute|triggerHandler|sender|absolutePosition|plugins|mouseInit|fixed|float|init|mouse|widget|522|version|safari'.split('|'),0,{}))
+
index 8634b412f88889b6165b44ca0dc5c63e326e891b..de954b051560e22825ec85e01237cacd6d4827df 100644 (file)
@@ -1,529 +1,2 @@
-/*
- * Tabs 3 - New Wave Tabs
- *
- * Copyright (c) 2007 Klaus Hartl (stilbuero.de)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- */
+eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(4(A){A.39("8.3",{38:4(){2.c.v+=".3";2.1e(1c)},37:4(B,C){5((/^7/).1Z(B)){2.16(C)}n{2.c[B]=C;2.1e()}},i:4(){f 2.$3.i},1E:4(B){f B.24&&B.24.13(/\\s/g,"23").13(/[^A-36-35-9\\-23:\\.]/g,"")||2.c.1Q+A.e(B)},8:4(C,B){f{c:2.c,34:C,1M:B}},1e:4(O){2.$h=A("1i:33(a[o])",2.l);2.$3=2.$h.1s(4(){f A("a",2)[0]});2.$b=A([]);6 P=2,D=2.c;2.$3.V(4(R,Q){5(Q.u&&Q.u.13("#","")){P.$b=P.$b.1b(Q.u)}n{5(A(Q).12("o")!="#"){A.e(Q,"o.3",Q.o);A.e(Q,"q.3",Q.o);6 T=P.1E(Q);Q.o="#"+T;6 S=A("#"+T);5(!S.i){S=A(D.1x).12("1f",T).m(D.18).32(P.$b[R-1]||P.l);S.e("1a.3",1c)}P.$b=P.$b.1b(S)}n{D.d.1U(R+1)}}});5(O){2.l.m(D.1w);2.$b.V(4(){6 Q=A(2);Q.m(D.18)});5(D.7===1p){5(1J.u){2.$3.V(4(S,Q){5(Q.u==1J.u){D.7=S;5(A.W.1g||A.W.31){6 R=A(1J.u),T=R.12("1f");R.12("1f","");1z(4(){R.12("1f",T)},30)}2Z(0,0);f p}})}n{5(D.Y){6 J=2Y(A.Y("8-3"+A.e(P.l)),10);5(J&&P.$3[J]){D.7=J}}n{5(P.$h.z("."+D.k).i){D.7=P.$h.Z(P.$h.z("."+D.k)[0])}}}}D.7=D.7===j||D.7!==1p?D.7:0;D.d=A.2X(D.d.2W(A.1s(2.$h.z("."+D.U),4(R,Q){f P.$h.Z(R)}))).1T();5(A.1r(D.7,D.d)!=-1){D.d.2V(A.1r(D.7,D.d),1)}2.$b.m(D.w);2.$h.r(D.k);5(D.7!==j){2.$b.t(D.7).1G().r(D.w);2.$h.t(D.7).m(D.k);6 K=4(){A(P.l).y("20",[j,P.8(P.$3[D.7],P.$b[D.7])],D.1G)};5(A.e(2.$3[D.7],"q.3")){2.q(D.7,K)}n{K()}}A(2U).15("2T",4(){P.$3.14(".3");P.$h=P.$3=P.$b=j})}2S(6 G=0,N;N=2.$h[G];G++){A(N)[A.1r(G,D.d)!=-1&&!A(N).11(D.k)?"m":"r"](D.U)}5(D.x===p){2.$3.1m("x.3")}6 C,I,B={"2R-2Q":0,1I:1},E="2P";5(D.X&&D.X.2O==2N){C=D.X[0]||B,I=D.X[1]||B}n{C=I=D.X||B}6 H={1q:"",2M:"",2L:""};5(!A.W.1g){H.1H=""}4 M(R,Q,S){Q.22(C,C.1I||E,4(){Q.m(D.w).1d(H);5(A.W.1g&&C.1H){Q[0].21.z=""}5(S){L(R,S,Q)}})}4 L(R,S,Q){5(I===B){S.1d("1q","1D")}S.22(I,I.1I||E,4(){S.r(D.w).1d(H);5(A.W.1g&&I.1H){S[0].21.z=""}A(P.l).y("20",[j,P.8(R,S[0])],D.1G)})}4 F(R,T,Q,S){T.m(D.k).2K().r(D.k);M(R,Q,S)}2.$3.14(".3").15(D.v,4(){6 T=A(2).2J("1i:t(0)"),Q=P.$b.z(":2I"),S=A(2.u);5((T.11(D.k)&&!D.1h)||T.11(D.U)||A(2).11(D.17)||A(P.l).y("2H",[j,P.8(2,S[0])],D.16)===p){2.1t();f p}P.c.7=P.$3.Z(2);5(D.1h){5(T.11(D.k)){P.c.7=j;T.r(D.k);P.$b.1F();M(2,Q);2.1t();f p}n{5(!Q.i){P.$b.1F();6 R=2;P.q(P.$3.Z(2),4(){T.m(D.k).m(D.1v);L(R,S)});2.1t();f p}}}5(D.Y){A.Y("8-3"+A.e(P.l),P.c.7,D.Y)}P.$b.1F();5(S.i){6 R=2;P.q(P.$3.Z(2),Q.i?4(){F(R,T,Q,S)}:4(){T.m(D.k);L(R,S)})}n{2G"1K 2F 2E: 2D 2C 2B."}5(A.W.1g){2.1t()}f p});5(!(/^1y/).1Z(D.v)){2.$3.15("1y.3",4(){f p})}},1b:4(E,D,C){5(C==1p){C=2.$3.i}6 G=2.c;6 I=A(G.1P.13(/#\\{o\\}/g,E).13(/#\\{1j\\}/g,D));I.e("1a.3",1c);6 H=E.2A("#")==0?E.13("#",""):2.1E(A("a:2z-2y",I)[0]);6 F=A("#"+H);5(!F.i){F=A(G.1x).12("1f",H).m(G.w).e("1a.3",1c)}F.m(G.18);5(C>=2.$h.i){I.1Y(2.l);F.1Y(2.l[0].2x)}n{I.1X(2.$h[C]);F.1X(2.$b[C])}G.d=A.1s(G.d,4(K,J){f K>=C?++K:K});2.1e();5(2.$3.i==1){I.m(G.k);F.r(G.w);6 B=A.e(2.$3[0],"q.3");5(B){2.q(C,B)}}2.l.y("2w",[j,2.8(2.$3[C],2.$b[C])],G.1b)},19:4(B){6 D=2.c,E=2.$h.t(B).19(),C=2.$b.t(B).19();5(E.11(D.k)&&2.$3.i>1){2.16(B+(B+1<2.$3.i?1:-1))}D.d=A.1s(A.1W(D.d,4(G,F){f G!=B}),4(G,F){f G>=B?--G:G});2.1e();2.l.y("2v",[j,2.8(E.1C("a")[0],C[0])],D.19)},1V:4(B){6 C=2.c;5(A.1r(B,C.d)==-1){f}6 D=2.$h.t(B).r(C.U);5(A.W.2u){D.1d("1q","2t-1D");1z(4(){D.1d("1q","1D")},0)}C.d=A.1W(C.d,4(F,E){f F!=B});2.l.y("2s",[j,2.8(2.$3[B],2.$b[B])],C.1V)},1S:4(C){6 B=2,D=2.c;5(C!=D.7){2.$h.t(C).m(D.U);D.d.1U(C);D.d.1T();2.l.y("2r",[j,2.8(2.$3[C],2.$b[C])],D.1S)}},16:4(B){5(2q B=="2p"){B=2.$3.Z(2.$3.z("[o$="+B+"]")[0])}2.$3.t(B).2o(2.c.v)},q:4(G,K){6 L=2,D=2.c,E=2.$3.t(G),J=E[0],H=K==1p||K===p,B=E.e("q.3");K=K||4(){};5(!B||!H&&A.e(J,"x.3")){K();f}6 M=4(N){6 O=A(N),P=O.1C("*:2n");f P.i&&P||O};6 C=4(){L.$3.z("."+D.17).r(D.17).V(4(){5(D.1l){M(2).2m().1o(M(2).e("1j.3"))}});L.1n=j};5(D.1l){6 I=M(J).1o();M(J).2l("<1B></1B>").1C("1B").e("1j.3",I).1o(D.1l)}6 F=A.1L({},D.1k,{1R:B,1A:4(O,N){A(J.u).1o(O);C();5(D.x){A.e(J,"x.3",1c)}A(L.l).y("2k",[j,L.8(L.$3[G],L.$b[G])],D.q);D.1k.1A&&D.1k.1A(O,N);K()}});5(2.1n){2.1n.2j();C()}E.m(D.17);1z(4(){L.1n=A.2i(F)},0)},1R:4(C,B){2.$3.t(C).1m("x.3").e("q.3",B)},1a:4(){6 B=2.c;2.l.14(".3").r(B.1w).1m("3");2.$3.V(4(){6 C=A.e(2,"o.3");5(C){2.o=C}6 D=A(2).14(".3");A.V(["o","q","x"],4(E,F){D.1m(F+".3")})});2.$h.1b(2.$b).V(4(){5(A.e(2,"1a.3")){A(2).19()}n{A(2).r([B.k,B.1v,B.U,B.18,B.w].2h(" "))}})}});A.8.3.2g={1h:p,v:"1y",d:[],Y:j,1l:"2f&#2e;",x:p,1Q:"8-3-",1k:{},X:j,1P:\'<1i><a o="#{o}"><1O>#{1j}</1O></a></1i>\',1x:"<1N></1N>",1w:"8-3-2d",k:"8-3-7",1v:"8-3-1h",U:"8-3-d",18:"8-3-1M",w:"8-3-2c",17:"8-3-2b"};A.8.3.2a="i";A.1L(A.8.3.29,{1u:j,28:4(C,F){F=F||p;6 B=2,E=2.c.7;4 G(){B.1u=27(4(){E=++E<B.$3.i?E:0;B.16(E)},C)}4 D(H){5(!H||H.26){25(B.1u)}}5(C){G();5(!F){2.$3.15(2.c.v,D)}n{2.$3.15(2.c.v,4(){D();E=B.c.7;G()})}}n{D();2.$3.14(2.c.v,D)}}})})(1K)',62,196,'||this|tabs|function|if|var|selected|ui|||panels|options|disabled|data|return||lis|length|null|selectedClass|element|addClass|else|href|false|load|removeClass||eq|hash|event|hideClass|cache|triggerHandler|filter|||||||||||||||||||||disabledClass|each|browser|fx|cookie|index||hasClass|attr|replace|unbind|bind|select|loadingClass|panelClass|remove|destroy|add|true|css|tabify|id|msie|unselect|li|label|ajaxOptions|spinner|removeData|xhr|html|undefined|display|inArray|map|blur|rotation|unselectClass|navClass|panelTemplate|click|setTimeout|success|em|find|block|tabId|stop|show|opacity|duration|location|jQuery|extend|panel|div|span|tabTemplate|idPrefix|url|disable|sort|push|enable|grep|insertBefore|appendTo|test|tabsshow|style|animate|_|title|clearInterval|clientX|setInterval|rotate|prototype|getter|loading|hide|nav|8230|Loading|defaults|join|ajax|abort|tabsload|wrapInner|parent|last|trigger|string|typeof|tabsdisable|tabsenable|inline|safari|tabsremove|tabsadd|parentNode|child|first|indexOf|identifier|fragment|Mismatching|Tabs|UI|throw|tabsselect|visible|parents|siblings|height|overflow|Array|constructor|normal|width|min|for|unload|window|splice|concat|unique|parseInt|scrollTo|500|opera|insertAfter|has|tab|z0|Za|setData|init|widget'.split('|'),0,{}))
 
-(function($) {
-
-    // if the UI scope is not availalable, add it
-    $.ui = $.ui || {};
-
-    // tabs initialization
-    $.fn.tabs = function(initial, options) {
-        if (initial && initial.constructor == Object) { // shift arguments
-            options = initial;
-            initial = null;
-        }
-        options = options || {};
-
-        initial = initial && initial.constructor == Number && --initial || 0;
-
-        return this.each(function() {
-            new $.ui.tabs(this, $.extend(options, { initial: initial }));
-        });
-    };
-
-    // other chainable tabs methods
-    $.each(['Add', 'Remove', 'Enable', 'Disable', 'Click', 'Load', 'Href'], function(i, method) {
-        $.fn['tabs' + method] = function() {
-            var args = arguments;
-            return this.each(function() {
-                var instance = $.ui.tabs.getInstance(this);
-                instance[method.toLowerCase()].apply(instance, args);
-            });
-        };
-    });
-    $.fn.tabsSelected = function() {
-        var selected = -1;
-        if (this[0]) {
-            var instance = $.ui.tabs.getInstance(this[0]),
-                $lis = $('li', this);
-            selected = $lis.index( $lis.filter('.' + instance.options.selectedClass)[0] );
-        }
-        return selected >= 0 ? ++selected : -1;
-    };
-
-    // tabs class
-    $.ui.tabs = function(el, options) {
-
-        this.source = el;
-
-        this.options = $.extend({
-
-            // basic setup
-            initial: 0,
-            event: 'click',
-            disabled: [],
-            cookie: null, // pass options object as expected by cookie plugin: { expires: 7, path: '/', domain: 'jquery.com', secure: true }
-            // TODO bookmarkable: $.ajaxHistory ? true : false,
-            unselected: false,
-            unselect: options.unselected ? true : false,
-
-            // Ajax
-            spinner: 'Loading&#8230;',
-            cache: false,
-            idPrefix: 'ui-tabs-',
-            ajaxOptions: {},
-
-            // animations
-            /*fxFade: null,
-            fxSlide: null,
-            fxShow: null,
-            fxHide: null,*/
-            fxSpeed: 'normal',
-            /*fxShowSpeed: null,
-            fxHideSpeed: null,*/
-
-            // callbacks
-            add: function() {},
-            remove: function() {},
-            enable: function() {},
-            disable: function() {},
-            click: function() {},
-            hide: function() {},
-            show: function() {},
-            load: function() {},
-            
-            // templates
-            tabTemplate: '<li><a href="#{href}"><span>#{text}</span></a></li>',
-            panelTemplate: '<div></div>',
-
-            // CSS classes
-            navClass: 'ui-tabs-nav',
-            selectedClass: 'ui-tabs-selected',
-            unselectClass: 'ui-tabs-unselect',
-            disabledClass: 'ui-tabs-disabled',
-            panelClass: 'ui-tabs-panel',
-            hideClass: 'ui-tabs-hide',
-            loadingClass: 'ui-tabs-loading'
-
-        }, options);
-
-        this.options.event += '.ui-tabs'; // namespace event
-        this.options.cookie = $.cookie && $.cookie.constructor == Function && this.options.cookie;
-
-        // save instance for later
-        $.data(el, $.ui.tabs.INSTANCE_KEY, this);
-        
-        // create tabs
-        this.tabify(true);
-    };
-
-    // static
-    $.ui.tabs.INSTANCE_KEY = 'ui_tabs_instance';
-    $.ui.tabs.getInstance = function(el) {
-        return $.data(el, $.ui.tabs.INSTANCE_KEY);
-    };
-
-    // instance methods
-    $.extend($.ui.tabs.prototype, {
-        tabId: function(a) {
-            return a.title ? a.title.replace(/\s/g, '_')
-                : this.options.idPrefix + $.data(a);
-        },
-        tabify: function(init) {
-
-            this.$lis = $('li:has(a[href])', this.source);
-            this.$tabs = this.$lis.map(function() { return $('a', this)[0] });
-            this.$panels = $([]);
-            
-            var self = this, o = this.options;
-            
-            this.$tabs.each(function(i, a) {
-                // inline tab
-                if (a.hash && a.hash.replace('#', '')) { // Safari 2 reports '#' for an empty hash
-                    self.$panels = self.$panels.add(a.hash);
-                }
-                // remote tab
-                else if ($(a).attr('href') != '#') { // prevent loading the page itself if href is just "#"
-                    $.data(a, 'href', a.href);
-                    var id = self.tabId(a);
-                    a.href = '#' + id;
-                    self.$panels = self.$panels.add(
-                        $('#' + id)[0] || $(o.panelTemplate).attr('id', id).addClass(o.panelClass)
-                            .insertAfter( self.$panels[i - 1] || self.source )
-                    );
-                }
-                // invalid tab href
-                else {
-                    o.disabled.push(i + 1);
-                }
-            });
-
-            if (init) {
-
-                // attach necessary classes for styling if not present
-                $(this.source).hasClass(o.navClass) || $(this.source).addClass(o.navClass);
-                this.$panels.each(function() {
-                    var $this = $(this);
-                    $this.hasClass(o.panelClass) || $this.addClass(o.panelClass);
-                });
-                
-                // disabled tabs
-                for (var i = 0, position; position = o.disabled[i]; i++) {
-                    this.disable(position);
-                }
-                
-                // Try to retrieve initial tab:
-                // 1. from fragment identifier in url if present
-                // 2. from cookie
-                // 3. from selected class attribute on <li>
-                // 4. otherwise use given initial argument
-                // 5. check if tab is disabled
-                this.$tabs.each(function(i, a) {
-                    if (location.hash) {
-                        if (a.hash == location.hash) {
-                            o.initial = i;
-                            // prevent page scroll to fragment
-                            //if (($.browser.msie || $.browser.opera) && !o.remote) {
-                            if ($.browser.msie || $.browser.opera) {
-                                var $toShow = $(location.hash), toShowId = $toShow.attr('id');
-                                $toShow.attr('id', '');
-                                setTimeout(function() {
-                                    $toShow.attr('id', toShowId); // restore id
-                                }, 500);
-                            }
-                            scrollTo(0, 0);
-                            return false; // break
-                        }
-                    } else if (o.cookie) {
-                        o.initial = parseInt($.cookie( $.ui.tabs.INSTANCE_KEY + $.data(self.source) )) || 0;
-                        return false; // break
-                    } else if ( self.$lis.eq(i).hasClass(o.selectedClass) ) {
-                        o.initial = i;
-                        return false; // break
-                    }
-                });
-                var n = this.$lis.length;
-                while (this.$lis.eq(o.initial).hasClass(o.disabledClass) && n) {
-                    o.initial = ++o.initial < this.$lis.length ? o.initial : 0;
-                    n--;
-                }
-                if (!n) { // all tabs disabled, set option unselected to true
-                    o.unselected = o.unselect = true;
-                }
-
-                // highlight selected tab
-                this.$panels.addClass(o.hideClass);
-                this.$lis.removeClass(o.selectedClass);
-                if (!o.unselected) {
-                    this.$panels.eq(o.initial).show().removeClass(o.hideClass); // use show and remove class to show in any case no matter how it has been hidden before
-                    this.$lis.eq(o.initial).addClass(o.selectedClass);
-                }
-
-                // load if remote tab
-                var href = !o.unselected && $.data(this.$tabs[o.initial], 'href');
-                if (href) {
-                    this.load(o.initial + 1, href);
-                }
-                
-                // disable click if event is configured to something else
-                if (!/^click/.test(o.event)) {
-                    this.$tabs.bind('click', function(e) { e.preventDefault(); });
-                }
-
-            }
-
-            // setup animations
-            var showAnim = {}, showSpeed = o.fxShowSpeed || o.fxSpeed,
-                hideAnim = {}, hideSpeed = o.fxHideSpeed || o.fxSpeed;
-            if (o.fxSlide || o.fxFade) {
-                if (o.fxSlide) {
-                    showAnim['height'] = 'show';
-                    hideAnim['height'] = 'hide';
-                }
-                if (o.fxFade) {
-                    showAnim['opacity'] = 'show';
-                    hideAnim['opacity'] = 'hide';
-                }
-            } else {
-                if (o.fxShow) {
-                    showAnim = o.fxShow;
-                } else { // use some kind of animation to prevent browser scrolling to the tab
-                    showAnim['min-width'] = 0; // avoid opacity, causes flicker in Firefox
-                    showSpeed = 1; // as little as 1 is sufficient
-                }
-                if (o.fxHide) {
-                    hideAnim = o.fxHide;
-                } else { // use some kind of animation to prevent browser scrolling to the tab
-                    hideAnim['min-width'] = 0; // avoid opacity, causes flicker in Firefox
-                    hideSpeed = 1; // as little as 1 is sufficient
-                }
-            }
-
-            // reset some styles to maintain print style sheets etc.
-            var resetCSS = { display: '', overflow: '', height: '' };
-            if (!$.browser.msie) { // not in IE to prevent ClearType font issue
-                resetCSS['opacity'] = '';
-            }
-
-            // Hide a tab, animation prevents browser scrolling to fragment,
-            // $show is optional.
-            function hideTab(clicked, $hide, $show) {
-                $hide.animate(hideAnim, hideSpeed, function() { //
-                    $hide.addClass(o.hideClass).css(resetCSS); // maintain flexible height and accessibility in print etc.
-                    if ($.browser.msie && hideAnim['opacity']) {
-                        $hide[0].style.filter = '';
-                    }
-                    o.hide(clicked, $hide[0], $show && $show[0] || null);
-                    if ($show) {
-                        showTab(clicked, $show, $hide);
-                    }
-                });
-            }
-
-            // Show a tab, animation prevents browser scrolling to fragment,
-            // $hide is optional
-            function showTab(clicked, $show, $hide) {
-                if (!(o.fxSlide || o.fxFade || o.fxShow)) {
-                    $show.css('display', 'block'); // prevent occasionally occuring flicker in Firefox cause by gap between showing and hiding the tab panels
-                }
-                $show.animate(showAnim, showSpeed, function() {
-                    $show.removeClass(o.hideClass).css(resetCSS); // maintain flexible height and accessibility in print etc.
-                    if ($.browser.msie && showAnim['opacity']) {
-                        $show[0].style.filter = '';
-                    }
-                    o.show(clicked, $show[0], $hide && $hide[0] || null);
-                });
-            }
-
-            // switch a tab
-            function switchTab(clicked, $li, $hide, $show) {
-                /*if (o.bookmarkable && trueClick) { // add to history only if true click occured, not a triggered click
-                    $.ajaxHistory.update(clicked.hash);
-                }*/
-                $li.addClass(o.selectedClass)
-                    .siblings().removeClass(o.selectedClass);
-                hideTab(clicked, $hide, $show);
-            }
-
-            // attach tab event handler, unbind to avoid duplicates from former tabifying...
-            this.$tabs.unbind(o.event).bind(o.event, function() {
-
-                //var trueClick = e.clientX; // add to history only if true click occured, not a triggered click
-                var $li = $(this).parents('li:eq(0)'),
-                    $hide = self.$panels.filter(':visible'),
-                    $show = $(this.hash);
-
-                // If tab is already selected and not unselectable or tab disabled or click callback returns false stop here.
-                // Check if click handler returns false last so that it is not executed for a disabled tab!
-                if (($li.hasClass(o.selectedClass) && !o.unselect) || $li.hasClass(o.disabledClass)
-                    || o.click(this, $show[0], $hide[0]) === false) {
-                    this.blur();
-                    return false;
-                }
-                
-                if (o.cookie) {
-                    $.cookie($.ui.tabs.INSTANCE_KEY + $.data(self.source), self.$tabs.index(this), o.cookie);
-                }
-                    
-                // if tab may be closed
-                if (o.unselect) {
-                    if ($li.hasClass(o.selectedClass)) {
-                        $li.removeClass(o.selectedClass);
-                        self.$panels.stop();
-                        hideTab(this, $hide);
-                        this.blur();
-                        return false;
-                    } else if (!$hide.length) {
-                        self.$panels.stop();
-                        if ($.data(this, 'href')) { // remote tab
-                            var a = this;
-                            self.load(self.$tabs.index(this) + 1, $.data(this, 'href'), function() {
-                                $li.addClass(o.selectedClass).addClass(o.unselectClass);
-                                showTab(a, $show);
-                            });
-                        } else {
-                            $li.addClass(o.selectedClass).addClass(o.unselectClass);
-                            showTab(this, $show);
-                        }
-                        this.blur();
-                        return false;
-                    }
-                }
-
-                // stop possibly running animations
-                self.$panels.stop();
-
-                // show new tab
-                if ($show.length) {
-
-                    // prevent scrollbar scrolling to 0 and than back in IE7, happens only if bookmarking/history is enabled
-                    /*if ($.browser.msie && o.bookmarkable) {
-                        var showId = this.hash.replace('#', '');
-                        $show.attr('id', '');
-                        setTimeout(function() {
-                            $show.attr('id', showId); // restore id
-                        }, 0);
-                    }*/
-
-                    if ($.data(this, 'href')) { // remote tab
-                        var a = this;
-                        self.load(self.$tabs.index(this) + 1, $.data(this, 'href'), function() {
-                            switchTab(a, $li, $hide, $show);
-                        });
-                    } else {
-                        switchTab(this, $li, $hide, $show);
-                    }
-
-                    // Set scrollbar to saved position - need to use timeout with 0 to prevent browser scroll to target of hash
-                    /*var scrollX = window.pageXOffset || document.documentElement && document.documentElement.scrollLeft || document.body.scrollLeft || 0;
-                    var scrollY = window.pageYOffset || document.documentElement && document.documentElement.scrollTop || document.body.scrollTop || 0;
-                    setTimeout(function() {
-                        scrollTo(scrollX, scrollY);
-                    }, 0);*/
-
-                } else {
-                    throw 'jQuery UI Tabs: Mismatching fragment identifier.';
-                }
-
-                // Prevent IE from keeping other link focussed when using the back button
-                // and remove dotted border from clicked link. This is controlled in modern
-                // browsers via CSS, also blur removes focus from address bar in Firefox
-                // which can become a usability and annoying problem with tabsRotate.
-                if ($.browser.msie) {
-                    this.blur(); 
-                }
-
-                //return o.bookmarkable && !!trueClick; // convert trueClick == undefined to Boolean required in IE
-                return false;
-
-            });
-
-        },
-        add: function(url, text, position) {
-            if (url && text) {
-                position = position || this.$tabs.length; // append by default  
-                
-                var o = this.options,
-                    $li = $(o.tabTemplate.replace(/#\{href\}/, url).replace(/#\{text\}/, text));
-                
-                var id = url.indexOf('#') == 0 ? url.replace('#', '') : this.tabId( $('a:first-child', $li)[0] );
-                
-                // try to find an existing element before creating a new one
-                var $panel = $('#' + id);
-                $panel = $panel.length && $panel
-                    || $(o.panelTemplate).attr('id', id).addClass(o.panelClass).addClass(o.hideClass);
-                if (position >= this.$lis.length) {
-                    $li.appendTo(this.source);
-                    $panel.appendTo(this.source.parentNode);
-                } else {
-                    $li.insertBefore(this.$lis[position - 1]);
-                    $panel.insertBefore(this.$panels[position - 1]);
-                }
-                
-                this.tabify();
-                
-                if (this.$tabs.length == 1) {
-                     $li.addClass(o.selectedClass);
-                     $panel.removeClass(o.hideClass);
-                     var href = $.data(this.$tabs[0], 'href');
-                     if (href) {
-                         this.load(position + 1, href);
-                     }
-                }
-                o.add(this.$tabs[position], this.$panels[position]); // callback
-            } else {
-                throw 'jQuery UI Tabs: Not enough arguments to add tab.';
-            }
-        },
-        remove: function(position) {
-            if (position && position.constructor == Number) {                
-                var o = this.options, $li = this.$lis.eq(position - 1).remove(),
-                    $panel = this.$panels.eq(position - 1).remove();
-                    
-                // If selected tab was removed focus tab to the right or
-                // tab to the left if last tab was removed.
-                if ($li.hasClass(o.selectedClass) && this.$tabs.length > 1) {
-                    this.click(position + (position < this.$tabs.length ? 1 : -1));
-                }
-                this.tabify();
-                o.remove($li.end()[0], $panel[0]); // callback
-            }
-        },
-        enable: function(position) {
-            var o = this.options, $li = this.$lis.eq(position - 1);
-            $li.removeClass(o.disabledClass);
-            if ($.browser.safari) { // fix disappearing tab (that used opacity indicating disabling) after enabling in Safari 2...
-                $li.css('display', 'inline-block');
-                setTimeout(function() {
-                    $li.css('display', 'block')
-                }, 0)
-            }
-            o.enable(this.$tabs[position - 1], this.$panels[position - 1]); // callback
-        },
-        disable: function(position) {
-            var o = this.options;      
-            this.$lis.eq(position - 1).addClass(o.disabledClass);
-            o.disable(this.$tabs[position - 1], this.$panels[position - 1]); // callback
-        },
-        click: function(position) {
-            this.$tabs.eq(position - 1).trigger(this.options.event);
-        },
-        load: function(position, url, callback) {
-            var self = this, o = this.options,
-                $a = this.$tabs.eq(position - 1), a = $a[0], $span = $('span', a);
-            
-            // shift arguments
-            if (url && url.constructor == Function) {
-                callback = url;
-                url = null;
-            }
-
-            // set new URL or get existing
-            if (url) {
-                $.data(a, 'href', url);
-            } else {
-                url = $.data(a, 'href');
-            }
-
-            // load
-            if (o.spinner) {
-                $.data(a, 'title', $span.html());
-                $span.html('<em>' + o.spinner + '</em>');
-            }
-            var finish = function() {
-                self.$tabs.filter('.' + o.loadingClass).each(function() {
-                    $(this).removeClass(o.loadingClass);
-                    if (o.spinner) {
-                        $('span', this).html( $.data(this, 'title') );
-                    }
-                });
-                self.xhr = null;
-            };
-            var ajaxOptions = $.extend(o.ajaxOptions, {
-                url: url,
-                success: function(r) {
-                    $(a.hash).html(r);
-                    finish();
-                    // This callback is required because the switch has to take 
-                    // place after loading has completed.
-                    if (callback && callback.constructor == Function) {
-                        callback();
-                    }
-                    if (o.cache) {
-                        $.removeData(a, 'href'); // if loaded once do not load them again
-                    }
-                    o.load(self.$tabs[position - 1], self.$panels[position - 1]); // callback
-                }
-            });
-            if (this.xhr) {
-                // terminate pending requests from other tabs and restore title
-                this.xhr.abort();
-                finish();
-            }
-            $a.addClass(o.loadingClass);
-            setTimeout(function() { // timeout is again required in IE, "wait" for id being restored
-                self.xhr = $.ajax(ajaxOptions);
-            }, 0);
-            
-        },
-        href: function(position, href) {
-            $.data(this.$tabs.eq(position - 1)[0], 'href', href);
-        }
-    });
-
-})(jQuery);
index 92eb8ac88c56d646d14e7d02ba75d98d5805834f..75ce85c5c69e499447e5337943d7382332600fba 100644 (file)
@@ -55,7 +55,7 @@ function prepareMediaItemInit(fileObj) {
        jQuery('#media-item-' + fileObj.id + ' .filename.original').replaceWith(jQuery('#media-item-' + fileObj.id + ' .filename.new'));
 
        // Also bind toggle to the links
-       jQuery('#media-item-' + fileObj.id + ' a.toggle').bind('click', function(){jQuery(this).siblings('.slidetoggle').slideToggle(150);jQuery(this).parent().eq(0).children('.toggle').toggle();jQuery(this).siblings('a.toggle').focus();return false;});
+       jQuery('#media-item-' + fileObj.id + ' a.toggle').bind('click', function(){jQuery(this).siblings('.slidetoggle').slideToggle(150, function(){window.scrollTo(0,this.parentNode.offsetTop);});jQuery(this).parent().eq(0).children('.toggle').toggle();jQuery(this).siblings('a.toggle').focus();return false;});
 
        // Bind AJAX to the new Delete button
        jQuery('#media-item-' + fileObj.id + ' a.delete').bind('click',function(){
diff --git a/wp-includes/js/thickbox/macFFBgHack.png b/wp-includes/js/thickbox/macFFBgHack.png
new file mode 100644 (file)
index 0000000..c6473b3
Binary files /dev/null and b/wp-includes/js/thickbox/macFFBgHack.png differ
index 0552cc54562a6ebc532354b9e51f024c863d0227..a7c4a4012a891ae9560c805a8f040eb4e9904426 100644 (file)
@@ -82,16 +82,14 @@ margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = d
 }
 
 #TB_closeAjaxWindow{
-       padding:7px 10px 5px 0;
-       margin-bottom:1px;
+       padding:6px 10px 0;
        text-align:right;
        float:right;
 }
 
 #TB_ajaxWindowTitle{
        float:left;
-       padding:7px 0 5px 10px;
-       margin-bottom:1px;
+       padding:6px 10px 0;
 }
 
 #TB_title{
@@ -118,12 +116,13 @@ margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = d
 #TB_load{
        position: fixed;
        display:none;
-       height:13px;
-       width:208px;
        z-index:103;
        top: 50%;
        left: 50%;
-       margin: -6px 0 0 -104px; /* -height/2 0 0 -width/2 */
+       background-color: #E8E8E8;
+       border: 4px solid #525252;
+       margin: -45px 0pt 0pt -125px;
+       padding: 40px 15px 15px;
 }
 
 * html #TB_load { /* ie6 hack */
@@ -154,6 +153,5 @@ margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = d
        clear:both;
        border:none;
        margin-bottom:-1px;
-       margin-top:1px;
        _margin-bottom:1px;
 }
index b1875e9a57945b1e11ab2b9f299d1eec26f0edef..75f10a7e6cd625550b6fb3095343bc9bf7d8d80c 100644 (file)
@@ -3,7 +3,7 @@
 // escape text only if it needs translating
 function mce_escape($text) {
        global $language;
-       
+
        if ( 'en' == $language ) return $text;
        else return js_escape($text);
 }
@@ -395,7 +395,47 @@ 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...') ) . '",
-wp_page_alt:"' . mce_escape( __('Next page...') ) . '"
+wp_page_alt:"' . mce_escape( __('Next page...') ) . '",
+add_media:"' . mce_escape( __('Add Media') ) . '",
+add_image:"' . mce_escape( __('Add an Image') ) . '",
+add_video:"' . mce_escape( __('Add Video') ) . '",
+add_audio:"' . mce_escape( __('Add Audio') ) . '"
+});
+
+tinyMCE.addI18n("' . $language . '.wpeditimage",{
+edit_img:"' . mce_escape( __('Edit Image') )  . '",
+del_img:"' . mce_escape( __('Delete Image') )  . '",
+adv_settings:"' . mce_escape( __('Advanced Settings') )  . '",
+none:"' . mce_escape( __('None') )  . '",
+size:"' . mce_escape( __('Size') ) . '",
+thumbnail:"' . mce_escape( __('Thumbnail') ) . '",
+medium:"' . mce_escape( __('Medium') ) . '",
+full_size:"' . mce_escape( __('Full Size') ) . '",
+current_link:"' . mce_escape( __('Current Link') ) . '",
+link_to_img:"' . mce_escape( __('Link to Image') ) . '",
+link_help:"' . mce_escape( __('Enter a link URL or click above for presets.') ) . '",
+adv_img_settings:"' . mce_escape( __('Advanced Image Settings') ) . '",
+source:"' . mce_escape( __('Source') )  . '",
+width:"' . mce_escape( __('Width') ) . '",
+height:"' . mce_escape( __('Height') ) . '",
+orig_size:"' . mce_escape( __('Original Size') ) . '",
+css:"' . mce_escape( __('CSS Class') ) . '",
+adv_link_settings:"' . mce_escape( __('Advanced Link Settings') )  . '",
+link_rel:"' . mce_escape( __('Link Rel') ) . '",
+height:"' . mce_escape( __('Height') ) . '",
+orig_size:"' . mce_escape( __('Original Size') ) . '",
+css:"' . mce_escape( __('CSS Class') ) . '",
+s60:"' . mce_escape( __('60%') ) . '",
+s70:"' . mce_escape( __('70%') ) . '",
+s80:"' . mce_escape( __('80%') ) . '",
+s90:"' . mce_escape( __('90%') ) . '",
+s100:"' . mce_escape( __('100%') ) . '",
+s110:"' . mce_escape( __('110%') ) . '",
+s120:"' . mce_escape( __('120%') ) . '",
+s130:"' . mce_escape( __('130%') ) . '",
+img_title:"' . mce_escape( __('Edit Image Title') ) . '",
+caption:"' . mce_escape( __('Edit Image Caption') ) . '",
+alt:"' . mce_escape( __('Edit Alternate Text') ) . '"
 });
-'; 
+';
 ?>
\ No newline at end of file
index 7b848f1e98324756840ba403b3e2123c4e5bd2bb..1f0cc1bdad3b4c9d75bf37fcf649962d75f7ac99 100644 (file)
@@ -1 +1 @@
-(function(){var DOM=tinymce.DOM;tinymce.create('tinymce.plugins.FullScreenPlugin',{init:function(ed,url){var t=this,s={},vp;t.editor=ed;ed.addCommand('mceFullScreen',function(){var win,de=DOM.doc.documentElement;if(ed.getParam('fullscreen_is_enabled')){if(ed.getParam('fullscreen_new_window'))closeFullscreen();else{DOM.win.setTimeout(function(){tinymce.dom.Event.remove(DOM.win,'resize',t.resizeFunc);tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent({format:'raw'}),{format:'raw'});tinyMCE.remove(ed);DOM.remove('mce_fullscreen_container');de.style.overflow=ed.getParam('fullscreen_html_overflow');DOM.setStyle(DOM.doc.body,'overflow',ed.getParam('fullscreen_overflow'));DOM.win.scrollTo(ed.getParam('fullscreen_scrollx'),ed.getParam('fullscreen_scrolly'));tinyMCE.settings=tinyMCE.oldSettings;},10);}return;}if(ed.getParam('fullscreen_new_window')){win=DOM.win.open(url+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{win.resizeTo(screen.availWidth,screen.availHeight);}catch(e){}}else{tinyMCE.oldSettings=tinyMCE.settings;s.fullscreen_overflow=DOM.getStyle(DOM.doc.body,'overflow',1)||'auto';s.fullscreen_html_overflow=DOM.getStyle(de,'overflow',1);vp=DOM.getViewPort();s.fullscreen_scrollx=vp.x;s.fullscreen_scrolly=vp.y;if(tinymce.isOpera&&s.fullscreen_overflow=='visible')s.fullscreen_overflow='auto';if(tinymce.isIE&&s.fullscreen_overflow=='scroll')s.fullscreen_overflow='auto';if(s.fullscreen_overflow=='0px')s.fullscreen_overflow='';DOM.setStyle(DOM.doc.body,'overflow','hidden');de.style.overflow='hidden';vp=DOM.getViewPort();DOM.win.scrollTo(0,0);if(tinymce.isIE)vp.h-=1;n=DOM.add(DOM.doc.body,'div',{id:'mce_fullscreen_container',style:'position:absolute;top:0;left:0;width:'+vp.w+'px;height:'+vp.h+'px;z-index:200000;'});DOM.add(n,'div',{id:'mce_fullscreen'});tinymce.each(ed.settings,function(v,n){s[n]=v;});s.id='mce_fullscreen';s.width=n.clientWidth;s.height=n.clientHeight-15;s.fullscreen_is_enabled=true;s.fullscreen_editor_id=ed.id;s.theme_advanced_resizing=false;s.save_onsavecallback=function(){ed.setContent(tinyMCE.get(s.id).getContent({format:'raw'}),{format:'raw'});ed.execCommand('mceSave');};tinymce.each(ed.getParam('fullscreen_settings'),function(v,k){s[k]=v;});if(s.theme_advanced_toolbar_location==='external')s.theme_advanced_toolbar_location='top';t.fullscreenEditor=new tinymce.Editor('mce_fullscreen',s);t.fullscreenEditor.onInit.add(function(){t.fullscreenEditor.setContent(ed.getContent());t.fullscreenEditor.focus();});t.fullscreenEditor.render();tinyMCE.add(t.fullscreenEditor);t.fullscreenElement=new tinymce.dom.Element('mce_fullscreen_container');t.fullscreenElement.update();t.resizeFunc=tinymce.dom.Event.add(DOM.win,'resize',function(){var vp=tinymce.DOM.getViewPort();t.fullscreenEditor.theme.resizeTo(vp.w,vp.h);});}});ed.addButton('fullscreen',{title:'fullscreen.desc',cmd:'mceFullScreen'});ed.onNodeChange.add(function(ed,cm){cm.setActive('fullscreen',ed.getParam('fullscreen_is_enabled'));});},getInfo:function(){return{longname:'Fullscreen',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('fullscreen',tinymce.plugins.FullScreenPlugin);})();
\ No newline at end of file
+(function(){var DOM=tinymce.DOM;tinymce.create('tinymce.plugins.FullScreenPlugin',{init:function(ed,url){var t=this,s={},vp;t.editor=ed;ed.addCommand('mceFullScreen',function(){var win,de=DOM.doc.documentElement;if(ed.getParam('fullscreen_is_enabled')){if(ed.getParam('fullscreen_new_window'))closeFullscreen();else{DOM.win.setTimeout(function(){tinymce.dom.Event.remove(DOM.win,'resize',t.resizeFunc);tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent({format:'raw'}),{format:'raw'});tinyMCE.remove(ed);DOM.remove('mce_fullscreen_container');de.style.overflow=ed.getParam('fullscreen_html_overflow');DOM.setStyle(DOM.doc.body,'overflow',ed.getParam('fullscreen_overflow'));DOM.win.scrollTo(ed.getParam('fullscreen_scrollx'),ed.getParam('fullscreen_scrolly'));tinyMCE.settings=tinyMCE.oldSettings;},10);}return;}if(ed.getParam('fullscreen_new_window')){win=DOM.win.open(url+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{win.resizeTo(screen.availWidth,screen.availHeight);}catch(e){}}else{tinyMCE.oldSettings=tinyMCE.settings;s.fullscreen_overflow=DOM.getStyle(DOM.doc.body,'overflow',1)||'auto';s.fullscreen_html_overflow=DOM.getStyle(de,'overflow',1);vp=DOM.getViewPort();s.fullscreen_scrollx=vp.x;s.fullscreen_scrolly=vp.y;if(tinymce.isOpera&&s.fullscreen_overflow=='visible')s.fullscreen_overflow='auto';if(tinymce.isIE&&s.fullscreen_overflow=='scroll')s.fullscreen_overflow='auto';if(s.fullscreen_overflow=='0px')s.fullscreen_overflow='';DOM.setStyle(DOM.doc.body,'overflow','hidden');de.style.overflow='hidden';vp=DOM.getViewPort();DOM.win.scrollTo(0,0);if(tinymce.isIE)vp.h-=1;n=DOM.add(DOM.doc.body,'div',{id:'mce_fullscreen_container',style:'position:'+(tinymce.isIE6||(tinymce.isIE&&!DOM.boxModel)?'absolute':'fixed')+';top:0;left:0;width:'+vp.w+'px;height:'+vp.h+'px;z-index:200000;'});DOM.add(n,'div',{id:'mce_fullscreen'});tinymce.each(ed.settings,function(v,n){s[n]=v;});s.id='mce_fullscreen';s.width=n.clientWidth;s.height=n.clientHeight-15;s.fullscreen_is_enabled=true;s.fullscreen_editor_id=ed.id;s.theme_advanced_resizing=false;s.save_onsavecallback=function(){ed.setContent(tinyMCE.get(s.id).getContent({format:'raw'}),{format:'raw'});ed.execCommand('mceSave');};tinymce.each(ed.getParam('fullscreen_settings'),function(v,k){s[k]=v;});if(s.theme_advanced_toolbar_location==='external')s.theme_advanced_toolbar_location='top';t.fullscreenEditor=new tinymce.Editor('mce_fullscreen',s);t.fullscreenEditor.onInit.add(function(){t.fullscreenEditor.setContent(ed.getContent());t.fullscreenEditor.focus();});t.fullscreenEditor.render();tinyMCE.add(t.fullscreenEditor);t.fullscreenElement=new tinymce.dom.Element('mce_fullscreen_container');t.fullscreenElement.update();t.resizeFunc=tinymce.dom.Event.add(DOM.win,'resize',function(){var vp=tinymce.DOM.getViewPort();t.fullscreenEditor.theme.resizeTo(vp.w,vp.h);});}});ed.addButton('fullscreen',{title:'fullscreen.desc',cmd:'mceFullScreen'});ed.onNodeChange.add(function(ed,cm){cm.setActive('fullscreen',ed.getParam('fullscreen_is_enabled'));});},getInfo:function(){return{longname:'Fullscreen',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('fullscreen',tinymce.plugins.FullScreenPlugin);})();
\ No newline at end of file
index a18f3967864ff1819132681440fcc132da2d222d..3209e0678e99b452d65fcb0007a9b9fd90e7c98a 100644 (file)
@@ -3,14 +3,14 @@
 <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-       <script type="text/javascript" src="../../tiny_mce.js?v=307"></script>
+       <script type="text/javascript" src="../../tiny_mce.js?ver=311"></script>
        <script type="text/javascript">
                function patchCallback(settings, key) {
                        if (settings[key])
                                settings[key] = "window.opener." + settings[key];
                }
 
-               var settings = {}, paSe = window.opener.tinyMCE.activeEditor.settings;
+               var settings = {}, paSe = window.opener.tinyMCE.activeEditor.settings, oeID = window.opener.tinyMCE.activeEditor.id;
 
                // Clone array
                for (var n in paSe)
                settings['ask'] = false;
                settings['document_base_url'] = window.opener.tinyMCE.activeEditor.documentBaseURI.getURI();
                settings['fullscreen_is_enabled'] = true;
-               settings['fullscreen_editor_id'] = window.opener.tinyMCE.activeEditor.id;
+               settings['fullscreen_editor_id'] = oeID;
                settings['theme_advanced_resizing'] = false;
                settings['strict_loading_mode'] = true;
 
                settings.save_onsavecallback = function() {
-                       window.opener.tinyMCE.activeEditor.setContent(tinyMCE.get('fullscreenarea').getContent({format : 'raw'}), {format : 'raw'});
-                       window.opener.tinyMCE.activeEditor.execCommand('mceSave');
+                       window.opener.tinyMCE.get(oeID).setContent(tinyMCE.get('fullscreenarea').getContent({format : 'raw'}), {format : 'raw'});
+                       window.opener.tinyMCE.get(oeID).execCommand('mceSave');
                        window.close();
                };
 
@@ -56,7 +56,7 @@
                }
 
                function moveContent() {
-                       window.opener.tinyMCE.activeEditor.setContent(tinyMCE.activeEditor.getContent());
+                       window.opener.tinyMCE.get(oeID).setContent(tinyMCE.activeEditor.getContent());
                }
 
                function closeFullscreen() {
@@ -78,7 +78,7 @@
                function render() {
                        var e = document.getElementById('fullscreenarea'), vp, ed, ow, oh, dom = tinymce.DOM;
 
-                       e.value = window.opener.tinyMCE.activeEditor.getContent();
+                       e.value = window.opener.tinyMCE.get(oeID).getContent();
 
                        vp = dom.getViewPort();
                        settings.width = vp.w;
index 0766b49a43a436bb53d4a5f780a735bf7907aca8..3649c8dfac1b0a731bb8540efc5ff9c679323573 100644 (file)
@@ -1 +1 @@
-(function(){var DOM=tinymce.DOM,Element=tinymce.dom.Element,Event=tinymce.dom.Event,each=tinymce.each,is=tinymce.is;tinymce.create('tinymce.plugins.InlinePopups',{init:function(ed,url){ed.onBeforeRenderUI.add(function(){ed.windowManager=new tinymce.InlineWindowManager(ed);DOM.loadCSS(url+'/skins/'+(ed.settings.inlinepopups_skin||'clearlooks2')+"/window.css");});},getInfo:function(){return{longname:'InlinePopups',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.create('tinymce.InlineWindowManager:tinymce.WindowManager',{InlineWindowManager:function(ed){var t=this;t.parent(ed);t.zIndex=300000;t.count=0;},open:function(f,p){var t=this,id,opt='',ed=t.editor,dw=0,dh=0,vp,po,mdf,clf,we,w,u;f=f||{};p=p||{};if(!f.inline)return t.parent(f,p);if(!f.type)t.bookmark=ed.selection.getBookmark('simple');id=DOM.uniqueId();vp=DOM.getViewPort();f.width=parseInt(f.width||320);f.height=parseInt(f.height||240)+(tinymce.isIE?8:0);f.min_width=parseInt(f.min_width||150);f.min_height=parseInt(f.min_height||100);f.max_width=parseInt(f.max_width||2000);f.max_height=parseInt(f.max_height||2000);f.left=f.left||Math.round(Math.max(vp.x,vp.x+(vp.w/ 2.0) - (f.width /2.0)));f.top=f.top||Math.round(Math.max(vp.y,vp.y+(vp.h/ 2.0) - (f.height /2.0)));f.movable=f.resizable=true;p.mce_width=f.width;p.mce_height=f.height;p.mce_inline=true;p.mce_window_id=id;p.mce_auto_focus=f.auto_focus;t.features=f;t.params=p;t.onOpen.dispatch(t,f,p);if(f.type){opt+=' mceModal';if(f.type)opt+=' mce'+f.type.substring(0,1).toUpperCase()+f.type.substring(1);f.resizable=false;}if(f.statusbar)opt+=' mceStatusbar';if(f.resizable)opt+=' mceResizable';if(f.minimizable)opt+=' mceMinimizable';if(f.maximizable)opt+=' mceMaximizable';if(f.movable)opt+=' mceMovable';t._addAll(DOM.doc.body,['div',{id:id,'class':ed.settings.inlinepopups_skin||'clearlooks2',style:'width:100px;height:100px'},['div',{id:id+'_wrapper','class':'mceWrapper'+opt},['div',{id:id+'_top','class':'mceTop'},['div',{'class':'mceLeft'}],['div',{'class':'mceCenter'}],['div',{'class':'mceRight'}],['span',{id:id+'_title'},f.title||'']],['div',{id:id+'_middle','class':'mceMiddle'},['div',{id:id+'_left','class':'mceLeft'}],['span',{id:id+'_content'}],['div',{id:id+'_right','class':'mceRight'}]],['div',{id:id+'_bottom','class':'mceBottom'},['div',{'class':'mceLeft'}],['div',{'class':'mceCenter'}],['div',{'class':'mceRight'}],['span',{id:id+'_status'},'Content']],['a',{'class':'mceMove',tabindex:'-1',href:'javascript:;'}],['a',{'class':'mceMin',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'mceMax',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'mceMed',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'mceClose',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{id:id+'_resize_n','class':'mceResize mceResizeN',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_s','class':'mceResize mceResizeS',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_w','class':'mceResize mceResizeW',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_e','class':'mceResize mceResizeE',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_nw','class':'mceResize mceResizeNW',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_ne','class':'mceResize mceResizeNE',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_sw','class':'mceResize mceResizeSW',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_se','class':'mceResize mceResizeSE',tabindex:'-1',href:'javascript:;'}]]]);DOM.setStyles(id,{top:-10000,left:-10000});if(tinymce.isGecko)DOM.setStyle(id,'overflow','auto');if(!f.type){dw+=DOM.get(id+'_left').clientWidth;dw+=DOM.get(id+'_right').clientWidth;dh+=DOM.get(id+'_top').clientHeight;dh+=DOM.get(id+'_bottom').clientHeight;}DOM.setStyles(id,{top:f.top,left:f.left,width:f.width+dw,height:f.height+dh});u=f.url||f.file;if(u){if(tinymce.relaxedDomain)u+=(u.indexOf('?')==-1?'?':'&')+'mce_rdomain='+tinymce.relaxedDomain;u=tinymce._addVer(u);}if(!f.type){DOM.add(id+'_content','iframe',{id:id+'_ifr',src:'javascript:""',frameBorder:0,style:'border:0;width:10px;height:10px'});DOM.setStyles(id+'_ifr',{width:f.width,height:f.height});DOM.setAttrib(id+'_ifr','src',u);}else{DOM.add(id+'_wrapper','a',{id:id+'_ok','class':'mceButton mceOk',href:'javascript:;',onmousedown:'return false;'},'Ok');if(f.type=='confirm')DOM.add(id+'_wrapper','a',{'class':'mceButton mceCancel',href:'javascript:;',onmousedown:'return false;'},'Cancel');DOM.add(id+'_middle','div',{'class':'mceIcon'});DOM.setHTML(id+'_content',f.content.replace('\n','<br />'));}mdf=Event.add(id,'mousedown',function(e){var n=e.target,w,vp;w=t.windows[id];t.focus(id);if(n.nodeName=='A'||n.nodeName=='a'){if(n.className=='mceMax'){w.oldPos=w.element.getXY();w.oldSize=w.element.getSize();vp=DOM.getViewPort();vp.w-=2;vp.h-=2;w.element.moveTo(vp.x,vp.y);w.element.resizeTo(vp.w,vp.h);DOM.setStyles(id+'_ifr',{width:vp.w-w.deltaWidth,height:vp.h-w.deltaHeight});DOM.addClass(id+'_wrapper','mceMaximized');}else if(n.className=='mceMed'){w.element.moveTo(w.oldPos.x,w.oldPos.y);w.element.resizeTo(w.oldSize.w,w.oldSize.h);w.iframeElement.resizeTo(w.oldSize.w-w.deltaWidth,w.oldSize.h-w.deltaHeight);DOM.removeClass(id+'_wrapper','mceMaximized');}else if(n.className=='mceMove')return t._startDrag(id,e,n.className);else if(DOM.hasClass(n,'mceResize'))return t._startDrag(id,e,n.className.substring(13));}});clf=Event.add(id,'click',function(e){var n=e.target;t.focus(id);if(n.nodeName=='A'||n.nodeName=='a'){switch(n.className){case'mceClose':t.close(null,id);return Event.cancel(e);case'mceButton mceOk':case'mceButton mceCancel':f.button_func(n.className=='mceButton mceOk');return Event.cancel(e);}}});t.windows=t.windows||{};w=t.windows[id]={id:id,mousedown_func:mdf,click_func:clf,element:new Element(id,{blocker:1,container:ed.getContainer()}),iframeElement:new Element(id+'_ifr'),features:f,deltaWidth:dw,deltaHeight:dh};w.iframeElement.on('focus',function(){t.focus(id);});if(t.count==0&&t.editor.getParam('dialog_type')=='modal'){DOM.add(DOM.doc.body,'div',{id:'mceModalBlocker','class':(t.editor.settings.inlinepopups_skin||'clearlooks2')+'_modalBlocker',style:{left:vp.x,top:vp.y,zIndex:t.zIndex-1}});DOM.show('mceModalBlocker');}else DOM.setStyle('mceModalBlocker','z-index',t.zIndex-1);t.focus(id);t._fixIELayout(id,1);if(DOM.get(id+'_ok'))DOM.get(id+'_ok').focus();t.count++;return w;},focus:function(id){var t=this,w=t.windows[id];w.zIndex=this.zIndex++;w.element.setStyle('zIndex',w.zIndex);w.element.update();id=id+'_wrapper';DOM.removeClass(t.lastId,'mceFocus');DOM.addClass(id,'mceFocus');t.lastId=id;},_addAll:function(te,ne){var i,n,t=this,dom=tinymce.DOM;if(is(ne,'string'))te.appendChild(dom.doc.createTextNode(ne));else if(ne.length){te=te.appendChild(dom.create(ne[0],ne[1]));for(i=2;i<ne.length;i++)t._addAll(te,ne[i]);}},_startDrag:function(id,se,ac){var t=this,mu,mm,d=DOM.doc,eb,w=t.windows[id],we=w.element,sp=we.getXY(),p,sz,ph,cp,vp,sx,sy,sex,sey,dx,dy,dw,dh;cp={x:0,y:0};vp=DOM.getViewPort();vp.w-=2;vp.h-=2;sex=se.screenX;sey=se.screenY;dx=dy=dw=dh=0;mu=Event.add(d,'mouseup',function(e){Event.remove(d,'mouseup',mu);Event.remove(d,'mousemove',mm);if(eb)eb.remove();we.moveBy(dx,dy);we.resizeBy(dw,dh);sz=we.getSize();DOM.setStyles(id+'_ifr',{width:sz.w-w.deltaWidth,height:sz.h-w.deltaHeight});t._fixIELayout(id,1);return Event.cancel(e);});if(ac!='Move')startMove();function startMove(){if(eb)return;t._fixIELayout(id,0);DOM.add(d.body,'div',{id:'mceEventBlocker','class':'mceEventBlocker '+(t.editor.settings.inlinepopups_skin||'clearlooks2'),style:{left:vp.x,top:vp.y,zIndex:t.zIndex+1}});eb=new Element('mceEventBlocker');eb.update();p=we.getXY();sz=we.getSize();sx=cp.x+p.x-vp.x;sy=cp.y+p.y-vp.y;DOM.add(eb.get(),'div',{id:'mcePlaceHolder','class':'mcePlaceHolder',style:{left:sx,top:sy,width:sz.w,height:sz.h}});ph=new Element('mcePlaceHolder');};mm=Event.add(d,'mousemove',function(e){var x,y,v;startMove();x=e.screenX-sex;y=e.screenY-sey;switch(ac){case'ResizeW':dx=x;dw=0-x;break;case'ResizeE':dw=x;break;case'ResizeN':case'ResizeNW':case'ResizeNE':if(ac=="ResizeNW"){dx=x;dw=0-x;}else if(ac=="ResizeNE")dw=x;dy=y;dh=0-y;break;case'ResizeS':case'ResizeSW':case'ResizeSE':if(ac=="ResizeSW"){dx=x;dw=0-x;}else if(ac=="ResizeSE")dw=x;dh=y;break;case'mceMove':dx=x;dy=y;break;}if(dw<(v=w.features.min_width-sz.w)){if(dx!==0)dx+=dw-v;dw=v;}if(dh<(v=w.features.min_height-sz.h)){if(dy!==0)dy+=dh-v;dh=v;}dw=Math.min(dw,w.features.max_width-sz.w);dh=Math.min(dh,w.features.max_height-sz.h);dx=Math.max(dx,vp.x-(sx+vp.x));dy=Math.max(dy,vp.y-(sy+vp.y));dx=Math.min(dx,(vp.w+vp.x)-(sx+sz.w+vp.x));dy=Math.min(dy,(vp.h+vp.y)-(sy+sz.h+vp.y));if(dx+dy!==0){if(sx+dx<0)dx=0;if(sy+dy<0)dy=0;ph.moveTo(sx+dx,sy+dy);}if(dw+dh!==0)ph.resizeTo(sz.w+dw,sz.h+dh);return Event.cancel(e);});return Event.cancel(se);},resizeBy:function(dw,dh,id){var w=this.windows[id];if(w){w.element.resizeBy(dw,dh);w.iframeElement.resizeBy(dw,dh);}},close:function(win,id){var t=this,w,d=DOM.doc,ix=0,fw;t.count--;if(t.count==0)DOM.remove('mceModalBlocker');if(!id&&win){t.parent(win);return;}if(w=t.windows[id]){t.onClose.dispatch(t);Event.remove(d,'mousedown',w.mousedownFunc);Event.remove(d,'click',w.clickFunc);Event.clear(id);Event.clear(id+'_ifr');DOM.setAttrib(id+'_ifr','src','javascript:""');w.element.remove();delete t.windows[id];each(t.windows,function(w){if(w.zIndex>ix){fw=w;ix=w.zIndex;}});if(fw)t.focus(fw.id);}},setTitle:function(ti,id){var e;if(e=DOM.get(id+'_title'))e.innerHTML=DOM.encode(ti);},alert:function(txt,cb,s){var t=this,w;w=t.open({title:t,type:'alert',button_func:function(s){if(cb)cb.call(s||t,s);t.close(null,w.id);},content:DOM.encode(t.editor.getLang(txt,txt)),inline:1,width:400,height:130});},confirm:function(txt,cb,s){var t=this,w;w=t.open({title:t,type:'confirm',button_func:function(s){if(cb)cb.call(s||t,s);t.close(null,w.id);},content:DOM.encode(t.editor.getLang(txt,txt)),inline:1,width:400,height:130});},_fixIELayout:function(id,s){var w,img;if(!tinymce.isIE6)return;each(['n','s','w','e','nw','ne','sw','se'],function(v){var e=DOM.get(id+'_resize_'+v);DOM.setStyles(e,{width:s?e.clientWidth:'',height:s?e.clientHeight:'',cursor:DOM.getStyle(e,'cursor',1)});DOM.setStyle(id+"_bottom",'bottom','-1px');e=0;});if(w=this.windows[id]){w.element.hide();w.element.show();each(DOM.select('div,a',id),function(e,i){if(e.currentStyle.backgroundImage!='none'){img=new Image();img.src=e.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/,'$1');}});DOM.get(id).style.filter='';}}});tinymce.PluginManager.add('inlinepopups',tinymce.plugins.InlinePopups);})();
\ No newline at end of file
+(function(){var DOM=tinymce.DOM,Element=tinymce.dom.Element,Event=tinymce.dom.Event,each=tinymce.each,is=tinymce.is;tinymce.create('tinymce.plugins.InlinePopups',{init:function(ed,url){ed.onBeforeRenderUI.add(function(){ed.windowManager=new tinymce.InlineWindowManager(ed);DOM.loadCSS(url+'/skins/'+(ed.settings.inlinepopups_skin||'clearlooks2')+"/window.css");});},getInfo:function(){return{longname:'InlinePopups',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.create('tinymce.InlineWindowManager:tinymce.WindowManager',{InlineWindowManager:function(ed){var t=this;t.parent(ed);t.zIndex=300000;t.count=0;},open:function(f,p){var t=this,id,opt='',ed=t.editor,dw=0,dh=0,vp,po,mdf,clf,we,w,u;f=f||{};p=p||{};if(!f.inline)return t.parent(f,p);if(!f.type)t.bookmark=ed.selection.getBookmark('simple');id=DOM.uniqueId();vp=DOM.getViewPort();f.width=parseInt(f.width||320);f.height=parseInt(f.height||240)+(tinymce.isIE?8:0);f.min_width=parseInt(f.min_width||150);f.min_height=parseInt(f.min_height||100);f.max_width=parseInt(f.max_width||2000);f.max_height=parseInt(f.max_height||2000);f.left=f.left||Math.round(Math.max(vp.x,vp.x+(vp.w/ 2.0) - (f.width /2.0)));f.top=f.top||Math.round(Math.max(vp.y,vp.y+(vp.h/ 2.0) - (f.height /2.0)));f.movable=f.resizable=true;p.mce_width=f.width;p.mce_height=f.height;p.mce_inline=true;p.mce_window_id=id;p.mce_auto_focus=f.auto_focus;t.features=f;t.params=p;t.onOpen.dispatch(t,f,p);if(f.type){opt+=' mceModal';if(f.type)opt+=' mce'+f.type.substring(0,1).toUpperCase()+f.type.substring(1);f.resizable=false;}if(f.statusbar)opt+=' mceStatusbar';if(f.resizable)opt+=' mceResizable';if(f.minimizable)opt+=' mceMinimizable';if(f.maximizable)opt+=' mceMaximizable';if(f.movable)opt+=' mceMovable';t._addAll(DOM.doc.body,['div',{id:id,'class':ed.settings.inlinepopups_skin||'clearlooks2',style:'width:100px;height:100px'},['div',{id:id+'_wrapper','class':'mceWrapper'+opt},['div',{id:id+'_top','class':'mceTop'},['div',{'class':'mceLeft'}],['div',{'class':'mceCenter'}],['div',{'class':'mceRight'}],['span',{id:id+'_title'},f.title||'']],['div',{id:id+'_middle','class':'mceMiddle'},['div',{id:id+'_left','class':'mceLeft'}],['span',{id:id+'_content'}],['div',{id:id+'_right','class':'mceRight'}]],['div',{id:id+'_bottom','class':'mceBottom'},['div',{'class':'mceLeft'}],['div',{'class':'mceCenter'}],['div',{'class':'mceRight'}],['span',{id:id+'_status'},'Content']],['a',{'class':'mceMove',tabindex:'-1',href:'javascript:;'}],['a',{'class':'mceMin',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'mceMax',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'mceMed',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'mceClose',tabindex:'-1',href:'javascript:;',onmousedown:'return false;'}],['a',{id:id+'_resize_n','class':'mceResize mceResizeN',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_s','class':'mceResize mceResizeS',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_w','class':'mceResize mceResizeW',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_e','class':'mceResize mceResizeE',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_nw','class':'mceResize mceResizeNW',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_ne','class':'mceResize mceResizeNE',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_sw','class':'mceResize mceResizeSW',tabindex:'-1',href:'javascript:;'}],['a',{id:id+'_resize_se','class':'mceResize mceResizeSE',tabindex:'-1',href:'javascript:;'}]]]);DOM.setStyles(id,{top:-10000,left:-10000});if(tinymce.isGecko)DOM.setStyle(id,'overflow','auto');if(!f.type){dw+=DOM.get(id+'_left').clientWidth;dw+=DOM.get(id+'_right').clientWidth;dh+=DOM.get(id+'_top').clientHeight;dh+=DOM.get(id+'_bottom').clientHeight;}DOM.setStyles(id,{top:f.top,left:f.left,width:f.width+dw,height:f.height+dh});u=f.url||f.file;if(u){if(tinymce.relaxedDomain)u+=(u.indexOf('?')==-1?'?':'&')+'mce_rdomain='+tinymce.relaxedDomain;u=tinymce._addVer(u);}if(!f.type){DOM.add(id+'_content','iframe',{id:id+'_ifr',src:'javascript:""',frameBorder:0,style:'border:0;width:10px;height:10px'});DOM.setStyles(id+'_ifr',{width:f.width,height:f.height});DOM.setAttrib(id+'_ifr','src',u);}else{DOM.add(id+'_wrapper','a',{id:id+'_ok','class':'mceButton mceOk',href:'javascript:;',onmousedown:'return false;'},'Ok');if(f.type=='confirm')DOM.add(id+'_wrapper','a',{'class':'mceButton mceCancel',href:'javascript:;',onmousedown:'return false;'},'Cancel');DOM.add(id+'_middle','div',{'class':'mceIcon'});DOM.setHTML(id+'_content',f.content.replace('\n','<br />'));}mdf=Event.add(id,'mousedown',function(e){var n=e.target,w,vp;w=t.windows[id];t.focus(id);if(n.nodeName=='A'||n.nodeName=='a'){if(n.className=='mceMax'){w.oldPos=w.element.getXY();w.oldSize=w.element.getSize();vp=DOM.getViewPort();vp.w-=2;vp.h-=2;w.element.moveTo(vp.x,vp.y);w.element.resizeTo(vp.w,vp.h);DOM.setStyles(id+'_ifr',{width:vp.w-w.deltaWidth,height:vp.h-w.deltaHeight});DOM.addClass(id+'_wrapper','mceMaximized');}else if(n.className=='mceMed'){w.element.moveTo(w.oldPos.x,w.oldPos.y);w.element.resizeTo(w.oldSize.w,w.oldSize.h);w.iframeElement.resizeTo(w.oldSize.w-w.deltaWidth,w.oldSize.h-w.deltaHeight);DOM.removeClass(id+'_wrapper','mceMaximized');}else if(n.className=='mceMove')return t._startDrag(id,e,n.className);else if(DOM.hasClass(n,'mceResize'))return t._startDrag(id,e,n.className.substring(13));}});clf=Event.add(id,'click',function(e){var n=e.target;t.focus(id);if(n.nodeName=='A'||n.nodeName=='a'){switch(n.className){case'mceClose':t.close(null,id);return Event.cancel(e);case'mceButton mceOk':case'mceButton mceCancel':f.button_func(n.className=='mceButton mceOk');return Event.cancel(e);}}});t.windows=t.windows||{};w=t.windows[id]={id:id,mousedown_func:mdf,click_func:clf,element:new Element(id,{blocker:1,container:ed.getContainer()}),iframeElement:new Element(id+'_ifr'),features:f,deltaWidth:dw,deltaHeight:dh};w.iframeElement.on('focus',function(){t.focus(id);});if(t.count==0&&t.editor.getParam('dialog_type')=='modal'){DOM.add(DOM.doc.body,'div',{id:'mceModalBlocker','class':(t.editor.settings.inlinepopups_skin||'clearlooks2')+'_modalBlocker',style:{left:vp.x,top:vp.y,zIndex:t.zIndex-1}});DOM.show('mceModalBlocker');}else DOM.setStyle('mceModalBlocker','z-index',t.zIndex-1);if(tinymce.isIE6||(tinymce.isIE&&!DOM.boxModel))DOM.setStyles('mceModalBlocker',{position:'absolute',width:vp.w-2,height:vp.h-2});t.focus(id);t._fixIELayout(id,1);if(DOM.get(id+'_ok'))DOM.get(id+'_ok').focus();t.count++;return w;},focus:function(id){var t=this,w=t.windows[id];w.zIndex=this.zIndex++;w.element.setStyle('zIndex',w.zIndex);w.element.update();id=id+'_wrapper';DOM.removeClass(t.lastId,'mceFocus');DOM.addClass(id,'mceFocus');t.lastId=id;},_addAll:function(te,ne){var i,n,t=this,dom=tinymce.DOM;if(is(ne,'string'))te.appendChild(dom.doc.createTextNode(ne));else if(ne.length){te=te.appendChild(dom.create(ne[0],ne[1]));for(i=2;i<ne.length;i++)t._addAll(te,ne[i]);}},_startDrag:function(id,se,ac){var t=this,mu,mm,d=DOM.doc,eb,w=t.windows[id],we=w.element,sp=we.getXY(),p,sz,ph,cp,vp,sx,sy,sex,sey,dx,dy,dw,dh;cp={x:0,y:0};vp=DOM.getViewPort();vp.w-=2;vp.h-=2;sex=se.screenX;sey=se.screenY;dx=dy=dw=dh=0;mu=Event.add(d,'mouseup',function(e){Event.remove(d,'mouseup',mu);Event.remove(d,'mousemove',mm);if(eb)eb.remove();we.moveBy(dx,dy);we.resizeBy(dw,dh);sz=we.getSize();DOM.setStyles(id+'_ifr',{width:sz.w-w.deltaWidth,height:sz.h-w.deltaHeight});t._fixIELayout(id,1);return Event.cancel(e);});if(ac!='Move')startMove();function startMove(){if(eb)return;t._fixIELayout(id,0);DOM.add(d.body,'div',{id:'mceEventBlocker','class':'mceEventBlocker '+(t.editor.settings.inlinepopups_skin||'clearlooks2'),style:{left:vp.x,top:vp.y,zIndex:t.zIndex+1}});if(tinymce.isIE6||(tinymce.isIE&&!DOM.boxModel))DOM.setStyles('mceEventBlocker',{position:'absolute',width:vp.w-2,height:vp.h-2});eb=new Element('mceEventBlocker');eb.update();p=we.getXY();sz=we.getSize();sx=cp.x+p.x-vp.x;sy=cp.y+p.y-vp.y;DOM.add(eb.get(),'div',{id:'mcePlaceHolder','class':'mcePlaceHolder',style:{left:sx,top:sy,width:sz.w,height:sz.h}});ph=new Element('mcePlaceHolder');};mm=Event.add(d,'mousemove',function(e){var x,y,v;startMove();x=e.screenX-sex;y=e.screenY-sey;switch(ac){case'ResizeW':dx=x;dw=0-x;break;case'ResizeE':dw=x;break;case'ResizeN':case'ResizeNW':case'ResizeNE':if(ac=="ResizeNW"){dx=x;dw=0-x;}else if(ac=="ResizeNE")dw=x;dy=y;dh=0-y;break;case'ResizeS':case'ResizeSW':case'ResizeSE':if(ac=="ResizeSW"){dx=x;dw=0-x;}else if(ac=="ResizeSE")dw=x;dh=y;break;case'mceMove':dx=x;dy=y;break;}if(dw<(v=w.features.min_width-sz.w)){if(dx!==0)dx+=dw-v;dw=v;}if(dh<(v=w.features.min_height-sz.h)){if(dy!==0)dy+=dh-v;dh=v;}dw=Math.min(dw,w.features.max_width-sz.w);dh=Math.min(dh,w.features.max_height-sz.h);dx=Math.max(dx,vp.x-(sx+vp.x));dy=Math.max(dy,vp.y-(sy+vp.y));dx=Math.min(dx,(vp.w+vp.x)-(sx+sz.w+vp.x));dy=Math.min(dy,(vp.h+vp.y)-(sy+sz.h+vp.y));if(dx+dy!==0){if(sx+dx<0)dx=0;if(sy+dy<0)dy=0;ph.moveTo(sx+dx,sy+dy);}if(dw+dh!==0)ph.resizeTo(sz.w+dw,sz.h+dh);return Event.cancel(e);});return Event.cancel(se);},resizeBy:function(dw,dh,id){var w=this.windows[id];if(w){w.element.resizeBy(dw,dh);w.iframeElement.resizeBy(dw,dh);}},close:function(win,id){var t=this,w,d=DOM.doc,ix=0,fw,id;id=t._findId(id||win);t.count--;if(t.count==0)DOM.remove('mceModalBlocker');if(!id&&win){t.parent(win);return;}if(w=t.windows[id]){t.onClose.dispatch(t);Event.remove(d,'mousedown',w.mousedownFunc);Event.remove(d,'click',w.clickFunc);Event.clear(id);Event.clear(id+'_ifr');DOM.setAttrib(id+'_ifr','src','javascript:""');w.element.remove();delete t.windows[id];each(t.windows,function(w){if(w.zIndex>ix){fw=w;ix=w.zIndex;}});if(fw)t.focus(fw.id);}},setTitle:function(w,ti){var e;w=this._findId(w);if(e=DOM.get(w+'_title'))e.innerHTML=DOM.encode(ti);},alert:function(txt,cb,s){var t=this,w;w=t.open({title:t,type:'alert',button_func:function(s){if(cb)cb.call(s||t,s);t.close(null,w.id);},content:DOM.encode(t.editor.getLang(txt,txt)),inline:1,width:400,height:130});},confirm:function(txt,cb,s){var t=this,w;w=t.open({title:t,type:'confirm',button_func:function(s){if(cb)cb.call(s||t,s);t.close(null,w.id);},content:DOM.encode(t.editor.getLang(txt,txt)),inline:1,width:400,height:130});},_findId:function(w){var t=this;if(typeof(w)=='string')return w;each(t.windows,function(wo){var ifr=DOM.get(wo.id+'_ifr');if(ifr&&w==ifr.contentWindow){w=wo.id;return false;}});return w;},_fixIELayout:function(id,s){var w,img;if(!tinymce.isIE6)return;each(['n','s','w','e','nw','ne','sw','se'],function(v){var e=DOM.get(id+'_resize_'+v);DOM.setStyles(e,{width:s?e.clientWidth:'',height:s?e.clientHeight:'',cursor:DOM.getStyle(e,'cursor',1)});DOM.setStyle(id+"_bottom",'bottom','-1px');e=0;});if(w=this.windows[id]){w.element.hide();w.element.show();each(DOM.select('div,a',id),function(e,i){if(e.currentStyle.backgroundImage!='none'){img=new Image();img.src=e.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/,'$1');}});DOM.get(id).style.filter='';}}});tinymce.PluginManager.add('inlinepopups',tinymce.plugins.InlinePopups);})();
\ No newline at end of file
index 8fe667e5d1fe908bef9435488db4eaaa0ef8e38b..8c25ceb1d38ba1ac2c5046919a9dfeb0bab19c72 100644 (file)
@@ -2,7 +2,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <title>Template for dialogs</title>
-<link rel="stylesheet" type="text/css" href="skins/clearlooks2/window.css?v=307" />
+<link rel="stylesheet" type="text/css" href="skins/clearlooks2/window.css?ver=311" />
 </head>
 <body>
 
index 62d666a5f83bc5d8cc31d0b0b514526501fdce70..7b2253ba3da626aab91401db88051bf77bfc34fd 100644 (file)
@@ -1,68 +1,16 @@
-#id, #name, #hspace, #vspace, #class_name, #align {
-       width: 100px;
-}
-
-#hspace, #vspace {
-       width: 50px;
-}
-
-#flash_quality, #flash_align, #flash_scale, #flash_salign, #flash_wmode {
-       width: 100px;
-}
-
-#flash_base, #flash_flashvars {
-       width: 240px;
-}
-
-#width, #height {
-       width: 40px;
-}
-
-#src, #media_type {
-       width: 250px;
-}
-
-#class {
-       width: 120px;
-}
-
-#prev {
-       margin: 0;
-       border: 1px solid black;
-       width: 99%;
-       height: 230px;
-       overflow: auto;
-}
-
-.panel_wrapper div.current {
-       height: 390px;
-       overflow: auto;
-}
-
-#flash_options, #shockwave_options, #qt_options, #wmp_options, #rmp_options {
-       display: none;
-}
-
-.mceAddSelectValue {
-       background-color: #DDDDDD;
-}
-
-#qt_starttime, #qt_endtime, #qt_fov, #qt_href, #qt_moveid, #qt_moviename, #qt_node, #qt_pan, #qt_qtsrc, #qt_qtsrcchokespeed, #qt_target, #qt_tilt, #qt_urlsubstituten, #qt_volume {
-       width: 70px;
-}
-
-#wmp_balance, #wmp_baseurl, #wmp_captioningid, #wmp_currentmarker, #wmp_currentposition, #wmp_defaultframe, #wmp_playcount, #wmp_rate, #wmp_uimode, #wmp_volume {
-       width: 70px;
-}
-
-#rmp_console, #rmp_numloop, #rmp_controls, #rmp_scriptcallbacks {
-       width: 70px;
-}
-
-#shockwave_swvolume, #shockwave_swframe, #shockwave_swurl, #shockwave_swstretchvalign, #shockwave_swstretchhalign, #shockwave_swstretchstyle {
-       width: 90px;
-}
-
-#qt_qtsrc {
-       width: 200px;
-}
+#id, #name, #hspace, #vspace, #class_name, #align {    width: 100px }
+#hspace, #vspace { width: 50px }
+#flash_quality, #flash_align, #flash_scale, #flash_salign, #flash_wmode { width: 100px }
+#flash_base, #flash_flashvars { width: 240px }
+#width, #height { width: 40px }
+#src, #media_type { width: 250px }
+#class { width: 120px }
+#prev { margin: 0; border: 1px solid black; width: 380px; height: 230px; overflow: auto }
+.panel_wrapper div.current { height: 390px; overflow: auto }
+#flash_options, #shockwave_options, #qt_options, #wmp_options, #rmp_options { display: none }
+.mceAddSelectValue { background-color: #DDDDDD }
+#qt_starttime, #qt_endtime, #qt_fov, #qt_href, #qt_moveid, #qt_moviename, #qt_node, #qt_pan, #qt_qtsrc, #qt_qtsrcchokespeed, #qt_target, #qt_tilt, #qt_urlsubstituten, #qt_volume { width: 70px }
+#wmp_balance, #wmp_baseurl, #wmp_captioningid, #wmp_currentmarker, #wmp_currentposition, #wmp_defaultframe, #wmp_playcount, #wmp_rate, #wmp_uimode, #wmp_volume { width: 70px }
+#rmp_console, #rmp_numloop, #rmp_controls, #rmp_scriptcallbacks { width: 70px }
+#shockwave_swvolume, #shockwave_swframe, #shockwave_swurl, #shockwave_swstretchvalign, #shockwave_swstretchhalign, #shockwave_swstretchstyle { width: 90px }
+#qt_qtsrc { width: 200px }
index 4591be7a475a69807c3eefba445c51fdb7e0e33e..4ee35492ee70e92b0cd0d50a1d0de62318a12711 100644 (file)
@@ -1 +1 @@
-(function(){var each=tinymce.each;tinymce.create('tinymce.plugins.MediaPlugin',{init:function(ed,url){var t=this;t.editor=ed;t.url=url;function isMediaElm(n){return/^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className);};ed.addCommand('mceMedia',function(){ed.windowManager.open({file:url+'/media.htm',width:430+parseInt(ed.getLang('media.delta_width',0)),height:470+parseInt(ed.getLang('media.delta_height',0)),inline:1},{plugin_url:url});});ed.addButton('media',{title:'media.desc',cmd:'mceMedia'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('media',n.nodeName=='IMG'&&isMediaElm(n));});ed.onInit.add(function(){var lo={mceItemFlash:'flash',mceItemShockWave:'shockwave',mceItemWindowsMedia:'windowsmedia',mceItemQuickTime:'quicktime',mceItemRealMedia:'realmedia'};if(ed.settings.content_css!==false)ed.dom.loadCSS(url+"/css/content.css");if(ed.theme.onResolveName){ed.theme.onResolveName.add(function(th,o){if(o.name=='img'){each(lo,function(v,k){if(ed.dom.hasClass(o.node,k)){o.name=v;o.title=ed.dom.getAttrib(o.node,'title');return false;}});}});}if(ed&&ed.plugins.contextmenu){ed.plugins.contextmenu.onContextMenu.add(function(th,m,e){if(e.nodeName=='IMG'&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(e.className)){m.add({title:'media.edit',icon:'media',cmd:'mceMedia'});}});}});ed.onBeforeSetContent.add(function(ed,o){var h=o.content;h=h.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi,function(a,b,c){var o=t._parse(c);return'<img class="mceItem'+b+'" title="'+ed.dom.encode(c)+'" src="'+url+'/img/trans.gif" width="'+o.width+'" height="'+o.height+'" />'});h=h.replace(/<object([^>]*)>/gi,'<span class="mceItemObject" $1>');h=h.replace(/<embed([^>]*)>/gi,'<span class="mceItemEmbed" $1>');h=h.replace(/<\/(object|embed)([^>]*)>/gi,'</span>');h=h.replace(/<param([^>]*)>/gi,function(a,b){return'<span '+b.replace(/value=/gi,'_value=')+' class="mceItemParam"></span>'});h=h.replace(/\/ class=\"mceItemParam\"><\/span>/gi,'class="mceItemParam"></span>');o.content=h;});ed.onSetContent.add(function(){t._spansToImgs(ed.getBody());});ed.onPreProcess.add(function(ed,o){var dom=ed.dom;if(o.set){t._spansToImgs(o.node);each(dom.select('IMG',o.node),function(n){var p;if(isMediaElm(n)){p=t._parse(n.title);dom.setAttrib(n,'width',dom.getAttrib(n,'width',p.width||100));dom.setAttrib(n,'height',dom.getAttrib(n,'height',p.height||100));}});}if(o.get){each(dom.select('IMG',o.node),function(n){var ci,cb,mt;if(ed.getParam('media_use_script')){if(isMediaElm(n))n.className=n.className.replace(/mceItem/g,'mceTemp');return;}switch(n.className){case'mceItemFlash':ci='d27cdb6e-ae6d-11cf-96b8-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='application/x-shockwave-flash';break;case'mceItemShockWave':ci='166b1bca-3f9c-11cf-8075-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';mt='application/x-director';break;case'mceItemWindowsMedia':ci=ed.getParam('media_wmp6_compatible')?'05589fa1-c356-11ce-bf01-00aa0055595a':'6bf52a52-394a-11d3-b153-00c04f79faa6';cb='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';mt='application/x-mplayer2';break;case'mceItemQuickTime':ci='02bf25d5-8c17-4b23-bc80-d3488abddc6b';cb='http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';mt='video/quicktime';break;case'mceItemRealMedia':ci='cfcdaa03-8be4-11cf-b84b-0020afbbccfa';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='audio/x-pn-realaudio-plugin';break;}if(ci){dom.replace(t._buildObj({classid:ci,codebase:cb,type:mt},n),n);}});}});ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/_value=/g,'value=');});if(ed.getParam('media_use_script')){function getAttr(s,n){n=new RegExp(n+'=\"([^\"]+)\"','g').exec(s);return n?ed.dom.decode(n[1]):'';};ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/<img[^>]+>/g,function(im){var cl=getAttr(im,'class');if(/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(cl)){at=t._parse(getAttr(im,'title'));at.width=getAttr(im,'width');at.height=getAttr(im,'height');im='<script type="text/javascript">write'+cl.substring(7)+'({'+t._serialize(at)+'});</script>';}return im;});});}},getInfo:function(){return{longname:'Media',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_buildObj:function(o,n){var ob,ed=this.editor,dom=ed.dom,p=this._parse(n.title);p.width=o.width=dom.getAttrib(n,'width')||100;p.height=o.height=dom.getAttrib(n,'height')||100;ob=dom.create('span',{mce_name:'object',classid:"clsid:"+o.classid,codebase:o.codebase,width:o.width,height:o.height});if(p.src)p.src=ed.convertURL(p.src,'src',n);each(p,function(v,k){if(!/^(width|height|codebase|classid)$/.test(k)){if(o.type=='application/x-mplayer2'&&k=='src')k='url';dom.add(ob,'span',{mce_name:'param',name:k,'_value':v});}});dom.add(ob,'span',tinymce.extend({mce_name:'embed',type:o.type},p));return ob;},_spansToImgs:function(p){var t=this,dom=t.editor.dom,im,ci;each(dom.select('span',p),function(n){if(dom.getAttrib(n,'class')=='mceItemObject'){ci=dom.getAttrib(n,"classid").toLowerCase().replace(/\s+/g,'');switch(ci){case'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':dom.replace(t._createImg('mceItemFlash',n),n);break;case'clsid:166b1bca-3f9c-11cf-8075-444553540000':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':case'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':case'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}return;}if(dom.getAttrib(n,'class')=='mceItemEmbed'){switch(dom.getAttrib(n,'type')){case'application/x-shockwave-flash':dom.replace(t._createImg('mceItemFlash',n),n);break;case'application/x-director':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'application/x-mplayer2':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'video/quicktime':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'audio/x-pn-realaudio-plugin':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}}});},_createImg:function(cl,n){var im,dom=this.editor.dom,pa={},ti='';im=dom.create('img',{src:this.url+'/img/trans.gif',width:dom.getAttrib(n,'width')||100,height:dom.getAttrib(n,'height')||100,'class':cl});each(['id','name','width','height','bgcolor','align','flashvars','src','wmode'],function(na){var v=dom.getAttrib(n,na);if(v)pa[na]=v;});each(dom.select('span',n),function(n){if(dom.hasClass(n,'mceItemParam'))pa[dom.getAttrib(n,'name')]=dom.getAttrib(n,'_value');});if(pa.movie){pa.src=pa.movie;delete pa.movie;}delete pa.width;delete pa.height;im.title=this._serialize(pa);return im;},_parse:function(s){return tinymce.util.JSON.parse('{'+s+'}');},_serialize:function(o){return tinymce.util.JSON.serialize(o).replace(/[{}]/g,'');}});tinymce.PluginManager.add('media',tinymce.plugins.MediaPlugin);})();
\ No newline at end of file
+(function(){var each=tinymce.each;tinymce.create('tinymce.plugins.MediaPlugin',{init:function(ed,url){var t=this;t.editor=ed;t.url=url;function isMediaElm(n){return/^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className);};ed.onPreInit.add(function(){ed.serializer.addRules('param[name|value|_value]');});ed.addCommand('mceMedia',function(){ed.windowManager.open({file:url+'/media.htm',width:430+parseInt(ed.getLang('media.delta_width',0)),height:470+parseInt(ed.getLang('media.delta_height',0)),inline:1},{plugin_url:url});});ed.addButton('media',{title:'media.desc',cmd:'mceMedia'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('media',n.nodeName=='IMG'&&isMediaElm(n));});ed.onInit.add(function(){var lo={mceItemFlash:'flash',mceItemShockWave:'shockwave',mceItemWindowsMedia:'windowsmedia',mceItemQuickTime:'quicktime',mceItemRealMedia:'realmedia'};if(ed.settings.content_css!==false)ed.dom.loadCSS(url+"/css/content.css");if(ed.theme.onResolveName){ed.theme.onResolveName.add(function(th,o){if(o.name=='img'){each(lo,function(v,k){if(ed.dom.hasClass(o.node,k)){o.name=v;o.title=ed.dom.getAttrib(o.node,'title');return false;}});}});}if(ed&&ed.plugins.contextmenu){ed.plugins.contextmenu.onContextMenu.add(function(th,m,e){if(e.nodeName=='IMG'&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(e.className)){m.add({title:'media.edit',icon:'media',cmd:'mceMedia'});}});}});ed.onBeforeSetContent.add(function(ed,o){var h=o.content;h=h.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi,function(a,b,c){var o=t._parse(c);return'<img class="mceItem'+b+'" title="'+ed.dom.encode(c)+'" src="'+url+'/img/trans.gif" width="'+o.width+'" height="'+o.height+'" />'});h=h.replace(/<object([^>]*)>/gi,'<span class="mceItemObject" $1>');h=h.replace(/<embed([^>]*)\/?>/gi,'<span class="mceItemEmbed" $1></span>');h=h.replace(/<embed([^>]*)>/gi,'<span class="mceItemEmbed" $1>');h=h.replace(/<\/(object)([^>]*)>/gi,'</span>');h=h.replace(/<\/embed>/gi,'');h=h.replace(/<param([^>]*)>/gi,function(a,b){return'<span '+b.replace(/value=/gi,'_value=')+' class="mceItemParam"></span>'});h=h.replace(/\/ class=\"mceItemParam\"><\/span>/gi,'class="mceItemParam"></span>');o.content=h;});ed.onSetContent.add(function(){t._spansToImgs(ed.getBody());});ed.onPreProcess.add(function(ed,o){var dom=ed.dom;if(o.set){t._spansToImgs(o.node);each(dom.select('IMG',o.node),function(n){var p;if(isMediaElm(n)){p=t._parse(n.title);dom.setAttrib(n,'width',dom.getAttrib(n,'width',p.width||100));dom.setAttrib(n,'height',dom.getAttrib(n,'height',p.height||100));}});}if(o.get){each(dom.select('IMG',o.node),function(n){var ci,cb,mt;if(ed.getParam('media_use_script')){if(isMediaElm(n))n.className=n.className.replace(/mceItem/g,'mceTemp');return;}switch(n.className){case'mceItemFlash':ci='d27cdb6e-ae6d-11cf-96b8-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='application/x-shockwave-flash';break;case'mceItemShockWave':ci='166b1bca-3f9c-11cf-8075-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';mt='application/x-director';break;case'mceItemWindowsMedia':ci=ed.getParam('media_wmp6_compatible')?'05589fa1-c356-11ce-bf01-00aa0055595a':'6bf52a52-394a-11d3-b153-00c04f79faa6';cb='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';mt='application/x-mplayer2';break;case'mceItemQuickTime':ci='02bf25d5-8c17-4b23-bc80-d3488abddc6b';cb='http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';mt='video/quicktime';break;case'mceItemRealMedia':ci='cfcdaa03-8be4-11cf-b84b-0020afbbccfa';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='audio/x-pn-realaudio-plugin';break;}if(ci){dom.replace(t._buildObj({classid:ci,codebase:cb,type:mt},n),n);}});}});ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/_value=/g,'value=');});if(ed.getParam('media_use_script')){function getAttr(s,n){n=new RegExp(n+'=\"([^\"]+)\"','g').exec(s);return n?ed.dom.decode(n[1]):'';};ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/<img[^>]+>/g,function(im){var cl=getAttr(im,'class');if(/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(cl)){at=t._parse(getAttr(im,'title'));at.width=getAttr(im,'width');at.height=getAttr(im,'height');im='<script type="text/javascript">write'+cl.substring(7)+'({'+t._serialize(at)+'});</script>';}return im;});});}},getInfo:function(){return{longname:'Media',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_buildObj:function(o,n){var ob,ed=this.editor,dom=ed.dom,p=this._parse(n.title);p.width=o.width=dom.getAttrib(n,'width')||100;p.height=o.height=dom.getAttrib(n,'height')||100;ob=dom.create('span',{mce_name:'object',classid:"clsid:"+o.classid,codebase:o.codebase,width:o.width,height:o.height});if(p.src)p.src=ed.convertURL(p.src,'src',n);each(p,function(v,k){if(!/^(width|height|codebase|classid)$/.test(k)){if(o.type=='application/x-mplayer2'&&k=='src')k='url';dom.add(ob,'span',{mce_name:'param',name:k,'_value':v});}});dom.add(ob,'span',tinymce.extend({mce_name:'embed',type:o.type},p));return ob;},_spansToImgs:function(p){var t=this,dom=t.editor.dom,im,ci;each(dom.select('span',p),function(n){if(dom.getAttrib(n,'class')=='mceItemObject'){ci=dom.getAttrib(n,"classid").toLowerCase().replace(/\s+/g,'');switch(ci){case'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':dom.replace(t._createImg('mceItemFlash',n),n);break;case'clsid:166b1bca-3f9c-11cf-8075-444553540000':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':case'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':case'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}return;}if(dom.getAttrib(n,'class')=='mceItemEmbed'){switch(dom.getAttrib(n,'type')){case'application/x-shockwave-flash':dom.replace(t._createImg('mceItemFlash',n),n);break;case'application/x-director':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'application/x-mplayer2':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'video/quicktime':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'audio/x-pn-realaudio-plugin':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}}});},_createImg:function(cl,n){var im,dom=this.editor.dom,pa={},ti='';im=dom.create('img',{src:this.url+'/img/trans.gif',width:dom.getAttrib(n,'width')||100,height:dom.getAttrib(n,'height')||100,'class':cl});each(['id','name','width','height','bgcolor','align','flashvars','src','wmode'],function(na){var v=dom.getAttrib(n,na);if(v)pa[na]=v;});each(dom.select('span',n),function(n){if(dom.hasClass(n,'mceItemParam'))pa[dom.getAttrib(n,'name')]=dom.getAttrib(n,'_value');});if(pa.movie){pa.src=pa.movie;delete pa.movie;}delete pa.width;delete pa.height;im.title=this._serialize(pa);return im;},_parse:function(s){return tinymce.util.JSON.parse('{'+s+'}');},_serialize:function(o){return tinymce.util.JSON.serialize(o).replace(/[{}]/g,'');}});tinymce.PluginManager.add('media',tinymce.plugins.MediaPlugin);})();
\ No newline at end of file
index 58d2fafb7343a0763a51cbd7602c5a8678963c2d..0f0cfd6448b81ed229523999263604f6cad6d2d1 100644 (file)
@@ -598,14 +598,17 @@ function generatePreview(c) {
        pl.name = !pl.name ? 'eobj' : pl.name;
        pl.align = !pl.align ? '' : pl.align;
 
-       h += '<object classid="clsid:' + cls + '" codebase="' + codebase + '" width="' + pl.width + '" height="' + pl.height + '" id="' + pl.id + '" name="' + pl.name + '" align="' + pl.align + '">';
+       // Avoid annoying warning about insecure items
+       if (!tinymce.isIE || document.location.protocol != 'https:') {
+               h += '<object classid="clsid:' + cls + '" codebase="' + codebase + '" width="' + pl.width + '" height="' + pl.height + '" id="' + pl.id + '" name="' + pl.name + '" align="' + pl.align + '">';
 
-       for (n in pl) {
-               h += '<param name="' + n + '" value="' + pl[n] + '">';
+               for (n in pl) {
+                       h += '<param name="' + n + '" value="' + pl[n] + '">';
 
-               // Add extra url parameter if it's an absolute URL
-               if (n == 'src' && pl[n].indexOf('://') != -1)
-                       h += '<param name="url" value="' + pl[n] + '" />';
+                       // Add extra url parameter if it's an absolute URL
+                       if (n == 'src' && pl[n].indexOf('://') != -1)
+                               h += '<param name="url" value="' + pl[n] + '" />';
+               }
        }
 
        h += '<embed type="' + type + '" ';
@@ -613,7 +616,11 @@ function generatePreview(c) {
        for (n in pl)
                h += n + '="' + pl[n] + '" ';
 
-       h += '></embed></object>';
+       h += '></embed>';
+
+       // Avoid annoying warning about insecure items
+       if (!tinymce.isIE || document.location.protocol != 'https:')
+               h += '</object>';
 
        p.innerHTML = "<!-- x --->" + h;
 }
index 69d9e77fcd0a29fbcb814322ac2d1e2a58af2021..a663cbef1aec31682293602b4ba5c6a6c4a055cf 100644 (file)
@@ -2,13 +2,13 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
        <title>{#media_dlg.title}</title>
-       <script type="text/javascript" src="../../tiny_mce_popup.js?v=307"></script>
-       <script type="text/javascript" src="js/media.js?v=307"></script>
-       <script type="text/javascript" src="../../utils/mctabs.js?v=307"></script>
-       <script type="text/javascript" src="../../utils/validate.js?v=307"></script>
-       <script type="text/javascript" src="../../utils/form_utils.js?v=307"></script>
-       <script type="text/javascript" src="../../utils/editable_selects.js?v=307"></script>
-       <link href="css/media.css?v=307" rel="stylesheet" type="text/css" />
+       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=311"></script>
+       <script type="text/javascript" src="js/media.js?ver=311"></script>
+       <script type="text/javascript" src="../../utils/mctabs.js?ver=311"></script>
+       <script type="text/javascript" src="../../utils/validate.js?ver=311"></script>
+       <script type="text/javascript" src="../../utils/form_utils.js?ver=311"></script>
+       <script type="text/javascript" src="../../utils/editable_selects.js?ver=311"></script>
+       <link href="css/media.css?ver=311" rel="stylesheet" type="text/css" />
        <base target="_self" />
 </head>
 <body style="display: none">
index 59c8c651cc68f9e0d706af03352f1156ff09f63e..0db61aa4e6105b32fade171d79f3c1e77adfe8b6 100644 (file)
@@ -2,7 +2,7 @@
 <head>
 <title>blank_page</title>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<link href="css/blank.css?v=307" rel="stylesheet" type="text/css" />
+<link href="css/blank.css?ver=311" rel="stylesheet" type="text/css" />
 <base target="_self" />
 <script type="text/javascript">
 function init() {
index b317ed2c19cbf6fe2d9ee1daa2c49f9e09224f82..4a35002b46e34c0ebbfd2cba8964c1ebb1c6b44a 100644 (file)
@@ -1 +1 @@
-(function(){var Event=tinymce.dom.Event;tinymce.create('tinymce.plugins.PastePlugin',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mcePasteText',function(ui,v){if(ui){if((ed.getParam('paste_use_dialog',true))||(!tinymce.isIE)){ed.windowManager.open({file:url+'/pastetext.htm',width:450,height:400,inline:1},{plugin_url:url});}else t._insertText(clipboardData.getData("Text"),true);}else t._insertText(v.html,v.linebreaks);});ed.addCommand('mcePasteWord',function(ui,v){if(ui){if((ed.getParam('paste_use_dialog',true))||(!tinymce.isIE)){ed.windowManager.open({file:url+'/pasteword.htm',width:450,height:400,inline:1},{plugin_url:url});}else t._insertText(t._clipboardHTML());}else t._insertWordContent(v);});ed.addCommand('mceSelectAll',function(){ed.execCommand('selectall');});ed.addButton('pastetext',{title:'paste.paste_text_desc',cmd:'mcePasteText',ui:true});ed.addButton('pasteword',{title:'paste.paste_word_desc',cmd:'mcePasteWord',ui:true});ed.addButton('selectall',{title:'paste.selectall_desc',cmd:'mceSelectAll'});if(ed.getParam("paste_auto_cleanup_on_paste",false)){ed.onPaste.add(function(ed,e){return t._handlePasteEvent(e)});}if(!tinymce.isIE&&ed.getParam("paste_auto_cleanup_on_paste",false)){ed.onKeyDown.add(function(ed,e){if(e.ctrlKey&&e.keyCode==86){window.setTimeout(function(){ed.execCommand("mcePasteText",true);},1);Event.cancel(e);}});}},getInfo:function(){return{longname:'Paste text/word',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_handlePasteEvent:function(e){var html=this._clipboardHTML(),ed=this.editor,sel=ed.selection,r;if(ed&&(r=sel.getRng())&&r.text.length>0)ed.execCommand('delete');if(html&&html.length>0)ed.execCommand('mcePasteWord',false,html);return Event.cancel(e);},_insertText:function(content,bLinebreaks){if(content&&content.length>0){if(bLinebreaks){if(this.editor.getParam("paste_create_paragraphs",true)){var rl=this.editor.getParam("paste_replace_list",'\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i<rl.length;i+=2)content=content.replace(new RegExp(rl[i],'gi'),rl[i+1]);content=content.replace(/\r\n\r\n/g,'</p><p>');content=content.replace(/\r\r/g,'</p><p>');content=content.replace(/\n\n/g,'</p><p>');if((pos=content.indexOf('</p><p>'))!=-1){this.editor.execCommand("Delete");var node=this.editor.selection.getNode();var breakElms=[];do{if(node.nodeType==1){if(node.nodeName=="TD"||node.nodeName=="BODY")break;breakElms[breakElms.length]=node;}}while(node=node.parentNode);var before="",after="</p>";before+=content.substring(0,pos);for(var i=0;i<breakElms.length;i++){before+="</"+breakElms[i].nodeName+">";after+="<"+breakElms[(breakElms.length-1)-i].nodeName+">";}before+="<p>";content=before+content.substring(pos+7)+after;}}if(this.editor.getParam("paste_create_linebreaks",true)){content=content.replace(/\r\n/g,'<br />');content=content.replace(/\r/g,'<br />');content=content.replace(/\n/g,'<br />');}}this.editor.execCommand("mceInsertRawHTML",false,content);}},_insertWordContent:function(content){var t=this,ed=t.editor;if(content&&content.length>0){var bull=String.fromCharCode(8226);var middot=String.fromCharCode(183);if(ed.getParam('paste_insert_word_content_callback'))content=ed.execCallback('paste_insert_word_content_callback','before',content);var rl=ed.getParam("paste_replace_list",'\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i<rl.length;i+=2)content=content.replace(new RegExp(rl[i],'gi'),rl[i+1]);if(this.editor.getParam("paste_convert_headers_to_strong",false)){content=content.replace(new RegExp('<p class=MsoHeading.*?>(.*?)<\/p>','gi'),'<p><b>$1</b></p>');}content=content.replace(new RegExp('tab-stops: list [0-9]+.0pt">','gi'),'">'+"--list--");content=content.replace(new RegExp(bull+"(.*?)<BR>","gi"),"<p>"+middot+"$1</p>");content=content.replace(new RegExp('<SPAN style="mso-list: Ignore">','gi'),"<span>"+bull);content=content.replace(/<o:p><\/o:p>/gi,"");content=content.replace(new RegExp('<br style="page-break-before: always;.*>','gi'),'-- page break --');content=content.replace(new RegExp('<(!--)([^>]*)(--)>','g'),"");if(this.editor.getParam("paste_remove_spans",true))content=content.replace(/<\/?span[^>]*>/gi,"");if(this.editor.getParam("paste_remove_styles",true))content=content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)','gi'),"<$1$3");content=content.replace(/<\/?font[^>]*>/gi,"");switch(this.editor.getParam("paste_strip_class_attributes","all")){case"all":content=content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi,"<$1$3");break;case"mso":content=content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)','gi'),"<$1$3");break;}content=content.replace(new RegExp('href="?'+this._reEscape(""+document.location)+'','gi'),'href="'+this.editor.documentBaseURI.getURI());content=content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi,"<$1$3");content=content.replace(/<\\?\?xml[^>]*>/gi,"");content=content.replace(/<\/?\w+:[^>]*>/gi,"");content=content.replace(/-- page break --\s*<p>&nbsp;<\/p>/gi,"");content=content.replace(/-- page break --/gi,"");if(!this.editor.getParam('force_p_newlines')){content=content.replace('','','gi');content=content.replace('</p>','<br /><br />','gi');}if(!tinymce.isIE&&!this.editor.getParam('force_p_newlines')){content=content.replace(/<\/?p[^>]*>/gi,"");}content=content.replace(/<\/?div[^>]*>/gi,"");if(this.editor.getParam("paste_convert_middot_lists",true)){var div=ed.dom.create("div",null,content);var className=this.editor.getParam("paste_unindented_list_class","unIndentedList");while(this._convertMiddots(div,"--list--"));while(this._convertMiddots(div,middot,className));while(this._convertMiddots(div,bull));content=div.innerHTML;}if(this.editor.getParam("paste_convert_headers_to_strong",false)){content=content.replace(/<h[1-6]>&nbsp;<\/h[1-6]>/gi,'<p>&nbsp;&nbsp;</p>');content=content.replace(/<h[1-6]>/gi,'<p><b>');content=content.replace(/<\/h[1-6]>/gi,'</b></p>');content=content.replace(/<b>&nbsp;<\/b>/gi,'<b>&nbsp;&nbsp;</b>');content=content.replace(/^(&nbsp;)*/gi,'');}content=content.replace(/--list--/gi,"");if(ed.getParam('paste_insert_word_content_callback'))content=ed.execCallback('paste_insert_word_content_callback','after',content);this.editor.execCommand("mceInsertContent",false,content);if(this.editor.getParam('paste_force_cleanup_wordpaste',true)){var ed=this.editor;window.setTimeout(function(){ed.execCommand("mceCleanup");},1);}}},_reEscape:function(s){var l="?.\\*[](){}+^$:";var o="";for(var i=0;i<s.length;i++){var c=s.charAt(i);if(l.indexOf(c)!=-1)o+='\\'+c;else o+=c;}return o;},_convertMiddots:function(div,search,class_name){var ed=this.editor,mdot=String.fromCharCode(183),bull=String.fromCharCode(8226);var nodes,prevul,i,p,ul,li,np,cp,li;nodes=div.getElementsByTagName("p");for(i=0;i<nodes.length;i++){p=nodes[i];if(p.innerHTML.indexOf(search)==0){ul=ed.dom.create("ul");if(class_name)ul.className=class_name;li=ed.dom.create("li");li.innerHTML=p.innerHTML.replace(new RegExp(''+mdot+'|'+bull+'|--list--|&nbsp;',"gi"),'');ul.appendChild(li);np=p.nextSibling;while(np){if(np.nodeType==3&&new RegExp('^\\s$','m').test(np.nodeValue)){np=np.nextSibling;continue;}if(search==mdot){if(np.nodeType==1&&new RegExp('^o(\\s+|&nbsp;)').test(np.innerHTML)){if(!prevul){prevul=ul;ul=ed.dom.create("ul");prevul.appendChild(ul);}np.innerHTML=np.innerHTML.replace(/^o/,'');}else{if(prevul){ul=prevul;prevul=null;}if(np.nodeType!=1||np.innerHTML.indexOf(search)!=0)break;}}else{if(np.nodeType!=1||np.innerHTML.indexOf(search)!=0)break;}cp=np.nextSibling;li=ed.dom.create("li");li.innerHTML=np.innerHTML.replace(new RegExp(''+mdot+'|'+bull+'|--list--|&nbsp;',"gi"),'');np.parentNode.removeChild(np);ul.appendChild(li);np=cp;}p.parentNode.replaceChild(ul,p);return true;}}return false;},_clipboardHTML:function(){var div=document.getElementById('_TinyMCE_clipboardHTML');if(!div){var div=document.createElement('DIV');div.id='_TinyMCE_clipboardHTML';with(div.style){visibility='hidden';overflow='hidden';position='absolute';width=1;height=1;}document.body.appendChild(div);}div.innerHTML='';var rng=document.body.createTextRange();rng.moveToElementText(div);rng.execCommand('Paste');var html=div.innerHTML;div.innerHTML='';return html;}});tinymce.PluginManager.add('paste',tinymce.plugins.PastePlugin);})();
\ No newline at end of file
+(function(){var Event=tinymce.dom.Event;tinymce.create('tinymce.plugins.PastePlugin',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mcePasteText',function(ui,v){if(ui){if((ed.getParam('paste_use_dialog',true))||(!tinymce.isIE)){ed.windowManager.open({file:url+'/pastetext.htm',width:450,height:400,inline:1},{plugin_url:url});}else t._insertText(clipboardData.getData("Text"),true);}else t._insertText(v.html,v.linebreaks);});ed.addCommand('mcePasteWord',function(ui,v){if(ui){if((ed.getParam('paste_use_dialog',true))||(!tinymce.isIE)){ed.windowManager.open({file:url+'/pasteword.htm',width:450,height:400,inline:1},{plugin_url:url});}else t._insertText(t._clipboardHTML());}else t._insertWordContent(v);});ed.addCommand('mceSelectAll',function(){ed.execCommand('selectall');});ed.addButton('pastetext',{title:'paste.paste_text_desc',cmd:'mcePasteText',ui:true});ed.addButton('pasteword',{title:'paste.paste_word_desc',cmd:'mcePasteWord',ui:true});ed.addButton('selectall',{title:'paste.selectall_desc',cmd:'mceSelectAll'});if(ed.getParam("paste_auto_cleanup_on_paste",false)){ed.onPaste.add(function(ed,e){return t._handlePasteEvent(e)});}if(!tinymce.isIE&&ed.getParam("paste_auto_cleanup_on_paste",false)){ed.onKeyDown.add(function(ed,e){if(e.ctrlKey&&e.keyCode==86){window.setTimeout(function(){ed.execCommand("mcePasteText",true);},1);Event.cancel(e);}});}},getInfo:function(){return{longname:'Paste text/word',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_handlePasteEvent:function(e){var html=this._clipboardHTML(),ed=this.editor,sel=ed.selection,r;if(ed&&(r=sel.getRng())&&r.text.length>0)ed.execCommand('delete');if(html&&html.length>0)ed.execCommand('mcePasteWord',false,html);return Event.cancel(e);},_insertText:function(content,bLinebreaks){content=this.editor.dom.encode(content);if(content&&content.length>0){if(bLinebreaks){if(this.editor.getParam("paste_create_paragraphs",true)){var rl=this.editor.getParam("paste_replace_list",'\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i<rl.length;i+=2)content=content.replace(new RegExp(rl[i],'gi'),rl[i+1]);content=content.replace(/\r\n\r\n/g,'</p><p>');content=content.replace(/\r\r/g,'</p><p>');content=content.replace(/\n\n/g,'</p><p>');if((pos=content.indexOf('</p><p>'))!=-1){this.editor.execCommand("Delete");var node=this.editor.selection.getNode();var breakElms=[];do{if(node.nodeType==1){if(node.nodeName=="TD"||node.nodeName=="BODY")break;breakElms[breakElms.length]=node;}}while(node=node.parentNode);var before="",after="</p>";before+=content.substring(0,pos);for(var i=0;i<breakElms.length;i++){before+="</"+breakElms[i].nodeName+">";after+="<"+breakElms[(breakElms.length-1)-i].nodeName+">";}before+="<p>";content=before+content.substring(pos+7)+after;}}if(this.editor.getParam("paste_create_linebreaks",true)){content=content.replace(/\r\n/g,'<br />');content=content.replace(/\r/g,'<br />');content=content.replace(/\n/g,'<br />');}}this.editor.execCommand("mceInsertRawHTML",false,content);}},_insertWordContent:function(content){var t=this,ed=t.editor;if(content&&content.length>0){var bull=String.fromCharCode(8226);var middot=String.fromCharCode(183);if(ed.getParam('paste_insert_word_content_callback'))content=ed.execCallback('paste_insert_word_content_callback','before',content);var rl=ed.getParam("paste_replace_list",'\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i<rl.length;i+=2)content=content.replace(new RegExp(rl[i],'gi'),rl[i+1]);if(this.editor.getParam("paste_convert_headers_to_strong",false)){content=content.replace(new RegExp('<p class=MsoHeading.*?>(.*?)<\/p>','gi'),'<p><b>$1</b></p>');}content=content.replace(new RegExp('tab-stops: list [0-9]+.0pt">','gi'),'">'+"--list--");content=content.replace(new RegExp(bull+"(.*?)<BR>","gi"),"<p>"+middot+"$1</p>");content=content.replace(new RegExp('<SPAN style="mso-list: Ignore">','gi'),"<span>"+bull);content=content.replace(/<o:p><\/o:p>/gi,"");content=content.replace(new RegExp('<br style="page-break-before: always;.*>','gi'),'-- page break --');content=content.replace(new RegExp('<(!--)([^>]*)(--)>','g'),"");if(this.editor.getParam("paste_remove_spans",true))content=content.replace(/<\/?span[^>]*>/gi,"");if(this.editor.getParam("paste_remove_styles",true))content=content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)','gi'),"<$1$3");content=content.replace(/<\/?font[^>]*>/gi,"");switch(this.editor.getParam("paste_strip_class_attributes","all")){case"all":content=content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi,"<$1$3");break;case"mso":content=content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)','gi'),"<$1$3");break;}content=content.replace(new RegExp('href="?'+this._reEscape(""+document.location)+'','gi'),'href="'+this.editor.documentBaseURI.getURI());content=content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi,"<$1$3");content=content.replace(/<\\?\?xml[^>]*>/gi,"");content=content.replace(/<\/?\w+:[^>]*>/gi,"");content=content.replace(/-- page break --\s*<p>&nbsp;<\/p>/gi,"");content=content.replace(/-- page break --/gi,"");if(!this.editor.getParam('force_p_newlines')){content=content.replace('','','gi');content=content.replace('</p>','<br /><br />','gi');}if(!tinymce.isIE&&!this.editor.getParam('force_p_newlines')){content=content.replace(/<\/?p[^>]*>/gi,"");}content=content.replace(/<\/?div[^>]*>/gi,"");if(this.editor.getParam("paste_convert_middot_lists",true)){var div=ed.dom.create("div",null,content);var className=this.editor.getParam("paste_unindented_list_class","unIndentedList");while(this._convertMiddots(div,"--list--"));while(this._convertMiddots(div,middot,className));while(this._convertMiddots(div,bull));content=div.innerHTML;}if(this.editor.getParam("paste_convert_headers_to_strong",false)){content=content.replace(/<h[1-6]>&nbsp;<\/h[1-6]>/gi,'<p>&nbsp;&nbsp;</p>');content=content.replace(/<h[1-6]>/gi,'<p><b>');content=content.replace(/<\/h[1-6]>/gi,'</b></p>');content=content.replace(/<b>&nbsp;<\/b>/gi,'<b>&nbsp;&nbsp;</b>');content=content.replace(/^(&nbsp;)*/gi,'');}content=content.replace(/--list--/gi,"");if(ed.getParam('paste_insert_word_content_callback'))content=ed.execCallback('paste_insert_word_content_callback','after',content);this.editor.execCommand("mceInsertContent",false,content);if(this.editor.getParam('paste_force_cleanup_wordpaste',true)){var ed=this.editor;window.setTimeout(function(){ed.execCommand("mceCleanup");},1);}}},_reEscape:function(s){var l="?.\\*[](){}+^$:";var o="";for(var i=0;i<s.length;i++){var c=s.charAt(i);if(l.indexOf(c)!=-1)o+='\\'+c;else o+=c;}return o;},_convertMiddots:function(div,search,class_name){var ed=this.editor,mdot=String.fromCharCode(183),bull=String.fromCharCode(8226);var nodes,prevul,i,p,ul,li,np,cp,li;nodes=div.getElementsByTagName("p");for(i=0;i<nodes.length;i++){p=nodes[i];if(p.innerHTML.indexOf(search)==0){ul=ed.dom.create("ul");if(class_name)ul.className=class_name;li=ed.dom.create("li");li.innerHTML=p.innerHTML.replace(new RegExp(''+mdot+'|'+bull+'|--list--|&nbsp;',"gi"),'');ul.appendChild(li);np=p.nextSibling;while(np){if(np.nodeType==3&&new RegExp('^\\s$','m').test(np.nodeValue)){np=np.nextSibling;continue;}if(search==mdot){if(np.nodeType==1&&new RegExp('^o(\\s+|&nbsp;)').test(np.innerHTML)){if(!prevul){prevul=ul;ul=ed.dom.create("ul");prevul.appendChild(ul);}np.innerHTML=np.innerHTML.replace(/^o/,'');}else{if(prevul){ul=prevul;prevul=null;}if(np.nodeType!=1||np.innerHTML.indexOf(search)!=0)break;}}else{if(np.nodeType!=1||np.innerHTML.indexOf(search)!=0)break;}cp=np.nextSibling;li=ed.dom.create("li");li.innerHTML=np.innerHTML.replace(new RegExp(''+mdot+'|'+bull+'|--list--|&nbsp;',"gi"),'');np.parentNode.removeChild(np);ul.appendChild(li);np=cp;}p.parentNode.replaceChild(ul,p);return true;}}return false;},_clipboardHTML:function(){var div=document.getElementById('_TinyMCE_clipboardHTML');if(!div){var div=document.createElement('DIV');div.id='_TinyMCE_clipboardHTML';with(div.style){visibility='hidden';overflow='hidden';position='absolute';width=1;height=1;}document.body.appendChild(div);}div.innerHTML='';var rng=document.body.createTextRange();rng.moveToElementText(div);rng.execCommand('Paste');var html=div.innerHTML;div.innerHTML='';return html;}});tinymce.PluginManager.add('paste',tinymce.plugins.PastePlugin);})();
\ No newline at end of file
index f60aff1d54b1c1179522142c5d2e20e81771e06a..010961594d29f7e54a737d6b79e974feae0e12c3 100644 (file)
@@ -2,8 +2,8 @@
 <head>
        <title>{#paste.paste_text_desc}</title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-       <script type="text/javascript" src="../../tiny_mce_popup.js?v=307"></script>
-       <script type="text/javascript" src="js/pastetext.js?v=307"></script>
+       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=311"></script>
+       <script type="text/javascript" src="js/pastetext.js?ver=311"></script>
        <base target="_self" />
 </head>
 <body onresize="resizeInputs();" style="display:none; overflow:hidden;">
index d3c53e54f52cead7c4d75a86009d6fbffed0858e..99c0348bbc404a2452fc8d00cbac60420586f9ed 100644 (file)
@@ -2,9 +2,9 @@
 <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>{#paste.paste_word_desc}</title>
-       <script type="text/javascript" src="../../tiny_mce_popup.js?v=307"></script>
-       <script type="text/javascript" src="js/pasteword.js?v=307"></script>
-       <link href="css/pasteword.css?v=307" rel="stylesheet" type="text/css" />
+       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=311"></script>
+       <script type="text/javascript" src="js/pasteword.js?ver=311"></script>
+       <link href="css/pasteword.css?ver=311" rel="stylesheet" type="text/css" />
        <base target="_self" />
 </head>
 <body onresize="resizeInputs();" style="display:none; overflow:hidden;">
index f722c2f14f9354418bbc27346548775e0bc5f52f..332b0e70218adb5c54d24b4b6d8d381341bab6d1 100644 (file)
@@ -1 +1 @@
-(function(){var Event=tinymce.dom.Event,grep=tinymce.grep,each=tinymce.each,inArray=tinymce.inArray,isOldWebKit=tinymce.isOldWebKit;tinymce.create('tinymce.plugins.Safari',{init:function(ed){var t=this,dom;if(!tinymce.isWebKit)return;t.editor=ed;t.webKitFontSizes=['x-small','small','medium','large','x-large','xx-large','-webkit-xxx-large'];t.namedFontSizes=['xx-small','x-small','small','medium','large','x-large','xx-large'];ed.onPaste.add(function(ed,e){function removeStyles(e){e=e.target;if(e.nodeType==1){e.style.cssText='';each(ed.dom.select('*',e),function(e){e.style.cssText='';});}};Event.add(ed.getDoc(),'DOMNodeInserted',removeStyles);window.setTimeout(function(){Event.remove(ed.getDoc(),'DOMNodeInserted',removeStyles);},0);});ed.onKeyUp.add(function(ed,e){var h,b;if(e.keyCode==46||e.keyCode==8){b=ed.getBody();h=b.innerHTML;if(b.childNodes.length==1&&!/<(img|hr)/.test(h)&&tinymce.trim(h.replace(/<[^>]+>/g,'')).length==0)ed.setContent('',{format:'raw'});}});ed.addCommand('FormatBlock',function(u,v){var dom=ed.dom,e=dom.getParent(ed.selection.getNode(),dom.isBlock);if(e)dom.replace(dom.create(v),e,1);else ed.getDoc().execCommand("FormatBlock",false,v);});ed.addCommand('mceInsertContent',function(u,v){ed.getDoc().execCommand("InsertText",false,'mce_marker');ed.getBody().innerHTML=ed.getBody().innerHTML.replace(/mce_marker/g,v+'<span id="_mce_tmp">XX</span>');ed.selection.select(ed.dom.get('_mce_tmp'));ed.getDoc().execCommand("Delete",false,' ');});ed.onKeyPress.add(function(ed,e){if(e.keyCode==13&&(e.shiftKey||ed.settings.force_br_newlines&&ed.selection.getNode().nodeName!='LI')){t._insertBR(ed);Event.cancel(e);}});ed.addQueryValueHandler('FontSize',function(u,v){var e,v;if((e=ed.dom.getParent(ed.selection.getStart(),'span'))&&(v=e.style.fontSize))return tinymce.inArray(t.namedFontSizes,v)+1;if((e=ed.dom.getParent(ed.selection.getEnd(),'span'))&&(v=e.style.fontSize))return tinymce.inArray(t.namedFontSizes,v)+1;return ed.getDoc().queryCommandValue('FontSize');});ed.addQueryValueHandler('FontName',function(u,v){var e,v;if((e=ed.dom.getParent(ed.selection.getStart(),'span'))&&(v=e.style.fontFamily))return v.replace(/, /g,',');if((e=ed.dom.getParent(ed.selection.getEnd(),'span'))&&(v=e.style.fontFamily))return v.replace(/, /g,',');return ed.getDoc().queryCommandValue('FontName');});ed.onClick.add(function(ed,e){e=e.target;if(e.nodeName=='IMG'){t.selElm=e;ed.selection.select(e);}else t.selElm=null;});ed.onInit.add(function(){t._fixWebKitSpans();if(isOldWebKit)t._patchSafari2x(ed);});ed.onSetContent.add(function(){dom=ed.dom;each(['strong','b','em','u','strike','sub','sup','a'],function(v){each(grep(dom.select(v)).reverse(),function(n){var nn=n.nodeName.toLowerCase(),st;if(nn=='a'){if(n.name)dom.replace(dom.create('img',{mce_name:'a',name:n.name,'class':'mceItemAnchor'}),n);return;}switch(nn){case'b':case'strong':if(nn=='b')nn='strong';st='font-weight: bold;';break;case'em':st='font-style: italic;';break;case'u':st='text-decoration: underline;';break;case'sub':st='vertical-align: sub;';break;case'sup':st='vertical-align: super;';break;case'strike':st='text-decoration: line-through;';break;}dom.replace(dom.create('span',{mce_name:nn,style:st,'class':'Apple-style-span'}),n,1);});});});ed.onPreProcess.add(function(ed,o){dom=ed.dom;each(grep(o.node.getElementsByTagName('span')).reverse(),function(n){var v,bg;if(o.get){if(dom.hasClass(n,'Apple-style-span')){bg=n.style.backgroundColor;switch(dom.getAttrib(n,'mce_name')){case'font':if(!ed.settings.convert_fonts_to_spans)dom.setAttrib(n,'style','');break;case'strong':case'em':case'sub':case'sup':dom.setAttrib(n,'style','');break;case'strike':case'u':if(!ed.settings.inline_styles)dom.setAttrib(n,'style','');else dom.setAttrib(n,'mce_name','');break;default:if(!ed.settings.inline_styles)dom.setAttrib(n,'style','');}if(bg)n.style.backgroundColor=bg;}}if(dom.hasClass(n,'mceItemRemoved'))dom.remove(n,1);});});ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/<br \/><\/(h[1-6]|div|p|address|pre)>/g,'</$1>');o.content=o.content.replace(/ id=\"undefined\"/g,'');});},getInfo:function(){return{longname:'Safari compatibility',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/safari',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_fixWebKitSpans:function(){var t=this,ed=t.editor;if(!isOldWebKit){Event.add(ed.getDoc(),'DOMNodeInserted',function(e){e=e.target;if(e&&e.nodeType==1)t._fixAppleSpan(e);});}else{ed.onExecCommand.add(function(){each(ed.dom.select('span'),function(n){t._fixAppleSpan(n);});ed.nodeChanged();});}},_fixAppleSpan:function(e){var ed=this.editor,dom=ed.dom,fz=this.webKitFontSizes,fzn=this.namedFontSizes,s=ed.settings,st,p;if(dom.getAttrib(e,'mce_fixed'))return;if(e.nodeName=='SPAN'&&e.className=='Apple-style-span'){st=e.style;if(!s.convert_fonts_to_spans){if(st.fontSize){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'size',inArray(fz,st.fontSize)+1);}if(st.fontFamily){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'face',st.fontFamily);}if(st.color){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'color',dom.toHex(st.color));}if(st.backgroundColor){dom.setAttrib(e,'mce_name','font');dom.setStyle(e,'background-color',st.backgroundColor);}}else{if(st.fontSize)dom.setStyle(e,'fontSize',fzn[inArray(fz,st.fontSize)]);}if(st.fontWeight=='bold')dom.setAttrib(e,'mce_name','strong');if(st.fontStyle=='italic')dom.setAttrib(e,'mce_name','em');if(st.textDecoration=='underline')dom.setAttrib(e,'mce_name','u');if(st.textDecoration=='line-through')dom.setAttrib(e,'mce_name','strike');if(st.verticalAlign=='super')dom.setAttrib(e,'mce_name','sup');if(st.verticalAlign=='sub')dom.setAttrib(e,'mce_name','sub');dom.setAttrib(e,'mce_fixed','1');}},_patchSafari2x:function(ed){var t=this,setContent,getNode,dom=ed.dom,lr;if(ed.windowManager.onBeforeOpen){ed.windowManager.onBeforeOpen.add(function(){r=ed.selection.getRng();});}ed.selection.select=function(n){this.getSel().setBaseAndExtent(n,0,n,1);};getNode=ed.selection.getNode;ed.selection.getNode=function(){return t.selElm||getNode.call(this);};ed.selection.getRng=function(){var t=this,s=t.getSel(),d=ed.getDoc(),r,rb,ra,di;if(s.anchorNode){r=d.createRange();try{rb=d.createRange();rb.setStart(s.anchorNode,s.anchorOffset);rb.collapse(1);ra=d.createRange();ra.setStart(s.focusNode,s.focusOffset);ra.collapse(1);di=rb.compareBoundaryPoints(rb.START_TO_END,ra)<0;r.setStart(di?s.anchorNode:s.focusNode,di?s.anchorOffset:s.focusOffset);r.setEnd(di?s.focusNode:s.anchorNode,di?s.focusOffset:s.anchorOffset);lr=r;}catch(ex){}}return r||lr;};setContent=ed.selection.setContent;ed.selection.setContent=function(h,s){var r=this.getRng(),b;try{setContent.call(this,h,s);}catch(ex){b=dom.create('body');b.innerHTML=h;each(b.childNodes,function(n){r.insertNode(n.cloneNode(true));});}};},_insertBR:function(ed){var dom=ed.dom,s=ed.selection,r=s.getRng(),br;r.insertNode(br=dom.create('br'));r.setStartAfter(br);r.setEndAfter(br);s.setRng(r);if(s.getSel().focusNode==br.previousSibling){s.select(dom.insertAfter(dom.doc.createTextNode('\u00a0'),br));s.collapse(1);}ed.getWin().scrollTo(0,dom.getPos(s.getRng().startContainer).y);}});tinymce.PluginManager.add('safari',tinymce.plugins.Safari);})();
\ No newline at end of file
+(function(){var Event=tinymce.dom.Event,grep=tinymce.grep,each=tinymce.each,inArray=tinymce.inArray,isOldWebKit=tinymce.isOldWebKit;tinymce.create('tinymce.plugins.Safari',{init:function(ed){var t=this,dom;if(!tinymce.isWebKit)return;t.editor=ed;t.webKitFontSizes=['x-small','small','medium','large','x-large','xx-large','-webkit-xxx-large'];t.namedFontSizes=['xx-small','x-small','small','medium','large','x-large','xx-large'];ed.addCommand('CreateLink',function(u,v){var n=ed.selection.getNode(),dom=ed.dom,a;if(n&&(/^(left|right)$/i.test(dom.getStyle(n,'float',1))||/^(left|right)$/i.test(dom.getAttrib(n,'align')))){a=dom.create('a',{href:v},n.cloneNode());n.parentNode.replaceChild(a,n);ed.selection.select(a);}else ed.getDoc().execCommand("CreateLink",false,v);});ed.onPaste.add(function(ed,e){function removeStyles(e){e=e.target;if(e.nodeType==1){e.style.cssText='';each(ed.dom.select('*',e),function(e){e.style.cssText='';});}};Event.add(ed.getDoc(),'DOMNodeInserted',removeStyles);window.setTimeout(function(){Event.remove(ed.getDoc(),'DOMNodeInserted',removeStyles);},0);});ed.onKeyUp.add(function(ed,e){var h,b;if(e.keyCode==46||e.keyCode==8){b=ed.getBody();h=b.innerHTML;if(b.childNodes.length==1&&!/<(img|hr)/.test(h)&&tinymce.trim(h.replace(/<[^>]+>/g,'')).length==0)ed.setContent('',{format:'raw'});}});ed.addCommand('FormatBlock',function(u,v){var dom=ed.dom,e=dom.getParent(ed.selection.getNode(),dom.isBlock);if(e)dom.replace(dom.create(v),e,1);else ed.getDoc().execCommand("FormatBlock",false,v);});ed.addCommand('mceInsertContent',function(u,v){ed.getDoc().execCommand("InsertText",false,'mce_marker');ed.getBody().innerHTML=ed.getBody().innerHTML.replace(/mce_marker/g,v+'<span id="_mce_tmp">XX</span>');ed.selection.select(ed.dom.get('_mce_tmp'));ed.getDoc().execCommand("Delete",false,' ');});ed.onKeyPress.add(function(ed,e){if(e.keyCode==13&&(e.shiftKey||ed.settings.force_br_newlines&&ed.selection.getNode().nodeName!='LI')){t._insertBR(ed);Event.cancel(e);}});ed.addQueryValueHandler('FontSize',function(u,v){var e,v;if((e=ed.dom.getParent(ed.selection.getStart(),'span'))&&(v=e.style.fontSize))return tinymce.inArray(t.namedFontSizes,v)+1;if((e=ed.dom.getParent(ed.selection.getEnd(),'span'))&&(v=e.style.fontSize))return tinymce.inArray(t.namedFontSizes,v)+1;return ed.getDoc().queryCommandValue('FontSize');});ed.addQueryValueHandler('FontName',function(u,v){var e,v;if((e=ed.dom.getParent(ed.selection.getStart(),'span'))&&(v=e.style.fontFamily))return v.replace(/, /g,',');if((e=ed.dom.getParent(ed.selection.getEnd(),'span'))&&(v=e.style.fontFamily))return v.replace(/, /g,',');return ed.getDoc().queryCommandValue('FontName');});ed.onClick.add(function(ed,e){e=e.target;if(e.nodeName=='IMG'){t.selElm=e;ed.selection.select(e);}else t.selElm=null;});ed.onInit.add(function(){t._fixWebKitSpans();if(isOldWebKit)t._patchSafari2x(ed);});ed.onSetContent.add(function(){dom=ed.dom;each(['strong','b','em','u','strike','sub','sup','a'],function(v){each(grep(dom.select(v)).reverse(),function(n){var nn=n.nodeName.toLowerCase(),st;if(nn=='a'){if(n.name)dom.replace(dom.create('img',{mce_name:'a',name:n.name,'class':'mceItemAnchor'}),n);return;}switch(nn){case'b':case'strong':if(nn=='b')nn='strong';st='font-weight: bold;';break;case'em':st='font-style: italic;';break;case'u':st='text-decoration: underline;';break;case'sub':st='vertical-align: sub;';break;case'sup':st='vertical-align: super;';break;case'strike':st='text-decoration: line-through;';break;}dom.replace(dom.create('span',{mce_name:nn,style:st,'class':'Apple-style-span'}),n,1);});});});ed.onPreProcess.add(function(ed,o){dom=ed.dom;each(grep(o.node.getElementsByTagName('span')).reverse(),function(n){var v,bg;if(o.get){if(dom.hasClass(n,'Apple-style-span')){bg=n.style.backgroundColor;switch(dom.getAttrib(n,'mce_name')){case'font':if(!ed.settings.convert_fonts_to_spans)dom.setAttrib(n,'style','');break;case'strong':case'em':case'sub':case'sup':dom.setAttrib(n,'style','');break;case'strike':case'u':if(!ed.settings.inline_styles)dom.setAttrib(n,'style','');else dom.setAttrib(n,'mce_name','');break;default:if(!ed.settings.inline_styles)dom.setAttrib(n,'style','');}if(bg)n.style.backgroundColor=bg;}}if(dom.hasClass(n,'mceItemRemoved'))dom.remove(n,1);});});ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/<br \/><\/(h[1-6]|div|p|address|pre)>/g,'</$1>');o.content=o.content.replace(/ id=\"undefined\"/g,'');});},getInfo:function(){return{longname:'Safari compatibility',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/safari',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_fixWebKitSpans:function(){var t=this,ed=t.editor;if(!isOldWebKit){Event.add(ed.getDoc(),'DOMNodeInserted',function(e){e=e.target;if(e&&e.nodeType==1)t._fixAppleSpan(e);});}else{ed.onExecCommand.add(function(){each(ed.dom.select('span'),function(n){t._fixAppleSpan(n);});ed.nodeChanged();});}},_fixAppleSpan:function(e){var ed=this.editor,dom=ed.dom,fz=this.webKitFontSizes,fzn=this.namedFontSizes,s=ed.settings,st,p;if(dom.getAttrib(e,'mce_fixed'))return;if(e.nodeName=='SPAN'&&e.className=='Apple-style-span'){st=e.style;if(!s.convert_fonts_to_spans){if(st.fontSize){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'size',inArray(fz,st.fontSize)+1);}if(st.fontFamily){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'face',st.fontFamily);}if(st.color){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'color',dom.toHex(st.color));}if(st.backgroundColor){dom.setAttrib(e,'mce_name','font');dom.setStyle(e,'background-color',st.backgroundColor);}}else{if(st.fontSize)dom.setStyle(e,'fontSize',fzn[inArray(fz,st.fontSize)]);}if(st.fontWeight=='bold')dom.setAttrib(e,'mce_name','strong');if(st.fontStyle=='italic')dom.setAttrib(e,'mce_name','em');if(st.textDecoration=='underline')dom.setAttrib(e,'mce_name','u');if(st.textDecoration=='line-through')dom.setAttrib(e,'mce_name','strike');if(st.verticalAlign=='super')dom.setAttrib(e,'mce_name','sup');if(st.verticalAlign=='sub')dom.setAttrib(e,'mce_name','sub');dom.setAttrib(e,'mce_fixed','1');}},_patchSafari2x:function(ed){var t=this,setContent,getNode,dom=ed.dom,lr;if(ed.windowManager.onBeforeOpen){ed.windowManager.onBeforeOpen.add(function(){r=ed.selection.getRng();});}ed.selection.select=function(n){this.getSel().setBaseAndExtent(n,0,n,1);};getNode=ed.selection.getNode;ed.selection.getNode=function(){return t.selElm||getNode.call(this);};ed.selection.getRng=function(){var t=this,s=t.getSel(),d=ed.getDoc(),r,rb,ra,di;if(s.anchorNode){r=d.createRange();try{rb=d.createRange();rb.setStart(s.anchorNode,s.anchorOffset);rb.collapse(1);ra=d.createRange();ra.setStart(s.focusNode,s.focusOffset);ra.collapse(1);di=rb.compareBoundaryPoints(rb.START_TO_END,ra)<0;r.setStart(di?s.anchorNode:s.focusNode,di?s.anchorOffset:s.focusOffset);r.setEnd(di?s.focusNode:s.anchorNode,di?s.focusOffset:s.anchorOffset);lr=r;}catch(ex){}}return r||lr;};setContent=ed.selection.setContent;ed.selection.setContent=function(h,s){var r=this.getRng(),b;try{setContent.call(this,h,s);}catch(ex){b=dom.create('body');b.innerHTML=h;each(b.childNodes,function(n){r.insertNode(n.cloneNode(true));});}};},_insertBR:function(ed){var dom=ed.dom,s=ed.selection,r=s.getRng(),br;r.insertNode(br=dom.create('br'));r.setStartAfter(br);r.setEndAfter(br);s.setRng(r);if(s.getSel().focusNode==br.previousSibling){s.select(dom.insertAfter(dom.doc.createTextNode('\u00a0'),br));s.collapse(1);}ed.getWin().scrollTo(0,dom.getPos(s.getRng().startContainer).y);}});tinymce.PluginManager.add('safari',tinymce.plugins.Safari);})();
\ No newline at end of file
index 28144579a3e3aad295fc7d1b6047d49617f970e5..faff841500cc7f49e07393706aff160d7951a3b4 100644 (file)
                                        t._resizeIframe(ed, tbId, 28);
                                }
                        });
-                       
+
                        // Register commands
                        ed.addCommand('WP_More', function() {
                                ed.execCommand('mceInsertContent', 0, moreHTML);
                        });
-                       
+
                        ed.addCommand('WP_Page', function() {
                                ed.execCommand('mceInsertContent', 0, nextpageHTML);
                        });
-                       
+
                        ed.addCommand('WP_Help', function() {
                                        ed.windowManager.open({
                                                url : tinymce.baseURL + '/wp-mce-help.php',
@@ -80,7 +80,7 @@
                        ed.addButton('wp_help', {
                                title : 'wordpress.wp_help_desc',
                                image : url + '/img/help.gif',
-                               cmd : 'WP_Help' 
+                               cmd : 'WP_Help'
                        });
 
                        ed.addButton('wp_adv', {
                                cmd : 'WP_Adv'
                        });
 
-                       // Add class "alignleft", "alignright" and "aligncenter" when selecting align for images.
-                       ed.onExecCommand.add(function( editor, cmd ) {
-                               var node, bl, dom = editor.dom;
-
-                               if ( 'JustifyCenter' == cmd ) {
-                                       if ( ( node = editor.selection.getNode() ) && node.nodeName == 'IMG' ) {
-                                               if ( ! dom.hasClass( node, "aligncenter" ) && ( bl = editor.forceBlocks.getParentBlock(node) ) && bl.childNodes.length == 1 )
-                                                       dom.setStyle(bl, 'text-align', '');
-                                       }
-                                       editor.execCommand('mceRepaint');
+                       // Add Media buttons
+                       ed.addButton('add_media', {
+                               title : 'wordpress.add_media',
+                               image : url + '/img/media.gif',
+                               onclick : function() {
+                                       tb_show('', tinymce.DOM.get('add_media').href);
+                                       tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
+                               }
+                       });
+
+                       ed.addButton('add_image', {
+                               title : 'wordpress.add_image',
+                               image : url + '/img/image.gif',
+                               onclick : function() {
+                                       tb_show('', tinymce.DOM.get('add_image').href);
+                                       tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
                                }
                        });
 
-                       ed.onBeforeExecCommand.add(function( editor, cmd ) {
-                               var node, dir, xdir, bl, dom = editor.dom;
-
-                               if ( ( cmd.indexOf('Justify') != -1 ) && ( node = editor.selection.getNode() ) ) {
-                                       if ( 'JustifyFull' == cmd || node.nodeName !== 'IMG' ) return;
-                                       dir = cmd.substring(7).toLowerCase();
-
-                                       if (  editor.queryCommandState( cmd ) ) {
-                                               dom.removeClass( node, "alignleft" );
-                                               dom.removeClass( node, "alignright" );
-                                               dom.removeClass( node, "aligncenter" );
-                                       } else if ( 'JustifyCenter' == cmd ) {
-                                               dom.removeClass( node, "alignleft" );
-                                               dom.removeClass( node, "alignright" );
-
-                                               if ( dom.hasClass( node, "aligncenter" ) ) {
-                                                       dom.removeClass( node, "aligncenter" );
-                                                       if ( ( bl = editor.forceBlocks.getParentBlock(node) ) && bl.childNodes.length == 1 && tinymce.isGecko )
-                                                               editor.selection.select(bl.firstChild);
-                                               } else dom.addClass( node, "aligncenter" );
-
-                                       } else {
-                                               xdir = ( dir == 'left' ) ? 'right' : 'left';
-                                               dom.removeClass( node, "aligncenter" );
-                                               dom.removeClass( node, "align"+xdir );
-                                               dom.addClass( node, "align"+dir );
-                                       }
+                       ed.addButton('add_video', {
+                               title : 'wordpress.add_video',
+                               image : url + '/img/video.gif',
+                               onclick : function() {
+                                       tb_show('', tinymce.DOM.get('add_video').href);
+                                       tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
                                }
                        });
 
+                       ed.addButton('add_audio', {
+                               title : 'wordpress.add_audio',
+                               image : url + '/img/audio.gif',
+                               onclick : function() {
+                                       tb_show('', tinymce.DOM.get('add_audio').href);
+                                       tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
+                               }
+                       });
+
+                       // Add Media buttons to fullscreen
+                       ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {
+                               if ( 'mceFullScreen' != cmd ) return;
+                               if ( 'mce_fullscreen' != ed.id )
+                                       ed.settings.theme_advanced_buttons1 += ',|,add_image,add_video,add_audio,add_media';
+                       });
+
+                       // Add class "alignleft", "alignright" and "aligncenter" when selecting align for images.
+                       ed.addCommand('JustifyLeft', function() {
+                               var n = ed.selection.getNode();
+
+                               if ( n.nodeName != 'IMG' )
+                                       ed.editorCommands.mceJustify('JustifyLeft', 'left');
+                               else ed.plugins.wordpress.do_align(n, 'alignleft');
+                       });
+
+                       ed.addCommand('JustifyRight', function() {
+                               var n = ed.selection.getNode();
+
+                               if ( n.nodeName != 'IMG' )
+                                       ed.editorCommands.mceJustify('JustifyRight', 'right');
+                               else ed.plugins.wordpress.do_align(n, 'alignright');
+                       });
+
+                       ed.addCommand('JustifyCenter', function() {
+                               var n = ed.selection.getNode(), P = ed.dom.getParent(n, 'p'), DL = ed.dom.getParent(n, 'dl');
+
+                               if ( n.nodeName == 'IMG' && ( P || DL ) )
+                                       ed.plugins.wordpress.do_align(n, 'aligncenter');
+                               else ed.editorCommands.mceJustify('JustifyCenter', 'center');
+                       });
+
+                       // Word count if script is loaded
+                       if ( 'undefined' != typeof wpWordCount ) {
+                               var last = 0;
+                               ed.onKeyUp.add(function(ed, e) {
+                                       if ( e.keyCode == last ) return;
+                                       if ( 13 == e.keyCode || 8 == last || 46 == last ) wpWordCount.wc( ed.getContent({format : 'raw'}) );
+                                       last = e.keyCode;
+                               });
+                       };
+
                        // Add listeners to handle more break
                        t._handleMoreBreak(ed, url);
 
                },
 
                // Internal functions
+               do_align : function(n, a) {
+                       var P, DL, DIV, cls, c, ed = tinyMCE.activeEditor;
+
+                       P = ed.dom.getParent(n, 'p');
+                       DL = ed.dom.getParent(n, 'dl');
+                       DIV = ed.dom.getParent(n, 'div');
+
+                       if ( DL && DIV ) {
+                               cls = ed.dom.hasClass(DL, a) ? 'alignnone' : a;
+                               DL.className = DL.className.replace(/align[^ '"]+\s?/g, '');
+                               ed.dom.addClass(DL, cls);
+                               c = (cls == 'aligncenter') ? ed.dom.addClass(DIV, 'mceIEcenter') : ed.dom.removeClass(DIV, 'mceIEcenter');
+                       } else if ( P ) {
+                               cls = ed.dom.hasClass(n, a) ? 'alignnone' : a;
+                               n.className = n.className.replace(/align[^ '"]+\s?/g, '');
+                               ed.dom.addClass(n, cls);
+                               if ( cls == 'aligncenter' )
+                                       ed.dom.setStyle(P, 'textAlign', 'center');
+                               else if (P.style && P.style.textAlign == 'center')
+                                       ed.dom.setStyle(P, 'textAlign', '');
+                       }
+
+                       ed.execCommand('mceRepaint');
+               },
 
                // Resizes the iframe by a relative height value
                _resizeIframe : function(ed, tb_id, dy) {
diff --git a/wp-includes/js/tinymce/plugins/wordpress/img/audio.gif b/wp-includes/js/tinymce/plugins/wordpress/img/audio.gif
new file mode 100644 (file)
index 0000000..f8ad223
Binary files /dev/null and b/wp-includes/js/tinymce/plugins/wordpress/img/audio.gif differ
diff --git a/wp-includes/js/tinymce/plugins/wordpress/img/image.gif b/wp-includes/js/tinymce/plugins/wordpress/img/image.gif
new file mode 100644 (file)
index 0000000..6736e6b
Binary files /dev/null and b/wp-includes/js/tinymce/plugins/wordpress/img/image.gif differ
diff --git a/wp-includes/js/tinymce/plugins/wordpress/img/media.gif b/wp-includes/js/tinymce/plugins/wordpress/img/media.gif
new file mode 100644 (file)
index 0000000..786e4f5
Binary files /dev/null and b/wp-includes/js/tinymce/plugins/wordpress/img/media.gif differ
diff --git a/wp-includes/js/tinymce/plugins/wordpress/img/video.gif b/wp-includes/js/tinymce/plugins/wordpress/img/video.gif
new file mode 100644 (file)
index 0000000..b8e0975
Binary files /dev/null and b/wp-includes/js/tinymce/plugins/wordpress/img/video.gif differ
diff --git a/wp-includes/js/tinymce/plugins/wordpress/popups.css b/wp-includes/js/tinymce/plugins/wordpress/popups.css
deleted file mode 100644 (file)
index 2d97665..0000000
+++ /dev/null
@@ -1,354 +0,0 @@
-/* This file contains the CSS data for all popups in TinyMCE */
-
-body {
-       background-color: #F0F0EE;
-       font-family: Verdana, Arial, Helvetica, sans-serif;
-       font-size: 11px;
-       scrollbar-3dlight-color: #F0F0EE;
-       scrollbar-arrow-color: #676662;
-       scrollbar-base-color: #F0F0EE;
-       scrollbar-darkshadow-color: #DDDDDD;
-       scrollbar-face-color: #E0E0DD;
-       scrollbar-highlight-color: #F0F0EE;
-       scrollbar-shadow-color: #F0F0EE;
-       scrollbar-track-color: #F5F5F5;
-       margin: 8px;
-}
-
-td {
-       font-family: Verdana, Arial, Helvetica, sans-serif;
-       font-size: 11px;
-}
-
-input {
-       background: #FFFFFF;
-       border: 1px solid #cccccc;
-}
-
-td, input, select, textarea {
-       font-family: Verdana, Arial, Helvetica, sans-serif;
-       font-size: 10px;
-}
-
-input, select, textarea {
-       border: 1px solid #808080;
-}
-
-.input_noborder {
-       border: 0;
-}
-
-#insert, .updateButton {
-   font-weight: bold;
-   width: 90px;
-   height: 21px;
-   border: 0;
-   background-image: url('../images/insert_button_bg.gif');
-   cursor: pointer;
-}
-
-#cancel {
-   font-weight: bold;
-   width: 90px;
-   height: 21px;
-   border: 0;
-   background-image: url('../images/cancel_button_bg.gif');
-   cursor: pointer;
-}
-
-/* Mozilla only style */
-html>body #insert, html>body #cancel {
-       padding-bottom: 2px;
-}
-
-.title {
-       display: block;
-       padding-top: 5px;
-       padding-bottom: 5px;
-       padding-left: 15px;
-       font-size: 15px;
-}
-
-
-table.charmap {
-       border-style: solid;
-       border-width: 1px;
-       border-color: #AAAAAA;
-}
-
-td.charmap, td.charmapOver {
-       color: #000000;
-       border-color: #AAAAAA;
-       border-style: solid;
-       border-width: 1px;
-       text-align: center;
-       font-size: 12px;
-}
-
-td.charmapOver {
-       background-color: #CCCCCC;
-       cursor: default;
-}
-
-a.charmap {
-       color: #000000;
-       text-decoration: none
-}
-
-.wordWrapCode {
-       vertical-align: middle;
-       border: 1px none #000000;
-       background-color: transparent;
-}
-
-input.radio {
-       border: 1px none #000000;
-       background-color: transparent;
-       vertical-align: middle;
-}
-
-input.checkbox {
-       border: 1px none #000000;
-       background-color: transparent;
-       vertical-align: middle;
-}
-
-.mceButtonNormal, .mceButtonOver, .mceButtonDown, .mceSeparator, .mceButtonDisabled, .mceButtonSelected {
-       margin-left: 1px;
-}
-
-.mceButtonNormal {
-       border-top: 1px solid;
-       border-left: 1px solid;
-       border-bottom: 1px solid;
-       border-right: 1px solid;
-       border-color: #F0F0EE;
-       cursor: default;
-}
-
-.mceButtonOver {
-       border: 1px solid #0A246A;
-       cursor: default;
-       background-color: #B6BDD2;
-}
-
-.mceButtonDown {
-       cursor: default;
-       border: 1px solid #0A246A;
-       background-color: #8592B5;
-}
-
-.mceButtonDisabled {
-       filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);
-       -moz-opacity:0.3;
-       opacity: 0.3;
-       border-top: 1px solid;
-       border-left: 1px solid;
-       border-bottom: 1px solid;
-       border-right: 1px solid;
-       border-color: #F0F0EE;
-       cursor: default;
-}
-
-.mceActionPanel {
-       margin-top: 5px;
-}
-
-/* Tabs classes */
-
-.tabs {
-       float: left;
-       width: 100%;
-       line-height: normal;
-       background-image: url("../images/xp/tabs_bg.gif");
-}
-
-.tabs ul {
-       margin: 0;
-       padding: 0 0 0;
-       list-style: none;
-}
-
-.tabs li {
-       float: left;
-       background: url("../images/xp/tab_bg.gif") no-repeat left top;
-       margin: 0;
-       margin-left: 0;
-       margin-right: 2px;
-       padding: 0 0 0 10px;
-       line-height: 18px;
-}
-
-.tabs li.current {
-       background: url("../images/xp/tab_sel_bg.gif") no-repeat left top;
-       margin-right: 2px;
-}
-
-.tabs span {
-       float: left;
-       display: block;
-       background: url("../images/xp/tab_end.gif") no-repeat right top;
-       padding: 0px 10px 0 0;
-}
-
-.tabs .current span {
-       background: url("../images/xp/tab_sel_end.gif") no-repeat right top;
-}
-
-.tabs a {
-       text-decoration: none;
-       font-family: Verdana, Arial;
-       font-size: 10px;
-}
-
-.tabs a:link, .tabs a:visited, .tabs a:hover {
-       color: black;
-}
-
-.tabs a:hover {
-}
-
-.tabs .current {
-}
-
-.tabs .current a, .tabs .current a:link, .tabs .current a:visited {
-}
-
-.panel_wrapper div.panel {
-       display: none;
-}
-
-.panel_wrapper div.current {
-       display: block;
-       width: 100%;
-       height: 300px;
-       overflow: visible; /* Should be auto but that breaks Safari */
-}
-
-.panel_wrapper {
-       border: 1px solid #919B9C;
-       border-top: 0px;
-       padding: 10px;
-       padding-top: 5px;
-       clear: both;
-       background-color: white;
-}
-
-fieldset {
-       border: 1px solid #919B9C;
-       font-family: Verdana, Arial;
-       font-size: 10px;
-       padding: 0;
-       margin: 0;
-       padding: 4px;
-}
-
-legend {
-       color: #2B6FB6;
-       font-weight: bold;
-}
-
-.properties {
-       width: 100%;
-}
-
-.properties .column1 {
-}
-
-.properties .column2 {
-       text-align: left;
-}
-
-a:link, a:visited {
-       color: black;
-}
-
-a:hover {
-       color: #2B6FB6;
-}
-
-#plugintable thead {
-       font-weight: bold;
-       background-color: #DDDDDD;
-}
-
-#plugintable, #about #plugintable td {
-       border: 1px solid #919B9C;
-}
-
-#plugintable {
-       width: 99%;
-       margin-top: 10px;
-}
-
-#pluginscontainer {
-       height: 290px;
-       overflow: auto;
-}
-
-/* MSIE Specific styles */
-
-* html .panel_wrapper {
-       width: 100%;
-}
-
-.column {
-       float: left;
-}
-
-h1, h2, h3, h4 {
-       color: #2B6FB6;
-       margin: 0;
-       padding: 0;
-       padding-top: 5px;
-}
-
-h3 {
-       font-size: 14px;
-}
-
-#link .panel_wrapper, #link div.current {
-       height: 125px;
-}
-
-#image .panel_wrapper, #image div.current {
-       height: 190px;
-}
-
-/* Disables the advanced tab in the table plugin. */
-/*
-#table #advanced_tab {
-       display: none;
-}
-*/
-
-/* Disables the border input field and label in the table plugin. */
-/*
-#table #border, #table #borderlabel {
-       display: none;
-}
-*/
-
-#insert, #cancel, .submitbutton {
-       font: 13px Verdana, Arial, Helvetica, sans-serif;
-       height: auto;
-       width: auto;
-       background-color: transparent;
-       background-image: url(../../../../../wp-admin/images/fade-butt.png);
-       background-repeat: repeat;
-       border: 3px double;
-       border-right-color: rgb(153, 153, 153);
-       border-bottom-color: rgb(153, 153, 153);
-       border-left-color: rgb(204, 204, 204);
-       border-top-color: rgb(204, 204, 204);
-       color: rgb(51, 51, 51);
-       padding: 0.25em 0.75em;
-}
-
-#insert:active, #cancel:active, .submitbutton:active {
-       background: #f4f4f4;
-       border-left-color: #999;
-       border-top-color: #999;
-}
-
-
diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css b/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css
new file mode 100644 (file)
index 0000000..e78820f
--- /dev/null
@@ -0,0 +1,68 @@
+
+body#media-upload ul#sidemenu {
+       left: auto;
+       right: 0;
+}
+
+#basic .align .field label {
+       display: block;
+       float: right;
+       padding: 0 24px 0 0;
+       margin: 5px 3px 5px 5px; 
+}
+
+.align .field input {
+       display: block;
+       float: right;
+       margin: 5px 15px 5px 0;
+}
+
+tr.image-size label {
+       margin: 0;
+}
+
+tr.image-size input {
+       margin: 3px 15px 0 5px;
+}
+
+.image-align-none-label,
+.image-align-left-label,
+.image-align-center-label,
+.image-align-right-label {
+       background-position: center right;
+}
+
+#media-upload .describe th.label {
+       text-align: right;
+}
+
+.show-align,
+.alignright,
+#img_size {
+       float: left;
+}
+
+tr.image-size label,
+tr.image-size input,
+#img_dim label,
+#img_dim input,
+#img_prop label,
+#img_prop input,
+#img_size_div,
+.alignleft {
+       float: right;
+}
+
+#img_dim label,
+#img_prop label {
+       margin: 5px 0pt;
+}
+
+#img_dim input,
+#img_prop input {
+       margin: 0 5px 0 10px;
+}
+
+#img_size_title {
+       text-align: left;
+}
diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css b/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css
new file mode 100644 (file)
index 0000000..112f5db
--- /dev/null
@@ -0,0 +1,239 @@
+
+html, body {
+       background-color: #fff;
+       margin: 0;
+       padding: 0;
+}
+
+.submit input,
+.button {
+       font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
+       padding: 3px 5px;
+       font-size: 12px;
+       line-height: 1.5em;
+       border-width: 1px;
+       border-style: solid;
+       -moz-border-radius: 3px;
+       -khtml-border-radius: 3px;
+       -webkit-border-radius: 3px;
+       border-radius: 3px;
+       cursor: pointer;
+       text-decoration: none;
+}
+
+textarea,
+input,
+select {
+       font: 13px Verdana, Arial, Helvetica, sans-serif;
+       margin: 1px;
+       padding: 3px;
+}
+
+body, td {
+       font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
+}
+
+abbr.required {
+       color: #FF0000;
+       text-align: left;
+}
+
+img.alignright,
+.alignright {
+       float: right;
+}
+
+img.alignleft,
+.alignleft {
+       float: left;
+}
+
+img.aligncenter {
+       display: block;
+       margin-left: auto;
+       margin-right: auto;
+}
+
+label {
+       cursor: pointer;
+}
+
+th.label {
+       width: 107px;
+}
+
+#media-upload #basic th.label {
+       padding: 5px 5px 5px 0;
+}
+
+.show-align {
+       height: 200px;
+       width: 480px;
+       float: right;
+       background-color: #f1f1f1;
+       cursor: default;
+       -moz-user-select: none;
+       user-select: none;
+       overflow: hidden;
+}
+
+#media-upload #img-edit {
+       border: 1px solid #c0c0c0;
+       width: 623px;
+       margin: 15px auto;
+}
+
+#media-upload .media-upload-form table.describe {
+       border-top-style: none;
+       border-top-width: 0;
+}
+
+#img_demo_txt {
+       font-size: 6px;
+       line-height: 10px;
+       font-family: "Courier New",Courier,monotype;
+       color: #ccc;
+       background-color: #ccc;
+}
+
+#img_demo {
+       padding: 0;
+}
+
+#saveeditimg {
+       padding: 10px 0 0 5px;
+       border-top: 1px solid #ccc;
+}
+
+#sidemenu,
+#sidemenu li {
+       list-style: none;
+}
+
+#sidemenu li {
+       display: inline;
+}
+
+#sidemenu a {
+       border-bottom-style: solid;
+       border-bottom-width: 1px;
+       border-top-style: solid;
+       border-top-width: 1px;
+       display: block;
+       float: left;
+       line-height: 28px;
+       text-decoration: none;
+       text-align: center;
+       white-space: nowrap;
+       margin: 0;
+       padding: 0pt 7px;
+}
+
+#sidemenu a.current {
+       -moz-border-radius-topleft: 4px;
+       -khtml-border-top-left-radius: 4px;
+       -webkit-border-top-left-radius: 4px;
+       border-top-left-radius: 4px;
+       -moz-border-radius-topright: 4px;
+       -khtml-border-top-right-radius: 4px;
+       -webkit-border-top-right-radius: 4px;
+       border-top-right-radius: 4px;
+       border-style:solid;
+       border-width:1px;
+       font-weight:normal;
+}
+
+#adv_settings .field label {
+       padding: 0 5px 5px;
+}
+
+#media-upload h3 {
+       clear: both;
+       padding: 0pt 0pt 3px;
+       border-bottom-style: solid;
+       border-bottom-width: 1px;
+       font-family: Georgia,"Times New Roman",Times,serif;
+       font-size: 20px;
+       font-weight: normal;
+       line-height: normal;
+       margin: 0 0 10px -4px;
+       padding: 15px 0 3px;
+       border-bottom-color: #DADADA;
+       color: #5A5A5A;
+}
+
+#img_dim #width,
+#img_dim #height,
+#img_prop #border,
+#img_prop #vspace,
+#img_prop #hspace {
+       width: 36px;
+}
+
+#img_dim abbr {
+       padding: 0 4px;
+}
+
+#show_align_sp {
+       width: 115px;
+}
+
+#img_dim input,
+#img_prop input {
+       margin-right: 10px;
+}
+
+#basic .align .field label {
+       padding: 0 0 0 24px;
+}
+
+#basic {
+       padding-top: 2px;
+}
+
+td {
+       padding: 2px 0;
+}
+
+#img_size {
+       float: right;
+       text-align: center;
+       cursor: pointer;
+       background-color: #f1f1f1;
+       padding: 5px 0;
+       width: 45px;
+}
+
+#img_size div {
+       font-size: 10px;
+       padding: 2px;
+       border: 1px solid #f1f1f1;
+       line-height: 15px;
+       height: 15px;
+       -moz-border-radius: 3px;
+       -khtml-border-radius: 3px;
+       -webkit-border-radius: 3px;
+       border-radius: 3px;
+       color: #07273E;
+}
+
+#img_size div#s100 {
+       border-color: #A3A3A3;
+       background-color: #E5E5E5;
+}
+
+#img_size_div {
+       width: 100px;
+       float: left;
+       cursor: default;
+}
+
+#img_size_title {
+       margin: 0 7px 5px;
+       text-align: right;
+       font-weight: bold;
+}
+
+#img_align_td {
+       padding: 2px 0 8px;
+}
diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html b/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html
new file mode 100644 (file)
index 0000000..55554d7
--- /dev/null
@@ -0,0 +1,275 @@
+<!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" lang="en-US">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title></title>
+
+<script type="text/javascript" src="js/editimage.js?ver=311g"></script>
+<script type="text/javascript" src="../../utils/form_utils.js?ver=311"></script>
+
+<link rel="stylesheet" href="css/editimage.css?ver=311g" type="text/css" media="all" />
+<link rel="stylesheet" href="../../../../../wp-admin/css/media.css?ver=2.6.1" type="text/css" media="all" />
+<script type="text/javascript">
+if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') )
+       document.write('<link rel="stylesheet" href="css/editimage-rtl.css?ver=311" type="text/css" media="all" />');
+</script>
+<base target="_self" />
+</head>
+
+<body id="media-upload" style="display:none;">
+<div id="media-upload-header">
+       <ul id="sidemenu">
+       <li><a href="javascript:;" id="tab_basic" class="current" onclick="wpImage.setTabs(this);">{#wpeditimage.edit_img}</a></li>
+       <li><a href="javascript:;" id="tab_advanced" onclick="wpImage.setTabs(this);">{#wpeditimage.adv_settings}</a></li>
+       </ul>
+</div>
+
+<div id="img-edit">
+<form class="media-upload-form" action="" onsubmit="wpImage.update();">
+       <div id="img_size_div">
+               <div id="img_size_title">{#wpeditimage.size}</div>
+               <div id="img_size" onmouseout="wpImage.showSizeRem()">
+                       <div id="s130" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s130}</div>
+                       <div id="s120" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s120}</div>
+                       <div id="s110" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s110}</div>
+                       <div id="s100" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s100}</div>
+                       <div id="s90" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s90}</div>
+                       <div id="s80" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s80}</div>
+                       <div id="s70" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s70}</div>
+                       <div id="s60" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s60}</div>
+               </div>
+       </div>
+       <div class="show-align" id="show_align">
+               <img id="img_demo" src="img/image.png" alt="" />
+               <span id="img_demo_txt">
+               Lorem ipsum dolor sit amet consectetuer velit pretium euismod ipsum enim. Mi cursus at a mollis senectus id arcu gravida quis urna. Sed et felis id tempus Morbi mauris tincidunt enim In mauris. Pede eu risus velit libero natoque enim lorem adipiscing ipsum consequat. In malesuada et sociis tincidunt tempus pellentesque cursus convallis ipsum Suspendisse. Risus In ac quis ut Nunc convallis laoreet ante Suspendisse Nam. Amet amet urna condimentum Vestibulum sem at Curabitur lorem et cursus. Sodales tortor fermentum leo dui habitant Nunc Sed Vestibulum.
+               Ut lorem In penatibus libero id ipsum sagittis nec elit Sed. Condimentum eget Vivamus vel consectetuer lorem molestie turpis amet tellus id. Condimentum vel ridiculus Fusce sed pede Nam nunc sodales eros tempor. Sit lacus magna dictumst Curabitur fringilla auctor id vitae wisi facilisi. Fermentum eget turpis felis velit leo Nunc Proin orci molestie Praesent. Curabitur tellus scelerisque suscipit ut sem amet cursus mi Morbi eu. Donec libero Vestibulum augue et mollis accumsan ornare condimentum In enim. Leo eget ac consectetuer quis condimentum malesuada.
+               Condimentum commodo et Lorem fringilla malesuada libero volutpat sem tellus enim. Tincidunt sed at Aenean nec nonummy porttitor Nam Sed Nulla ut. Auctor leo In aliquet Curabitur eros et velit Quisque justo morbi. Et vel mauris sit nulla semper vitae et quis at dui. Id at elit laoreet justo eu mauris Quisque et interdum pharetra. Nullam accumsan interdum Maecenas condimentum quis quis Fusce a sollicitudin Sed. Non Quisque Vivamus congue porttitor non semper ipsum porttitor quis vel. Donec eros lacus volutpat et tincidunt sem convallis id venenatis sit. Consectetuer odio.
+               Semper faucibus Morbi nulla convallis orci Aliquam Sed porttitor et Pellentesque. Venenatis laoreet lorem id a a Morbi augue turpis id semper. Arcu volutpat ac mauris Vestibulum fringilla Aenean condimentum nibh sed id. Sagittis eu lacus orci urna tellus tellus pretium Curabitur dui nunc. Et nibh eu eu nibh adipiscing at lorem Vestibulum adipiscing augue. Magna convallis Phasellus dolor malesuada Curabitur ornare adipiscing tellus Aliquam tempus. Id Aliquam Integer augue Nulla consectetuer ac Donec Curabitur tincidunt et. Id vel Nunc amet lacus dui magna ridiculus penatibus laoreet Duis. Enim sagittis nibh quis Nulla nec laoreet vel Maecenas mattis vel.
+               </span>
+       </div>
+
+       <div id="div_basic">
+       <table id="basic" class="describe">
+               <tbody>
+
+               <tr class="align">
+                       <th valign="top" scope="row" class="label">
+                               <label for="img_align_td">
+                               <span class="alignleft">{#contextmenu.align}</span>
+                               </label>
+                       </th>
+                       <td class="field" id="img_align_td">
+                               <input type="radio" onclick="wpImage.imgAlignCls('alignnone')" name="img_align" id="alignnone" value="alignnone" />
+                               <label for="alignnone" class="align image-align-none-label">{#wpeditimage.none}</label>
+
+                               <input type="radio" onclick="wpImage.imgAlignCls('alignleft')" name="img_align" id="alignleft" value="alignleft" />
+                               <label for="alignleft" class="align image-align-left-label">{#contextmenu.left}</label>
+
+                               <input type="radio" onclick="wpImage.imgAlignCls('aligncenter')" name="img_align" id="aligncenter" value="aligncenter" />
+                               <label for="aligncenter" class="align image-align-center-label">{#contextmenu.center}</label>
+
+                               <input type="radio" onclick="wpImage.imgAlignCls('alignright')" name="img_align" id="alignright" value="alignright" />
+                               <label for="alignright" class="align image-align-right-label">{#contextmenu.right}</label>
+                       </td>
+               </tr>
+
+               <tr>
+                       <th valign="top" scope="row" class="label">
+                               <label for="img_title">
+                               <span class="alignleft">{#wpeditimage.img_title}</span>
+                               </label>
+                       </th>
+                       <td class="field">
+                               <input type="text" id="img_title" name="img_title" value="" aria-required="true" size="60" />
+                       </td>
+               </tr>
+
+               <tr id="cap_field">
+                       <th valign="top" scope="row" class="label">
+                               <label for="img_cap">
+                               <span class="alignleft">{#wpeditimage.caption}</span>
+                               </label>
+                       </th>
+                       <td class="field">
+                               <input type="text" id="img_cap" name="img_cap" value="" size="60" />
+                       </td>
+               </tr>
+
+               <tr>
+                       <th valign="top" scope="row" class="label">
+                               <label for="link_href">
+                               <span class="alignleft" id="lb_link_href">{#advanced_dlg.link_url}</span>
+                               </label>
+                       </th>
+                       <td class="field">
+                               <input type="text" id="link_href" name="link_href" value="" size="60" /><br />
+                               <input type="button" class="button" onclick="wpImage.I('link_href').value='';" value="{#wpeditimage.none}" />
+                               <input type="button" class="button" id="img_url_current" onclick="wpImage.img_seturl('current')" value="{#wpeditimage.current_link}" />
+                               <input type="button" class="button" id="img_url_img" onclick="wpImage.img_seturl('link')" value="{#wpeditimage.link_to_img}" />
+                               <p class="help">{#wpeditimage.link_help}</p>
+                       </td>
+               </tr>
+       </tbody>
+       </table></div>
+
+       <div id="div_advanced" style="display:none;">
+       <h3>{#wpeditimage.adv_img_settings}</h3>
+       <table id="adv_settings_img" class="describe">
+               <tbody>
+               <tr>
+                       <th valign="top" scope="row" class="label">
+                               <label for="img_src">
+                               <span class="alignleft">{#wpeditimage.source}</span>
+                               <span class="alignright"><abbr title="required" class="required">*</abbr></span>
+                               </label>
+                       </th>
+                       <td class="field">
+                               <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">
+                               <label>
+                               <span class="alignleft">{#wpeditimage.size}</span>
+                               </label>
+                       </th>
+                       <td class="field">
+                               <label for="width">{#wpeditimage.width}</label>
+                               <input type="text" maxlength="5" id="width" name="width"  value="" />
+
+                               <label for="height">{#wpeditimage.height}</label>
+                               <input type="text" maxlength="5" id="height" name="height" value="" />
+
+                               <input type="button" class="button" id="orig_size" name="orig_size" value="{#wpeditimage.orig_size}" onclick="wpImage.origSize();" />
+                       </td>
+               </tr>
+
+               <tr>
+                       <th valign="top" scope="row" class="label">
+                               <label for="img_classes">
+                               <span class="alignleft">{#wpeditimage.css}</span>
+                               </label>
+                       </th>
+                       <td class="field">
+                               <input type="text" id="img_classes" name="img_classes" value="" size="60" />
+                       </td>
+               </tr>
+
+               <tr>
+                       <th valign="top" scope="row" class="label">
+                               <label for="img_style">
+                               <span class="alignleft">{#advanced.style_select}</span>
+                               </label>
+                       </th>
+                       <td class="field">
+                               <input type="text" id="img_style" name="img_style" value="" size="60" onblur="wpImage.demoSetStyle();" />
+                       </td>
+               </tr>
+
+               <tr id="img_prop">
+                       <th valign="top" scope="row" class="label">
+                               <label for="img_prop">
+                                       <span class="alignleft">{#advanced.image_props_desc}</span>
+                               </label>
+                       </th>
+                       <td class="field">
+                               <label for="border">{#advanced_dlg.image_border}</label>
+                               <input type="text" maxlength="5" id="border" name="border" value="" onblur="wpImage.updateStyle('border')" />
+
+                               <label for="vspace">{#advanced_dlg.image_vspace}</label>
+                               <input type="text" maxlength="5" id="vspace" name="vspace" value="" onblur="wpImage.updateStyle('vspace')" />
+
+                               <label for="hspace">{#advanced_dlg.image_hspace}</label>
+                               <input type="text" maxlength="5" id="hspace" name="hspace" value="" onblur="wpImage.updateStyle('hspace')" />
+                       </td>
+               </tr>
+               </tbody>
+       </table>
+
+       <h3>{#wpeditimage.adv_link_settings}</h3>
+       <table id="adv_settings_link" class="describe">
+               <tbody>
+               <tr>
+                       <th valign="top" scope="row" class="label">
+                               <label for="link_title">
+                               <span class="alignleft">{#advanced_dlg.link_titlefield}</span>
+                               </label>
+                       </th>
+                       <td class="field">
+                               <input type="text" id="link_title" name="link_title" value="" size="60" />
+                       </td>
+               </tr>
+
+               <tr>
+                       <th valign="top" scope="row" class="label">
+                               <label for="link_rel">
+                               <span class="alignleft">{#wpeditimage.link_rel}</span>
+                               </label>
+                       </th>
+                       <td class="field">
+                               <input type="text" id="link_rel" name="link_rel" value="" size="60" />
+                       </td>
+               </tr>
+
+               <tr>
+                       <th valign="top" scope="row" class="label">
+                               <label for="link_classes">
+                               <span class="alignleft">{#wpeditimage.css}</span>
+                               </label>
+                       </th>
+                       <td class="field">
+                               <input type="text" id="link_classes" name="link_classes" value="" size="60" />
+                       </td>
+               </tr>
+
+               <tr>
+                       <th valign="top" scope="row" class="label">
+                               <label for="link_style">
+                               <span class="alignleft">{#advanced.style_select}</span>
+                               </label>
+                       </th>
+                       <td class="field">
+                               <input type="text" id="link_style" name="link_style" value="" size="60" />
+                       </td>
+               </tr>
+
+               <tr>
+                       <th valign="top" scope="row" class="label">
+                               <label>
+                               <span class="alignleft">{#advanced_dlg.link_target}</span>
+                               </label>
+                       </th>
+                       <td class="field">
+                               <label for="link_target">
+                               {#advanced_dlg.link_target_blank}
+                               </label>
+                               <input type="checkbox" id="link_target" name="link_target" value="_blank" />
+                       </td>
+               </tr>
+               </tbody>
+       </table></div>
+
+       <div id="saveeditimg">
+               <input type="hidden" id="align" name="align" value="" />
+
+               <input type="submit" id="saveimg" class="button" value="{#update}" />
+               <input type="button" class="button" id="cancelimg" name="cancelimg" value="{#cancel}" onclick="tinyMCEPopup.close();" />
+       </div>
+</form>
+</div>
+
+</body>
+</html>
diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js b/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js
new file mode 100644 (file)
index 0000000..d0ca4ed
--- /dev/null
@@ -0,0 +1,217 @@
+
+(function() {
+       tinymce.create('tinymce.plugins.wpEditImage', {
+
+               init : function(ed, url) {
+                       var t = this;
+
+                       t.url = url;
+                       t._createButtons();
+
+                       // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('...');
+                       ed.addCommand('WP_EditImage', function() {
+                               var el = ed.selection.getNode();
+
+                               if ( ed.dom.getAttrib(el, 'class').indexOf('mceItem') != -1 || el.nodeName != 'IMG' )
+                                       return;
+
+                               tb_show('', url + '/editimage.html?ver=311g&TB_iframe=true');
+                               tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
+                       });
+
+                       ed.onInit.add(function(ed) {
+                               tinymce.dom.Event.add(ed.getWin(), 'scroll', function(e) {
+                                       ed.plugins.wpeditimage.hideButtons();
+                               });
+                       });
+
+                       ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {
+                               ed.plugins.wpeditimage.hideButtons();
+                       });
+
+                       ed.onSaveContent.add(function(ed, o) {
+                               ed.plugins.wpeditimage.hideButtons();
+                       });
+
+                       ed.onMouseUp.add(function(ed, e) {
+                               if ( tinymce.isOpera ) {
+                                       if ( e.target.nodeName == 'IMG' )
+                                               ed.plugins.wpeditimage.showButtons(e.target);
+                               } else if ( ! tinymce.isWebKit ) {
+                                       var n = ed.selection.getNode(), DL;
+                                       
+                                       if ( n.nodeName == 'IMG' && (DL = ed.dom.getParent(n, 'DL')) ) {                                        
+                                               window.setTimeout(function(){
+                                                       var ed = tinyMCE.activeEditor, n = ed.selection.getNode(), DL = ed.dom.getParent(n, 'DL');
+                                               
+                                                       if ( n.width != (parseInt(ed.dom.getStyle(DL, 'width')) - 10) ) {
+                                                               ed.dom.setStyle(DL, 'width', parseInt(n.width)+10);
+                                                               ed.execCommand('mceRepaint');
+                                                       }
+                                               }, 100);
+                                       }
+                               }
+                       });
+
+                       ed.onMouseDown.add(function(ed, e) {
+                               if ( tinymce.isOpera || e.target.nodeName != 'IMG' ) {
+                                       t.hideButtons();
+                                       return;
+                               }
+                               ed.plugins.wpeditimage.showButtons(e.target);
+                       });
+
+                       ed.onKeyPress.add(function(ed, e) {
+                               var DL, DIV;
+
+                               if ( e.keyCode == 13 && (DL = ed.dom.getParent(ed.selection.getNode(), 'DL')) ) {
+                                       var P = ed.dom.create('p', {}, '&nbsp;');
+                                       if ( (DIV = DL.parentNode) && DIV.nodeName == 'DIV' ) 
+                                               ed.dom.insertAfter( P, DIV );
+                                       else ed.dom.insertAfter( P, DL );
+
+                                       tinymce.dom.Event.cancel(e);
+                                       ed.selection.select(P);
+                                       return false;
+                               }
+                       });
+
+                       ed.onBeforeSetContent.add(function(ed, o) {
+                               o.content = t._do_shcode(o.content);
+                       });
+
+                       ed.onPostProcess.add(function(ed, o) {
+                               if (o.get)
+                                       o.content = t._get_shcode(o.content);
+                       });
+               },
+
+               _do_shcode : function(co) {
+                       return co.replace(/\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\][\s\u00a0]*/g, function(a,b,c){
+                               b = b.replace(/\\'|\\&#39;|\\&#039;/g, '&#39;').replace(/\\"|\\&quot;/g, '&quot;');
+                               c = c.replace(/\\&#39;|\\&#039;/g, '&#39;').replace(/\\&quot;/g, '&quot;');
+                               var id = b.match(/id=['"]([^'"]+)/i), cls = b.match(/align=['"]([^'"]+)/i);
+                               var w = b.match(/width=['"]([0-9]+)/), cap = b.match(/caption=['"]([^'"]+)/i);
+
+                               id = ( id && id[1] ) ? id[1] : '';
+                               cls = ( cls && cls[1] ) ? cls[1] : 'alignnone';
+                               w = ( w && w[1] ) ? w[1] : '';
+                               cap = ( cap && cap[1] ) ? cap[1] : '';
+                               if ( ! w || ! cap ) return c;
+                               
+                               var div_cls = (cls == 'aligncenter') ? 'mceTemp mceIEcenter' : 'mceTemp';
+
+                               return '<div class="'+div_cls+'"><dl id="'+id+'" class="wp-caption '+cls+'" style="width: '+(10+parseInt(w))+
+                               'px"><dt class="wp-caption-dt">'+c+'</dt><dd class="wp-caption-dd">'+cap+'</dd></dl></div>';
+                       });
+               },
+
+               _get_shcode : function(co) {
+                       return co.replace(/<div class="mceTemp[^"]*">\s*<dl([^>]+)>\s*<dt[^>]+>([\s\S]+?)<\/dt>\s*<dd[^>]+>(.+?)<\/dd>\s*<\/dl>\s*<\/div>\s*/gi, function(a,b,c,cap){
+                               var id = b.match(/id=['"]([^'"]+)/i), cls = b.match(/class=['"]([^'"]+)/i);
+                               var w = c.match(/width=['"]([0-9]+)/);
+
+                               id = ( id && id[1] ) ? id[1] : '';
+                               cls = ( cls && cls[1] ) ? cls[1] : 'alignnone';
+                               w = ( w && w[1] ) ? w[1] : '';
+
+                               if ( ! w || ! cap ) return c;
+                               cls = cls.match(/align[^ '"]+/) || 'alignnone';
+                               cap = cap.replace(/<\S[^<>]*>/gi, '').replace(/'/g, '&#39;').replace(/"/g, '&quot;');
+
+                               return '[caption id="'+id+'" align="'+cls+'" width="'+w+'" caption="'+cap+'"]'+c+'[/caption]';
+                       });
+               },
+
+               showButtons : function(n) {
+                       var t = this, ed = tinyMCE.activeEditor, p1, p2, vp, DOM = tinymce.DOM, X, Y;
+
+                       if (ed.dom.getAttrib(n, 'class').indexOf('mceItem') != -1)
+                               return;
+
+                       vp = ed.dom.getViewPort(ed.getWin());
+                       p1 = DOM.getPos(ed.getContentAreaContainer());
+                       p2 = ed.dom.getPos(n);
+
+                       X = Math.max(p2.x - vp.x, 0) + p1.x;
+                       Y = Math.max(p2.y - vp.y, 0) + p1.y;
+
+                       DOM.setStyles('wp_editbtns', {
+                               'top' : Y+5+'px',
+                               'left' : X+5+'px',
+                               'display' : 'block'
+                       });
+
+                       t.btnsTout = window.setTimeout( function(){ed.plugins.wpeditimage.hideButtons();}, 5000 );
+               },
+
+               hideButtons : function() {
+                       if ( tinymce.DOM.isHidden('wp_editbtns') ) return;
+
+                       tinymce.DOM.hide('wp_editbtns');
+                       window.clearTimeout(this.btnsTout);
+               },
+
+               _createButtons : function() {
+                       var t = this, ed = tinyMCE.activeEditor, DOM = tinymce.DOM;
+
+                       DOM.remove('wp_editbtns');
+
+                       var wp_editbtns = DOM.add(document.body, 'div', {
+                               id : 'wp_editbtns',
+                               style : 'display:none;'
+                       });
+
+                       var wp_editimgbtn = DOM.add('wp_editbtns', 'img', {
+                               src : t.url+'/img/image.png',
+                               id : 'wp_editimgbtn',
+                               width : '24',
+                               height : '24',
+                               title : ed.getLang('wpeditimage.edit_img')
+                       });
+
+                       wp_editimgbtn.onmousedown = function(e) {
+                               var ed = tinyMCE.activeEditor;
+                               ed.windowManager.bookmark = ed.selection.getBookmark('simple');
+                               ed.execCommand("WP_EditImage");
+                               this.parentNode.style.display = 'none';
+                       };
+
+                       var wp_delimgbtn = DOM.add('wp_editbtns', 'img', {
+                               src : t.url+'/img/delete.png',
+                               id : 'wp_delimgbtn',
+                               width : '24',
+                               height : '24',
+                               title : ed.getLang('wpeditimage.del_img')
+                       });
+
+                       wp_delimgbtn.onmousedown = function(e) {
+                               var ed = tinyMCE.activeEditor, el = ed.selection.getNode(), p;
+
+                               if ( el.nodeName == 'IMG' && ed.dom.getAttrib(el, 'class').indexOf('mceItem') == -1 ) {
+                                       if ( (p = ed.dom.getParent(el, 'div')) && ed.dom.hasClass(p, 'mceTemp') )
+                                               ed.dom.remove(p);
+                                       else if ( (p = ed.dom.getParent(el, 'A')) && p.childNodes.length == 1 )
+                                               ed.dom.remove(p);
+                                       else ed.dom.remove(el);
+
+                                       this.parentNode.style.display = 'none';
+                                       ed.execCommand('mceRepaint');
+                                       return false;
+                               }
+                       };
+               },
+
+               getInfo : function() {
+                       return {
+                               longname : 'Edit Image',
+                               author : 'WordPress',
+                               authorurl : 'http://wordpress.org',
+                               infourl : '',
+                               version : "1.0"
+                       };
+               }
+       });
+
+       tinymce.PluginManager.add('wpeditimage', tinymce.plugins.wpEditImage);
+})();
diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/img/delete.png b/wp-includes/js/tinymce/plugins/wpeditimage/img/delete.png
new file mode 100644 (file)
index 0000000..d64d8a6
Binary files /dev/null and b/wp-includes/js/tinymce/plugins/wpeditimage/img/delete.png differ
diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/img/image.png b/wp-includes/js/tinymce/plugins/wpeditimage/img/image.png
new file mode 100644 (file)
index 0000000..f3d4b44
Binary files /dev/null and b/wp-includes/js/tinymce/plugins/wpeditimage/img/image.png differ
diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js b/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js
new file mode 100644 (file)
index 0000000..9534c64
--- /dev/null
@@ -0,0 +1,607 @@
+
+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();
index 69e376011a2d2ff5ba548bc93177dabf29947aeb..6dc74ba7b817f96b6173a9249cbd814d22a7781c 100644 (file)
@@ -2,9 +2,9 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
        <title>{#advanced_dlg.about_title}</title>
-       <script type="text/javascript" src="../../tiny_mce_popup.js?v=307"></script>
-       <script type="text/javascript" src="../../utils/mctabs.js?v=307"></script>
-       <script type="text/javascript" src="js/about.js?v=307"></script>
+       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=311"></script>
+       <script type="text/javascript" src="../../utils/mctabs.js?ver=311"></script>
+       <script type="text/javascript" src="js/about.js?ver=311"></script>
 </head>
 <body id="about" style="display: none">
                <div class="tabs">
index 3ae87d01cd9aeb1496c9e03a8c17893bf82d30e1..a97b7cec93b0306a972457623f8c09c0693427ad 100644 (file)
@@ -2,8 +2,8 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
        <title>{#advanced_dlg.anchor_title}</title>
-       <script type="text/javascript" src="../../tiny_mce_popup.js?v=307"></script>
-       <script type="text/javascript" src="js/anchor.js?v=307"></script>
+       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=311"></script>
+       <script type="text/javascript" src="js/anchor.js?ver=311"></script>
        <base target="_self" />
 </head>
 <body style="display: none">
index 4f714576eecfa91152a449440a8bf160d744ca64..0d422ba724a63bb5855b7693568306d902f1a903 100644 (file)
@@ -3,8 +3,8 @@
 <head>
        <title>{#advanced_dlg.charmap_title}</title>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
-       <script type="text/javascript" src="../../tiny_mce_popup.js?v=307"></script>
-       <script type="text/javascript" src="js/charmap.js?v=307"></script>
+       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=311"></script>
+       <script type="text/javascript" src="js/charmap.js?ver=311"></script>
        <base target="_self" />
 </head>
 <body id="charmap" style="display:none">
index 62fc40f43e7a18b86d71029d3053e051e8688f51..faaa8400923881be4741120af95544779a8e7256 100644 (file)
@@ -2,9 +2,9 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
        <title>{#advanced_dlg.colorpicker_title}</title>
-       <script type="text/javascript" src="../../tiny_mce_popup.js?v=307"></script>
-       <script type="text/javascript" src="../../utils/mctabs.js?v=307"></script>
-       <script type="text/javascript" src="js/color_picker.js?v=307"></script>
+       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=311"></script>
+       <script type="text/javascript" src="../../utils/mctabs.js?ver=311"></script>
+       <script type="text/javascript" src="js/color_picker.js?ver=311"></script>
        <base target="_self" />
 </head>
 <body id="colorpicker" style="display: none">
index 465a80904a93f264d9f489478f30db488505b134..eea384f751aac2080c8f229e7a60f142f8c6cbdf 100644 (file)
@@ -1 +1 @@
-(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,extend=tinymce.extend,each=tinymce.each,Cookie=tinymce.util.Cookie,lastExtID,explode=tinymce.explode;tinymce.ThemeManager.requireLangPack('advanced');tinymce.create('tinymce.themes.AdvancedTheme',{controls:{bold:['bold_desc','Bold'],italic:['italic_desc','Italic'],underline:['underline_desc','Underline'],strikethrough:['striketrough_desc','Strikethrough'],justifyleft:['justifyleft_desc','JustifyLeft'],justifycenter:['justifycenter_desc','JustifyCenter'],justifyright:['justifyright_desc','JustifyRight'],justifyfull:['justifyfull_desc','JustifyFull'],bullist:['bullist_desc','InsertUnorderedList'],numlist:['numlist_desc','InsertOrderedList'],outdent:['outdent_desc','Outdent'],indent:['indent_desc','Indent'],cut:['cut_desc','Cut'],copy:['copy_desc','Copy'],paste:['paste_desc','Paste'],undo:['undo_desc','Undo'],redo:['redo_desc','Redo'],link:['link_desc','mceLink'],unlink:['unlink_desc','unlink'],image:['image_desc','mceImage'],cleanup:['cleanup_desc','mceCleanup'],help:['help_desc','mceHelp'],code:['code_desc','mceCodeEditor'],hr:['hr_desc','InsertHorizontalRule'],removeformat:['removeformat_desc','RemoveFormat'],sub:['sub_desc','subscript'],sup:['sup_desc','superscript'],forecolor:['forecolor_desc','ForeColor'],forecolorpicker:['forecolor_desc','mceForeColor'],backcolor:['backcolor_desc','HiliteColor'],backcolorpicker:['backcolor_desc','mceBackColor'],charmap:['charmap_desc','mceCharMap'],visualaid:['visualaid_desc','mceToggleVisualAid'],anchor:['anchor_desc','mceInsertAnchor'],newdocument:['newdocument_desc','mceNewDocument'],blockquote:['blockquote_desc','mceBlockQuote']},stateControls:['bold','italic','underline','strikethrough','bullist','numlist','justifyleft','justifycenter','justifyright','justifyfull','sub','sup','blockquote'],init:function(ed,url){var t=this,s,v;t.editor=ed;t.url=url;t.onResolveName=new tinymce.util.Dispatcher(this);t.settings=s=extend({theme_advanced_path:true,theme_advanced_toolbar_location:'bottom',theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,|,sub,sup,|,charmap",theme_advanced_blockformats:"p,address,pre,h1,h2,h3,h4,h5,h6",theme_advanced_toolbar_align:"center",theme_advanced_fonts:"Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",theme_advanced_font_sizes:"1,2,3,4,5,6,7",theme_advanced_more_colors:1,theme_advanced_row_height:23,theme_advanced_resize_horizontal:1,theme_advanced_resizing_use_cookie:1},ed.settings);if((v=s.theme_advanced_path_location)&&v!='none')s.theme_advanced_statusbar_location=s.theme_advanced_path_location;if(s.theme_advanced_statusbar_location=='none')s.theme_advanced_statusbar_location=0;ed.onInit.add(function(){ed.onNodeChange.add(t._nodeChanged,t);if(ed.settings.content_css!==false)ed.dom.loadCSS(ed.baseURI.toAbsolute("themes/advanced/skins/"+ed.settings.skin+"/content.css"));});ed.onSetProgressState.add(function(ed,b,ti){var co,id=ed.id,tb;if(b){t.progressTimer=setTimeout(function(){co=ed.getContainer();co=co.insertBefore(DOM.create('DIV',{style:'position:relative'}),co.firstChild);tb=DOM.get(ed.id+'_tbl');DOM.add(co,'div',{id:id+'_blocker','class':'mceBlocker',style:{width:tb.clientWidth+2,height:tb.clientHeight+2}});DOM.add(co,'div',{id:id+'_progress','class':'mceProgress',style:{left:tb.clientWidth/ 2, top : tb.clientHeight /2}});},ti||0);}else{DOM.remove(id+'_blocker');DOM.remove(id+'_progress');clearTimeout(t.progressTimer);}});DOM.loadCSS(ed.baseURI.toAbsolute(s.editor_css||"themes/advanced/skins/"+ed.settings.skin+"/ui.css"));if(s.skin_variant)DOM.loadCSS(ed.baseURI.toAbsolute(s.editor_css||"themes/advanced/skins/"+ed.settings.skin+"/ui_"+s.skin_variant+".css"));},createControl:function(n,cf){var cd,c;if(c=cf.createControl(n))return c;switch(n){case"styleselect":return this._createStyleSelect();case"formatselect":return this._createBlockFormats();case"fontselect":return this._createFontSelect();case"fontsizeselect":return this._createFontSizeSelect();case"forecolor":return this._createForeColorMenu();case"backcolor":return this._createBackColorMenu();}if((cd=this.controls[n]))return cf.createButton(n,{title:"advanced."+cd[0],cmd:cd[1],ui:cd[2],value:cd[3]});},execCommand:function(cmd,ui,val){var f=this['_'+cmd];if(f){f.call(this,ui,val);return true;}return false;},_importClasses:function(){var ed=this.editor,c=ed.controlManager.get('styleselect');if(c.getLength()==0){each(ed.dom.getClasses(),function(o){c.add(o['class'],o['class']);});}},_createStyleSelect:function(n){var t=this,ed=t.editor,cf=ed.controlManager,c=cf.createListBox('styleselect',{title:'advanced.style_select',onselect:function(v){if(c.selectedValue===v){ed.execCommand('mceSetStyleInfo',0,{command:'removeformat'});c.select();return false;}else ed.execCommand('mceSetCSSClass',0,v);}});if(c){each(ed.getParam('theme_advanced_styles','','hash'),function(v,k){if(v)c.add(t.editor.translate(k),v);});c.onPostRender.add(function(ed,n){Event.add(n,'focus',t._importClasses,t);Event.add(n,'mousedown',t._importClasses,t);});}return c;},_createFontSelect:function(){var c,t=this,ed=t.editor;c=ed.controlManager.createListBox('fontselect',{title:'advanced.fontdefault',cmd:'FontName'});if(c){each(ed.getParam('theme_advanced_fonts',t.settings.theme_advanced_fonts,'hash'),function(v,k){c.add(ed.translate(k),v,{style:v.indexOf('dings')==-1?'font-family:'+v:''});});}return c;},_createFontSizeSelect:function(){var c,t=this,lo=["1 (8 pt)","2 (10 pt)","3 (12 pt)","4 (14 pt)","5 (18 pt)","6 (24 pt)","7 (36 pt)"],fz=[8,10,12,14,18,24,36];c=t.editor.controlManager.createListBox('fontsizeselect',{title:'advanced.font_size',cmd:'FontSize'});if(c){each(explode(t.settings.theme_advanced_font_sizes),function(v){c.add(lo[parseInt(v)-1],v,{'style':'font-size:'+fz[v-1]+'pt','class':'mceFontSize'+v});});}return c;},_createBlockFormats:function(){var c,fmts={p:'advanced.paragraph',address:'advanced.address',pre:'advanced.pre',h1:'advanced.h1',h2:'advanced.h2',h3:'advanced.h3',h4:'advanced.h4',h5:'advanced.h5',h6:'advanced.h6',div:'advanced.div',blockquote:'advanced.blockquote',code:'advanced.code',dt:'advanced.dt',dd:'advanced.dd',samp:'advanced.samp'},t=this;c=t.editor.controlManager.createListBox('formatselect',{title:'advanced.block',cmd:'FormatBlock'});if(c){each(t.editor.getParam('theme_advanced_blockformats',t.settings.theme_advanced_blockformats,'hash'),function(v,k){c.add(t.editor.translate(k!=v?k:fmts[v]),v,{'class':'mce_formatPreview mce_'+v});});}return c;},_createForeColorMenu:function(){var c,t=this,s=t.settings,o={},v;if(s.theme_advanced_more_colors){o.more_colors_func=function(){t._mceColorPicker(0,{color:c.value,func:function(co){c.setColor(co);}});};}if(v=s.theme_advanced_text_colors)o.colors=v;o.title='advanced.forecolor_desc';o.cmd='ForeColor';o.scope=this;c=t.editor.controlManager.createColorSplitButton('forecolor',o);return c;},_createBackColorMenu:function(){var c,t=this,s=t.settings,o={},v;if(s.theme_advanced_more_colors){o.more_colors_func=function(){t._mceColorPicker(0,{color:c.value,func:function(co){c.setColor(co);}});};}if(v=s.theme_advanced_background_colors)o.colors=v;o.title='advanced.backcolor_desc';o.cmd='HiliteColor';o.scope=this;c=t.editor.controlManager.createColorSplitButton('backcolor',o);return c;},renderUI:function(o){var n,ic,tb,t=this,ed=t.editor,s=t.settings,sc,p,nl;n=p=DOM.create('span',{id:ed.id+'_parent','class':'mceEditor '+ed.settings.skin+'Skin'+(s.skin_variant?' '+ed.settings.skin+'Skin'+t._ufirst(s.skin_variant):'')});if(!DOM.boxModel)n=DOM.add(n,'div',{'class':'mceOldBoxModel'});n=sc=DOM.add(n,'table',{id:ed.id+'_tbl','class':'mceLayout',cellSpacing:0,cellPadding:0});n=tb=DOM.add(n,'tbody');switch((s.theme_advanced_layout_manager||'').toLowerCase()){case"rowlayout":ic=t._rowLayout(s,tb,o);break;case"customlayout":ic=ed.execCallback("theme_advanced_custom_layout",s,tb,o,p);break;default:ic=t._simpleLayout(s,tb,o,p);}n=o.targetNode;nl=DOM.stdMode?sc.getElementsByTagName('tr'):sc.rows;DOM.addClass(nl[0],'mceFirst');DOM.addClass(nl[nl.length-1],'mceLast');each(DOM.select('tr',tb),function(n){DOM.addClass(n.firstChild,'mceFirst');DOM.addClass(n.childNodes[n.childNodes.length-1],'mceLast');});if(DOM.get(s.theme_advanced_toolbar_container))DOM.get(s.theme_advanced_toolbar_container).appendChild(p);else DOM.insertAfter(p,n);Event.add(ed.id+'_path_row','click',function(e){e=e.target;if(e.nodeName=='A'){t._sel(e.className.replace(/^.*mcePath_([0-9]+).*$/,'$1'));return Event.cancel(e);}});if(!ed.getParam('accessibility_focus')||ed.getParam('tab_focus'))Event.add(DOM.add(p,'a',{href:'#'},'<!-- IE -->'),'focus',function(){tinyMCE.get(ed.id).focus();});if(s.theme_advanced_toolbar_location=='external')o.deltaHeight=0;t.deltaHeight=o.deltaHeight;o.targetNode=null;return{iframeContainer:ic,editorContainer:ed.id+'_parent',sizeContainer:sc,deltaHeight:o.deltaHeight};},getInfo:function(){return{longname:'Advanced theme',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',version:tinymce.majorVersion+"."+tinymce.minorVersion}},resizeBy:function(dw,dh){var e=DOM.get(this.editor.id+'_tbl');this.resizeTo(e.clientWidth+dw,e.clientHeight+dh);},resizeTo:function(w,h){var ed=this.editor,s=ed.settings,e=DOM.get(ed.id+'_tbl'),ifr=DOM.get(ed.id+'_ifr'),dh;w=Math.max(s.theme_advanced_resizing_min_width||100,w);h=Math.max(s.theme_advanced_resizing_min_height||100,h);w=Math.min(s.theme_advanced_resizing_max_width||0xFFFF,w);h=Math.min(s.theme_advanced_resizing_max_height||0xFFFF,h);dh=e.clientHeight-ifr.clientHeight;DOM.setStyle(ifr,'height',h-dh);DOM.setStyles(e,{width:w,height:h});},destroy:function(){var id=this.editor.id;Event.clear(id+'_resize');Event.clear(id+'_path_row');Event.clear(id+'_external_close');},_simpleLayout:function(s,tb,o,p){var t=this,ed=t.editor,lo=s.theme_advanced_toolbar_location,sl=s.theme_advanced_statusbar_location,n,ic,etb,c;if(lo=='top')t._addToolbars(tb,o);if(lo=='external'){n=c=DOM.create('div',{style:'position:relative'});n=DOM.add(n,'div',{id:ed.id+'_external','class':'mceExternalToolbar'});DOM.add(n,'a',{id:ed.id+'_external_close',href:'javascript:;','class':'mceExternalClose'});n=DOM.add(n,'table',{id:ed.id+'_tblext',cellSpacing:0,cellPadding:0});etb=DOM.add(n,'tbody');if(p.firstChild.className=='mceOldBoxModel')p.firstChild.appendChild(c);else p.insertBefore(c,p.firstChild);t._addToolbars(etb,o);ed.onMouseUp.add(function(){var e=DOM.get(ed.id+'_external');DOM.show(e);DOM.hide(lastExtID);var f=Event.add(ed.id+'_external_close','click',function(){DOM.hide(ed.id+'_external');Event.remove(ed.id+'_external_close','click',f);});DOM.show(e);DOM.setStyle(e,'top',0-DOM.getRect(ed.id+'_tblext').h-1);DOM.hide(e);DOM.show(e);e.style.filter='';lastExtID=ed.id+'_external';e=null;});}if(sl=='top')t._addStatusBar(tb,o);if(!s.theme_advanced_toolbar_container){n=DOM.add(tb,'tr');n=ic=DOM.add(n,'td',{'class':'mceIframeContainer'});}if(lo=='bottom')t._addToolbars(tb,o);if(sl=='bottom')t._addStatusBar(tb,o);return ic;},_rowLayout:function(s,tb,o){var t=this,ed=t.editor,dc,da,cf=ed.controlManager,n,ic,to,a;dc=s.theme_advanced_containers_default_class||'';da=s.theme_advanced_containers_default_align||'center';each(explode(s.theme_advanced_containers||''),function(c,i){var v=s['theme_advanced_container_'+c]||'';switch(c.toLowerCase()){case'mceeditor':n=DOM.add(tb,'tr');n=ic=DOM.add(n,'td',{'class':'mceIframeContainer'});break;case'mceelementpath':t._addStatusBar(tb,o);break;default:a=s['theme_advanced_container_'+c+'_align'].toLowerCase();a='mce'+t._ufirst(a);n=DOM.add(DOM.add(tb,'tr'),'td',{'class':'mceToolbar '+(s['theme_advanced_container_'+c+'_class']||dc)+' '+a||da});to=cf.createToolbar("toolbar"+i);t._addControls(v,to);DOM.setHTML(n,to.renderHTML());o.deltaHeight-=s.theme_advanced_row_height;}});return ic;},_addControls:function(v,tb){var t=this,s=t.settings,di,cf=t.editor.controlManager;if(s.theme_advanced_disable&&!t._disabled){di={};each(explode(s.theme_advanced_disable),function(v){di[v]=1;});t._disabled=di;}else di=t._disabled;each(explode(v),function(n){var c;if(di&&di[n])return;if(n=='tablecontrols'){each(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"],function(n){n=t.createControl(n,cf);if(n)tb.add(n);});return;}c=t.createControl(n,cf);if(c)tb.add(c);});},_addToolbars:function(c,o){var t=this,i,tb,ed=t.editor,s=t.settings,v,cf=ed.controlManager,di,n,h=[],a;a=s.theme_advanced_toolbar_align.toLowerCase();a='mce'+t._ufirst(a);n=DOM.add(DOM.add(c,'tr'),'td',{'class':'mceToolbar '+a});if(!ed.getParam('accessibility_focus')||ed.getParam('tab_focus'))h.push(DOM.createHTML('a',{href:'#',onfocus:'tinyMCE.get(\''+ed.id+'\').focus();'},'<!-- IE -->'));h.push(DOM.createHTML('a',{href:'#',accesskey:'q',title:ed.getLang("advanced.toolbar_focus")},'<!-- IE -->'));for(i=1;(v=s['theme_advanced_buttons'+i]);i++){tb=cf.createToolbar("toolbar"+i,{'class':'mceToolbarRow'+i});if(s['theme_advanced_buttons'+i+'_add'])v+=','+s['theme_advanced_buttons'+i+'_add'];if(s['theme_advanced_buttons'+i+'_add_before'])v=s['theme_advanced_buttons'+i+'_add_before']+','+v;t._addControls(v,tb);h.push(tb.renderHTML());o.deltaHeight-=s.theme_advanced_row_height;}h.push(DOM.createHTML('a',{href:'#',accesskey:'z',title:ed.getLang("advanced.toolbar_focus"),onfocus:'tinyMCE.getInstanceById(\''+ed.id+'\').focus();'},'<!-- IE -->'));DOM.setHTML(n,h.join(''));},_addStatusBar:function(tb,o){var n,t=this,ed=t.editor,s=t.settings,r,mf,me,td;n=DOM.add(tb,'tr');n=td=DOM.add(n,'td',{'class':'mceStatusbar'});n=DOM.add(n,'div',{id:ed.id+'_path_row'},s.theme_advanced_path?ed.translate('advanced.path')+': ':'&nbsp;');DOM.add(n,'a',{href:'#',accesskey:'x'});if(s.theme_advanced_resizing&&!tinymce.isOldWebKit){DOM.add(td,'a',{id:ed.id+'_resize',href:'javascript:;',onclick:"return false;",'class':'mceResize'});if(s.theme_advanced_resizing_use_cookie){ed.onPostRender.add(function(){var o=Cookie.getHash("TinyMCE_"+ed.id+"_size"),c=DOM.get(ed.id+'_tbl');if(!o)return;if(s.theme_advanced_resize_horizontal)c.style.width=Math.max(10,o.cw)+'px';c.style.height=Math.max(10,o.ch)+'px';DOM.get(ed.id+'_ifr').style.height=Math.max(10,parseInt(o.ch)+t.deltaHeight)+'px';});}ed.onPostRender.add(function(){Event.add(ed.id+'_resize','mousedown',function(e){var c,p,w,h,n,pa;c=DOM.get(ed.id+'_tbl');w=c.clientWidth;h=c.clientHeight;miw=s.theme_advanced_resizing_min_width||100;mih=s.theme_advanced_resizing_min_height||100;maw=s.theme_advanced_resizing_max_width||0xFFFF;mah=s.theme_advanced_resizing_max_height||0xFFFF;p=DOM.add(DOM.get(ed.id+'_parent'),'div',{'class':'mcePlaceHolder'});DOM.setStyles(p,{width:w,height:h});DOM.hide(c);DOM.show(p);r={x:e.screenX,y:e.screenY,w:w,h:h,dx:null,dy:null};mf=Event.add(DOM.doc,'mousemove',function(e){var w,h;r.dx=e.screenX-r.x;r.dy=e.screenY-r.y;w=Math.max(miw,r.w+r.dx);h=Math.max(mih,r.h+r.dy);w=Math.min(maw,w);h=Math.min(mah,h);if(s.theme_advanced_resize_horizontal)p.style.width=w+'px';p.style.height=h+'px';return Event.cancel(e);});me=Event.add(DOM.doc,'mouseup',function(e){var ifr;Event.remove(DOM.doc,'mousemove',mf);Event.remove(DOM.doc,'mouseup',me);c.style.display='';DOM.remove(p);if(r.dx===null)return;ifr=DOM.get(ed.id+'_ifr');if(s.theme_advanced_resize_horizontal)c.style.width=Math.max(10,r.w+r.dx)+'px';c.style.height=Math.max(10,r.h+r.dy)+'px';ifr.style.height=Math.max(10,ifr.clientHeight+r.dy)+'px';if(s.theme_advanced_resizing_use_cookie){Cookie.setHash("TinyMCE_"+ed.id+"_size",{cw:r.w+r.dx,ch:r.h+r.dy});}});return Event.cancel(e);});});}o.deltaHeight-=21;n=tb=null;},_nodeChanged:function(ed,cm,n,co){var t=this,p,de=0,v,c,s=t.settings;tinymce.each(t.stateControls,function(c){cm.setActive(c,ed.queryCommandState(t.controls[c][1]));});cm.setActive('visualaid',ed.hasVisual);cm.setDisabled('undo',!ed.undoManager.hasUndo()&&!ed.typing);cm.setDisabled('redo',!ed.undoManager.hasRedo());cm.setDisabled('outdent',!ed.queryCommandState('Outdent'));p=DOM.getParent(n,'A');if(c=cm.get('link')){if(!p||!p.name){c.setDisabled(!p&&co);c.setActive(!!p);}}if(c=cm.get('unlink')){c.setDisabled(!p&&co);c.setActive(!!p&&!p.name);}if(c=cm.get('anchor')){c.setActive(!!p&&p.name);if(tinymce.isWebKit){p=DOM.getParent(n,'IMG');c.setActive(!!p&&DOM.getAttrib(p,'mce_name')=='a');}}p=DOM.getParent(n,'IMG');if(c=cm.get('image'))c.setActive(!!p&&n.className.indexOf('mceItem')==-1);if(c=cm.get('styleselect')){if(n.className){t._importClasses();c.select(n.className);}else c.select();}if(c=cm.get('formatselect')){p=DOM.getParent(n,DOM.isBlock);if(p)c.select(p.nodeName.toLowerCase());}if(c=cm.get('fontselect'))c.select(ed.queryCommandValue('FontName'));if(c=cm.get('fontsizeselect'))c.select(ed.queryCommandValue('FontSize'));if(s.theme_advanced_path&&s.theme_advanced_statusbar_location){p=DOM.get(ed.id+'_path')||DOM.add(ed.id+'_path_row','span',{id:ed.id+'_path'});DOM.setHTML(p,'');ed.dom.getParent(n,function(n){var na=n.nodeName.toLowerCase(),u,pi,ti='';if(n.nodeType!=1||(DOM.hasClass(n,'mceItemHidden')||DOM.hasClass(n,'mceItemRemoved')))return;if(v=DOM.getAttrib(n,'mce_name'))na=v;if(tinymce.isIE&&n.scopeName!=='HTML')na=n.scopeName+':'+na;na=na.replace(/mce\:/g,'');switch(na){case'b':na='strong';break;case'i':na='em';break;case'img':if(v=DOM.getAttrib(n,'src'))ti+='src: '+v+' ';break;case'a':if(v=DOM.getAttrib(n,'name')){ti+='name: '+v+' ';na+='#'+v;}if(v=DOM.getAttrib(n,'href'))ti+='href: '+v+' ';break;case'font':if(s.convert_fonts_to_spans)na='span';if(v=DOM.getAttrib(n,'face'))ti+='font: '+v+' ';if(v=DOM.getAttrib(n,'size'))ti+='size: '+v+' ';if(v=DOM.getAttrib(n,'color'))ti+='color: '+v+' ';break;case'span':if(v=DOM.getAttrib(n,'style'))ti+='style: '+v+' ';break;}if(v=DOM.getAttrib(n,'id'))ti+='id: '+v+' ';if(v=n.className){v=v.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g,'');if(v&&v.indexOf('mceItem')==-1){ti+='class: '+v+' ';if(DOM.isBlock(n)||na=='img'||na=='span')na+='.'+v;}}na=na.replace(/(html:)/g,'');na={name:na,node:n,title:ti};t.onResolveName.dispatch(t,na);ti=na.title;na=na.name;pi=DOM.create('a',{'href':"javascript:;",onmousedown:"return false;",title:ti,'class':'mcePath_'+(de++)},na);if(p.hasChildNodes()){p.insertBefore(DOM.doc.createTextNode(' \u00bb '),p.firstChild);p.insertBefore(pi,p.firstChild);}else p.appendChild(pi);},ed.getBody());}},_sel:function(v){this.editor.execCommand('mceSelectNodeDepth',false,v);},_mceInsertAnchor:function(ui,v){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/anchor.htm',width:320+parseInt(ed.getLang('advanced.anchor_delta_width',0)),height:90+parseInt(ed.getLang('advanced.anchor_delta_height',0)),inline:true},{theme_url:this.url});},_mceCharMap:function(){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/charmap.htm',width:550+parseInt(ed.getLang('advanced.charmap_delta_width',0)),height:250+parseInt(ed.getLang('advanced.charmap_delta_height',0)),inline:true},{theme_url:this.url});},_mceHelp:function(){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/about.htm',width:480,height:380,inline:true},{theme_url:this.url});},_mceColorPicker:function(u,v){var ed=this.editor;v=v||{};ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/color_picker.htm',width:375+parseInt(ed.getLang('advanced.colorpicker_delta_width',0)),height:250+parseInt(ed.getLang('advanced.colorpicker_delta_height',0)),close_previous:false,inline:true},{input_color:v.color,func:v.func,theme_url:this.url});},_mceCodeEditor:function(ui,val){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/source_editor.htm',width:parseInt(ed.getParam("theme_advanced_source_editor_width",720)),height:parseInt(ed.getParam("theme_advanced_source_editor_height",580)),inline:true,resizable:true,maximizable:true},{theme_url:this.url});},_mceImage:function(ui,val){var ed=this.editor;if(ed.dom.getAttrib(ed.selection.getNode(),'class').indexOf('mceItem')!=-1)return;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/image.htm',width:355+parseInt(ed.getLang('advanced.image_delta_width',0)),height:275+parseInt(ed.getLang('advanced.image_delta_height',0)),inline:true},{theme_url:this.url});},_mceLink:function(ui,val){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/link.htm',width:310+parseInt(ed.getLang('advanced.link_delta_width',0)),height:200+parseInt(ed.getLang('advanced.link_delta_height',0)),inline:true},{theme_url:this.url});},_mceNewDocument:function(){var ed=this.editor;ed.windowManager.confirm('advanced.newdocument',function(s){if(s)ed.execCommand('mceSetContent',false,'');});},_mceForeColor:function(){var t=this;this._mceColorPicker(0,{color:t.fgColor,func:function(co){t.fgColor=co;t.editor.execCommand('ForeColor',false,co);}});},_mceBackColor:function(){var t=this;this._mceColorPicker(0,{color:t.bgColor,func:function(co){t.bgColor=co;t.editor.execCommand('HiliteColor',false,co);}});},_ufirst:function(s){return s.substring(0,1).toUpperCase()+s.substring(1);}});tinymce.ThemeManager.add('advanced',tinymce.themes.AdvancedTheme);}());
\ No newline at end of file
+(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,extend=tinymce.extend,each=tinymce.each,Cookie=tinymce.util.Cookie,lastExtID,explode=tinymce.explode;tinymce.ThemeManager.requireLangPack('advanced');tinymce.create('tinymce.themes.AdvancedTheme',{controls:{bold:['bold_desc','Bold'],italic:['italic_desc','Italic'],underline:['underline_desc','Underline'],strikethrough:['striketrough_desc','Strikethrough'],justifyleft:['justifyleft_desc','JustifyLeft'],justifycenter:['justifycenter_desc','JustifyCenter'],justifyright:['justifyright_desc','JustifyRight'],justifyfull:['justifyfull_desc','JustifyFull'],bullist:['bullist_desc','InsertUnorderedList'],numlist:['numlist_desc','InsertOrderedList'],outdent:['outdent_desc','Outdent'],indent:['indent_desc','Indent'],cut:['cut_desc','Cut'],copy:['copy_desc','Copy'],paste:['paste_desc','Paste'],undo:['undo_desc','Undo'],redo:['redo_desc','Redo'],link:['link_desc','mceLink'],unlink:['unlink_desc','unlink'],image:['image_desc','mceImage'],cleanup:['cleanup_desc','mceCleanup'],help:['help_desc','mceHelp'],code:['code_desc','mceCodeEditor'],hr:['hr_desc','InsertHorizontalRule'],removeformat:['removeformat_desc','RemoveFormat'],sub:['sub_desc','subscript'],sup:['sup_desc','superscript'],forecolor:['forecolor_desc','ForeColor'],forecolorpicker:['forecolor_desc','mceForeColor'],backcolor:['backcolor_desc','HiliteColor'],backcolorpicker:['backcolor_desc','mceBackColor'],charmap:['charmap_desc','mceCharMap'],visualaid:['visualaid_desc','mceToggleVisualAid'],anchor:['anchor_desc','mceInsertAnchor'],newdocument:['newdocument_desc','mceNewDocument'],blockquote:['blockquote_desc','mceBlockQuote']},stateControls:['bold','italic','underline','strikethrough','bullist','numlist','justifyleft','justifycenter','justifyright','justifyfull','sub','sup','blockquote'],init:function(ed,url){var t=this,s,v;t.editor=ed;t.url=url;t.onResolveName=new tinymce.util.Dispatcher(this);t.settings=s=extend({theme_advanced_path:true,theme_advanced_toolbar_location:'bottom',theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,|,sub,sup,|,charmap",theme_advanced_blockformats:"p,address,pre,h1,h2,h3,h4,h5,h6",theme_advanced_toolbar_align:"center",theme_advanced_fonts:"Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",theme_advanced_font_sizes:"1,2,3,4,5,6,7",theme_advanced_more_colors:1,theme_advanced_row_height:23,theme_advanced_resize_horizontal:1,theme_advanced_resizing_use_cookie:1},ed.settings);if((v=s.theme_advanced_path_location)&&v!='none')s.theme_advanced_statusbar_location=s.theme_advanced_path_location;if(s.theme_advanced_statusbar_location=='none')s.theme_advanced_statusbar_location=0;ed.onInit.add(function(){ed.onNodeChange.add(t._nodeChanged,t);if(ed.settings.content_css!==false)ed.dom.loadCSS(ed.baseURI.toAbsolute("themes/advanced/skins/"+ed.settings.skin+"/content.css"));});ed.onSetProgressState.add(function(ed,b,ti){var co,id=ed.id,tb;if(b){t.progressTimer=setTimeout(function(){co=ed.getContainer();co=co.insertBefore(DOM.create('DIV',{style:'position:relative'}),co.firstChild);tb=DOM.get(ed.id+'_tbl');DOM.add(co,'div',{id:id+'_blocker','class':'mceBlocker',style:{width:tb.clientWidth+2,height:tb.clientHeight+2}});DOM.add(co,'div',{id:id+'_progress','class':'mceProgress',style:{left:tb.clientWidth/ 2, top : tb.clientHeight /2}});},ti||0);}else{DOM.remove(id+'_blocker');DOM.remove(id+'_progress');clearTimeout(t.progressTimer);}});DOM.loadCSS(ed.baseURI.toAbsolute(s.editor_css||"themes/advanced/skins/"+ed.settings.skin+"/ui.css"));if(s.skin_variant)DOM.loadCSS(ed.baseURI.toAbsolute(s.editor_css||"themes/advanced/skins/"+ed.settings.skin+"/ui_"+s.skin_variant+".css"));},createControl:function(n,cf){var cd,c;if(c=cf.createControl(n))return c;switch(n){case"styleselect":return this._createStyleSelect();case"formatselect":return this._createBlockFormats();case"fontselect":return this._createFontSelect();case"fontsizeselect":return this._createFontSizeSelect();case"forecolor":return this._createForeColorMenu();case"backcolor":return this._createBackColorMenu();}if((cd=this.controls[n]))return cf.createButton(n,{title:"advanced."+cd[0],cmd:cd[1],ui:cd[2],value:cd[3]});},execCommand:function(cmd,ui,val){var f=this['_'+cmd];if(f){f.call(this,ui,val);return true;}return false;},_importClasses:function(e){var ed=this.editor,c=ed.controlManager.get('styleselect');if(c.getLength()==0){each(ed.dom.getClasses(),function(o){c.add(o['class'],o['class']);});}},_createStyleSelect:function(n){var t=this,ed=t.editor,cf=ed.controlManager,c=cf.createListBox('styleselect',{title:'advanced.style_select',onselect:function(v){if(c.selectedValue===v){ed.execCommand('mceSetStyleInfo',0,{command:'removeformat'});c.select();return false;}else ed.execCommand('mceSetCSSClass',0,v);}});if(c){each(ed.getParam('theme_advanced_styles','','hash'),function(v,k){if(v)c.add(t.editor.translate(k),v);});c.onPostRender.add(function(ed,n){Event.add(n.id+'_text','focus',t._importClasses,t);Event.add(n.id+'_text','mousedown',t._importClasses,t);});}return c;},_createFontSelect:function(){var c,t=this,ed=t.editor;c=ed.controlManager.createListBox('fontselect',{title:'advanced.fontdefault',cmd:'FontName'});if(c){each(ed.getParam('theme_advanced_fonts',t.settings.theme_advanced_fonts,'hash'),function(v,k){c.add(ed.translate(k),v,{style:v.indexOf('dings')==-1?'font-family:'+v:''});});}return c;},_createFontSizeSelect:function(){var t=this,ed=t.editor,c,lo=["1 (8 pt)","2 (10 pt)","3 (12 pt)","4 (14 pt)","5 (18 pt)","6 (24 pt)","7 (36 pt)"],fz=[8,10,12,14,18,24,36];c=ed.controlManager.createListBox('fontsizeselect',{title:'advanced.font_size',cmd:'FontSize'});if(c){each(ed.getParam('theme_advanced_font_sizes',t.settings.theme_advanced_font_sizes,'hash'),function(v,k){c.add(k!=v?k:lo[parseInt(v)-1],v,{'style':'font-size:'+fz[v-1]+'pt','class':'mceFontSize'+v});});}return c;},_createBlockFormats:function(){var c,fmts={p:'advanced.paragraph',address:'advanced.address',pre:'advanced.pre',h1:'advanced.h1',h2:'advanced.h2',h3:'advanced.h3',h4:'advanced.h4',h5:'advanced.h5',h6:'advanced.h6',div:'advanced.div',blockquote:'advanced.blockquote',code:'advanced.code',dt:'advanced.dt',dd:'advanced.dd',samp:'advanced.samp'},t=this;c=t.editor.controlManager.createListBox('formatselect',{title:'advanced.block',cmd:'FormatBlock'});if(c){each(t.editor.getParam('theme_advanced_blockformats',t.settings.theme_advanced_blockformats,'hash'),function(v,k){c.add(t.editor.translate(k!=v?k:fmts[v]),v,{'class':'mce_formatPreview mce_'+v});});}return c;},_createForeColorMenu:function(){var c,t=this,s=t.settings,o={},v;if(s.theme_advanced_more_colors){o.more_colors_func=function(){t._mceColorPicker(0,{color:c.value,func:function(co){c.setColor(co);}});};}if(v=s.theme_advanced_text_colors)o.colors=v;o.title='advanced.forecolor_desc';o.cmd='ForeColor';o.scope=this;c=t.editor.controlManager.createColorSplitButton('forecolor',o);return c;},_createBackColorMenu:function(){var c,t=this,s=t.settings,o={},v;if(s.theme_advanced_more_colors){o.more_colors_func=function(){t._mceColorPicker(0,{color:c.value,func:function(co){c.setColor(co);}});};}if(v=s.theme_advanced_background_colors)o.colors=v;o.title='advanced.backcolor_desc';o.cmd='HiliteColor';o.scope=this;c=t.editor.controlManager.createColorSplitButton('backcolor',o);return c;},renderUI:function(o){var n,ic,tb,t=this,ed=t.editor,s=t.settings,sc,p,nl;n=p=DOM.create('span',{id:ed.id+'_parent','class':'mceEditor '+ed.settings.skin+'Skin'+(s.skin_variant?' '+ed.settings.skin+'Skin'+t._ufirst(s.skin_variant):'')});if(!DOM.boxModel)n=DOM.add(n,'div',{'class':'mceOldBoxModel'});n=sc=DOM.add(n,'table',{id:ed.id+'_tbl','class':'mceLayout',cellSpacing:0,cellPadding:0});n=tb=DOM.add(n,'tbody');switch((s.theme_advanced_layout_manager||'').toLowerCase()){case"rowlayout":ic=t._rowLayout(s,tb,o);break;case"customlayout":ic=ed.execCallback("theme_advanced_custom_layout",s,tb,o,p);break;default:ic=t._simpleLayout(s,tb,o,p);}n=o.targetNode;nl=DOM.stdMode?sc.getElementsByTagName('tr'):sc.rows;DOM.addClass(nl[0],'mceFirst');DOM.addClass(nl[nl.length-1],'mceLast');each(DOM.select('tr',tb),function(n){DOM.addClass(n.firstChild,'mceFirst');DOM.addClass(n.childNodes[n.childNodes.length-1],'mceLast');});if(DOM.get(s.theme_advanced_toolbar_container))DOM.get(s.theme_advanced_toolbar_container).appendChild(p);else DOM.insertAfter(p,n);Event.add(ed.id+'_path_row','click',function(e){e=e.target;if(e.nodeName=='A'){t._sel(e.className.replace(/^.*mcePath_([0-9]+).*$/,'$1'));return Event.cancel(e);}});if(!ed.getParam('accessibility_focus')||ed.getParam('tab_focus'))Event.add(DOM.add(p,'a',{href:'#'},'<!-- IE -->'),'focus',function(){tinyMCE.get(ed.id).focus();});if(s.theme_advanced_toolbar_location=='external')o.deltaHeight=0;t.deltaHeight=o.deltaHeight;o.targetNode=null;return{iframeContainer:ic,editorContainer:ed.id+'_parent',sizeContainer:sc,deltaHeight:o.deltaHeight};},getInfo:function(){return{longname:'Advanced theme',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',version:tinymce.majorVersion+"."+tinymce.minorVersion}},resizeBy:function(dw,dh){var e=DOM.get(this.editor.id+'_tbl');this.resizeTo(e.clientWidth+dw,e.clientHeight+dh);},resizeTo:function(w,h){var ed=this.editor,s=ed.settings,e=DOM.get(ed.id+'_tbl'),ifr=DOM.get(ed.id+'_ifr'),dh;w=Math.max(s.theme_advanced_resizing_min_width||100,w);h=Math.max(s.theme_advanced_resizing_min_height||100,h);w=Math.min(s.theme_advanced_resizing_max_width||0xFFFF,w);h=Math.min(s.theme_advanced_resizing_max_height||0xFFFF,h);dh=e.clientHeight-ifr.clientHeight;DOM.setStyle(ifr,'height',h-dh);DOM.setStyles(e,{width:w,height:h});},destroy:function(){var id=this.editor.id;Event.clear(id+'_resize');Event.clear(id+'_path_row');Event.clear(id+'_external_close');},_simpleLayout:function(s,tb,o,p){var t=this,ed=t.editor,lo=s.theme_advanced_toolbar_location,sl=s.theme_advanced_statusbar_location,n,ic,etb,c;if(lo=='top')t._addToolbars(tb,o);if(lo=='external'){n=c=DOM.create('div',{style:'position:relative'});n=DOM.add(n,'div',{id:ed.id+'_external','class':'mceExternalToolbar'});DOM.add(n,'a',{id:ed.id+'_external_close',href:'javascript:;','class':'mceExternalClose'});n=DOM.add(n,'table',{id:ed.id+'_tblext',cellSpacing:0,cellPadding:0});etb=DOM.add(n,'tbody');if(p.firstChild.className=='mceOldBoxModel')p.firstChild.appendChild(c);else p.insertBefore(c,p.firstChild);t._addToolbars(etb,o);ed.onMouseUp.add(function(){var e=DOM.get(ed.id+'_external');DOM.show(e);DOM.hide(lastExtID);var f=Event.add(ed.id+'_external_close','click',function(){DOM.hide(ed.id+'_external');Event.remove(ed.id+'_external_close','click',f);});DOM.show(e);DOM.setStyle(e,'top',0-DOM.getRect(ed.id+'_tblext').h-1);DOM.hide(e);DOM.show(e);e.style.filter='';lastExtID=ed.id+'_external';e=null;});}if(sl=='top')t._addStatusBar(tb,o);if(!s.theme_advanced_toolbar_container){n=DOM.add(tb,'tr');n=ic=DOM.add(n,'td',{'class':'mceIframeContainer'});}if(lo=='bottom')t._addToolbars(tb,o);if(sl=='bottom')t._addStatusBar(tb,o);return ic;},_rowLayout:function(s,tb,o){var t=this,ed=t.editor,dc,da,cf=ed.controlManager,n,ic,to,a;dc=s.theme_advanced_containers_default_class||'';da=s.theme_advanced_containers_default_align||'center';each(explode(s.theme_advanced_containers||''),function(c,i){var v=s['theme_advanced_container_'+c]||'';switch(v.toLowerCase()){case'mceeditor':n=DOM.add(tb,'tr');n=ic=DOM.add(n,'td',{'class':'mceIframeContainer'});break;case'mceelementpath':t._addStatusBar(tb,o);break;default:a=(s['theme_advanced_container_'+c+'_align']||da).toLowerCase();a='mce'+t._ufirst(a);n=DOM.add(DOM.add(tb,'tr'),'td',{'class':'mceToolbar '+(s['theme_advanced_container_'+c+'_class']||dc)+' '+a||da});to=cf.createToolbar("toolbar"+i);t._addControls(v,to);DOM.setHTML(n,to.renderHTML());o.deltaHeight-=s.theme_advanced_row_height;}});return ic;},_addControls:function(v,tb){var t=this,s=t.settings,di,cf=t.editor.controlManager;if(s.theme_advanced_disable&&!t._disabled){di={};each(explode(s.theme_advanced_disable),function(v){di[v]=1;});t._disabled=di;}else di=t._disabled;each(explode(v),function(n){var c;if(di&&di[n])return;if(n=='tablecontrols'){each(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"],function(n){n=t.createControl(n,cf);if(n)tb.add(n);});return;}c=t.createControl(n,cf);if(c)tb.add(c);});},_addToolbars:function(c,o){var t=this,i,tb,ed=t.editor,s=t.settings,v,cf=ed.controlManager,di,n,h=[],a;a=s.theme_advanced_toolbar_align.toLowerCase();a='mce'+t._ufirst(a);n=DOM.add(DOM.add(c,'tr'),'td',{'class':'mceToolbar '+a});if(!ed.getParam('accessibility_focus')||ed.getParam('tab_focus'))h.push(DOM.createHTML('a',{href:'#',onfocus:'tinyMCE.get(\''+ed.id+'\').focus();'},'<!-- IE -->'));h.push(DOM.createHTML('a',{href:'#',accesskey:'q',title:ed.getLang("advanced.toolbar_focus")},'<!-- IE -->'));for(i=1;(v=s['theme_advanced_buttons'+i]);i++){tb=cf.createToolbar("toolbar"+i,{'class':'mceToolbarRow'+i});if(s['theme_advanced_buttons'+i+'_add'])v+=','+s['theme_advanced_buttons'+i+'_add'];if(s['theme_advanced_buttons'+i+'_add_before'])v=s['theme_advanced_buttons'+i+'_add_before']+','+v;t._addControls(v,tb);h.push(tb.renderHTML());o.deltaHeight-=s.theme_advanced_row_height;}h.push(DOM.createHTML('a',{href:'#',accesskey:'z',title:ed.getLang("advanced.toolbar_focus"),onfocus:'tinyMCE.getInstanceById(\''+ed.id+'\').focus();'},'<!-- IE -->'));DOM.setHTML(n,h.join(''));},_addStatusBar:function(tb,o){var n,t=this,ed=t.editor,s=t.settings,r,mf,me,td;n=DOM.add(tb,'tr');n=td=DOM.add(n,'td',{'class':'mceStatusbar'});n=DOM.add(n,'div',{id:ed.id+'_path_row'},s.theme_advanced_path?ed.translate('advanced.path')+': ':'&nbsp;');DOM.add(n,'a',{href:'#',accesskey:'x'});if(s.theme_advanced_resizing&&!tinymce.isOldWebKit){DOM.add(td,'a',{id:ed.id+'_resize',href:'javascript:;',onclick:"return false;",'class':'mceResize'});if(s.theme_advanced_resizing_use_cookie){ed.onPostRender.add(function(){var o=Cookie.getHash("TinyMCE_"+ed.id+"_size"),c=DOM.get(ed.id+'_tbl');if(!o)return;if(s.theme_advanced_resize_horizontal)c.style.width=Math.max(10,o.cw)+'px';c.style.height=Math.max(10,o.ch)+'px';DOM.get(ed.id+'_ifr').style.height=Math.max(10,parseInt(o.ch)+t.deltaHeight)+'px';});}ed.onPostRender.add(function(){Event.add(ed.id+'_resize','mousedown',function(e){var c,p,w,h,n,pa;c=DOM.get(ed.id+'_tbl');w=c.clientWidth;h=c.clientHeight;miw=s.theme_advanced_resizing_min_width||100;mih=s.theme_advanced_resizing_min_height||100;maw=s.theme_advanced_resizing_max_width||0xFFFF;mah=s.theme_advanced_resizing_max_height||0xFFFF;p=DOM.add(DOM.get(ed.id+'_parent'),'div',{'class':'mcePlaceHolder'});DOM.setStyles(p,{width:w,height:h});DOM.hide(c);DOM.show(p);r={x:e.screenX,y:e.screenY,w:w,h:h,dx:null,dy:null};mf=Event.add(DOM.doc,'mousemove',function(e){var w,h;r.dx=e.screenX-r.x;r.dy=e.screenY-r.y;w=Math.max(miw,r.w+r.dx);h=Math.max(mih,r.h+r.dy);w=Math.min(maw,w);h=Math.min(mah,h);if(s.theme_advanced_resize_horizontal)p.style.width=w+'px';p.style.height=h+'px';return Event.cancel(e);});me=Event.add(DOM.doc,'mouseup',function(e){var ifr;Event.remove(DOM.doc,'mousemove',mf);Event.remove(DOM.doc,'mouseup',me);c.style.display='';DOM.remove(p);if(r.dx===null)return;ifr=DOM.get(ed.id+'_ifr');if(s.theme_advanced_resize_horizontal)c.style.width=Math.max(10,r.w+r.dx)+'px';c.style.height=Math.max(10,r.h+r.dy)+'px';ifr.style.height=Math.max(10,ifr.clientHeight+r.dy)+'px';if(s.theme_advanced_resizing_use_cookie){Cookie.setHash("TinyMCE_"+ed.id+"_size",{cw:r.w+r.dx,ch:r.h+r.dy});}});return Event.cancel(e);});});}o.deltaHeight-=21;n=tb=null;},_nodeChanged:function(ed,cm,n,co){var t=this,p,de=0,v,c,s=t.settings;tinymce.each(t.stateControls,function(c){cm.setActive(c,ed.queryCommandState(t.controls[c][1]));});cm.setActive('visualaid',ed.hasVisual);cm.setDisabled('undo',!ed.undoManager.hasUndo()&&!ed.typing);cm.setDisabled('redo',!ed.undoManager.hasRedo());cm.setDisabled('outdent',!ed.queryCommandState('Outdent'));p=DOM.getParent(n,'A');if(c=cm.get('link')){if(!p||!p.name){c.setDisabled(!p&&co);c.setActive(!!p);}}if(c=cm.get('unlink')){c.setDisabled(!p&&co);c.setActive(!!p&&!p.name);}if(c=cm.get('anchor')){c.setActive(!!p&&p.name);if(tinymce.isWebKit){p=DOM.getParent(n,'IMG');c.setActive(!!p&&DOM.getAttrib(p,'mce_name')=='a');}}p=DOM.getParent(n,'IMG');if(c=cm.get('image'))c.setActive(!!p&&n.className.indexOf('mceItem')==-1);if(c=cm.get('styleselect')){if(n.className){t._importClasses();c.select(n.className);}else c.select();}if(c=cm.get('formatselect')){p=DOM.getParent(n,DOM.isBlock);if(p)c.select(p.nodeName.toLowerCase());}if(c=cm.get('fontselect'))c.select(ed.queryCommandValue('FontName'));if(c=cm.get('fontsizeselect'))c.select(''+ed.queryCommandValue('FontSize'));if(s.theme_advanced_path&&s.theme_advanced_statusbar_location){p=DOM.get(ed.id+'_path')||DOM.add(ed.id+'_path_row','span',{id:ed.id+'_path'});DOM.setHTML(p,'');ed.dom.getParent(n,function(n){var na=n.nodeName.toLowerCase(),u,pi,ti='';if(n.nodeType!=1||(DOM.hasClass(n,'mceItemHidden')||DOM.hasClass(n,'mceItemRemoved')))return;if(v=DOM.getAttrib(n,'mce_name'))na=v;if(tinymce.isIE&&n.scopeName!=='HTML')na=n.scopeName+':'+na;na=na.replace(/mce\:/g,'');switch(na){case'b':na='strong';break;case'i':na='em';break;case'img':if(v=DOM.getAttrib(n,'src'))ti+='src: '+v+' ';break;case'a':if(v=DOM.getAttrib(n,'name')){ti+='name: '+v+' ';na+='#'+v;}if(v=DOM.getAttrib(n,'href'))ti+='href: '+v+' ';break;case'font':if(s.convert_fonts_to_spans)na='span';if(v=DOM.getAttrib(n,'face'))ti+='font: '+v+' ';if(v=DOM.getAttrib(n,'size'))ti+='size: '+v+' ';if(v=DOM.getAttrib(n,'color'))ti+='color: '+v+' ';break;case'span':if(v=DOM.getAttrib(n,'style'))ti+='style: '+v+' ';break;}if(v=DOM.getAttrib(n,'id'))ti+='id: '+v+' ';if(v=n.className){v=v.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g,'');if(v&&v.indexOf('mceItem')==-1){ti+='class: '+v+' ';if(DOM.isBlock(n)||na=='img'||na=='span')na+='.'+v;}}na=na.replace(/(html:)/g,'');na={name:na,node:n,title:ti};t.onResolveName.dispatch(t,na);ti=na.title;na=na.name;pi=DOM.create('a',{'href':"javascript:;",onmousedown:"return false;",title:ti,'class':'mcePath_'+(de++)},na);if(p.hasChildNodes()){p.insertBefore(DOM.doc.createTextNode(' \u00bb '),p.firstChild);p.insertBefore(pi,p.firstChild);}else p.appendChild(pi);},ed.getBody());}},_sel:function(v){this.editor.execCommand('mceSelectNodeDepth',false,v);},_mceInsertAnchor:function(ui,v){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/anchor.htm',width:320+parseInt(ed.getLang('advanced.anchor_delta_width',0)),height:90+parseInt(ed.getLang('advanced.anchor_delta_height',0)),inline:true},{theme_url:this.url});},_mceCharMap:function(){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/charmap.htm',width:550+parseInt(ed.getLang('advanced.charmap_delta_width',0)),height:250+parseInt(ed.getLang('advanced.charmap_delta_height',0)),inline:true},{theme_url:this.url});},_mceHelp:function(){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/about.htm',width:480,height:380,inline:true},{theme_url:this.url});},_mceColorPicker:function(u,v){var ed=this.editor;v=v||{};ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/color_picker.htm',width:375+parseInt(ed.getLang('advanced.colorpicker_delta_width',0)),height:250+parseInt(ed.getLang('advanced.colorpicker_delta_height',0)),close_previous:false,inline:true},{input_color:v.color,func:v.func,theme_url:this.url});},_mceCodeEditor:function(ui,val){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/source_editor.htm',width:parseInt(ed.getParam("theme_advanced_source_editor_width",720)),height:parseInt(ed.getParam("theme_advanced_source_editor_height",580)),inline:true,resizable:true,maximizable:true},{theme_url:this.url});},_mceImage:function(ui,val){var ed=this.editor;if(ed.dom.getAttrib(ed.selection.getNode(),'class').indexOf('mceItem')!=-1)return;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/image.htm',width:355+parseInt(ed.getLang('advanced.image_delta_width',0)),height:275+parseInt(ed.getLang('advanced.image_delta_height',0)),inline:true},{theme_url:this.url});},_mceLink:function(ui,val){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/link.htm',width:310+parseInt(ed.getLang('advanced.link_delta_width',0)),height:200+parseInt(ed.getLang('advanced.link_delta_height',0)),inline:true},{theme_url:this.url});},_mceNewDocument:function(){var ed=this.editor;ed.windowManager.confirm('advanced.newdocument',function(s){if(s)ed.execCommand('mceSetContent',false,'');});},_mceForeColor:function(){var t=this;this._mceColorPicker(0,{color:t.fgColor,func:function(co){t.fgColor=co;t.editor.execCommand('ForeColor',false,co);}});},_mceBackColor:function(){var t=this;this._mceColorPicker(0,{color:t.bgColor,func:function(co){t.bgColor=co;t.editor.execCommand('HiliteColor',false,co);}});},_ufirst:function(s){return s.substring(0,1).toUpperCase()+s.substring(1);}});tinymce.ThemeManager.add('advanced',tinymce.themes.AdvancedTheme);}());
\ No newline at end of file
index f0bd23c7d7f1e65e38fd3c59d54e7952c017b7ce..af3cbfdb94766fecc6ba9cf2eb278dafa7a00592 100644 (file)
@@ -2,10 +2,10 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
        <title>{#advanced_dlg.image_title}</title>
-       <script type="text/javascript" src="../../tiny_mce_popup.js?v=307"></script>
-       <script type="text/javascript" src="../../utils/mctabs.js?v=307"></script>
-       <script type="text/javascript" src="../../utils/form_utils.js?v=307"></script>
-       <script type="text/javascript" src="js/image.js?v=307"></script>
+       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=311"></script>
+       <script type="text/javascript" src="../../utils/mctabs.js?ver=311"></script>
+       <script type="text/javascript" src="../../utils/form_utils.js?ver=311"></script>
+       <script type="text/javascript" src="js/image.js?ver=311"></script>
        <base target="_self" />
 </head>
 <body id="image" style="display: none">
index 687082782a37bb539f33e4c16cd1b243939736cc..ccac36f54d983cc33a0a6e45134e3dabf1820367 100644 (file)
Binary files a/wp-includes/js/tinymce/themes/advanced/img/icons.gif and b/wp-includes/js/tinymce/themes/advanced/img/icons.gif differ
index db5ac254417e4768aecb5acebc0ef27b3891404c..c1a65db2c47f05fe0c55da17e0c098b53fd08c69 100644 (file)
@@ -230,7 +230,7 @@ function updateLight(r, g, b) {
 
                color = finalR + finalG + finalB;
 
-               document.getElementById('gs' + i).style.backgroundColor = '#'+color;
+               setCol('gs' + i, '#'+color);
        }
 }
 
@@ -238,8 +238,16 @@ function changeFinalColor(color) {
        if (color.indexOf('#') == -1)
                color = convertRGBToHex(color);
 
-       document.getElementById('preview').style.backgroundColor = color;
+       setCol('preview', color);
        document.getElementById('color').value = color;
 }
 
+function setCol(e, c) {
+       try {
+               document.getElementById(e).style.backgroundColor = c;
+       } catch (ex) {
+               // Ignore IE warning
+       }
+}
+
 tinyMCEPopup.onInit.add(init);
index 4c018eda33a001409d371b27cc1ae78c8b98d8c6..63c843d2d011022a0e7cb8e3bbb3935761d42379 100644 (file)
@@ -90,7 +90,7 @@ var ImageDialog = {
                if (el && el.nodeName == 'IMG') {
                        ed.dom.setAttribs(el, args);
                } else {
-                       ed.execCommand('mceInsertContent', false, '<img id="__mce_tmp" src="javascript:;" />', {skip_undo : 1});
+                       ed.execCommand('mceInsertContent', false, '<img id="__mce_tmp" />', {skip_undo : 1});
                        ed.dom.setAttribs('__mce_tmp', args);
                        ed.dom.setAttrib('__mce_tmp', 'id', '');
                        ed.undoManager.add();
index cdc149b5572c3e7432f5ab121ec5c542fc3744ed..7a4699b52011faff581d652f6b6ff3484cf07623 100644 (file)
@@ -2,11 +2,11 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
        <title>{#advanced_dlg.link_title}</title>
-       <script type="text/javascript" src="../../tiny_mce_popup.js?v=307"></script>
-       <script type="text/javascript" src="../../utils/mctabs.js?v=307"></script>
-       <script type="text/javascript" src="../../utils/form_utils.js?v=307"></script>
-       <script type="text/javascript" src="../../utils/validate.js?v=307"></script>
-       <script type="text/javascript" src="js/link.js?v=307"></script>
+       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=311"></script>
+       <script type="text/javascript" src="../../utils/mctabs.js?ver=311"></script>
+       <script type="text/javascript" src="../../utils/form_utils.js?ver=311"></script>
+       <script type="text/javascript" src="../../utils/validate.js?ver=311"></script>
+       <script type="text/javascript" src="js/link.js?ver=311"></script>
        <base target="_self" />
 </head>
 <body id="link" style="display: none">
index c13d0a3e2cea916f44ba43b270b07a6339c1e965..cb7604e79168e88e2f99ab9864a255b87c7595ea 100644 (file)
@@ -13,6 +13,11 @@ img.mceItemAnchor {width:12px; height:12px; background:url(img/items.gif) no-rep
 img {border:0;}
 table {cursor:default}
 table td, table th {cursor:text}
+ins {border-bottom:1px solid green; text-decoration: none; color:green}
+del {color:red; text-decoration:line-through}
+cite {border-bottom:1px dashed blue}
+acronym {border-bottom:1px dotted #CCC; cursor:help}
+abbr, html\:abbr {border-bottom:1px dashed #CCC; cursor:help}
 
 /* IE */
 * html body {
index 0a73a57597bb7347723f611e8b232c95799c7bee..a40493175b0584fa6e82266d5c1a943939031117 100644 (file)
@@ -13,6 +13,11 @@ img.mceItemAnchor {width:12px; height:12px; background:url(../default/img/items.
 img {border:0;}
 table {cursor:default}
 table td, table th {cursor:text}
+ins {border-bottom:1px solid green; text-decoration: none; color:green}
+del {color:red; text-decoration:line-through}
+cite {border-bottom:1px dashed blue}
+acronym {border-bottom:1px dotted #CCC; cursor:help}
+abbr, html\:abbr {border-bottom:1px dashed #CCC; cursor:help}
 
 /* IE */
 * html body {
index 16d589c4d8027f7b7181cb85b681f5d5f1f46789..0ae41557e526663918af3f0f629ca5cb3eacd8c3 100644 (file)
@@ -1,4 +1,4 @@
-body, td, pre {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;}
+body, td {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;}
 body {background:#FFF;}
 body.mceForceColors {background:#FFF; color:#000;}
 h1 {font-size: 2em}
@@ -8,19 +8,12 @@ h4 {font-size: 1em}
 h5 {font-size: .83em}
 h6 {font-size: .75em}
 .mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;}
-a.mceItemAnchor {width:12px; line-height:6px; overflow:hidden; padding-left:12px; background:url(img/items.gif) no-repeat bottom left;}
-img.mceItemAnchor {width:12px; height:12px; background:url(img/items.gif) no-repeat;}
+a.mceItemAnchor {width:12px; line-height:6px; overflow:hidden; padding-left:12px; background:url(../default/img/items.gif) no-repeat bottom left;}
+img.mceItemAnchor {width:12px; height:12px; background:url(../default/img/items.gif) no-repeat;}
 img {border:0;}
-
-/* IE 
-* html body {
-scrollbar-3dlight-color:#F0F0EE;
-scrollbar-arrow-color:#676662;
-scrollbar-base-color:#F0F0EE;
-scrollbar-darkshadow-color:#DDD;
-scrollbar-face-color:#E0E0DD;
-scrollbar-highlight-color:#F0F0EE;
-scrollbar-shadow-color:#F0F0EE;
-scrollbar-track-color:#F5F5F5;
-}
-*/
\ No newline at end of file
+table {cursor:default}
+table td, table th {cursor:text}
+ins {border-bottom:1px solid green; text-decoration: none; color:green}
+del {color:red; text-decoration:line-through}
+cite {border-bottom:1px dashed blue}
+acronym {border-bottom:1px dotted #CCC; cursor:help}
index dcc636db94386ac52f77b3463d4115150f0d72f7..2c709c9e558293e9ecb309892d965ab3c203d63d 100644 (file)
@@ -2,8 +2,8 @@
 <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>{#advanced_dlg.code_title}</title>
-       <script type="text/javascript" src="../../tiny_mce_popup.js?v=307"></script>
-       <script type="text/javascript" src="js/source_editor.js?v=307"></script>
+       <script type="text/javascript" src="../../tiny_mce_popup.js?ver=311"></script>
+       <script type="text/javascript" src="js/source_editor.js?ver=311"></script>
        <base target="_self" />
 </head>
 <body onresize="resizeInputs();" style="display:none; overflow:hidden;">
index bc86c40536da364572da865bec3acacf8672d660..1d2a80344387585f6cb289487ab893bc94fe82e5 100644 (file)
@@ -1 +1 @@
-var tinymce={majorVersion:'3',minorVersion:'0.7',releaseDate:'2008-04-14',_init:function(){var t=this,d=document,w=window,na=navigator,ua=na.userAgent,i,nl,n,base;t.isOpera=w.opera&&opera.buildNumber;t.isWebKit=/WebKit/.test(ua);t.isOldWebKit=t.isWebKit&&!w.getSelection().getRangeAt;t.isIE=!t.isWebKit&&!t.isOpera&&(/MSIE/gi).test(ua)&&(/Explorer/gi).test(na.appName);t.isIE6=t.isIE&&/MSIE [56]/.test(ua);t.isGecko=!t.isWebKit&&/Gecko/.test(ua);t.isMac=ua.indexOf('Mac')!=-1;if(w.tinyMCEPreInit){t.suffix=tinyMCEPreInit.suffix;t.baseURL=tinyMCEPreInit.base;return;}t.suffix='';nl=d.getElementsByTagName('base');for(i=0;i<nl.length;i++){if(nl[i].href)base=nl[i].href;}function getBase(n){if(n.src&&/tiny_mce(|_dev|_src|_gzip|_jquery|_prototype).js/.test(n.src)){if(/_(src|dev)\.js/g.test(n.src))t.suffix='_src';t.baseURL=n.src.substring(0,n.src.lastIndexOf('/'));if(base&&t.baseURL.indexOf('://')==-1)t.baseURL=base+t.baseURL;return t.baseURL;}return null;};nl=d.getElementsByTagName('script');for(i=0;i<nl.length;i++){if(getBase(nl[i]))return;}n=d.getElementsByTagName('head')[0];if(n){nl=n.getElementsByTagName('script');for(i=0;i<nl.length;i++){if(getBase(nl[i]))return;}}return;},is:function(o,t){var n=typeof(o);if(!t)return n!='undefined';if(t=='array'&&(o instanceof Array))return true;return n==t;},each:function(o,cb,s){var n,l;if(!o)return 0;s=s||o;if(typeof(o.length)!='undefined'){for(n=0,l=o.length;n<l;n++){if(cb.call(s,o[n],n,o)===false)return 0;}}else{for(n in o){if(o.hasOwnProperty(n)){if(cb.call(s,o[n],n,o)===false)return 0;}}}return 1;},map:function(a,f){var o=[];tinymce.each(a,function(v){o.push(f(v));});return o;},grep:function(a,f){var o=[];tinymce.each(a,function(v){if(!f||f(v))o.push(v);});return o;},inArray:function(a,v){var i,l;if(a){for(i=0,l=a.length;i<l;i++){if(a[i]===v)return i;}}return-1;},extend:function(o,e){var i,a=arguments;for(i=1;i<a.length;i++){e=a[i];tinymce.each(e,function(v,n){if(typeof(v)!=='undefined')o[n]=v;});}return o;},trim:function(s){return(s?''+s:'').replace(/^\s*|\s*$/g,'');},create:function(s,p){var t=this,sp,ns,cn,scn,c,de=0;s=/^((static) )?([\w.]+)(:([\w.]+))?/.exec(s);cn=s[3].match(/(^|\.)(\w+)$/i)[2];ns=t.createNS(s[3].replace(/\.\w+$/,''));if(ns[cn])return;if(s[2]=='static'){ns[cn]=p;if(this.onCreate)this.onCreate(s[2],s[3],ns[cn]);return;}if(!p[cn]){p[cn]=function(){};de=1;}ns[cn]=p[cn];t.extend(ns[cn].prototype,p);if(s[5]){sp=t.resolve(s[5]).prototype;scn=s[5].match(/\.(\w+)$/i)[1];c=ns[cn];if(de){ns[cn]=function(){return sp[scn].apply(this,arguments);};}else{ns[cn]=function(){this.parent=sp[scn];return c.apply(this,arguments);};}ns[cn].prototype[cn]=ns[cn];t.each(sp,function(f,n){ns[cn].prototype[n]=sp[n];});t.each(p,function(f,n){if(sp[n]){ns[cn].prototype[n]=function(){this.parent=sp[n];return f.apply(this,arguments);};}else{if(n!=cn)ns[cn].prototype[n]=f;}});}t.each(p['static'],function(f,n){ns[cn][n]=f;});if(this.onCreate)this.onCreate(s[2],s[3],ns[cn].prototype);},walk:function(o,f,n,s){s=s||this;if(o){if(n)o=o[n];tinymce.each(o,function(o,i){if(f.call(s,o,i,n)===false)return false;tinymce.walk(o,f,n,s);});}},createNS:function(n,o){var i,v;o=o||window;n=n.split('.');for(i=0;i<n.length;i++){v=n[i];if(!o[v])o[v]={};o=o[v];}return o;},resolve:function(n,o){var i,l;o=o||window;n=n.split('.');for(i=0,l=n.length;i<l;i++){o=o[n[i]];if(!o)break;}return o;},addUnload:function(f,s){var t=this,w=window;f={func:f,scope:s||this};if(!t.unloads){function unload(){var li=t.unloads,o,n;if(li){for(n in li){o=li[n];if(o&&o.func)o.func.call(o.scope,1);}if(w.detachEvent){w.detachEvent('onbeforeunload',fakeUnload);w.detachEvent('onunload',unload);}else if(w.removeEventListener)w.removeEventListener('unload',unload,false);t.unloads=o=li=w=unload=null;if(window.CollectGarbage)window.CollectGarbage();}};function fakeUnload(){var d=document;if(d.readyState=='interactive'){function stop(){d.detachEvent('onstop',stop);unload();d=null;};d.attachEvent('onstop',stop);window.setTimeout(function(){d.detachEvent('onstop',stop);},0);}};if(w.attachEvent){w.attachEvent('onunload',unload);w.attachEvent('onbeforeunload',fakeUnload);}else if(w.addEventListener)w.addEventListener('unload',unload,false);t.unloads=[f];}else t.unloads.push(f);return f;},removeUnload:function(f){var u=this.unloads,r=null;tinymce.each(u,function(o,i){if(o&&o.func==f){u.splice(i,1);r=f;return false;}});return r;},explode:function(s,d){return tinymce.map(s.split(d||','),tinymce.trim);},_addVer:function(u,s){return u+(u.indexOf('?')==-1?'?':'&')+'v='+(tinymce.majorVersion+tinymce.minorVersion).replace(/[^0-9]/g,'');}};window.tinymce=tinymce;tinymce._init();tinymce.create('tinymce.util.Dispatcher',{scope:null,listeners:null,Dispatcher:function(s){this.scope=s||this;this.listeners=[];},add:function(cb,s){this.listeners.push({cb:cb,scope:s||this.scope});return cb;},addToTop:function(cb,s){this.listeners.unshift({cb:cb,scope:s||this.scope});return cb;},remove:function(cb){var l=this.listeners,o=null;tinymce.each(l,function(c,i){if(cb==c.cb){o=cb;l.splice(i,1);return false;}});return o;},dispatch:function(){var s,a=arguments,i,li=this.listeners,c;for(i=0;i<li.length;i++){c=li[i];s=c.cb.apply(c.scope,a);if(s===false)break;}return s;}});(function(){var each=tinymce.each;tinymce.create('tinymce.util.URI',{URI:function(u,s){var t=this,o,a,b;s=t.settings=s||{};if(/^(mailto|news|javascript|about):/i.test(u)||/^\s*#/.test(u)){t.source=u;return;}if(u.indexOf('/')===0&&u.indexOf('//')!==0)u=(s.base_uri?s.base_uri.protocol||'http':'http')+'://mce_host'+u;if(u.indexOf('://')===-1&&u.indexOf('//')!==0)u=(s.base_uri.protocol||'http')+'://mce_host'+t.toAbsPath(s.base_uri.path,u);u=u.replace(/@@/g,'(mce_at)');u=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(u);each(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],function(v,i){var s=u[i];if(s)s=s.replace(/\(mce_at\)/g,'@@');t[v]=s;});if(b=s.base_uri){if(!t.protocol)t.protocol=b.protocol;if(!t.userInfo)t.userInfo=b.userInfo;if(!t.port&&t.host=='mce_host')t.port=b.port;if(!t.host||t.host=='mce_host')t.host=b.host;t.source='';}},setPath:function(p){var t=this;p=/^(.*?)\/?(\w+)?$/.exec(p);t.path=p[0];t.directory=p[1];t.file=p[2];t.source='';t.getURI();},toRelative:function(u){var t=this,o;u=new tinymce.util.URI(u,{base_uri:t});if((u.host!='mce_host'&&t.host!=u.host&&u.host)||t.port!=u.port||t.protocol!=u.protocol)return u.getURI();o=t.toRelPath(t.path,u.path);if(u.query)o+='?'+u.query;if(u.anchor)o+='#'+u.anchor;return o;},toAbsolute:function(u,nh){var u=new tinymce.util.URI(u,{base_uri:this});return u.getURI(this.host==u.host?nh:0);},toRelPath:function(base,path){var items,bp=0,out='',i;base=base.substring(0,base.lastIndexOf('/'));base=base.split('/');items=path.split('/');if(base.length>=items.length){for(i=0;i<base.length;i++){if(i>=items.length||base[i]!=items[i]){bp=i+1;break;}}}if(base.length<items.length){for(i=0;i<items.length;i++){if(i>=base.length||base[i]!=items[i]){bp=i+1;break;}}}if(bp==1)return path;for(i=0;i<base.length-(bp-1);i++)out+="../";for(i=bp-1;i<items.length;i++){if(i!=bp-1)out+="/"+items[i];else out+=items[i];}return out;},toAbsPath:function(base,path){var i,nb=0,o=[];base=base.split('/');path=path.split('/');each(base,function(k){if(k)o.push(k);});base=o;for(i=path.length-1,o=[];i>=0;i--){if(path[i].length==0||path[i]==".")continue;if(path[i]=='..'){nb++;continue;}if(nb>0){nb--;continue;}o.push(path[i]);}i=base.length-nb;if(i<=0)return'/'+o.reverse().join('/');return'/'+base.slice(0,i).join('/')+'/'+o.reverse().join('/');},getURI:function(nh){var s,t=this;if(!t.source||nh){s='';if(!nh){if(t.protocol)s+=t.protocol+'://';if(t.userInfo)s+=t.userInfo+'@';if(t.host)s+=t.host;if(t.port)s+=':'+t.port;}if(t.path)s+=t.path;if(t.query)s+='?'+t.query;if(t.anchor)s+='#'+t.anchor;t.source=s;}return t.source;}});})();(function(){var each=tinymce.each;tinymce.create('static tinymce.util.Cookie',{getHash:function(n){var v=this.get(n),h;if(v){each(v.split('&'),function(v){v=v.split('=');h=h||{};h[unescape(v[0])]=unescape(v[1]);});}return h;},setHash:function(n,v,e,p,d,s){var o='';each(v,function(v,k){o+=(!o?'':'&')+escape(k)+'='+escape(v);});this.set(n,o,e,p,d,s);},get:function(n){var c=document.cookie,e,p=n+"=",b;if(!c)return;b=c.indexOf("; "+p);if(b==-1){b=c.indexOf(p);if(b!=0)return null;}else b+=2;e=c.indexOf(";",b);if(e==-1)e=c.length;return unescape(c.substring(b+p.length,e));},set:function(n,v,e,p,d,s){document.cookie=n+"="+escape(v)+((e)?"; expires="+e.toGMTString():"")+((p)?"; path="+escape(p):"")+((d)?"; domain="+d:"")+((s)?"; secure":"");},remove:function(n,p){var d=new Date();d.setTime(d.getTime()-1000);this.set(n,'',d,p,d);}});})();tinymce.create('static tinymce.util.JSON',{serialize:function(o){var i,v,s=tinymce.util.JSON.serialize,t;if(o==null)return'null';t=typeof o;if(t=='string'){v='\bb\tt\nn\ff\rr\""\'\'\\\\';return'"'+o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'])/g,function(a,b){i=v.indexOf(b);if(i+1)return'\\'+v.charAt(i+1);a=b.charCodeAt().toString(16);return'\\u'+'0000'.substring(a.length)+a;})+'"';}if(t=='object'){if(o instanceof Array){for(i=0,v='[';i<o.length;i++)v+=(i>0?',':'')+s(o[i]);return v+']';}v='{';for(i in o)v+=typeof o[i]!='function'?(v.length>1?',"':'"')+i+'":'+s(o[i]):'';return v+'}';}return''+o;},parse:function(s){try{return eval('('+s+')');}catch(ex){}}});tinymce.create('static tinymce.util.XHR',{send:function(o){var x,t,w=window,c=0;o.scope=o.scope||this;o.success_scope=o.success_scope||o.scope;o.error_scope=o.error_scope||o.scope;o.async=o.async===false?false:true;o.data=o.data||'';function get(s){x=0;try{x=new ActiveXObject(s);}catch(ex){}return x;};x=w.XMLHttpRequest?new XMLHttpRequest():get('Microsoft.XMLHTTP')||get('Msxml2.XMLHTTP');if(x){if(x.overrideMimeType)x.overrideMimeType(o.content_type);x.open(o.type||(o.data?'POST':'GET'),o.url,o.async);if(o.content_type)x.setRequestHeader('Content-Type',o.content_type);x.send(o.data);t=w.setInterval(function(){if(x.readyState==4||c++>10000){w.clearInterval(t);if(o.success&&c<10000&&x.status==200)o.success.call(o.success_scope,''+x.responseText,x,o);else if(o.error)o.error.call(o.error_scope,c>10000?'TIMED_OUT':'GENERAL',x,o);x=null;}},10);}}});(function(){var extend=tinymce.extend,JSON=tinymce.util.JSON,XHR=tinymce.util.XHR;tinymce.create('tinymce.util.JSONRequest',{JSONRequest:function(s){this.settings=extend({},s);this.count=0;},send:function(o){var ecb=o.error,scb=o.success;o=extend(this.settings,o);o.success=function(c,x){c=JSON.parse(c);if(typeof(c)=='undefined'){c={error:'JSON Parse error.'};}if(c.error)ecb.call(o.error_scope||o.scope,c.error,x);else scb.call(o.success_scope||o.scope,c.result);};o.error=function(ty,x){ecb.call(o.error_scope||o.scope,ty,x);};o.data=JSON.serialize({id:o.id||'c'+(this.count++),method:o.method,params:o.params});o.content_type='application/json';XHR.send(o);},'static':{sendRPC:function(o){return new tinymce.util.JSONRequest().send(o);}}});}());(function(){var each=tinymce.each,is=tinymce.is;var isWebKit=tinymce.isWebKit,isIE=tinymce.isIE;tinymce.create('tinymce.dom.DOMUtils',{doc:null,root:null,files:null,listeners:{},pixelStyles:/^(top|left|bottom|right|width|height|borderWidth)$/,cache:{},idPattern:/^#[\w]+$/,elmPattern:/^[\w_*]+$/,elmClassPattern:/^([\w_]*)\.([\w_]+)$/,DOMUtils:function(d,s){var t=this;t.doc=d;t.win=window;t.files={};t.cssFlicker=false;t.counter=0;t.boxModel=!tinymce.isIE||d.compatMode=="CSS1Compat";t.stdMode=d.documentMode===8;this.settings=s=tinymce.extend({keep_values:false,hex_colors:1,process_html:1},s);if(tinymce.isIE6){try{d.execCommand('BackgroundImageCache',false,true);}catch(e){t.cssFlicker=true;}}tinymce.addUnload(t.destroy,t);},getRoot:function(){var t=this,s=t.settings;return(s&&t.get(s.root_element))||t.doc.body;},getViewPort:function(w){var d,b;w=!w?this.win:w;d=w.document;b=this.boxModel?d.documentElement:d.body;return{x:w.pageXOffset||b.scrollLeft,y:w.pageYOffset||b.scrollTop,w:w.innerWidth||b.clientWidth,h:w.innerHeight||b.clientHeight};},getRect:function(e){var p,t=this,w,h;e=t.get(e);p=t.getPos(e);w=t.getStyle(e,'width');h=t.getStyle(e,'height');if(w.indexOf('px')===-1)w=0;if(h.indexOf('px')===-1)h=0;return{x:p.x,y:p.y,w:parseInt(w)||e.offsetWidth||e.clientWidth,h:parseInt(h)||e.offsetHeight||e.clientHeight};},getParent:function(n,f,r){var na,se=this.settings;n=this.get(n);if(se.strict_root)r=r||this.getRoot();if(is(f,'string')){na=f.toUpperCase();f=function(n){var s=false;if(n.nodeType==1&&na==='*'){s=true;return false;}each(na.split(','),function(v){if(n.nodeType==1&&((se.strict&&n.nodeName.toUpperCase()==v)||n.nodeName==v)){s=true;return false;}});return s;};}while(n){if(n==r)return null;if(f(n))return n;n=n.parentNode;}return null;},get:function(e){var n;if(e&&this.doc&&typeof(e)=='string'){n=e;e=this.doc.getElementById(e);if(e&&e.id!==n)return this.doc.getElementsByName(n)[1];}return e;},select:function(pa,s){var t=this,cs,c,pl,o=[],x,i,l,n;s=t.get(s)||t.doc;if(s.querySelectorAll){if(s!=t.doc){i=s.id;s.id='_mc_tmp';pa='#_mc_tmp '+pa;}l=tinymce.grep(s.querySelectorAll(pa));s.id=i;return l;}if(t.settings.strict){function get(s,n){return s.getElementsByTagName(n.toLowerCase());};}else{function get(s,n){return s.getElementsByTagName(n);};}if(t.elmPattern.test(pa)){x=get(s,pa);for(i=0,l=x.length;i<l;i++)o.push(x[i]);return o;}if(t.elmClassPattern.test(pa)){pl=t.elmClassPattern.exec(pa);x=get(s,pl[1]||'*');c=' '+pl[2]+' ';for(i=0,l=x.length;i<l;i++){n=x[i];if(n.className&&(' '+n.className+' ').indexOf(c)!==-1)o.push(n);}return o;}function collect(n){if(!n.mce_save){n.mce_save=1;o.push(n);}};function collectIE(n){if(!n.getAttribute('mce_save')){n.setAttribute('mce_save','1');o.push(n);}};function find(n,f,r){var i,l,nl=get(r,n);for(i=0,l=nl.length;i<l;i++)f(nl[i]);};each(pa.split(','),function(v,i){v=tinymce.trim(v);if(t.elmPattern.test(v)){each(get(s,v),function(n){collect(n);});return;}if(t.elmClassPattern.test(v)){x=t.elmClassPattern.exec(v);each(get(s,x[1]),function(n){if(t.hasClass(n,x[2]))collect(n);});return;}if(!(cs=t.cache[pa])){cs='x=(function(cf, s) {';pl=v.split(' ');each(pl,function(v){var p=/^([\w\\*]+)?(?:#([\w\\]+))?(?:\.([\w\\\.]+))?(?:\[\@([\w\\]+)([\^\$\*!]?=)([\w\\]+)\])?(?:\:([\w\\]+))?/i.exec(v);p[1]=p[1]||'*';cs+='find("'+p[1]+'", function(n) {';if(p[2])cs+='if (n.id !== "'+p[2]+'") return;';if(p[3]){cs+='var c = " " + n.className + " ";';cs+='if (';c='';each(p[3].split('.'),function(v){if(v)c+=(c?'||':'')+'c.indexOf(" '+v+' ") === -1';});cs+=c+') return;';}});cs+='cf(n);';for(i=pl.length-1;i>=0;i--)cs+='}, '+(i?'n':'s')+');';cs+='})';t.cache[pa]=cs=eval(cs);}cs(isIE?collectIE:collect,s);});each(o,function(n){if(isIE)n.removeAttribute('mce_save');else delete n.mce_save;});return o;},add:function(p,n,a,h,c){var t=this;return this.run(p,function(p){var e,k;e=is(n,'string')?t.doc.createElement(n):n;if(a){for(k in a){if(a.hasOwnProperty(k)&&!is(a[k],'object'))t.setAttrib(e,k,''+a[k]);}if(a.style&&!is(a.style,'string')){each(a.style,function(v,n){t.setStyle(e,n,v);});}}if(h){if(h.nodeType)e.appendChild(h);else t.setHTML(e,h);}return!c?p.appendChild(e):e;});},create:function(n,a,h){return this.add(this.doc.createElement(n),n,a,h,1);},createHTML:function(n,a,h){var o='',t=this,k;o+='<'+n;for(k in a){if(a.hasOwnProperty(k))o+=' '+k+'="'+t.encode(a[k])+'"';}if(tinymce.is(h))return o+'>'+h+'</'+n+'>';return o+' />';},remove:function(n,k){return this.run(n,function(n){var p,g;p=n.parentNode;if(!p)return null;if(k){each(n.childNodes,function(c){p.insertBefore(c.cloneNode(true),n);});}return p.removeChild(n);});},setStyle:function(n,na,v){var t=this;return t.run(n,function(e){var s,i;s=e.style;na=na.replace(/-(\D)/g,function(a,b){return b.toUpperCase();});if(t.pixelStyles.test(na)&&(tinymce.is(v,'number')||/^[\-0-9\.]+$/.test(v)))v+='px';switch(na){case'opacity':if(isIE){s.filter=v===''?'':"alpha(opacity="+(v*100)+")";if(!n.currentStyle||!n.currentStyle.hasLayout)s.display='inline-block';}s[na]=s['-moz-opacity']=s['-khtml-opacity']=v||'';break;case'float':isIE?s.styleFloat=v:s.cssFloat=v;break;default:s[na]=v||'';}if(t.settings.update_styles)t.setAttrib(e,'mce_style');});},getStyle:function(n,na,c){n=this.get(n);if(!n)return false;if(this.doc.defaultView&&c){na=na.replace(/[A-Z]/g,function(a){return'-'+a;});try{return this.doc.defaultView.getComputedStyle(n,null).getPropertyValue(na);}catch(ex){return null;}}na=na.replace(/-(\D)/g,function(a,b){return b.toUpperCase();});if(na=='float')na=isIE?'styleFloat':'cssFloat';if(n.currentStyle&&c)return n.currentStyle[na];return n.style[na];},setStyles:function(e,o){var t=this,s=t.settings,ol;ol=s.update_styles;s.update_styles=0;each(o,function(v,n){t.setStyle(e,n,v);});s.update_styles=ol;if(s.update_styles)t.setAttrib(e,s.cssText);},setAttrib:function(e,n,v){var t=this;if(t.settings.strict)n=n.toLowerCase();return this.run(e,function(e){var s=t.settings;switch(n){case"style":if(s.keep_values&&/^(| )(top|left|bottom|right|width|height)/i.test(v)){if(v)e.setAttribute('mce_style',v,2);else e.removeAttribute('mce_style',2);}e.style.cssText=v;break;case"class":e.className=v||'';break;case"src":case"href":if(s.keep_values){if(s.url_converter)v=s.url_converter.call(s.url_converter_scope||t,v,n,e);t.setAttrib(e,'mce_'+n,v,2);}break;}if(is(v)&&v!==null&&v.length!==0)e.setAttribute(n,''+v,2);else e.removeAttribute(n,2);});},setAttribs:function(e,o){var t=this;return this.run(e,function(e){each(o,function(v,n){t.setAttrib(e,n,v);});});},getAttrib:function(e,n,dv){var v,t=this;e=t.get(e);if(!e||e.nodeType!==1)return false;if(!is(dv))dv="";if(/^(src|href|style|coords)$/.test(n)){v=e.getAttribute("mce_"+n);if(v)return v;}v=e.getAttribute(n,2);if(!v){switch(n){case'class':v=e.className;break;default:if(isIE&&n==='name'&&e.nodeName==='A'){v=e.name;break;}v=e.attributes[n];v=v&&is(v.nodeValue)?v.nodeValue:v;}}switch(n){case'style':v=v||e.style.cssText;if(v){v=t.serializeStyle(t.parseStyle(v));if(t.settings.keep_values&&/^(| )(top|left|bottom|right|width|height)/i.test(v))e.setAttribute('mce_style',v);}break;}if(isWebKit&&n==="class"&&v)v=v.replace(/(apple|webkit)\-[a-z\-]+/gi,'');if(isIE){switch(n){case'rowspan':case'colspan':if(v===1)v='';break;case'size':if(v==='+0')v='';break;case'hspace':if(v===-1)v='';break;case'tabindex':if(v===32768)v='';break;case'shape':v=v.toLowerCase();break;default:if(n.indexOf('on')===0&&v)v=(''+v).replace(/^function\s+anonymous\(\)\s+\{\s+(.*)\s+\}$/,'$1');}}return(v&&v!='')?''+v:dv;},getPos:function(n){var t=this,x=0,y=0,e,d=t.doc,r;n=t.get(n);if(n&&isIE){n=n.getBoundingClientRect();e=t.boxModel?d.documentElement:d.body;x=t.getStyle(t.select('html')[0],'borderWidth');x=(x=='medium'||t.boxModel&&!t.isIE6)&&2||x;n.top+=t.win.self!=t.win.top?2:0;return{x:n.left+e.scrollLeft-x,y:n.top+e.scrollTop-x};}r=n;while(r){x+=r.offsetLeft||0;y+=r.offsetTop||0;r=r.offsetParent;}r=n;while(r){if(!/^table-row|inline.*/i.test(t.getStyle(r,"display",1))){x-=r.scrollLeft||0;y-=r.scrollTop||0;}r=r.parentNode;if(r==d.body)break;}return{x:x,y:y};},parseStyle:function(st){var t=this,s=t.settings,o={};if(!st)return o;function compress(p,s,ot){var t,r,b,l;t=o[p+'-top'+s];if(!t)return;r=o[p+'-right'+s];if(t!=r)return;b=o[p+'-bottom'+s];if(r!=b)return;l=o[p+'-left'+s];if(b!=l)return;o[ot]=l;delete o[p+'-top'+s];delete o[p+'-right'+s];delete o[p+'-bottom'+s];delete o[p+'-left'+s];};function compress2(ta,a,b,c){var t;t=o[a];if(!t)return;t=o[b];if(!t)return;t=o[c];if(!t)return;o[ta]=o[a]+' '+o[b]+' '+o[c];delete o[a];delete o[b];delete o[c];};each(st.split(';'),function(v){var sv,ur=[];if(v){v=v.replace(/url\([^\)]+\)/g,function(v){ur.push(v);return'url('+ur.length+')';});v=v.split(':');sv=tinymce.trim(v[1]);sv=sv.replace(/url\(([^\)]+)\)/g,function(a,b){return ur[parseInt(b)-1];});sv=sv.replace(/rgb\([^\)]+\)/g,function(v){return t.toHex(v);});if(s.url_converter){sv=sv.replace(/url\([\'\"]?([^\)\'\"]+)[\'\"]?\)/g,function(x,c){return'url('+t.encode(s.url_converter.call(s.url_converter_scope||t,t.decode(c),'style',null))+')';});}o[tinymce.trim(v[0]).toLowerCase()]=sv;}});compress("border","","border");compress("border","-width","border-width");compress("border","-color","border-color");compress("border","-style","border-style");compress("padding","","padding");compress("margin","","margin");compress2('border','border-width','border-style','border-color');if(isIE){if(o.border=='medium none')o.border='';}return o;},serializeStyle:function(o){var s='';each(o,function(v,k){if(k&&v){switch(k){case'color':case'background-color':v=v.toLowerCase();break;}s+=(s?' ':'')+k+': '+v+';';}});return s;},loadCSS:function(u){var t=this,d=t.doc;if(!u)u='';each(u.split(','),function(u){if(t.files[u])return;t.files[u]=true;t.add(t.select('head')[0],'link',{rel:'stylesheet',href:tinymce._addVer(u)});});},addClass:function(e,c){return this.run(e,function(e){var o;if(!c)return 0;if(this.hasClass(e,c))return e.className;o=this.removeClass(e,c);return e.className=(o!=''?(o+' '):'')+c;});},removeClass:function(e,c){var t=this,re;return t.run(e,function(e){var v;if(t.hasClass(e,c)){if(!re)re=new RegExp("(^|\\s+)"+c+"(\\s+|$)","g");v=e.className.replace(re,' ');return e.className=tinymce.trim(v!=' '?v:'');}return e.className;});},hasClass:function(n,c){n=this.get(n);if(!n||!c)return false;return(' '+n.className+' ').indexOf(' '+c+' ')!==-1;},show:function(e){return this.setStyle(e,'display','block');},hide:function(e){return this.setStyle(e,'display','none');},isHidden:function(e){e=this.get(e);return e.style.display=='none'||this.getStyle(e,'display')=='none';},uniqueId:function(p){return(!p?'mce_':p)+(this.counter++);},setHTML:function(e,h){var t=this;return this.run(e,function(e){var x,i,nl,n,p,x;h=t.processHTML(h);if(isIE){function set(){try{e.innerHTML='<br />'+h;e.removeChild(e.firstChild);}catch(ex){while(e.firstChild)e.firstChild.removeNode();x=t.create('div');x.innerHTML='<br />'+h;each(x.childNodes,function(n,i){if(i)e.appendChild(n);});}};if(t.settings.fix_ie_paragraphs)h=h.replace(/<p><\/p>|<p([^>]+)><\/p>|<p[^\/+]\/>/gi,'<p$1 mce_keep="true">&nbsp;</p>');set();if(t.settings.fix_ie_paragraphs){nl=e.getElementsByTagName("p");for(i=nl.length-1,x=0;i>=0;i--){n=nl[i];if(!n.hasChildNodes()){if(!n.mce_keep){x=1;break;}n.removeAttribute('mce_keep');}}}if(x){h=h.replace(/<p([^>]+)>|<p>/g,'<div$1 mce_tmp="1">');h=h.replace(/<\/p>/g,'</div>');set();if(t.settings.fix_ie_paragraphs){nl=e.getElementsByTagName("DIV");for(i=nl.length-1;i>=0;i--){n=nl[i];if(n.mce_tmp){p=t.doc.createElement('p');n.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi,function(a,b){var v;if(b!=='mce_tmp'){v=n.getAttribute(b);if(!v&&b==='class')v=n.className;p.setAttribute(b,v);}});for(x=0;x<n.childNodes.length;x++)p.appendChild(n.childNodes[x].cloneNode(true));n.swapNode(p);}}}}}else e.innerHTML=h;return h;});},processHTML:function(h){var t=this,s=t.settings;if(!s.process_html)return h;if(tinymce.isGecko){h=h.replace(/<(\/?)strong>|<strong( [^>]+)>/gi,'<$1b$2>');h=h.replace(/<(\/?)em>|<em( [^>]+)>/gi,'<$1i$2>');}else if(isIE)h=h.replace(/&apos;/g,'&#39;');h=h.replace(/<a( )([^>]+)\/>|<a\/>/gi,'<a$1$2></a>');if(s.keep_values){if(h.indexOf('<script')!==-1){h=h.replace(/<script>/g,'<script type="text/javascript">');h=h.replace(/<script(|[^>]+)>(\s*<!--|\/\/\s*<\[CDATA\[)?[\r\n]*/g,'<mce:script$1><!--\n');h=h.replace(/\s*(\/\/\s*-->|\/\/\s*]]>)?<\/script>/g,'\n// --></mce:script>');h=h.replace(/<mce:script(|[^>]+)><!--\n\/\/ --><\/mce:script>/g,'<mce:script$1></mce:script>');}h=h.replace(/<([\w:]+) [^>]*(src|href|style|coords)[^>]*>/gi,function(a,n){function handle(m,b,c){var u=c;if(a.indexOf('mce_'+b)!=-1)return m;if(b=='style'){if(/^(| )(top|left|bottom|right|width|height)/i.test(c))return m;if(s.hex_colors){u=u.replace(/rgb\([^\)]+\)/g,function(v){return t.toHex(v);});}if(s.url_converter){u=u.replace(/url\([\'\"]?([^\)\'\"]+)\)/g,function(x,c){return'url('+t.encode(s.url_converter.call(s.url_converter_scope||t,t.decode(c),b,n))+')';});}}else if(b!='coords'){if(s.url_converter)u=t.encode(s.url_converter.call(s.url_converter_scope||t,t.decode(c),b,n));}return' '+b+'="'+c+'" mce_'+b+'="'+u+'"';};a=a.replace(/ (src|href|style|coords)=[\"]([^\"]+)[\"]/gi,handle);a=a.replace(/ (src|href|style|coords)=[\']([^\']+)[\']/gi,handle);return a.replace(/ (src|href|style|coords)=([^\s\"\'>]+)/gi,handle);});}return h;},getOuterHTML:function(e){var d;e=this.get(e);if(!e)return null;if(isIE)return e.outerHTML;d=(e.ownerDocument||this.doc).createElement("body");d.appendChild(e.cloneNode(true));return d.innerHTML;},setOuterHTML:function(e,h,d){var t=this;return this.run(e,function(e){var n,tp;e=t.get(e);d=d||e.ownerDocument||t.doc;if(isIE&&e.nodeType==1)e.outerHTML=h;else{tp=d.createElement("body");tp.innerHTML=h;n=tp.lastChild;while(n){t.insertAfter(n.cloneNode(true),e);n=n.previousSibling;}t.remove(e);}});},decode:function(s){var e;if(/&[^;]+;/.test(s)){e=this.doc.createElement("div");e.innerHTML=s;return!e.firstChild?s:e.firstChild.nodeValue;}return s;},encode:function(s){return s?(''+s).replace(/[<>&\"]/g,function(c,b){switch(c){case'&':return'&amp;';case'"':return'&quot;';case'<':return'&lt;';case'>':return'&gt;';}return c;}):s;},insertAfter:function(n,r){var t=this;r=t.get(r);return this.run(n,function(n){var p,ns;p=r.parentNode;ns=r.nextSibling;if(ns)p.insertBefore(n,ns);else p.appendChild(n);return n;});},isBlock:function(n){if(n.nodeType&&n.nodeType!==1)return false;n=n.nodeName||n;return/^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(n);},replace:function(n,o,k){if(is(o,'array'))n=n.cloneNode(true);return this.run(o,function(o){if(k){each(o.childNodes,function(c){n.appendChild(c.cloneNode(true));});}return o.parentNode.replaceChild(n,o);});},toHex:function(s){var c=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(s);function hex(s){s=parseInt(s).toString(16);return s.length>1?s:'0'+s;};if(c){s='#'+hex(c[1])+hex(c[2])+hex(c[3]);return s;}return s;},getClasses:function(){var t=this,cl=[],i,lo={},f=t.settings.class_filter,ov;if(t.classes)return t.classes;function addClasses(s){each(s.imports,function(r){addClasses(r);});each(s.cssRules||s.rules,function(r){switch(r.type||1){case 1:if(r.selectorText){each(r.selectorText.split(','),function(v){v=v.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(v)||!/\.[\w\-]+$/.test(v))return;ov=v;v=v.replace(/.*\.([a-z0-9_\-]+).*/i,'$1');if(f&&!(v=f(v,ov)))return;if(!lo[v]){cl.push({'class':v});lo[v]=1;}});}break;case 3:addClasses(r.styleSheet);break;}});};try{each(t.doc.styleSheets,addClasses);}catch(ex){}if(cl.length>0)t.classes=cl;return cl;},run:function(e,f,s){var t=this,o;if(t.doc&&typeof(e)==='string')e=t.doc.getElementById(e);if(!e)return false;s=s||this;if(!e.nodeType&&(e.length||e.length===0)){o=[];each(e,function(e,i){if(e){if(typeof(e)=='string')e=t.doc.getElementById(e);o.push(f.call(s,e,i));}});return o;}return f.call(s,e);},getAttribs:function(n){var o;n=this.get(n);if(!n)return[];if(isIE){o=[];if(n.nodeName=='OBJECT')return n.attributes;n.cloneNode(false).outerHTML.replace(/([a-z0-9\:\-_]+)=/gi,function(a,b){o.push({specified:1,nodeName:b});});return o;}return n.attributes;},destroy:function(s){var t=this;t.win=t.doc=t.root=null;if(!s)tinymce.removeUnload(t.destroy);}});tinymce.DOM=new tinymce.dom.DOMUtils(document,{process_html:0});})();(function(){var each=tinymce.each,DOM=tinymce.DOM,isIE=tinymce.isIE,isWebKit=tinymce.isWebKit,Event;tinymce.create('static tinymce.dom.Event',{inits:[],events:[],add:function(o,n,f,s){var cb,t=this,el=t.events,r;if(o&&o instanceof Array){r=[];each(o,function(o){o=DOM.get(o);r.push(t.add(o,n,f,s));});return r;}o=DOM.get(o);if(!o)return;cb=function(e){e=e||window.event;if(e&&!e.target&&isIE)e.target=e.srcElement;if(!s)return f(e);return f.call(s,e);};if(n=='unload'){tinymce.unloads.unshift({func:cb});return cb;}if(n=='init'){if(t.domLoaded)cb();else t.inits.push(cb);return cb;}el.push({obj:o,name:n,func:f,cfunc:cb,scope:s});t._add(o,n,cb);return f;},remove:function(o,n,f){var t=this,a=t.events,s=false,r;if(o&&o instanceof Array){r=[];each(o,function(o){o=DOM.get(o);r.push(t.remove(o,n,f));});return r;}o=DOM.get(o);each(a,function(e,i){if(e.obj==o&&e.name==n&&(!f||(e.func==f||e.cfunc==f))){a.splice(i,1);t._remove(o,n,e.cfunc);s=true;return false;}});return s;},clear:function(o){var t=this,a=t.events,i,e;if(o){o=DOM.get(o);for(i=a.length-1;i>=0;i--){e=a[i];if(e.obj===o){t._remove(e.obj,e.name,e.cfunc);e.obj=e.cfunc=null;a.splice(i,1);}}}},cancel:function(e){if(!e)return false;this.stop(e);return this.prevent(e);},stop:function(e){if(e.stopPropagation)e.stopPropagation();else e.cancelBubble=true;return false;},prevent:function(e){if(e.preventDefault)e.preventDefault();else e.returnValue=false;return false;},_unload:function(){var t=Event;each(t.events,function(e,i){t._remove(e.obj,e.name,e.cfunc);e.obj=e.cfunc=null;});t.events=[];t=null;},_add:function(o,n,f){if(o.attachEvent)o.attachEvent('on'+n,f);else if(o.addEventListener)o.addEventListener(n,f,false);else o['on'+n]=f;},_remove:function(o,n,f){if(o){try{if(o.detachEvent)o.detachEvent('on'+n,f);else if(o.removeEventListener)o.removeEventListener(n,f,false);else o['on'+n]=null;}catch(ex){}}},_pageInit:function(){var e=Event;e._remove(window,'DOMContentLoaded',e._pageInit);e.domLoaded=true;each(e.inits,function(c){c();});e.inits=[];},_wait:function(){var t;if(window.tinyMCE_GZ&&tinyMCE_GZ.loaded)return;if(isIE&&document.location.protocol!='https:'){document.write('<script id=__ie_onload defer src=\'javascript:""\';><\/script>');DOM.get("__ie_onload").onreadystatechange=function(){if(this.readyState=="complete"){Event._pageInit();DOM.get("__ie_onload").onreadystatechange=null;}};}else{Event._add(window,'DOMContentLoaded',Event._pageInit,Event);if(isIE||isWebKit){t=setInterval(function(){if(/loaded|complete/.test(document.readyState)){clearInterval(t);Event._pageInit();}},10);}}}});Event=tinymce.dom.Event;Event._wait();tinymce.addUnload(Event._unload);})();(function(){var each=tinymce.each;tinymce.create('tinymce.dom.Element',{Element:function(id,s){var t=this,dom,el;s=s||{};t.id=id;t.dom=dom=s.dom||tinymce.DOM;t.settings=s;if(!tinymce.isIE)el=t.dom.get(t.id);each(['getPos','getRect','getParent','add','setStyle','getStyle','setStyles','setAttrib','setAttribs','getAttrib','addClass','removeClass','hasClass','getOuterHTML','setOuterHTML','remove','show','hide','isHidden','setHTML','get'],function(k){t[k]=function(){var a=arguments,o;if(tinymce.isOpera){a=[id];each(arguments,function(v){a.push(v);});}else Array.prototype.unshift.call(a,el||id);o=dom[k].apply(dom,a);t.update(k);return o;};});},on:function(n,f,s){return tinymce.dom.Event.add(this.id,n,f,s);},getXY:function(){return{x:parseInt(this.getStyle('left')),y:parseInt(this.getStyle('top'))};},getSize:function(){var n=this.dom.get(this.id);return{w:parseInt(this.getStyle('width')||n.clientWidth),h:parseInt(this.getStyle('height')||n.clientHeight)};},moveTo:function(x,y){this.setStyles({left:x,top:y});},moveBy:function(x,y){var p=this.getXY();this.moveTo(p.x+x,p.y+y);},resizeTo:function(w,h){this.setStyles({width:w,height:h});},resizeBy:function(w,h){var s=this.getSize();this.resizeTo(s.w+w,s.h+h);},update:function(k){var t=this,b,dom=t.dom;if(tinymce.isIE6&&t.settings.blocker){k=k||'';if(k.indexOf('get')===0||k.indexOf('has')===0||k.indexOf('is')===0)return;if(k=='remove'){dom.remove(t.blocker);return;}if(!t.blocker){t.blocker=dom.uniqueId();b=dom.add(t.settings.container||dom.getRoot(),'iframe',{id:t.blocker,style:'position:absolute;',frameBorder:0,src:'javascript:""'});dom.setStyle(b,'opacity',0);}else b=dom.get(t.blocker);dom.setStyle(b,'left',t.getStyle('left',1));dom.setStyle(b,'top',t.getStyle('top',1));dom.setStyle(b,'width',t.getStyle('width',1));dom.setStyle(b,'height',t.getStyle('height',1));dom.setStyle(b,'display',t.getStyle('display',1));dom.setStyle(b,'zIndex',parseInt(t.getStyle('zIndex',1)||0)-1);}}});})();(function(){var is=tinymce.is,isIE=tinymce.isIE,each=tinymce.each;tinymce.create('tinymce.dom.Selection',{Selection:function(dom,win,serializer){var t=this;t.dom=dom;t.win=win;t.serializer=serializer;tinymce.addUnload(t.destroy,t);},getContent:function(s){var t=this,r=t.getRng(),e=t.dom.create("body"),se=t.getSel(),wb,wa,n;s=s||{};wb=wa='';s.get=true;s.format=s.format||'html';if(s.format=='text')return t.isCollapsed()?'':(r.text||(se.toString?se.toString():''));if(r.cloneContents){n=r.cloneContents();if(n)e.appendChild(n);}else if(is(r.item)||is(r.htmlText))e.innerHTML=r.item?r.item(0).outerHTML:r.htmlText;else e.innerHTML=r.toString();if(/^\s/.test(e.innerHTML))wb=' ';if(/\s+$/.test(e.innerHTML))wa=' ';s.getInner=true;return t.isCollapsed()?'':wb+t.serializer.serialize(e,s)+wa;},setContent:function(h,s){var t=this,r=t.getRng(),d;s=s||{format:'html'};s.set=true;h=t.dom.processHTML(h);if(r.insertNode){d=t.win.document;if(tinymce.isGecko&&h.indexOf('<')==-1){r.deleteContents();r.insertNode(t.getRng().createContextualFragment(h+'<span id="__caret">_</span>'));t.select(t.dom.get('__caret'));t.getRng().deleteContents();return;}try{if(d.queryCommandEnabled('InsertHTML'))return d.execCommand('InsertHTML',false,h);}catch(ex){r.deleteContents();r.insertNode(t.getRng().createContextualFragment(h));}}else{if(r.item)r.item(0).outerHTML=h;else r.pasteHTML(h);}},getStart:function(){var t=this,r=t.getRng(),e;if(isIE){if(r.item)return r.item(0);r=r.duplicate();r.collapse(1);e=r.parentElement();if(e.nodeName=='BODY')return e.firstChild;return e;}else{e=r.startContainer;if(e.nodeName=='BODY')return e.firstChild;return t.dom.getParent(e,function(n){return n.nodeType==1;});}},getEnd:function(){var t=this,r=t.getRng(),e;if(isIE){if(r.item)return r.item(0);r=r.duplicate();r.collapse(0);e=r.parentElement();if(e.nodeName=='BODY')return e.lastChild;return e;}else{e=r.endContainer;if(e.nodeName=='BODY')return e.lastChild;return t.dom.getParent(e,function(n){return n.nodeType==1;});}},getBookmark:function(si){var t=this,r=t.getRng(),tr,sx,sy,vp=t.dom.getViewPort(t.win),e,sp,bp,le,c=-0xFFFFFF,s,ro=t.dom.getRoot(),wb=0,wa=0,nv;sx=vp.x;sy=vp.y;if(si=='simple')return{rng:r,scrollX:sx,scrollY:sy};if(isIE){if(r.item){e=r.item(0);each(t.dom.select(e.nodeName),function(n,i){if(e==n){sp=i;return false;}});return{tag:e.nodeName,index:sp,scrollX:sx,scrollY:sy};}tr=t.dom.doc.body.createTextRange();tr.moveToElementText(ro);tr.collapse(true);bp=Math.abs(tr.move('character',c));tr=r.duplicate();tr.collapse(true);sp=Math.abs(tr.move('character',c));tr=r.duplicate();tr.collapse(false);le=Math.abs(tr.move('character',c))-sp;return{start:sp-bp,length:le,scrollX:sx,scrollY:sy};}e=t.getNode();s=t.getSel();if(!s)return null;if(e&&e.nodeName=='IMG'){return{scrollX:sx,scrollY:sy};}function getPos(r,sn,en){var w=t.dom.doc.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false),n,p=0,d={};while((n=w.nextNode())!=null){if(n==sn)d.start=p;if(n==en){d.end=p;return d;}p+=tinymce.trim(n.nodeValue||'').length;}return null;};if(s.anchorNode==s.focusNode&&s.anchorOffset==s.focusOffset){e=getPos(ro,s.anchorNode,s.focusNode);if(!e)return{scrollX:sx,scrollY:sy};(s.anchorNode.nodeValue||'').replace(/^\s+/,function(a){wb=a.length;});return{start:Math.max(e.start+s.anchorOffset-wb,0),end:Math.max(e.end+s.focusOffset-wb,0),scrollX:sx,scrollY:sy,beg:s.anchorOffset-wb==0};}else{e=getPos(ro,r.startContainer,r.endContainer);(r.startContainer.nodeValue||'').replace(/^\s+/,function(a){wb=a.length;});(r.endContainer.nodeValue||'').replace(/^\s+/,function(a){wa=a.length;});if(!e)return{scrollX:sx,scrollY:sy};return{start:Math.max(e.start+r.startOffset-wb,0),end:Math.max(e.end+r.endOffset-wa,0),scrollX:sx,scrollY:sy,beg:r.startOffset-wb==0};}},moveToBookmark:function(b){var t=this,r=t.getRng(),s=t.getSel(),ro=t.dom.getRoot(),sd,nvl,nv;function getPos(r,sp,ep){var w=t.dom.doc.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false),n,p=0,d={},o,v,wa,wb;while((n=w.nextNode())!=null){wa=wb=0;nv=n.nodeValue||'';nv.replace(/^\s+[^\s]/,function(a){wb=a.length-1;});nv.replace(/[^\s]\s+$/,function(a){wa=a.length-1;});nvl=tinymce.trim(nv).length;p+=nvl;if(p>=sp&&!d.startNode){o=sp-(p-nvl);if(b.beg&&o>=nvl)continue;d.startNode=n;d.startOffset=o+wb;}if(p>=ep){d.endNode=n;d.endOffset=ep-(p-nvl)+wb;return d;}}return null;};if(!b)return false;t.win.scrollTo(b.scrollX,b.scrollY);if(isIE){if(r=b.rng){try{r.select();}catch(ex){}return true;}t.win.focus();if(b.tag){r=ro.createControlRange();each(t.dom.select(b.tag),function(n,i){if(i==b.index)r.addElement(n);});}else{try{if(b.start<0)return true;r=s.createRange();r.moveToElementText(ro);r.collapse(true);r.moveStart('character',b.start);r.moveEnd('character',b.length);}catch(ex2){return true;}}try{r.select();}catch(ex){}return true;}if(!s)return false;if(b.rng){s.removeAllRanges();s.addRange(b.rng);}else{if(is(b.start)&&is(b.end)){try{sd=getPos(ro,b.start,b.end);if(sd){r=t.dom.doc.createRange();r.setStart(sd.startNode,sd.startOffset);r.setEnd(sd.endNode,sd.endOffset);s.removeAllRanges();s.addRange(r);}if(!tinymce.isOpera)t.win.focus();}catch(ex){}}}},select:function(n,c){var t=this,r=t.getRng(),s=t.getSel(),b,fn,ln,d=t.win.document;function first(n){return n?d.createTreeWalker(n,NodeFilter.SHOW_TEXT,null,false).nextNode():null;};function last(n){var c,o,w;if(!n)return null;w=d.createTreeWalker(n,NodeFilter.SHOW_TEXT,null,false);while(c=w.nextNode())o=c;return o;};if(isIE){try{b=d.body;if(/^(IMG|TABLE)$/.test(n.nodeName)){r=b.createControlRange();r.addElement(n);}else{r=b.createTextRange();r.moveToElementText(n);}r.select();}catch(ex){}}else{if(c){fn=first(n);ln=last(n);if(fn&&ln){r=d.createRange();r.setStart(fn,0);r.setEnd(ln,ln.nodeValue.length);}else r.selectNode(n);}else r.selectNode(n);t.setRng(r);}return n;},isCollapsed:function(){var t=this,r=t.getRng(),s=t.getSel();if(!r||r.item)return false;return!s||r.boundingWidth==0||s.isCollapsed;},collapse:function(b){var t=this,r=t.getRng(),n;if(r.item){n=r.item(0);r=this.win.document.body.createTextRange();r.moveToElementText(n);}r.collapse(!!b);t.setRng(r);},getSel:function(){var t=this,w=this.win;return w.getSelection?w.getSelection():w.document.selection;},getRng:function(){var t=this,s=t.getSel(),r;try{if(s)r=s.rangeCount>0?s.getRangeAt(0):(s.createRange?s.createRange():t.win.document.createRange());}catch(ex){}if(!r)r=isIE?t.win.document.body.createTextRange():t.win.document.createRange();return r;},setRng:function(r){var s;if(!isIE){s=this.getSel();if(s){s.removeAllRanges();s.addRange(r);}}else{try{r.select();}catch(ex){}}},setNode:function(n){var t=this;t.setContent(t.dom.getOuterHTML(n));return n;},getNode:function(){var t=this,r=t.getRng(),s=t.getSel(),e;if(!isIE){if(!r)return t.dom.getRoot();e=r.commonAncestorContainer;if(!r.collapsed){if(r.startContainer==r.endContainer||(tinymce.isWebKit&&r.startContainer==r.endContainer.parentNode)){if(r.startOffset-r.endOffset<2||tinymce.isWebKit){if(r.startContainer.hasChildNodes())e=r.startContainer.childNodes[r.startOffset];}}}return t.dom.getParent(e,function(n){return n.nodeType==1;});}return r.item?r.item(0):r.parentElement();},destroy:function(s){var t=this;t.win=null;if(!s)tinymce.removeUnload(t.destroy);}});})();(function(){tinymce.create('tinymce.dom.XMLWriter',{node:null,XMLWriter:function(s){function getXML(){var i=document.implementation;if(!i||!i.createDocument){try{return new ActiveXObject('MSXML2.DOMDocument');}catch(ex){}try{return new ActiveXObject('Microsoft.XmlDom');}catch(ex){}}else return i.createDocument('','',null);};this.doc=getXML();this.valid=tinymce.isOpera||tinymce.isWebKit;this.reset();},reset:function(){var t=this,d=t.doc;if(d.firstChild)d.removeChild(d.firstChild);t.node=d.appendChild(d.createElement("html"));},writeStartElement:function(n){var t=this;t.node=t.node.appendChild(t.doc.createElement(n));},writeAttribute:function(n,v){if(this.valid)v=v.replace(/>/g,'%MCGT%');this.node.setAttribute(n,v);},writeEndElement:function(){this.node=this.node.parentNode;},writeFullEndElement:function(){var t=this,n=t.node;n.appendChild(t.doc.createTextNode(""));t.node=n.parentNode;},writeText:function(v){if(this.valid)v=v.replace(/>/g,'%MCGT%');this.node.appendChild(this.doc.createTextNode(v));},writeCDATA:function(v){this.node.appendChild(this.doc.createCDATA(v));},writeComment:function(v){this.node.appendChild(this.doc.createComment(v.replace(/\-\-/g,' ')));},getContent:function(){var h;h=this.doc.xml||new XMLSerializer().serializeToString(this.doc);h=h.replace(/<\?[^?]+\?>|<html>|<\/html>|<html\/>|<!DOCTYPE[^>]+>/g,'');h=h.replace(/ ?\/>/g,' />');if(this.valid)h=h.replace(/\%MCGT%/g,'&gt;');return h;}});})();(function(){tinymce.create('tinymce.dom.StringWriter',{str:null,tags:null,count:0,settings:null,indent:null,StringWriter:function(s){this.settings=tinymce.extend({indent_char:' ',indentation:1},s);this.reset();},reset:function(){this.indent='';this.str="";this.tags=[];this.count=0;},writeStartElement:function(n){this._writeAttributesEnd();this.writeRaw('<'+n);this.tags.push(n);this.inAttr=true;this.count++;this.elementCount=this.count;},writeAttribute:function(n,v){var t=this;t.writeRaw(" "+t.encode(n)+'="'+t.encode(v)+'"');},writeEndElement:function(){var n;if(this.tags.length>0){n=this.tags.pop();if(this._writeAttributesEnd(1))this.writeRaw('</'+n+'>');if(this.settings.indentation>0)this.writeRaw('\n');}},writeFullEndElement:function(){if(this.tags.length>0){this._writeAttributesEnd();this.writeRaw('</'+this.tags.pop()+'>');if(this.settings.indentation>0)this.writeRaw('\n');}},writeText:function(v){this._writeAttributesEnd();this.writeRaw(this.encode(v));this.count++;},writeCDATA:function(v){this._writeAttributesEnd();this.writeRaw('<![CDATA['+v+']]>');this.count++;},writeComment:function(v){this._writeAttributesEnd();this.writeRaw('<!-- '+v+'-->');this.count++;},writeRaw:function(v){this.str+=v;},encode:function(s){return s.replace(/[<>&"]/g,function(v){switch(v){case'<':return'&lt;';case'>':return'&gt;';case'&':return'&amp;';case'"':return'&quot;';}return v;});},getContent:function(){return this.str;},_writeAttributesEnd:function(s){if(!this.inAttr)return;this.inAttr=false;if(s&&this.elementCount==this.count){this.writeRaw(' />');return false;}this.writeRaw('>');return true;}});})();(function(){var extend=tinymce.extend,each=tinymce.each,Dispatcher=tinymce.util.Dispatcher,isIE=tinymce.isIE,isGecko=tinymce.isGecko;function getIEAtts(n){var o=[];if(n.nodeName=='OBJECT')return n.attributes;n.cloneNode(false).outerHTML.replace(/([a-z0-9\:\-_]+)=/gi,function(a,b){o.push({specified:1,nodeName:b});});return o;};function wildcardToRE(s){return s.replace(/([?+*])/g,'.$1');};tinymce.create('tinymce.dom.Serializer',{Serializer:function(s){var t=this;t.key=0;t.onPreProcess=new Dispatcher(t);t.onPostProcess=new Dispatcher(t);if(tinymce.relaxedDomain&&tinymce.isGecko){t.writer=new tinymce.dom.StringWriter();}else{try{t.writer=new tinymce.dom.XMLWriter();}catch(ex){t.writer=new tinymce.dom.StringWriter();}}t.settings=s=extend({dom:tinymce.DOM,valid_nodes:0,node_filter:0,attr_filter:0,invalid_attrs:/^(mce_|_moz_)/,closed:/(br|hr|input|meta|img|link|param)/,entity_encoding:'named',entities:'160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro',valid_elements:'*[*]',extended_valid_elements:0,valid_child_elements:0,invalid_elements:0,fix_table_elements:0,fix_list_elements:true,fix_content_duplication:true,convert_fonts_to_spans:false,font_size_classes:0,font_size_style_values:0,apply_source_formatting:0,indent_mode:'simple',indent_char:'\t',indent_levels:1,remove_linebreaks:1},s);t.dom=s.dom;if(s.fix_list_elements){t.onPreProcess.add(function(se,o){var nl,x,a=['ol','ul'],i,n,p,r=/^(OL|UL)$/,np;function prevNode(e,n){var a=n.split(','),i;while((e=e.previousSibling)!=null){for(i=0;i<a.length;i++){if(e.nodeName==a[i])return e;}}return null;};for(x=0;x<a.length;x++){nl=t.dom.select(a[x],o.node);for(i=0;i<nl.length;i++){n=nl[i];p=n.parentNode;if(r.test(p.nodeName)){np=prevNode(n,'LI');if(!np){np=t.dom.create('li');np.innerHTML='&nbsp;';np.appendChild(n);p.insertBefore(np,p.firstChild);}else np.appendChild(n);}}}});}if(s.fix_table_elements){t.onPreProcess.add(function(se,o){each(t.dom.select('table',o.node),function(e){var pa=t.dom.getParent(e,'H1,H2,H3,H4,H5,H6,P'),pa2,n,tm,pl=[],i,ns;if(pa){pa2=pa.cloneNode(false);pl.push(e);for(n=e;n=n.parentNode;){pl.push(n);if(n==pa)break;}tm=pa2;for(i=pl.length-1;i>=0;i--){if(i==pl.length-1){while(ns=pl[i-1].nextSibling)tm.appendChild(ns.parentNode.removeChild(ns));}else{n=pl[i].cloneNode(false);if(i!=0){while(ns=pl[i-1].nextSibling)n.appendChild(ns.parentNode.removeChild(ns));}tm=tm.appendChild(n);}}e=t.dom.insertAfter(e.parentNode.removeChild(e),pa);t.dom.insertAfter(e,pa);t.dom.insertAfter(pa2,e);}});});}},setEntities:function(s){var t=this,a,i,l={},re='',v;if(t.entityLookup)return;a=s.split(',');for(i=0;i<a.length;i+=2){v=a[i];if(v==34||v==38||v==60||v==62)continue;l[String.fromCharCode(a[i])]=a[i+1];v=parseInt(a[i]).toString(16);re+='\\u'+'0000'.substring(v.length)+v;}if(!re){t.settings.entity_encoding='raw';return;}t.entitiesRE=new RegExp('['+re+']','g');t.entityLookup=l;},setValidChildRules:function(s){this.childRules=null;this.addValidChildRules(s);},addValidChildRules:function(s){var t=this,inst,intr,bloc;if(!s)return;inst='A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment';intr='A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment';bloc='H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP';each(s.split(','),function(s){var p=s.split(/\[|\]/),re;s='';each(p[1].split('|'),function(v){if(s)s+='|';switch(v){case'%itrans':v=intr;break;case'%itrans_na':v=intr.substring(2);break;case'%istrict':v=inst;break;case'%istrict_na':v=inst.substring(2);break;case'%btrans':v=bloc;break;case'%bstrict':v=bloc;break;}s+=v;});re=new RegExp('^('+s.toLowerCase()+')$','i');each(p[0].split('/'),function(s){t.childRules=t.childRules||{};t.childRules[s]=re;});});s='';each(t.childRules,function(v,k){if(s)s+='|';s+=k;});t.parentElementsRE=new RegExp('^('+s.toLowerCase()+')$','i');},setRules:function(s){var t=this;t._setup();t.rules={};t.wildRules=[];t.validElements={};return t.addRules(s);},addRules:function(s){var t=this,dr;if(!s)return;t._setup();each(s.split(','),function(s){var p=s.split(/\[|\]/),tn=p[0].split('/'),ra,at,wat,va=[];if(dr)at=tinymce.extend([],dr.attribs);if(p.length>1){each(p[1].split('|'),function(s){var ar={},i;at=at||[];s=s.replace(/::/g,'~');s=/^([!\-])?([\w*.?~_\-]+|)([=:<])?(.+)?$/.exec(s);s[2]=s[2].replace(/~/g,':');if(s[1]=='!'){ra=ra||[];ra.push(s[2]);}if(s[1]=='-'){for(i=0;i<at.length;i++){if(at[i].name==s[2]){at.splice(i,1);return;}}}switch(s[3]){case'=':ar.defaultVal=s[4]||'';break;case':':ar.forcedVal=s[4];break;case'<':ar.validVals=s[4].split('?');break;}if(/[*.?]/.test(s[2])){wat=wat||[];ar.nameRE=new RegExp('^'+wildcardToRE(s[2])+'$');wat.push(ar);}else{ar.name=s[2];at.push(ar);}va.push(s[2]);});}each(tn,function(s,i){var pr=s.charAt(0),x=1,ru={};if(dr){if(dr.noEmpty)ru.noEmpty=dr.noEmpty;if(dr.fullEnd)ru.fullEnd=dr.fullEnd;if(dr.padd)ru.padd=dr.padd;}switch(pr){case'-':ru.noEmpty=true;break;case'+':ru.fullEnd=true;break;case'#':ru.padd=true;break;default:x=0;}tn[i]=s=s.substring(x);t.validElements[s]=1;if(/[*.?]/.test(tn[0])){ru.nameRE=new RegExp('^'+wildcardToRE(tn[0])+'$');t.wildRules=t.wildRules||{};t.wildRules.push(ru);}else{ru.name=tn[0];if(tn[0]=='@')dr=ru;t.rules[s]=ru;}ru.attribs=at;if(ra)ru.requiredAttribs=ra;if(wat){s='';each(va,function(v){if(s)s+='|';s+='('+wildcardToRE(v)+')';});ru.validAttribsRE=new RegExp('^'+s.toLowerCase()+'$');ru.wildAttribs=wat;}});});s='';each(t.validElements,function(v,k){if(s)s+='|';if(k!='@')s+=k;});t.validElementsRE=new RegExp('^('+wildcardToRE(s.toLowerCase())+')$');},findRule:function(n){var t=this,rl=t.rules,i,r;t._setup();r=rl[n];if(r)return r;rl=t.wildRules;for(i=0;i<rl.length;i++){if(rl[i].nameRE.test(n))return rl[i];}return null;},findAttribRule:function(ru,n){var i,wa=ru.wildAttribs;for(i=0;i<wa.length;i++){if(wa[i].nameRE.test(n))return wa[i];}return null;},serialize:function(n,o){var h,t=this;t._setup();o=o||{};o.format=o.format||'html';t.processObj=o;n=n.cloneNode(true);t.key=''+(parseInt(t.key)+1);if(!o.no_events){o.node=n;t.onPreProcess.dispatch(t,o);}t.writer.reset();t._serializeNode(n,o.getInner);o.content=t.writer.getContent();if(!o.no_events)t.onPostProcess.dispatch(t,o);t._postProcess(o);o.node=null;return tinymce.trim(o.content);},_postProcess:function(o){var t=this,s=t.settings,h=o.content,sc=[],p;if(o.format=='html'){p=t._protect({content:h,patterns:[{pattern:/(<script[^>]*>)(.*?)(<\/script>)/g},{pattern:/(<style[^>]*>)(.*?)(<\/style>)/g},{pattern:/(<pre[^>]*>)(.*?)(<\/pre>)/g,encode:1}]});h=p.content;if(s.entity_encoding!=='raw')h=t._encode(h);if(!o.set){h=h.replace(/<p>\s+<\/p>|<p([^>]+)>\s+<\/p>/g,s.entity_encoding=='numeric'?'<p$1>&#160;</p>':'<p$1>&nbsp;</p>');if(s.remove_linebreaks){h=h.replace(/\r?\n|\r/g,' ');h=h.replace(/(<[^>]+>)\s+/g,'$1 ');h=h.replace(/\s+(<\/[^>]+>)/g,' $1');h=h.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object) ([^>]+)>\s+/g,'<$1 $2>');h=h.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>\s+/g,'<$1>');h=h.replace(/\s+<\/(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>/g,'</$1>');}if(s.apply_source_formatting&&s.indent_mode=='simple'){h=h.replace(/<(\/?)(ul|hr|table|meta|link|tbody|tr|object|body|head|html|map)(|[^>]+)>\s*/g,'\n<$1$2$3>\n');h=h.replace(/\s*<(p|h[1-6]|blockquote|div|title|style|pre|script|td|li|area)(|[^>]+)>/g,'\n<$1$2>');h=h.replace(/<\/(p|h[1-6]|blockquote|div|title|style|pre|script|td|li)>\s*/g,'</$1>\n');h=h.replace(/\n\n/g,'\n');}}h=t._unprotect(h,p);if(s.entity_encoding=='raw')h=h.replace(/<p>&nbsp;<\/p>|<p([^>]+)>&nbsp;<\/p>/g,'<p$1>\u00a0</p>');}o.content=h;},_serializeNode:function(n,inn){var t=this,s=t.settings,w=t.writer,hc,el,cn,i,l,a,at,no,v,nn,ru,ar,iv;if(!s.node_filter||s.node_filter(n)){switch(n.nodeType){case 1:if(n.hasAttribute?n.hasAttribute('mce_bogus'):n.getAttribute('mce_bogus'))return;iv=false;hc=n.hasChildNodes();nn=n.getAttribute('mce_name')||n.nodeName.toLowerCase();if(isIE){if(n.scopeName!=='HTML'&&n.scopeName!=='html')nn=n.scopeName+':'+nn;}if(nn.indexOf('mce:')===0)nn=nn.substring(4);if(!t.validElementsRE.test(nn)||(t.invalidElementsRE&&t.invalidElementsRE.test(nn))||inn){iv=true;break;}if(isIE){if(s.fix_content_duplication){if(n.mce_serialized==t.key)return;n.mce_serialized=t.key;}if(nn.charAt(0)=='/')nn=nn.substring(1);}else if(isGecko){if(n.nodeName==='BR'&&n.getAttribute('type')=='_moz')return;}if(t.childRules){if(t.parentElementsRE.test(t.elementName)){if(!t.childRules[t.elementName].test(nn)){iv=true;break;}}t.elementName=nn;}ru=t.findRule(nn);nn=ru.name||nn;if((!hc&&ru.noEmpty)||(isIE&&!nn)){iv=true;break;}if(ru.requiredAttribs){a=ru.requiredAttribs;for(i=a.length-1;i>=0;i--){if(this.dom.getAttrib(n,a[i])!=='')break;}if(i==-1){iv=true;break;}}w.writeStartElement(nn);if(ru.attribs){for(i=0,at=ru.attribs,l=at.length;i<l;i++){a=at[i];v=t._getAttrib(n,a);if(v!==null)w.writeAttribute(a.name,v);}}if(ru.validAttribsRE){at=isIE?getIEAtts(n):n.attributes;for(i=at.length-1;i>-1;i--){no=at[i];if(no.specified){a=no.nodeName.toLowerCase();if(s.invalid_attrs.test(a)||!ru.validAttribsRE.test(a))continue;ar=t.findAttribRule(ru,a);v=t._getAttrib(n,ar,a);if(v!==null)w.writeAttribute(a,v);}}}if(!hc&&ru.padd)w.writeText('\u00a0');break;case 3:if(t.childRules&&t.parentElementsRE.test(t.elementName)){if(!t.childRules[t.elementName].test(n.nodeName))return;}return w.writeText(n.nodeValue);case 4:return w.writeCDATA(n.nodeValue);case 8:return w.writeComment(n.nodeValue);}}else if(n.nodeType==1)hc=n.hasChildNodes();if(hc){cn=n.firstChild;while(cn){t._serializeNode(cn);t.elementName=nn;cn=cn.nextSibling;}}if(!iv){if(hc||!s.closed.test(nn))w.writeFullEndElement();else w.writeEndElement();}},_protect:function(o){var t=this;o.items=o.items||[];function enc(s){return s.replace(/[\r\n\\]/g,function(c){if(c==='\n')return'\\n';else if(c==='\\')return'\\\\';return'\\r';});};function dec(s){return s.replace(/\\[\\rn]/g,function(c){if(c==='\\n')return'\n';else if(c==='\\\\')return'\\';return'\r';});};each(o.patterns,function(p){o.content=dec(enc(o.content).replace(p.pattern,function(x,a,b,c){b=dec(b);if(p.encode)b=t._encode(b);o.items.push(b);return a+'<!--mce:'+(o.items.length-1)+'-->'+c;}));});return o;},_unprotect:function(h,o){h=h.replace(/\<!--mce:([0-9]+)--\>/g,function(a,b){return o.items[parseInt(b)];});o.items=[];return h;},_encode:function(h){var t=this,s=t.settings,l;if(s.entity_encoding!=='raw'){if(s.entity_encoding.indexOf('named')!=-1){t.setEntities(s.entities);l=t.entityLookup;h=h.replace(t.entitiesRE,function(a){var v;if(v=l[a])a='&'+v+';';return a;});}if(s.entity_encoding.indexOf('numeric')!=-1){h=h.replace(/[\u007E-\uFFFF]/g,function(a){return'&#'+a.charCodeAt(0)+';';});}}return h;},_setup:function(){var t=this,s=this.settings;if(t.done)return;t.done=1;t.setRules(s.valid_elements);t.addRules(s.extended_valid_elements);t.addValidChildRules(s.valid_child_elements);if(s.invalid_elements)t.invalidElementsRE=new RegExp('^('+wildcardToRE(s.invalid_elements.replace(',','|').toLowerCase())+')$');if(s.attrib_value_filter)t.attribValueFilter=s.attribValueFilter;},_getAttrib:function(n,a,na){var i,v;na=na||a.name;if(a.forcedVal&&(v=a.forcedVal)){if(v==='{$uid}')return this.dom.uniqueId();return v;}v=this.dom.getAttrib(n,na);switch(na){case'rowspan':case'colspan':if(v=='1')v='';break;}if(this.attribValueFilter)v=this.attribValueFilter(na,v,n);if(a.validVals){for(i=a.validVals.length-1;i>=0;i--){if(v==a.validVals[i])break;}if(i==-1)return null;}if(v===''&&typeof(a.defaultVal)!='undefined'){v=a.defaultVal;if(v==='{$uid}')return this.dom.uniqueId();return v;}else{if(na=='class'&&this.processObj.get)v=v.replace(/\s?mceItem\w+\s?/g,'');}if(v==='')return null;return v;}});})();(function(){var each=tinymce.each;tinymce.create('tinymce.dom.ScriptLoader',{ScriptLoader:function(s){this.settings=s||{};this.queue=[];this.lookup={};},isDone:function(u){return this.lookup[u]?this.lookup[u].state==2:0;},markDone:function(u){this.lookup[u]={state:2,url:u};},add:function(u,cb,s,pr){var t=this,lo=t.lookup,o;if(o=lo[u]){if(cb&&o.state==2)cb.call(s||this);return o;}o={state:0,url:u,func:cb,scope:s||this};if(pr)t.queue.unshift(o);else t.queue.push(o);lo[u]=o;return o;},load:function(u,cb,s){var t=this,o;if(o=t.lookup[u]){if(cb&&o.state==2)cb.call(s||t);return o;}function loadScript(u){if(tinymce.dom.Event.domLoaded||t.settings.strict_mode){tinymce.util.XHR.send({url:tinymce._addVer(u),error:t.settings.error,async:false,success:function(co){t.eval(co);}});}else document.write('<script type="text/javascript" src="'+tinymce._addVer(u)+'"></script>');};if(!tinymce.is(u,'string')){each(u,function(u){loadScript(u);});if(cb)cb.call(s||t);}else{loadScript(u);if(cb)cb.call(s||t);}},loadQueue:function(cb,s){var t=this;if(!t.queueLoading){t.queueLoading=1;t.queueCallbacks=[];t.loadScripts(t.queue,function(){t.queueLoading=0;if(cb)cb.call(s||t);each(t.queueCallbacks,function(o){o.func.call(o.scope);});});}else if(cb)t.queueCallbacks.push({func:cb,scope:s||t});},eval:function(co){var w=window;if(!w.execScript){try{eval.call(w,co);}catch(ex){eval(co,w);}}else w.execScript(co);},loadScripts:function(sc,cb,s){var t=this,lo=t.lookup;function done(o){o.state=2;if(o.func)o.func.call(o.scope||t);};function allDone(){var l;l=sc.length;each(sc,function(o){o=lo[o.url];if(o.state===2){done(o);l--;}else load(o);});if(l===0&&cb){cb.call(s||t);cb=0;}};function load(o){if(o.state>0)return;o.state=1;tinymce.util.XHR.send({url:o.url,error:t.settings.error,success:function(co){t.eval(co);done(o);allDone();}});};each(sc,function(o){var u=o.url;if(!lo[u]){lo[u]=o;t.queue.push(o);}else o=lo[u];if(o.state>0)return;if(!tinymce.dom.Event.domLoaded&&!t.settings.strict_mode){var ix,ol='';if(cb||o.func){o.state=1;ix=tinymce.dom.ScriptLoader._addOnLoad(function(){done(o);allDone();});if(tinymce.isIE)ol=' onreadystatechange="';else ol=' onload="';ol+='tinymce.dom.ScriptLoader._onLoad(this,\''+u+'\','+ix+');"';}document.write('<script type="text/javascript" src="'+tinymce._addVer(u)+'"'+ol+'></script>');if(!o.func)done(o);}else load(o);});allDone();},'static':{_addOnLoad:function(f){var t=this;t._funcs=t._funcs||[];t._funcs.push(f);return t._funcs.length-1;},_onLoad:function(e,u,ix){if(!tinymce.isIE||e.readyState=='complete')this._funcs[ix].call(this);}}});tinymce.ScriptLoader=new tinymce.dom.ScriptLoader();})();(function(){var DOM=tinymce.DOM,is=tinymce.is;tinymce.create('tinymce.ui.Control',{Control:function(id,s){this.id=id;this.settings=s=s||{};this.rendered=false;this.onRender=new tinymce.util.Dispatcher(this);this.classPrefix='';this.scope=s.scope||this;this.disabled=0;this.active=0;},setDisabled:function(s){var e;if(s!=this.disabled){e=DOM.get(this.id);if(e&&this.settings.unavailable_prefix){if(s){this.prevTitle=e.title;e.title=this.settings.unavailable_prefix+": "+e.title;}else e.title=this.prevTitle;}this.setState('Disabled',s);this.setState('Enabled',!s);this.disabled=s;}},isDisabled:function(){return this.disabled;},setActive:function(s){if(s!=this.active){this.setState('Active',s);this.active=s;}},isActive:function(){return this.active;},setState:function(c,s){var n=DOM.get(this.id);c=this.classPrefix+c;if(s)DOM.addClass(n,c);else DOM.removeClass(n,c);},isRendered:function(){return this.rendered;},renderHTML:function(){},renderTo:function(n){DOM.setHTML(n,this.renderHTML());},postRender:function(){var t=this,b;if(is(t.disabled)){b=t.disabled;t.disabled=-1;t.setDisabled(b);}if(is(t.active)){b=t.active;t.active=-1;t.setActive(b);}},remove:function(){DOM.remove(this.id);this.destroy();},destroy:function(){tinymce.dom.Event.clear(this.id);}});})();tinymce.create('tinymce.ui.Container:tinymce.ui.Control',{Container:function(id,s){this.parent(id,s);this.controls=[];this.lookup={};},add:function(c){this.lookup[c.id]=c;this.controls.push(c);return c;},get:function(n){return this.lookup[n];}});tinymce.create('tinymce.ui.Separator:tinymce.ui.Control',{Separator:function(id,s){this.parent(id,s);this.classPrefix='mceSeparator';},renderHTML:function(){return tinymce.DOM.createHTML('span',{'class':this.classPrefix});}});(function(){var is=tinymce.is,DOM=tinymce.DOM,each=tinymce.each,walk=tinymce.walk;tinymce.create('tinymce.ui.MenuItem:tinymce.ui.Control',{MenuItem:function(id,s){this.parent(id,s);this.classPrefix='mceMenuItem';},setSelected:function(s){this.setState('Selected',s);this.selected=s;},isSelected:function(){return this.selected;},postRender:function(){var t=this;t.parent();if(is(t.selected))t.setSelected(t.selected);}});})();(function(){var is=tinymce.is,DOM=tinymce.DOM,each=tinymce.each,walk=tinymce.walk;tinymce.create('tinymce.ui.Menu:tinymce.ui.MenuItem',{Menu:function(id,s){var t=this;t.parent(id,s);t.items={};t.collapsed=false;t.menuCount=0;t.onAddItem=new tinymce.util.Dispatcher(this);},expand:function(d){var t=this;if(d){walk(t,function(o){if(o.expand)o.expand();},'items',t);}t.collapsed=false;},collapse:function(d){var t=this;if(d){walk(t,function(o){if(o.collapse)o.collapse();},'items',t);}t.collapsed=true;},isCollapsed:function(){return this.collapsed;},add:function(o){if(!o.settings)o=new tinymce.ui.MenuItem(o.id||DOM.uniqueId(),o);this.onAddItem.dispatch(this,o);return this.items[o.id]=o;},addSeparator:function(){return this.add({separator:true});},addMenu:function(o){if(!o.collapse)o=this.createMenu(o);this.menuCount++;return this.add(o);},hasMenus:function(){return this.menuCount!==0;},remove:function(o){delete this.items[o.id];},removeAll:function(){var t=this;walk(t,function(o){if(o.removeAll)o.removeAll();else o.remove();o.destroy();},'items',t);t.items={};},createMenu:function(o){var m=new tinymce.ui.Menu(o.id||DOM.uniqueId(),o);m.onAddItem.add(this.onAddItem.dispatch,this.onAddItem);return m;}});})();(function(){var is=tinymce.is,DOM=tinymce.DOM,each=tinymce.each,Event=tinymce.dom.Event,Element=tinymce.dom.Element;tinymce.create('tinymce.ui.DropMenu:tinymce.ui.Menu',{DropMenu:function(id,s){s=s||{};s.container=s.container||DOM.doc.body;s.offset_x=s.offset_x||0;s.offset_y=s.offset_y||0;s.vp_offset_x=s.vp_offset_x||0;s.vp_offset_y=s.vp_offset_y||0;if(is(s.icons)&&!s.icons)s['class']+=' mceNoIcons';this.parent(id,s);this.onShowMenu=new tinymce.util.Dispatcher(this);this.onHideMenu=new tinymce.util.Dispatcher(this);this.classPrefix='mceMenu';this.fixIE=tinymce.isIE&&DOM.win.top!=DOM.win;},createMenu:function(s){var t=this,cs=t.settings,m;s.container=s.container||cs.container;s.parent=t;s.constrain=s.constrain||cs.constrain;s['class']=s['class']||cs['class'];s.vp_offset_x=s.vp_offset_x||cs.vp_offset_x;s.vp_offset_y=s.vp_offset_y||cs.vp_offset_y;m=new tinymce.ui.DropMenu(s.id||DOM.uniqueId(),s);m.onAddItem.add(t.onAddItem.dispatch,t.onAddItem);return m;},update:function(){var t=this,s=t.settings,tb=DOM.get('menu_'+t.id+'_tbl'),co=DOM.get('menu_'+t.id+'_co'),tw,th;tw=s.max_width?Math.min(tb.clientWidth,s.max_width):tb.clientWidth;th=s.max_height?Math.min(tb.clientHeight,s.max_height):tb.clientHeight;if(!DOM.boxModel)t.element.setStyles({width:tw+2,height:th+2});else t.element.setStyles({width:tw,height:th});if(s.max_width)DOM.setStyle(co,'width',tw);if(s.max_height){DOM.setStyle(co,'height',th);if(tb.clientHeight<s.max_height)DOM.setStyle(co,'overflow','hidden');}},showMenu:function(x,y,px){var t=this,s=t.settings,co,vp=DOM.getViewPort(),w,h,mx,my,ot=2,dm,tb,cp=t.classPrefix;t.collapse(1);if(t.isMenuVisible)return;if(!t.rendered){co=DOM.add(t.settings.container,t.renderNode());each(t.items,function(o){o.postRender();});t.element=new Element('menu_'+t.id,{blocker:1,container:s.container});}else co=DOM.get('menu_'+t.id);if(!tinymce.isOpera)DOM.setStyles(co,{left:-0xFFFF,top:-0xFFFF});DOM.show(co);t.update();x+=s.offset_x||0;y+=s.offset_y||0;vp.w-=4;vp.h-=4;if(s.constrain){w=co.clientWidth-ot;h=co.clientHeight-ot;mx=vp.x+vp.w;my=vp.y+vp.h;if((x+s.vp_offset_x+w)>mx)x=px?px-w:Math.max(0,(mx-s.vp_offset_x)-w);if((y+s.vp_offset_y+h)>my)y=Math.max(0,(my-s.vp_offset_y)-h);}DOM.setStyles(co,{left:x,top:y});t.element.update();t.isMenuVisible=1;t.mouseClickFunc=Event.add(co,t.fixIE?'mousedown':'click',function(e){var m;e=e.target;if(e&&(e=DOM.getParent(e,'TR'))&&!DOM.hasClass(e,cp+'ItemSub')){m=t.items[e.id];if(m.isDisabled())return;dm=t;DOM.win.setTimeout(function(){while(dm){if(dm.hideMenu)dm.hideMenu();dm=dm.settings.parent;}},0);if(m.settings.onclick)m.settings.onclick(e);return Event.cancel(e);}});if(t.hasMenus()){t.mouseOverFunc=Event.add(co,'mouseover',function(e){var m,r,mi;e=e.target;if(e&&(e=DOM.getParent(e,'TR'))){m=t.items[e.id];if(t.lastMenu)t.lastMenu.collapse(1);if(m.isDisabled())return;if(e&&DOM.hasClass(e,cp+'ItemSub')){r=DOM.getRect(e);m.showMenu((r.x+r.w-ot),r.y-ot,r.x);t.lastMenu=m;DOM.addClass(DOM.get(m.id).firstChild,cp+'ItemActive');}}});}t.onShowMenu.dispatch(t);if(s.keyboard_focus){Event.add(co,'keydown',t._keyHandler,t);DOM.select('a','menu_'+t.id)[0].focus();}},hideMenu:function(c){var t=this,co=DOM.get('menu_'+t.id),e;if(!t.isMenuVisible)return;Event.remove(co,'mouseover',t.mouseOverFunc);Event.remove(co,t.fixIE?'mousedown':'click',t.mouseClickFunc);Event.remove(co,'keydown',t._keyHandler);DOM.hide(co);t.isMenuVisible=0;if(!c)t.collapse(1);if(t.element)t.element.hide();if(e=DOM.get(t.id))DOM.removeClass(e.firstChild,t.classPrefix+'ItemActive');t.onHideMenu.dispatch(t);},add:function(o){var t=this,co;o=t.parent(o);if(t.isRendered&&(co=DOM.get('menu_'+t.id)))t._add(DOM.select('tbody',co)[0],o);return o;},collapse:function(d){this.parent(d);this.hideMenu(1);},remove:function(o){DOM.remove(o.id);this.destroy();return this.parent(o);},destroy:function(){var t=this,co=DOM.get('menu_'+t.id);Event.remove(co,'mouseover',t.mouseOverFunc);Event.remove(co,'click',t.mouseClickFunc);if(t.element)t.element.remove();DOM.remove(co);},renderNode:function(){var t=this,s=t.settings,n,tb,co,w;w=DOM.create('div',{id:'menu_'+t.id,'class':s['class'],'style':'position:absolute;left:0;top:0;z-index:200000'});co=DOM.add(w,'div',{id:'menu_'+t.id+'_co','class':t.classPrefix+(s['class']?' '+s['class']:'')});t.element=new Element('menu_'+t.id,{blocker:1,container:s.container});if(s.menu_line)DOM.add(co,'span',{'class':t.classPrefix+'Line'});n=DOM.add(co,'table',{id:'menu_'+t.id+'_tbl',border:0,cellPadding:0,cellSpacing:0});tb=DOM.add(n,'tbody');each(t.items,function(o){t._add(tb,o);});t.rendered=true;return w;},_keyHandler:function(e){if(e.keyCode==27)this.hideMenu();},_add:function(tb,o){var n,s=o.settings,a,ro,it,cp=this.classPrefix;if(s.separator){ro=DOM.add(tb,'tr',{id:o.id,'class':cp+'ItemSeparator'});DOM.add(ro,'td',{'class':cp+'ItemSeparator'});if(n=ro.previousSibling)DOM.addClass(n,'mceLast');return;}n=ro=DOM.add(tb,'tr',{id:o.id,'class':cp+'Item '+cp+'ItemEnabled'});n=it=DOM.add(n,'td');n=a=DOM.add(n,'a',{href:'javascript:;',onclick:"return false;",onmousedown:'return false;'});DOM.addClass(it,s['class']);DOM.add(n,'span',{'class':'mceIcon'+(s.icon?' mce_'+s.icon:'')});n=DOM.add(n,s.element||'span',{'class':'mceText',title:o.settings.title},o.settings.title);if(o.settings.style)DOM.setAttrib(n,'style',o.settings.style);if(tb.childNodes.length==1)DOM.addClass(ro,'mceFirst');if((n=ro.previousSibling)&&DOM.hasClass(n,cp+'ItemSeparator'))DOM.addClass(ro,'mceFirst');if(o.collapse)DOM.addClass(ro,cp+'ItemSub');if(n=ro.previousSibling)DOM.removeClass(n,'mceLast');DOM.addClass(ro,'mceLast');}});})();(function(){var DOM=tinymce.DOM;tinymce.create('tinymce.ui.Button:tinymce.ui.Control',{Button:function(id,s){this.parent(id,s);this.classPrefix='mceButton';},renderHTML:function(){var cp=this.classPrefix,s=this.settings,h,l;l=DOM.encode(s.label||'');h='<a id="'+this.id+'" href="javascript:;" class="'+cp+' '+cp+'Enabled '+s['class']+(l?' '+cp+'Labeled':'')+'" onmousedown="return false;" onclick="return false;" title="'+DOM.encode(s.title)+'">';if(s.image)h+='<img class="mceIcon" src="'+s.image+'" />'+l+'</a>';else h+='<span class="mceIcon '+s['class']+'"></span>'+(l?'<span class="'+cp+'Label">'+l+'</span>':'')+'</a>';return h;},postRender:function(){var t=this,s=t.settings;tinymce.dom.Event.add(t.id,'click',function(e){if(!t.isDisabled())return s.onclick.call(s.scope,e);});}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each,Dispatcher=tinymce.util.Dispatcher;tinymce.create('tinymce.ui.ListBox:tinymce.ui.Control',{ListBox:function(id,s){var t=this;t.parent(id,s);t.items=[];t.onChange=new Dispatcher(t);t.onPostRender=new Dispatcher(t);t.onAdd=new Dispatcher(t);t.onRenderMenu=new tinymce.util.Dispatcher(this);t.classPrefix='mceListBox';},select:function(v){var t=this,e,fv;if(v!=t.selectedValue){e=DOM.get(t.id+'_text');t.selectedValue=v;each(t.items,function(o){if(o.value==v){DOM.setHTML(e,DOM.encode(o.title));fv=1;return false;}});if(!fv){DOM.setHTML(e,DOM.encode(t.settings.title));DOM.addClass(e,'mceTitle');e=0;return;}else DOM.removeClass(e,'mceTitle');}e=0;},add:function(n,v,o){var t=this;o=o||{};o=tinymce.extend(o,{title:n,value:v});t.items.push(o);t.onAdd.dispatch(t,o);},getLength:function(){return this.items.length;},renderHTML:function(){var h='',t=this,s=t.settings,cp=t.classPrefix;h='<table id="'+t.id+'" cellpadding="0" cellspacing="0" class="'+cp+' '+cp+'Enabled'+(s['class']?(' '+s['class']):'')+'"><tbody><tr>';h+='<td>'+DOM.createHTML('a',{id:t.id+'_text',href:'javascript:;','class':'mceText',onclick:"return false;",onmousedown:'return false;'},DOM.encode(t.settings.title))+'</td>';h+='<td>'+DOM.createHTML('a',{id:t.id+'_open',tabindex:-1,href:'javascript:;','class':'mceOpen',onclick:"return false;",onmousedown:'return false;'},'<span></span>')+'</td>';h+='</tr></tbody></table>';return h;},showMenu:function(){var t=this,p1,p2,e=DOM.get(this.id),m;if(t.isDisabled()||t.items.length==0)return;if(t.menu&&t.menu.isMenuVisible)return t.hideMenu();if(!t.isMenuRendered){t.renderMenu();t.isMenuRendered=true;}p1=DOM.getPos(this.settings.menu_container);p2=DOM.getPos(e);m=t.menu;m.settings.offset_x=p2.x;m.settings.offset_y=p2.y;m.settings.keyboard_focus=t._focused;if(t.oldID)m.items[t.oldID].setSelected(0);each(t.items,function(o){if(o.value===t.selectedValue){m.items[o.id].setSelected(1);t.oldID=o.id;}});m.showMenu(0,e.clientHeight);Event.add(DOM.doc,'mousedown',t.hideMenu,t);DOM.addClass(t.id,t.classPrefix+'Selected');},hideMenu:function(e){var t=this;if(e&&e.type=="mousedown"&&(e.target.id==t.id+'_text'||e.target.id==t.id+'_open'))return;if(!e||!DOM.getParent(e.target,function(n){return DOM.hasClass(n,'mceMenu');})){DOM.removeClass(t.id,t.classPrefix+'Selected');Event.remove(DOM.doc,'mousedown',t.hideMenu,t);if(t.menu)t.menu.hideMenu();}},renderMenu:function(){var t=this,m;m=t.settings.control_manager.createDropMenu(t.id+'_menu',{menu_line:1,'class':t.classPrefix+'Menu mceNoIcons',max_width:150,max_height:150});m.onHideMenu.add(t.hideMenu,t);m.add({title:t.settings.title,'class':'mceMenuItemTitle'}).setDisabled(1);each(t.items,function(o){o.id=DOM.uniqueId();o.onclick=function(){if(t.settings.onselect(o.value)!==false)t.select(o.value);};m.add(o);});t.onRenderMenu.dispatch(t,m);t.menu=m;},postRender:function(){var t=this,cp=t.classPrefix;Event.add(t.id,'click',t.showMenu,t);Event.add(t.id+'_text','focus',function(){t._focused=1;});Event.add(t.id+'_text','blur',function(){t._focused=0;});if(tinymce.isIE6||!DOM.boxModel){Event.add(t.id,'mouseover',function(){if(!DOM.hasClass(t.id,cp+'Disabled'))DOM.addClass(t.id,cp+'Hover');});Event.add(t.id,'mouseout',function(){if(!DOM.hasClass(t.id,cp+'Disabled'))DOM.removeClass(t.id,cp+'Hover');});}t.onPostRender.dispatch(t,DOM.get(t.id));},destroy:function(){this.parent();Event.clear(this.id+'_text');}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each,Dispatcher=tinymce.util.Dispatcher;tinymce.create('tinymce.ui.NativeListBox:tinymce.ui.ListBox',{NativeListBox:function(id,s){this.parent(id,s);this.classPrefix='mceNativeListBox';},setDisabled:function(s){DOM.get(this.id).disabled=s;},isDisabled:function(){return DOM.get(this.id).disabled;},select:function(v){var e=DOM.get(this.id),ol=e.options;v=''+(v||'');e.selectedIndex=0;each(ol,function(o,i){if(o.value==v){e.selectedIndex=i;return false;}});},add:function(n,v,a){var o,t=this;a=a||{};a.value=v;if(t.isRendered())DOM.add(DOM.get(this.id),'option',a,n);o={title:n,value:v,attribs:a};t.items.push(o);t.onAdd.dispatch(t,o);},getLength:function(){return DOM.get(this.id).options.length-1;},renderHTML:function(){var h,t=this;h=DOM.createHTML('option',{value:''},'-- '+t.settings.title+' --');each(t.items,function(it){h+=DOM.createHTML('option',{value:it.value},it.title);});h=DOM.createHTML('select',{id:t.id,'class':'mceNativeListBox'},h);return h;},postRender:function(){var t=this,ch;t.rendered=true;function onChange(e){var v=e.target.options[e.target.selectedIndex].value;t.onChange.dispatch(t,v);if(t.settings.onselect)t.settings.onselect(v);};Event.add(t.id,'change',onChange);Event.add(t.id,'keydown',function(e){var bf;Event.remove(t.id,'change',ch);bf=Event.add(t.id,'blur',function(){Event.add(t.id,'change',onChange);Event.remove(t.id,'blur',bf);});if(e.keyCode==13||e.keyCode==32){onChange(e);return Event.cancel(e);}});t.onPostRender.dispatch(t,DOM.get(t.id));}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each;tinymce.create('tinymce.ui.MenuButton:tinymce.ui.Button',{MenuButton:function(id,s){this.parent(id,s);this.onRenderMenu=new tinymce.util.Dispatcher(this);s.menu_container=s.menu_container||DOM.doc.body;},showMenu:function(){var t=this,p1,p2,e=DOM.get(t.id),m;if(t.isDisabled())return;if(!t.isMenuRendered){t.renderMenu();t.isMenuRendered=true;}if(t.isMenuVisible)return t.hideMenu();p1=DOM.getPos(t.settings.menu_container);p2=DOM.getPos(e);m=t.menu;m.settings.offset_x=p2.x;m.settings.offset_y=p2.y;m.settings.vp_offset_x=p2.x;m.settings.vp_offset_y=p2.y;m.settings.keyboard_focus=t._focused;m.showMenu(0,e.clientHeight);Event.add(DOM.doc,'mousedown',t.hideMenu,t);t.setState('Selected',1);t.isMenuVisible=1;},renderMenu:function(){var t=this,m;m=t.settings.control_manager.createDropMenu(t.id+'_menu',{menu_line:1,'class':this.classPrefix+'Menu',icons:t.settings.icons});m.onHideMenu.add(t.hideMenu,t);t.onRenderMenu.dispatch(t,m);t.menu=m;},hideMenu:function(e){var t=this;if(e&&e.type=="mousedown"&&DOM.getParent(e.target,function(e){return e.id===t.id||e.id===t.id+'_open';}))return;if(!e||!DOM.getParent(e.target,function(n){return DOM.hasClass(n,'mceMenu');})){t.setState('Selected',0);Event.remove(DOM.doc,'mousedown',t.hideMenu,t);if(t.menu)t.menu.hideMenu();}t.isMenuVisible=0;},postRender:function(){var t=this,s=t.settings;Event.add(t.id,'click',function(){if(!t.isDisabled()){if(s.onclick)s.onclick(t.value);t.showMenu();}});}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each;tinymce.create('tinymce.ui.SplitButton:tinymce.ui.MenuButton',{SplitButton:function(id,s){this.parent(id,s);this.classPrefix='mceSplitButton';},renderHTML:function(){var h,t=this,s=t.settings,h1;h='<tbody><tr>';if(s.image)h1=DOM.createHTML('img ',{src:s.image,'class':'mceAction '+s['class']});else h1=DOM.createHTML('span',{'class':'mceAction '+s['class']},'');h+='<td>'+DOM.createHTML('a',{id:t.id+'_action',href:'javascript:;','class':'mceAction '+s['class'],onclick:"return false;",onmousedown:'return false;',title:s.title},h1)+'</td>';h1=DOM.createHTML('span',{'class':'mceOpen '+s['class']});h+='<td>'+DOM.createHTML('a',{id:t.id+'_open',href:'javascript:;','class':'mceOpen '+s['class'],onclick:"return false;",onmousedown:'return false;',title:s.title},h1)+'</td>';h+='</tr></tbody>';return DOM.createHTML('table',{id:t.id,'class':'mceSplitButton mceSplitButtonEnabled '+s['class'],cellpadding:'0',cellspacing:'0',onmousedown:'return false;',title:s.title},h);},postRender:function(){var t=this,s=t.settings;if(s.onclick){Event.add(t.id+'_action','click',function(){if(!t.isDisabled())s.onclick(t.value);});}Event.add(t.id+'_open','click',t.showMenu,t);Event.add(t.id+'_open','focus',function(){t._focused=1;});Event.add(t.id+'_open','blur',function(){t._focused=0;});if(tinymce.isIE6||!DOM.boxModel){Event.add(t.id,'mouseover',function(){if(!DOM.hasClass(t.id,'mceSplitButtonDisabled'))DOM.addClass(t.id,'mceSplitButtonHover');});Event.add(t.id,'mouseout',function(){if(!DOM.hasClass(t.id,'mceSplitButtonDisabled'))DOM.removeClass(t.id,'mceSplitButtonHover');});}},destroy:function(){this.parent();Event.clear(this.id+'_action');Event.clear(this.id+'_open');}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,is=tinymce.is,each=tinymce.each;tinymce.create('tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton',{ColorSplitButton:function(id,s){var t=this;t.parent(id,s);t.settings=s=tinymce.extend({colors:'000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF',grid_width:8,default_color:'#888888'},t.settings);t.value=s.default_color;},showMenu:function(){var t=this,r,p,e,p2;if(t.isDisabled())return;if(!t.isMenuRendered){t.renderMenu();t.isMenuRendered=true;}if(t.isMenuVisible)return t.hideMenu();e=DOM.get(t.id);DOM.show(t.id+'_menu');DOM.addClass(e,'mceSplitButtonSelected');p2=DOM.getPos(e);DOM.setStyles(t.id+'_menu',{left:p2.x,top:p2.y+e.clientHeight,zIndex:200000});e=0;Event.add(DOM.doc,'mousedown',t.hideMenu,t);if(t._focused){t._keyHandler=Event.add(t.id+'_menu','keydown',function(e){if(e.keyCode==27)t.hideMenu();});DOM.select('a',t.id+'_menu')[0].focus();}t.isMenuVisible=1;},hideMenu:function(e){var t=this;if(e&&e.type=="mousedown"&&DOM.getParent(e.target,function(e){return e.id===t.id+'_open';}))return;if(!e||!DOM.getParent(e.target,function(n){return DOM.hasClass(n,'mceSplitButtonMenu');})){DOM.removeClass(t.id,'mceSplitButtonSelected');Event.remove(DOM.doc,'mousedown',t.hideMenu,t);Event.remove(t.id+'_menu','keydown',t._keyHandler);DOM.hide(t.id+'_menu');}t.isMenuVisible=0;},renderMenu:function(){var t=this,m,i=0,s=t.settings,n,tb,tr,w;w=DOM.add(s.menu_container,'div',{id:t.id+'_menu','class':s['menu_class']+' '+s['class'],style:'position:absolute;left:0;top:-1000px;'});m=DOM.add(w,'div',{'class':s['class']+' mceSplitButtonMenu'});DOM.add(m,'span',{'class':'mceMenuLine'});n=DOM.add(m,'table',{'class':'mceColorSplitMenu'});tb=DOM.add(n,'tbody');i=0;each(is(s.colors,'array')?s.colors:s.colors.split(','),function(c){c=c.replace(/^#/,'');if(!i--){tr=DOM.add(tb,'tr');i=s.grid_width-1;}n=DOM.add(tr,'td');n=DOM.add(n,'a',{href:'javascript:;',style:{backgroundColor:'#'+c},mce_color:'#'+c});});if(s.more_colors_func){n=DOM.add(tb,'tr');n=DOM.add(n,'td',{colspan:s.grid_width,'class':'mceMoreColors'});n=DOM.add(n,'a',{id:t.id+'_more',href:'javascript:;',onclick:'return false;','class':'mceMoreColors'},s.more_colors_title);Event.add(n,'click',function(e){s.more_colors_func.call(s.more_colors_scope||this);return Event.cancel(e);});}DOM.addClass(m,'mceColorSplitMenu');Event.add(t.id+'_menu','click',function(e){var c;e=e.target;if(e.nodeName=='A'&&(c=e.getAttribute('mce_color')))t.setColor(c);});return w;},setColor:function(c){var t=this;DOM.setStyle(t.id+'_preview','backgroundColor',c);t.value=c;t.hideMenu();t.settings.onselect(c);},postRender:function(){var t=this,id=t.id;t.parent();DOM.add(id+'_action','div',{id:id+'_preview','class':'mceColorPreview'});},destroy:function(){this.parent();Event.clear(this.id+'_menu');Event.clear(this.id+'_more');DOM.remove(this.id+'_menu');}});})();tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container',{renderHTML:function(){var t=this,h='',c,co,dom=tinymce.DOM,s=t.settings,i,pr,nx,cl;cl=t.controls;for(i=0;i<cl.length;i++){co=cl[i];pr=cl[i-1];nx=cl[i+1];if(i===0){c='mceToolbarStart';if(co.Button)c+=' mceToolbarStartButton';else if(co.SplitButton)c+=' mceToolbarStartSplitButton';else if(co.ListBox)c+=' mceToolbarStartListBox';h+=dom.createHTML('td',{'class':c},dom.createHTML('span',null,'<!-- IE -->'));}if(pr&&co.ListBox){if(pr.Button||pr.SplitButton)h+=dom.createHTML('td',{'class':'mceToolbarEnd'},dom.createHTML('span',null,'<!-- IE -->'));}if(dom.stdMode)h+='<td style="position: relative">'+co.renderHTML()+'</td>';else h+='<td>'+co.renderHTML()+'</td>';if(nx&&co.ListBox){if(nx.Button||nx.SplitButton)h+=dom.createHTML('td',{'class':'mceToolbarStart'},dom.createHTML('span',null,'<!-- IE -->'));}}c='mceToolbarEnd';if(co.Button)c+=' mceToolbarEndButton';else if(co.SplitButton)c+=' mceToolbarEndSplitButton';else if(co.ListBox)c+=' mceToolbarEndListBox';h+=dom.createHTML('td',{'class':c},dom.createHTML('span',null,'<!-- IE -->'));return dom.createHTML('table',{id:t.id,'class':'mceToolbar'+(s['class']?' '+s['class']:''),cellpadding:'0',cellspacing:'0',align:t.settings.align||''},'<tbody><tr>'+h+'</tr></tbody>');}});(function(){var Dispatcher=tinymce.util.Dispatcher,each=tinymce.each;tinymce.create('tinymce.AddOnManager',{items:[],urls:{},lookup:{},onAdd:new Dispatcher(this),get:function(n){return this.lookup[n];},requireLangPack:function(n){var u,s;if(tinymce.EditorManager.settings){u=this.urls[n]+'/langs/'+tinymce.EditorManager.settings.language+'.js';s=tinymce.EditorManager.settings;if(s){if(!tinymce.dom.Event.domLoaded&&!s.strict_mode)tinymce.ScriptLoader.load(u);else tinymce.ScriptLoader.add(u);}}},add:function(id,o){this.items.push(o);this.lookup[id]=o;this.onAdd.dispatch(this,id,o);return o;},load:function(n,u,cb,s){var t=this;if(t.urls[n])return;if(u.indexOf('/')!=0&&u.indexOf('://')==-1)u=tinymce.baseURL+'/'+u;t.urls[n]=u.substring(0,u.lastIndexOf('/'));tinymce.ScriptLoader.add(u,cb,s);}});tinymce.PluginManager=new tinymce.AddOnManager();tinymce.ThemeManager=new tinymce.AddOnManager();}());(function(){var each=tinymce.each,extend=tinymce.extend,DOM=tinymce.DOM,Event=tinymce.dom.Event,ThemeManager=tinymce.ThemeManager,PluginManager=tinymce.PluginManager,explode=tinymce.explode;tinymce.create('static tinymce.EditorManager',{editors:{},i18n:{},activeEditor:null,preInit:function(){var t=this,lo=window.location;tinymce.documentBaseURL=lo.href.replace(/[\?#].*$/,'').replace(/[\/\\][^\/]+$/,'');if(!/[\/\\]$/.test(tinymce.documentBaseURL))tinymce.documentBaseURL+='/';tinymce.baseURL=new tinymce.util.URI(tinymce.documentBaseURL).toAbsolute(tinymce.baseURL);tinymce.EditorManager.baseURI=new tinymce.util.URI(tinymce.baseURL);if(tinymce.EditorManager.baseURI.host!=lo.hostname&&lo.hostname)document.domain=tinymce.relaxedDomain=lo.hostname.replace(/.*\.(.+\..+)$/,'$1');t.onBeforeUnload=new tinymce.util.Dispatcher(t);Event.add(window,'beforeunload',function(e){t.onBeforeUnload.dispatch(t,e);});},init:function(s){var t=this,pl,sl=tinymce.ScriptLoader,c,e;function execCallback(se,n,s){var f=se[n];if(!f)return;if(tinymce.is(f,'string')){s=f.replace(/\.\w+$/,'');s=s?tinymce.resolve(s):0;f=tinymce.resolve(f);}return f.apply(s||this,Array.prototype.slice.call(arguments,2));};s=extend({theme:"simple",language:"en",strict_loading_mode:document.contentType=='application/xhtml+xml'},s);t.settings=s;if(!Event.domLoaded&&!s.strict_loading_mode){if(s.language)sl.add(tinymce.baseURL+'/langs/'+s.language+'.js');if(s.theme&&s.theme.charAt(0)!='-'&&!ThemeManager.urls[s.theme])ThemeManager.load(s.theme,'themes/'+s.theme+'/editor_template'+tinymce.suffix+'.js');if(s.plugins){pl=explode(s.plugins);if(tinymce.inArray(pl,'compat2x')!=-1)PluginManager.load('compat2x','plugins/compat2x/editor_plugin'+tinymce.suffix+'.js');each(pl,function(v){if(v&&v.charAt(0)!='-'&&!PluginManager.urls[v]){if(!tinymce.isWebKit&&v=='safari')return;PluginManager.load(v,'plugins/'+v+'/editor_plugin'+tinymce.suffix+'.js');}});}sl.loadQueue();}Event.add(document,'init',function(){var l,co;execCallback(s,'onpageload');if(s.browsers){l=false;each(explode(s.browsers),function(v){switch(v){case'ie':case'msie':if(tinymce.isIE)l=true;break;case'gecko':if(tinymce.isGecko)l=true;break;case'safari':case'webkit':if(tinymce.isWebKit)l=true;break;case'opera':if(tinymce.isOpera)l=true;break;}});if(!l)return;}switch(s.mode){case"exact":l=s.elements||'';if(l.length>0){each(explode(l),function(v){if(DOM.get(v))new tinymce.Editor(v,s).render(1);else{c=0;each(document.forms,function(f){each(f.elements,function(e){if(e.name===v){v='mce_editor_'+c;DOM.setAttrib(e,'id',v);new tinymce.Editor(v,s).render(1);}});});}});}break;case"textareas":case"specific_textareas":function hasClass(n,c){return new RegExp('\\b'+c+'\\b','g').test(n.className);};each(DOM.select('textarea'),function(v){if(s.editor_deselector&&hasClass(v,s.editor_deselector))return;if(!s.editor_selector||hasClass(v,s.editor_selector)){e=DOM.get(v.name);if(!v.id&&!e)v.id=v.name;if(!v.id||t.get(v.id))v.id=DOM.uniqueId();new tinymce.Editor(v.id,s).render(1);}});break;}if(s.oninit){l=co=0;each(t.editors,function(ed){co++;if(!ed.initialized){ed.onInit.add(function(){l++;if(l==co)execCallback(s,'oninit');});}else l++;if(l==co)execCallback(s,'oninit');});}});},get:function(id){return this.editors[id];},getInstanceById:function(id){return this.get(id);},add:function(e){this.editors[e.id]=e;this._setActive(e);return e;},remove:function(e){var t=this;if(!t.editors[e.id])return null;delete t.editors[e.id];if(t.activeEditor==e){each(t.editors,function(e){t._setActive(e);return false;});}e.destroy();return e;},execCommand:function(c,u,v){var t=this,ed=t.get(v),w;switch(c){case"mceFocus":ed.focus();return true;case"mceAddEditor":case"mceAddControl":if(!t.get(v))new tinymce.Editor(v,t.settings).render();return true;case"mceAddFrameControl":w=v.window;w.tinyMCE=tinyMCE;w.tinymce=tinymce;tinymce.DOM.doc=w.document;tinymce.DOM.win=w;ed=new tinymce.Editor(v.element_id,v);ed.render();if(tinymce.isIE){function clr(){ed.destroy();w.detachEvent('onunload',clr);w=w.tinyMCE=w.tinymce=null;};w.attachEvent('onunload',clr);}v.page_window=null;return true;case"mceRemoveEditor":case"mceRemoveControl":ed.remove();return true;case'mceToggleEditor':if(!ed){t.execCommand('mceAddControl',0,v);return true;}if(ed.isHidden())ed.show();else ed.hide();return true;}if(t.activeEditor)return t.activeEditor.execCommand(c,u,v);return false;},execInstanceCommand:function(id,c,u,v){var ed=this.get(id);if(ed)return ed.execCommand(c,u,v);return false;},triggerSave:function(){each(this.editors,function(e){e.save();});},addI18n:function(p,o){var lo,i18n=this.i18n;if(!tinymce.is(p,'string')){each(p,function(o,lc){each(o,function(o,g){each(o,function(o,k){if(g==='common')i18n[lc+'.'+k]=o;else i18n[lc+'.'+g+'.'+k]=o;});});});}else{each(o,function(o,k){i18n[p+'.'+k]=o;});}},_setActive:function(e){this.selectedInstance=this.activeEditor=e;}});tinymce.EditorManager.preInit();})();var tinyMCE=window.tinyMCE=tinymce.EditorManager;(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,extend=tinymce.extend,Dispatcher=tinymce.util.Dispatcher;var each=tinymce.each,isGecko=tinymce.isGecko,isIE=tinymce.isIE,isWebKit=tinymce.isWebKit;var is=tinymce.is,ThemeManager=tinymce.ThemeManager,PluginManager=tinymce.PluginManager,EditorManager=tinymce.EditorManager;var inArray=tinymce.inArray,grep=tinymce.grep,explode=tinymce.explode;tinymce.create('tinymce.Editor',{Editor:function(id,s){var t=this;t.id=t.editorId=id;t.execCommands={};t.queryStateCommands={};t.queryValueCommands={};t.plugins={};each(['onPreInit','onBeforeRenderUI','onPostRender','onInit','onRemove','onActivate','onDeactivate','onClick','onEvent','onMouseUp','onMouseDown','onDblClick','onKeyDown','onKeyUp','onKeyPress','onContextMenu','onSubmit','onReset','onPaste','onPreProcess','onPostProcess','onBeforeSetContent','onBeforeGetContent','onSetContent','onGetContent','onLoadContent','onSaveContent','onNodeChange','onChange','onBeforeExecCommand','onExecCommand','onUndo','onRedo','onVisualAid','onSetProgressState'],function(e){t[e]=new Dispatcher(t);});t.settings=s=extend({id:id,language:'en',docs_language:'en',theme:'simple',skin:'default',delta_width:0,delta_height:0,popup_css:'',plugins:'',document_base_url:tinymce.documentBaseURL,add_form_submit_trigger:1,submit_patch:1,add_unload_trigger:1,convert_urls:1,relative_urls:1,remove_script_host:1,table_inline_editing:0,object_resizing:1,cleanup:1,accessibility_focus:1,custom_shortcuts:1,custom_undo_redo_keyboard_shortcuts:1,custom_undo_redo_restore_selection:1,custom_undo_redo:1,doctype:'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',visual_table_class:'mceItemTable',visual:1,inline_styles:true,convert_fonts_to_spans:true,font_size_style_values:'xx-small,x-small,small,medium,large,x-large,xx-large',apply_source_formatting:1,directionality:'ltr',forced_root_block:'p',valid_elements:'@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur],strong/b,em/i,strike,u,#p[align],-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|src|border|alt=|title|hspace|vspace|width|height|align],-sub,-sup,-blockquote,-table[border=0|cellspacing|cellpadding|width|frame|rules|height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,-span,-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],object[classid|width|height|codebase|*],param[name|value|_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],kbd,label[for],legend,noscript,optgroup[label|disabled],option[disabled|label|selected|value],q[cite],samp,select[disabled|multiple|name|size],small,textarea[cols|rows|disabled|name|readonly],tt,var,big',hidden_input:1,padd_empty_editor:1,render_ui:1,init_theme:1,force_p_newlines:1,indentation:'30px'},s);t.documentBaseURI=new tinymce.util.URI(s.document_base_url||tinymce.documentBaseURL,{base_uri:tinyMCE.baseURI});t.baseURI=EditorManager.baseURI;t.execCallback('setup',t);},render:function(nst){var t=this,s=t.settings,id=t.id,sl=tinymce.ScriptLoader;if(!Event.domLoaded){Event.add(document,'init',function(){t.render();});return;}if(!nst){s.strict_loading_mode=1;tinyMCE.settings=s;}if(!t.getElement())return;if(s.strict_loading_mode){sl.settings.strict_mode=s.strict_loading_mode;tinymce.DOM.settings.strict=1;}if(!/TEXTAREA|INPUT/i.test(t.getElement().nodeName)&&s.hidden_input&&DOM.getParent(id,'form'))DOM.insertAfter(DOM.create('input',{type:'hidden',name:id}),id);t.windowManager=new tinymce.WindowManager(t);if(s.encoding=='xml'){t.onGetContent.add(function(ed,o){if(o.get)o.content=DOM.encode(o.content);});}if(s.add_form_submit_trigger){t.onSubmit.addToTop(function(){if(t.initialized){t.save();t.isNotDirty=1;}});}if(s.add_unload_trigger){t._beforeUnload=tinyMCE.onBeforeUnload.add(function(){if(t.initialized&&!t.destroyed&&!t.isHidden())t.save({format:'raw',no_events:true});});}tinymce.addUnload(t.destroy,t);if(s.submit_patch){t.onBeforeRenderUI.add(function(){var n=t.getElement().form;if(!n)return;if(n._mceOldSubmit)return;if(!n.submit.nodeType&&!n.submit.length){t.formElement=n;n._mceOldSubmit=n.submit;n.submit=function(){EditorManager.triggerSave();t.isNotDirty=1;return this._mceOldSubmit(this);};}n=null;});}function loadScripts(){if(s.language)sl.add(tinymce.baseURL+'/langs/'+s.language+'.js');if(s.theme.charAt(0)!='-'&&!ThemeManager.urls[s.theme])ThemeManager.load(s.theme,'themes/'+s.theme+'/editor_template'+tinymce.suffix+'.js');each(explode(s.plugins),function(p){if(p&&p.charAt(0)!='-'&&!PluginManager.urls[p]){if(!isWebKit&&p=='safari')return;PluginManager.load(p,'plugins/'+p+'/editor_plugin'+tinymce.suffix+'.js');}});sl.loadQueue(function(){if(s.ask){function ask(){t.windowManager.confirm(t.getLang('edit_confirm'),function(s){if(s)t.init();else Event.remove(t.id,'focus',ask);});};Event.add(t.id,'focus',ask);return;}if(!t.removed)t.init();});};if(s.plugins.indexOf('compat2x')!=-1){PluginManager.load('compat2x','plugins/compat2x/editor_plugin'+tinymce.suffix+'.js');sl.loadQueue(loadScripts);}else loadScripts();},init:function(){var n,t=this,s=t.settings,w,h,e=t.getElement(),o,ti,u,bi,bc,re;EditorManager.add(t);s.theme=s.theme.replace(/-/,'');o=ThemeManager.get(s.theme);t.theme=new o();if(t.theme.init&&s.init_theme)t.theme.init(t,ThemeManager.urls[s.theme]||tinymce.documentBaseURL.replace(/\/$/,''));each(explode(s.plugins.replace(/\-/g,'')),function(p){var c=PluginManager.get(p),u=PluginManager.urls[p]||tinymce.documentBaseURL.replace(/\/$/,''),po;if(c){po=new c(t,u);t.plugins[p]=po;if(po.init)po.init(t,u);}});if(s.popup_css)s.popup_css=t.documentBaseURI.toAbsolute(s.popup_css);else s.popup_css=t.baseURI.toAbsolute("themes/"+s.theme+"/skins/"+s.skin+"/dialog.css");if(s.popup_css_add)s.popup_css+=','+t.documentBaseURI.toAbsolute(s.popup_css_add);t.controlManager=new tinymce.ControlManager(t);t.undoManager=new tinymce.UndoManager(t);t.undoManager.onAdd.add(function(um,l){return t.onChange.dispatch(t,l,um);});t.undoManager.onUndo.add(function(um,l){return t.onUndo.dispatch(t,l,um);});t.undoManager.onRedo.add(function(um,l){return t.onRedo.dispatch(t,l,um);});if(s.custom_undo_redo){t.onExecCommand.add(function(ed,cmd,ui,val,a){if(cmd!='Undo'&&cmd!='Redo'&&cmd!='mceRepaint'&&(!a||!a.skip_undo))t.undoManager.add();});}t.onExecCommand.add(function(ed,c){if(!/^(FontName|FontSize)$/.test(c))t.nodeChanged();});if(isGecko){function repaint(a,o){if(!o||!o.initial)t.execCommand('mceRepaint');};t.onUndo.add(repaint);t.onRedo.add(repaint);t.onSetContent.add(repaint);}t.onBeforeRenderUI.dispatch(t,t.controlManager);if(s.render_ui){w=s.width||e.style.width||e.clientWidth;h=s.height||e.style.height||e.clientHeight;t.orgDisplay=e.style.display;re=/^[0-9\.]+(|px)$/i;if(re.test(''+w))w=Math.max(parseInt(w)+(o.deltaWidth||0),100);if(re.test(''+h))h=Math.max(parseInt(h)+(o.deltaHeight||0),100);o=t.theme.renderUI({targetNode:e,width:w,height:h,deltaWidth:s.delta_width,deltaHeight:s.delta_height});t.editorContainer=o.editorContainer;}DOM.setStyles(o.sizeContainer||o.editorContainer,{width:w,height:h});h=(o.iframeHeight||h)+((h+'').indexOf('%')==-1?(o.deltaHeight||0):'');if(h<100)h=100;t.iframeHTML=s.doctype+'<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="'+t.documentBaseURI.getURI()+'"></base>';t.iframeHTML+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';if(tinymce.relaxedDomain)t.iframeHTML+='<script type="text/javascript">document.domain = "'+tinymce.relaxedDomain+'";</script>';bi=s.body_id||'tinymce';if(bi.indexOf('=')!=-1){bi=t.getParam('body_id','','hash');bi=bi[t.id]||bi;}bc=s.body_class||'';if(bc.indexOf('=')!=-1){bc=t.getParam('body_class','','hash');bc=bc[t.id]||'';}t.iframeHTML+='</head><body id="'+bi+'" class="mceContentBody '+bc+'"></body></html>';if(tinymce.relaxedDomain){if(isIE)u='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+t.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()';else if(tinymce.isOpera)u='javascript:(function(){document.open();document.domain="'+document.domain+'";document.close();ed.setupIframe();})()';}n=DOM.add(o.iframeContainer,'iframe',{id:t.id+"_ifr",src:u||'javascript:""',frameBorder:'0',style:{width:'100%',height:h}});t.contentAreaContainer=o.iframeContainer;DOM.get(o.editorContainer).style.display=t.orgDisplay;DOM.get(t.id).style.display='none';if(tinymce.isOldWebKit){Event.add(n,'load',t.setupIframe,t);n.src=tinymce.baseURL+'/plugins/safari/blank.htm';}else{if(!isIE||!tinymce.relaxedDomain)t.setupIframe();e=n=o=null;}},setupIframe:function(){var t=this,s=t.settings,e=DOM.get(t.id),d=t.getDoc(),h,b;if(!isIE||!tinymce.relaxedDomain){d.open();d.write(t.iframeHTML);d.close();}if(!isIE){try{d.designMode='On';}catch(ex){}}if(isIE){b=t.getBody();DOM.hide(b);b.contentEditable=true;DOM.show(b);}t.dom=new tinymce.DOM.DOMUtils(t.getDoc(),{keep_values:true,url_converter:t.convertURL,url_converter_scope:t,hex_colors:s.force_hex_style_colors,class_filter:s.class_filter,update_styles:1,fix_ie_paragraphs:1});t.serializer=new tinymce.dom.Serializer({entity_encoding:s.entity_encoding,entities:s.entities,valid_elements:s.verify_html===false?'*[*]':s.valid_elements,extended_valid_elements:s.extended_valid_elements,valid_child_elements:s.valid_child_elements,invalid_elements:s.invalid_elements,fix_table_elements:s.fix_table_elements,fix_list_elements:s.fix_list_elements,fix_content_duplication:s.fix_content_duplication,convert_fonts_to_spans:s.convert_fonts_to_spans,font_size_classes:s.font_size_classes,font_size_style_values:s.font_size_style_values,apply_source_formatting:s.apply_source_formatting,remove_linebreaks:s.remove_linebreaks,dom:t.dom});t.selection=new tinymce.dom.Selection(t.dom,t.getWin(),t.serializer);t.forceBlocks=new tinymce.ForceBlocks(t,{forced_root_block:s.forced_root_block});t.editorCommands=new tinymce.EditorCommands(t);t.serializer.onPreProcess.add(function(se,o){return t.onPreProcess.dispatch(t,o,se);});t.serializer.onPostProcess.add(function(se,o){return t.onPostProcess.dispatch(t,o,se);});t.onPreInit.dispatch(t);if(!s.gecko_spellcheck)t.getBody().spellcheck=0;t._addEvents();t.controlManager.onPostRender.dispatch(t,t.controlManager);t.onPostRender.dispatch(t);if(s.directionality)t.getBody().dir=s.directionality;if(s.nowrap)t.getBody().style.whiteSpace="nowrap";if(s.auto_resize)t.onNodeChange.add(t.resizeToContent,t);if(s.custom_elements){function handleCustom(ed,o){each(explode(s.custom_elements),function(v){var n;if(v.indexOf('~')===0){v=v.substring(1);n='span';}else n='div';o.content=o.content.replace(new RegExp('<('+v+')([^>]*)>','g'),'<'+n+' mce_name="$1"$2>');o.content=o.content.replace(new RegExp('</('+v+')>','g'),'</'+n+'>');});};t.onBeforeSetContent.add(handleCustom);t.onPostProcess.add(function(ed,o){if(o.set)handleCustom(ed,o)});}if(s.handle_node_change_callback){t.onNodeChange.add(function(ed,cm,n){t.execCallback('handle_node_change_callback',t.id,n,-1,-1,true,t.selection.isCollapsed());});}if(s.save_callback){t.onSaveContent.add(function(ed,o){var h=t.execCallback('save_callback',t.id,o.content,t.getBody());if(h)o.content=h;});}if(s.onchange_callback){t.onChange.add(function(ed,l){t.execCallback('onchange_callback',t,l);});}if(s.convert_newlines_to_brs){t.onBeforeSetContent.add(function(ed,o){if(o.initial)o.content=o.content.replace(/\r?\n/g,'<br />');});}if(s.fix_nesting&&isIE){t.onBeforeSetContent.add(function(ed,o){o.content=t._fixNesting(o.content);});}if(s.preformatted){t.onPostProcess.add(function(ed,o){o.content=o.content.replace(/^\s*<pre.*?>/,'');o.content=o.content.replace(/<\/pre>\s*$/,'');if(o.set)o.content='<pre class="mceItemHidden">'+o.content+'</pre>';});}if(s.verify_css_classes){t.serializer.attribValueFilter=function(n,v){var s,cl;if(n=='class'){if(!t.classesRE){cl=t.dom.getClasses();if(cl.length>0){s='';each(cl,function(o){s+=(s?'|':'')+o['class'];});t.classesRE=new RegExp('('+s+')','gi');}}return!t.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(v)||t.classesRE.test(v)?v:'';}return v;};}if(s.convert_fonts_to_spans)t._convertFonts();if(s.inline_styles)t._convertInlineElements();if(s.cleanup_callback){t.onBeforeSetContent.add(function(ed,o){o.content=t.execCallback('cleanup_callback','insert_to_editor',o.content,o);});t.onPreProcess.add(function(ed,o){if(o.set)t.execCallback('cleanup_callback','insert_to_editor_dom',o.node,o);if(o.get)t.execCallback('cleanup_callback','get_from_editor_dom',o.node,o);});t.onPostProcess.add(function(ed,o){if(o.set)o.content=t.execCallback('cleanup_callback','insert_to_editor',o.content,o);if(o.get)o.content=t.execCallback('cleanup_callback','get_from_editor',o.content,o);});}if(s.save_callback){t.onGetContent.add(function(ed,o){if(o.save)o.content=t.execCallback('save_callback',t.id,o.content,t.getBody());});}if(s.handle_event_callback){t.onEvent.add(function(ed,e,o){if(t.execCallback('handle_event_callback',e,ed,o)===false)Event.cancel(e);});}t.onSetContent.add(function(){t.addVisual(t.getBody());});if(s.padd_empty_editor){t.onPostProcess.add(function(ed,o){o.content=o.content.replace(/^(<p>(&nbsp;|&#160;|\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/,'');});}if(isGecko){try{d.designMode='Off';d.designMode='On';}catch(ex){}}setTimeout(function(){if(t.removed)return;t.load({initial:true,format:(s.cleanup_on_startup?'html':'raw')});t.startContent=t.getContent({format:'raw'});t.undoManager.add({initial:true});t.initialized=true;t.onInit.dispatch(t);t.execCallback('setupcontent_callback',t.id,t.getBody(),t.getDoc());t.execCallback('init_instance_callback',t);t.focus(true);t.nodeChanged({initial:1});if(s.content_css){tinymce.each(explode(s.content_css),function(u){t.dom.loadCSS(t.documentBaseURI.toAbsolute(u));});}if(s.auto_focus){setTimeout(function(){var ed=EditorManager.get(s.auto_focus);ed.selection.select(ed.getBody(),1);ed.selection.collapse(1);ed.getWin().focus();},100);}},1);e=null;},focus:function(sf){var oed,t=this;if(!sf){t.getWin().focus();}if(EditorManager.activeEditor!=t){if((oed=EditorManager.activeEditor)!=null)oed.onDeactivate.dispatch(oed,t);t.onActivate.dispatch(t,oed);}EditorManager._setActive(t);},execCallback:function(n){var t=this,f=t.settings[n],s;if(!f)return;if(t.callbackLookup&&(s=t.callbackLookup[n])){f=s.func;s=s.scope;}if(is(f,'string')){s=f.replace(/\.\w+$/,'');s=s?tinymce.resolve(s):0;f=tinymce.resolve(f);t.callbackLookup=t.callbackLookup||{};t.callbackLookup[n]={func:f,scope:s};}return f.apply(s||t,Array.prototype.slice.call(arguments,1));},translate:function(s){var c=this.settings.language,i18n=EditorManager.i18n;if(!s)return'';return i18n[c+'.'+s]||s.replace(/{\#([^}]+)\}/g,function(a,b){return i18n[c+'.'+b]||'{#'+b+'}';});},getLang:function(n,dv){return EditorManager.i18n[this.settings.language+'.'+n]||(is(dv)?dv:'{#'+n+'}');},getParam:function(n,dv,ty){var tr=tinymce.trim,v=is(this.settings[n])?this.settings[n]:dv,o;if(ty==='hash'){o={};if(is(v,'string')){each(v.indexOf('=')>0?v.split(/[;,](?![^=;,]*(?:[;,]|$))/):v.split(','),function(v){v=v.split('=');if(v.length>1)o[tr(v[0])]=tr(v[1]);else o[tr(v[0])]=tr(v);});}else o=v;return o;}return v;},nodeChanged:function(o){var t=this,s=t.selection,n=s.getNode()||t.getBody();if(t.initialized){t.onNodeChange.dispatch(t,o?o.controlManager||t.controlManager:t.controlManager,isIE&&n.ownerDocument!=t.getDoc()?t.getBody():n,s.isCollapsed(),o);}},addButton:function(n,s){var t=this;t.buttons=t.buttons||{};t.buttons[n]=s;},addCommand:function(n,f,s){this.execCommands[n]={func:f,scope:s||this};},addQueryStateHandler:function(n,f,s){this.queryStateCommands[n]={func:f,scope:s||this};},addQueryValueHandler:function(n,f,s){this.queryValueCommands[n]={func:f,scope:s||this};},addShortcut:function(pa,desc,cmd_func,sc){var t=this,c;if(!t.settings.custom_shortcuts)return false;t.shortcuts=t.shortcuts||{};if(is(cmd_func,'string')){c=cmd_func;cmd_func=function(){t.execCommand(c,false,null);};}if(is(cmd_func,'object')){c=cmd_func;cmd_func=function(){t.execCommand(c[0],c[1],c[2]);};}each(explode(pa),function(pa){var o={func:cmd_func,scope:sc||this,desc:desc,alt:false,ctrl:false,shift:false};each(explode(pa,'+'),function(v){switch(v){case'alt':case'ctrl':case'shift':o[v]=true;break;default:o.charCode=v.charCodeAt(0);o.keyCode=v.toUpperCase().charCodeAt(0);}});t.shortcuts[(o.ctrl?'ctrl':'')+','+(o.alt?'alt':'')+','+(o.shift?'shift':'')+','+o.keyCode]=o;});return true;},execCommand:function(cmd,ui,val,a){var t=this,s=0,o,st;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(cmd)&&(!a||!a.skip_focus))t.focus();o={};t.onBeforeExecCommand.dispatch(t,cmd,ui,val,o);if(o.terminate)return false;if(t.execCallback('execcommand_callback',t.id,t.selection.getNode(),cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}if(o=t.execCommands[cmd]){st=o.func.call(o.scope,ui,val);if(st!==true){t.onExecCommand.dispatch(t,cmd,ui,val,a);return st;}}each(t.plugins,function(p){if(p.execCommand&&p.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);s=1;return false;}});if(s)return true;if(t.theme.execCommand&&t.theme.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}if(t.editorCommands.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}t.getDoc().execCommand(cmd,ui,val);t.onExecCommand.dispatch(t,cmd,ui,val,a);},queryCommandState:function(c){var t=this,o,s;if(t._isHidden())return;if(o=t.queryStateCommands[c]){s=o.func.call(o.scope);if(s!==true)return s;}o=t.editorCommands.queryCommandState(c);if(o!==-1)return o;try{return this.getDoc().queryCommandState(c);}catch(ex){}},queryCommandValue:function(c){var t=this,o,s;if(t._isHidden())return;if(o=t.queryValueCommands[c]){s=o.func.call(o.scope);if(s!==true)return s;}o=t.editorCommands.queryCommandValue(c);if(is(o))return o;try{return this.getDoc().queryCommandValue(c);}catch(ex){}},show:function(){var t=this;DOM.show(t.getContainer());DOM.hide(t.id);t.load();},hide:function(){var t=this,d=t.getDoc();if(isIE&&d)d.execCommand('SelectAll');t.save();DOM.hide(t.getContainer());DOM.setStyle(t.id,'display',t.orgDisplay);},isHidden:function(){return!DOM.isHidden(this.id);},setProgressState:function(b,ti,o){this.onSetProgressState.dispatch(this,b,ti,o);return b;},resizeToContent:function(){var t=this;DOM.setStyle(t.id+"_ifr",'height',t.getBody().scrollHeight);},load:function(o){var t=this,e=t.getElement(),h;o=o||{};o.load=true;h=t.setContent(is(e.value)?e.value:e.innerHTML,o);o.element=e;if(!o.no_events)t.onLoadContent.dispatch(t,o);o.element=e=null;return h;},save:function(o){var t=this,e=t.getElement(),h,f;if(!t.initialized)return;o=o||{};o.save=true;o.element=e;h=o.content=t.getContent(o);if(!o.no_events)t.onSaveContent.dispatch(t,o);h=o.content;if(!/TEXTAREA|INPUT/i.test(e.nodeName)){e.innerHTML=h;if(f=DOM.getParent(t.id,'form')){each(f.elements,function(e){if(e.name==t.id){e.value=h;return false;}});}}else e.value=h;o.element=e=null;return h;},setContent:function(h,o){var t=this;o=o||{};o.format=o.format||'html';o.set=true;o.content=h;if(!o.no_events)t.onBeforeSetContent.dispatch(t,o);if(!tinymce.isIE&&(h.length===0||/^\s+$/.test(h))){o.content=t.dom.setHTML(t.getBody(),'<br mce_bogus="1" />',1);o.format='raw';}o.content=t.dom.setHTML(t.getBody(),tinymce.trim(o.content));if(o.format!='raw'&&t.settings.cleanup){o.getInner=true;o.content=t.dom.setHTML(t.getBody(),t.serializer.serialize(t.getBody(),o));}if(!o.no_events)t.onSetContent.dispatch(t,o);return o.content;},getContent:function(o){var t=this,h;o=o||{};o.format=o.format||'html';o.get=true;if(!o.no_events)t.onBeforeGetContent.dispatch(t,o);if(o.format!='raw'&&t.settings.cleanup){o.getInner=true;h=t.serializer.serialize(t.getBody(),o);}else h=t.getBody().innerHTML;h=h.replace(/^\s*|\s*$/g,'');o={content:h};t.onGetContent.dispatch(t,o);return o.content;},isDirty:function(){var t=this;return tinymce.trim(t.startContent)!=tinymce.trim(t.getContent({format:'raw',no_events:1}))&&!t.isNotDirty;},getContainer:function(){var t=this;if(!t.container)t.container=DOM.get(t.editorContainer||t.id+'_parent');return t.container;},getContentAreaContainer:function(){return this.contentAreaContainer;},getElement:function(){return DOM.get(this.settings.content_element||this.id);},getWin:function(){var t=this,e;if(!t.contentWindow){e=DOM.get(t.id+"_ifr");if(e)t.contentWindow=e.contentWindow;}return t.contentWindow;},getDoc:function(){var t=this,w;if(!t.contentDocument){w=t.getWin();if(w)t.contentDocument=w.document;}return t.contentDocument;},getBody:function(){return this.bodyElement||this.getDoc().body;},convertURL:function(u,n,e){var t=this,s=t.settings;if(s.urlconverter_callback)return t.execCallback('urlconverter_callback',u,e,true,n);if(!s.convert_urls||(e&&e.nodeName=='LINK')||u.indexOf('file:')===0)return u;if(s.relative_urls)return t.documentBaseURI.toRelative(u);u=t.documentBaseURI.toAbsolute(u,s.remove_script_host);return u;},addVisual:function(e){var t=this,s=t.settings;e=e||t.getBody();if(!is(t.hasVisual))t.hasVisual=s.visual;each(t.dom.select('table,a',e),function(e){var v;switch(e.nodeName){case'TABLE':v=t.dom.getAttrib(e,'border');if(!v||v=='0'){if(t.hasVisual)t.dom.addClass(e,s.visual_table_class);else t.dom.removeClass(e,s.visual_table_class);}return;case'A':v=t.dom.getAttrib(e,'name');if(v){if(t.hasVisual)t.dom.addClass(e,'mceItemAnchor');else t.dom.removeClass(e,'mceItemAnchor');}return;}});t.onVisualAid.dispatch(t,e,t.hasVisual);},remove:function(){var t=this,e=t.getContainer();t.removed=1;t.hide();t.execCallback('remove_instance_callback',t);t.onRemove.dispatch(t);t.onExecCommand.listeners=[];EditorManager.remove(t);DOM.remove(e);},destroy:function(s){var t=this;if(t.destroyed)return;if(!s){tinymce.removeUnload(t.destroy);tinyMCE.onBeforeUnload.remove(t._beforeUnload);if(t.theme.destroy)t.theme.destroy();t.controlManager.destroy();t.selection.destroy();t.dom.destroy();if(!t.settings.content_editable){Event.clear(t.getWin());Event.clear(t.getDoc());}Event.clear(t.getBody());Event.clear(t.formElement);}if(t.formElement){t.formElement.submit=t.formElement._mceOldSubmit;t.formElement._mceOldSubmit=null;}t.contentAreaContainer=t.formElement=t.container=t.settings.content_element=t.bodyElement=t.contentDocument=t.contentWindow=null;if(t.selection)t.selection=t.selection.win=t.selection.dom=t.selection.dom.doc=null;t.destroyed=1;},_addEvents:function(){var t=this,i,s=t.settings,lo={mouseup:'onMouseUp',mousedown:'onMouseDown',click:'onClick',keyup:'onKeyUp',keydown:'onKeyDown',keypress:'onKeyPress',submit:'onSubmit',reset:'onReset',contextmenu:'onContextMenu',dblclick:'onDblClick',paste:'onPaste'};function eventHandler(e,o){var ty=e.type;if(t.removed)return;if(t.onEvent.dispatch(t,e,o)!==false){t[lo[e.fakeType||e.type]].dispatch(t,e,o);}};each(lo,function(v,k){switch(k){case'contextmenu':if(tinymce.isOpera){Event.add(t.getDoc(),'mousedown',function(e){if(e.ctrlKey){e.fakeType='contextmenu';eventHandler(e);}});}else Event.add(t.getDoc(),k,eventHandler);break;case'paste':Event.add(t.getBody(),k,function(e){var tx,h,el,r;if(e.clipboardData)tx=e.clipboardData.getData('text/plain');else if(tinymce.isIE)tx=t.getWin().clipboardData.getData('Text');eventHandler(e,{text:tx,html:h});});break;case'submit':case'reset':Event.add(t.getElement().form||DOM.getParent(t.id,'form'),k,eventHandler);break;default:Event.add(s.content_editable?t.getBody():t.getDoc(),k,eventHandler);}});Event.add(s.content_editable?t.getBody():(isGecko?t.getDoc():t.getWin()),'focus',function(e){t.focus(true);});if(tinymce.isGecko){Event.add(t.getDoc(),'DOMNodeInserted',function(e){var v;e=e.target;if(e.nodeType===1&&e.nodeName==='IMG'&&(v=e.getAttribute('mce_src')))e.src=t.documentBaseURI.toAbsolute(v);});}if(isGecko){function setOpts(){var t=this,d=t.getDoc(),s=t.settings;if(isGecko){if(t._isHidden()){try{if(!s.content_editable)d.designMode='On';}catch(ex){}}try{d.execCommand("styleWithCSS",0,false);}catch(ex){if(!t._isHidden())d.execCommand("useCSS",0,true);}if(!s.table_inline_editing)try{d.execCommand('enableInlineTableEditing',false,false);}catch(ex){}if(!s.object_resizing)try{d.execCommand('enableObjectResizing',false,false);}catch(ex){}}};t.onBeforeExecCommand.add(setOpts);t.onMouseDown.add(setOpts);}t.onMouseUp.add(t.nodeChanged);t.onClick.add(t.nodeChanged);t.onKeyUp.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45||e.keyCode==46||e.keyCode==8||e.ctrlKey)t.nodeChanged();});t.onReset.add(function(){t.setContent(t.startContent,{format:'raw'});});if(t.getParam('tab_focus')){function tabCancel(ed,e){if(e.keyCode===9)return Event.cancel(e);};function tabHandler(ed,e){var x,i,f,el,v;function find(d){f=DOM.getParent(ed.id,'form');el=f.elements;if(f){each(el,function(e,i){if(e.id==ed.id){x=i;return false;}});if(d>0){for(i=x+1;i<el.length;i++){if(el[i].type!='hidden')return el[i];}}else{for(i=x-1;i>=0;i--){if(el[i].type!='hidden')return el[i];}}}return null;};if(e.keyCode===9){v=explode(ed.getParam('tab_focus'));if(v.length==1){v[1]=v[0];v[0]=':prev';}if(e.shiftKey){if(v[0]==':prev')el=find(-1);else el=DOM.get(v[0]);}else{if(v[1]==':next')el=find(1);else el=DOM.get(v[1]);}if(el){if(ed=EditorManager.get(el.id||el.name))ed.focus();else window.setTimeout(function(){window.focus();el.focus();},10);return Event.cancel(e);}}};t.onKeyUp.add(tabCancel);if(isGecko){t.onKeyPress.add(tabHandler);t.onKeyDown.add(tabCancel);}else t.onKeyDown.add(tabHandler);}if(s.custom_shortcuts){if(s.custom_undo_redo_keyboard_shortcuts){t.addShortcut('ctrl+z',t.getLang('undo_desc'),'Undo');t.addShortcut('ctrl+y',t.getLang('redo_desc'),'Redo');}if(isGecko){t.addShortcut('ctrl+b',t.getLang('bold_desc'),'Bold');t.addShortcut('ctrl+i',t.getLang('italic_desc'),'Italic');t.addShortcut('ctrl+u',t.getLang('underline_desc'),'Underline');}for(i=1;i<=6;i++)t.addShortcut('ctrl+'+i,'',['FormatBlock',false,'<h'+i+'>']);t.addShortcut('ctrl+7','',['FormatBlock',false,'<p>']);t.addShortcut('ctrl+8','',['FormatBlock',false,'<div>']);t.addShortcut('ctrl+9','',['FormatBlock',false,'<address>']);function find(e){var v=null;if(!e.altKey&&!e.ctrlKey&&!e.metaKey)return v;each(t.shortcuts,function(o){if(o.ctrl!=e.ctrlKey&&(!tinymce.isMac||o.ctrl==e.metaKey))return;if(o.alt!=e.altKey)return;if(o.shift!=e.shiftKey)return;if(e.keyCode==o.keyCode||(e.charCode&&e.charCode==o.charCode)){v=o;return false;}});return v;};t.onKeyUp.add(function(ed,e){var o=find(e);if(o)return Event.cancel(e);});t.onKeyPress.add(function(ed,e){var o=find(e);if(o)return Event.cancel(e);});t.onKeyDown.add(function(ed,e){var o=find(e);if(o){o.func.call(o.scope);return Event.cancel(e);}});}if(tinymce.isIE){Event.add(t.getDoc(),'controlselect',function(e){var re=t.resizeInfo,cb;e=e.target;if(e.nodeName!=='IMG')return;if(re)Event.remove(re.node,re.ev,re.cb);if(!t.dom.hasClass(e,'mceItemNoResize')){ev='resizeend';cb=Event.add(e,ev,function(e){var v;e=e.target;if(v=t.dom.getStyle(e,'width')){t.dom.setAttrib(e,'width',v.replace(/[^0-9%]+/g,''));t.dom.setStyle(e,'width','');}if(v=t.dom.getStyle(e,'height')){t.dom.setAttrib(e,'height',v.replace(/[^0-9%]+/g,''));t.dom.setStyle(e,'height','');}});}else{ev='resizestart';cb=Event.add(e,'resizestart',Event.cancel,Event);}re=t.resizeInfo={node:e,ev:ev,cb:cb};});t.onKeyDown.add(function(ed,e){switch(e.keyCode){case 8:if(t.selection.getRng().item){t.selection.getRng().item(0).removeNode();return Event.cancel(e);}}});}if(tinymce.isOpera){t.onClick.add(function(ed,e){Event.prevent(e);});}if(s.custom_undo_redo){function addUndo(){t.undoManager.typing=0;t.undoManager.add();};if(tinymce.isIE){Event.add(t.getWin(),'blur',function(e){var n;if(t.selection){n=t.selection.getNode();if(!t.removed&&n.ownerDocument&&n.ownerDocument!=t.getDoc())addUndo();}});}else{Event.add(t.getDoc(),'blur',function(){if(t.selection&&!t.removed)addUndo();});}t.onMouseDown.add(addUndo);t.onKeyUp.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45||e.ctrlKey){t.undoManager.typing=0;t.undoManager.add();}});t.onKeyDown.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45){if(t.undoManager.typing){t.undoManager.add();t.undoManager.typing=0;}return;}if(!t.undoManager.typing){t.undoManager.add();t.undoManager.typing=1;}});}},_convertInlineElements:function(){var t=this,s=t.settings,dom=t.dom,v,e,na,st,sp;function convert(ed,o){if(!s.inline_styles)return;if(o.get){each(t.dom.select('table,u,strike',o.node),function(n){switch(n.nodeName){case'TABLE':if(v=dom.getAttrib(n,'height')){dom.setStyle(n,'height',v);dom.setAttrib(n,'height','');}break;case'U':case'STRIKE':n.style.textDecoration=n.nodeName=='U'?'underline':'line-through';dom.setAttrib(n,'mce_style','');dom.setAttrib(n,'mce_name','span');break;}});}else if(o.set){each(t.dom.select('table,span',o.node).reverse(),function(n){if(n.nodeName=='TABLE'){if(v=dom.getStyle(n,'height'))dom.setAttrib(n,'height',v.replace(/[^0-9%]+/g,''));}else{if(n.style.textDecoration=='underline')na='u';else if(n.style.textDecoration=='line-through')na='strike';else na='';if(na){n.style.textDecoration='';dom.setAttrib(n,'mce_style','');e=dom.create(na,{style:dom.getAttrib(n,'style')});dom.replace(e,n,1);}}});}};t.onPreProcess.add(convert);if(!s.cleanup_on_startup){t.onSetContent.add(function(ed,o){if(o.initial)convert(t,{node:t.getBody(),set:1});});}},_convertFonts:function(){var t=this,s=t.settings,dom=t.dom,fz,fzn,sl,cl;if(!s.inline_styles)return;fz=[8,10,12,14,18,24,36];fzn=['xx-small','x-small','small','medium','large','x-large','xx-large'];if(sl=s.font_size_style_values)sl=explode(sl);if(cl=s.font_size_classes)cl=explode(cl);function convertToFonts(no){var n,f,nl,x,i,v,st;if(tinymce.isWebKit||!s.inline_styles)return;nl=t.dom.select('span',no);for(x=nl.length-1;x>=0;x--){n=nl[x];f=dom.create('font',{color:dom.toHex(dom.getStyle(n,'color')),face:dom.getStyle(n,'fontFamily'),style:dom.getAttrib(n,'style'),'class':dom.getAttrib(n,'class')});st=f.style;if(st.color||st.fontFamily){st.color=st.fontFamily='';dom.setAttrib(f,'mce_style','');}if(sl){i=inArray(sl,dom.getStyle(n,'fontSize'));if(i!=-1){dom.setAttrib(f,'size',''+(i+1||1));f.style.fontSize='';}}else if(cl){i=inArray(cl,dom.getAttrib(n,'class'));v=dom.getStyle(n,'fontSize');if(i==-1&&v.indexOf('pt')>0)i=inArray(fz,parseInt(v));if(i==-1)i=inArray(fzn,v);if(i!=-1){dom.setAttrib(f,'size',''+(i+1||1));f.style.fontSize='';}}if(f.color||f.face||f.size){f.style.fontFamily='';dom.setAttrib(f,'mce_style','');dom.replace(f,n,1);}f=n=null;}};t.onSetContent.add(function(ed,o){convertToFonts(ed.getBody());});t.onPreProcess.add(function(ed,o){var n,sp,nl,x;if(!s.inline_styles)return;if(o.get){nl=t.dom.select('font',o.node);for(x=nl.length-1;x>=0;x--){n=nl[x];sp=dom.create('span',{style:dom.getAttrib(n,'style'),'class':dom.getAttrib(n,'class')});dom.setStyles(sp,{fontFamily:dom.getAttrib(n,'face'),color:dom.getAttrib(n,'color'),backgroundColor:n.style.backgroundColor});if(n.size){if(sl)dom.setStyle(sp,'fontSize',sl[parseInt(n.size)-1]);else dom.setAttrib(sp,'class',cl[parseInt(n.size)-1]);}dom.setAttrib(sp,'mce_style','');dom.replace(sp,n,1);}}});},_isHidden:function(){var s;if(!isGecko)return 0;s=this.selection.getSel();return(!s||!s.rangeCount||s.rangeCount==0);},_fixNesting:function(s){var d=[],i;s=s.replace(/<(\/)?([^\s>]+)[^>]*?>/g,function(a,b,c){var e;if(b==='/'){if(!d.length)return'';if(c!==d[d.length-1].tag){for(i=d.length-1;i>=0;i--){if(d[i].tag===c){d[i].close=1;break;}}return'';}else{d.pop();if(d.length&&d[d.length-1].close){a=a+'</'+d[d.length-1].tag+'>';d.pop();}}}else{if(/^(br|hr|input|meta|img|link|param)$/i.test(c))return a;if(/\/>$/.test(a))return a;d.push({tag:c});}return a;});for(i=d.length-1;i>=0;i--)s+='</'+d[i].tag+'>';return s;}});})();(function(){var each=tinymce.each,isIE=tinymce.isIE,isGecko=tinymce.isGecko,isOpera=tinymce.isOpera,isWebKit=tinymce.isWebKit;tinymce.create('tinymce.EditorCommands',{EditorCommands:function(ed){this.editor=ed;},execCommand:function(cmd,ui,val){var t=this,ed=t.editor,f;switch(cmd){case'Cut':case'Copy':case'Paste':try{ed.getDoc().execCommand(cmd,ui,val);}catch(ex){if(isGecko){ed.windowManager.confirm(ed.getLang('clipboard_msg'),function(s){if(s)window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html','mceExternal');});}else ed.windowManager.alert(ed.getLang('clipboard_no_support'));}return true;case'mceResetDesignMode':case'mceBeginUndoLevel':return true;case'unlink':t.UnLink();return true;case'JustifyLeft':case'JustifyCenter':case'JustifyRight':case'JustifyFull':t.mceJustify(cmd,cmd.substring(7).toLowerCase());return true;case'mceEndUndoLevel':case'mceAddUndoLevel':ed.undoManager.add();return true;default:f=this[cmd];if(f){f.call(this,ui,val);return true;}}return false;},Indent:function(){var ed=this.editor,d=ed.dom,s=ed.selection,e,iv,iu;iv=ed.settings.indentation;iu=/[a-z%]+$/i.exec(iv);iv=parseInt(iv);if(ed.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){each(this._getSelectedBlocks(),function(e){d.setStyle(e,'paddingLeft',(parseInt(e.style.paddingLeft||0)+iv)+iu);});return;}ed.getDoc().execCommand('Indent',false,null);if(isIE){d.getParent(s.getNode(),function(n){if(n.nodeName=='BLOCKQUOTE'){n.dir=n.style.cssText='';}});}},Outdent:function(){var ed=this.editor,d=ed.dom,s=ed.selection,e,v,iv,iu;iv=ed.settings.indentation;iu=/[a-z%]+$/i.exec(iv);iv=parseInt(iv);if(ed.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){each(this._getSelectedBlocks(),function(e){v=Math.max(0,parseInt(e.style.paddingLeft||0)-iv);d.setStyle(e,'paddingLeft',v?v+iu:'');});return;}ed.getDoc().execCommand('Outdent',false,null);},mceSetAttribute:function(u,v){var ed=this.editor,d=ed.dom,e;if(e=d.getParent(ed.selection.getNode(),d.isBlock))d.setAttrib(e,v.name,v.value);},mceSetContent:function(u,v){this.editor.setContent(v);},mceToggleVisualAid:function(){var ed=this.editor;ed.hasVisual=!ed.hasVisual;ed.addVisual();},mceReplaceContent:function(u,v){var s=this.editor.selection;s.setContent(v.replace(/\{\$selection\}/g,s.getContent({format:'text'})));},mceInsertLink:function(u,v){var ed=this.editor,s=ed.selection,e=ed.dom.getParent(s.getNode(),'A');if(tinymce.is(v,'string'))v={href:v};function set(e){each(v,function(v,k){ed.dom.setAttrib(e,k,v);});};if(!e){ed.execCommand('CreateLink',false,'javascript:mctmp(0);');each(ed.dom.select('a'),function(e){if(e.href=='javascript:mctmp(0);')set(e);});}else{if(v.href)set(e);else ed.dom.remove(e,1);}},UnLink:function(){var ed=this.editor,s=ed.selection;if(s.isCollapsed())s.select(s.getNode());ed.getDoc().execCommand('unlink',false,null);s.collapse(0);},FontName:function(u,v){var t=this,ed=t.editor,s=ed.selection,e;if(!v){if(s.isCollapsed())s.select(s.getNode());t.RemoveFormat();}else ed.getDoc().execCommand('FontName',false,v);},queryCommandValue:function(c){var f=this['queryValue'+c];if(f)return f.call(this,c);return false;},queryCommandState:function(cmd){var f;switch(cmd){case'JustifyLeft':case'JustifyCenter':case'JustifyRight':case'JustifyFull':return this.queryStateJustify(cmd,cmd.substring(7).toLowerCase());default:if(f=this['queryState'+cmd])return f.call(this,cmd);}return-1;},_queryState:function(c){try{return this.editor.getDoc().queryCommandState(c);}catch(ex){}},_queryVal:function(c){try{return this.editor.getDoc().queryCommandValue(c);}catch(ex){}},queryValueFontSize:function(){var ed=this.editor,v=0,p;if(isOpera||isWebKit){if(p=ed.dom.getParent(ed.selection.getNode(),'FONT'))v=p.size;return v;}return this._queryVal('FontSize');},queryValueFontName:function(){var ed=this.editor,v=0,p;if(p=ed.dom.getParent(ed.selection.getNode(),'FONT'))v=p.face;if(!v)v=this._queryVal('FontName');return v;},mceJustify:function(c,v){var ed=this.editor,se=ed.selection,n=se.getNode(),nn=n.nodeName,bl,nb,dom=ed.dom,rm;if(ed.settings.inline_styles&&this.queryStateJustify(c,v))rm=1;bl=dom.getParent(n,ed.dom.isBlock);if(nn=='IMG'){if(v=='full')return;if(rm){if(v=='center')dom.setStyle(n.parentNode,'textAlign','');dom.setStyle(n,'float','');this.mceRepaint();return;}if(v=='center'){if(/^(TD|TH)$/.test(bl.nodeName))bl=0;if(!bl||bl.childNodes.length>1){nb=dom.create('p');nb.appendChild(n.cloneNode(false));if(bl)dom.insertAfter(nb,bl);else dom.insertAfter(nb,n);dom.remove(n);n=nb.firstChild;bl=nb;}dom.setStyle(bl,'textAlign',v);dom.setStyle(n,'float','');}else{dom.setStyle(n,'float',v);dom.setStyle(n.parentNode,'textAlign','');}this.mceRepaint();return;}if(ed.settings.inline_styles&&ed.settings.forced_root_block){if(rm)v='';each(this._getSelectedBlocks(dom.getParent(se.getStart(),dom.isBlock),dom.getParent(se.getEnd(),dom.isBlock)),function(e){dom.setAttrib(e,'align','');dom.setStyle(e,'textAlign',v=='full'?'justify':v);});return;}else if(!rm)ed.getDoc().execCommand(c,false,null);if(ed.settings.inline_styles){if(rm){dom.getParent(ed.selection.getNode(),function(n){if(n.style&&n.style.textAlign)dom.setStyle(n,'textAlign','');});return;}each(dom.select('*'),function(n){var v=n.align;if(v){if(v=='full')v='justify';dom.setStyle(n,'textAlign',v);dom.setAttrib(n,'align','');}});}},mceSetCSSClass:function(u,v){this.mceSetStyleInfo(0,{command:'setattrib',name:'class',value:v});},getSelectedElement:function(){var t=this,ed=t.editor,dom=ed.dom,se=ed.selection,r=se.getRng(),r1,r2,sc,ec,so,eo,e,sp,ep,re;if(se.isCollapsed()||r.item)return se.getNode();re=ed.settings.merge_styles_invalid_parents;if(tinymce.is(re,'string'))re=new RegExp(re,'i');if(isIE){r1=r.duplicate();r1.collapse(true);sc=r1.parentElement();r2=r.duplicate();r2.collapse(false);ec=r2.parentElement();if(sc!=ec){r1.move('character',1);sc=r1.parentElement();}if(sc==ec){r1=r.duplicate();r1.moveToElementText(sc);if(r1.compareEndPoints('StartToStart',r)==0&&r1.compareEndPoints('EndToEnd',r)==0)return re&&re.test(sc.nodeName)?null:sc;}}else{function getParent(n){return dom.getParent(n,function(n){return n.nodeType==1;});};sc=r.startContainer;ec=r.endContainer;so=r.startOffset;eo=r.endOffset;if(!r.collapsed){if(sc==ec){if(so-eo<2){if(sc.hasChildNodes()){sp=sc.childNodes[so];return re&&re.test(sp.nodeName)?null:sp;}}}}if(sc.nodeType!=3||ec.nodeType!=3)return null;if(so==0){sp=getParent(sc);if(sp&&sp.firstChild!=sc)sp=null;}if(so==sc.nodeValue.length){e=sc.nextSibling;if(e&&e.nodeType==1)sp=sc.nextSibling;}if(eo==0){e=ec.previousSibling;if(e&&e.nodeType==1)ep=e;}if(eo==ec.nodeValue.length){ep=getParent(ec);if(ep&&ep.lastChild!=ec)ep=null;}if(sp==ep)return re&&sp&&re.test(sp.nodeName)?null:sp;}return null;},InsertHorizontalRule:function(){if(isGecko||isIE)this.editor.selection.setContent('<hr />');else this.editor.getDoc().execCommand('InsertHorizontalRule',false,'');},RemoveFormat:function(){var t=this,ed=t.editor,s=ed.selection,b;if(isWebKit)s.setContent(s.getContent({format:'raw'}).replace(/(<(span|b|i|strong|em|strike) [^>]+>|<(span|b|i|strong|em|strike)>|<\/(span|b|i|strong|em|strike)>|)/g,''),{format:'raw'});else ed.getDoc().execCommand('RemoveFormat',false,null);t.mceSetStyleInfo(0,{command:'removeformat'});ed.addVisual();},mceSetStyleInfo:function(u,v){var t=this,ed=t.editor,d=ed.getDoc(),dom=ed.dom,e,b,s=ed.selection,nn=v.wrapper||'span',b=s.getBookmark(),re;function set(n,e){if(n.nodeType==1){switch(v.command){case'setattrib':return dom.setAttrib(n,v.name,v.value);case'setstyle':return dom.setStyle(n,v.name,v.value);case'removeformat':return dom.setAttrib(n,'class','');}}};re=ed.settings.merge_styles_invalid_parents;if(tinymce.is(re,'string'))re=new RegExp(re,'i');if(e=t.getSelectedElement())set(e,1);else{d.execCommand('FontName',false,'__');each(isWebKit?dom.select('span'):dom.select('font'),function(n){var sp,e;if(dom.getAttrib(n,'face')=='__'||n.style.fontFamily==='__'){sp=dom.create(nn,{mce_new:'1'});set(sp);each(n.childNodes,function(n){sp.appendChild(n.cloneNode(true));});dom.replace(sp,n);}});}each(dom.select(nn).reverse(),function(n){var p=n.parentNode;if(!dom.getAttrib(n,'mce_new')){p=dom.getParent(n,function(n){return n.nodeType==1&&dom.getAttrib(n,'mce_new');});if(p)dom.remove(n,1);}});each(dom.select(nn).reverse(),function(n){var p=n.parentNode;if(!p||!dom.getAttrib(n,'mce_new'))return;if(p.nodeName==nn.toUpperCase()&&p.childNodes.length==1)return dom.remove(p,1);if(n.nodeType==1&&(!re||!re.test(p.nodeName))&&p.childNodes.length==1){set(p);dom.setAttrib(n,'class','');}});each(dom.select(nn).reverse(),function(n){if(dom.getAttrib(n,'mce_new')||(dom.getAttribs(n).length<=1&&n.className==='')){if(!dom.getAttrib(n,'class')&&!dom.getAttrib(n,'style'))return dom.remove(n,1);dom.setAttrib(n,'mce_new','');}});s.moveToBookmark(b);},queryStateJustify:function(c,v){var ed=this.editor,n=ed.selection.getNode(),dom=ed.dom;if(n&&n.nodeName=='IMG'){if(dom.getStyle(n,'float')==v)return 1;return n.parentNode.style.textAlign==v;}n=dom.getParent(ed.selection.getStart(),function(n){return n.nodeType==1&&n.style.textAlign;});if(v=='full')v='justify';if(ed.settings.inline_styles)return(n&&n.style.textAlign==v);return this._queryState(c);},HiliteColor:function(ui,val){var t=this,ed=t.editor,d=ed.getDoc();function set(s){if(!isGecko)return;try{d.execCommand("styleWithCSS",0,s);}catch(ex){d.execCommand("useCSS",0,!s);}};if(isGecko||isOpera){set(true);d.execCommand('hilitecolor',false,val);set(false);}else d.execCommand('BackColor',false,val);},Undo:function(){var ed=this.editor;if(ed.settings.custom_undo_redo){ed.undoManager.undo();ed.nodeChanged();}else ed.getDoc().execCommand('Undo',false,null);},Redo:function(){var ed=this.editor;if(ed.settings.custom_undo_redo){ed.undoManager.redo();ed.nodeChanged();}else ed.getDoc().execCommand('Redo',false,null);},FormatBlock:function(ui,val){var t=this,ed=t.editor;val=ed.settings.forced_root_block?(val||'<p>'):val;if(/^(P|DIV|H[1-6]|ADDRESS|BLOCKQUOTE|PRE)$/.test(ed.selection.getNode().nodeName))t.mceRemoveNode();if(val.indexOf('<')==-1)val='<'+val+'>';if(tinymce.isGecko)val=val.replace(/<(div|blockquote|code|dt|dd|dl|samp)>/gi,'$1');ed.getDoc().execCommand('FormatBlock',false,val);},mceCleanup:function(){var ed=this.editor,s=ed.selection,b=s.getBookmark();ed.setContent(ed.getContent());s.moveToBookmark(b);},mceRemoveNode:function(ui,val){var ed=this.editor,s=ed.selection,b,n=val||s.getNode();if(n==ed.getBody())return;b=s.getBookmark();ed.dom.remove(n,1);s.moveToBookmark(b);ed.nodeChanged();},mceSelectNodeDepth:function(ui,val){var ed=this.editor,s=ed.selection,c=0;ed.dom.getParent(s.getNode(),function(n){if(n.nodeType==1&&c++==val){s.select(n);ed.nodeChanged();return false;}},ed.getBody());},mceSelectNode:function(u,v){this.editor.selection.select(v);},mceInsertContent:function(ui,val){this.editor.selection.setContent(val);},mceInsertRawHTML:function(ui,val){var ed=this.editor;ed.selection.setContent('tiny_mce_marker');ed.setContent(ed.getContent().replace(/tiny_mce_marker/g,val));},mceRepaint:function(){var s,b,e=this.editor;if(tinymce.isGecko){try{s=e.selection;b=s.getBookmark(true);if(s.getSel())s.getSel().selectAllChildren(e.getBody());s.collapse(true);s.moveToBookmark(b);}catch(ex){}}},queryStateUnderline:function(){var ed=this.editor,n=ed.selection.getNode();if(n&&n.nodeName=='A')return false;return this._queryState('Underline');},queryStateOutdent:function(){var ed=this.editor,n;if(ed.settings.inline_styles){if((n=ed.dom.getParent(ed.selection.getStart(),ed.dom.isBlock))&&parseInt(n.style.paddingLeft)>0)return true;if((n=ed.dom.getParent(ed.selection.getEnd(),ed.dom.isBlock))&&parseInt(n.style.paddingLeft)>0)return true;}else return!!ed.dom.getParent(ed.selection.getNode(),'BLOCKQUOTE');return this.queryStateInsertUnorderedList()||this.queryStateInsertOrderedList();},queryStateInsertUnorderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),'UL');},queryStateInsertOrderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),'OL');},queryStatemceBlockQuote:function(){return!!this.editor.dom.getParent(this.editor.selection.getStart(),function(n){return n.nodeName==='BLOCKQUOTE';});},mceBlockQuote:function(){var t=this,ed=t.editor,s=ed.selection,dom=ed.dom,sb,eb,n,bm,bq,r,bq2,i,nl;function getBQ(e){return dom.getParent(e,function(n){return n.nodeName==='BLOCKQUOTE';});};sb=dom.getParent(s.getStart(),dom.isBlock);eb=dom.getParent(s.getEnd(),dom.isBlock);if(bq=getBQ(sb)){if(sb!=eb||sb.childNodes.length>1||(sb.childNodes.length==1&&sb.firstChild.nodeName!='BR'))bm=s.getBookmark();if(getBQ(eb)){bq2=bq.cloneNode(false);while(n=eb.nextSibling)bq2.appendChild(n.parentNode.removeChild(n));}if(bq2)dom.insertAfter(bq2,bq);nl=t._getSelectedBlocks(sb,eb);for(i=nl.length-1;i>=0;i--){dom.insertAfter(nl[i],bq);}if(/^\s*$/.test(bq.innerHTML))dom.remove(bq,1);if(bq2&&/^\s*$/.test(bq2.innerHTML))dom.remove(bq2,1);if(!bm){if(!isIE){r=ed.getDoc().createRange();r.setStart(sb,0);r.setEnd(sb,0);s.setRng(r);}else{s.select(sb);s.collapse(0);if(dom.getParent(s.getStart(),dom.isBlock)!=sb){r=s.getRng();r.move('character',-1);r.select();}}}else t.editor.selection.moveToBookmark(bm);return;}if(isIE&&!sb&&!eb){t.editor.getDoc().execCommand('Indent');n=getBQ(s.getNode());n.style.margin=n.dir='';return;}if(!sb||!eb)return;if(sb!=eb||sb.childNodes.length>1||(sb.childNodes.length==1&&sb.firstChild.nodeName!='BR'))bm=s.getBookmark();each(t._getSelectedBlocks(getBQ(s.getStart()),getBQ(s.getEnd())),function(e){if(e.nodeName=='BLOCKQUOTE'&&!bq){bq=e;return;}if(!bq){bq=dom.create('blockquote');e.parentNode.insertBefore(bq,e);}if(e.nodeName=='BLOCKQUOTE'&&bq){n=e.firstChild;while(n){bq.appendChild(n.cloneNode(true));n=n.nextSibling;}dom.remove(e);return;}bq.appendChild(dom.remove(e));});if(!bm){if(!isIE){r=ed.getDoc().createRange();r.setStart(sb,0);r.setEnd(sb,0);s.setRng(r);}else{s.select(sb);s.collapse(1);}}else s.moveToBookmark(bm);},_getSelectedBlocks:function(st,en){var ed=this.editor,dom=ed.dom,s=ed.selection,sb,eb,n,bl=[];sb=dom.getParent(st||s.getStart(),dom.isBlock);eb=dom.getParent(en||s.getEnd(),dom.isBlock);if(sb)bl.push(sb);if(sb&&eb&&sb!=eb){n=sb;while((n=n.nextSibling)&&n!=eb){if(dom.isBlock(n))bl.push(n);}}if(eb&&sb!=eb)bl.push(eb);return bl;}});})();tinymce.create('tinymce.UndoManager',{index:0,data:null,typing:0,UndoManager:function(ed){var t=this,Dispatcher=tinymce.util.Dispatcher;t.editor=ed;t.data=[];t.onAdd=new Dispatcher(this);t.onUndo=new Dispatcher(this);t.onRedo=new Dispatcher(this);},add:function(l){var t=this,i,ed=t.editor,b,s=ed.settings,la;l=l||{};l.content=l.content||ed.getContent({format:'raw',no_events:1});l.content=l.content.replace(/^\s*|\s*$/g,'');la=t.data[t.index>0?t.index-1:0];if(!l.initial&&la&&l.content==la.content)return null;if(s.custom_undo_redo_levels){if(t.data.length>s.custom_undo_redo_levels){for(i=0;i<t.data.length-1;i++)t.data[i]=t.data[i+1];t.data.length--;t.index=t.data.length;}}if(s.custom_undo_redo_restore_selection&&!l.initial)l.bookmark=b=l.bookmark||ed.selection.getBookmark();if(t.index<t.data.length&&t.data[t.index].initial)t.index++;if(t.data.length===0&&!l.initial)return null;t.data.length=t.index+1;t.data[t.index++]=l;if(l.initial)t.index=0;if(t.data.length==2&&t.data[0].initial)t.data[0].bookmark=b;t.onAdd.dispatch(t,l);ed.isNotDirty=0;return l;},undo:function(){var t=this,ed=t.editor,l=l,i;if(t.typing){t.add();t.typing=0;}if(t.index>0){if(t.index==t.data.length&&t.index>1){i=t.index;t.typing=0;if(!t.add())t.index=i;--t.index;}l=t.data[--t.index];ed.setContent(l.content,{format:'raw'});ed.selection.moveToBookmark(l.bookmark);t.onUndo.dispatch(t,l);}return l;},redo:function(){var t=this,ed=t.editor,l=null;if(t.index<t.data.length-1){l=t.data[++t.index];ed.setContent(l.content,{format:'raw'});ed.selection.moveToBookmark(l.bookmark);t.onRedo.dispatch(t,l);}return l;},clear:function(){var t=this;t.data=[];t.index=0;t.typing=0;t.add({initial:true});},hasUndo:function(){return this.index!=0||this.typing;},hasRedo:function(){return this.index<this.data.length-1;}});(function(){var Event,isIE,isGecko,isOpera,each,extend;Event=tinymce.dom.Event;isIE=tinymce.isIE;isGecko=tinymce.isGecko;isOpera=tinymce.isOpera;each=tinymce.each;extend=tinymce.extend;tinymce.create('tinymce.ForceBlocks',{ForceBlocks:function(ed){var t=this,s=ed.settings,elm;t.editor=ed;t.dom=ed.dom;elm=(s.forced_root_block||'p').toLowerCase();s.element=elm.toUpperCase();ed.onPreInit.add(t.setup,t);t.reOpera=new RegExp('(\\u00a0|&#160;|&nbsp;)<\/'+elm+'>','gi');t.rePadd=new RegExp('<p( )([^>]+)><\\\/p>|<p( )([^>]+)\\\/>|<p( )([^>]+)>\\s+<\\\/p>|<p><\\\/p>|<p\\\/>|<p>\\s+<\\\/p>'.replace(/p/g,elm),'gi');t.reNbsp2BR1=new RegExp('<p( )([^>]+)>[\\s\\u00a0]+<\\\/p>|<p>[\\s\\u00a0]+<\\\/p>'.replace(/p/g,elm),'gi');t.reNbsp2BR2=new RegExp('<p( )([^>]+)>(&nbsp;|&#160;)<\\\/p>|<p>(&nbsp;|&#160;)<\\\/p>'.replace(/p/g,elm),'gi');t.reBR2Nbsp=new RegExp('<p( )([^>]+)>\\s*<br \\\/>\\s*<\\\/p>|<p>\\s*<br \\\/>\\s*<\\\/p>'.replace(/p/g,elm),'gi');t.reTrailBr=new RegExp('\\s*<br \\/>\\s*<\\\/p>'.replace(/p/g,elm),'gi');function padd(ed,o){if(isOpera)o.content=o.content.replace(t.reOpera,'</'+elm+'>');o.content=o.content.replace(t.rePadd,'<'+elm+'$1$2$3$4$5$6>\u00a0</'+elm+'>');if(!isIE&&!isOpera&&o.set){o.content=o.content.replace(t.reNbsp2BR1,'<'+elm+'$1$2><br /></'+elm+'>');o.content=o.content.replace(t.reNbsp2BR2,'<'+elm+'$1$2><br /></'+elm+'>');}else{o.content=o.content.replace(t.reBR2Nbsp,'<'+elm+'$1$2>\u00a0</'+elm+'>');o.content=o.content.replace(t.reTrailBr,'</'+elm+'>');}};ed.onBeforeSetContent.add(padd);ed.onPostProcess.add(padd);if(s.forced_root_block){ed.onInit.add(t.forceRoots,t);ed.onSetContent.add(t.forceRoots,t);ed.onBeforeGetContent.add(t.forceRoots,t);}},setup:function(){var t=this,ed=t.editor,s=ed.settings;if(s.forced_root_block){ed.onKeyUp.add(t.forceRoots,t);ed.onPreProcess.add(t.forceRoots,t);}if(s.force_br_newlines){if(isIE){ed.onKeyPress.add(function(ed,e){var n,s=ed.selection;if(e.keyCode==13&&s.getNode().nodeName!='LI'){s.setContent('<br id="__" /> ',{format:'raw'});n=ed.dom.get('__');n.removeAttribute('id');s.select(n);s.collapse();return Event.cancel(e);}});}return;}if(!isIE&&s.force_p_newlines){ed.onKeyPress.add(function(ed,e){if(e.keyCode==13&&!e.shiftKey){if(!t.insertPara(e))Event.cancel(e);}});if(isGecko){ed.onKeyDown.add(function(ed,e){if((e.keyCode==8||e.keyCode==46)&&!e.shiftKey)t.backspaceDelete(e,e.keyCode==8);});}}function ren(rn,na){var ne=ed.dom.create(na);each(rn.attributes,function(a){if(a.specified&&a.nodeValue)ne.setAttribute(a.nodeName.toLowerCase(),a.nodeValue);});each(rn.childNodes,function(n){ne.appendChild(n.cloneNode(true));});rn.parentNode.replaceChild(ne,rn);return ne;};if(isIE&&s.element!='P'){ed.onKeyPress.add(function(ed,e){t.lastElm=ed.selection.getNode().nodeName;});ed.onKeyUp.add(function(ed,e){var bl,sel=ed.selection,n=sel.getNode(),b=ed.getBody();if(b.childNodes.length===1&&n.nodeName=='P'){n=ren(n,s.element);sel.select(n);sel.collapse();ed.nodeChanged();}else if(e.keyCode==13&&!e.shiftKey&&t.lastElm!='P'){bl=ed.dom.getParent(n,'P');if(bl){ren(bl,s.element);ed.nodeChanged();}}});}},find:function(n,t,s){var ed=this.editor,w=ed.getDoc().createTreeWalker(n,4,null,false),c=-1;while(n=w.nextNode()){c++;if(t==0&&n==s)return c;if(t==1&&c==s)return n;}return-1;},forceRoots:function(ed,e){var t=this,ed=t.editor,b=ed.getBody(),d=ed.getDoc(),se=ed.selection,s=se.getSel(),r=se.getRng(),si=-2,ei,so,eo,tr,c=-0xFFFFFF;var nx,bl,bp,sp,le,nl=b.childNodes,i;if(e&&e.keyCode==13)return true;for(i=nl.length-1;i>=0;i--){nx=nl[i];if(nx.nodeType==3||(!t.dom.isBlock(nx)&&nx.nodeType!=8)){if(!bl){if(nx.nodeType!=3||/[^\s]/g.test(nx.nodeValue)){if(si==-2&&r){if(!isIE){so=r.startOffset;eo=r.endOffset;si=t.find(b,0,r.startContainer);ei=t.find(b,0,r.endContainer);}else{tr=d.body.createTextRange();tr.moveToElementText(b);tr.collapse(1);bp=tr.move('character',c)*-1;tr=r.duplicate();tr.collapse(1);sp=tr.move('character',c)*-1;tr=r.duplicate();tr.collapse(0);le=(tr.move('character',c)*-1)-sp;si=sp-bp;ei=le;}}bl=ed.dom.create(ed.settings.forced_root_block);bl.appendChild(nx.cloneNode(1));nx.parentNode.replaceChild(bl,nx);}}else{if(bl.hasChildNodes())bl.insertBefore(nx,bl.firstChild);else bl.appendChild(nx);}}else bl=null;}if(si!=-2){if(!isIE){bl=d.getElementsByTagName(ed.settings.element)[0];r=d.createRange();if(si!=-1)r.setStart(t.find(b,1,si),so);else r.setStart(bl,0);if(ei!=-1)r.setEnd(t.find(b,1,ei),eo);else r.setEnd(bl,0);if(s){s.removeAllRanges();s.addRange(r);}}else{try{r=s.createRange();r.moveToElementText(b);r.collapse(1);r.moveStart('character',si);r.moveEnd('character',ei);r.select();}catch(ex){}}}},getParentBlock:function(n){var d=this.dom;return d.getParent(n,d.isBlock);},insertPara:function(e){var t=this,ed=t.editor,dom=ed.dom,d=ed.getDoc(),se=ed.settings,s=ed.selection.getSel(),r=s.getRangeAt(0),b=d.body;var rb,ra,dir,sn,so,en,eo,sb,eb,bn,bef,aft,sc,ec,n,vp=dom.getViewPort(ed.getWin()),y,ch;function isEmpty(n){n=n.innerHTML;n=n.replace(/<(img|hr|table)/gi,'-');n=n.replace(/<[^>]+>/g,'');return n.replace(/[ \t\r\n]+/g,'')=='';};rb=d.createRange();rb.setStart(s.anchorNode,s.anchorOffset);rb.collapse(true);ra=d.createRange();ra.setStart(s.focusNode,s.focusOffset);ra.collapse(true);dir=rb.compareBoundaryPoints(rb.START_TO_END,ra)<0;sn=dir?s.anchorNode:s.focusNode;so=dir?s.anchorOffset:s.focusOffset;en=dir?s.focusNode:s.anchorNode;eo=dir?s.focusOffset:s.anchorOffset;if(sn===en&&/^(TD|TH)$/.test(sn.nodeName)){dom.remove(sn.firstChild);ed.dom.add(sn,se.element,null,'<br />');aft=ed.dom.add(sn,se.element,null,'<br />');r=d.createRange();r.selectNodeContents(aft);r.collapse(1);ed.selection.setRng(r);return false;}if(sn==b&&en==b&&b.firstChild&&ed.dom.isBlock(b.firstChild)){sn=en=sn.firstChild;so=eo=0;rb=d.createRange();rb.setStart(sn,0);ra=d.createRange();ra.setStart(en,0);}sn=sn.nodeName=="HTML"?d.body:sn;sn=sn.nodeName=="BODY"?sn.firstChild:sn;en=en.nodeName=="HTML"?d.body:en;en=en.nodeName=="BODY"?en.firstChild:en;sb=t.getParentBlock(sn);eb=t.getParentBlock(en);bn=sb?sb.nodeName:se.element;if(t.dom.getParent(sb,function(n){return/OL|UL|PRE/.test(n.nodeName);}))return true;if(sb&&(sb.nodeName=='CAPTION'||/absolute|relative|static/gi.test(sb.style.position))){bn=se.element;sb=null;}if(eb&&(eb.nodeName=='CAPTION'||/absolute|relative|static/gi.test(eb.style.position))){bn=se.element;eb=null;}if(/(TD|TABLE|TH|CAPTION)/.test(bn)||(sb&&bn=="DIV"&&/left|right/gi.test(sb.style.cssFloat))){bn=se.element;sb=eb=null;}bef=(sb&&sb.nodeName==bn)?sb.cloneNode(0):ed.dom.create(bn);aft=(eb&&eb.nodeName==bn)?eb.cloneNode(0):ed.dom.create(bn);aft.removeAttribute('id');if(/^(H[1-6])$/.test(bn)&&sn.nodeValue&&so==sn.nodeValue.length)aft=ed.dom.create(se.element);n=sc=sn;do{if(n==b||n.nodeType==9||t.dom.isBlock(n)||/(TD|TABLE|TH|CAPTION)/.test(n.nodeName))break;sc=n;}while((n=n.previousSibling?n.previousSibling:n.parentNode));n=ec=en;do{if(n==b||n.nodeType==9||t.dom.isBlock(n)||/(TD|TABLE|TH|CAPTION)/.test(n.nodeName))break;ec=n;}while((n=n.nextSibling?n.nextSibling:n.parentNode));if(sc.nodeName==bn)rb.setStart(sc,0);else rb.setStartBefore(sc);rb.setEnd(sn,so);bef.appendChild(rb.cloneContents()||d.createTextNode(''));try{ra.setEndAfter(ec);}catch(ex){}ra.setStart(en,eo);aft.appendChild(ra.cloneContents()||d.createTextNode(''));r=d.createRange();if(!sc.previousSibling&&sc.parentNode.nodeName==bn){r.setStartBefore(sc.parentNode);}else{if(rb.startContainer.nodeName==bn&&rb.startOffset==0)r.setStartBefore(rb.startContainer);else r.setStart(rb.startContainer,rb.startOffset);}if(!ec.nextSibling&&ec.parentNode.nodeName==bn)r.setEndAfter(ec.parentNode);else r.setEnd(ra.endContainer,ra.endOffset);r.deleteContents();if(isOpera)ed.getWin().scrollTo(0,vp.y);if(bef.firstChild&&bef.firstChild.nodeName==bn)bef.innerHTML=bef.firstChild.innerHTML;if(aft.firstChild&&aft.firstChild.nodeName==bn)aft.innerHTML=aft.firstChild.innerHTML;if(isEmpty(bef))bef.innerHTML='<br />';if(isEmpty(aft))aft.innerHTML=isOpera?'&nbsp;':'<br />';if(isOpera){r.insertNode(bef);r.insertNode(aft);}else{r.insertNode(aft);r.insertNode(bef);}aft.normalize();bef.normalize();r=d.createRange();r.selectNodeContents(aft);r.collapse(1);s.removeAllRanges();s.addRange(r);y=ed.dom.getPos(aft).y;ch=aft.clientHeight;if(y<vp.y||y+ch>vp.y+vp.h){ed.getWin().scrollTo(0,y<vp.y?y:y-vp.h+ch);}return false;},backspaceDelete:function(e,bs){var t=this,ed=t.editor,b=ed.getBody(),n,se=ed.selection,r=se.getRng(),sc=r.startContainer,n,w,tn;if(sc&&ed.dom.isBlock(sc)&&!/^(TD|TH)$/.test(sc.nodeName)&&bs){if(sc.childNodes.length==0||(sc.childNodes.length==1&&sc.firstChild.nodeName=='BR')){n=sc;while((n=n.previousSibling)&&!ed.dom.isBlock(n));if(n){if(sc!=b.firstChild){w=ed.dom.doc.createTreeWalker(n,NodeFilter.SHOW_TEXT,null,false);while(tn=w.nextNode())n=tn;r=ed.getDoc().createRange();r.setStart(n,n.nodeValue?n.nodeValue.length:0);r.setEnd(n,n.nodeValue?n.nodeValue.length:0);se.setRng(r);ed.dom.remove(sc);}return Event.cancel(e);}}}function handler(e){e=e.target;if(e&&e.parentNode&&e.nodeName=='BR'&&(n=t.getParentBlock(e))){Event.remove(b,'DOMNodeInserted',handler);if(e.previousSibling||e.nextSibling)ed.dom.remove(e);}};Event._add(b,'DOMNodeInserted',handler);window.setTimeout(function(){Event._remove(b,'DOMNodeInserted',handler);},1);}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each,extend=tinymce.extend;tinymce.create('tinymce.ControlManager',{ControlManager:function(ed,s){var t=this,i;s=s||{};t.editor=ed;t.controls={};t.onAdd=new tinymce.util.Dispatcher(t);t.onPostRender=new tinymce.util.Dispatcher(t);t.prefix=s.prefix||ed.id+'_';t._cls={};t.onPostRender.add(function(){each(t.controls,function(c){c.postRender();});});},get:function(id){return this.controls[this.prefix+id]||this.controls[id];},setActive:function(id,s){var c=null;if(c=this.get(id))c.setActive(s);return c;},setDisabled:function(id,s){var c=null;if(c=this.get(id))c.setDisabled(s);return c;},add:function(c){var t=this;if(c){t.controls[c.id]=c;t.onAdd.dispatch(c,t);}return c;},createControl:function(n){var c,t=this,ed=t.editor;each(ed.plugins,function(p){if(p.createControl){c=p.createControl(n,t);if(c)return false;}});switch(n){case"|":case"separator":return t.createSeparator();}if(!c&&ed.buttons&&(c=ed.buttons[n]))return t.createButton(n,c);return t.add(c);},createDropMenu:function(id,s,cc){var t=this,ed=t.editor,c,bm,v,cls;s=extend({'class':'mceDropDown',constrain:ed.settings.constrain_menus},s);s['class']=s['class']+' '+ed.getParam('skin')+'Skin';if(v=ed.getParam('skin_variant'))s['class']+=' '+ed.getParam('skin')+'Skin'+v.substring(0,1).toUpperCase()+v.substring(1);id=t.prefix+id;cls=cc||t._cls.dropmenu||tinymce.ui.DropMenu;c=t.controls[id]=new cls(id,s);c.onAddItem.add(function(c,o){var s=o.settings;s.title=ed.getLang(s.title,s.title);if(!s.onclick){s.onclick=function(v){ed.execCommand(s.cmd,s.ui||false,s.value);};}});ed.onRemove.add(function(){c.destroy();});if(tinymce.isIE){c.onShowMenu.add(function(){var s=ed.selection,n=s.getNode();if(n.nodeName=='IMG')bm=s.getBookmark();else bm=0;});c.onHideMenu.add(function(){if(bm)ed.selection.moveToBookmark(bm);});}return t.add(c);},createListBox:function(id,s,cc){var t=this,ed=t.editor,cmd,c,cls;if(t.get(id))return null;s.title=ed.translate(s.title);s.scope=s.scope||ed;if(!s.onselect){s.onselect=function(v){ed.execCommand(s.cmd,s.ui||false,v||s.value);};}s=extend({title:s.title,'class':'mce_'+id,scope:s.scope,control_manager:t},s);id=t.prefix+id;if(ed.settings.use_native_selects)c=new tinymce.ui.NativeListBox(id,s);else{cls=cc||t._cls.listbox||tinymce.ui.ListBox;c=new cls(id,s);}t.controls[id]=c;if(tinymce.isWebKit){c.onPostRender.add(function(c,n){Event.add(n,'mousedown',function(){ed.bookmark=ed.selection.getBookmark('simple');});Event.add(n,'focus',function(){ed.selection.moveToBookmark(ed.bookmark);ed.bookmark=null;});});}if(c.hideMenu)ed.onMouseDown.add(c.hideMenu,c);return t.add(c);},createButton:function(id,s,cc){var t=this,ed=t.editor,o,c,cls;if(t.get(id))return null;s.title=ed.translate(s.title);s.label=ed.translate(s.label);s.scope=s.scope||ed;if(!s.onclick&&!s.menu_button){s.onclick=function(){ed.execCommand(s.cmd,s.ui||false,s.value);};}s=extend({title:s.title,'class':'mce_'+id,unavailable_prefix:ed.getLang('unavailable',''),scope:s.scope,control_manager:t},s);id=t.prefix+id;if(s.menu_button){cls=cc||t._cls.menubutton||tinymce.ui.MenuButton;c=new cls(id,s);ed.onMouseDown.add(c.hideMenu,c);}else{cls=t._cls.button||tinymce.ui.Button;c=new cls(id,s);}return t.add(c);},createMenuButton:function(id,s){s=s||{};s.menu_button=1;return this.createButton(id,s);},createSplitButton:function(id,s,cc){var t=this,ed=t.editor,cmd,c,cls;if(t.get(id))return null;s.title=ed.translate(s.title);s.scope=s.scope||ed;if(!s.onclick){s.onclick=function(v){ed.execCommand(s.cmd,s.ui||false,v||s.value);};}if(!s.onselect){s.onselect=function(v){ed.execCommand(s.cmd,s.ui||false,v||s.value);};}s=extend({title:s.title,'class':'mce_'+id,scope:s.scope,control_manager:t},s);id=t.prefix+id;cls=cc||t._cls.splitbutton||tinymce.ui.SplitButton;c=t.add(new cls(id,s));ed.onMouseDown.add(c.hideMenu,c);return c;},createColorSplitButton:function(id,s,cc){var t=this,ed=t.editor,cmd,c,cls;if(t.get(id))return null;s.title=ed.translate(s.title);s.scope=s.scope||ed;if(!s.onclick){s.onclick=function(v){ed.execCommand(s.cmd,s.ui||false,v||s.value);};}if(!s.onselect){s.onselect=function(v){ed.execCommand(s.cmd,s.ui||false,v||s.value);};}s=extend({title:s.title,'class':'mce_'+id,'menu_class':ed.getParam('skin')+'Skin',scope:s.scope,more_colors_title:ed.getLang('more_colors')},s);id=t.prefix+id;cls=cc||t._cls.colorsplitbutton||tinymce.ui.ColorSplitButton;c=new cls(id,s);ed.onMouseDown.add(c.hideMenu,c);ed.onRemove.add(function(){c.destroy();});return t.add(c);},createToolbar:function(id,s,cc){var c,t=this,cls;id=t.prefix+id;cls=cc||t._cls.toolbar||tinymce.ui.Toolbar;c=new cls(id,s);if(t.get(id))return null;return t.add(c);},createSeparator:function(cc){var cls=cc||this._cls.separator||tinymce.ui.Separator;return new cls();},setControlType:function(n,c){return this._cls[n.toLowerCase()]=c;},destroy:function(){each(this.controls,function(c){c.destroy();});this.controls=null;}});})();(function(){var Dispatcher=tinymce.util.Dispatcher,each=tinymce.each,isIE=tinymce.isIE,isOpera=tinymce.isOpera;tinymce.create('tinymce.WindowManager',{WindowManager:function(ed){var t=this;t.editor=ed;t.onOpen=new Dispatcher(t);t.onClose=new Dispatcher(t);t.params={};t.features={};},open:function(s,p){var t=this,f='',x,y,mo=t.editor.settings.dialog_type=='modal',w,sw,sh,vp=tinymce.DOM.getViewPort(),u;s=s||{};p=p||{};sw=isOpera?vp.w:screen.width;sh=isOpera?vp.h:screen.height;s.name=s.name||'mc_'+new Date().getTime();s.width=parseInt(s.width||320);s.height=parseInt(s.height||240);s.resizable=true;s.left=s.left||parseInt(sw/ 2.0) - (s.width /2.0);s.top=s.top||parseInt(sh/ 2.0) - (s.height /2.0);p.inline=false;p.mce_width=s.width;p.mce_height=s.height;p.mce_auto_focus=s.auto_focus;if(mo){if(isIE){s.center=true;s.help=false;s.dialogWidth=s.width+'px';s.dialogHeight=s.height+'px';s.scroll=s.scrollbars||false;}else s.modal=s.alwaysRaised=s.dialog=s.centerscreen=s.dependent=true;}each(s,function(v,k){if(tinymce.is(v,'boolean'))v=v?'yes':'no';if(!/^(name|url)$/.test(k)){if(isIE&&mo)f+=(f?';':'')+k+':'+v;else f+=(f?',':'')+k+'='+v;}});t.features=s;t.params=p;t.onOpen.dispatch(t,s,p);u=s.url||s.file;if(tinymce.relaxedDomain)u+=(u.indexOf('?')==-1?'?':'&')+'mce_rdomain='+tinymce.relaxedDomain;u=tinymce._addVer(u);try{if(isIE&&mo){w=1;window.showModalDialog(u,window,f);}else w=window.open(u,s.name,f);}catch(ex){}if(!w)alert(t.editor.getLang('popup_blocked'));},close:function(w){w.close();this.onClose.dispatch(this);},createInstance:function(cl,a,b,c,d,e){var f=tinymce.resolve(cl);return new f(a,b,c,d,e);},confirm:function(t,cb,s){cb.call(s||this,confirm(this._decode(this.editor.getLang(t,t))));},alert:function(tx,cb,s){var t=this;alert(t._decode(t.editor.getLang(tx,tx)));if(cb)cb.call(s||t);},_decode:function(s){return tinymce.DOM.decode(s).replace(/\\n/g,'\n');}});}());
\ No newline at end of file
+var tinymce={majorVersion:'3',minorVersion:'1.1',releaseDate:'2008-06-25',_init:function(){var t=this,d=document,w=window,na=navigator,ua=na.userAgent,i,nl,n,base,p,v;t.isOpera=w.opera&&opera.buildNumber;t.isWebKit=/WebKit/.test(ua);t.isOldWebKit=t.isWebKit&&!w.getSelection().getRangeAt;t.isIE=!t.isWebKit&&!t.isOpera&&(/MSIE/gi).test(ua)&&(/Explorer/gi).test(na.appName);t.isIE6=t.isIE&&/MSIE [56]/.test(ua);t.isGecko=!t.isWebKit&&/Gecko/.test(ua);t.isMac=ua.indexOf('Mac')!=-1;if(w.tinyMCEPreInit){t.suffix=tinyMCEPreInit.suffix;t.baseURL=tinyMCEPreInit.base;t.query=tinyMCEPreInit.query;return;}t.suffix='';nl=d.getElementsByTagName('base');for(i=0;i<nl.length;i++){if(v=nl[i].href){if(/^https?:\/\/[^\/]+$/.test(v))v+='/';base=v?v.match(/.*\//)[0]:'';}}function getBase(n){if(n.src&&/tiny_mce(|_dev|_src|_gzip|_jquery|_prototype).js/.test(n.src)){if(/_(src|dev)\.js/g.test(n.src))t.suffix='_src';if((p=n.src.indexOf('?'))!=-1)t.query=n.src.substring(p+1);t.baseURL=n.src.substring(0,n.src.lastIndexOf('/'));if(base&&t.baseURL.indexOf('://')==-1)t.baseURL=base+t.baseURL;return t.baseURL;}return null;};nl=d.getElementsByTagName('script');for(i=0;i<nl.length;i++){if(getBase(nl[i]))return;}n=d.getElementsByTagName('head')[0];if(n){nl=n.getElementsByTagName('script');for(i=0;i<nl.length;i++){if(getBase(nl[i]))return;}}return;},is:function(o,t){var n=typeof(o);if(!t)return n!='undefined';if(t=='array'&&(o instanceof Array))return true;return n==t;},each:function(o,cb,s){var n,l;if(!o)return 0;s=s||o;if(typeof(o.length)!='undefined'){for(n=0,l=o.length;n<l;n++){if(cb.call(s,o[n],n,o)===false)return 0;}}else{for(n in o){if(o.hasOwnProperty(n)){if(cb.call(s,o[n],n,o)===false)return 0;}}}return 1;},map:function(a,f){var o=[];tinymce.each(a,function(v){o.push(f(v));});return o;},grep:function(a,f){var o=[];tinymce.each(a,function(v){if(!f||f(v))o.push(v);});return o;},inArray:function(a,v){var i,l;if(a){for(i=0,l=a.length;i<l;i++){if(a[i]===v)return i;}}return-1;},extend:function(o,e){var i,a=arguments;for(i=1;i<a.length;i++){e=a[i];tinymce.each(e,function(v,n){if(typeof(v)!=='undefined')o[n]=v;});}return o;},trim:function(s){return(s?''+s:'').replace(/^\s*|\s*$/g,'');},create:function(s,p){var t=this,sp,ns,cn,scn,c,de=0;s=/^((static) )?([\w.]+)(:([\w.]+))?/.exec(s);cn=s[3].match(/(^|\.)(\w+)$/i)[2];ns=t.createNS(s[3].replace(/\.\w+$/,''));if(ns[cn])return;if(s[2]=='static'){ns[cn]=p;if(this.onCreate)this.onCreate(s[2],s[3],ns[cn]);return;}if(!p[cn]){p[cn]=function(){};de=1;}ns[cn]=p[cn];t.extend(ns[cn].prototype,p);if(s[5]){sp=t.resolve(s[5]).prototype;scn=s[5].match(/\.(\w+)$/i)[1];c=ns[cn];if(de){ns[cn]=function(){return sp[scn].apply(this,arguments);};}else{ns[cn]=function(){this.parent=sp[scn];return c.apply(this,arguments);};}ns[cn].prototype[cn]=ns[cn];t.each(sp,function(f,n){ns[cn].prototype[n]=sp[n];});t.each(p,function(f,n){if(sp[n]){ns[cn].prototype[n]=function(){this.parent=sp[n];return f.apply(this,arguments);};}else{if(n!=cn)ns[cn].prototype[n]=f;}});}t.each(p['static'],function(f,n){ns[cn][n]=f;});if(this.onCreate)this.onCreate(s[2],s[3],ns[cn].prototype);},walk:function(o,f,n,s){s=s||this;if(o){if(n)o=o[n];tinymce.each(o,function(o,i){if(f.call(s,o,i,n)===false)return false;tinymce.walk(o,f,n,s);});}},createNS:function(n,o){var i,v;o=o||window;n=n.split('.');for(i=0;i<n.length;i++){v=n[i];if(!o[v])o[v]={};o=o[v];}return o;},resolve:function(n,o){var i,l;o=o||window;n=n.split('.');for(i=0,l=n.length;i<l;i++){o=o[n[i]];if(!o)break;}return o;},addUnload:function(f,s){var t=this,w=window;f={func:f,scope:s||this};if(!t.unloads){function unload(){var li=t.unloads,o,n;if(li){for(n in li){o=li[n];if(o&&o.func)o.func.call(o.scope,1);}if(w.detachEvent){w.detachEvent('onbeforeunload',fakeUnload);w.detachEvent('onunload',unload);}else if(w.removeEventListener)w.removeEventListener('unload',unload,false);t.unloads=o=li=w=unload=null;if(window.CollectGarbage)window.CollectGarbage();}};function fakeUnload(){var d=document;if(d.readyState=='interactive'){function stop(){d.detachEvent('onstop',stop);unload();d=null;};d.attachEvent('onstop',stop);window.setTimeout(function(){d.detachEvent('onstop',stop);},0);}};if(w.attachEvent){w.attachEvent('onunload',unload);w.attachEvent('onbeforeunload',fakeUnload);}else if(w.addEventListener)w.addEventListener('unload',unload,false);t.unloads=[f];}else t.unloads.push(f);return f;},removeUnload:function(f){var u=this.unloads,r=null;tinymce.each(u,function(o,i){if(o&&o.func==f){u.splice(i,1);r=f;return false;}});return r;},explode:function(s,d){return s?tinymce.map(s.split(d||','),tinymce.trim):s;},_addVer:function(u){var v;if(!this.query)return u;v=(u.indexOf('?')==-1?'?':'&')+this.query;if(u.indexOf('#')==-1)return u+v;return u.replace('#',v+'#');}};window.tinymce=tinymce;tinymce._init();tinymce.create('tinymce.util.Dispatcher',{scope:null,listeners:null,Dispatcher:function(s){this.scope=s||this;this.listeners=[];},add:function(cb,s){this.listeners.push({cb:cb,scope:s||this.scope});return cb;},addToTop:function(cb,s){this.listeners.unshift({cb:cb,scope:s||this.scope});return cb;},remove:function(cb){var l=this.listeners,o=null;tinymce.each(l,function(c,i){if(cb==c.cb){o=cb;l.splice(i,1);return false;}});return o;},dispatch:function(){var s,a=arguments,i,li=this.listeners,c;for(i=0;i<li.length;i++){c=li[i];s=c.cb.apply(c.scope,a);if(s===false)break;}return s;}});(function(){var each=tinymce.each;tinymce.create('tinymce.util.URI',{URI:function(u,s){var t=this,o,a,b;s=t.settings=s||{};if(/^(mailto|news|javascript|about):/i.test(u)||/^\s*#/.test(u)){t.source=u;return;}if(u.indexOf('/')===0&&u.indexOf('//')!==0)u=(s.base_uri?s.base_uri.protocol||'http':'http')+'://mce_host'+u;if(u.indexOf('://')===-1&&u.indexOf('//')!==0)u=(s.base_uri.protocol||'http')+'://mce_host'+t.toAbsPath(s.base_uri.path,u);u=u.replace(/@@/g,'(mce_at)');u=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(u);each(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],function(v,i){var s=u[i];if(s)s=s.replace(/\(mce_at\)/g,'@@');t[v]=s;});if(b=s.base_uri){if(!t.protocol)t.protocol=b.protocol;if(!t.userInfo)t.userInfo=b.userInfo;if(!t.port&&t.host=='mce_host')t.port=b.port;if(!t.host||t.host=='mce_host')t.host=b.host;t.source='';}},setPath:function(p){var t=this;p=/^(.*?)\/?(\w+)?$/.exec(p);t.path=p[0];t.directory=p[1];t.file=p[2];t.source='';t.getURI();},toRelative:function(u){var t=this,o;u=new tinymce.util.URI(u,{base_uri:t});if((u.host!='mce_host'&&t.host!=u.host&&u.host)||t.port!=u.port||t.protocol!=u.protocol)return u.getURI();o=t.toRelPath(t.path,u.path);if(u.query)o+='?'+u.query;if(u.anchor)o+='#'+u.anchor;return o;},toAbsolute:function(u,nh){var u=new tinymce.util.URI(u,{base_uri:this});return u.getURI(this.host==u.host?nh:0);},toRelPath:function(base,path){var items,bp=0,out='',i;base=base.substring(0,base.lastIndexOf('/'));base=base.split('/');items=path.split('/');if(base.length>=items.length){for(i=0;i<base.length;i++){if(i>=items.length||base[i]!=items[i]){bp=i+1;break;}}}if(base.length<items.length){for(i=0;i<items.length;i++){if(i>=base.length||base[i]!=items[i]){bp=i+1;break;}}}if(bp==1)return path;for(i=0;i<base.length-(bp-1);i++)out+="../";for(i=bp-1;i<items.length;i++){if(i!=bp-1)out+="/"+items[i];else out+=items[i];}return out;},toAbsPath:function(base,path){var i,nb=0,o=[];base=base.split('/');path=path.split('/');each(base,function(k){if(k)o.push(k);});base=o;for(i=path.length-1,o=[];i>=0;i--){if(path[i].length==0||path[i]==".")continue;if(path[i]=='..'){nb++;continue;}if(nb>0){nb--;continue;}o.push(path[i]);}i=base.length-nb;if(i<=0)return'/'+o.reverse().join('/');return'/'+base.slice(0,i).join('/')+'/'+o.reverse().join('/');},getURI:function(nh){var s,t=this;if(!t.source||nh){s='';if(!nh){if(t.protocol)s+=t.protocol+'://';if(t.userInfo)s+=t.userInfo+'@';if(t.host)s+=t.host;if(t.port)s+=':'+t.port;}if(t.path)s+=t.path;if(t.query)s+='?'+t.query;if(t.anchor)s+='#'+t.anchor;t.source=s;}return t.source;}});})();(function(){var each=tinymce.each;tinymce.create('static tinymce.util.Cookie',{getHash:function(n){var v=this.get(n),h;if(v){each(v.split('&'),function(v){v=v.split('=');h=h||{};h[unescape(v[0])]=unescape(v[1]);});}return h;},setHash:function(n,v,e,p,d,s){var o='';each(v,function(v,k){o+=(!o?'':'&')+escape(k)+'='+escape(v);});this.set(n,o,e,p,d,s);},get:function(n){var c=document.cookie,e,p=n+"=",b;if(!c)return;b=c.indexOf("; "+p);if(b==-1){b=c.indexOf(p);if(b!=0)return null;}else b+=2;e=c.indexOf(";",b);if(e==-1)e=c.length;return unescape(c.substring(b+p.length,e));},set:function(n,v,e,p,d,s){document.cookie=n+"="+escape(v)+((e)?"; expires="+e.toGMTString():"")+((p)?"; path="+escape(p):"")+((d)?"; domain="+d:"")+((s)?"; secure":"");},remove:function(n,p){var d=new Date();d.setTime(d.getTime()-1000);this.set(n,'',d,p,d);}});})();tinymce.create('static tinymce.util.JSON',{serialize:function(o){var i,v,s=tinymce.util.JSON.serialize,t;if(o==null)return'null';t=typeof o;if(t=='string'){v='\bb\tt\nn\ff\rr\""\'\'\\\\';return'"'+o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'])/g,function(a,b){i=v.indexOf(b);if(i+1)return'\\'+v.charAt(i+1);a=b.charCodeAt().toString(16);return'\\u'+'0000'.substring(a.length)+a;})+'"';}if(t=='object'){if(o instanceof Array){for(i=0,v='[';i<o.length;i++)v+=(i>0?',':'')+s(o[i]);return v+']';}v='{';for(i in o)v+=typeof o[i]!='function'?(v.length>1?',"':'"')+i+'":'+s(o[i]):'';return v+'}';}return''+o;},parse:function(s){try{return eval('('+s+')');}catch(ex){}}});tinymce.create('static tinymce.util.XHR',{send:function(o){var x,t,w=window,c=0;o.scope=o.scope||this;o.success_scope=o.success_scope||o.scope;o.error_scope=o.error_scope||o.scope;o.async=o.async===false?false:true;o.data=o.data||'';function get(s){x=0;try{x=new ActiveXObject(s);}catch(ex){}return x;};x=w.XMLHttpRequest?new XMLHttpRequest():get('Microsoft.XMLHTTP')||get('Msxml2.XMLHTTP');if(x){if(x.overrideMimeType)x.overrideMimeType(o.content_type);x.open(o.type||(o.data?'POST':'GET'),o.url,o.async);if(o.content_type)x.setRequestHeader('Content-Type',o.content_type);x.send(o.data);function ready(){if(!o.async||x.readyState==4||c++>10000){if(o.success&&c<10000&&x.status==200)o.success.call(o.success_scope,''+x.responseText,x,o);else if(o.error)o.error.call(o.error_scope,c>10000?'TIMED_OUT':'GENERAL',x,o);x=null;}else w.setTimeout(ready,10);};if(!o.async)return ready();t=w.setTimeout(ready,10);}}});(function(){var extend=tinymce.extend,JSON=tinymce.util.JSON,XHR=tinymce.util.XHR;tinymce.create('tinymce.util.JSONRequest',{JSONRequest:function(s){this.settings=extend({},s);this.count=0;},send:function(o){var ecb=o.error,scb=o.success;o=extend(this.settings,o);o.success=function(c,x){c=JSON.parse(c);if(typeof(c)=='undefined'){c={error:'JSON Parse error.'};}if(c.error)ecb.call(o.error_scope||o.scope,c.error,x);else scb.call(o.success_scope||o.scope,c.result);};o.error=function(ty,x){ecb.call(o.error_scope||o.scope,ty,x);};o.data=JSON.serialize({id:o.id||'c'+(this.count++),method:o.method,params:o.params});o.content_type='application/json';XHR.send(o);},'static':{sendRPC:function(o){return new tinymce.util.JSONRequest().send(o);}}});}());(function(){var each=tinymce.each,is=tinymce.is;var isWebKit=tinymce.isWebKit,isIE=tinymce.isIE;tinymce.create('tinymce.dom.DOMUtils',{doc:null,root:null,files:null,listeners:{},pixelStyles:/^(top|left|bottom|right|width|height|borderWidth)$/,cache:{},idPattern:/^#[\w]+$/,elmPattern:/^[\w_*]+$/,elmClassPattern:/^([\w_]*)\.([\w_]+)$/,DOMUtils:function(d,s){var t=this;t.doc=d;t.win=window;t.files={};t.cssFlicker=false;t.counter=0;t.boxModel=!tinymce.isIE||d.compatMode=="CSS1Compat";t.stdMode=d.documentMode===8;this.settings=s=tinymce.extend({keep_values:false,hex_colors:1,process_html:1},s);if(tinymce.isIE6){try{d.execCommand('BackgroundImageCache',false,true);}catch(e){t.cssFlicker=true;}}tinymce.addUnload(t.destroy,t);},getRoot:function(){var t=this,s=t.settings;return(s&&t.get(s.root_element))||t.doc.body;},getViewPort:function(w){var d,b;w=!w?this.win:w;d=w.document;b=this.boxModel?d.documentElement:d.body;return{x:w.pageXOffset||b.scrollLeft,y:w.pageYOffset||b.scrollTop,w:w.innerWidth||b.clientWidth,h:w.innerHeight||b.clientHeight};},getRect:function(e){var p,t=this,w,h;e=t.get(e);p=t.getPos(e);w=t.getStyle(e,'width');h=t.getStyle(e,'height');if(w.indexOf('px')===-1)w=0;if(h.indexOf('px')===-1)h=0;return{x:p.x,y:p.y,w:parseInt(w)||e.offsetWidth||e.clientWidth,h:parseInt(h)||e.offsetHeight||e.clientHeight};},getParent:function(n,f,r){var na,se=this.settings;n=this.get(n);if(se.strict_root)r=r||this.getRoot();if(is(f,'string')){na=f.toUpperCase();f=function(n){var s=false;if(n.nodeType==1&&na==='*'){s=true;return false;}each(na.split(','),function(v){if(n.nodeType==1&&((se.strict&&n.nodeName.toUpperCase()==v)||n.nodeName.toUpperCase()==v)){s=true;return false;}});return s;};}while(n){if(n==r)return null;if(f(n))return n;n=n.parentNode;}return null;},get:function(e){var n;if(e&&this.doc&&typeof(e)=='string'){n=e;e=this.doc.getElementById(e);if(e&&e.id!==n)return this.doc.getElementsByName(n)[1];}return e;},select:function(pa,s){var t=this,cs,c,pl,o=[],x,i,l,n;s=t.get(s)||t.doc;if(s.querySelectorAll){if(s!=t.doc){i=s.id;s.id='_mc_tmp';pa='#_mc_tmp '+pa;}l=tinymce.grep(s.querySelectorAll(pa));s.id=i;return l;}if(t.settings.strict){function get(s,n){return s.getElementsByTagName(n.toLowerCase());};}else{function get(s,n){return s.getElementsByTagName(n);};}if(t.elmPattern.test(pa)){x=get(s,pa);for(i=0,l=x.length;i<l;i++)o.push(x[i]);return o;}if(t.elmClassPattern.test(pa)){pl=t.elmClassPattern.exec(pa);x=get(s,pl[1]||'*');c=' '+pl[2]+' ';for(i=0,l=x.length;i<l;i++){n=x[i];if(n.className&&(' '+n.className+' ').indexOf(c)!==-1)o.push(n);}return o;}function collect(n){if(!n.mce_save){n.mce_save=1;o.push(n);}};function collectIE(n){if(!n.getAttribute('mce_save')){n.setAttribute('mce_save','1');o.push(n);}};function find(n,f,r){var i,l,nl=get(r,n);for(i=0,l=nl.length;i<l;i++)f(nl[i]);};each(pa.split(','),function(v,i){v=tinymce.trim(v);if(t.elmPattern.test(v)){each(get(s,v),function(n){collect(n);});return;}if(t.elmClassPattern.test(v)){x=t.elmClassPattern.exec(v);each(get(s,x[1]),function(n){if(t.hasClass(n,x[2]))collect(n);});return;}if(!(cs=t.cache[pa])){cs='x=(function(cf, s) {';pl=v.split(' ');each(pl,function(v){var p=/^([\w\\*]+)?(?:#([\w\\]+))?(?:\.([\w\\\.]+))?(?:\[\@([\w\\]+)([\^\$\*!]?=)([\w\\]+)\])?(?:\:([\w\\]+))?/i.exec(v);p[1]=p[1]||'*';cs+='find("'+p[1]+'", function(n) {';if(p[2])cs+='if (n.id !== "'+p[2]+'") return;';if(p[3]){cs+='var c = " " + n.className + " ";';cs+='if (';c='';each(p[3].split('.'),function(v){if(v)c+=(c?'||':'')+'c.indexOf(" '+v+' ") === -1';});cs+=c+') return;';}});cs+='cf(n);';for(i=pl.length-1;i>=0;i--)cs+='}, '+(i?'n':'s')+');';cs+='})';t.cache[pa]=cs=eval(cs);}cs(isIE?collectIE:collect,s);});each(o,function(n){if(isIE)n.removeAttribute('mce_save');else delete n.mce_save;});return o;},add:function(p,n,a,h,c){var t=this;return this.run(p,function(p){var e,k;e=is(n,'string')?t.doc.createElement(n):n;if(a){for(k in a){if(a.hasOwnProperty(k)&&!is(a[k],'object'))t.setAttrib(e,k,''+a[k]);}if(a.style&&!is(a.style,'string')){each(a.style,function(v,n){t.setStyle(e,n,v);});}}if(h){if(h.nodeType)e.appendChild(h);else t.setHTML(e,h);}return!c?p.appendChild(e):e;});},create:function(n,a,h){return this.add(this.doc.createElement(n),n,a,h,1);},createHTML:function(n,a,h){var o='',t=this,k;o+='<'+n;for(k in a){if(a.hasOwnProperty(k))o+=' '+k+'="'+t.encode(a[k])+'"';}if(tinymce.is(h))return o+'>'+h+'</'+n+'>';return o+' />';},remove:function(n,k){return this.run(n,function(n){var p,g;p=n.parentNode;if(!p)return null;if(k){each(n.childNodes,function(c){p.insertBefore(c.cloneNode(true),n);});}return p.removeChild(n);});},setStyle:function(n,na,v){var t=this;return t.run(n,function(e){var s,i;s=e.style;na=na.replace(/-(\D)/g,function(a,b){return b.toUpperCase();});if(t.pixelStyles.test(na)&&(tinymce.is(v,'number')||/^[\-0-9\.]+$/.test(v)))v+='px';switch(na){case'opacity':if(isIE){s.filter=v===''?'':"alpha(opacity="+(v*100)+")";if(!n.currentStyle||!n.currentStyle.hasLayout)s.display='inline-block';}s[na]=s['-moz-opacity']=s['-khtml-opacity']=v||'';break;case'float':isIE?s.styleFloat=v:s.cssFloat=v;break;default:s[na]=v||'';}if(t.settings.update_styles)t.setAttrib(e,'mce_style');});},getStyle:function(n,na,c){n=this.get(n);if(!n)return false;if(this.doc.defaultView&&c){na=na.replace(/[A-Z]/g,function(a){return'-'+a;});try{return this.doc.defaultView.getComputedStyle(n,null).getPropertyValue(na);}catch(ex){return null;}}na=na.replace(/-(\D)/g,function(a,b){return b.toUpperCase();});if(na=='float')na=isIE?'styleFloat':'cssFloat';if(n.currentStyle&&c)return n.currentStyle[na];return n.style[na];},setStyles:function(e,o){var t=this,s=t.settings,ol;ol=s.update_styles;s.update_styles=0;each(o,function(v,n){t.setStyle(e,n,v);});s.update_styles=ol;if(s.update_styles)t.setAttrib(e,s.cssText);},setAttrib:function(e,n,v){var t=this;if(t.settings.strict)n=n.toLowerCase();return this.run(e,function(e){var s=t.settings;switch(n){case"style":if(s.keep_values){if(v&&!t._isRes(v))e.setAttribute('mce_style',v,2);else e.removeAttribute('mce_style',2);}e.style.cssText=v;break;case"class":e.className=v||'';break;case"src":case"href":if(s.keep_values){if(s.url_converter)v=s.url_converter.call(s.url_converter_scope||t,v,n,e);t.setAttrib(e,'mce_'+n,v,2);}break;case"shape":e.setAttribute('mce_style',v);break;}if(is(v)&&v!==null&&v.length!==0)e.setAttribute(n,''+v,2);else e.removeAttribute(n,2);});},setAttribs:function(e,o){var t=this;return this.run(e,function(e){each(o,function(v,n){t.setAttrib(e,n,v);});});},getAttrib:function(e,n,dv){var v,t=this;e=t.get(e);if(!e||e.nodeType!==1)return false;if(!is(dv))dv="";if(/^(src|href|style|coords|shape)$/.test(n)){v=e.getAttribute("mce_"+n);if(v)return v;}v=e.getAttribute(n,2);if(!v){switch(n){case'class':v=e.className;break;default:if(isIE&&n==='name'&&e.nodeName==='A'){v=e.name;break;}v=e.attributes[n];v=v&&is(v.nodeValue)?v.nodeValue:v;}}switch(n){case'style':v=v||e.style.cssText;if(v){v=t.serializeStyle(t.parseStyle(v));if(t.settings.keep_values&&!t._isRes(v))e.setAttribute('mce_style',v);}break;}if(isWebKit&&n==="class"&&v)v=v.replace(/(apple|webkit)\-[a-z\-]+/gi,'');if(isIE){switch(n){case'rowspan':case'colspan':if(v===1)v='';break;case'size':if(v==='+0')v='';break;case'hspace':if(v===-1)v='';break;case'maxlength':case'tabindex':if(v===32768||v===2147483647)v='';break;case'noshade':if(v===65535)return'noshade';break;case'shape':v=v.toLowerCase();break;default:if(n.indexOf('on')===0&&v)v=(''+v).replace(/^function\s+anonymous\(\)\s+\{\s+(.*)\s+\}$/,'$1');}}return(v&&v!='')?''+v:dv;},getPos:function(n){var t=this,x=0,y=0,e,d=t.doc,r;n=t.get(n);if(n&&isIE){n=n.getBoundingClientRect();e=t.boxModel?d.documentElement:d.body;x=t.getStyle(t.select('html')[0],'borderWidth');x=(x=='medium'||t.boxModel&&!t.isIE6)&&2||x;n.top+=t.win.self!=t.win.top?2:0;return{x:n.left+e.scrollLeft-x,y:n.top+e.scrollTop-x};}r=n;while(r){x+=r.offsetLeft||0;y+=r.offsetTop||0;r=r.offsetParent;}r=n;while(r){if(!/^table-row|inline.*/i.test(t.getStyle(r,"display",1))){x-=r.scrollLeft||0;y-=r.scrollTop||0;}r=r.parentNode;if(r==d.body)break;}return{x:x,y:y};},parseStyle:function(st){var t=this,s=t.settings,o={};if(!st)return o;function compress(p,s,ot){var t,r,b,l;t=o[p+'-top'+s];if(!t)return;r=o[p+'-right'+s];if(t!=r)return;b=o[p+'-bottom'+s];if(r!=b)return;l=o[p+'-left'+s];if(b!=l)return;o[ot]=l;delete o[p+'-top'+s];delete o[p+'-right'+s];delete o[p+'-bottom'+s];delete o[p+'-left'+s];};function compress2(ta,a,b,c){var t;t=o[a];if(!t)return;t=o[b];if(!t)return;t=o[c];if(!t)return;o[ta]=o[a]+' '+o[b]+' '+o[c];delete o[a];delete o[b];delete o[c];};st=st.replace(/&(#?[a-z0-9]+);/g,'&$1_MCE_SEMI_');each(st.split(';'),function(v){var sv,ur=[];if(v){v=v.replace(/_MCE_SEMI_/g,';');v=v.replace(/url\([^\)]+\)/g,function(v){ur.push(v);return'url('+ur.length+')';});v=v.split(':');sv=tinymce.trim(v[1]);sv=sv.replace(/url\(([^\)]+)\)/g,function(a,b){return ur[parseInt(b)-1];});sv=sv.replace(/rgb\([^\)]+\)/g,function(v){return t.toHex(v);});if(s.url_converter){sv=sv.replace(/url\([\'\"]?([^\)\'\"]+)[\'\"]?\)/g,function(x,c){return'url('+s.url_converter.call(s.url_converter_scope||t,t.decode(c),'style',null)+')';});}o[tinymce.trim(v[0]).toLowerCase()]=sv;}});compress("border","","border");compress("border","-width","border-width");compress("border","-color","border-color");compress("border","-style","border-style");compress("padding","","padding");compress("margin","","margin");compress2('border','border-width','border-style','border-color');if(isIE){if(o.border=='medium none')o.border='';}return o;},serializeStyle:function(o){var s='';each(o,function(v,k){if(k&&v){if(tinymce.isGecko&&k.indexOf('-moz-')===0)return;switch(k){case'color':case'background-color':v=v.toLowerCase();break;}s+=(s?' ':'')+k+': '+v+';';}});return s;},loadCSS:function(u){var t=this,d=t.doc;if(!u)u='';each(u.split(','),function(u){if(t.files[u])return;t.files[u]=true;t.add(t.select('head')[0],'link',{rel:'stylesheet',href:tinymce._addVer(u)});});},addClass:function(e,c){return this.run(e,function(e){var o;if(!c)return 0;if(this.hasClass(e,c))return e.className;o=this.removeClass(e,c);return e.className=(o!=''?(o+' '):'')+c;});},removeClass:function(e,c){var t=this,re;return t.run(e,function(e){var v;if(t.hasClass(e,c)){if(!re)re=new RegExp("(^|\\s+)"+c+"(\\s+|$)","g");v=e.className.replace(re,' ');return e.className=tinymce.trim(v!=' '?v:'');}return e.className;});},hasClass:function(n,c){n=this.get(n);if(!n||!c)return false;return(' '+n.className+' ').indexOf(' '+c+' ')!==-1;},show:function(e){return this.setStyle(e,'display','block');},hide:function(e){return this.setStyle(e,'display','none');},isHidden:function(e){e=this.get(e);return e.style.display=='none'||this.getStyle(e,'display')=='none';},uniqueId:function(p){return(!p?'mce_':p)+(this.counter++);},setHTML:function(e,h){var t=this;return this.run(e,function(e){var x,i,nl,n,p,x;h=t.processHTML(h);if(isIE){function set(){try{e.innerHTML='<br />'+h;e.removeChild(e.firstChild);}catch(ex){while(e.firstChild)e.firstChild.removeNode();x=t.create('div');x.innerHTML='<br />'+h;each(x.childNodes,function(n,i){if(i)e.appendChild(n);});}};if(t.settings.fix_ie_paragraphs)h=h.replace(/<p><\/p>|<p([^>]+)><\/p>|<p[^\/+]\/>/gi,'<p$1 mce_keep="true">&nbsp;</p>');set();if(t.settings.fix_ie_paragraphs){nl=e.getElementsByTagName("p");for(i=nl.length-1,x=0;i>=0;i--){n=nl[i];if(!n.hasChildNodes()){if(!n.mce_keep){x=1;break;}n.removeAttribute('mce_keep');}}}if(x){h=h.replace(/<p([^>]+)>|<p>/g,'<div$1 mce_tmp="1">');h=h.replace(/<\/p>/g,'</div>');set();if(t.settings.fix_ie_paragraphs){nl=e.getElementsByTagName("DIV");for(i=nl.length-1;i>=0;i--){n=nl[i];if(n.mce_tmp){p=t.doc.createElement('p');n.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi,function(a,b){var v;if(b!=='mce_tmp'){v=n.getAttribute(b);if(!v&&b==='class')v=n.className;p.setAttribute(b,v);}});for(x=0;x<n.childNodes.length;x++)p.appendChild(n.childNodes[x].cloneNode(true));n.swapNode(p);}}}}}else e.innerHTML=h;return h;});},processHTML:function(h){var t=this,s=t.settings;if(!s.process_html)return h;if(tinymce.isGecko){h=h.replace(/<(\/?)strong>|<strong( [^>]+)>/gi,'<$1b$2>');h=h.replace(/<(\/?)em>|<em( [^>]+)>/gi,'<$1i$2>');}else if(isIE)h=h.replace(/&apos;/g,'&#39;');h=h.replace(/<a( )([^>]+)\/>|<a\/>/gi,'<a$1$2></a>');if(s.keep_values){if(/<script|style/.test(h)){function trim(s){s=s.replace(/^[\r\n]*|[\r\n]*$/g,'');s=s.replace(/^\s*(\/\/\s*<!--|\/\/\s*<\[CDATA\[|<!--|<\[CDATA\[)[\r\n]*/g,'');s=s.replace(/\s*(\/\/\s*\]\]>|\/\/\s*-->|\]\]>|-->)\s*$/g,'');return s;};h=h.replace(/<script([^>]+|)>([\s\S]*?)<\/script>/g,function(v,a,b){b=trim(b);if(!a)a=' type="text/javascript"';if(b)b='<!--\n'+b+'\n// -->';return'<mce:script'+a+'>'+b+'</mce:script>';});h=h.replace(/<style([^>]+|)>([\s\S]*?)<\/style>/g,function(v,a,b){b=trim(b);return'<mce:style'+a+'><!--\n'+b+'\n--></mce:style><style'+a+' mce_bogus="1">'+b+'</style>';});}h=h.replace(/<([\w:]+) [^>]*(src|href|style|shape|coords)[^>]*>/gi,function(a,n){function handle(m,b,c){var u=c;if(a.indexOf('mce_'+b)!=-1)return m;if(b=='style'){if(t._isRes(c))return m;if(s.hex_colors){u=u.replace(/rgb\([^\)]+\)/g,function(v){return t.toHex(v);});}if(s.url_converter){u=u.replace(/url\([\'\"]?([^\)\'\"]+)\)/g,function(x,c){return'url('+t.encode(s.url_converter.call(s.url_converter_scope||t,t.decode(c),b,n))+')';});}}else if(b!='coords'&&b!='shape'){if(s.url_converter)u=t.encode(s.url_converter.call(s.url_converter_scope||t,t.decode(c),b,n));}return' '+b+'="'+c+'" mce_'+b+'="'+u+'"';};a=a.replace(/ (src|href|style|coords|shape)=[\"]([^\"]+)[\"]/gi,handle);a=a.replace(/ (src|href|style|coords|shape)=[\']([^\']+)[\']/gi,handle);return a.replace(/ (src|href|style|coords|shape)=([^\s\"\'>]+)/gi,handle);});}return h;},getOuterHTML:function(e){var d;e=this.get(e);if(!e)return null;if(isIE)return e.outerHTML;d=(e.ownerDocument||this.doc).createElement("body");d.appendChild(e.cloneNode(true));return d.innerHTML;},setOuterHTML:function(e,h,d){var t=this;return this.run(e,function(e){var n,tp;e=t.get(e);d=d||e.ownerDocument||t.doc;if(isIE&&e.nodeType==1)e.outerHTML=h;else{tp=d.createElement("body");tp.innerHTML=h;n=tp.lastChild;while(n){t.insertAfter(n.cloneNode(true),e);n=n.previousSibling;}t.remove(e);}});},decode:function(s){var e;if(/&[^;]+;/.test(s)){e=this.doc.createElement("div");e.innerHTML=s;return!e.firstChild?s:e.firstChild.nodeValue;}return s;},encode:function(s){return s?(''+s).replace(/[<>&\"]/g,function(c,b){switch(c){case'&':return'&amp;';case'"':return'&quot;';case'<':return'&lt;';case'>':return'&gt;';}return c;}):s;},insertAfter:function(n,r){var t=this;r=t.get(r);return this.run(n,function(n){var p,ns;p=r.parentNode;ns=r.nextSibling;if(ns)p.insertBefore(n,ns);else p.appendChild(n);return n;});},isBlock:function(n){if(n.nodeType&&n.nodeType!==1)return false;n=n.nodeName||n;return/^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(n);},replace:function(n,o,k){if(is(o,'array'))n=n.cloneNode(true);return this.run(o,function(o){if(k){each(o.childNodes,function(c){n.appendChild(c.cloneNode(true));});}return o.parentNode.replaceChild(n,o);});},toHex:function(s){var c=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(s);function hex(s){s=parseInt(s).toString(16);return s.length>1?s:'0'+s;};if(c){s='#'+hex(c[1])+hex(c[2])+hex(c[3]);return s;}return s;},getClasses:function(){var t=this,cl=[],i,lo={},f=t.settings.class_filter,ov;if(t.classes)return t.classes;function addClasses(s){each(s.imports,function(r){addClasses(r);});each(s.cssRules||s.rules,function(r){switch(r.type||1){case 1:if(r.selectorText){each(r.selectorText.split(','),function(v){v=v.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(v)||!/\.[\w\-]+$/.test(v))return;ov=v;v=v.replace(/.*\.([a-z0-9_\-]+).*/i,'$1');if(f&&!(v=f(v,ov)))return;if(!lo[v]){cl.push({'class':v});lo[v]=1;}});}break;case 3:addClasses(r.styleSheet);break;}});};try{each(t.doc.styleSheets,addClasses);}catch(ex){}if(cl.length>0)t.classes=cl;return cl;},run:function(e,f,s){var t=this,o;if(t.doc&&typeof(e)==='string')e=t.doc.getElementById(e);if(!e)return false;s=s||this;if(!e.nodeType&&(e.length||e.length===0)){o=[];each(e,function(e,i){if(e){if(typeof(e)=='string')e=t.doc.getElementById(e);o.push(f.call(s,e,i));}});return o;}return f.call(s,e);},getAttribs:function(n){var o;n=this.get(n);if(!n)return[];if(isIE){o=[];if(n.nodeName=='OBJECT')return n.attributes;n.cloneNode(false).outerHTML.replace(/([a-z0-9\:\-_]+)=/gi,function(a,b){o.push({specified:1,nodeName:b});});return o;}return n.attributes;},destroy:function(s){var t=this;t.win=t.doc=t.root=null;if(!s)tinymce.removeUnload(t.destroy);},_isRes:function(c){return/^(top|left|bottom|right|width|height)/i.test(c)||/;\s*(top|left|bottom|right|width|height)/i.test(c);}});tinymce.DOM=new tinymce.dom.DOMUtils(document,{process_html:0});})();(function(){var each=tinymce.each,DOM=tinymce.DOM,isIE=tinymce.isIE,isWebKit=tinymce.isWebKit,Event;tinymce.create('static tinymce.dom.Event',{inits:[],events:[],add:function(o,n,f,s){var cb,t=this,el=t.events,r;if(o&&o instanceof Array){r=[];each(o,function(o){o=DOM.get(o);r.push(t.add(o,n,f,s));});return r;}o=DOM.get(o);if(!o)return;cb=function(e){e=e||window.event;if(e&&!e.target&&isIE)e.target=e.srcElement;if(!s)return f(e);return f.call(s,e);};if(n=='unload'){tinymce.unloads.unshift({func:cb});return cb;}if(n=='init'){if(t.domLoaded)cb();else t.inits.push(cb);return cb;}el.push({obj:o,name:n,func:f,cfunc:cb,scope:s});t._add(o,n,cb);return f;},remove:function(o,n,f){var t=this,a=t.events,s=false,r;if(o&&o instanceof Array){r=[];each(o,function(o){o=DOM.get(o);r.push(t.remove(o,n,f));});return r;}o=DOM.get(o);each(a,function(e,i){if(e.obj==o&&e.name==n&&(!f||(e.func==f||e.cfunc==f))){a.splice(i,1);t._remove(o,n,e.cfunc);s=true;return false;}});return s;},clear:function(o){var t=this,a=t.events,i,e;if(o){o=DOM.get(o);for(i=a.length-1;i>=0;i--){e=a[i];if(e.obj===o){t._remove(e.obj,e.name,e.cfunc);e.obj=e.cfunc=null;a.splice(i,1);}}}},cancel:function(e){if(!e)return false;this.stop(e);return this.prevent(e);},stop:function(e){if(e.stopPropagation)e.stopPropagation();else e.cancelBubble=true;return false;},prevent:function(e){if(e.preventDefault)e.preventDefault();else e.returnValue=false;return false;},_unload:function(){var t=Event;each(t.events,function(e,i){t._remove(e.obj,e.name,e.cfunc);e.obj=e.cfunc=null;});t.events=[];t=null;},_add:function(o,n,f){if(o.attachEvent)o.attachEvent('on'+n,f);else if(o.addEventListener)o.addEventListener(n,f,false);else o['on'+n]=f;},_remove:function(o,n,f){if(o){try{if(o.detachEvent)o.detachEvent('on'+n,f);else if(o.removeEventListener)o.removeEventListener(n,f,false);else o['on'+n]=null;}catch(ex){}}},_pageInit:function(){var e=Event;e._remove(window,'DOMContentLoaded',e._pageInit);e.domLoaded=true;each(e.inits,function(c){c();});e.inits=[];},_wait:function(){var t;if(window.tinyMCE_GZ&&tinyMCE_GZ.loaded){Event.domLoaded=1;return;}if(isIE&&document.location.protocol!='https:'){document.write('<script id=__ie_onload defer src=\'javascript:""\';><\/script>');DOM.get("__ie_onload").onreadystatechange=function(){if(this.readyState=="complete"){Event._pageInit();DOM.get("__ie_onload").onreadystatechange=null;}};}else{Event._add(window,'DOMContentLoaded',Event._pageInit,Event);if(isIE||isWebKit){t=setInterval(function(){if(/loaded|complete/.test(document.readyState)){clearInterval(t);Event._pageInit();}},10);}}}});Event=tinymce.dom.Event;Event._wait();tinymce.addUnload(Event._unload);})();(function(){var each=tinymce.each;tinymce.create('tinymce.dom.Element',{Element:function(id,s){var t=this,dom,el;s=s||{};t.id=id;t.dom=dom=s.dom||tinymce.DOM;t.settings=s;if(!tinymce.isIE)el=t.dom.get(t.id);each(['getPos','getRect','getParent','add','setStyle','getStyle','setStyles','setAttrib','setAttribs','getAttrib','addClass','removeClass','hasClass','getOuterHTML','setOuterHTML','remove','show','hide','isHidden','setHTML','get'],function(k){t[k]=function(){var a=arguments,o;if(tinymce.isOpera){a=[id];each(arguments,function(v){a.push(v);});}else Array.prototype.unshift.call(a,el||id);o=dom[k].apply(dom,a);t.update(k);return o;};});},on:function(n,f,s){return tinymce.dom.Event.add(this.id,n,f,s);},getXY:function(){return{x:parseInt(this.getStyle('left')),y:parseInt(this.getStyle('top'))};},getSize:function(){var n=this.dom.get(this.id);return{w:parseInt(this.getStyle('width')||n.clientWidth),h:parseInt(this.getStyle('height')||n.clientHeight)};},moveTo:function(x,y){this.setStyles({left:x,top:y});},moveBy:function(x,y){var p=this.getXY();this.moveTo(p.x+x,p.y+y);},resizeTo:function(w,h){this.setStyles({width:w,height:h});},resizeBy:function(w,h){var s=this.getSize();this.resizeTo(s.w+w,s.h+h);},update:function(k){var t=this,b,dom=t.dom;if(tinymce.isIE6&&t.settings.blocker){k=k||'';if(k.indexOf('get')===0||k.indexOf('has')===0||k.indexOf('is')===0)return;if(k=='remove'){dom.remove(t.blocker);return;}if(!t.blocker){t.blocker=dom.uniqueId();b=dom.add(t.settings.container||dom.getRoot(),'iframe',{id:t.blocker,style:'position:absolute;',frameBorder:0,src:'javascript:""'});dom.setStyle(b,'opacity',0);}else b=dom.get(t.blocker);dom.setStyle(b,'left',t.getStyle('left',1));dom.setStyle(b,'top',t.getStyle('top',1));dom.setStyle(b,'width',t.getStyle('width',1));dom.setStyle(b,'height',t.getStyle('height',1));dom.setStyle(b,'display',t.getStyle('display',1));dom.setStyle(b,'zIndex',parseInt(t.getStyle('zIndex',1)||0)-1);}}});})();(function(){function trimNl(s){return s.replace(/[\n\r]+/g,'');};var is=tinymce.is,isIE=tinymce.isIE,each=tinymce.each;tinymce.create('tinymce.dom.Selection',{Selection:function(dom,win,serializer){var t=this;t.dom=dom;t.win=win;t.serializer=serializer;tinymce.addUnload(t.destroy,t);},getContent:function(s){var t=this,r=t.getRng(),e=t.dom.create("body"),se=t.getSel(),wb,wa,n;s=s||{};wb=wa='';s.get=true;s.format=s.format||'html';if(s.format=='text')return t.isCollapsed()?'':(r.text||(se.toString?se.toString():''));if(r.cloneContents){n=r.cloneContents();if(n)e.appendChild(n);}else if(is(r.item)||is(r.htmlText))e.innerHTML=r.item?r.item(0).outerHTML:r.htmlText;else e.innerHTML=r.toString();if(/^\s/.test(e.innerHTML))wb=' ';if(/\s+$/.test(e.innerHTML))wa=' ';s.getInner=true;return t.isCollapsed()?'':wb+t.serializer.serialize(e,s)+wa;},setContent:function(h,s){var t=this,r=t.getRng(),d=t.win.document;s=s||{format:'html'};s.set=true;h=t.dom.processHTML(h);if(r.insertNode){if(tinymce.isGecko&&h.indexOf('<')==-1){r.deleteContents();r.insertNode(t.getRng().createContextualFragment(h+'<span id="__caret">_</span>'));t.select(t.dom.get('__caret'));t.getRng().deleteContents();return;}try{if(d.queryCommandEnabled('InsertHTML'))return d.execCommand('InsertHTML',false,h);}catch(ex){r.deleteContents();r.insertNode(t.getRng().createContextualFragment(h));}}else{if(r.item){d.execCommand('Delete',false,null);r=t.getRng();}r.pasteHTML(h);}},getStart:function(){var t=this,r=t.getRng(),e;if(isIE){if(r.item)return r.item(0);r=r.duplicate();r.collapse(1);e=r.parentElement();if(e&&e.nodeName=='BODY')return e.firstChild;return e;}else{e=r.startContainer;if(e.nodeName=='BODY')return e.firstChild;return t.dom.getParent(e,function(n){return n.nodeType==1;});}},getEnd:function(){var t=this,r=t.getRng(),e;if(isIE){if(r.item)return r.item(0);r=r.duplicate();r.collapse(0);e=r.parentElement();if(e&&e.nodeName=='BODY')return e.lastChild;return e;}else{e=r.endContainer;if(e.nodeName=='BODY')return e.lastChild;return t.dom.getParent(e,function(n){return n.nodeType==1;});}},getBookmark:function(si){var t=this,r=t.getRng(),tr,sx,sy,vp=t.dom.getViewPort(t.win),e,sp,bp,le,c=-0xFFFFFF,s,ro=t.dom.getRoot(),wb=0,wa=0,nv;sx=vp.x;sy=vp.y;if(si=='simple')return{rng:r,scrollX:sx,scrollY:sy};if(isIE){if(r.item){e=r.item(0);each(t.dom.select(e.nodeName),function(n,i){if(e==n){sp=i;return false;}});return{tag:e.nodeName,index:sp,scrollX:sx,scrollY:sy};}tr=t.dom.doc.body.createTextRange();tr.moveToElementText(ro);tr.collapse(true);bp=Math.abs(tr.move('character',c));tr=r.duplicate();tr.collapse(true);sp=Math.abs(tr.move('character',c));tr=r.duplicate();tr.collapse(false);le=Math.abs(tr.move('character',c))-sp;return{start:sp-bp,length:le,scrollX:sx,scrollY:sy};}e=t.getNode();s=t.getSel();if(!s)return null;if(e&&e.nodeName=='IMG'){return{scrollX:sx,scrollY:sy};}function getPos(r,sn,en){var w=t.dom.doc.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false),n,p=0,d={};while((n=w.nextNode())!=null){if(n==sn)d.start=p;if(n==en){d.end=p;return d;}p+=trimNl(n.nodeValue||'').length;}return null;};if(s.anchorNode==s.focusNode&&s.anchorOffset==s.focusOffset){e=getPos(ro,s.anchorNode,s.focusNode);if(!e)return{scrollX:sx,scrollY:sy};trimNl(s.anchorNode.nodeValue||'').replace(/^\s+/,function(a){wb=a.length;});return{start:Math.max(e.start+s.anchorOffset-wb,0),end:Math.max(e.end+s.focusOffset-wb,0),scrollX:sx,scrollY:sy,beg:s.anchorOffset-wb==0};}else{e=getPos(ro,r.startContainer,r.endContainer);if(!e)return{scrollX:sx,scrollY:sy};return{start:Math.max(e.start+r.startOffset-wb,0),end:Math.max(e.end+r.endOffset-wa,0),scrollX:sx,scrollY:sy,beg:r.startOffset-wb==0};}},moveToBookmark:function(b){var t=this,r=t.getRng(),s=t.getSel(),ro=t.dom.getRoot(),sd,nvl,nv;function getPos(r,sp,ep){var w=t.dom.doc.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false),n,p=0,d={},o,v,wa,wb;while((n=w.nextNode())!=null){wa=wb=0;nv=n.nodeValue||'';nvl=trimNl(nv).length;p+=nvl;if(p>=sp&&!d.startNode){o=sp-(p-nvl);if(b.beg&&o>=nvl)continue;d.startNode=n;d.startOffset=o+wb;}if(p>=ep){d.endNode=n;d.endOffset=ep-(p-nvl)+wb;return d;}}return null;};if(!b)return false;t.win.scrollTo(b.scrollX,b.scrollY);if(isIE){if(r=b.rng){try{r.select();}catch(ex){}return true;}t.win.focus();if(b.tag){r=ro.createControlRange();each(t.dom.select(b.tag),function(n,i){if(i==b.index)r.addElement(n);});}else{try{if(b.start<0)return true;r=s.createRange();r.moveToElementText(ro);r.collapse(true);r.moveStart('character',b.start);r.moveEnd('character',b.length);}catch(ex2){return true;}}try{r.select();}catch(ex){}return true;}if(!s)return false;if(b.rng){s.removeAllRanges();s.addRange(b.rng);}else{if(is(b.start)&&is(b.end)){try{sd=getPos(ro,b.start,b.end);if(sd){r=t.dom.doc.createRange();r.setStart(sd.startNode,sd.startOffset);r.setEnd(sd.endNode,sd.endOffset);s.removeAllRanges();s.addRange(r);}if(!tinymce.isOpera)t.win.focus();}catch(ex){}}}},select:function(n,c){var t=this,r=t.getRng(),s=t.getSel(),b,fn,ln,d=t.win.document;function first(n){return n?d.createTreeWalker(n,NodeFilter.SHOW_TEXT,null,false).nextNode():null;};function last(n){var c,o,w;if(!n)return null;w=d.createTreeWalker(n,NodeFilter.SHOW_TEXT,null,false);while(c=w.nextNode())o=c;return o;};if(isIE){try{b=d.body;if(/^(IMG|TABLE)$/.test(n.nodeName)){r=b.createControlRange();r.addElement(n);}else{r=b.createTextRange();r.moveToElementText(n);}r.select();}catch(ex){}}else{if(c){fn=first(n);ln=last(n);if(fn&&ln){r=d.createRange();r.setStart(fn,0);r.setEnd(ln,ln.nodeValue.length);}else r.selectNode(n);}else r.selectNode(n);t.setRng(r);}return n;},isCollapsed:function(){var t=this,r=t.getRng(),s=t.getSel();if(!r||r.item)return false;return!s||r.boundingWidth==0||s.isCollapsed;},collapse:function(b){var t=this,r=t.getRng(),n;if(r.item){n=r.item(0);r=this.win.document.body.createTextRange();r.moveToElementText(n);}r.collapse(!!b);t.setRng(r);},getSel:function(){var t=this,w=this.win;return w.getSelection?w.getSelection():w.document.selection;},getRng:function(){var t=this,s=t.getSel(),r;try{if(s)r=s.rangeCount>0?s.getRangeAt(0):(s.createRange?s.createRange():t.win.document.createRange());}catch(ex){}if(!r)r=isIE?t.win.document.body.createTextRange():t.win.document.createRange();return r;},setRng:function(r){var s;if(!isIE){s=this.getSel();if(s){s.removeAllRanges();s.addRange(r);}}else{try{r.select();}catch(ex){}}},setNode:function(n){var t=this;t.setContent(t.dom.getOuterHTML(n));return n;},getNode:function(){var t=this,r=t.getRng(),s=t.getSel(),e;if(!isIE){if(!r)return t.dom.getRoot();e=r.commonAncestorContainer;if(!r.collapsed){if(tinymce.isWebKit&&s.anchorNode&&s.anchorNode.nodeType==1)return s.anchorNode.childNodes[s.anchorOffset];if(r.startContainer==r.endContainer){if(r.startOffset-r.endOffset<2){if(r.startContainer.hasChildNodes())e=r.startContainer.childNodes[r.startOffset];}}}return t.dom.getParent(e,function(n){return n.nodeType==1;});}return r.item?r.item(0):r.parentElement();},destroy:function(s){var t=this;t.win=null;if(!s)tinymce.removeUnload(t.destroy);}});})();(function(){tinymce.create('tinymce.dom.XMLWriter',{node:null,XMLWriter:function(s){function getXML(){var i=document.implementation;if(!i||!i.createDocument){try{return new ActiveXObject('MSXML2.DOMDocument');}catch(ex){}try{return new ActiveXObject('Microsoft.XmlDom');}catch(ex){}}else return i.createDocument('','',null);};this.doc=getXML();this.valid=tinymce.isOpera||tinymce.isWebKit;this.reset();},reset:function(){var t=this,d=t.doc;if(d.firstChild)d.removeChild(d.firstChild);t.node=d.appendChild(d.createElement("html"));},writeStartElement:function(n){var t=this;t.node=t.node.appendChild(t.doc.createElement(n));},writeAttribute:function(n,v){if(this.valid)v=v.replace(/>/g,'%MCGT%');this.node.setAttribute(n,v);},writeEndElement:function(){this.node=this.node.parentNode;},writeFullEndElement:function(){var t=this,n=t.node;n.appendChild(t.doc.createTextNode(""));t.node=n.parentNode;},writeText:function(v){if(this.valid)v=v.replace(/>/g,'%MCGT%');this.node.appendChild(this.doc.createTextNode(v));},writeCDATA:function(v){this.node.appendChild(this.doc.createCDATA(v));},writeComment:function(v){this.node.appendChild(this.doc.createComment(v.replace(/\-\-/g,' ')));},getContent:function(){var h;h=this.doc.xml||new XMLSerializer().serializeToString(this.doc);h=h.replace(/<\?[^?]+\?>|<html>|<\/html>|<html\/>|<!DOCTYPE[^>]+>/g,'');h=h.replace(/ ?\/>/g,' />');if(this.valid)h=h.replace(/\%MCGT%/g,'&gt;');return h;}});})();(function(){tinymce.create('tinymce.dom.StringWriter',{str:null,tags:null,count:0,settings:null,indent:null,StringWriter:function(s){this.settings=tinymce.extend({indent_char:' ',indentation:1},s);this.reset();},reset:function(){this.indent='';this.str="";this.tags=[];this.count=0;},writeStartElement:function(n){this._writeAttributesEnd();this.writeRaw('<'+n);this.tags.push(n);this.inAttr=true;this.count++;this.elementCount=this.count;},writeAttribute:function(n,v){var t=this;t.writeRaw(" "+t.encode(n)+'="'+t.encode(v)+'"');},writeEndElement:function(){var n;if(this.tags.length>0){n=this.tags.pop();if(this._writeAttributesEnd(1))this.writeRaw('</'+n+'>');if(this.settings.indentation>0)this.writeRaw('\n');}},writeFullEndElement:function(){if(this.tags.length>0){this._writeAttributesEnd();this.writeRaw('</'+this.tags.pop()+'>');if(this.settings.indentation>0)this.writeRaw('\n');}},writeText:function(v){this._writeAttributesEnd();this.writeRaw(this.encode(v));this.count++;},writeCDATA:function(v){this._writeAttributesEnd();this.writeRaw('<![CDATA['+v+']]>');this.count++;},writeComment:function(v){this._writeAttributesEnd();this.writeRaw('<!-- '+v+'-->');this.count++;},writeRaw:function(v){this.str+=v;},encode:function(s){return s.replace(/[<>&"]/g,function(v){switch(v){case'<':return'&lt;';case'>':return'&gt;';case'&':return'&amp;';case'"':return'&quot;';}return v;});},getContent:function(){return this.str;},_writeAttributesEnd:function(s){if(!this.inAttr)return;this.inAttr=false;if(s&&this.elementCount==this.count){this.writeRaw(' />');return false;}this.writeRaw('>');return true;}});})();(function(){var extend=tinymce.extend,each=tinymce.each,Dispatcher=tinymce.util.Dispatcher,isIE=tinymce.isIE,isGecko=tinymce.isGecko;function getIEAtts(n){var o=[];if(n.nodeName=='OBJECT')return n.attributes;n.cloneNode(false).outerHTML.replace(/([a-z0-9\:\-_]+)=/gi,function(a,b){o.push({specified:1,nodeName:b});});return o;};function wildcardToRE(s){return s.replace(/([?+*])/g,'.$1');};tinymce.create('tinymce.dom.Serializer',{Serializer:function(s){var t=this;t.key=0;t.onPreProcess=new Dispatcher(t);t.onPostProcess=new Dispatcher(t);if(tinymce.relaxedDomain&&tinymce.isGecko){t.writer=new tinymce.dom.StringWriter();}else{try{t.writer=new tinymce.dom.XMLWriter();}catch(ex){t.writer=new tinymce.dom.StringWriter();}}t.settings=s=extend({dom:tinymce.DOM,valid_nodes:0,node_filter:0,attr_filter:0,invalid_attrs:/^(mce_|_moz_)/,closed:/(br|hr|input|meta|img|link|param)/,entity_encoding:'named',entities:'160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro',valid_elements:'*[*]',extended_valid_elements:0,valid_child_elements:0,invalid_elements:0,fix_table_elements:0,fix_list_elements:true,fix_content_duplication:true,convert_fonts_to_spans:false,font_size_classes:0,font_size_style_values:0,apply_source_formatting:0,indent_mode:'simple',indent_char:'\t',indent_levels:1,remove_linebreaks:1},s);t.dom=s.dom;if(s.fix_list_elements){t.onPreProcess.add(function(se,o){var nl,x,a=['ol','ul'],i,n,p,r=/^(OL|UL)$/,np;function prevNode(e,n){var a=n.split(','),i;while((e=e.previousSibling)!=null){for(i=0;i<a.length;i++){if(e.nodeName==a[i])return e;}}return null;};for(x=0;x<a.length;x++){nl=t.dom.select(a[x],o.node);for(i=0;i<nl.length;i++){n=nl[i];p=n.parentNode;if(r.test(p.nodeName)){np=prevNode(n,'LI');if(!np){np=t.dom.create('li');np.innerHTML='&nbsp;';np.appendChild(n);p.insertBefore(np,p.firstChild);}else np.appendChild(n);}}}});}if(s.fix_table_elements){t.onPreProcess.add(function(se,o){each(t.dom.select('table',o.node),function(e){var pa=t.dom.getParent(e,'H1,H2,H3,H4,H5,H6,P'),pa2,n,tm,pl=[],i,ns;if(pa){pa2=pa.cloneNode(false);pl.push(e);for(n=e;n=n.parentNode;){pl.push(n);if(n==pa)break;}tm=pa2;for(i=pl.length-1;i>=0;i--){if(i==pl.length-1){while(ns=pl[i-1].nextSibling)tm.appendChild(ns.parentNode.removeChild(ns));}else{n=pl[i].cloneNode(false);if(i!=0){while(ns=pl[i-1].nextSibling)n.appendChild(ns.parentNode.removeChild(ns));}tm=tm.appendChild(n);}}e=t.dom.insertAfter(e.parentNode.removeChild(e),pa);t.dom.insertAfter(e,pa);t.dom.insertAfter(pa2,e);}});});}},setEntities:function(s){var t=this,a,i,l={},re='',v;if(t.entityLookup)return;a=s.split(',');for(i=0;i<a.length;i+=2){v=a[i];if(v==34||v==38||v==60||v==62)continue;l[String.fromCharCode(a[i])]=a[i+1];v=parseInt(a[i]).toString(16);re+='\\u'+'0000'.substring(v.length)+v;}if(!re){t.settings.entity_encoding='raw';return;}t.entitiesRE=new RegExp('['+re+']','g');t.entityLookup=l;},setValidChildRules:function(s){this.childRules=null;this.addValidChildRules(s);},addValidChildRules:function(s){var t=this,inst,intr,bloc;if(!s)return;inst='A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment';intr='A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment';bloc='H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP';each(s.split(','),function(s){var p=s.split(/\[|\]/),re;s='';each(p[1].split('|'),function(v){if(s)s+='|';switch(v){case'%itrans':v=intr;break;case'%itrans_na':v=intr.substring(2);break;case'%istrict':v=inst;break;case'%istrict_na':v=inst.substring(2);break;case'%btrans':v=bloc;break;case'%bstrict':v=bloc;break;}s+=v;});re=new RegExp('^('+s.toLowerCase()+')$','i');each(p[0].split('/'),function(s){t.childRules=t.childRules||{};t.childRules[s]=re;});});s='';each(t.childRules,function(v,k){if(s)s+='|';s+=k;});t.parentElementsRE=new RegExp('^('+s.toLowerCase()+')$','i');},setRules:function(s){var t=this;t._setup();t.rules={};t.wildRules=[];t.validElements={};return t.addRules(s);},addRules:function(s){var t=this,dr;if(!s)return;t._setup();each(s.split(','),function(s){var p=s.split(/\[|\]/),tn=p[0].split('/'),ra,at,wat,va=[];if(dr)at=tinymce.extend([],dr.attribs);if(p.length>1){each(p[1].split('|'),function(s){var ar={},i;at=at||[];s=s.replace(/::/g,'~');s=/^([!\-])?([\w*.?~_\-]+|)([=:<])?(.+)?$/.exec(s);s[2]=s[2].replace(/~/g,':');if(s[1]=='!'){ra=ra||[];ra.push(s[2]);}if(s[1]=='-'){for(i=0;i<at.length;i++){if(at[i].name==s[2]){at.splice(i,1);return;}}}switch(s[3]){case'=':ar.defaultVal=s[4]||'';break;case':':ar.forcedVal=s[4];break;case'<':ar.validVals=s[4].split('?');break;}if(/[*.?]/.test(s[2])){wat=wat||[];ar.nameRE=new RegExp('^'+wildcardToRE(s[2])+'$');wat.push(ar);}else{ar.name=s[2];at.push(ar);}va.push(s[2]);});}each(tn,function(s,i){var pr=s.charAt(0),x=1,ru={};if(dr){if(dr.noEmpty)ru.noEmpty=dr.noEmpty;if(dr.fullEnd)ru.fullEnd=dr.fullEnd;if(dr.padd)ru.padd=dr.padd;}switch(pr){case'-':ru.noEmpty=true;break;case'+':ru.fullEnd=true;break;case'#':ru.padd=true;break;default:x=0;}tn[i]=s=s.substring(x);t.validElements[s]=1;if(/[*.?]/.test(tn[0])){ru.nameRE=new RegExp('^'+wildcardToRE(tn[0])+'$');t.wildRules=t.wildRules||{};t.wildRules.push(ru);}else{ru.name=tn[0];if(tn[0]=='@')dr=ru;t.rules[s]=ru;}ru.attribs=at;if(ra)ru.requiredAttribs=ra;if(wat){s='';each(va,function(v){if(s)s+='|';s+='('+wildcardToRE(v)+')';});ru.validAttribsRE=new RegExp('^'+s.toLowerCase()+'$');ru.wildAttribs=wat;}});});s='';each(t.validElements,function(v,k){if(s)s+='|';if(k!='@')s+=k;});t.validElementsRE=new RegExp('^('+wildcardToRE(s.toLowerCase())+')$');},findRule:function(n){var t=this,rl=t.rules,i,r;t._setup();r=rl[n];if(r)return r;rl=t.wildRules;for(i=0;i<rl.length;i++){if(rl[i].nameRE.test(n))return rl[i];}return null;},findAttribRule:function(ru,n){var i,wa=ru.wildAttribs;for(i=0;i<wa.length;i++){if(wa[i].nameRE.test(n))return wa[i];}return null;},serialize:function(n,o){var h,t=this;t._setup();o=o||{};o.format=o.format||'html';t.processObj=o;n=n.cloneNode(true);t.key=''+(parseInt(t.key)+1);if(!o.no_events){o.node=n;t.onPreProcess.dispatch(t,o);}t.writer.reset();t._serializeNode(n,o.getInner);o.content=t.writer.getContent();if(!o.no_events)t.onPostProcess.dispatch(t,o);t._postProcess(o);o.node=null;return tinymce.trim(o.content);},_postProcess:function(o){var t=this,s=t.settings,h=o.content,sc=[],p;if(o.format=='html'){p=t._protect({content:h,patterns:[{pattern:/(<script[^>]*>)(.*?)(<\/script>)/g},{pattern:/(<style[^>]*>)(.*?)(<\/style>)/g},{pattern:/(<pre[^>]*>)(.*?)(<\/pre>)/g,encode:1}]});h=p.content;if(s.entity_encoding!=='raw')h=t._encode(h);if(!o.set){h=h.replace(/<p>\s+<\/p>|<p([^>]+)>\s+<\/p>/g,s.entity_encoding=='numeric'?'<p$1>&#160;</p>':'<p$1>&nbsp;</p>');if(s.remove_linebreaks){h=h.replace(/\r?\n|\r/g,' ');h=h.replace(/(<[^>]+>)\s+/g,'$1 ');h=h.replace(/\s+(<\/[^>]+>)/g,' $1');h=h.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object) ([^>]+)>\s+/g,'<$1 $2>');h=h.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>\s+/g,'<$1>');h=h.replace(/\s+<\/(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>/g,'</$1>');}if(s.apply_source_formatting&&s.indent_mode=='simple'){h=h.replace(/<(\/?)(ul|hr|table|meta|link|tbody|tr|object|body|head|html|map)(|[^>]+)>\s*/g,'\n<$1$2$3>\n');h=h.replace(/\s*<(p|h[1-6]|blockquote|div|title|style|pre|script|td|li|area)(|[^>]+)>/g,'\n<$1$2>');h=h.replace(/<\/(p|h[1-6]|blockquote|div|title|style|pre|script|td|li)>\s*/g,'</$1>\n');h=h.replace(/\n\n/g,'\n');}}h=t._unprotect(h,p);if(s.entity_encoding=='raw')h=h.replace(/<p>&nbsp;<\/p>|<p([^>]+)>&nbsp;<\/p>/g,'<p$1>\u00a0</p>');}o.content=h;},_serializeNode:function(n,inn){var t=this,s=t.settings,w=t.writer,hc,el,cn,i,l,a,at,no,v,nn,ru,ar,iv;if(!s.node_filter||s.node_filter(n)){switch(n.nodeType){case 1:if(n.hasAttribute?n.hasAttribute('mce_bogus'):n.getAttribute('mce_bogus'))return;iv=false;hc=n.hasChildNodes();nn=n.getAttribute('mce_name')||n.nodeName.toLowerCase();if(isIE){if(n.scopeName!=='HTML'&&n.scopeName!=='html')nn=n.scopeName+':'+nn;}if(nn.indexOf('mce:')===0)nn=nn.substring(4);if(!t.validElementsRE.test(nn)||(t.invalidElementsRE&&t.invalidElementsRE.test(nn))||inn){iv=true;break;}if(isIE){if(s.fix_content_duplication){if(n.mce_serialized==t.key)return;n.mce_serialized=t.key;}if(nn.charAt(0)=='/')nn=nn.substring(1);}else if(isGecko){if(n.nodeName==='BR'&&n.getAttribute('type')=='_moz')return;}if(t.childRules){if(t.parentElementsRE.test(t.elementName)){if(!t.childRules[t.elementName].test(nn)){iv=true;break;}}t.elementName=nn;}ru=t.findRule(nn);nn=ru.name||nn;if((!hc&&ru.noEmpty)||(isIE&&!nn)){iv=true;break;}if(ru.requiredAttribs){a=ru.requiredAttribs;for(i=a.length-1;i>=0;i--){if(this.dom.getAttrib(n,a[i])!=='')break;}if(i==-1){iv=true;break;}}w.writeStartElement(nn);if(ru.attribs){for(i=0,at=ru.attribs,l=at.length;i<l;i++){a=at[i];v=t._getAttrib(n,a);if(v!==null)w.writeAttribute(a.name,v);}}if(ru.validAttribsRE){at=isIE?getIEAtts(n):n.attributes;for(i=at.length-1;i>-1;i--){no=at[i];if(no.specified){a=no.nodeName.toLowerCase();if(s.invalid_attrs.test(a)||!ru.validAttribsRE.test(a))continue;ar=t.findAttribRule(ru,a);v=t._getAttrib(n,ar,a);if(v!==null)w.writeAttribute(a,v);}}}if(!hc&&ru.padd)w.writeText('\u00a0');break;case 3:if(t.childRules&&t.parentElementsRE.test(t.elementName)){if(!t.childRules[t.elementName].test(n.nodeName))return;}return w.writeText(n.nodeValue);case 4:return w.writeCDATA(n.nodeValue);case 8:return w.writeComment(n.nodeValue);}}else if(n.nodeType==1)hc=n.hasChildNodes();if(hc){cn=n.firstChild;while(cn){t._serializeNode(cn);t.elementName=nn;cn=cn.nextSibling;}}if(!iv){if(hc||!s.closed.test(nn))w.writeFullEndElement();else w.writeEndElement();}},_protect:function(o){var t=this;o.items=o.items||[];function enc(s){return s.replace(/[\r\n\\]/g,function(c){if(c==='\n')return'\\n';else if(c==='\\')return'\\\\';return'\\r';});};function dec(s){return s.replace(/\\[\\rn]/g,function(c){if(c==='\\n')return'\n';else if(c==='\\\\')return'\\';return'\r';});};each(o.patterns,function(p){o.content=dec(enc(o.content).replace(p.pattern,function(x,a,b,c){b=dec(b);if(p.encode)b=t._encode(b);o.items.push(b);return a+'<!--mce:'+(o.items.length-1)+'-->'+c;}));});return o;},_unprotect:function(h,o){h=h.replace(/\<!--mce:([0-9]+)--\>/g,function(a,b){return o.items[parseInt(b)];});o.items=[];return h;},_encode:function(h){var t=this,s=t.settings,l;if(s.entity_encoding!=='raw'){if(s.entity_encoding.indexOf('named')!=-1){t.setEntities(s.entities);l=t.entityLookup;h=h.replace(t.entitiesRE,function(a){var v;if(v=l[a])a='&'+v+';';return a;});}if(s.entity_encoding.indexOf('numeric')!=-1){h=h.replace(/[\u007E-\uFFFF]/g,function(a){return'&#'+a.charCodeAt(0)+';';});}}return h;},_setup:function(){var t=this,s=this.settings;if(t.done)return;t.done=1;t.setRules(s.valid_elements);t.addRules(s.extended_valid_elements);t.addValidChildRules(s.valid_child_elements);if(s.invalid_elements)t.invalidElementsRE=new RegExp('^('+wildcardToRE(s.invalid_elements.replace(/,/g,'|').toLowerCase())+')$');if(s.attrib_value_filter)t.attribValueFilter=s.attribValueFilter;},_getAttrib:function(n,a,na){var i,v;na=na||a.name;if(a.forcedVal&&(v=a.forcedVal)){if(v==='{$uid}')return this.dom.uniqueId();return v;}v=this.dom.getAttrib(n,na);switch(na){case'rowspan':case'colspan':if(v=='1')v='';break;}if(this.attribValueFilter)v=this.attribValueFilter(na,v,n);if(a.validVals){for(i=a.validVals.length-1;i>=0;i--){if(v==a.validVals[i])break;}if(i==-1)return null;}if(v===''&&typeof(a.defaultVal)!='undefined'){v=a.defaultVal;if(v==='{$uid}')return this.dom.uniqueId();return v;}else{if(na=='class'&&this.processObj.get)v=v.replace(/\s?mceItem\w+\s?/g,'');}if(v==='')return null;return v;}});})();(function(){var each=tinymce.each;tinymce.create('tinymce.dom.ScriptLoader',{ScriptLoader:function(s){this.settings=s||{};this.queue=[];this.lookup={};},isDone:function(u){return this.lookup[u]?this.lookup[u].state==2:0;},markDone:function(u){this.lookup[u]={state:2,url:u};},add:function(u,cb,s,pr){var t=this,lo=t.lookup,o;if(o=lo[u]){if(cb&&o.state==2)cb.call(s||this);return o;}o={state:0,url:u,func:cb,scope:s||this};if(pr)t.queue.unshift(o);else t.queue.push(o);lo[u]=o;return o;},load:function(u,cb,s){var t=this,o;if(o=t.lookup[u]){if(cb&&o.state==2)cb.call(s||t);return o;}function loadScript(u){if(tinymce.dom.Event.domLoaded||t.settings.strict_mode){tinymce.util.XHR.send({url:tinymce._addVer(u),error:t.settings.error,async:false,success:function(co){t.eval(co);}});}else document.write('<script type="text/javascript" src="'+tinymce._addVer(u)+'"></script>');};if(!tinymce.is(u,'string')){each(u,function(u){loadScript(u);});if(cb)cb.call(s||t);}else{loadScript(u);if(cb)cb.call(s||t);}},loadQueue:function(cb,s){var t=this;if(!t.queueLoading){t.queueLoading=1;t.queueCallbacks=[];t.loadScripts(t.queue,function(){t.queueLoading=0;if(cb)cb.call(s||t);each(t.queueCallbacks,function(o){o.func.call(o.scope);});});}else if(cb)t.queueCallbacks.push({func:cb,scope:s||t});},eval:function(co){var w=window;if(!w.execScript){try{eval.call(w,co);}catch(ex){eval(co,w);}}else w.execScript(co);},loadScripts:function(sc,cb,s){var t=this,lo=t.lookup;function done(o){o.state=2;if(o.func)o.func.call(o.scope||t);};function allDone(){var l;l=sc.length;each(sc,function(o){o=lo[o.url];if(o.state===2){done(o);l--;}else load(o);});if(l===0&&cb){cb.call(s||t);cb=0;}};function load(o){if(o.state>0)return;o.state=1;tinymce.util.XHR.send({url:o.url,error:t.settings.error,success:function(co){t.eval(co);done(o);allDone();}});};each(sc,function(o){var u=o.url;if(!lo[u]){lo[u]=o;t.queue.push(o);}else o=lo[u];if(o.state>0)return;if(!tinymce.dom.Event.domLoaded&&!t.settings.strict_mode){var ix,ol='';if(cb||o.func){o.state=1;ix=tinymce.dom.ScriptLoader._addOnLoad(function(){done(o);allDone();});if(tinymce.isIE)ol=' onreadystatechange="';else ol=' onload="';ol+='tinymce.dom.ScriptLoader._onLoad(this,\''+u+'\','+ix+');"';}document.write('<script type="text/javascript" src="'+tinymce._addVer(u)+'"'+ol+'></script>');if(!o.func)done(o);}else load(o);});allDone();},'static':{_addOnLoad:function(f){var t=this;t._funcs=t._funcs||[];t._funcs.push(f);return t._funcs.length-1;},_onLoad:function(e,u,ix){if(!tinymce.isIE||e.readyState=='complete')this._funcs[ix].call(this);}}});tinymce.ScriptLoader=new tinymce.dom.ScriptLoader();})();(function(){var DOM=tinymce.DOM,is=tinymce.is;tinymce.create('tinymce.ui.Control',{Control:function(id,s){this.id=id;this.settings=s=s||{};this.rendered=false;this.onRender=new tinymce.util.Dispatcher(this);this.classPrefix='';this.scope=s.scope||this;this.disabled=0;this.active=0;},setDisabled:function(s){var e;if(s!=this.disabled){e=DOM.get(this.id);if(e&&this.settings.unavailable_prefix){if(s){this.prevTitle=e.title;e.title=this.settings.unavailable_prefix+": "+e.title;}else e.title=this.prevTitle;}this.setState('Disabled',s);this.setState('Enabled',!s);this.disabled=s;}},isDisabled:function(){return this.disabled;},setActive:function(s){if(s!=this.active){this.setState('Active',s);this.active=s;}},isActive:function(){return this.active;},setState:function(c,s){var n=DOM.get(this.id);c=this.classPrefix+c;if(s)DOM.addClass(n,c);else DOM.removeClass(n,c);},isRendered:function(){return this.rendered;},renderHTML:function(){},renderTo:function(n){DOM.setHTML(n,this.renderHTML());},postRender:function(){var t=this,b;if(is(t.disabled)){b=t.disabled;t.disabled=-1;t.setDisabled(b);}if(is(t.active)){b=t.active;t.active=-1;t.setActive(b);}},remove:function(){DOM.remove(this.id);this.destroy();},destroy:function(){tinymce.dom.Event.clear(this.id);}});})();tinymce.create('tinymce.ui.Container:tinymce.ui.Control',{Container:function(id,s){this.parent(id,s);this.controls=[];this.lookup={};},add:function(c){this.lookup[c.id]=c;this.controls.push(c);return c;},get:function(n){return this.lookup[n];}});tinymce.create('tinymce.ui.Separator:tinymce.ui.Control',{Separator:function(id,s){this.parent(id,s);this.classPrefix='mceSeparator';},renderHTML:function(){return tinymce.DOM.createHTML('span',{'class':this.classPrefix});}});(function(){var is=tinymce.is,DOM=tinymce.DOM,each=tinymce.each,walk=tinymce.walk;tinymce.create('tinymce.ui.MenuItem:tinymce.ui.Control',{MenuItem:function(id,s){this.parent(id,s);this.classPrefix='mceMenuItem';},setSelected:function(s){this.setState('Selected',s);this.selected=s;},isSelected:function(){return this.selected;},postRender:function(){var t=this;t.parent();if(is(t.selected))t.setSelected(t.selected);}});})();(function(){var is=tinymce.is,DOM=tinymce.DOM,each=tinymce.each,walk=tinymce.walk;tinymce.create('tinymce.ui.Menu:tinymce.ui.MenuItem',{Menu:function(id,s){var t=this;t.parent(id,s);t.items={};t.collapsed=false;t.menuCount=0;t.onAddItem=new tinymce.util.Dispatcher(this);},expand:function(d){var t=this;if(d){walk(t,function(o){if(o.expand)o.expand();},'items',t);}t.collapsed=false;},collapse:function(d){var t=this;if(d){walk(t,function(o){if(o.collapse)o.collapse();},'items',t);}t.collapsed=true;},isCollapsed:function(){return this.collapsed;},add:function(o){if(!o.settings)o=new tinymce.ui.MenuItem(o.id||DOM.uniqueId(),o);this.onAddItem.dispatch(this,o);return this.items[o.id]=o;},addSeparator:function(){return this.add({separator:true});},addMenu:function(o){if(!o.collapse)o=this.createMenu(o);this.menuCount++;return this.add(o);},hasMenus:function(){return this.menuCount!==0;},remove:function(o){delete this.items[o.id];},removeAll:function(){var t=this;walk(t,function(o){if(o.removeAll)o.removeAll();else o.remove();o.destroy();},'items',t);t.items={};},createMenu:function(o){var m=new tinymce.ui.Menu(o.id||DOM.uniqueId(),o);m.onAddItem.add(this.onAddItem.dispatch,this.onAddItem);return m;}});})();(function(){var is=tinymce.is,DOM=tinymce.DOM,each=tinymce.each,Event=tinymce.dom.Event,Element=tinymce.dom.Element;tinymce.create('tinymce.ui.DropMenu:tinymce.ui.Menu',{DropMenu:function(id,s){s=s||{};s.container=s.container||DOM.doc.body;s.offset_x=s.offset_x||0;s.offset_y=s.offset_y||0;s.vp_offset_x=s.vp_offset_x||0;s.vp_offset_y=s.vp_offset_y||0;if(is(s.icons)&&!s.icons)s['class']+=' mceNoIcons';this.parent(id,s);this.onShowMenu=new tinymce.util.Dispatcher(this);this.onHideMenu=new tinymce.util.Dispatcher(this);this.classPrefix='mceMenu';},createMenu:function(s){var t=this,cs=t.settings,m;s.container=s.container||cs.container;s.parent=t;s.constrain=s.constrain||cs.constrain;s['class']=s['class']||cs['class'];s.vp_offset_x=s.vp_offset_x||cs.vp_offset_x;s.vp_offset_y=s.vp_offset_y||cs.vp_offset_y;m=new tinymce.ui.DropMenu(s.id||DOM.uniqueId(),s);m.onAddItem.add(t.onAddItem.dispatch,t.onAddItem);return m;},update:function(){var t=this,s=t.settings,tb=DOM.get('menu_'+t.id+'_tbl'),co=DOM.get('menu_'+t.id+'_co'),tw,th;tw=s.max_width?Math.min(tb.clientWidth,s.max_width):tb.clientWidth;th=s.max_height?Math.min(tb.clientHeight,s.max_height):tb.clientHeight;if(!DOM.boxModel)t.element.setStyles({width:tw+2,height:th+2});else t.element.setStyles({width:tw,height:th});if(s.max_width)DOM.setStyle(co,'width',tw);if(s.max_height){DOM.setStyle(co,'height',th);if(tb.clientHeight<s.max_height)DOM.setStyle(co,'overflow','hidden');}},showMenu:function(x,y,px){var t=this,s=t.settings,co,vp=DOM.getViewPort(),w,h,mx,my,ot=2,dm,tb,cp=t.classPrefix;t.collapse(1);if(t.isMenuVisible)return;if(!t.rendered){co=DOM.add(t.settings.container,t.renderNode());each(t.items,function(o){o.postRender();});t.element=new Element('menu_'+t.id,{blocker:1,container:s.container});}else co=DOM.get('menu_'+t.id);if(!tinymce.isOpera)DOM.setStyles(co,{left:-0xFFFF,top:-0xFFFF});DOM.show(co);t.update();x+=s.offset_x||0;y+=s.offset_y||0;vp.w-=4;vp.h-=4;if(s.constrain){w=co.clientWidth-ot;h=co.clientHeight-ot;mx=vp.x+vp.w;my=vp.y+vp.h;if((x+s.vp_offset_x+w)>mx)x=px?px-w:Math.max(0,(mx-s.vp_offset_x)-w);if((y+s.vp_offset_y+h)>my)y=Math.max(0,(my-s.vp_offset_y)-h);}DOM.setStyles(co,{left:x,top:y});t.element.update();t.isMenuVisible=1;t.mouseClickFunc=Event.add(co,'click',function(e){var m;e=e.target;if(e&&(e=DOM.getParent(e,'TR'))&&!DOM.hasClass(e,cp+'ItemSub')){m=t.items[e.id];if(m.isDisabled())return;dm=t;while(dm){if(dm.hideMenu)dm.hideMenu();dm=dm.settings.parent;}if(m.settings.onclick)m.settings.onclick(e);return Event.cancel(e);}});if(t.hasMenus()){t.mouseOverFunc=Event.add(co,'mouseover',function(e){var m,r,mi;e=e.target;if(e&&(e=DOM.getParent(e,'TR'))){m=t.items[e.id];if(t.lastMenu)t.lastMenu.collapse(1);if(m.isDisabled())return;if(e&&DOM.hasClass(e,cp+'ItemSub')){r=DOM.getRect(e);m.showMenu((r.x+r.w-ot),r.y-ot,r.x);t.lastMenu=m;DOM.addClass(DOM.get(m.id).firstChild,cp+'ItemActive');}}});}t.onShowMenu.dispatch(t);if(s.keyboard_focus){Event.add(co,'keydown',t._keyHandler,t);DOM.select('a','menu_'+t.id)[0].focus();t._focusIdx=0;}},hideMenu:function(c){var t=this,co=DOM.get('menu_'+t.id),e;if(!t.isMenuVisible)return;Event.remove(co,'mouseover',t.mouseOverFunc);Event.remove(co,'click',t.mouseClickFunc);Event.remove(co,'keydown',t._keyHandler);DOM.hide(co);t.isMenuVisible=0;if(!c)t.collapse(1);if(t.element)t.element.hide();if(e=DOM.get(t.id))DOM.removeClass(e.firstChild,t.classPrefix+'ItemActive');t.onHideMenu.dispatch(t);},add:function(o){var t=this,co;o=t.parent(o);if(t.isRendered&&(co=DOM.get('menu_'+t.id)))t._add(DOM.select('tbody',co)[0],o);return o;},collapse:function(d){this.parent(d);this.hideMenu(1);},remove:function(o){DOM.remove(o.id);this.destroy();return this.parent(o);},destroy:function(){var t=this,co=DOM.get('menu_'+t.id);Event.remove(co,'mouseover',t.mouseOverFunc);Event.remove(co,'click',t.mouseClickFunc);if(t.element)t.element.remove();DOM.remove(co);},renderNode:function(){var t=this,s=t.settings,n,tb,co,w;w=DOM.create('div',{id:'menu_'+t.id,'class':s['class'],'style':'position:absolute;left:0;top:0;z-index:200000'});co=DOM.add(w,'div',{id:'menu_'+t.id+'_co','class':t.classPrefix+(s['class']?' '+s['class']:'')});t.element=new Element('menu_'+t.id,{blocker:1,container:s.container});if(s.menu_line)DOM.add(co,'span',{'class':t.classPrefix+'Line'});n=DOM.add(co,'table',{id:'menu_'+t.id+'_tbl',border:0,cellPadding:0,cellSpacing:0});tb=DOM.add(n,'tbody');each(t.items,function(o){t._add(tb,o);});t.rendered=true;return w;},_keyHandler:function(e){var t=this,kc=e.keyCode;function focus(d){var i=t._focusIdx+d,e=DOM.select('a','menu_'+t.id)[i];if(e){t._focusIdx=i;e.focus();}};switch(kc){case 38:focus(-1);return;case 40:focus(1);return;case 13:return;case 27:return this.hideMenu();}},_add:function(tb,o){var n,s=o.settings,a,ro,it,cp=this.classPrefix;if(s.separator){ro=DOM.add(tb,'tr',{id:o.id,'class':cp+'ItemSeparator'});DOM.add(ro,'td',{'class':cp+'ItemSeparator'});if(n=ro.previousSibling)DOM.addClass(n,'mceLast');return;}n=ro=DOM.add(tb,'tr',{id:o.id,'class':cp+'Item '+cp+'ItemEnabled'});n=it=DOM.add(n,'td');n=a=DOM.add(n,'a',{href:'javascript:;',onclick:"return false;",onmousedown:'return false;'});DOM.addClass(it,s['class']);DOM.add(n,'span',{'class':'mceIcon'+(s.icon?' mce_'+s.icon:'')});n=DOM.add(n,s.element||'span',{'class':'mceText',title:o.settings.title},o.settings.title);if(o.settings.style)DOM.setAttrib(n,'style',o.settings.style);if(tb.childNodes.length==1)DOM.addClass(ro,'mceFirst');if((n=ro.previousSibling)&&DOM.hasClass(n,cp+'ItemSeparator'))DOM.addClass(ro,'mceFirst');if(o.collapse)DOM.addClass(ro,cp+'ItemSub');if(n=ro.previousSibling)DOM.removeClass(n,'mceLast');DOM.addClass(ro,'mceLast');}});})();(function(){var DOM=tinymce.DOM;tinymce.create('tinymce.ui.Button:tinymce.ui.Control',{Button:function(id,s){this.parent(id,s);this.classPrefix='mceButton';},renderHTML:function(){var cp=this.classPrefix,s=this.settings,h,l;l=DOM.encode(s.label||'');h='<a id="'+this.id+'" href="javascript:;" class="'+cp+' '+cp+'Enabled '+s['class']+(l?' '+cp+'Labeled':'')+'" onmousedown="return false;" onclick="return false;" title="'+DOM.encode(s.title)+'">';if(s.image)h+='<img class="mceIcon" src="'+s.image+'" />'+l+'</a>';else h+='<span class="mceIcon '+s['class']+'"></span>'+(l?'<span class="'+cp+'Label">'+l+'</span>':'')+'</a>';return h;},postRender:function(){var t=this,s=t.settings;tinymce.dom.Event.add(t.id,'click',function(e){if(!t.isDisabled())return s.onclick.call(s.scope,e);});}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each,Dispatcher=tinymce.util.Dispatcher;tinymce.create('tinymce.ui.ListBox:tinymce.ui.Control',{ListBox:function(id,s){var t=this;t.parent(id,s);t.items=[];t.onChange=new Dispatcher(t);t.onPostRender=new Dispatcher(t);t.onAdd=new Dispatcher(t);t.onRenderMenu=new tinymce.util.Dispatcher(this);t.classPrefix='mceListBox';},select:function(v){var t=this,e,fv;if(v!=t.selectedValue){e=DOM.get(t.id+'_text');t.selectedValue=v;each(t.items,function(o){if(o.value==v){DOM.setHTML(e,DOM.encode(o.title));fv=1;return false;}});if(!fv){DOM.setHTML(e,DOM.encode(t.settings.title));DOM.addClass(e,'mceTitle');e=0;return;}else DOM.removeClass(e,'mceTitle');}e=0;},add:function(n,v,o){var t=this;o=o||{};o=tinymce.extend(o,{title:n,value:v});t.items.push(o);t.onAdd.dispatch(t,o);},getLength:function(){return this.items.length;},renderHTML:function(){var h='',t=this,s=t.settings,cp=t.classPrefix;h='<table id="'+t.id+'" cellpadding="0" cellspacing="0" class="'+cp+' '+cp+'Enabled'+(s['class']?(' '+s['class']):'')+'"><tbody><tr>';h+='<td>'+DOM.createHTML('a',{id:t.id+'_text',href:'javascript:;','class':'mceText',onclick:"return false;",onmousedown:'return false;'},DOM.encode(t.settings.title))+'</td>';h+='<td>'+DOM.createHTML('a',{id:t.id+'_open',tabindex:-1,href:'javascript:;','class':'mceOpen',onclick:"return false;",onmousedown:'return false;'},'<span></span>')+'</td>';h+='</tr></tbody></table>';return h;},showMenu:function(){var t=this,p1,p2,e=DOM.get(this.id),m;if(t.isDisabled()||t.items.length==0)return;if(t.menu&&t.menu.isMenuVisible)return t.hideMenu();if(!t.isMenuRendered){t.renderMenu();t.isMenuRendered=true;}p1=DOM.getPos(this.settings.menu_container);p2=DOM.getPos(e);m=t.menu;m.settings.offset_x=p2.x;m.settings.offset_y=p2.y;m.settings.keyboard_focus=!tinymce.isOpera;if(t.oldID)m.items[t.oldID].setSelected(0);each(t.items,function(o){if(o.value===t.selectedValue){m.items[o.id].setSelected(1);t.oldID=o.id;}});m.showMenu(0,e.clientHeight);Event.add(DOM.doc,'mousedown',t.hideMenu,t);DOM.addClass(t.id,t.classPrefix+'Selected');},hideMenu:function(e){var t=this;if(e&&e.type=="mousedown"&&(e.target.id==t.id+'_text'||e.target.id==t.id+'_open'))return;if(!e||!DOM.getParent(e.target,function(n){return DOM.hasClass(n,'mceMenu');})){DOM.removeClass(t.id,t.classPrefix+'Selected');Event.remove(DOM.doc,'mousedown',t.hideMenu,t);if(t.menu)t.menu.hideMenu();}},renderMenu:function(){var t=this,m;m=t.settings.control_manager.createDropMenu(t.id+'_menu',{menu_line:1,'class':t.classPrefix+'Menu mceNoIcons',max_width:150,max_height:150});m.onHideMenu.add(t.hideMenu,t);m.add({title:t.settings.title,'class':'mceMenuItemTitle',onclick:function(){if(t.settings.onselect('')!==false)t.select('');}});each(t.items,function(o){o.id=DOM.uniqueId();o.onclick=function(){if(t.settings.onselect(o.value)!==false)t.select(o.value);};m.add(o);});t.onRenderMenu.dispatch(t,m);t.menu=m;},postRender:function(){var t=this,cp=t.classPrefix;Event.add(t.id,'click',t.showMenu,t);Event.add(t.id+'_text','focus',function(e){if(!t._focused){t.keyDownHandler=Event.add(t.id+'_text','keydown',function(e){var idx=-1,v,kc=e.keyCode;each(t.items,function(v,i){if(t.selectedValue==v.value)idx=i;});if(kc==38)v=t.items[idx-1];else if(kc==40)v=t.items[idx+1];else if(kc==13){v=t.selectedValue;t.selectedValue=null;t.settings.onselect(v);return Event.cancel(e);}if(v){t.hideMenu();t.select(v.value);}});}t._focused=1;});Event.add(t.id+'_text','blur',function(){Event.remove(t.id+'_text','keydown',t.keyDownHandler);t._focused=0;});if(tinymce.isIE6||!DOM.boxModel){Event.add(t.id,'mouseover',function(){if(!DOM.hasClass(t.id,cp+'Disabled'))DOM.addClass(t.id,cp+'Hover');});Event.add(t.id,'mouseout',function(){if(!DOM.hasClass(t.id,cp+'Disabled'))DOM.removeClass(t.id,cp+'Hover');});}t.onPostRender.dispatch(t,DOM.get(t.id));},destroy:function(){this.parent();Event.clear(this.id+'_text');}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each,Dispatcher=tinymce.util.Dispatcher;tinymce.create('tinymce.ui.NativeListBox:tinymce.ui.ListBox',{NativeListBox:function(id,s){this.parent(id,s);this.classPrefix='mceNativeListBox';},setDisabled:function(s){DOM.get(this.id).disabled=s;},isDisabled:function(){return DOM.get(this.id).disabled;},select:function(v){var e=DOM.get(this.id),ol=e.options;v=''+(v||'');e.selectedIndex=0;each(ol,function(o,i){if(o.value==v){e.selectedIndex=i;return false;}});},add:function(n,v,a){var o,t=this;a=a||{};a.value=v;if(t.isRendered())DOM.add(DOM.get(this.id),'option',a,n);o={title:n,value:v,attribs:a};t.items.push(o);t.onAdd.dispatch(t,o);},getLength:function(){return DOM.get(this.id).options.length-1;},renderHTML:function(){var h,t=this;h=DOM.createHTML('option',{value:''},'-- '+t.settings.title+' --');each(t.items,function(it){h+=DOM.createHTML('option',{value:it.value},it.title);});h=DOM.createHTML('select',{id:t.id,'class':'mceNativeListBox'},h);return h;},postRender:function(){var t=this,ch;t.rendered=true;function onChange(e){var v=e.target.options[e.target.selectedIndex].value;t.onChange.dispatch(t,v);if(t.settings.onselect)t.settings.onselect(v);};Event.add(t.id,'change',onChange);Event.add(t.id,'keydown',function(e){var bf;Event.remove(t.id,'change',ch);bf=Event.add(t.id,'blur',function(){Event.add(t.id,'change',onChange);Event.remove(t.id,'blur',bf);});if(e.keyCode==13||e.keyCode==32){onChange(e);return Event.cancel(e);}});t.onPostRender.dispatch(t,DOM.get(t.id));}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each;tinymce.create('tinymce.ui.MenuButton:tinymce.ui.Button',{MenuButton:function(id,s){this.parent(id,s);this.onRenderMenu=new tinymce.util.Dispatcher(this);s.menu_container=s.menu_container||DOM.doc.body;},showMenu:function(){var t=this,p1,p2,e=DOM.get(t.id),m;if(t.isDisabled())return;if(!t.isMenuRendered){t.renderMenu();t.isMenuRendered=true;}if(t.isMenuVisible)return t.hideMenu();p1=DOM.getPos(t.settings.menu_container);p2=DOM.getPos(e);m=t.menu;m.settings.offset_x=p2.x;m.settings.offset_y=p2.y;m.settings.vp_offset_x=p2.x;m.settings.vp_offset_y=p2.y;m.settings.keyboard_focus=t._focused;m.showMenu(0,e.clientHeight);Event.add(DOM.doc,'mousedown',t.hideMenu,t);t.setState('Selected',1);t.isMenuVisible=1;},renderMenu:function(){var t=this,m;m=t.settings.control_manager.createDropMenu(t.id+'_menu',{menu_line:1,'class':this.classPrefix+'Menu',icons:t.settings.icons});m.onHideMenu.add(t.hideMenu,t);t.onRenderMenu.dispatch(t,m);t.menu=m;},hideMenu:function(e){var t=this;if(e&&e.type=="mousedown"&&DOM.getParent(e.target,function(e){return e.id===t.id||e.id===t.id+'_open';}))return;if(!e||!DOM.getParent(e.target,function(n){return DOM.hasClass(n,'mceMenu');})){t.setState('Selected',0);Event.remove(DOM.doc,'mousedown',t.hideMenu,t);if(t.menu)t.menu.hideMenu();}t.isMenuVisible=0;},postRender:function(){var t=this,s=t.settings;Event.add(t.id,'click',function(){if(!t.isDisabled()){if(s.onclick)s.onclick(t.value);t.showMenu();}});}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each;tinymce.create('tinymce.ui.SplitButton:tinymce.ui.MenuButton',{SplitButton:function(id,s){this.parent(id,s);this.classPrefix='mceSplitButton';},renderHTML:function(){var h,t=this,s=t.settings,h1;h='<tbody><tr>';if(s.image)h1=DOM.createHTML('img ',{src:s.image,'class':'mceAction '+s['class']});else h1=DOM.createHTML('span',{'class':'mceAction '+s['class']},'');h+='<td>'+DOM.createHTML('a',{id:t.id+'_action',href:'javascript:;','class':'mceAction '+s['class'],onclick:"return false;",onmousedown:'return false;',title:s.title},h1)+'</td>';h1=DOM.createHTML('span',{'class':'mceOpen '+s['class']});h+='<td>'+DOM.createHTML('a',{id:t.id+'_open',href:'javascript:;','class':'mceOpen '+s['class'],onclick:"return false;",onmousedown:'return false;',title:s.title},h1)+'</td>';h+='</tr></tbody>';return DOM.createHTML('table',{id:t.id,'class':'mceSplitButton mceSplitButtonEnabled '+s['class'],cellpadding:'0',cellspacing:'0',onmousedown:'return false;',title:s.title},h);},postRender:function(){var t=this,s=t.settings;if(s.onclick){Event.add(t.id+'_action','click',function(){if(!t.isDisabled())s.onclick(t.value);});}Event.add(t.id+'_open','click',t.showMenu,t);Event.add(t.id+'_open','focus',function(){t._focused=1;});Event.add(t.id+'_open','blur',function(){t._focused=0;});if(tinymce.isIE6||!DOM.boxModel){Event.add(t.id,'mouseover',function(){if(!DOM.hasClass(t.id,'mceSplitButtonDisabled'))DOM.addClass(t.id,'mceSplitButtonHover');});Event.add(t.id,'mouseout',function(){if(!DOM.hasClass(t.id,'mceSplitButtonDisabled'))DOM.removeClass(t.id,'mceSplitButtonHover');});}},destroy:function(){this.parent();Event.clear(this.id+'_action');Event.clear(this.id+'_open');}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,is=tinymce.is,each=tinymce.each;tinymce.create('tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton',{ColorSplitButton:function(id,s){var t=this;t.parent(id,s);t.settings=s=tinymce.extend({colors:'000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF',grid_width:8,default_color:'#888888'},t.settings);t.onShowMenu=new tinymce.util.Dispatcher(t);t.onHideMenu=new tinymce.util.Dispatcher(t);t.value=s.default_color;},showMenu:function(){var t=this,r,p,e,p2;if(t.isDisabled())return;if(!t.isMenuRendered){t.renderMenu();t.isMenuRendered=true;}if(t.isMenuVisible)return t.hideMenu();e=DOM.get(t.id);DOM.show(t.id+'_menu');DOM.addClass(e,'mceSplitButtonSelected');p2=DOM.getPos(e);DOM.setStyles(t.id+'_menu',{left:p2.x,top:p2.y+e.clientHeight,zIndex:200000});e=0;Event.add(DOM.doc,'mousedown',t.hideMenu,t);if(t._focused){t._keyHandler=Event.add(t.id+'_menu','keydown',function(e){if(e.keyCode==27)t.hideMenu();});DOM.select('a',t.id+'_menu')[0].focus();}t.onShowMenu.dispatch(t);t.isMenuVisible=1;},hideMenu:function(e){var t=this;if(e&&e.type=="mousedown"&&DOM.getParent(e.target,function(e){return e.id===t.id+'_open';}))return;if(!e||!DOM.getParent(e.target,function(n){return DOM.hasClass(n,'mceSplitButtonMenu');})){DOM.removeClass(t.id,'mceSplitButtonSelected');Event.remove(DOM.doc,'mousedown',t.hideMenu,t);Event.remove(t.id+'_menu','keydown',t._keyHandler);DOM.hide(t.id+'_menu');}t.onHideMenu.dispatch(t);t.isMenuVisible=0;},renderMenu:function(){var t=this,m,i=0,s=t.settings,n,tb,tr,w;w=DOM.add(s.menu_container,'div',{id:t.id+'_menu','class':s['menu_class']+' '+s['class'],style:'position:absolute;left:0;top:-1000px;'});m=DOM.add(w,'div',{'class':s['class']+' mceSplitButtonMenu'});DOM.add(m,'span',{'class':'mceMenuLine'});n=DOM.add(m,'table',{'class':'mceColorSplitMenu'});tb=DOM.add(n,'tbody');i=0;each(is(s.colors,'array')?s.colors:s.colors.split(','),function(c){c=c.replace(/^#/,'');if(!i--){tr=DOM.add(tb,'tr');i=s.grid_width-1;}n=DOM.add(tr,'td');n=DOM.add(n,'a',{href:'javascript:;',style:{backgroundColor:'#'+c},mce_color:'#'+c});});if(s.more_colors_func){n=DOM.add(tb,'tr');n=DOM.add(n,'td',{colspan:s.grid_width,'class':'mceMoreColors'});n=DOM.add(n,'a',{id:t.id+'_more',href:'javascript:;',onclick:'return false;','class':'mceMoreColors'},s.more_colors_title);Event.add(n,'click',function(e){s.more_colors_func.call(s.more_colors_scope||this);return Event.cancel(e);});}DOM.addClass(m,'mceColorSplitMenu');Event.add(t.id+'_menu','click',function(e){var c;e=e.target;if(e.nodeName=='A'&&(c=e.getAttribute('mce_color')))t.setColor(c);return Event.cancel(e);});return w;},setColor:function(c){var t=this;DOM.setStyle(t.id+'_preview','backgroundColor',c);t.value=c;t.hideMenu();t.settings.onselect(c);},postRender:function(){var t=this,id=t.id;t.parent();DOM.add(id+'_action','div',{id:id+'_preview','class':'mceColorPreview'});},destroy:function(){this.parent();Event.clear(this.id+'_menu');Event.clear(this.id+'_more');DOM.remove(this.id+'_menu');}});})();tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container',{renderHTML:function(){var t=this,h='',c,co,dom=tinymce.DOM,s=t.settings,i,pr,nx,cl;cl=t.controls;for(i=0;i<cl.length;i++){co=cl[i];pr=cl[i-1];nx=cl[i+1];if(i===0){c='mceToolbarStart';if(co.Button)c+=' mceToolbarStartButton';else if(co.SplitButton)c+=' mceToolbarStartSplitButton';else if(co.ListBox)c+=' mceToolbarStartListBox';h+=dom.createHTML('td',{'class':c},dom.createHTML('span',null,'<!-- IE -->'));}if(pr&&co.ListBox){if(pr.Button||pr.SplitButton)h+=dom.createHTML('td',{'class':'mceToolbarEnd'},dom.createHTML('span',null,'<!-- IE -->'));}if(dom.stdMode)h+='<td style="position: relative">'+co.renderHTML()+'</td>';else h+='<td>'+co.renderHTML()+'</td>';if(nx&&co.ListBox){if(nx.Button||nx.SplitButton)h+=dom.createHTML('td',{'class':'mceToolbarStart'},dom.createHTML('span',null,'<!-- IE -->'));}}c='mceToolbarEnd';if(co.Button)c+=' mceToolbarEndButton';else if(co.SplitButton)c+=' mceToolbarEndSplitButton';else if(co.ListBox)c+=' mceToolbarEndListBox';h+=dom.createHTML('td',{'class':c},dom.createHTML('span',null,'<!-- IE -->'));return dom.createHTML('table',{id:t.id,'class':'mceToolbar'+(s['class']?' '+s['class']:''),cellpadding:'0',cellspacing:'0',align:t.settings.align||''},'<tbody><tr>'+h+'</tr></tbody>');}});(function(){var Dispatcher=tinymce.util.Dispatcher,each=tinymce.each;tinymce.create('tinymce.AddOnManager',{items:[],urls:{},lookup:{},onAdd:new Dispatcher(this),get:function(n){return this.lookup[n];},requireLangPack:function(n){var u,s;if(tinymce.EditorManager.settings){u=this.urls[n]+'/langs/'+tinymce.EditorManager.settings.language+'.js';s=tinymce.EditorManager.settings;if(s){if(!tinymce.dom.Event.domLoaded&&!s.strict_mode)tinymce.ScriptLoader.load(u);else tinymce.ScriptLoader.add(u);}}},add:function(id,o){this.items.push(o);this.lookup[id]=o;this.onAdd.dispatch(this,id,o);return o;},load:function(n,u,cb,s){var t=this;if(t.urls[n])return;if(u.indexOf('/')!=0&&u.indexOf('://')==-1)u=tinymce.baseURL+'/'+u;t.urls[n]=u.substring(0,u.lastIndexOf('/'));tinymce.ScriptLoader.add(u,cb,s);}});tinymce.PluginManager=new tinymce.AddOnManager();tinymce.ThemeManager=new tinymce.AddOnManager();}());(function(){var each=tinymce.each,extend=tinymce.extend,DOM=tinymce.DOM,Event=tinymce.dom.Event,ThemeManager=tinymce.ThemeManager,PluginManager=tinymce.PluginManager,explode=tinymce.explode;tinymce.create('static tinymce.EditorManager',{editors:{},i18n:{},activeEditor:null,preInit:function(){var t=this,lo=window.location;tinymce.documentBaseURL=lo.href.replace(/[\?#].*$/,'').replace(/[\/\\][^\/]+$/,'');if(!/[\/\\]$/.test(tinymce.documentBaseURL))tinymce.documentBaseURL+='/';tinymce.baseURL=new tinymce.util.URI(tinymce.documentBaseURL).toAbsolute(tinymce.baseURL);tinymce.EditorManager.baseURI=new tinymce.util.URI(tinymce.baseURL);if(tinymce.EditorManager.baseURI.host!=lo.hostname&&lo.hostname)document.domain=tinymce.relaxedDomain=lo.hostname.replace(/.*\.(.+\..+)$/,'$1');t.onBeforeUnload=new tinymce.util.Dispatcher(t);Event.add(window,'beforeunload',function(e){t.onBeforeUnload.dispatch(t,e);});},init:function(s){var t=this,pl,sl=tinymce.ScriptLoader,c,e;function execCallback(se,n,s){var f=se[n];if(!f)return;if(tinymce.is(f,'string')){s=f.replace(/\.\w+$/,'');s=s?tinymce.resolve(s):0;f=tinymce.resolve(f);}return f.apply(s||this,Array.prototype.slice.call(arguments,2));};s=extend({theme:"simple",language:"en",strict_loading_mode:document.contentType=='application/xhtml+xml'},s);t.settings=s;if(!Event.domLoaded&&!s.strict_loading_mode){if(s.language)sl.add(tinymce.baseURL+'/langs/'+s.language+'.js');if(s.theme&&s.theme.charAt(0)!='-'&&!ThemeManager.urls[s.theme])ThemeManager.load(s.theme,'themes/'+s.theme+'/editor_template'+tinymce.suffix+'.js');if(s.plugins){pl=explode(s.plugins);if(tinymce.inArray(pl,'compat2x')!=-1)PluginManager.load('compat2x','plugins/compat2x/editor_plugin'+tinymce.suffix+'.js');each(pl,function(v){if(v&&v.charAt(0)!='-'&&!PluginManager.urls[v]){if(!tinymce.isWebKit&&v=='safari')return;PluginManager.load(v,'plugins/'+v+'/editor_plugin'+tinymce.suffix+'.js');}});}sl.loadQueue();}Event.add(document,'init',function(){var l,co;execCallback(s,'onpageload');if(s.browsers){l=false;each(explode(s.browsers),function(v){switch(v){case'ie':case'msie':if(tinymce.isIE)l=true;break;case'gecko':if(tinymce.isGecko)l=true;break;case'safari':case'webkit':if(tinymce.isWebKit)l=true;break;case'opera':if(tinymce.isOpera)l=true;break;}});if(!l)return;}switch(s.mode){case"exact":l=s.elements||'';if(l.length>0){each(explode(l),function(v){if(DOM.get(v))new tinymce.Editor(v,s).render(1);else{c=0;each(document.forms,function(f){each(f.elements,function(e){if(e.name===v){v='mce_editor_'+c;DOM.setAttrib(e,'id',v);new tinymce.Editor(v,s).render(1);}});});}});}break;case"textareas":case"specific_textareas":function hasClass(n,c){return c.constructor===RegExp?c.test(n.className):DOM.hasClass(n,c);};each(DOM.select('textarea'),function(v){if(s.editor_deselector&&hasClass(v,s.editor_deselector))return;if(!s.editor_selector||hasClass(v,s.editor_selector)){e=DOM.get(v.name);if(!v.id&&!e)v.id=v.name;if(!v.id||t.get(v.id))v.id=DOM.uniqueId();new tinymce.Editor(v.id,s).render(1);}});break;}if(s.oninit){l=co=0;each(t.editors,function(ed){co++;if(!ed.initialized){ed.onInit.add(function(){l++;if(l==co)execCallback(s,'oninit');});}else l++;if(l==co)execCallback(s,'oninit');});}});},get:function(id){return this.editors[id];},getInstanceById:function(id){return this.get(id);},add:function(e){this.editors[e.id]=e;this._setActive(e);return e;},remove:function(e){var t=this;if(!t.editors[e.id])return null;delete t.editors[e.id];if(t.activeEditor==e){each(t.editors,function(e){t._setActive(e);return false;});}e.destroy();return e;},execCommand:function(c,u,v){var t=this,ed=t.get(v),w;switch(c){case"mceFocus":ed.focus();return true;case"mceAddEditor":case"mceAddControl":if(!t.get(v))new tinymce.Editor(v,t.settings).render();return true;case"mceAddFrameControl":w=v.window;w.tinyMCE=tinyMCE;w.tinymce=tinymce;tinymce.DOM.doc=w.document;tinymce.DOM.win=w;ed=new tinymce.Editor(v.element_id,v);ed.render();if(tinymce.isIE){function clr(){ed.destroy();w.detachEvent('onunload',clr);w=w.tinyMCE=w.tinymce=null;};w.attachEvent('onunload',clr);}v.page_window=null;return true;case"mceRemoveEditor":case"mceRemoveControl":ed.remove();return true;case'mceToggleEditor':if(!ed){t.execCommand('mceAddControl',0,v);return true;}if(ed.isHidden())ed.show();else ed.hide();return true;}if(t.activeEditor)return t.activeEditor.execCommand(c,u,v);return false;},execInstanceCommand:function(id,c,u,v){var ed=this.get(id);if(ed)return ed.execCommand(c,u,v);return false;},triggerSave:function(){each(this.editors,function(e){e.save();});},addI18n:function(p,o){var lo,i18n=this.i18n;if(!tinymce.is(p,'string')){each(p,function(o,lc){each(o,function(o,g){each(o,function(o,k){if(g==='common')i18n[lc+'.'+k]=o;else i18n[lc+'.'+g+'.'+k]=o;});});});}else{each(o,function(o,k){i18n[p+'.'+k]=o;});}},_setActive:function(e){this.selectedInstance=this.activeEditor=e;}});tinymce.EditorManager.preInit();})();var tinyMCE=window.tinyMCE=tinymce.EditorManager;(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,extend=tinymce.extend,Dispatcher=tinymce.util.Dispatcher;var each=tinymce.each,isGecko=tinymce.isGecko,isIE=tinymce.isIE,isWebKit=tinymce.isWebKit;var is=tinymce.is,ThemeManager=tinymce.ThemeManager,PluginManager=tinymce.PluginManager,EditorManager=tinymce.EditorManager;var inArray=tinymce.inArray,grep=tinymce.grep,explode=tinymce.explode;tinymce.create('tinymce.Editor',{Editor:function(id,s){var t=this;t.id=t.editorId=id;t.execCommands={};t.queryStateCommands={};t.queryValueCommands={};t.plugins={};each(['onPreInit','onBeforeRenderUI','onPostRender','onInit','onRemove','onActivate','onDeactivate','onClick','onEvent','onMouseUp','onMouseDown','onDblClick','onKeyDown','onKeyUp','onKeyPress','onContextMenu','onSubmit','onReset','onPaste','onPreProcess','onPostProcess','onBeforeSetContent','onBeforeGetContent','onSetContent','onGetContent','onLoadContent','onSaveContent','onNodeChange','onChange','onBeforeExecCommand','onExecCommand','onUndo','onRedo','onVisualAid','onSetProgressState'],function(e){t[e]=new Dispatcher(t);});t.settings=s=extend({id:id,language:'en',docs_language:'en',theme:'simple',skin:'default',delta_width:0,delta_height:0,popup_css:'',plugins:'',document_base_url:tinymce.documentBaseURL,add_form_submit_trigger:1,submit_patch:1,add_unload_trigger:1,convert_urls:1,relative_urls:1,remove_script_host:1,table_inline_editing:0,object_resizing:1,cleanup:1,accessibility_focus:1,custom_shortcuts:1,custom_undo_redo_keyboard_shortcuts:1,custom_undo_redo_restore_selection:1,custom_undo_redo:1,doctype:'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',visual_table_class:'mceItemTable',visual:1,inline_styles:true,convert_fonts_to_spans:true,font_size_style_values:'xx-small,x-small,small,medium,large,x-large,xx-large',apply_source_formatting:1,directionality:'ltr',forced_root_block:'p',valid_elements:'@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur],strong/b,em/i,strike,u,#p[align],-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|src|border|alt=|title|hspace|vspace|width|height|align],-sub,-sup,-blockquote[cite],-table[border=0|cellspacing|cellpadding|width|frame|rules|height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,-span,-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],object[classid|width|height|codebase|*],param[name|value],embed[type|width|height|src|*],script[src|type],map[name],area[shape|coords|href|alt|target],bdo,button,col[align|char|charoff|span|valign|width],colgroup[align|char|charoff|span|valign|width],dfn,fieldset,form[action|accept|accept-charset|enctype|method],input[accept|alt|checked|disabled|maxlength|name|readonly|size|src|type|value|tabindex|accesskey],kbd,label[for],legend,noscript,optgroup[label|disabled],option[disabled|label|selected|value],q[cite],samp,select[disabled|multiple|name|size],small,textarea[cols|rows|disabled|name|readonly],tt,var,big',hidden_input:1,padd_empty_editor:1,render_ui:1,init_theme:1,force_p_newlines:1,indentation:'30px'},s);t.documentBaseURI=new tinymce.util.URI(s.document_base_url||tinymce.documentBaseURL,{base_uri:tinyMCE.baseURI});t.baseURI=EditorManager.baseURI;t.execCallback('setup',t);},render:function(nst){var t=this,s=t.settings,id=t.id,sl=tinymce.ScriptLoader;if(!Event.domLoaded){Event.add(document,'init',function(){t.render();});return;}if(!nst){s.strict_loading_mode=1;tinyMCE.settings=s;}if(!t.getElement())return;if(s.strict_loading_mode){sl.settings.strict_mode=s.strict_loading_mode;tinymce.DOM.settings.strict=1;}if(!/TEXTAREA|INPUT/i.test(t.getElement().nodeName)&&s.hidden_input&&DOM.getParent(id,'form'))DOM.insertAfter(DOM.create('input',{type:'hidden',name:id}),id);t.windowManager=new tinymce.WindowManager(t);if(s.encoding=='xml'){t.onGetContent.add(function(ed,o){if(o.save)o.content=DOM.encode(o.content);});}if(s.add_form_submit_trigger){t.onSubmit.addToTop(function(){if(t.initialized){t.save();t.isNotDirty=1;}});}if(s.add_unload_trigger&&!s.ask){t._beforeUnload=tinyMCE.onBeforeUnload.add(function(){if(t.initialized&&!t.destroyed&&!t.isHidden())t.save({format:'raw',no_events:true});});}tinymce.addUnload(t.destroy,t);if(s.submit_patch){t.onBeforeRenderUI.add(function(){var n=t.getElement().form;if(!n)return;if(n._mceOldSubmit)return;if(!n.submit.nodeType&&!n.submit.length){t.formElement=n;n._mceOldSubmit=n.submit;n.submit=function(){EditorManager.triggerSave();t.isNotDirty=1;return this._mceOldSubmit(this);};}n=null;});}function loadScripts(){if(s.language)sl.add(tinymce.baseURL+'/langs/'+s.language+'.js');if(s.theme.charAt(0)!='-'&&!ThemeManager.urls[s.theme])ThemeManager.load(s.theme,'themes/'+s.theme+'/editor_template'+tinymce.suffix+'.js');each(explode(s.plugins),function(p){if(p&&p.charAt(0)!='-'&&!PluginManager.urls[p]){if(!isWebKit&&p=='safari')return;PluginManager.load(p,'plugins/'+p+'/editor_plugin'+tinymce.suffix+'.js');}});sl.loadQueue(function(){if(s.ask){function ask(){window.setTimeout(function(){Event.remove(t.id,'focus',ask);t.windowManager.confirm(t.getLang('edit_confirm'),function(s){if(s)t.init();});},0);};Event.add(t.id,'focus',ask);return;}if(!t.removed)t.init();});};if(s.plugins.indexOf('compat2x')!=-1){PluginManager.load('compat2x','plugins/compat2x/editor_plugin'+tinymce.suffix+'.js');sl.loadQueue(loadScripts);}else loadScripts();},init:function(){var n,t=this,s=t.settings,w,h,e=t.getElement(),o,ti,u,bi,bc,re;EditorManager.add(t);s.theme=s.theme.replace(/-/,'');o=ThemeManager.get(s.theme);t.theme=new o();if(t.theme.init&&s.init_theme)t.theme.init(t,ThemeManager.urls[s.theme]||tinymce.documentBaseURL.replace(/\/$/,''));each(explode(s.plugins.replace(/\-/g,'')),function(p){var c=PluginManager.get(p),u=PluginManager.urls[p]||tinymce.documentBaseURL.replace(/\/$/,''),po;if(c){po=new c(t,u);t.plugins[p]=po;if(po.init)po.init(t,u);}});if(s.popup_css)s.popup_css=t.documentBaseURI.toAbsolute(s.popup_css);else s.popup_css=t.baseURI.toAbsolute("themes/"+s.theme+"/skins/"+s.skin+"/dialog.css");if(s.popup_css_add)s.popup_css+=','+t.documentBaseURI.toAbsolute(s.popup_css_add);t.controlManager=new tinymce.ControlManager(t);t.undoManager=new tinymce.UndoManager(t);t.undoManager.onAdd.add(function(um,l){if(!l.initial)return t.onChange.dispatch(t,l,um);});t.undoManager.onUndo.add(function(um,l){return t.onUndo.dispatch(t,l,um);});t.undoManager.onRedo.add(function(um,l){return t.onRedo.dispatch(t,l,um);});if(s.custom_undo_redo){t.onExecCommand.add(function(ed,cmd,ui,val,a){if(cmd!='Undo'&&cmd!='Redo'&&cmd!='mceRepaint'&&(!a||!a.skip_undo))t.undoManager.add();});}t.onExecCommand.add(function(ed,c){if(!/^(FontName|FontSize)$/.test(c))t.nodeChanged();});if(isGecko){function repaint(a,o){if(!o||!o.initial)t.execCommand('mceRepaint');};t.onUndo.add(repaint);t.onRedo.add(repaint);t.onSetContent.add(repaint);}t.onBeforeRenderUI.dispatch(t,t.controlManager);if(s.render_ui){w=s.width||e.style.width||e.offsetWidth;h=s.height||e.style.height||e.offsetHeight;t.orgDisplay=e.style.display;re=/^[0-9\.]+(|px)$/i;if(re.test(''+w))w=Math.max(parseInt(w)+(o.deltaWidth||0),100);if(re.test(''+h))h=Math.max(parseInt(h)+(o.deltaHeight||0),100);o=t.theme.renderUI({targetNode:e,width:w,height:h,deltaWidth:s.delta_width,deltaHeight:s.delta_height});t.editorContainer=o.editorContainer;}DOM.setStyles(o.sizeContainer||o.editorContainer,{width:w,height:h});h=(o.iframeHeight||h)+((h+'').indexOf('%')==-1?(o.deltaHeight||0):'');if(h<100)h=100;t.iframeHTML=s.doctype+'<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="'+t.documentBaseURI.getURI()+'" />';t.iframeHTML+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';if(tinymce.relaxedDomain)t.iframeHTML+='<script type="text/javascript">document.domain = "'+tinymce.relaxedDomain+'";</script>';bi=s.body_id||'tinymce';if(bi.indexOf('=')!=-1){bi=t.getParam('body_id','','hash');bi=bi[t.id]||bi;}bc=s.body_class||'';if(bc.indexOf('=')!=-1){bc=t.getParam('body_class','','hash');bc=bc[t.id]||'';}t.iframeHTML+='</head><body id="'+bi+'" class="mceContentBody '+bc+'"></body></html>';if(tinymce.relaxedDomain){if(isIE||(tinymce.isOpera&&parseFloat(opera.version())>=9.5))u='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+t.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()';else if(tinymce.isOpera)u='javascript:(function(){document.open();document.domain="'+document.domain+'";document.close();ed.setupIframe();})()';}n=DOM.add(o.iframeContainer,'iframe',{id:t.id+"_ifr",src:u||'javascript:""',frameBorder:'0',style:{width:'100%',height:h}});t.contentAreaContainer=o.iframeContainer;DOM.get(o.editorContainer).style.display=t.orgDisplay;DOM.get(t.id).style.display='none';if(tinymce.isOldWebKit){Event.add(n,'load',t.setupIframe,t);n.src=tinymce.baseURL+'/plugins/safari/blank.htm';}else{if(!isIE||!tinymce.relaxedDomain)t.setupIframe();e=n=o=null;}},setupIframe:function(){var t=this,s=t.settings,e=DOM.get(t.id),d=t.getDoc(),h,b;if(!isIE||!tinymce.relaxedDomain){d.open();d.write(t.iframeHTML);d.close();}if(!isIE){try{d.designMode='On';}catch(ex){}}if(isIE){b=t.getBody();DOM.hide(b);b.contentEditable=true;DOM.show(b);}t.dom=new tinymce.DOM.DOMUtils(t.getDoc(),{keep_values:true,url_converter:t.convertURL,url_converter_scope:t,hex_colors:s.force_hex_style_colors,class_filter:s.class_filter,update_styles:1,fix_ie_paragraphs:1});t.serializer=new tinymce.dom.Serializer({entity_encoding:s.entity_encoding,entities:s.entities,valid_elements:s.verify_html===false?'*[*]':s.valid_elements,extended_valid_elements:s.extended_valid_elements,valid_child_elements:s.valid_child_elements,invalid_elements:s.invalid_elements,fix_table_elements:s.fix_table_elements,fix_list_elements:s.fix_list_elements,fix_content_duplication:s.fix_content_duplication,convert_fonts_to_spans:s.convert_fonts_to_spans,font_size_classes:s.font_size_classes,font_size_style_values:s.font_size_style_values,apply_source_formatting:s.apply_source_formatting,remove_linebreaks:s.remove_linebreaks,dom:t.dom});t.selection=new tinymce.dom.Selection(t.dom,t.getWin(),t.serializer);t.forceBlocks=new tinymce.ForceBlocks(t,{forced_root_block:s.forced_root_block});t.editorCommands=new tinymce.EditorCommands(t);t.serializer.onPreProcess.add(function(se,o){return t.onPreProcess.dispatch(t,o,se);});t.serializer.onPostProcess.add(function(se,o){return t.onPostProcess.dispatch(t,o,se);});t.onPreInit.dispatch(t);if(!s.gecko_spellcheck)t.getBody().spellcheck=0;t._addEvents();t.controlManager.onPostRender.dispatch(t,t.controlManager);t.onPostRender.dispatch(t);if(s.directionality)t.getBody().dir=s.directionality;if(s.nowrap)t.getBody().style.whiteSpace="nowrap";if(s.auto_resize)t.onNodeChange.add(t.resizeToContent,t);if(s.custom_elements){function handleCustom(ed,o){each(explode(s.custom_elements),function(v){var n;if(v.indexOf('~')===0){v=v.substring(1);n='span';}else n='div';o.content=o.content.replace(new RegExp('<('+v+')([^>]*)>','g'),'<'+n+' mce_name="$1"$2>');o.content=o.content.replace(new RegExp('</('+v+')>','g'),'</'+n+'>');});};t.onBeforeSetContent.add(handleCustom);t.onPostProcess.add(function(ed,o){if(o.set)handleCustom(ed,o)});}if(s.handle_node_change_callback){t.onNodeChange.add(function(ed,cm,n){t.execCallback('handle_node_change_callback',t.id,n,-1,-1,true,t.selection.isCollapsed());});}if(s.save_callback){t.onSaveContent.add(function(ed,o){var h=t.execCallback('save_callback',t.id,o.content,t.getBody());if(h)o.content=h;});}if(s.onchange_callback){t.onChange.add(function(ed,l){t.execCallback('onchange_callback',t,l);});}if(s.convert_newlines_to_brs){t.onBeforeSetContent.add(function(ed,o){if(o.initial)o.content=o.content.replace(/\r?\n/g,'<br />');});}if(s.fix_nesting&&isIE){t.onBeforeSetContent.add(function(ed,o){o.content=t._fixNesting(o.content);});}if(s.preformatted){t.onPostProcess.add(function(ed,o){o.content=o.content.replace(/^\s*<pre.*?>/,'');o.content=o.content.replace(/<\/pre>\s*$/,'');if(o.set)o.content='<pre class="mceItemHidden">'+o.content+'</pre>';});}if(s.verify_css_classes){t.serializer.attribValueFilter=function(n,v){var s,cl;if(n=='class'){if(!t.classesRE){cl=t.dom.getClasses();if(cl.length>0){s='';each(cl,function(o){s+=(s?'|':'')+o['class'];});t.classesRE=new RegExp('('+s+')','gi');}}return!t.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(v)||t.classesRE.test(v)?v:'';}return v;};}if(s.convert_fonts_to_spans)t._convertFonts();if(s.inline_styles)t._convertInlineElements();if(s.cleanup_callback){t.onBeforeSetContent.add(function(ed,o){o.content=t.execCallback('cleanup_callback','insert_to_editor',o.content,o);});t.onPreProcess.add(function(ed,o){if(o.set)t.execCallback('cleanup_callback','insert_to_editor_dom',o.node,o);if(o.get)t.execCallback('cleanup_callback','get_from_editor_dom',o.node,o);});t.onPostProcess.add(function(ed,o){if(o.set)o.content=t.execCallback('cleanup_callback','insert_to_editor',o.content,o);if(o.get)o.content=t.execCallback('cleanup_callback','get_from_editor',o.content,o);});}if(s.save_callback){t.onGetContent.add(function(ed,o){if(o.save)o.content=t.execCallback('save_callback',t.id,o.content,t.getBody());});}if(s.handle_event_callback){t.onEvent.add(function(ed,e,o){if(t.execCallback('handle_event_callback',e,ed,o)===false)Event.cancel(e);});}t.onSetContent.add(function(){t.addVisual(t.getBody());});if(s.padd_empty_editor){t.onPostProcess.add(function(ed,o){o.content=o.content.replace(/^(<p>(&nbsp;|&#160;|\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/,'');});}if(isGecko){try{d.designMode='Off';d.designMode='On';}catch(ex){}}setTimeout(function(){if(t.removed)return;t.load({initial:true,format:(s.cleanup_on_startup?'html':'raw')});t.startContent=t.getContent({format:'raw'});t.undoManager.add({initial:true});t.initialized=true;t.onInit.dispatch(t);t.execCallback('setupcontent_callback',t.id,t.getBody(),t.getDoc());t.execCallback('init_instance_callback',t);t.focus(true);t.nodeChanged({initial:1});if(s.content_css){tinymce.each(explode(s.content_css),function(u){t.dom.loadCSS(t.documentBaseURI.toAbsolute(u));});}if(s.auto_focus){setTimeout(function(){var ed=EditorManager.get(s.auto_focus);ed.selection.select(ed.getBody(),1);ed.selection.collapse(1);ed.getWin().focus();},100);}},1);e=null;},focus:function(sf){var oed,t=this,ce=t.settings.content_editable;if(!sf){if(!ce&&(!isIE||t.selection.getNode().ownerDocument!=t.getDoc()))t.getWin().focus();}if(EditorManager.activeEditor!=t){if((oed=EditorManager.activeEditor)!=null)oed.onDeactivate.dispatch(oed,t);t.onActivate.dispatch(t,oed);}EditorManager._setActive(t);},execCallback:function(n){var t=this,f=t.settings[n],s;if(!f)return;if(t.callbackLookup&&(s=t.callbackLookup[n])){f=s.func;s=s.scope;}if(is(f,'string')){s=f.replace(/\.\w+$/,'');s=s?tinymce.resolve(s):0;f=tinymce.resolve(f);t.callbackLookup=t.callbackLookup||{};t.callbackLookup[n]={func:f,scope:s};}return f.apply(s||t,Array.prototype.slice.call(arguments,1));},translate:function(s){var c=this.settings.language,i18n=EditorManager.i18n;if(!s)return'';return i18n[c+'.'+s]||s.replace(/{\#([^}]+)\}/g,function(a,b){return i18n[c+'.'+b]||'{#'+b+'}';});},getLang:function(n,dv){return EditorManager.i18n[this.settings.language+'.'+n]||(is(dv)?dv:'{#'+n+'}');},getParam:function(n,dv,ty){var tr=tinymce.trim,v=is(this.settings[n])?this.settings[n]:dv,o;if(ty==='hash'){o={};if(is(v,'string')){each(v.indexOf('=')>0?v.split(/[;,](?![^=;,]*(?:[;,]|$))/):v.split(','),function(v){v=v.split('=');if(v.length>1)o[tr(v[0])]=tr(v[1]);else o[tr(v[0])]=tr(v);});}else o=v;return o;}return v;},nodeChanged:function(o){var t=this,s=t.selection,n=s.getNode()||t.getBody();if(t.initialized){t.onNodeChange.dispatch(t,o?o.controlManager||t.controlManager:t.controlManager,isIE&&n.ownerDocument!=t.getDoc()?t.getBody():n,s.isCollapsed(),o);}},addButton:function(n,s){var t=this;t.buttons=t.buttons||{};t.buttons[n]=s;},addCommand:function(n,f,s){this.execCommands[n]={func:f,scope:s||this};},addQueryStateHandler:function(n,f,s){this.queryStateCommands[n]={func:f,scope:s||this};},addQueryValueHandler:function(n,f,s){this.queryValueCommands[n]={func:f,scope:s||this};},addShortcut:function(pa,desc,cmd_func,sc){var t=this,c;if(!t.settings.custom_shortcuts)return false;t.shortcuts=t.shortcuts||{};if(is(cmd_func,'string')){c=cmd_func;cmd_func=function(){t.execCommand(c,false,null);};}if(is(cmd_func,'object')){c=cmd_func;cmd_func=function(){t.execCommand(c[0],c[1],c[2]);};}each(explode(pa),function(pa){var o={func:cmd_func,scope:sc||this,desc:desc,alt:false,ctrl:false,shift:false};each(explode(pa,'+'),function(v){switch(v){case'alt':case'ctrl':case'shift':o[v]=true;break;default:o.charCode=v.charCodeAt(0);o.keyCode=v.toUpperCase().charCodeAt(0);}});t.shortcuts[(o.ctrl?'ctrl':'')+','+(o.alt?'alt':'')+','+(o.shift?'shift':'')+','+o.keyCode]=o;});return true;},execCommand:function(cmd,ui,val,a){var t=this,s=0,o,st;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(cmd)&&(!a||!a.skip_focus))t.focus();o={};t.onBeforeExecCommand.dispatch(t,cmd,ui,val,o);if(o.terminate)return false;if(t.execCallback('execcommand_callback',t.id,t.selection.getNode(),cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}if(o=t.execCommands[cmd]){st=o.func.call(o.scope,ui,val);if(st!==true){t.onExecCommand.dispatch(t,cmd,ui,val,a);return st;}}each(t.plugins,function(p){if(p.execCommand&&p.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);s=1;return false;}});if(s)return true;if(t.theme.execCommand&&t.theme.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}if(t.editorCommands.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val,a);return true;}t.getDoc().execCommand(cmd,ui,val);t.onExecCommand.dispatch(t,cmd,ui,val,a);},queryCommandState:function(c){var t=this,o,s;if(t._isHidden())return;if(o=t.queryStateCommands[c]){s=o.func.call(o.scope);if(s!==true)return s;}o=t.editorCommands.queryCommandState(c);if(o!==-1)return o;try{return this.getDoc().queryCommandState(c);}catch(ex){}},queryCommandValue:function(c){var t=this,o,s;if(t._isHidden())return;if(o=t.queryValueCommands[c]){s=o.func.call(o.scope);if(s!==true)return s;}o=t.editorCommands.queryCommandValue(c);if(is(o))return o;try{return this.getDoc().queryCommandValue(c);}catch(ex){}},show:function(){var t=this;DOM.show(t.getContainer());DOM.hide(t.id);t.load();},hide:function(){var t=this,d=t.getDoc();if(isIE&&d)d.execCommand('SelectAll');t.save();DOM.hide(t.getContainer());DOM.setStyle(t.id,'display',t.orgDisplay);},isHidden:function(){return!DOM.isHidden(this.id);},setProgressState:function(b,ti,o){this.onSetProgressState.dispatch(this,b,ti,o);return b;},resizeToContent:function(){var t=this;DOM.setStyle(t.id+"_ifr",'height',t.getBody().scrollHeight);},load:function(o){var t=this,e=t.getElement(),h;o=o||{};o.load=true;h=t.setContent(is(e.value)?e.value:e.innerHTML,o);o.element=e;if(!o.no_events)t.onLoadContent.dispatch(t,o);o.element=e=null;return h;},save:function(o){var t=this,e=t.getElement(),h,f;if(!t.initialized)return;o=o||{};o.save=true;if(!o.no_events){t.undoManager.typing=0;t.undoManager.add();}o.element=e;h=o.content=t.getContent(o);if(!o.no_events)t.onSaveContent.dispatch(t,o);h=o.content;if(!/TEXTAREA|INPUT/i.test(e.nodeName)){e.innerHTML=h;if(f=DOM.getParent(t.id,'form')){each(f.elements,function(e){if(e.name==t.id){e.value=h;return false;}});}}else e.value=h;o.element=e=null;return h;},setContent:function(h,o){var t=this;o=o||{};o.format=o.format||'html';o.set=true;o.content=h;if(!o.no_events)t.onBeforeSetContent.dispatch(t,o);if(!tinymce.isIE&&(h.length===0||/^\s+$/.test(h))){o.content=t.dom.setHTML(t.getBody(),'<br mce_bogus="1" />');o.format='raw';}o.content=t.dom.setHTML(t.getBody(),tinymce.trim(o.content));if(o.format!='raw'&&t.settings.cleanup){o.getInner=true;o.content=t.dom.setHTML(t.getBody(),t.serializer.serialize(t.getBody(),o));}if(!o.no_events)t.onSetContent.dispatch(t,o);return o.content;},getContent:function(o){var t=this,h;o=o||{};o.format=o.format||'html';o.get=true;if(!o.no_events)t.onBeforeGetContent.dispatch(t,o);if(o.format!='raw'&&t.settings.cleanup){o.getInner=true;h=t.serializer.serialize(t.getBody(),o);}else h=t.getBody().innerHTML;h=h.replace(/^\s*|\s*$/g,'');o.content=h;if(!o.no_events)t.onGetContent.dispatch(t,o);return o.content;},isDirty:function(){var t=this;return tinymce.trim(t.startContent)!=tinymce.trim(t.getContent({format:'raw',no_events:1}))&&!t.isNotDirty;},getContainer:function(){var t=this;if(!t.container)t.container=DOM.get(t.editorContainer||t.id+'_parent');return t.container;},getContentAreaContainer:function(){return this.contentAreaContainer;},getElement:function(){return DOM.get(this.settings.content_element||this.id);},getWin:function(){var t=this,e;if(!t.contentWindow){e=DOM.get(t.id+"_ifr");if(e)t.contentWindow=e.contentWindow;}return t.contentWindow;},getDoc:function(){var t=this,w;if(!t.contentDocument){w=t.getWin();if(w)t.contentDocument=w.document;}return t.contentDocument;},getBody:function(){return this.bodyElement||this.getDoc().body;},convertURL:function(u,n,e){var t=this,s=t.settings;if(s.urlconverter_callback)return t.execCallback('urlconverter_callback',u,e,true,n);if(!s.convert_urls||(e&&e.nodeName=='LINK')||u.indexOf('file:')===0)return u;if(s.relative_urls)return t.documentBaseURI.toRelative(u);u=t.documentBaseURI.toAbsolute(u,s.remove_script_host);return u;},addVisual:function(e){var t=this,s=t.settings;e=e||t.getBody();if(!is(t.hasVisual))t.hasVisual=s.visual;each(t.dom.select('table,a',e),function(e){var v;switch(e.nodeName){case'TABLE':v=t.dom.getAttrib(e,'border');if(!v||v=='0'){if(t.hasVisual)t.dom.addClass(e,s.visual_table_class);else t.dom.removeClass(e,s.visual_table_class);}return;case'A':v=t.dom.getAttrib(e,'name');if(v){if(t.hasVisual)t.dom.addClass(e,'mceItemAnchor');else t.dom.removeClass(e,'mceItemAnchor');}return;}});t.onVisualAid.dispatch(t,e,t.hasVisual);},remove:function(){var t=this,e=t.getContainer();t.removed=1;t.hide();t.execCallback('remove_instance_callback',t);t.onRemove.dispatch(t);t.onExecCommand.listeners=[];EditorManager.remove(t);DOM.remove(e);},destroy:function(s){var t=this;if(t.destroyed)return;if(!s){tinymce.removeUnload(t.destroy);tinyMCE.onBeforeUnload.remove(t._beforeUnload);if(t.theme.destroy)t.theme.destroy();t.controlManager.destroy();t.selection.destroy();t.dom.destroy();if(!t.settings.content_editable){Event.clear(t.getWin());Event.clear(t.getDoc());}Event.clear(t.getBody());Event.clear(t.formElement);}if(t.formElement){t.formElement.submit=t.formElement._mceOldSubmit;t.formElement._mceOldSubmit=null;}t.contentAreaContainer=t.formElement=t.container=t.settings.content_element=t.bodyElement=t.contentDocument=t.contentWindow=null;if(t.selection)t.selection=t.selection.win=t.selection.dom=t.selection.dom.doc=null;t.destroyed=1;},_addEvents:function(){var t=this,i,s=t.settings,lo={mouseup:'onMouseUp',mousedown:'onMouseDown',click:'onClick',keyup:'onKeyUp',keydown:'onKeyDown',keypress:'onKeyPress',submit:'onSubmit',reset:'onReset',contextmenu:'onContextMenu',dblclick:'onDblClick',paste:'onPaste'};function eventHandler(e,o){var ty=e.type;if(t.removed)return;if(t.onEvent.dispatch(t,e,o)!==false){t[lo[e.fakeType||e.type]].dispatch(t,e,o);}};each(lo,function(v,k){switch(k){case'contextmenu':if(tinymce.isOpera){Event.add(t.getBody(),'mousedown',function(e){if(e.ctrlKey){e.fakeType='contextmenu';eventHandler(e);}});}else Event.add(t.getBody(),k,eventHandler);break;case'paste':Event.add(t.getBody(),k,function(e){var tx,h,el,r;if(e.clipboardData)tx=e.clipboardData.getData('text/plain');else if(tinymce.isIE)tx=t.getWin().clipboardData.getData('Text');eventHandler(e,{text:tx,html:h});});break;case'submit':case'reset':Event.add(t.getElement().form||DOM.getParent(t.id,'form'),k,eventHandler);break;default:Event.add(s.content_editable?t.getBody():t.getDoc(),k,eventHandler);}});Event.add(s.content_editable?t.getBody():(isGecko?t.getDoc():t.getWin()),'focus',function(e){t.focus(true);});if(tinymce.isGecko){Event.add(t.getDoc(),'DOMNodeInserted',function(e){var v;e=e.target;if(e.nodeType===1&&e.nodeName==='IMG'&&(v=e.getAttribute('mce_src')))e.src=t.documentBaseURI.toAbsolute(v);});}if(isGecko){function setOpts(){var t=this,d=t.getDoc(),s=t.settings;if(isGecko){if(t._isHidden()){try{if(!s.content_editable)d.designMode='On';}catch(ex){}}try{d.execCommand("styleWithCSS",0,false);}catch(ex){if(!t._isHidden())try{d.execCommand("useCSS",0,true);}catch(ex){}}if(!s.table_inline_editing)try{d.execCommand('enableInlineTableEditing',false,false);}catch(ex){}if(!s.object_resizing)try{d.execCommand('enableObjectResizing',false,false);}catch(ex){}}};t.onBeforeExecCommand.add(setOpts);t.onMouseDown.add(setOpts);}t.onMouseUp.add(t.nodeChanged);t.onClick.add(t.nodeChanged);t.onKeyUp.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45||e.keyCode==46||e.keyCode==8||e.ctrlKey)t.nodeChanged();});t.onReset.add(function(){t.setContent(t.startContent,{format:'raw'});});if(t.getParam('tab_focus')){function tabCancel(ed,e){if(e.keyCode===9)return Event.cancel(e);};function tabHandler(ed,e){var x,i,f,el,v;function find(d){f=DOM.getParent(ed.id,'form');el=f.elements;if(f){each(el,function(e,i){if(e.id==ed.id){x=i;return false;}});if(d>0){for(i=x+1;i<el.length;i++){if(el[i].type!='hidden')return el[i];}}else{for(i=x-1;i>=0;i--){if(el[i].type!='hidden')return el[i];}}}return null;};if(e.keyCode===9){v=explode(ed.getParam('tab_focus'));if(v.length==1){v[1]=v[0];v[0]=':prev';}if(e.shiftKey){if(v[0]==':prev')el=find(-1);else el=DOM.get(v[0]);}else{if(v[1]==':next')el=find(1);else el=DOM.get(v[1]);}if(el){if(ed=EditorManager.get(el.id||el.name))ed.focus();else window.setTimeout(function(){window.focus();el.focus();},10);return Event.cancel(e);}}};t.onKeyUp.add(tabCancel);if(isGecko){t.onKeyPress.add(tabHandler);t.onKeyDown.add(tabCancel);}else t.onKeyDown.add(tabHandler);}if(s.custom_shortcuts){if(s.custom_undo_redo_keyboard_shortcuts){t.addShortcut('ctrl+z',t.getLang('undo_desc'),'Undo');t.addShortcut('ctrl+y',t.getLang('redo_desc'),'Redo');}if(isGecko){t.addShortcut('ctrl+b',t.getLang('bold_desc'),'Bold');t.addShortcut('ctrl+i',t.getLang('italic_desc'),'Italic');t.addShortcut('ctrl+u',t.getLang('underline_desc'),'Underline');}for(i=1;i<=6;i++)t.addShortcut('ctrl+'+i,'',['FormatBlock',false,'<h'+i+'>']);t.addShortcut('ctrl+7','',['FormatBlock',false,'<p>']);t.addShortcut('ctrl+8','',['FormatBlock',false,'<div>']);t.addShortcut('ctrl+9','',['FormatBlock',false,'<address>']);function find(e){var v=null;if(!e.altKey&&!e.ctrlKey&&!e.metaKey)return v;each(t.shortcuts,function(o){if(o.ctrl!=e.ctrlKey&&(!tinymce.isMac||o.ctrl==e.metaKey))return;if(o.alt!=e.altKey)return;if(o.shift!=e.shiftKey)return;if(e.keyCode==o.keyCode||(e.charCode&&e.charCode==o.charCode)){v=o;return false;}});return v;};t.onKeyUp.add(function(ed,e){var o=find(e);if(o)return Event.cancel(e);});t.onKeyPress.add(function(ed,e){var o=find(e);if(o)return Event.cancel(e);});t.onKeyDown.add(function(ed,e){var o=find(e);if(o){o.func.call(o.scope);return Event.cancel(e);}});}if(tinymce.isIE){Event.add(t.getDoc(),'controlselect',function(e){var re=t.resizeInfo,cb;e=e.target;if(e.nodeName!=='IMG')return;if(re)Event.remove(re.node,re.ev,re.cb);if(!t.dom.hasClass(e,'mceItemNoResize')){ev='resizeend';cb=Event.add(e,ev,function(e){var v;e=e.target;if(v=t.dom.getStyle(e,'width')){t.dom.setAttrib(e,'width',v.replace(/[^0-9%]+/g,''));t.dom.setStyle(e,'width','');}if(v=t.dom.getStyle(e,'height')){t.dom.setAttrib(e,'height',v.replace(/[^0-9%]+/g,''));t.dom.setStyle(e,'height','');}});}else{ev='resizestart';cb=Event.add(e,'resizestart',Event.cancel,Event);}re=t.resizeInfo={node:e,ev:ev,cb:cb};});t.onKeyDown.add(function(ed,e){switch(e.keyCode){case 8:if(t.selection.getRng().item){t.selection.getRng().item(0).removeNode();return Event.cancel(e);}}});}if(tinymce.isOpera){t.onClick.add(function(ed,e){Event.prevent(e);});}if(s.custom_undo_redo){function addUndo(){t.undoManager.typing=0;t.undoManager.add();};if(tinymce.isIE){Event.add(t.getWin(),'blur',function(e){var n;if(t.selection){n=t.selection.getNode();if(!t.removed&&n.ownerDocument&&n.ownerDocument!=t.getDoc())addUndo();}});}else{Event.add(t.getDoc(),'blur',function(){if(t.selection&&!t.removed)addUndo();});}t.onMouseDown.add(addUndo);t.onKeyUp.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45||e.ctrlKey){t.undoManager.typing=0;t.undoManager.add();}});t.onKeyDown.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45){if(t.undoManager.typing){t.undoManager.add();t.undoManager.typing=0;}return;}if(!t.undoManager.typing){t.undoManager.add();t.undoManager.typing=1;}});}},_convertInlineElements:function(){var t=this,s=t.settings,dom=t.dom,v,e,na,st,sp;function convert(ed,o){if(!s.inline_styles)return;if(o.get){each(t.dom.select('table,u,strike',o.node),function(n){switch(n.nodeName){case'TABLE':if(v=dom.getAttrib(n,'height')){dom.setStyle(n,'height',v);dom.setAttrib(n,'height','');}break;case'U':case'STRIKE':n.style.textDecoration=n.nodeName=='U'?'underline':'line-through';dom.setAttrib(n,'mce_style','');dom.setAttrib(n,'mce_name','span');break;}});}else if(o.set){each(t.dom.select('table,span',o.node).reverse(),function(n){if(n.nodeName=='TABLE'){if(v=dom.getStyle(n,'height'))dom.setAttrib(n,'height',v.replace(/[^0-9%]+/g,''));}else{if(n.style.textDecoration=='underline')na='u';else if(n.style.textDecoration=='line-through')na='strike';else na='';if(na){n.style.textDecoration='';dom.setAttrib(n,'mce_style','');e=dom.create(na,{style:dom.getAttrib(n,'style')});dom.replace(e,n,1);}}});}};t.onPreProcess.add(convert);if(!s.cleanup_on_startup){t.onSetContent.add(function(ed,o){if(o.initial)convert(t,{node:t.getBody(),set:1});});}},_convertFonts:function(){var t=this,s=t.settings,dom=t.dom,fz,fzn,sl,cl;if(!s.inline_styles)return;fz=[8,10,12,14,18,24,36];fzn=['xx-small','x-small','small','medium','large','x-large','xx-large'];if(sl=s.font_size_style_values)sl=explode(sl);if(cl=s.font_size_classes)cl=explode(cl);function convertToFonts(no){var n,f,nl,x,i,v,st;if(tinymce.isWebKit||!s.inline_styles)return;nl=t.dom.select('span',no);for(x=nl.length-1;x>=0;x--){n=nl[x];f=dom.create('font',{color:dom.toHex(dom.getStyle(n,'color')),face:dom.getStyle(n,'fontFamily'),style:dom.getAttrib(n,'style'),'class':dom.getAttrib(n,'class')});st=f.style;if(st.color||st.fontFamily){st.color=st.fontFamily='';dom.setAttrib(f,'mce_style','');}if(sl){i=inArray(sl,dom.getStyle(n,'fontSize'));if(i!=-1){dom.setAttrib(f,'size',''+(i+1||1));}}else if(cl){i=inArray(cl,dom.getAttrib(n,'class'));v=dom.getStyle(n,'fontSize');if(i==-1&&v.indexOf('pt')>0)i=inArray(fz,parseInt(v));if(i==-1)i=inArray(fzn,v);if(i!=-1){dom.setAttrib(f,'size',''+(i+1||1));f.style.fontSize='';}}if(f.color||f.face||f.size){f.style.fontFamily='';dom.setAttrib(f,'mce_style','');dom.replace(f,n,1);}f=n=null;}};t.onSetContent.add(function(ed,o){convertToFonts(ed.getBody());});t.onPreProcess.add(function(ed,o){var n,sp,nl,x;if(!s.inline_styles)return;if(o.get){nl=t.dom.select('font',o.node);for(x=nl.length-1;x>=0;x--){n=nl[x];sp=dom.create('span',{style:dom.getAttrib(n,'style'),'class':dom.getAttrib(n,'class')});dom.setStyles(sp,{fontFamily:dom.getAttrib(n,'face'),color:dom.getAttrib(n,'color'),backgroundColor:n.style.backgroundColor});if(n.size){if(sl)dom.setStyle(sp,'fontSize',sl[parseInt(n.size)-1]);else dom.setAttrib(sp,'class',cl[parseInt(n.size)-1]);}dom.setAttrib(sp,'mce_style','');dom.replace(sp,n,1);}}});},_isHidden:function(){var s;if(!isGecko)return 0;s=this.selection.getSel();return(!s||!s.rangeCount||s.rangeCount==0);},_fixNesting:function(s){var d=[],i;s=s.replace(/<(\/)?([^\s>]+)[^>]*?>/g,function(a,b,c){var e;if(b==='/'){if(!d.length)return'';if(c!==d[d.length-1].tag){for(i=d.length-1;i>=0;i--){if(d[i].tag===c){d[i].close=1;break;}}return'';}else{d.pop();if(d.length&&d[d.length-1].close){a=a+'</'+d[d.length-1].tag+'>';d.pop();}}}else{if(/^(br|hr|input|meta|img|link|param)$/i.test(c))return a;if(/\/>$/.test(a))return a;d.push({tag:c});}return a;});for(i=d.length-1;i>=0;i--)s+='</'+d[i].tag+'>';return s;}});})();(function(){var each=tinymce.each,isIE=tinymce.isIE,isGecko=tinymce.isGecko,isOpera=tinymce.isOpera,isWebKit=tinymce.isWebKit;tinymce.create('tinymce.EditorCommands',{EditorCommands:function(ed){this.editor=ed;},execCommand:function(cmd,ui,val){var t=this,ed=t.editor,f;switch(cmd){case'Cut':case'Copy':case'Paste':try{ed.getDoc().execCommand(cmd,ui,val);}catch(ex){if(isGecko){ed.windowManager.confirm(ed.getLang('clipboard_msg'),function(s){if(s)window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html','mceExternal');});}else ed.windowManager.alert(ed.getLang('clipboard_no_support'));}return true;case'mceResetDesignMode':case'mceBeginUndoLevel':return true;case'unlink':t.UnLink();return true;case'JustifyLeft':case'JustifyCenter':case'JustifyRight':case'JustifyFull':t.mceJustify(cmd,cmd.substring(7).toLowerCase());return true;case'mceEndUndoLevel':case'mceAddUndoLevel':ed.undoManager.add();return true;default:f=this[cmd];if(f){f.call(this,ui,val);return true;}}return false;},Indent:function(){var ed=this.editor,d=ed.dom,s=ed.selection,e,iv,iu;iv=ed.settings.indentation;iu=/[a-z%]+$/i.exec(iv);iv=parseInt(iv);if(ed.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){each(this._getSelectedBlocks(),function(e){d.setStyle(e,'paddingLeft',(parseInt(e.style.paddingLeft||0)+iv)+iu);});return;}ed.getDoc().execCommand('Indent',false,null);if(isIE){d.getParent(s.getNode(),function(n){if(n.nodeName=='BLOCKQUOTE'){n.dir=n.style.cssText='';}});}},Outdent:function(){var ed=this.editor,d=ed.dom,s=ed.selection,e,v,iv,iu;iv=ed.settings.indentation;iu=/[a-z%]+$/i.exec(iv);iv=parseInt(iv);if(ed.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){each(this._getSelectedBlocks(),function(e){v=Math.max(0,parseInt(e.style.paddingLeft||0)-iv);d.setStyle(e,'paddingLeft',v?v+iu:'');});return;}ed.getDoc().execCommand('Outdent',false,null);},mceSetAttribute:function(u,v){var ed=this.editor,d=ed.dom,e;if(e=d.getParent(ed.selection.getNode(),d.isBlock))d.setAttrib(e,v.name,v.value);},mceSetContent:function(u,v){this.editor.setContent(v);},mceToggleVisualAid:function(){var ed=this.editor;ed.hasVisual=!ed.hasVisual;ed.addVisual();},mceReplaceContent:function(u,v){var s=this.editor.selection;s.setContent(v.replace(/\{\$selection\}/g,s.getContent({format:'text'})));},mceInsertLink:function(u,v){var ed=this.editor,s=ed.selection,e=ed.dom.getParent(s.getNode(),'A');if(tinymce.is(v,'string'))v={href:v};function set(e){each(v,function(v,k){ed.dom.setAttrib(e,k,v);});};if(!e){ed.execCommand('CreateLink',false,'javascript:mctmp(0);');each(ed.dom.select('a'),function(e){if(e.href=='javascript:mctmp(0);')set(e);});}else{if(v.href)set(e);else ed.dom.remove(e,1);}},UnLink:function(){var ed=this.editor,s=ed.selection;if(s.isCollapsed())s.select(s.getNode());ed.getDoc().execCommand('unlink',false,null);s.collapse(0);},FontName:function(u,v){var t=this,ed=t.editor,s=ed.selection,e;if(!v){if(s.isCollapsed())s.select(s.getNode());t.RemoveFormat();}else ed.getDoc().execCommand('FontName',false,v);},FontSize:function(u,v){var ed=this.editor,s=ed.settings,fz=tinymce.explode(s.font_size_style_values),fzc=tinymce.explode(s.font_size_classes),h,bm;each(ed.dom.select('font'),function(e){e.style.fontSize='';});ed.getDoc().execCommand('FontSize',false,v);if(s.inline_styles){each(ed.dom.select('font'),function(e){if(e.parentNode.nodeName=='FONT'&&e.size==e.parentNode.size){if(!bm)bm=ed.selection.getBookmark();ed.dom.remove(e,1);return;}if(v=e.size){if(fzc&&fzc.length>0)ed.dom.setAttrib(e,'class',fzc[parseInt(v)-1]);else ed.dom.setStyle(e,'fontSize',fz[parseInt(v)-1]);}});}ed.selection.moveToBookmark(bm);},queryCommandValue:function(c){var f=this['queryValue'+c];if(f)return f.call(this,c);return false;},queryCommandState:function(cmd){var f;switch(cmd){case'JustifyLeft':case'JustifyCenter':case'JustifyRight':case'JustifyFull':return this.queryStateJustify(cmd,cmd.substring(7).toLowerCase());default:if(f=this['queryState'+cmd])return f.call(this,cmd);}return-1;},_queryState:function(c){try{return this.editor.getDoc().queryCommandState(c);}catch(ex){}},_queryVal:function(c){try{return this.editor.getDoc().queryCommandValue(c);}catch(ex){}},queryValueFontSize:function(){var ed=this.editor,v=0,p;if(isOpera||isWebKit){if(p=ed.dom.getParent(ed.selection.getNode(),'FONT'))v=p.size;return v;}return this._queryVal('FontSize');},queryValueFontName:function(){var ed=this.editor,v=0,p;if(p=ed.dom.getParent(ed.selection.getNode(),'FONT'))v=p.face;if(!v)v=this._queryVal('FontName');return v;},mceJustify:function(c,v){var ed=this.editor,se=ed.selection,n=se.getNode(),nn=n.nodeName,bl,nb,dom=ed.dom,rm;if(ed.settings.inline_styles&&this.queryStateJustify(c,v))rm=1;bl=dom.getParent(n,ed.dom.isBlock);if(nn=='IMG'){if(v=='full')return;if(rm){if(v=='center')dom.setStyle(bl||n.parentNode,'textAlign','');dom.setStyle(n,'float','');this.mceRepaint();return;}if(v=='center'){if(bl&&/^(TD|TH)$/.test(bl.nodeName))bl=0;if(!bl||bl.childNodes.length>1){nb=dom.create('p');nb.appendChild(n.cloneNode(false));if(bl)dom.insertAfter(nb,bl);else dom.insertAfter(nb,n);dom.remove(n);n=nb.firstChild;bl=nb;}dom.setStyle(bl,'textAlign',v);dom.setStyle(n,'float','');}else{dom.setStyle(n,'float',v);dom.setStyle(bl||n.parentNode,'textAlign','');}this.mceRepaint();return;}if(ed.settings.inline_styles&&ed.settings.forced_root_block){if(rm)v='';each(this._getSelectedBlocks(dom.getParent(se.getStart(),dom.isBlock),dom.getParent(se.getEnd(),dom.isBlock)),function(e){dom.setAttrib(e,'align','');dom.setStyle(e,'textAlign',v=='full'?'justify':v);});return;}else if(!rm)ed.getDoc().execCommand(c,false,null);if(ed.settings.inline_styles){if(rm){dom.getParent(ed.selection.getNode(),function(n){if(n.style&&n.style.textAlign)dom.setStyle(n,'textAlign','');});return;}each(dom.select('*'),function(n){var v=n.align;if(v){if(v=='full')v='justify';dom.setStyle(n,'textAlign',v);dom.setAttrib(n,'align','');}});}},mceSetCSSClass:function(u,v){this.mceSetStyleInfo(0,{command:'setattrib',name:'class',value:v});},getSelectedElement:function(){var t=this,ed=t.editor,dom=ed.dom,se=ed.selection,r=se.getRng(),r1,r2,sc,ec,so,eo,e,sp,ep,re;if(se.isCollapsed()||r.item)return se.getNode();re=ed.settings.merge_styles_invalid_parents;if(tinymce.is(re,'string'))re=new RegExp(re,'i');if(isIE){r1=r.duplicate();r1.collapse(true);sc=r1.parentElement();r2=r.duplicate();r2.collapse(false);ec=r2.parentElement();if(sc!=ec){r1.move('character',1);sc=r1.parentElement();}if(sc==ec){r1=r.duplicate();r1.moveToElementText(sc);if(r1.compareEndPoints('StartToStart',r)==0&&r1.compareEndPoints('EndToEnd',r)==0)return re&&re.test(sc.nodeName)?null:sc;}}else{function getParent(n){return dom.getParent(n,function(n){return n.nodeType==1;});};sc=r.startContainer;ec=r.endContainer;so=r.startOffset;eo=r.endOffset;if(!r.collapsed){if(sc==ec){if(so-eo<2){if(sc.hasChildNodes()){sp=sc.childNodes[so];return re&&re.test(sp.nodeName)?null:sp;}}}}if(sc.nodeType!=3||ec.nodeType!=3)return null;if(so==0){sp=getParent(sc);if(sp&&sp.firstChild!=sc)sp=null;}if(so==sc.nodeValue.length){e=sc.nextSibling;if(e&&e.nodeType==1)sp=sc.nextSibling;}if(eo==0){e=ec.previousSibling;if(e&&e.nodeType==1)ep=e;}if(eo==ec.nodeValue.length){ep=getParent(ec);if(ep&&ep.lastChild!=ec)ep=null;}if(sp==ep)return re&&sp&&re.test(sp.nodeName)?null:sp;}return null;},InsertHorizontalRule:function(){if(isGecko||isIE)this.editor.selection.setContent('<hr />');else this.editor.getDoc().execCommand('InsertHorizontalRule',false,'');},RemoveFormat:function(){var t=this,ed=t.editor,s=ed.selection,b;if(isWebKit)s.setContent(s.getContent({format:'raw'}).replace(/(<(span|b|i|strong|em|strike) [^>]+>|<(span|b|i|strong|em|strike)>|<\/(span|b|i|strong|em|strike)>|)/g,''),{format:'raw'});else ed.getDoc().execCommand('RemoveFormat',false,null);t.mceSetStyleInfo(0,{command:'removeformat'});ed.addVisual();},mceSetStyleInfo:function(u,v){var t=this,ed=t.editor,d=ed.getDoc(),dom=ed.dom,e,b,s=ed.selection,nn=v.wrapper||'span',b=s.getBookmark(),re;function set(n,e){if(n.nodeType==1){switch(v.command){case'setattrib':return dom.setAttrib(n,v.name,v.value);case'setstyle':return dom.setStyle(n,v.name,v.value);case'removeformat':return dom.setAttrib(n,'class','');}}};re=ed.settings.merge_styles_invalid_parents;if(tinymce.is(re,'string'))re=new RegExp(re,'i');if(e=t.getSelectedElement())set(e,1);else{d.execCommand('FontName',false,'__');each(isWebKit?dom.select('span'):dom.select('font'),function(n){var sp,e;if(dom.getAttrib(n,'face')=='__'||n.style.fontFamily==='__'){sp=dom.create(nn,{mce_new:'1'});set(sp);each(n.childNodes,function(n){sp.appendChild(n.cloneNode(true));});dom.replace(sp,n);}});}each(dom.select(nn).reverse(),function(n){var p=n.parentNode;if(!dom.getAttrib(n,'mce_new')){p=dom.getParent(n,function(n){return n.nodeType==1&&dom.getAttrib(n,'mce_new');});if(p)dom.remove(n,1);}});each(dom.select(nn).reverse(),function(n){var p=n.parentNode;if(!p||!dom.getAttrib(n,'mce_new'))return;if(p.nodeName==nn.toUpperCase()&&p.childNodes.length==1)return dom.remove(p,1);if(n.nodeType==1&&(!re||!re.test(p.nodeName))&&p.childNodes.length==1){set(p);dom.setAttrib(n,'class','');}});each(dom.select(nn).reverse(),function(n){if(dom.getAttrib(n,'mce_new')||(dom.getAttribs(n).length<=1&&n.className==='')){if(!dom.getAttrib(n,'class')&&!dom.getAttrib(n,'style'))return dom.remove(n,1);dom.setAttrib(n,'mce_new','');}});s.moveToBookmark(b);},queryStateJustify:function(c,v){var ed=this.editor,n=ed.selection.getNode(),dom=ed.dom;if(n&&n.nodeName=='IMG'){if(dom.getStyle(n,'float')==v)return 1;return n.parentNode.style.textAlign==v;}n=dom.getParent(ed.selection.getStart(),function(n){return n.nodeType==1&&n.style.textAlign;});if(v=='full')v='justify';if(ed.settings.inline_styles)return(n&&n.style.textAlign==v);return this._queryState(c);},HiliteColor:function(ui,val){var t=this,ed=t.editor,d=ed.getDoc();function set(s){if(!isGecko)return;try{d.execCommand("styleWithCSS",0,s);}catch(ex){d.execCommand("useCSS",0,!s);}};if(isGecko||isOpera){set(true);d.execCommand('hilitecolor',false,val);set(false);}else d.execCommand('BackColor',false,val);},Undo:function(){var ed=this.editor;if(ed.settings.custom_undo_redo){ed.undoManager.undo();ed.nodeChanged();}else ed.getDoc().execCommand('Undo',false,null);},Redo:function(){var ed=this.editor;if(ed.settings.custom_undo_redo){ed.undoManager.redo();ed.nodeChanged();}else ed.getDoc().execCommand('Redo',false,null);},FormatBlock:function(ui,val){var t=this,ed=t.editor,s=ed.selection,dom=ed.dom,bl,nb,b;function isBlock(n){return/^(P|DIV|H[1-6]|ADDRESS|BLOCKQUOTE|PRE)$/.test(n.nodeName);};bl=dom.getParent(s.getNode(),function(n){return isBlock(n);});if(bl){if((isIE&&isBlock(bl.parentNode))||bl.nodeName=='DIV'){nb=ed.dom.create(val);each(dom.getAttribs(bl),function(v){dom.setAttrib(nb,v.nodeName,dom.getAttrib(bl,v.nodeName));});b=s.getBookmark();dom.replace(nb,bl,1);s.moveToBookmark(b);ed.nodeChanged();return;}}val=ed.settings.forced_root_block?(val||'<p>'):val;if(val.indexOf('<')==-1)val='<'+val+'>';if(tinymce.isGecko)val=val.replace(/<(div|blockquote|code|dt|dd|dl|samp)>/gi,'$1');ed.getDoc().execCommand('FormatBlock',false,val);},mceCleanup:function(){var ed=this.editor,s=ed.selection,b=s.getBookmark();ed.setContent(ed.getContent());s.moveToBookmark(b);},mceRemoveNode:function(ui,val){var ed=this.editor,s=ed.selection,b,n=val||s.getNode();if(n==ed.getBody())return;b=s.getBookmark();ed.dom.remove(n,1);s.moveToBookmark(b);ed.nodeChanged();},mceSelectNodeDepth:function(ui,val){var ed=this.editor,s=ed.selection,c=0;ed.dom.getParent(s.getNode(),function(n){if(n.nodeType==1&&c++==val){s.select(n);ed.nodeChanged();return false;}},ed.getBody());},mceSelectNode:function(u,v){this.editor.selection.select(v);},mceInsertContent:function(ui,val){this.editor.selection.setContent(val);},mceInsertRawHTML:function(ui,val){var ed=this.editor;ed.selection.setContent('tiny_mce_marker');ed.setContent(ed.getContent().replace(/tiny_mce_marker/g,val));},mceRepaint:function(){var s,b,e=this.editor;if(tinymce.isGecko){try{s=e.selection;b=s.getBookmark(true);if(s.getSel())s.getSel().selectAllChildren(e.getBody());s.collapse(true);s.moveToBookmark(b);}catch(ex){}}},queryStateUnderline:function(){var ed=this.editor,n=ed.selection.getNode();if(n&&n.nodeName=='A')return false;return this._queryState('Underline');},queryStateOutdent:function(){var ed=this.editor,n;if(ed.settings.inline_styles){if((n=ed.dom.getParent(ed.selection.getStart(),ed.dom.isBlock))&&parseInt(n.style.paddingLeft)>0)return true;if((n=ed.dom.getParent(ed.selection.getEnd(),ed.dom.isBlock))&&parseInt(n.style.paddingLeft)>0)return true;}else return!!ed.dom.getParent(ed.selection.getNode(),'BLOCKQUOTE');return this.queryStateInsertUnorderedList()||this.queryStateInsertOrderedList();},queryStateInsertUnorderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),'UL');},queryStateInsertOrderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),'OL');},queryStatemceBlockQuote:function(){return!!this.editor.dom.getParent(this.editor.selection.getStart(),function(n){return n.nodeName==='BLOCKQUOTE';});},mceBlockQuote:function(){var t=this,ed=t.editor,s=ed.selection,dom=ed.dom,sb,eb,n,bm,bq,r,bq2,i,nl;function getBQ(e){return dom.getParent(e,function(n){return n.nodeName==='BLOCKQUOTE';});};sb=dom.getParent(s.getStart(),dom.isBlock);eb=dom.getParent(s.getEnd(),dom.isBlock);if(bq=getBQ(sb)){if(sb!=eb||sb.childNodes.length>1||(sb.childNodes.length==1&&sb.firstChild.nodeName!='BR'))bm=s.getBookmark();if(getBQ(eb)){bq2=bq.cloneNode(false);while(n=eb.nextSibling)bq2.appendChild(n.parentNode.removeChild(n));}if(bq2)dom.insertAfter(bq2,bq);nl=t._getSelectedBlocks(sb,eb);for(i=nl.length-1;i>=0;i--){dom.insertAfter(nl[i],bq);}if(/^\s*$/.test(bq.innerHTML))dom.remove(bq,1);if(bq2&&/^\s*$/.test(bq2.innerHTML))dom.remove(bq2,1);if(!bm){if(!isIE){r=ed.getDoc().createRange();r.setStart(sb,0);r.setEnd(sb,0);s.setRng(r);}else{s.select(sb);s.collapse(0);if(dom.getParent(s.getStart(),dom.isBlock)!=sb){r=s.getRng();r.move('character',-1);r.select();}}}else t.editor.selection.moveToBookmark(bm);return;}if(isIE&&!sb&&!eb){t.editor.getDoc().execCommand('Indent');n=getBQ(s.getNode());n.style.margin=n.dir='';return;}if(!sb||!eb)return;if(sb!=eb||sb.childNodes.length>1||(sb.childNodes.length==1&&sb.firstChild.nodeName!='BR'))bm=s.getBookmark();each(t._getSelectedBlocks(getBQ(s.getStart()),getBQ(s.getEnd())),function(e){if(e.nodeName=='BLOCKQUOTE'&&!bq){bq=e;return;}if(!bq){bq=dom.create('blockquote');e.parentNode.insertBefore(bq,e);}if(e.nodeName=='BLOCKQUOTE'&&bq){n=e.firstChild;while(n){bq.appendChild(n.cloneNode(true));n=n.nextSibling;}dom.remove(e);return;}bq.appendChild(dom.remove(e));});if(!bm){if(!isIE){r=ed.getDoc().createRange();r.setStart(sb,0);r.setEnd(sb,0);s.setRng(r);}else{s.select(sb);s.collapse(1);}}else s.moveToBookmark(bm);},_getSelectedBlocks:function(st,en){var ed=this.editor,dom=ed.dom,s=ed.selection,sb,eb,n,bl=[];sb=dom.getParent(st||s.getStart(),dom.isBlock);eb=dom.getParent(en||s.getEnd(),dom.isBlock);if(sb)bl.push(sb);if(sb&&eb&&sb!=eb){n=sb;while((n=n.nextSibling)&&n!=eb){if(dom.isBlock(n))bl.push(n);}}if(eb&&sb!=eb)bl.push(eb);return bl;}});})();tinymce.create('tinymce.UndoManager',{index:0,data:null,typing:0,UndoManager:function(ed){var t=this,Dispatcher=tinymce.util.Dispatcher;t.editor=ed;t.data=[];t.onAdd=new Dispatcher(this);t.onUndo=new Dispatcher(this);t.onRedo=new Dispatcher(this);},add:function(l){var t=this,i,ed=t.editor,b,s=ed.settings,la;l=l||{};l.content=l.content||ed.getContent({format:'raw',no_events:1});l.content=l.content.replace(/^\s*|\s*$/g,'');la=t.data[t.index>0&&(t.index==0||t.index==t.data.length)?t.index-1:t.index];if(!l.initial&&la&&l.content==la.content)return null;if(s.custom_undo_redo_levels){if(t.data.length>s.custom_undo_redo_levels){for(i=0;i<t.data.length-1;i++)t.data[i]=t.data[i+1];t.data.length--;t.index=t.data.length;}}if(s.custom_undo_redo_restore_selection&&!l.initial)l.bookmark=b=l.bookmark||ed.selection.getBookmark();if(t.index<t.data.length)t.index++;if(t.data.length===0&&!l.initial)return null;t.data.length=t.index+1;t.data[t.index++]=l;if(l.initial)t.index=0;if(t.data.length==2&&t.data[0].initial)t.data[0].bookmark=b;t.onAdd.dispatch(t,l);ed.isNotDirty=0;return l;},undo:function(){var t=this,ed=t.editor,l=l,i;if(t.typing){t.add();t.typing=0;}if(t.index>0){if(t.index==t.data.length&&t.index>1){i=t.index;t.typing=0;if(!t.add())t.index=i;--t.index;}l=t.data[--t.index];ed.setContent(l.content,{format:'raw'});ed.selection.moveToBookmark(l.bookmark);t.onUndo.dispatch(t,l);}return l;},redo:function(){var t=this,ed=t.editor,l=null;if(t.index<t.data.length-1){l=t.data[++t.index];ed.setContent(l.content,{format:'raw'});ed.selection.moveToBookmark(l.bookmark);t.onRedo.dispatch(t,l);}return l;},clear:function(){var t=this;t.data=[];t.index=0;t.typing=0;t.add({initial:true});},hasUndo:function(){return this.index!=0||this.typing;},hasRedo:function(){return this.index<this.data.length-1;}});(function(){var Event,isIE,isGecko,isOpera,each,extend;Event=tinymce.dom.Event;isIE=tinymce.isIE;isGecko=tinymce.isGecko;isOpera=tinymce.isOpera;each=tinymce.each;extend=tinymce.extend;tinymce.create('tinymce.ForceBlocks',{ForceBlocks:function(ed){var t=this,s=ed.settings,elm;t.editor=ed;t.dom=ed.dom;elm=(s.forced_root_block||'p').toLowerCase();s.element=elm.toUpperCase();ed.onPreInit.add(t.setup,t);t.reOpera=new RegExp('(\\u00a0|&#160;|&nbsp;)<\/'+elm+'>','gi');t.rePadd=new RegExp('<p( )([^>]+)><\\\/p>|<p( )([^>]+)\\\/>|<p( )([^>]+)>\\s+<\\\/p>|<p><\\\/p>|<p\\\/>|<p>\\s+<\\\/p>'.replace(/p/g,elm),'gi');t.reNbsp2BR1=new RegExp('<p( )([^>]+)>[\\s\\u00a0]+<\\\/p>|<p>[\\s\\u00a0]+<\\\/p>'.replace(/p/g,elm),'gi');t.reNbsp2BR2=new RegExp('<p( )([^>]+)>(&nbsp;|&#160;)<\\\/p>|<p>(&nbsp;|&#160;)<\\\/p>'.replace(/p/g,elm),'gi');t.reBR2Nbsp=new RegExp('<p( )([^>]+)>\\s*<br \\\/>\\s*<\\\/p>|<p>\\s*<br \\\/>\\s*<\\\/p>'.replace(/p/g,elm),'gi');t.reTrailBr=new RegExp('\\s*<br \\/>\\s*<\\\/p>'.replace(/p/g,elm),'gi');function padd(ed,o){if(isOpera)o.content=o.content.replace(t.reOpera,'</'+elm+'>');o.content=o.content.replace(t.rePadd,'<'+elm+'$1$2$3$4$5$6>\u00a0</'+elm+'>');if(!isIE&&!isOpera&&o.set){o.content=o.content.replace(t.reNbsp2BR1,'<'+elm+'$1$2><br /></'+elm+'>');o.content=o.content.replace(t.reNbsp2BR2,'<'+elm+'$1$2><br /></'+elm+'>');}else{o.content=o.content.replace(t.reBR2Nbsp,'<'+elm+'$1$2>\u00a0</'+elm+'>');o.content=o.content.replace(t.reTrailBr,'</'+elm+'>');}};ed.onBeforeSetContent.add(padd);ed.onPostProcess.add(padd);if(s.forced_root_block){ed.onInit.add(t.forceRoots,t);ed.onSetContent.add(t.forceRoots,t);ed.onBeforeGetContent.add(t.forceRoots,t);}},setup:function(){var t=this,ed=t.editor,s=ed.settings;if(s.forced_root_block){ed.onKeyUp.add(t.forceRoots,t);ed.onPreProcess.add(t.forceRoots,t);}if(s.force_br_newlines){if(isIE){ed.onKeyPress.add(function(ed,e){var n,s=ed.selection;if(e.keyCode==13&&s.getNode().nodeName!='LI'){s.setContent('<br id="__" /> ',{format:'raw'});n=ed.dom.get('__');n.removeAttribute('id');s.select(n);s.collapse();return Event.cancel(e);}});}return;}if(!isIE&&s.force_p_newlines){ed.onKeyPress.add(function(ed,e){if(e.keyCode==13&&!e.shiftKey){if(!t.insertPara(e))Event.cancel(e);}});if(isGecko){ed.onKeyDown.add(function(ed,e){if((e.keyCode==8||e.keyCode==46)&&!e.shiftKey)t.backspaceDelete(e,e.keyCode==8);});}}function ren(rn,na){var ne=ed.dom.create(na);each(rn.attributes,function(a){if(a.specified&&a.nodeValue)ne.setAttribute(a.nodeName.toLowerCase(),a.nodeValue);});each(rn.childNodes,function(n){ne.appendChild(n.cloneNode(true));});rn.parentNode.replaceChild(ne,rn);return ne;};if(isIE&&s.element!='P'){ed.onKeyPress.add(function(ed,e){t.lastElm=ed.selection.getNode().nodeName;});ed.onKeyUp.add(function(ed,e){var bl,sel=ed.selection,n=sel.getNode(),b=ed.getBody();if(b.childNodes.length===1&&n.nodeName=='P'){n=ren(n,s.element);sel.select(n);sel.collapse();ed.nodeChanged();}else if(e.keyCode==13&&!e.shiftKey&&t.lastElm!='P'){bl=ed.dom.getParent(n,'P');if(bl){ren(bl,s.element);ed.nodeChanged();}}});}},find:function(n,t,s){var ed=this.editor,w=ed.getDoc().createTreeWalker(n,4,null,false),c=-1;while(n=w.nextNode()){c++;if(t==0&&n==s)return c;if(t==1&&c==s)return n;}return-1;},forceRoots:function(ed,e){var t=this,ed=t.editor,b=ed.getBody(),d=ed.getDoc(),se=ed.selection,s=se.getSel(),r=se.getRng(),si=-2,ei,so,eo,tr,c=-0xFFFFFF;var nx,bl,bp,sp,le,nl=b.childNodes,i;if(e&&e.keyCode==13)return true;for(i=nl.length-1;i>=0;i--){nx=nl[i];if(nx.nodeType==3||(!t.dom.isBlock(nx)&&nx.nodeType!=8)){if(!bl){if(nx.nodeType!=3||/[^\s]/g.test(nx.nodeValue)){if(si==-2&&r){if(!isIE){if(ed.dom.getParent(r.startContainer,function(e){return e===b;})){so=r.startOffset;eo=r.endOffset;si=t.find(b,0,r.startContainer);ei=t.find(b,0,r.endContainer);}}else{tr=d.body.createTextRange();tr.moveToElementText(b);tr.collapse(1);bp=tr.move('character',c)*-1;tr=r.duplicate();tr.collapse(1);sp=tr.move('character',c)*-1;tr=r.duplicate();tr.collapse(0);le=(tr.move('character',c)*-1)-sp;si=sp-bp;ei=le;}}bl=ed.dom.create(ed.settings.forced_root_block);bl.appendChild(nx.cloneNode(1));nx.parentNode.replaceChild(bl,nx);}}else{if(bl.hasChildNodes())bl.insertBefore(nx,bl.firstChild);else bl.appendChild(nx);}}else bl=null;}if(si!=-2){if(!isIE){bl=b.getElementsByTagName(ed.settings.element)[0];r=d.createRange();if(si!=-1)r.setStart(t.find(b,1,si),so);else r.setStart(bl,0);if(ei!=-1)r.setEnd(t.find(b,1,ei),eo);else r.setEnd(bl,0);if(s){s.removeAllRanges();s.addRange(r);}}else{try{r=s.createRange();r.moveToElementText(b);r.collapse(1);r.moveStart('character',si);r.moveEnd('character',ei);r.select();}catch(ex){}}}},getParentBlock:function(n){var d=this.dom;return d.getParent(n,d.isBlock);},insertPara:function(e){var t=this,ed=t.editor,dom=ed.dom,d=ed.getDoc(),se=ed.settings,s=ed.selection.getSel(),r=s.getRangeAt(0),b=d.body;var rb,ra,dir,sn,so,en,eo,sb,eb,bn,bef,aft,sc,ec,n,vp=dom.getViewPort(ed.getWin()),y,ch;function isEmpty(n){n=n.innerHTML;n=n.replace(/<(img|hr|table)/gi,'-');n=n.replace(/<[^>]+>/g,'');return n.replace(/[ \t\r\n]+/g,'')=='';};rb=d.createRange();rb.setStart(s.anchorNode,s.anchorOffset);rb.collapse(true);ra=d.createRange();ra.setStart(s.focusNode,s.focusOffset);ra.collapse(true);dir=rb.compareBoundaryPoints(rb.START_TO_END,ra)<0;sn=dir?s.anchorNode:s.focusNode;so=dir?s.anchorOffset:s.focusOffset;en=dir?s.focusNode:s.anchorNode;eo=dir?s.focusOffset:s.anchorOffset;if(sn===en&&/^(TD|TH)$/.test(sn.nodeName)){dom.remove(sn.firstChild);ed.dom.add(sn,se.element,null,'<br />');aft=ed.dom.add(sn,se.element,null,'<br />');r=d.createRange();r.selectNodeContents(aft);r.collapse(1);ed.selection.setRng(r);return false;}if(sn==b&&en==b&&b.firstChild&&ed.dom.isBlock(b.firstChild)){sn=en=sn.firstChild;so=eo=0;rb=d.createRange();rb.setStart(sn,0);ra=d.createRange();ra.setStart(en,0);}sn=sn.nodeName=="HTML"?d.body:sn;sn=sn.nodeName=="BODY"?sn.firstChild:sn;en=en.nodeName=="HTML"?d.body:en;en=en.nodeName=="BODY"?en.firstChild:en;sb=t.getParentBlock(sn);eb=t.getParentBlock(en);bn=sb?sb.nodeName:se.element;if(t.dom.getParent(sb,function(n){return/OL|UL|PRE/.test(n.nodeName);}))return true;if(sb&&(sb.nodeName=='CAPTION'||/absolute|relative|static/gi.test(sb.style.position))){bn=se.element;sb=null;}if(eb&&(eb.nodeName=='CAPTION'||/absolute|relative|static/gi.test(eb.style.position))){bn=se.element;eb=null;}if(/(TD|TABLE|TH|CAPTION)/.test(bn)||(sb&&bn=="DIV"&&/left|right/gi.test(sb.style.cssFloat))){bn=se.element;sb=eb=null;}bef=(sb&&sb.nodeName==bn)?sb.cloneNode(0):ed.dom.create(bn);aft=(eb&&eb.nodeName==bn)?eb.cloneNode(0):ed.dom.create(bn);aft.removeAttribute('id');if(/^(H[1-6])$/.test(bn)&&sn.nodeValue&&so==sn.nodeValue.length)aft=ed.dom.create(se.element);n=sc=sn;do{if(n==b||n.nodeType==9||t.dom.isBlock(n)||/(TD|TABLE|TH|CAPTION)/.test(n.nodeName))break;sc=n;}while((n=n.previousSibling?n.previousSibling:n.parentNode));n=ec=en;do{if(n==b||n.nodeType==9||t.dom.isBlock(n)||/(TD|TABLE|TH|CAPTION)/.test(n.nodeName))break;ec=n;}while((n=n.nextSibling?n.nextSibling:n.parentNode));if(sc.nodeName==bn)rb.setStart(sc,0);else rb.setStartBefore(sc);rb.setEnd(sn,so);bef.appendChild(rb.cloneContents()||d.createTextNode(''));try{ra.setEndAfter(ec);}catch(ex){}ra.setStart(en,eo);aft.appendChild(ra.cloneContents()||d.createTextNode(''));r=d.createRange();if(!sc.previousSibling&&sc.parentNode.nodeName==bn){r.setStartBefore(sc.parentNode);}else{if(rb.startContainer.nodeName==bn&&rb.startOffset==0)r.setStartBefore(rb.startContainer);else r.setStart(rb.startContainer,rb.startOffset);}if(!ec.nextSibling&&ec.parentNode.nodeName==bn)r.setEndAfter(ec.parentNode);else r.setEnd(ra.endContainer,ra.endOffset);r.deleteContents();if(isOpera)ed.getWin().scrollTo(0,vp.y);if(bef.firstChild&&bef.firstChild.nodeName==bn)bef.innerHTML=bef.firstChild.innerHTML;if(aft.firstChild&&aft.firstChild.nodeName==bn)aft.innerHTML=aft.firstChild.innerHTML;if(isEmpty(bef))bef.innerHTML='<br />';if(isEmpty(aft))aft.innerHTML=isOpera?'&nbsp;':'<br />';if(isOpera&&parseFloat(opera.version())<9.5){r.insertNode(bef);r.insertNode(aft);}else{r.insertNode(aft);r.insertNode(bef);}aft.normalize();bef.normalize();function first(n){return d.createTreeWalker(n,NodeFilter.SHOW_TEXT,null,false).nextNode()||n;};r=d.createRange();r.selectNodeContents(isGecko?first(aft):aft);r.collapse(1);s.removeAllRanges();s.addRange(r);y=ed.dom.getPos(aft).y;ch=aft.clientHeight;if(y<vp.y||y+ch>vp.y+vp.h){ed.getWin().scrollTo(0,y<vp.y?y:y-vp.h+ch);}return false;},backspaceDelete:function(e,bs){var t=this,ed=t.editor,b=ed.getBody(),n,se=ed.selection,r=se.getRng(),sc=r.startContainer,n,w,tn;if(sc&&ed.dom.isBlock(sc)&&!/^(TD|TH)$/.test(sc.nodeName)&&bs){if(sc.childNodes.length==0||(sc.childNodes.length==1&&sc.firstChild.nodeName=='BR')){n=sc;while((n=n.previousSibling)&&!ed.dom.isBlock(n));if(n){if(sc!=b.firstChild){w=ed.dom.doc.createTreeWalker(n,NodeFilter.SHOW_TEXT,null,false);while(tn=w.nextNode())n=tn;r=ed.getDoc().createRange();r.setStart(n,n.nodeValue?n.nodeValue.length:0);r.setEnd(n,n.nodeValue?n.nodeValue.length:0);se.setRng(r);ed.dom.remove(sc);}return Event.cancel(e);}}}function handler(e){e=e.target;if(e&&e.parentNode&&e.nodeName=='BR'&&(n=t.getParentBlock(e))){Event.remove(b,'DOMNodeInserted',handler);if(e.previousSibling||e.nextSibling)ed.dom.remove(e);}};Event._add(b,'DOMNodeInserted',handler);window.setTimeout(function(){Event._remove(b,'DOMNodeInserted',handler);},1);}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each,extend=tinymce.extend;tinymce.create('tinymce.ControlManager',{ControlManager:function(ed,s){var t=this,i;s=s||{};t.editor=ed;t.controls={};t.onAdd=new tinymce.util.Dispatcher(t);t.onPostRender=new tinymce.util.Dispatcher(t);t.prefix=s.prefix||ed.id+'_';t._cls={};t.onPostRender.add(function(){each(t.controls,function(c){c.postRender();});});},get:function(id){return this.controls[this.prefix+id]||this.controls[id];},setActive:function(id,s){var c=null;if(c=this.get(id))c.setActive(s);return c;},setDisabled:function(id,s){var c=null;if(c=this.get(id))c.setDisabled(s);return c;},add:function(c){var t=this;if(c){t.controls[c.id]=c;t.onAdd.dispatch(c,t);}return c;},createControl:function(n){var c,t=this,ed=t.editor;each(ed.plugins,function(p){if(p.createControl){c=p.createControl(n,t);if(c)return false;}});switch(n){case"|":case"separator":return t.createSeparator();}if(!c&&ed.buttons&&(c=ed.buttons[n]))return t.createButton(n,c);return t.add(c);},createDropMenu:function(id,s,cc){var t=this,ed=t.editor,c,bm,v,cls;s=extend({'class':'mceDropDown',constrain:ed.settings.constrain_menus},s);s['class']=s['class']+' '+ed.getParam('skin')+'Skin';if(v=ed.getParam('skin_variant'))s['class']+=' '+ed.getParam('skin')+'Skin'+v.substring(0,1).toUpperCase()+v.substring(1);id=t.prefix+id;cls=cc||t._cls.dropmenu||tinymce.ui.DropMenu;c=t.controls[id]=new cls(id,s);c.onAddItem.add(function(c,o){var s=o.settings;s.title=ed.getLang(s.title,s.title);if(!s.onclick){s.onclick=function(v){ed.execCommand(s.cmd,s.ui||false,s.value);};}});ed.onRemove.add(function(){c.destroy();});if(tinymce.isIE){c.onShowMenu.add(function(){bm=ed.selection.getBookmark(1);});c.onHideMenu.add(function(){if(bm)ed.selection.moveToBookmark(bm);});}return t.add(c);},createListBox:function(id,s,cc){var t=this,ed=t.editor,cmd,c,cls;if(t.get(id))return null;s.title=ed.translate(s.title);s.scope=s.scope||ed;if(!s.onselect){s.onselect=function(v){ed.execCommand(s.cmd,s.ui||false,v||s.value);};}s=extend({title:s.title,'class':'mce_'+id,scope:s.scope,control_manager:t},s);id=t.prefix+id;if(ed.settings.use_native_selects)c=new tinymce.ui.NativeListBox(id,s);else{cls=cc||t._cls.listbox||tinymce.ui.ListBox;c=new cls(id,s);}t.controls[id]=c;if(tinymce.isWebKit){c.onPostRender.add(function(c,n){Event.add(n,'mousedown',function(){ed.bookmark=ed.selection.getBookmark('simple');});Event.add(n,'focus',function(){ed.selection.moveToBookmark(ed.bookmark);ed.bookmark=null;});});}if(c.hideMenu)ed.onMouseDown.add(c.hideMenu,c);return t.add(c);},createButton:function(id,s,cc){var t=this,ed=t.editor,o,c,cls;if(t.get(id))return null;s.title=ed.translate(s.title);s.label=ed.translate(s.label);s.scope=s.scope||ed;if(!s.onclick&&!s.menu_button){s.onclick=function(){ed.execCommand(s.cmd,s.ui||false,s.value);};}s=extend({title:s.title,'class':'mce_'+id,unavailable_prefix:ed.getLang('unavailable',''),scope:s.scope,control_manager:t},s);id=t.prefix+id;if(s.menu_button){cls=cc||t._cls.menubutton||tinymce.ui.MenuButton;c=new cls(id,s);ed.onMouseDown.add(c.hideMenu,c);}else{cls=t._cls.button||tinymce.ui.Button;c=new cls(id,s);}return t.add(c);},createMenuButton:function(id,s){s=s||{};s.menu_button=1;return this.createButton(id,s);},createSplitButton:function(id,s,cc){var t=this,ed=t.editor,cmd,c,cls;if(t.get(id))return null;s.title=ed.translate(s.title);s.scope=s.scope||ed;if(!s.onclick){s.onclick=function(v){ed.execCommand(s.cmd,s.ui||false,v||s.value);};}if(!s.onselect){s.onselect=function(v){ed.execCommand(s.cmd,s.ui||false,v||s.value);};}s=extend({title:s.title,'class':'mce_'+id,scope:s.scope,control_manager:t},s);id=t.prefix+id;cls=cc||t._cls.splitbutton||tinymce.ui.SplitButton;c=t.add(new cls(id,s));ed.onMouseDown.add(c.hideMenu,c);return c;},createColorSplitButton:function(id,s,cc){var t=this,ed=t.editor,cmd,c,cls,bm;if(t.get(id))return null;s.title=ed.translate(s.title);s.scope=s.scope||ed;if(!s.onclick){s.onclick=function(v){ed.execCommand(s.cmd,s.ui||false,v||s.value);};}if(!s.onselect){s.onselect=function(v){ed.execCommand(s.cmd,s.ui||false,v||s.value);};}s=extend({title:s.title,'class':'mce_'+id,'menu_class':ed.getParam('skin')+'Skin',scope:s.scope,more_colors_title:ed.getLang('more_colors')},s);id=t.prefix+id;cls=cc||t._cls.colorsplitbutton||tinymce.ui.ColorSplitButton;c=new cls(id,s);ed.onMouseDown.add(c.hideMenu,c);ed.onRemove.add(function(){c.destroy();});if(tinymce.isIE){c.onShowMenu.add(function(){bm=ed.selection.getBookmark(1);});c.onHideMenu.add(function(){if(bm){ed.selection.moveToBookmark(bm);bm=0;}});}return t.add(c);},createToolbar:function(id,s,cc){var c,t=this,cls;id=t.prefix+id;cls=cc||t._cls.toolbar||tinymce.ui.Toolbar;c=new cls(id,s);if(t.get(id))return null;return t.add(c);},createSeparator:function(cc){var cls=cc||this._cls.separator||tinymce.ui.Separator;return new cls();},setControlType:function(n,c){return this._cls[n.toLowerCase()]=c;},destroy:function(){each(this.controls,function(c){c.destroy();});this.controls=null;}});})();(function(){var Dispatcher=tinymce.util.Dispatcher,each=tinymce.each,isIE=tinymce.isIE,isOpera=tinymce.isOpera;tinymce.create('tinymce.WindowManager',{WindowManager:function(ed){var t=this;t.editor=ed;t.onOpen=new Dispatcher(t);t.onClose=new Dispatcher(t);t.params={};t.features={};},open:function(s,p){var t=this,f='',x,y,mo=t.editor.settings.dialog_type=='modal',w,sw,sh,vp=tinymce.DOM.getViewPort(),u;s=s||{};p=p||{};sw=isOpera?vp.w:screen.width;sh=isOpera?vp.h:screen.height;s.name=s.name||'mc_'+new Date().getTime();s.width=parseInt(s.width||320);s.height=parseInt(s.height||240);s.resizable=true;s.left=s.left||parseInt(sw/ 2.0) - (s.width /2.0);s.top=s.top||parseInt(sh/ 2.0) - (s.height /2.0);p.inline=false;p.mce_width=s.width;p.mce_height=s.height;p.mce_auto_focus=s.auto_focus;if(mo){if(isIE){s.center=true;s.help=false;s.dialogWidth=s.width+'px';s.dialogHeight=s.height+'px';s.scroll=s.scrollbars||false;}}each(s,function(v,k){if(tinymce.is(v,'boolean'))v=v?'yes':'no';if(!/^(name|url)$/.test(k)){if(isIE&&mo)f+=(f?';':'')+k+':'+v;else f+=(f?',':'')+k+'='+v;}});t.features=s;t.params=p;t.onOpen.dispatch(t,s,p);u=s.url||s.file;if(tinymce.relaxedDomain)u+=(u.indexOf('?')==-1?'?':'&')+'mce_rdomain='+tinymce.relaxedDomain;u=tinymce._addVer(u);try{if(isIE&&mo){w=1;window.showModalDialog(u,window,f);}else w=window.open(u,s.name,f);}catch(ex){}if(!w)alert(t.editor.getLang('popup_blocked'));},close:function(w){w.close();this.onClose.dispatch(this);},createInstance:function(cl,a,b,c,d,e){var f=tinymce.resolve(cl);return new f(a,b,c,d,e);},confirm:function(t,cb,s){cb.call(s||this,confirm(this._decode(this.editor.getLang(t,t))));},alert:function(tx,cb,s){var t=this;alert(t._decode(t.editor.getLang(tx,tx)));if(cb)cb.call(s||t);},_decode:function(s){return tinymce.DOM.decode(s).replace(/\\n/g,'\n');}});}());
\ No newline at end of file
index f95a746744b6cd2c1d323555cb8dedf19922f99f..757d06bec88c5ff116c1989a4db2e150dd59339c 100644 (file)
@@ -4,7 +4,7 @@
  * $Id: tiny_mce_gzip.php 315 2007-10-25 14:03:43Z spocke $
  *
  * @author Moxiecode
- * @copyright Copyright Â© 2005-2006, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright Ã‚© 2005-2006, Moxiecode Systems AB, All rights reserved.
  *
  * This file compresses the TinyMCE JavaScript using GZip.
  **/
@@ -12,7 +12,7 @@
 // Discard any buffers
 while ( @ob_end_clean() );
 
-@ require('../../../wp-config.php');
+@ require('../../../wp-load.php');
 
 function getFileContents($path) {
 
@@ -51,14 +51,10 @@ function putFileContents( $path, $content ) {
 }
 
 // Set up init variables
-$https = ( isset($_SERVER['HTTPS']) && 'on' == strtolower($_SERVER['HTTPS']) ) ? true : false;
-       
-$baseurl = get_option('siteurl') . '/wp-includes/js/tinymce';
-if ( $https ) $baseurl = str_replace('http://', 'https://', $baseurl);
+$baseurl = includes_url('js/tinymce');
 
 $mce_css = $baseurl . '/wordpress.css';
 $mce_css = apply_filters('mce_css', $mce_css);
-if ( $https ) $mce_css = str_replace('http://', 'https://', $mce_css);
 
 $mce_locale = ( '' == get_locale() ) ? 'en' : strtolower( substr(get_locale(), 0, 2) ); // only ISO 639-1
 
@@ -70,7 +66,7 @@ http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker
 */
 $mce_spellchecker_languages = apply_filters('mce_spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv');
 
-$plugins = array( 'safari', 'inlinepopups', 'autosave', 'spellchecker', 'paste', 'wordpress', 'media', 'fullscreen' );
+$plugins = array( 'safari', 'inlinepopups', 'autosave', 'spellchecker', 'paste', 'wordpress', 'media', 'fullscreen', 'wpeditimage' );
 
 /* 
 The following filter takes an associative array of external plugins for TinyMCE in the form 'plugin_name' => 'url'.
@@ -109,7 +105,7 @@ if ( ! empty($mce_external_plugins) ) {
 
        foreach ( $mce_external_plugins as $name => $url ) {
                
-               if ( $https ) $url = str_replace('http://', 'https://', $url);
+               if ( is_ssl() ) $url = str_replace('http://', 'https://', $url);
                
                $plugins[] = '-' . $name;
 
@@ -122,7 +118,7 @@ if ( ! empty($mce_external_plugins) ) {
 }
 $plugins = implode($plugins, ',');
 
-$mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', '|', 'bullist', 'numlist', 'blockquote', '|', 'justifyleft', 'justifycenter', 'justifyright', '|', 'link', 'unlink', 'image', 'wp_more', '|', 'spellchecker', 'fullscreen', 'wp_adv' ));
+$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' ));
@@ -134,6 +130,8 @@ $mce_buttons_3 = implode($mce_buttons_3, ',');
 $mce_buttons_4 = apply_filters('mce_buttons_4', array());
 $mce_buttons_4 = implode($mce_buttons_4, ',');
 
+$no_captions = ( apply_filters( 'disable_captions', '' ) ) ? true : false;
+
 // TinyMCE init settings
 $initArray = array (
        'mode' => 'none',
@@ -167,6 +165,7 @@ $initArray = array (
        'tab_focus' => ':next',
        'content_css' => "$mce_css",
        'save_callback' => 'switchEditors.saveCallback',
+       'wpeditimage_disable_captions' => $no_captions,
        'plugins' => "$plugins",
        // pass-through the settings for compression and caching, so they can be changed with "tiny_mce_before_init"
        'disk_cache' => true,
@@ -206,14 +205,14 @@ if ( $msie = strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') ) {
 }
 
 // Cache path, this is where the .gz files will be stored
-$cache_path = ABSPATH . 'wp-content/uploads/js_cache'; 
+$cache_path = WP_CONTENT_DIR . '/uploads/js_cache'; 
 if ( $disk_cache && ! is_dir($cache_path) )
        $disk_cache = wp_mkdir_p($cache_path);
 
 $cache_ext = '.js';
 $plugins = explode( ',', $initArray['plugins'] );
 $theme = ( 'simple' == $initArray['theme'] ) ? 'simple' : 'advanced';
-$language = isset($initArray['language']) ? substr( $initArray['language'], 0, 2 ) : 'en';
+$language = ( isset($initArray['language']) && ! empty($initArray['language']) ) ? substr( $initArray['language'], 0, 2 ) : 'en';
 $cacheKey = $mce_options = ''; 
 
 // Check if browser supports gzip
@@ -226,7 +225,7 @@ if ( $compress && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) {
 // Setup cache info
 if ( $disk_cache ) {
 
-       $cacheKey = apply_filters('tiny_mce_version', '20080414');
+       $cacheKey = apply_filters('tiny_mce_version', '20080810');
 
        foreach ( $initArray as $v )
                $cacheKey .= $v;
@@ -273,7 +272,7 @@ if ( $mce_deprecated ) $mce_options .= $mce_deprecated;
 
 $mce_options = rtrim( trim($mce_options), '\n\r,' );
 
-$content = 'var tinyMCEPreInit = { settings : { themes : "' . $theme . '", plugins : "' . $initArray['plugins'] . '", languages : "' . $language . '", debug : false }, base : "' . $baseurl . '", suffix : "" };';
+$content = 'var tinyMCEPreInit = { settings : { themes : "' . $theme . '", plugins : "' . $initArray['plugins'] . '", languages : "' . $language . '", debug : false }, base : "' . $baseurl . '", suffix : "", query : "ver=311" };';
 
 // Load patch
 $content .= getFileContents( 'tiny_mce_ext.js' );
@@ -329,4 +328,4 @@ if ( '' != $cacheKey && is_dir($cache_path) && is_readable($cache_path) ) {
        putFileContents( $cache_file, $content );
 }
 
-?>
+?>
\ No newline at end of file
index 6eab9106aa53f7bf4d45748a27201b33257f99ba..cee045d26e1cdd45b5c24b0e1f22250368410943 100644 (file)
@@ -29,8 +29,7 @@ tinyMCEPreInit.start = function() {
 };
 tinyMCEPreInit.load_ext = function(url,lang) {
        var sl = tinymce.ScriptLoader;
-       
-//     sl.add(url + '/langs/lang.php');
+
        sl.markDone(url + '/langs/' + lang + '.js');
        sl.markDone(url + '/langs/' + lang + '_dlg.js');
 };
index 84cbded5c35d90aee9aebd23c51803d7ed88ac13..6c8f73b67b53062e0a7ce577790fcc7b54384804 100644 (file)
@@ -132,7 +132,7 @@ tinyMCEPopup = {
 
                // To avoid domain relaxing issue in Opera
                function close() {
-                       t.editor.windowManager.close(window, t.id);
+                       t.editor.windowManager.close(window);
                        tinymce = tinyMCE = t.editor = t.params = t.dom = t.dom.doc = null; // Cleanup
                };
 
@@ -183,7 +183,7 @@ tinyMCEPopup = {
 
                // Set inline title
                if (!t.isWindow)
-                       t.editor.windowManager.setTitle(ti, t.id);
+                       t.editor.windowManager.setTitle(window, ti);
                else
                        window.focus();
 
index 7f58dfc31e9c12a240ee8245a4e05b32c38f3f75..c1bfa739e20cf785adfac2e5b17ff4c1b2371cc3 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * $Id: editable_selects.js 520 2008-01-07 16:30:32Z spocke $
+ * $Id: editable_selects.js 867 2008-06-09 20:33:40Z spocke $
  *
  * Makes select boxes editable.
  *
@@ -39,6 +39,7 @@ var TinyMCE_EditableSelects = {
                        se.style.display = 'none';
                        ne.focus();
                        ne.onblur = TinyMCE_EditableSelects.onBlurEditableSelectInput;
+                       ne.onkeydown = TinyMCE_EditableSelects.onKeyDown;
                        TinyMCE_EditableSelects.editSelectElm = se;
                }
        },
@@ -57,5 +58,12 @@ var TinyMCE_EditableSelects = {
                        se.parentNode.removeChild(se.previousSibling);
                        TinyMCE_EditableSelects.editSelectElm = null;
                }
+       },
+
+       onKeyDown : function(e) {
+               e = e || window.event;
+
+               if (e.keyCode == 13)
+                       TinyMCE_EditableSelects.onBlurEditableSelectInput();
        }
 };
index 63d457db207c044779be7185c5972bd722c48f78..1351806431b60624fee0afcccbd08698d074a7d3 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * $Id: mctabs.js 520 2008-01-07 16:30:32Z spocke $
+ * $Id: mctabs.js 758 2008-03-30 13:53:29Z spocke $
  *
  * Moxiecode DHTML Tabs script.
  *
@@ -8,7 +8,7 @@
  */
 
 function MCTabs() {
-       this.settings = new Array();
+       this.settings = [];
 };
 
 MCTabs.prototype.init = function(settings) {
@@ -28,17 +28,19 @@ MCTabs.prototype.getParam = function(name, default_value) {
 };
 
 MCTabs.prototype.displayTab = function(tab_id, panel_id) {
-       var panelElm = document.getElementById(panel_id);
-       var panelContainerElm = panelElm ? panelElm.parentNode : null;
-       var tabElm = document.getElementById(tab_id);
-       var tabContainerElm = tabElm ? tabElm.parentNode : null;
-       var selectionClass = this.getParam('selection_class', 'current');
+       var panelElm, panelContainerElm, tabElm, tabContainerElm, selectionClass, nodes, i;
+
+       panelElm= document.getElementById(panel_id);
+       panelContainerElm = panelElm ? panelElm.parentNode : null;
+       tabElm = document.getElementById(tab_id);
+       tabContainerElm = tabElm ? tabElm.parentNode : null;
+       selectionClass = this.getParam('selection_class', 'current');
 
        if (tabElm && tabContainerElm) {
-               var nodes = tabContainerElm.childNodes;
+               nodes = tabContainerElm.childNodes;
 
                // Hide all other tabs
-               for (var i=0; i<nodes.length; i++) {
+               for (i = 0; i < nodes.length; i++) {
                        if (nodes[i].nodeName == "LI")
                                nodes[i].className = '';
                }
@@ -48,10 +50,10 @@ MCTabs.prototype.displayTab = function(tab_id, panel_id) {
        }
 
        if (panelElm && panelContainerElm) {
-               var nodes = panelContainerElm.childNodes;
+               nodes = panelContainerElm.childNodes;
 
                // Hide all other panels
-               for (var i=0; i<nodes.length; i++) {
+               for (i = 0; i < nodes.length; i++) {
                        if (nodes[i].nodeName == "DIV")
                                nodes[i].className = 'panel';
                }
index 8e7022098124a63698ea662e6bbeab3a215b6462..3fcd63936baccf6ff06677896b3b487b62c66a57 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * $Id: validate.js 673 2008-03-06 13:26:20Z spocke $
+ * $Id: validate.js 758 2008-03-30 13:53:29Z spocke $
  *
  * Various form validation methods.
  *
@@ -110,7 +110,7 @@ var AutoValidator = {
        },
 
        reset : function(e) {
-               var t = new Array('label', 'input', 'select', 'textarea');
+               var t = ['label', 'input', 'select', 'textarea'];
                var i, j, nl, s = this.settings;
 
                if (e == null)
index 1596f59a6db52a74d46598b8fa3aef03f0571c09..0bc5f5521fcbefa498e521ef74ffd6c01e921c02 100644 (file)
@@ -1,6 +1,7 @@
 /* This file contains the CSS data for the editable area(iframe) of TinyMCE */
 
-.aligncenter {
+.aligncenter,
+dl.aligncenter {
        display: block;
        margin-left: auto;
        margin-right: auto;
        float: right;
 }
 
+.wp-caption {
+       border: 1px solid #ddd;
+       text-align: center;
+       background-color: #f3f3f3;
+       padding-top: 4px;
+       margin: 10px;
+       -moz-border-radius: 3px;
+       -khtml-border-radius: 3px;
+       -webkit-border-radius: 3px;
+       border-radius: 3px;
+}
+
+.wp-caption img {
+       margin: 0;
+       padding: 0;
+       border: 0 none;
+}
+
+.wp-caption-dd {
+       font-size: 11px;
+       line-height: 17px;
+       padding: 0 4px 5px;
+       margin: 0;
+}
+
 body.mceContentBody {
        background: #fff;
        color: #000;
@@ -50,16 +76,6 @@ pre {
        font: 12px/18px "Courier New", monospace;
 }
 
-img.mceItemAnchor {
-       width: 12px;
-       height: 12px;
-       background: url(img/items.gif) no-repeat;
-}
-
-a.mceItemAnchor {
-       width: 12px;
-       line-height: 6px;
-       overflow: hidden;
-       padding-left: 12px;
-       background: url(img/items.gif) no-repeat bottom left;
+.mceIEcenter {
+       text-align: center;
 }
index d462b95d5747eafbe67a93fb45e00b80d99aa852..4ef08f018aa4e1be7b910d67a381cce8549f5cf6 100644 (file)
@@ -1,4 +1,4 @@
-<?php require_once('../../../wp-config.php');
+<?php require_once('../../../wp-load.php');
 header('Content-Type: text/html; charset=' . get_bloginfo('charset'));
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -6,10 +6,10 @@ header('Content-Type: text/html; charset=' . get_bloginfo('charset'));
 <head>
 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
 <title><?php _e('Rich Editor Help') ?></title>
-<script type="text/javascript" src="tiny_mce_popup.js"></script>
+<script type="text/javascript" src="tiny_mce_popup.js?ver=311"></script>
 <?php 
-wp_admin_css( 'css/global' );
-wp_admin_css();
+wp_admin_css( 'global', true );
+wp_admin_css( 'wp-admin', true );
 ?>
 <style type="text/css">
        #wphead {
diff --git a/wp-includes/js/wp-ajax.js b/wp-includes/js/wp-ajax.js
deleted file mode 100644 (file)
index e3f63f7..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-var WPAjax = Class.create();
-Object.extend(WPAjax.prototype, Ajax.Request.prototype);
-Object.extend(WPAjax.prototype, {
-       WPComplete: false, // onComplete function
-       WPError: false, // onWPError function
-       defaultUrl: '', // We get these from WPAjaxL10n
-       permText: '',
-       strangeText: '',
-       whoaText: '',
-
-       initialize: function(url, responseEl) {
-               var tempObj = this;
-               this.transport = Ajax.getTransport();
-               if ( !this.transport )
-                       return false;
-               this.setOptions( {
-                       parameters: 'cookie=' + encodeURIComponent(document.cookie),
-                       onComplete: function(transport) { // transport = XMLHttpRequest object
-                               if ( tempObj.parseAjaxResponse() ) {
-                                       if ( 'function' == typeof tempObj.WPComplete )
-                                               tempObj.WPComplete(transport);
-                               } else if ( 'function' == typeof tempObj.WPError ) // if response corresponds to an error (bad data, say, not 404)
-                                       tempObj.WPError(transport);
-                       }
-               });
-               this.url = url ? url : this.defaultUrl;
-               this.getResponseElement(responseEl);
-       },
-       addArg: function(key, value) {
-               var a = $H();
-               a[encodeURIComponent(key)] = encodeURIComponent(value);
-               this.options.parameters = $H(this.options.parameters).merge(a);
-       },
-       getResponseElement: function(r) {
-               var p = $(r + '-p');
-               if ( !p ) {
-                       new Insertion.Bottom(r, "<span id='" + r + "-p'></span>");
-                       var p = $(r + '-p');
-               }
-               this.myResponseElement = p;
-       },
-       parseAjaxResponse: function() { // 1 = good, 0 = strange (bad data?), -1 = you lack permission
-               if ( this.transport.responseXML && typeof this.transport.responseXML == 'object' && ( this.transport.responseXML.xml || 'undefined' == typeof this.transport.responseXML.xml ) ) {
-                       var err = this.transport.responseXML.getElementsByTagName('wp_error');
-                       if ( err[0] ) {
-                               var msg = $A(err).inject( '', function(a, b) { return a + '<p>' + b.firstChild.nodeValue + '</p>'; } );
-                               Element.update(this.myResponseElement,'<div class="error">' + msg + '</div>');
-                               return false;
-                       }
-                       return true;
-               }
-               var r = this.transport.responseText;
-               if ( isNaN(r) ) {
-                       Element.update(this.myResponseElement,'<div class="error"><p>' + r + '</p></div>');
-                       return false;
-               }
-               var r = parseInt(r,10);
-               if ( -1 == r ) {
-                       Element.update(this.myResponseElement,"<div class='error'><p>" + this.permText + "</p></div>");
-                       return false;
-               } else if ( 0 == r ) {
-                       Element.update(this.myResponseElement,"<div class='error'><p>" + this.strangeText + "</p></div>");
-                       return false;
-               }
-               return true;
-       },
-       addOnComplete: function(f) {
-               if ( 'function' == typeof f ) { var of = this.WPComplete; this.WPComplete = function(t) { if ( of ) of(t); f(t); } }
-       },
-       addOnWPError: function(f) {
-               if ( 'function' == typeof f ) { var of = this.WPError; this.WPError = function(t) { if ( of ) of(t); f(t); } }
-       },
-       notInitialized: function() {
-               return this.transport ? false : true;
-       }
-});
-
-Event.observe( window, 'load', function() { Object.extend(WPAjax.prototype, WPAjaxL10n); }, false )
-
-Ajax.activeSendCount = 0;
-Ajax.Responders.register( {
-       onCreate: function() {
-               Ajax.activeSendCount++;
-               if ( 1 != Ajax.activeSendCount )
-                       return;
-               wpBeforeUnload = window.onbeforeunload;
-               window.onbeforeunload = function() {
-                       return WPAjax.whoaText;
-               }
-       },
-       onLoading: function() { // Can switch to onLoaded if we lose data
-               Ajax.activeSendCount--;
-               if ( 0 != Ajax.activeSendCount )
-                       return;
-               window.onbeforeunload = wpBeforeUnload;
-       }
-});
-
-//Pretty func adapted from ALA http://www.alistapart.com/articles/gettingstartedwithajax
-function getNodeValue(tree,el){try { var r = tree.getElementsByTagName(el)[0].firstChild.nodeValue; } catch(err) { var r = null; } return r; }
index 884f02a6fd2d7732d77fc6510c373378d0faa3c2..a4d5df3230c260e1e8ce32b1a8293028e076882d 100644 (file)
@@ -88,6 +88,8 @@ var wpList = {
                        var res = wpAjax.parseAjaxResponse(r, s.response, s.element);
                        if ( !res || res.errors ) { return false; }
 
+                       if ( true === res ) { return true; }
+
                        jQuery.each( res.responses, function() {
                                wpList.add.call( list, this.data, $.extend( {}, s, { // this.firstChild.nodevalue
                                        pos: this.position || 0,
index ae37fc26c55ed6a93d947488c4a1568d38fa931f..c7538b983b4002ad713f5fe06ef6e1ec74407821 100644 (file)
@@ -182,8 +182,10 @@ if (!CUSTOM_TAGS) {
                        'class' => array (),
                        'dir' => array (),
                        'align' => array (),
+                       'lang' => array (),
                        'style' => array (),
-                       'title' => array ()),
+                       'title' => array (),
+                       'xml:lang' => array()),
                'strike' => array(),
                'strong' => array(),
                'sub' => array(),
@@ -429,6 +431,10 @@ function wp_kses_split2($string, $allowed_html, $allowed_protocols) {
                        $string = $newstring;
                if ( $string == '' )
                        return '';
+               // prevent multiple dashes in comments
+               $string = preg_replace('/--+/', '-', $string);
+               // prevent three dashes closing a comment
+               $string = preg_replace('/-$/', '', $string);
                return "<!--{$string}-->";
        }
        # Allow HTML comments
@@ -531,7 +537,8 @@ function wp_kses_attr($element, $attr, $allowed_html, $allowed_protocols) {
  * input. It will add quotes around attribute values that don't have any quotes
  * or apostrophes around them, to make it easier to produce HTML code that will
  * conform to W3C's HTML specification. It will also remove bad URL protocols
- * from attribute values.
+ * from attribute values.  It also reduces duplicate attributes by using the
+ * attribute defined first (foo='bar' foo='baz' will result in foo='bar').
  *
  * @since 1.0.0
  *
@@ -574,7 +581,9 @@ function wp_kses_hair($attr, $allowed_protocols) {
                                        {
                                        $working = 1;
                                        $mode = 0;
-                                       $attrarr[] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y');
+                                       if(FALSE === array_key_exists($attrname, $attrarr)) {
+                                               $attrarr[$attrname] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y');
+                                       }
                                        $attr = preg_replace('/^\s+/', '', $attr);
                                }
 
@@ -587,7 +596,9 @@ function wp_kses_hair($attr, $allowed_protocols) {
                                        {
                                        $thisval = wp_kses_bad_protocol($match[1], $allowed_protocols);
 
-                                       $attrarr[] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n');
+                                       if(FALSE === array_key_exists($attrname, $attrarr)) {
+                                               $attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n');
+                                       }
                                        $working = 1;
                                        $mode = 0;
                                        $attr = preg_replace('/^"[^"]*"(\s+|$)/', '', $attr);
@@ -599,7 +610,9 @@ function wp_kses_hair($attr, $allowed_protocols) {
                                        {
                                        $thisval = wp_kses_bad_protocol($match[1], $allowed_protocols);
 
-                                       $attrarr[] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname='$thisval'", 'vless' => 'n');
+                                       if(FALSE === array_key_exists($attrname, $attrarr)) {
+                                               $attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname='$thisval'", 'vless' => 'n');
+                                       }
                                        $working = 1;
                                        $mode = 0;
                                        $attr = preg_replace("/^'[^']*'(\s+|$)/", '', $attr);
@@ -611,7 +624,9 @@ function wp_kses_hair($attr, $allowed_protocols) {
                                        {
                                        $thisval = wp_kses_bad_protocol($match[1], $allowed_protocols);
 
-                                       $attrarr[] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n');
+                                       if(FALSE === array_key_exists($attrname, $attrarr)) {
+                                               $attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n');
+                                       }
                                        # We add quotes to conform to W3C's HTML spec.
                                        $working = 1;
                                        $mode = 0;
@@ -628,10 +643,10 @@ function wp_kses_hair($attr, $allowed_protocols) {
                }
        } # while
 
-       if ($mode == 1)
+       if ($mode == 1 && FALSE === array_key_exists($attrname, $attrarr))
                # special case, for when the attribute list ends with a valueless
                # attribute like "selected"
-               $attrarr[] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y');
+               $attrarr[$attrname] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y');
 
        return $attrarr;
 }
@@ -1050,4 +1065,4 @@ function kses_init() {
 
 add_action('init', 'kses_init');
 add_action('set_current_user', 'kses_init');
-?>
\ No newline at end of file
+?>
index 0584f9daabd3fbb6f7caa8226a04f37de548f316..35f89c58ebf5d5930db3f532bf772aafa2273ae7 100644 (file)
@@ -38,7 +38,7 @@ function get_locale() {
                $locale = WPLANG;
 
        if (empty($locale))
-               $locale = '';
+               $locale = 'en_US';
 
        $locale = apply_filters('locale', $locale);
 
@@ -242,31 +242,35 @@ function __ngettext_noop($single, $plural, $number=1, $domain = 'default') {
 function load_textdomain($domain, $mofile) {
        global $l10n;
 
-       if (isset($l10n[$domain]))
-               return;
-
        if ( is_readable($mofile))
                $input = new CachedFileReader($mofile);
        else
                return;
 
-       $l10n[$domain] = new gettext_reader($input);
+       $gettext = new gettext_reader($input);
+
+       if (isset($l10n[$domain])) {
+               $l10n[$domain]->load_tables();
+               $gettext->load_tables();
+               $l10n[$domain]->cache_translations = array_merge($gettext->cache_translations, $l10n[$domain]->cache_translations);
+       } else
+               $l10n[$domain] = $gettext;
+
+       unset($input, $gettext);
 }
 
 /**
  * load_default_textdomain() - Loads default translated strings based on locale
  *
- * Loads the .mo file in LANGDIR constant path from WordPress root.
+ * Loads the .mo file in WP_LANG_DIR constant path from WordPress root.
  * The translated (.mo) file is named based off of the locale.
  *
  * @since 1.5.0
  */
 function load_default_textdomain() {
        $locale = get_locale();
-       if ( empty($locale) )
-               $locale = 'en_US';
 
-       $mofile = ABSPATH . LANGDIR . "/$locale.mo";
+       $mofile = WP_LANG_DIR . "/$locale.mo";
 
        load_textdomain('default', $mofile);
 }
@@ -278,26 +282,24 @@ function load_default_textdomain() {
  * directory. The .mo file should be named based on the domain with a
  * dash followed by a dash, and then the locale exactly.
  *
- * The plugin may place all of the .mo files in another folder and set
- * the $path based on the relative location from ABSPATH constant. The
- * plugin may use the constant PLUGINDIR and/or plugin_basename() to
- * get path of the plugin and then add the folder which holds the .mo
- * files.
- *
  * @since 1.5.0
  *
  * @param string $domain Unique identifier for retrieving translated strings
- * @param string $path Optional. Path of the folder where the .mo files reside.
+ * @param string $abs_rel_path Optional. Relative path to ABSPATH of a folder,
+ *     where the .mo file resides. Deprecated, but still functional until 2.7
+ * @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, $path = false) {
+function load_plugin_textdomain($domain, $abs_rel_path = false, $plugin_rel_path = false) {
        $locale = get_locale();
-       if ( empty($locale) )
-               $locale = 'en_US';
-
-       if ( false === $path )
-               $path = PLUGINDIR;
+       
+       if ( false !== $plugin_rel_path )
+               $path = WP_PLUGIN_DIR . '/' . trim( $plugin_rel_path, '/');
+       else if ( false !== $abs_rel_path)
+               $path = ABSPATH . trim( $abs_rel_path, '/');
+       else
+               $path = WP_PLUGIN_DIR;
 
-       $mofile = ABSPATH . "$path/$domain-$locale.mo";
+       $mofile = $path . '/'. $domain . '-' . $locale . '.mo';
        load_textdomain($domain, $mofile);
 }
 
@@ -315,8 +317,6 @@ function load_plugin_textdomain($domain, $path = false) {
  */
 function load_theme_textdomain($domain) {
        $locale = get_locale();
-       if ( empty($locale) )
-               $locale = 'en_US';
 
        $mofile = get_template_directory() . "/$locale.mo";
        load_textdomain($domain, $mofile);
index 74da3e74780bba6438e6aedcad5de3cd679060f1..a1286a9cd0094fd77f16fa4ba060bf45b319f000 100644 (file)
@@ -184,7 +184,7 @@ function get_attachment_link($id = false) {
                else
                        $name = $object->post_name;
                if (strpos($parentlink, '?') === false)
-                       $link = trailingslashit($parentlink) . $name . '/';
+                       $link = user_trailingslashit( trailingslashit($parentlink) . $name );
        }
 
        if (! $link ) {
@@ -402,7 +402,7 @@ function get_tag_feed_link($tag_id, $feed = '') {
                        $feed_link = 'feed';
                else
                        $feed_link = "feed/$feed";
-               $link = $link . user_trailingslashit($feed_link, 'feed');
+               $link = trailingslashit($link) . user_trailingslashit($feed_link, 'feed');
        }
 
        $link = apply_filters('tag_feed_link', $link, $feed);
@@ -442,10 +442,15 @@ function get_search_comments_feed_link($search_query = '', $feed = '') {
        return $link;
 }
 
-function get_edit_post_link( $id = 0 ) {
+function get_edit_post_link( $id = 0, $context = 'display' ) {
        if ( !$post = &get_post( $id ) )
                return;
 
+       if ( 'display' == $context )
+               $action = 'action=edit&amp;';
+       else
+               $action = 'action=edit&';
+
        switch ( $post->post_type ) :
        case 'page' :
                if ( !current_user_can( 'edit_page', $post->ID ) )
@@ -459,6 +464,13 @@ function get_edit_post_link( $id = 0 ) {
                $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;
@@ -467,7 +479,7 @@ function get_edit_post_link( $id = 0 ) {
                break;
        endswitch;
        
-       return apply_filters( 'get_edit_post_link', get_bloginfo( 'wpurl' ) . "/wp-admin/$file.php?action=edit&amp;$var=$post->ID", $post->ID );
+       return apply_filters( 'get_edit_post_link', admin_url("$file.php?{$action}$var=$post->ID"), $post->ID, $context );
 }
 
 function edit_post_link( $link = 'Edit This', $before = '', $after = '' ) {
@@ -497,7 +509,7 @@ function get_edit_comment_link( $comment_id = 0 ) {
                        return;
        }
 
-       $location = get_bloginfo( 'wpurl' ) . '/wp-admin/comment.php?action=editcomment&amp;c=' . $comment->comment_ID;
+       $location = admin_url('comment.php?action=editcomment&amp;c=') . $comment->comment_ID;
        return apply_filters( 'get_edit_comment_link', $location );
 }
 
@@ -599,7 +611,8 @@ function adjacent_post_link($format, $link, $in_same_cat = false, $excluded_cate
 
        $format = str_replace('%link', $link, $format);
 
-       echo $format;
+       $adjacent = $previous ? 'previous' : 'next';
+       echo apply_filters( "{$adjacent}_post_link", $format, $link );
 }
 
 function get_pagenum_link($pagenum = 1) {
@@ -730,4 +743,157 @@ function posts_nav_link($sep=' &#8212; ', $prelabel='&laquo; Previous Page', $nx
        }
 }
 
+function get_shortcut_link() {
+       $link = "javascript:
+                       var d=document,
+                       w=window,
+                       e=w.getSelection,
+                       k=d.getSelection,
+                       x=d.selection,
+                       s=(e?e():(k)?k():(x?x.createRange().text:0)),
+                       f='" . admin_url('press-this.php') . "',
+                       l=d.location,
+                       e=encodeURIComponent,
+                       g=f+'?u='+e(l.href)+'&t='+e(d.title)+'&s='+e(s)+'&v=2';
+                       function a(){
+                               if(!w.open(g,'t','toolbar=0,resizable=0,scrollbars=1,status=1,width=700,height=500')){
+                                       l.href=g;
+                               }
+                       }";
+                       if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false)
+                               $link .= 'setTimeout(a,0);';
+                       else
+                               $link .= 'a();';
+
+                       $link .= "void(0);";
+
+       $link = str_replace(array("\r", "\n", "\t"),  '', $link);
+
+       return apply_filters('shortcut_link', $link);
+}
+
+/** Return the site url
+ *
+ *
+ * @package WordPress
+ * @since 2.6
+ *
+ * Returns the 'site_url' option with the appropriate protocol,  'https' if is_ssl() and 'http' otherwise. 
+ * If $scheme is 'http' or 'https', is_ssl() is overridden.
+ *
+ * @param string $path Optional path relative to the site url
+ * @param string $scheme Optional scheme to give the site url context. Currently 'http','https', 'login', 'login_post', or 'admin'
+ * @return string Site url link with optional path appended
+*/
+function site_url($path = '', $scheme = null) {
+       // should the list of allowed schemes be maintained elsewhere?
+       if ( !in_array($scheme, array('http', 'https')) ) {
+               if ( ('login_post' == $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 = str_replace( 'http://', "{$scheme}://", get_option('siteurl') );
+
+       if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
+               $url .= '/' . ltrim($path, '/');
+
+       return $url;
+}
+
+/** Return the admin url
+ *
+ *
+ * @package WordPress
+ * @since 2.6
+ *
+ * Returns the url to the admin area
+ *
+ * @param string $path Optional path relative to the admin url
+ * @return string Admin url link with optional path appended
+*/
+function admin_url($path = '') {
+       $url = site_url('wp-admin/', 'admin');
+
+       if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
+               $url .= ltrim($path, '/');
+
+       return $url;
+}
+
+/** Return the includes url
+ *
+ *
+ * @package WordPress
+ * @since 2.6
+ *
+ * Returns the url to the includes directory
+ *
+ * @param string $path Optional path relative to the includes url
+ * @return string Includes url link with optional path appended
+*/
+function includes_url($path = '') {
+       $url = site_url() . '/' . WPINC . '/';
+
+       if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
+               $url .= ltrim($path, '/');
+
+       return $url;
+}
+
+/** Return the content url
+ *
+ *
+ * @package WordPress
+ * @since 2.6
+ *
+ * Returns the url to the content directory
+ *
+ * @param string $path Optional path relative to the content url
+ * @return string Content url link with optional path appended
+*/
+function content_url($path = '') {
+       $scheme = ( is_ssl() ? 'https' : 'http' );
+       $url = WP_CONTENT_URL;
+       if ( 0 === strpos($url, 'http') ) {
+               if ( is_ssl() )
+                       $url = str_replace( 'http://', "{$scheme}://", $url );
+       }
+
+       if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
+               $url .= '/' . ltrim($path, '/');
+
+       return $url;
+}
+
+/** Return the plugins url
+ *
+ *
+ * @package WordPress
+ * @since 2.6
+ *
+ * Returns the url to the plugins directory
+ *
+ * @param string $path Optional path relative to the plugins url
+ * @return string Plugins url link with optional path appended
+*/
+function plugins_url($path = '') {
+       $scheme = ( is_ssl() ? 'https' : 'http' );
+       $url = WP_PLUGIN_URL;
+       if ( 0 === strpos($url, 'http') ) {
+               if ( is_ssl() )
+                       $url = str_replace( 'http://', "{$scheme}://", $url );
+       }
+
+       if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
+               $url .= '/' . ltrim($path, '/');
+
+       return $url;
+}
+
 ?>
index f43a2f0ec7f5bb6cf8dd6ba4fa16b08990046e2d..36ca5958a36caa88b2f082cd9abbf124d4c6d155 100644 (file)
@@ -73,7 +73,7 @@ function image_downsize($id, $size = 'medium') {
        }
        elseif ( $size == 'thumbnail' ) {
                // fall back to the old thumbnail
-               if ( $thumb_file = wp_get_attachment_thumb_file() && $info = getimagesize($thumb_file) ) {
+               if ( ($thumb_file = wp_get_attachment_thumb_file($id)) && $info = getimagesize($thumb_file) ) {
                        $img_url = str_replace(basename($img_url), basename($thumb_file), $img_url);
                        $width = $info[0];
                        $height = $info[1];
@@ -90,16 +90,34 @@ function image_downsize($id, $size = 'medium') {
 
 }
 
-// return an <img src /> tag for the given image attachment, scaling it down if requested
+/**
+ * An <img src /> tag for an image attachment, scaling it down if requested.
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @uses apply_filters() The 'get_image_tag_class' filter is the IMG element
+ *             class attribute.
+ * @uses apply_filters() The 'get_image_tag' filter is the full IMG element with
+ *             all attributes.
+ *
+ * @param int $id Attachment ID.
+ * @param string $alt Image Description for the alt attribute.
+ * @param string $title Image Description for the title attribute.
+ * @param string $align Part of the class name for aligning the image.
+ * @param string $size Optional. Default is 'medium'.
+ * @return string HTML IMG element for given image attachment
+ */
 function get_image_tag($id, $alt, $title, $align, $size='medium') {
 
        list( $img_src, $width, $height ) = image_downsize($id, $size);
        $hwstring = image_hwstring($width, $height);
 
-       $html = '<img src="'.attribute_escape($img_src).'" alt="'.attribute_escape($alt).'" title="'.attribute_escape($title).'" '.$hwstring.'class="align'.attribute_escape($align).' size-'.attribute_escape($size).' wp-image-'.$id.'" />';
+       $class = 'align'.attribute_escape($align).' size-'.attribute_escape($size).' wp-image-'.$id;
+       $class = apply_filters('get_image_tag_class', $class, $id, $align, $size);
 
-       $url = '';
-       $html = apply_filters( 'image_send_to_editor', $html, $id, $alt, $title, $align, $url, $size );
+       $html = '<img src="'.attribute_escape($img_src).'" alt="'.attribute_escape($alt).'" title="'.attribute_escape($title).'" '.$hwstring.'class="'.$class.'" />';
+
+       $html = apply_filters( 'get_image_tag', $html, $id, $alt, $title, $align, $size );
 
        return $html;
 }
@@ -256,7 +274,7 @@ function image_make_intermediate_size($file, $width, $height, $crop=false) {
 }
 
 function image_get_intermediate_size($post_id, $size='thumbnail') {
-       if ( !$imagedata = wp_get_attachment_metadata( $post_id ) )
+       if ( !is_array( $imagedata = wp_get_attachment_metadata( $post_id ) ) )
                return false;
 
        // get the best one for a specified set of dimensions
@@ -307,7 +325,7 @@ function wp_get_attachment_image_src($attachment_id, $size='thumbnail', $icon =
                return $image;
 
        if ( $icon && $src = wp_mime_type_icon($attachment_id) ) {
-               $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/crystal' );
+               $icon_dir = apply_filters( 'icon_dir', includes_url('images/crystal') );
                $src_file = $icon_dir . '/' . basename($src);
                @list($width, $height) = getimagesize($src_file);
        }
@@ -332,6 +350,32 @@ function wp_get_attachment_image($attachment_id, $size='thumbnail', $icon = fals
        return $html;
 }
 
+add_shortcode('wp_caption', 'img_caption_shortcode');
+add_shortcode('caption', 'img_caption_shortcode');
+
+function img_caption_shortcode($attr, $content = null) {
+
+       // Allow plugins/themes to override the default caption template.
+       $output = apply_filters('img_caption_shortcode', '', $attr, $content);
+       if ( $output != '' )
+               return $output;
+
+       extract(shortcode_atts(array(
+               'id'    => '',
+               'align' => 'alignnone',
+               'width' => '',
+               'caption' => ''
+       ), $attr));
+       
+       if ( 1 > (int) $width || empty($caption) )
+               return $content;
+       
+       if ( $id ) $id = 'id="' . $id . '" ';
+       
+       return '<div ' . $id . 'class="wp-caption ' . $align . '" style="width: ' . (10 + (int) $width) . 'px">'
+       . $content . '<p class="wp-caption-text">' . $caption . '</p></div>';
+}
+
 add_shortcode('gallery', 'gallery_shortcode');
 
 function gallery_shortcode($attr) {
@@ -350,7 +394,8 @@ function gallery_shortcode($attr) {
        }
 
        extract(shortcode_atts(array(
-               'orderby'    => 'menu_order ASC, ID ASC',
+               'order'      => 'ASC',
+               'orderby'    => 'menu_order ID',
                'id'         => $post->ID,
                'itemtag'    => 'dl',
                'icontag'    => 'dt',
@@ -360,7 +405,7 @@ function gallery_shortcode($attr) {
        ), $attr));
 
        $id = intval($id);
-       $attachments = get_children("post_parent=$id&post_type=attachment&post_mime_type=image&orderby={$orderby}");
+       $attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
 
        if ( empty($attachments) )
                return '';
@@ -434,7 +479,7 @@ function next_image_link() {
 function adjacent_image_link($prev = true) {
        global $post;
        $post = get_post($post);
-       $attachments = array_values(get_children("post_parent=$post->post_parent&post_type=attachment&post_mime_type=image&orderby=menu_order ASC, ID ASC"));
+       $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 )
index 1a2bdc261eced4a3be26acc81943702db88ef1a5..e7ca2a7321c4dc3f7f9563100cde65b0e31251aa 100644 (file)
@@ -1,16 +1,16 @@
 <?php
 /**
- * These functions can be replaced via plugins. They are loaded after
- * plugins are loaded.
+ * These functions can be replaced via plugins. If plugins do not redefine these
+ * functions, then these will be used instead.
  *
  * @package WordPress
  */
 
 if ( !function_exists('set_current_user') ) :
 /**
- * set_current_user() - Populates global user information for any 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
+ * 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()
@@ -26,13 +26,13 @@ endif;
 
 if ( !function_exists('wp_set_current_user') ) :
 /**
- * wp_set_current_user() - Changes the current user by ID or name
+ * 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
+ * Set $id to null and specify a name if you do not know a user's ID.
  *
- * Some WordPress functionality is based on the current user and
- * not based on the signed in user. Therefore, it opens the ability
- * to edit and perform actions on users who aren't signed in.
+ * Some WordPress functionality is based on the current user and not based on
+ * the signed in user. Therefore, it opens the ability to edit and perform
+ * actions on users who aren't signed in.
  *
  * @since 2.0.4
  * @global object $current_user The current user object which holds the user data.
@@ -60,7 +60,7 @@ endif;
 
 if ( !function_exists('wp_get_current_user') ) :
 /**
- * wp_get_current_user() - Retrieve the current user object
+ * Retrieve the current user object.
  *
  * @since 2.0.4
  *
@@ -77,12 +77,11 @@ endif;
 
 if ( !function_exists('get_currentuserinfo') ) :
 /**
- * get_currentuserinfo() - Populate global variables with information about the currently logged in user
+ * Populate global variables with information about the currently logged in user.
  *
- * Will set the current user, if the current user is not set. The current
- * user will be set to the logged in person. If no user is logged in, then
- * it will set the current user to 0, which is invalid and won't have any
- * permissions.
+ * Will set the current user, if the current user is not set. The current user
+ * will be set to the logged in person. If no user is logged in, then it will
+ * set the current user to 0, which is invalid and won't have any permissions.
  *
  * @since 0.71
  * @uses $current_user Checks if the current user is set
@@ -100,8 +99,10 @@ function get_currentuserinfo() {
                return;
 
        if ( ! $user = wp_validate_auth_cookie() ) {
-               wp_set_current_user(0);
-               return false;
+                if ( empty($_COOKIE[LOGGED_IN_COOKIE]) || !$user = wp_validate_auth_cookie($_COOKIE[LOGGED_IN_COOKIE], 'logged_in') ) {
+                       wp_set_current_user(0);
+                       return false;
+                }
        }
 
        wp_set_current_user($user);
@@ -110,7 +111,7 @@ endif;
 
 if ( !function_exists('get_userdata') ) :
 /**
- * get_userdata() - Retrieve user info by user ID
+ * Retrieve user info by user ID.
  *
  * @since 0.71
  *
@@ -140,7 +141,7 @@ endif;
 
 if ( !function_exists('update_user_cache') ) :
 /**
- * update_user_cache() - Updates a users cache when overridden by a plugin
+ * Updates a users cache when overridden by a plugin.
  *
  * Core function does nothing.
  *
@@ -155,7 +156,7 @@ endif;
 
 if ( !function_exists('get_userdatabylogin') ) :
 /**
- * get_userdatabylogin() - Retrieve user info by login name
+ * Retrieve user info by login name.
  *
  * @since 0.71
  *
@@ -189,7 +190,7 @@ endif;
 
 if ( !function_exists('get_user_by_email') ) :
 /**
- * get_user_by_email() - Retrieve user info by email
+ * Retrieve user info by email.
  *
  * @since 2.5
  *
@@ -219,25 +220,23 @@ endif;
 
 if ( !function_exists( 'wp_mail' ) ) :
 /**
- * wp_mail() - Function to send mail, similar to PHP's mail
+ * Send mail, similar to PHP's mail
  *
- * A true return value does not automatically mean that the
- * user received the email successfully. It just only means
- * that the method used was able to process the request
- * without any errors.
+ * A true return value does not automatically mean that the user received the
+ * email successfully. It just only means that the method used was able to
+ * process the request without any errors.
  *
- * Using the two 'wp_mail_from' and 'wp_mail_from_name' hooks
- * allow from creating a from address like 'Name <email@address.com>'
- * when both are set. If just 'wp_mail_from' is set, then just
- * the email address will be used with no name.
+ * Using the two 'wp_mail_from' and 'wp_mail_from_name' hooks allow from
+ * creating a from address like 'Name <email@address.com>' when both are set. If
+ * just 'wp_mail_from' is set, then just the email address will be used with no
+ * name.
  *
- * The default content type is 'text/plain' which does not
- * allow using HTML. However, you can set the content type
- * of the email by using the 'wp_mail_content_type' filter.
+ * The default content type is 'text/plain' which does not allow using HTML.
+ * However, you can set the content type of the email by using the
+ * 'wp_mail_content_type' filter.
  *
- * The default charset is based on the charset used on the
- * blog. The charset can be set using the 'wp_mail_charset'
- * filter.
+ * The default charset is based on the charset used on the blog. The charset can
+ * be set using the 'wp_mail_charset' filter.
  *
  * @since 1.2.1
  * @uses apply_filters() Calls 'wp_mail' hook on an array of all of the parameters.
@@ -313,6 +312,10 @@ function wp_mail( $to, $subject, $message, $headers = '' ) {
                                        } 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 );
@@ -358,6 +361,18 @@ function wp_mail( $to, $subject, $message, $headers = '' ) {
        $phpmailer->Subject = $subject;
        $phpmailer->Body = $message;
 
+       // Add any CC and BCC recipients
+       if ( !empty($cc) ) {
+               foreach ($cc as $recipient) {
+                       $phpmailer->AddCc( trim($recipient) );
+               }
+       }
+       if ( !empty($bcc) ) {
+               foreach ($bcc as $recipient) {
+                       $phpmailer->AddBcc( trim($recipient) );
+               }
+       }
+
        // Set to use PHP's mail()
        $phpmailer->IsMail();
 
@@ -401,7 +416,8 @@ function wp_mail( $to, $subject, $message, $headers = '' ) {
 endif;
 
 /**
- * wp_authenticate() - Checks a user's login information and logs them in if it checks out
+ * Checks a user's login information and logs them in if it checks out.
+ *
  * @since 2.5
  *
  * @param string $username User's username
@@ -441,9 +457,9 @@ function wp_authenticate($username, $password) {
 endif;
 
 /**
- * wp_logout() - Log the current user out
- * @since 2.5
+ * Log the current user out.
  *
+ * @since 2.5
  */
 if ( !function_exists('wp_logout') ) :
 function wp_logout() {
@@ -454,24 +470,33 @@ endif;
 
 if ( !function_exists('wp_validate_auth_cookie') ) :
 /**
- * wp_validate_auth_cookie() - Validates authentication cookie
+ * Validates authentication cookie.
  *
- * The checks include making sure that the authentication cookie
- * is set and pulling in the contents (if $cookie is not used).
+ * The checks include making sure that the authentication cookie is set and
+ * pulling in the contents (if $cookie is not used).
  *
- * Makes sure the cookie is not expired. Verifies the hash in
- * cookie is what is should be and compares the two.
+ * Makes sure the cookie is not expired. Verifies the hash in cookie is what is
+ * should be and compares the two.
  *
  * @since 2.5
  *
  * @param string $cookie Optional. If used, will validate contents instead of cookie's
+ * @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in
  * @return bool|int False if invalid cookie, User ID if valid.
  */
-function wp_validate_auth_cookie($cookie = '') {
+function wp_validate_auth_cookie($cookie = '', $scheme = 'auth') {
        if ( empty($cookie) ) {
-               if ( empty($_COOKIE[AUTH_COOKIE]) )
+               if ( is_ssl() ) {
+                       $cookie_name = SECURE_AUTH_COOKIE;
+                       $scheme = 'secure_auth';
+               } else {
+                       $cookie_name = AUTH_COOKIE;
+                       $scheme = 'auth';
+               }
+
+               if ( empty($_COOKIE[$cookie_name]) )
                        return false;
-               $cookie = $_COOKIE[AUTH_COOKIE];
+               $cookie = $_COOKIE[$cookie_name];
        }
 
        $cookie_elements = explode('|', $cookie);
@@ -490,7 +515,7 @@ function wp_validate_auth_cookie($cookie = '') {
        if ( $expired < time() )
                return false;
 
-       $key = wp_hash($username . '|' . $expiration);
+       $key = wp_hash($username . '|' . $expiration, $scheme);
        $hash = hash_hmac('md5', $username . '|' . $expiration, $key);
 
        if ( $hmac != $hash )
@@ -506,7 +531,7 @@ endif;
 
 if ( !function_exists('wp_generate_auth_cookie') ) :
 /**
- * wp_generate_auth_cookie() - Generate authentication cookie contents
+ * Generate authentication cookie contents.
  *
  * @since 2.5
  * @uses apply_filters() Calls 'auth_cookie' hook on $cookie contents, User ID
@@ -514,35 +539,35 @@ if ( !function_exists('wp_generate_auth_cookie') ) :
  *
  * @param int $user_id User ID
  * @param int $expiration Cookie expiration in seconds
+ * @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in
  * @return string Authentication cookie contents
  */
-function wp_generate_auth_cookie($user_id, $expiration) {
+function wp_generate_auth_cookie($user_id, $expiration, $scheme = 'auth') {
        $user = get_userdata($user_id);
 
-       $key = wp_hash($user->user_login . '|' . $expiration);
+       $key = wp_hash($user->user_login . '|' . $expiration, $scheme);
        $hash = hash_hmac('md5', $user->user_login . '|' . $expiration, $key);
 
        $cookie = $user->user_login . '|' . $expiration . '|' . $hash;
 
-       return apply_filters('auth_cookie', $cookie, $user_id, $expiration);
+       return apply_filters('auth_cookie', $cookie, $user_id, $expiration, $scheme);
 }
 endif;
 
 if ( !function_exists('wp_set_auth_cookie') ) :
 /**
- * wp_set_auth_cookie() - Sets the authentication cookies based User ID
+ * Sets the authentication cookies based User ID.
  *
- * The $remember parameter increases the time that the cookie will
- * be kept. The default the cookie is kept without remembering is
- * two days. When $remember is set, the cookies will be kept for
- * 14 days or two weeks.
+ * The $remember parameter increases the time that the cookie will be kept. The
+ * default the cookie is kept without remembering is two days. When $remember is
+ * set, the cookies will be kept for 14 days or two weeks.
  *
  * @since 2.5
  *
  * @param int $user_id User ID
  * @param bool $remember Whether to remember the user or not
  */
-function wp_set_auth_cookie($user_id, $remember = false) {
+function wp_set_auth_cookie($user_id, $remember = false, $secure = '') {
        if ( $remember ) {
                $expiration = $expire = time() + 1209600;
        } else {
@@ -550,27 +575,52 @@ function wp_set_auth_cookie($user_id, $remember = false) {
                $expire = 0;
        }
 
-       $cookie = wp_generate_auth_cookie($user_id, $expiration);
+       if ( '' === $secure )
+               $secure = is_ssl() ? true : false;
+
+       if ( $secure ) {
+               $auth_cookie_name = SECURE_AUTH_COOKIE;
+               $scheme = 'secure_auth';
+       } else {
+               $auth_cookie_name = AUTH_COOKIE;
+               $scheme = 'auth';
+       }
+
+       $auth_cookie = wp_generate_auth_cookie($user_id, $expiration, $scheme);
+       $logged_in_cookie = wp_generate_auth_cookie($user_id, $expiration, 'logged_in');
 
-       do_action('set_auth_cookie', $cookie, $expire);
+       do_action('set_auth_cookie', $auth_cookie, $expire, $expiration, $user_id, $scheme);
+       do_action('set_logged_in_cookie', $logged_in_cookie, $expire, $expiration, $user_id, 'logged_in');
 
-       setcookie(AUTH_COOKIE, $cookie, $expire, COOKIEPATH, COOKIE_DOMAIN);
+       setcookie($auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN, $secure);
+       setcookie($auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $secure);
+       setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN);
        if ( COOKIEPATH != SITECOOKIEPATH )
-               setcookie(AUTH_COOKIE, $cookie, $expire, SITECOOKIEPATH, COOKIE_DOMAIN);
+               setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, SITECOOKIEPATH, COOKIE_DOMAIN);
 }
 endif;
 
 if ( !function_exists('wp_clear_auth_cookie') ) :
 /**
- * wp_clear_auth_cookie() - Deletes all of the cookies associated with authentication
+ * Removes all of the cookies associated with authentication.
  *
  * @since 2.5
  */
 function wp_clear_auth_cookie() {
+       setcookie(AUTH_COOKIE, ' ', time() - 31536000, ADMIN_COOKIE_PATH, COOKIE_DOMAIN);
+       setcookie(SECURE_AUTH_COOKIE, ' ', time() - 31536000, ADMIN_COOKIE_PATH, COOKIE_DOMAIN);
+       setcookie(AUTH_COOKIE, ' ', time() - 31536000, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN);
+       setcookie(SECURE_AUTH_COOKIE, ' ', time() - 31536000, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN);
+       setcookie(LOGGED_IN_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN);
+       setcookie(LOGGED_IN_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);
+
+       // Old cookies
        setcookie(AUTH_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN);
        setcookie(AUTH_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);
+       setcookie(SECURE_AUTH_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN);
+       setcookie(SECURE_AUTH_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);
 
-       // Old cookies
+       // Even older cookies
        setcookie(USER_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN);
        setcookie(PASS_COOKIE, ' ', time() - 31536000, COOKIEPATH, COOKIE_DOMAIN);
        setcookie(USER_COOKIE, ' ', time() - 31536000, SITECOOKIEPATH, COOKIE_DOMAIN);
@@ -580,7 +630,7 @@ endif;
 
 if ( !function_exists('is_user_logged_in') ) :
 /**
- * is_user_logged_in() - Checks if the current visitor is a logged in user
+ * Checks if the current visitor is a logged in user.
  *
  * @since 2.0.0
  *
@@ -598,26 +648,52 @@ endif;
 
 if ( !function_exists('auth_redirect') ) :
 /**
- * auth_redirect() - Checks if a user is logged in, if not it redirects them to the login page
+ * Checks if a user is logged in, if not it redirects them to the login page.
  *
  * @since 1.5
  */
 function auth_redirect() {
        // Checks if a user is logged in, if not redirects them to the login page
-       if ( (!empty($_COOKIE[AUTH_COOKIE]) &&
-                               !wp_validate_auth_cookie($_COOKIE[AUTH_COOKIE])) ||
-                       (empty($_COOKIE[AUTH_COOKIE])) ) {
-               nocache_headers();
 
-               wp_redirect(get_option('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI']));
-               exit();
+       if ( is_ssl() || force_ssl_admin() )
+               $secure = true;
+       else
+               $secure = false;
+
+       // If https is required and request is http, redirect
+       if ( $secure && !is_ssl() ) {
+               if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) {
+                       wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
+                       exit();
+               } else {
+                       wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
+                       exit();                 
+               }
        }
+
+       if ( wp_validate_auth_cookie() )
+               return;  // The cookie is good so we're done
+
+       // The cookie is no good so force login
+       nocache_headers();
+
+       if ( is_ssl() )
+               $proto = 'https://';
+       else
+               $proto = 'http://';
+
+       $login_url = site_url( 'wp-login.php?redirect_to=' . urlencode($proto . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']), 'login' );
+
+       wp_redirect($login_url);
+       exit();
 }
 endif;
 
 if ( !function_exists('check_admin_referer') ) :
 /**
- * check_admin_referer() - Makes sure that a user was referred from another admin page, to avoid security exploits
+ * Makes sure that a user was referred from another admin page.
+ *
+ * To avoid security exploits.
  *
  * @since 1.2.0
  * @uses do_action() Calls 'check_admin_referer' on $action.
@@ -626,7 +702,7 @@ if ( !function_exists('check_admin_referer') ) :
  * @param string $query_arg where to look for nonce in $_REQUEST (since 2.5)
  */
 function check_admin_referer($action = -1, $query_arg = '_wpnonce') {
-       $adminurl = strtolower(get_option('siteurl')).'/wp-admin';
+       $adminurl = strtolower(admin_url());
        $referer = strtolower(wp_get_referer());
        $result = wp_verify_nonce($_REQUEST[$query_arg], $action);
        if ( !$result && !(-1 == $action && strpos($referer, $adminurl) !== false) ) {
@@ -639,7 +715,7 @@ function check_admin_referer($action = -1, $query_arg = '_wpnonce') {
 
 if ( !function_exists('check_ajax_referer') ) :
 /**
- * check_ajax_referer() - Verifies the AJAX request to prevent processing requests external of the blog.
+ * Verifies the AJAX request to prevent processing requests external of the blog.
  *
  * @since 2.0.4
  *
@@ -665,7 +741,7 @@ endif;
 
 if ( !function_exists('wp_redirect') ) :
 /**
- * wp_redirect() - Redirects to another page, with a workaround for the IIS Set-Cookie bug
+ * Redirects to another page, with a workaround for the IIS Set-Cookie bug.
  *
  * @link http://support.microsoft.com/kb/q176113/
  * @since 1.5.1
@@ -698,7 +774,7 @@ endif;
 
 if ( !function_exists('wp_sanitize_redirect') ) :
 /**
- * wp_sanitize_redirect() - Sanitizes a URL for use in a redirect
+ * Sanitizes a URL for use in a redirect.
  *
  * @since 2.3
  *
@@ -726,14 +802,15 @@ endif;
 
 if ( !function_exists('wp_safe_redirect') ) :
 /**
- * wp_safe_redirect() - Performs a safe (local) redirect, using wp_redirect()
+ * Performs a safe (local) redirect, using wp_redirect().
  *
  * Checks whether the $location is using an allowed host, if it has an absolute
- * path. A plugin can therefore set or remove allowed host(s) to or from the list.
+ * path. A plugin can therefore set or remove allowed host(s) to or from the
+ * list.
  *
  * If the host is not allowed, then the redirect is to wp-admin on the siteurl
- * instead. This prevents malicious redirects which redirect to another host, but
- * only used in a few places.
+ * instead. This prevents malicious redirects which redirect to another host,
+ * but only used in a few places.
  *
  * @since 2.3
  * @uses apply_filters() Calls 'allowed_redirect_hosts' on an array containing
@@ -750,13 +827,16 @@ function wp_safe_redirect($location, $status = 302) {
        if ( substr($location, 0, 2) == '//' )
                $location = 'http:' . $location;
 
-       $lp  = parse_url($location);
+       // In php 5 parse_url may fail if the URL query part contains http://, bug #38143
+       $test = ( $cut = strpos($location, '?') ) ? substr( $location, 0, $cut ) : $location;
+       
+       $lp  = parse_url($test);
        $wpp = parse_url(get_option('home'));
 
        $allowed_hosts = (array) apply_filters('allowed_redirect_hosts', array($wpp['host']), isset($lp['host']) ? $lp['host'] : '');
 
        if ( isset($lp['host']) && ( !in_array($lp['host'], $allowed_hosts) && $lp['host'] != strtolower($wpp['host'])) )
-               $location = get_option('siteurl') . '/wp-admin/';
+               $location = admin_url();
 
        wp_redirect($location, $status);
 }
@@ -764,7 +844,7 @@ endif;
 
 if ( ! function_exists('wp_notify_postauthor') ) :
 /**
- * wp_notify_postauthor() - Notify an author of a comment/trackback/pingback to one of their posts
+ * Notify an author of a comment/trackback/pingback to one of their posts.
  *
  * @since 1.0.0
  *
@@ -810,8 +890,8 @@ function wp_notify_postauthor($comment_id, $comment_type='') {
                $subject = sprintf( __('[%1$s] Pingback: "%2$s"'), $blogname, $post->post_title );
        }
        $notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n";
-       $notify_message .= sprintf( __('Delete it: %s'), get_option('siteurl')."/wp-admin/comment.php?action=cdc&c=$comment_id" ) . "\r\n";
-       $notify_message .= sprintf( __('Spam it: %s'), get_option('siteurl')."/wp-admin/comment.php?action=cdc&dt=spam&c=$comment_id" ) . "\r\n";
+       $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=cdc&c=$comment_id") ) . "\r\n";
+       $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=cdc&dt=spam&c=$comment_id") ) . "\r\n";
 
        $wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']));
 
@@ -843,7 +923,7 @@ endif;
 
 if ( !function_exists('wp_notify_moderator') ) :
 /**
- * wp_notify_moderator() - Notifies the moderator of the blog about a new comment that is awaiting approval
+ * Notifies the moderator of the blog about a new comment that is awaiting approval.
  *
  * @since 1.0
  * @uses $wpdb
@@ -890,13 +970,13 @@ function wp_notify_moderator($comment_id) {
                        break;
        }
 
-       $notify_message .= sprintf( __('Approve it: %s'),  get_option('siteurl')."/wp-admin/comment.php?action=mac&c=$comment_id" ) . "\r\n";
-       $notify_message .= sprintf( __('Delete it: %s'), get_option('siteurl')."/wp-admin/comment.php?action=cdc&c=$comment_id" ) . "\r\n";
-       $notify_message .= sprintf( __('Spam it: %s'), get_option('siteurl')."/wp-admin/comment.php?action=cdc&dt=spam&c=$comment_id" ) . "\r\n";
+       $notify_message .= sprintf( __('Approve it: %s'),  admin_url("comment.php?action=mac&c=$comment_id") ) . "\r\n";
+       $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=cdc&c=$comment_id") ) . "\r\n";
+       $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=cdc&dt=spam&c=$comment_id") ) . "\r\n";
 
-       $strCommentsPending = sprintf( __ngettext('%s comment', '%s comments', $comments_waiting), $comments_waiting );
-       $notify_message .= sprintf( __('Currently %s are waiting for approval. Please visit the moderation panel:'), $strCommentsPending ) . "\r\n";
-       $notify_message .= get_option('siteurl') . "/wp-admin/edit-comments.php?comment_status=moderated\r\n";
+       $notify_message .= sprintf( __ngettext('Currently %s comment is waiting for approval. Please visit the moderation panel:', 
+               'Currently %s comments are waiting for approval. Please visit the moderation panel:', $comments_waiting), number_format_i18n($comments_waiting) ) . "\r\n";
+       $notify_message .= admin_url("edit-comments.php?comment_status=moderated") . "\r\n";
 
        $subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), get_option('blogname'), $post->post_title );
        $admin_email = get_option('admin_email');
@@ -912,7 +992,7 @@ endif;
 
 if ( !function_exists('wp_new_user_notification') ) :
 /**
- * wp_new_user_notification() - Notify the blog admin of a new user, normally via email
+ * Notify the blog admin of a new user, normally via email.
  *
  * @since 2.0
  *
@@ -936,7 +1016,7 @@ function wp_new_user_notification($user_id, $plaintext_pass = '') {
 
        $message  = sprintf(__('Username: %s'), $user_login) . "\r\n";
        $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
-       $message .= get_option('siteurl') . "/wp-login.php\r\n";
+       $message .= site_url("wp-login.php", 'login') . "\r\n";
 
        wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_option('blogname')), $message);
 
@@ -945,9 +1025,10 @@ endif;
 
 if ( !function_exists('wp_nonce_tick') ) :
 /**
- * wp_nonce_tick() - Get the time-dependent variable for nonce creation
+ * Get the time-dependent variable for nonce creation.
  *
- * A nonce has a lifespan of two ticks. Nonces in their second tick may be updated, e.g. by autosave.
+ * A nonce has a lifespan of two ticks. Nonces in their second tick may be
+ * updated, e.g. by autosave.
  *
  * @since 2.5
  *
@@ -962,10 +1043,10 @@ endif;
 
 if ( !function_exists('wp_verify_nonce') ) :
 /**
- * wp_verify_nonce() - Verify that correct nonce was used with time limit
+ * Verify that correct nonce was used with time limit.
  *
- * The user is given an amount of time to use the token, so therefore, since
- * the UID and $action remain the same, the independent variable is the time.
+ * The user is given an amount of time to use the token, so therefore, since the
+ * UID and $action remain the same, the independent variable is the time.
  *
  * @since 2.0.4
  *
@@ -992,7 +1073,7 @@ endif;
 
 if ( !function_exists('wp_create_nonce') ) :
 /**
- * wp_create_nonce() - Creates a random, one time use token
+ * Creates a random, one time use token.
  *
  * @since 2.0.4
  *
@@ -1011,61 +1092,97 @@ endif;
 
 if ( !function_exists('wp_salt') ) :
 /**
- * wp_salt() - Get salt to add to hashes to help prevent attacks
+ * Get salt to add to hashes to help prevent attacks.
  *
- * You can set the salt by defining two areas. One is in the database and
- * the other is in your wp-config.php file. The database location is defined
- * in the option named 'secret', but most likely will not need to be changed.
+ * The secret key is located in two places: the database in case the secret key
+ * isn't defined in the second place, which is in the wp-config.php file. If you
+ * are going to set the secret key, then you must do so in the wp-config.php
+ * file.
  *
- * The second, located in wp-config.php, is a constant named 'SECRET_KEY', but
- * is not required. If the constant is not defined then the database constants
- * will be used, since they are most likely given to be unique. However, given
- * that the salt will be added to the password and can be seen, the constant
- * is recommended to be set manually.
+ * The secret key in the database is randomly generated and will be appended to
+ * the secret key that is in wp-config.php file in some instances. It is
+ * important to have the secret key defined or changed in wp-config.php.
+ *
+ * If you have installed WordPress 2.5 or later, then you will have the
+ * SECRET_KEY defined in the wp-config.php already. You will want to change the
+ * value in it because hackers will know what it is. If you have upgraded to
+ * WordPress 2.5 or later version from a version before WordPress 2.5, then you
+ * should add the constant to your wp-config.php file.
+ *
+ * Below is an example of how the SECRET_KEY constant is defined with a value.
+ * You must not copy the below example and paste into your wp-config.php. If you
+ * need an example, then you can have a
+ * {@link http://api.wordpress.org/secret-key/1.0/ secret key created} for you.
  *
  * <code>
  * define('SECRET_KEY', 'mAry1HadA15|\/|b17w55w1t3asSn09w');
  * </code>
  *
- * Attention: Do not use above example!
- *
- * Salting passwords helps against tools which has stored hashed values
- * of common dictionary strings. The added values makes it harder to crack
- * if given salt string is not weak.
- *
- * Salting only helps if the string is not predictable and should be
- * made up of various characters. Think of the salt as a password for
- * securing your passwords, but common among all of your passwords.
- * Therefore the salt should be as long as possible as as difficult as
- * possible, because you will not have to remember it.
+ * Salting passwords helps against tools which has stored hashed values of
+ * common dictionary strings. The added values makes it harder to crack if given
+ * salt string is not weak.
  *
  * @since 2.5
+ * @link http://api.wordpress.org/secret-key/1.0/ Create a Secret Key for wp-config.php
  *
  * @return string Salt value from either 'SECRET_KEY' or 'secret' option
  */
-function wp_salt() {
+function wp_salt($scheme = 'auth') {
        global $wp_default_secret_key;
        $secret_key = '';
        if ( defined('SECRET_KEY') && ('' != SECRET_KEY) && ( $wp_default_secret_key != SECRET_KEY) )
                $secret_key = SECRET_KEY;
 
-       if ( defined('SECRET_SALT') ) {
-               $salt = SECRET_SALT;
-       } else {
-               $salt = get_option('secret');
-               if ( empty($salt) ) {
-                       $salt = wp_generate_password();
-                       update_option('secret', $salt);
+       if ( 'auth' == $scheme ) {
+               if ( defined('AUTH_KEY') && ('' != AUTH_KEY) && ( $wp_default_secret_key != AUTH_KEY) )
+                       $secret_key = AUTH_KEY;
+
+               if ( defined('AUTH_SALT') ) {
+                       $salt = AUTH_SALT;
+               } elseif ( defined('SECRET_SALT') ) {
+                       $salt = SECRET_SALT;
+               } else {
+                       $salt = get_option('auth_salt');
+                       if ( empty($salt) ) {
+                               $salt = wp_generate_password();
+                               update_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') ) {
+                       $salt = SECRET_AUTH_SALT;
+               } else {
+                       $salt = get_option('secure_auth_salt');
+                       if ( empty($salt) ) {
+                               $salt = wp_generate_password();
+                               update_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') ) {
+                       $salt = LOGGED_IN_SALT;
+               } else {
+                       $salt = get_option('logged_in_salt');
+                       if ( empty($salt) ) {
+                               $salt = wp_generate_password();
+                               update_option('logged_in_salt', $salt);
+                       }
                }
        }
 
-       return apply_filters('salt', $secret_key . $salt);
+       return apply_filters('salt', $secret_key . $salt, $scheme);
 }
 endif;
 
 if ( !function_exists('wp_hash') ) :
 /**
- * wp_hash() - Get hash of given string
+ * Get hash of given string.
  *
  * @since 2.0.4
  * @uses wp_salt() Get WordPress salt
@@ -1073,8 +1190,8 @@ if ( !function_exists('wp_hash') ) :
  * @param string $data Plain text to hash
  * @return string Hash of $data
  */
-function wp_hash($data) {
-       $salt = wp_salt();
+function wp_hash($data, $scheme = 'auth') {
+       $salt = wp_salt($scheme);
 
        return hash_hmac('md5', $data, $salt);
 }
@@ -1082,11 +1199,10 @@ endif;
 
 if ( !function_exists('wp_hash_password') ) :
 /**
- * wp_hash_password() - Create a hash (encrypt) of a plain text password
+ * Create a hash (encrypt) of a plain text password.
  *
- * For integration with other applications, this function can be
- * overwritten to instead use the other package password checking
- * algorithm.
+ * For integration with other applications, this function can be overwritten to
+ * instead use the other package password checking algorithm.
  *
  * @since 2.5
  * @global object $wp_hasher PHPass object
@@ -1110,17 +1226,15 @@ endif;
 
 if ( !function_exists('wp_check_password') ) :
 /**
- * wp_check_password() - Checks the plaintext password against the encrypted Password
+ * Checks the plaintext password against the encrypted Password.
  *
- * Maintains compatibility between old version and the new cookie
- * authentication protocol using PHPass library. The $hash parameter
- * is the encrypted password and the function compares the plain text
- * password when encypted similarly against the already encrypted
- * password to see if they match.
+ * Maintains compatibility between old version and the new cookie authentication
+ * protocol using PHPass library. The $hash parameter is the encrypted password
+ * and the function compares the plain text password when encypted similarly
+ * against the already encrypted password to see if they match.
  *
- * For integration with other applications, this function can be
- * overwritten to instead use the other package password checking
- * algorithm.
+ * For integration with other applications, this function can be overwritten to
+ * instead use the other package password checking algorithm.
  *
  * @since 2.5
  * @global object $wp_hasher PHPass object used for checking the password
@@ -1162,28 +1276,72 @@ endif;
 
 if ( !function_exists('wp_generate_password') ) :
 /**
- * wp_generate_password() - Generates a random password drawn from the defined set of characters
+ * Generates a random password drawn from the defined set of characters.
  *
  * @since 2.5
  *
  * @return string The random password
  **/
-function wp_generate_password($length = 12) {
-       $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()";
+function wp_generate_password($length = 12, $special_chars = true) {
+       $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
+       if ( $special_chars )
+               $chars .= '!@#$%^&*()';
+
        $password = '';
        for ( $i = 0; $i < $length; $i++ )
-               $password .= substr($chars, mt_rand(0, strlen($chars) - 1), 1);
+               $password .= substr($chars, wp_rand(0, strlen($chars) - 1), 1);
        return $password;
 }
 endif;
 
+if ( !function_exists('wp_rand') ) :
+ /**
+ * Generates a random number
+ *
+ * @since 2.6.2
+ *
+ * @param int $min Lower limit for the generated number (optional, default is 0)
+ * @param int $max Upper limit for the generated number (optional, default is 4294967295)
+ * @return int A random number between min and max
+ */
+function wp_rand( $min = 0, $max = 0 ) {
+       global $rnd_value;
+
+       $seed = get_option('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 ) {
+               $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);
+               update_option('random_seed', $seed);
+       }
+
+       // Take the first 8 digits for our value
+       $value = substr($rnd_value, 0, 8);
+
+       // Strip the first eight, leaving the remainder for the next call to wp_rand().
+       $rnd_value = substr($rnd_value, 8);
+
+       $value = abs(hexdec($value));
+
+       // Reduce the value to be within the min - max range
+       // 4294967295 = 0xffffffff = max random number
+       if ( $max != 0 )
+               $value = $min + (($max - $min + 1) * ($value / (4294967295 + 1)));
+
+       return abs(intval($value)); 
+}
+endif;
+
 if ( !function_exists('wp_set_password') ) :
 /**
- * wp_set_password() - Updates the user's password with a new encrypted one
+ * Updates the user's password with a new encrypted one.
  *
- * For integration with other applications, this function can be
- * overwritten to instead use the other package password checking
- * algorithm.
+ * For integration with other applications, this function can be overwritten to
+ * instead use the other package password checking algorithm.
  *
  * @since 2.5
  * @uses $wpdb WordPress database object for queries
@@ -1204,9 +1362,7 @@ endif;
 
 if ( !function_exists( 'get_avatar' ) ) :
 /**
- * get_avatar() - Get avatar for a user
- *
- * Retrieve the avatar for a user provided a user ID or email address
+ * Retrieve the avatar for a user who provided a user ID or email address.
  *
  * @since 2.5
  * @param int|string|object $id_or_email A user ID,  email address, or comment object
@@ -1240,8 +1396,26 @@ function get_avatar( $id_or_email, $size = '96', $default = '' ) {
                $email = $id_or_email;
        }
 
-       if ( empty($default) )
-               $default = "http://www.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=$size"; // ad516503a11cd5ca435acc9bb6523536 == md5('unknown@gravatar.com')
+       if ( empty($default) ) {
+               $avatar_default = get_option('avatar_default');
+               if ( empty($avatar_default) )
+                       $default = 'mystery';
+               else
+                       $default = $avatar_default;
+       }
+
+       if ( 'custom' == $default )
+               $default = add_query_arg( 's', $size, $defaults[$avatar_default][1] );
+       elseif ( 'mystery' == $default )
+               $default = "http://www.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s={$size}"; // ad516503a11cd5ca435acc9bb6523536 == md5('unknown@gravatar.com')
+       elseif ( 'blank' == $default )
+               $default = includes_url('images/blank.gif');
+       elseif ( !empty($email) && 'gravatar_default' == $default )
+               $default = '';
+       elseif ( 'gravatar_default' == $default )
+               $default = "http://www.gravatar.com/avatar/s={$size}";
+       elseif ( empty($email) )
+               $default = "http://www.gravatar.com/avatar/?d=$default&amp;s={$size}";
 
        if ( !empty($email) ) {
                $out = 'http://www.gravatar.com/avatar/';
@@ -1264,7 +1438,7 @@ endif;
 
 if ( !function_exists('wp_setcookie') ) :
 /**
- * wp_setcookie() - Sets a cookie for a user who just logged in
+ * Sets a cookie for a user who just logged in.
  *
  * @since 1.5
  * @deprecated Use wp_set_auth_cookie()
@@ -1286,7 +1460,7 @@ endif;
 
 if ( !function_exists('wp_clearcookie') ) :
 /**
- * wp_clearcookie() - Clears the authentication cookie, logging the user out
+ * Clears the authentication cookie, logging the user out.
  *
  * @since 1.5
  * @deprecated Use wp_clear_auth_cookie()
@@ -1300,10 +1474,10 @@ endif;
 
 if ( !function_exists('wp_get_cookie_login') ):
 /**
- * wp_get_cookie_login() - Gets the user 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.
+ * This function is deprecated and should no longer be extended as it won't be
+ * used anywhere in WordPress. Also, plugins shouldn't use it either.
  *
  * @since 2.0.4
  * @deprecated No alternative
@@ -1318,15 +1492,14 @@ endif;
 
 if ( !function_exists('wp_login') ) :
 /**
- * wp_login() - Checks a users login information and logs them in if it checks out
+ * 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.
+ * 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.
+ * 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()
@@ -1350,4 +1523,79 @@ function wp_login($username, $password, $deprecated = '') {
 }
 endif;
 
-?>
+if ( !function_exists( 'wp_text_diff' ) ) :
+/**
+ * Displays a human readable HTML representation of the difference between two strings.
+ *
+ * The Diff is available for getting the changes between versions. The output is
+ * HTML, so the primary use is for displaying the changes. If the two strings
+ * are equivalent, then an empty string will be returned.
+ *
+ * The arguments supported and can be changed are listed below.
+ *
+ * 'title' : Default is an empty string. Titles the diff in a manner compatible
+ *             with the output.
+ * 'title_left' : Default is an empty string. Change the HTML to the left of the
+ *             title.
+ * 'title_right' : Default is an empty string. Change the HTML to the right of
+ *             the title.
+ *
+ * @since 2.6
+ * @see wp_parse_args() Used to change defaults to user defined settings.
+ * @uses Text_Diff
+ * @uses WP_Text_Diff_Renderer_Table
+ *
+ * @param string $left_string "old" (left) version of string
+ * @param string $right_string "new" (right) version of string
+ * @param string|array $args Optional. Change 'title', 'title_left', and 'title_right' defaults.
+ * @return string Empty string if strings are equivalent or HTML with differences.
+ */
+function wp_text_diff( $left_string, $right_string, $args = null ) {
+       $defaults = array( 'title' => '', 'title_left' => '', 'title_right' => '' );
+       $args = wp_parse_args( $args, $defaults );
+
+       if ( !class_exists( 'WP_Text_Diff_Renderer_Table' ) )
+               require( ABSPATH . WPINC . '/wp-diff.php' );
+
+       // Normalize whitespace
+       $left_string  = trim($left_string);
+       $right_string = trim($right_string);
+       $left_string  = str_replace("\r", "\n", $left_string);
+       $right_string = str_replace("\r", "\n", $right_string);
+       $left_string  = preg_replace( array( '/\n+/', '/[ \t]+/' ), array( "\n", ' ' ), $left_string );
+       $right_string = preg_replace( array( '/\n+/', '/[ \t]+/' ), array( "\n", ' ' ), $right_string );
+       
+       $left_lines  = split("\n", $left_string);
+       $right_lines = split("\n", $right_string);
+
+       $text_diff = new Text_Diff($left_lines, $right_lines);
+       $renderer  = new WP_Text_Diff_Renderer_Table();
+       $diff = $renderer->render($text_diff);
+
+       if ( !$diff )
+               return '';
+
+       $r  = "<table class='diff'>\n";
+       $r .= "<col class='ltype' /><col class='content' /><col class='ltype' /><col class='content' />";
+
+       if ( $args['title'] || $args['title_left'] || $args['title_right'] )
+               $r .= "<thead>";
+       if ( $args['title'] )
+               $r .= "<tr class='diff-title'><th colspan='4'>$args[title]</th></tr>\n";
+       if ( $args['title_left'] || $args['title_right'] ) {
+               $r .= "<tr class='diff-sub-title'>\n";
+               $r .= "\t<td></td><th>$args[title_left]</th>\n";
+               $r .= "\t<td></td><th>$args[title_right]</th>\n";
+               $r .= "</tr>\n";
+       }
+       if ( $args['title'] || $args['title_left'] || $args['title_right'] )
+               $r .= "</thead>\n";
+
+       $r .= "<tbody>\n$diff\n</tbody>\n";
+       $r .= "</table>";
+
+       return $r;
+}
+endif;
+
+?>
\ No newline at end of file
index 556570a76e2ff303fa54dd3b7a1dec3f465199e2..83b53580e5534fc5bdd896409a83c79e016fb03e 100644 (file)
@@ -434,7 +434,7 @@ function remove_action($tag, $function_to_remove, $priority = 10, $accepted_args
 /**
  * plugin_basename() - Gets the basename of a plugin.
  *
- * This method extract the name of a plugin from its filename.
+ * This method extracts the name of a plugin from its filename.
  *
  * @package WordPress
  * @subpackage Plugin
@@ -444,11 +444,14 @@ function remove_action($tag, $function_to_remove, $priority = 10, $accepted_args
  *
  * @param string $file The filename of plugin.
  * @return string The name of a plugin.
+ * @uses WP_PLUGIN_DIR
  */
 function plugin_basename($file) {
        $file = str_replace('\\','/',$file); // sanitize for Win32 installs
        $file = preg_replace('|/+|','/', $file); // remove any duplicate slash
-       $file = preg_replace('|^.*/' . PLUGINDIR . '/|','',$file); // get relative path from plugins dir
+       $plugin_dir = str_replace('\\','/',WP_PLUGIN_DIR); // sanitize for Win32 installs
+       $plugin_dir = preg_replace('|/+|','/', $plugin_dir); // remove any duplicate slash
+       $file = preg_replace('|^' . preg_quote($plugin_dir, '|') . '/|','',$file); // get relative path from plugins dir
        return $file;
 }
 
index 915101cb083a91658bddcabcc3d8d8d9587ab78b..40a56d99eb3f5a8381fae9a55c77cec15be1f728 100644 (file)
@@ -283,7 +283,7 @@ function wp_dropdown_pages($args = '') {
        $output = '';
 
        if ( ! empty($pages) ) {
-               $output = "<select name='$name'>\n";
+               $output = "<select name='$name' id='$name'>\n";
                if ( $show_option_none )
                        $output .= "\t<option value=''>$show_option_none</option>\n";
                $output .= walk_page_dropdown_tree($pages, $depth, $r);
@@ -565,4 +565,169 @@ function is_page_template($template = '') {
        return false;
 }
 
-?>
+/**
+ * wp_post_revision_title() - returns formatted datetimestamp of a revision (linked to that revisions's page)
+ *
+ * @package WordPress
+ * @subpackage Post Revisions
+ * @since 2.6
+ *
+ * @uses date_i18n()
+ *
+ * @param int|object $revision revision ID or revision object
+ * @param bool $link optional Link to revisions's page?
+ * @return string i18n formatted datetimestamp or localized 'Corrent Revision'
+ */
+function wp_post_revision_title( $revision, $link = true ) {
+       if ( !$revision = get_post( $revision ) )
+               return $revision;
+
+       if ( !in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) )
+               return false;
+
+       $datef = _c( 'j F, Y @ G:i|revision date format');
+       $autosavef = __( '%s [Autosave]' );
+       $currentf  = __( '%s [Current Revision]' );
+
+       $date = date_i18n( $datef, strtotime( $revision->post_modified_gmt . ' +0000' ) );
+       if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) )
+               $date = "<a href='$link'>$date</a>";
+
+       if ( !wp_is_post_revision( $revision ) )
+               $date = sprintf( $currentf, $date );
+       elseif ( wp_is_post_autosave( $revision ) )
+               $date = sprintf( $autosavef, $date );
+
+       return $date;
+}
+
+/**
+ * wp_list_post_revisions() - echoes list of a post's revisions
+ *
+ * Can output either a UL with edit links or a TABLE with diff interface, and restore action links
+ *
+ * Second argument controls parameters:
+ *   (bool)   parent : include the parent (the "Current Revision") in the list
+ *   (string) format : 'list' or 'form-table'.  'list' outputs UL, 'form-table' outputs TABLE with UI
+ *   (int)    right  : what revision is currently being viewed - used in form-table format
+ *   (int)    left   : what revision is currently being diffed against right - used in form-table format
+ *
+ * @package WordPress
+ * @subpackage Post Revisions
+ * @since 2.6
+ *
+ * @uses wp_get_post_revisions()
+ * @uses wp_post_revision_title()
+ * @uses get_edit_post_link()
+ * @uses get_author_name()
+ *
+ * @param int|object $post_id post ID or post object
+ * @param string|array $args see description @see wp_parse_args()
+ */
+function wp_list_post_revisions( $post_id = 0, $args = null ) { // TODO? split into two functions (list, form-table) ?
+       if ( !$post = get_post( $post_id ) )
+               return;
+
+       $defaults = array( 'parent' => false, 'right' => false, 'left' => false, 'format' => 'list', 'type' => 'all' );
+       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;
+       }
+
+       $titlef = _c( '%1$s by %2$s|post revision 1:datetime, 2:name' );
+
+       if ( $parent )
+               array_unshift( $revisions, $post );
+
+       $rows = '';
+       $class = false;
+       $can_edit_post = current_user_can( 'edit_post', $post->ID );
+       foreach ( $revisions as $revision ) {
+               if ( !current_user_can( 'read_post', $revision->ID ) )
+                       continue;
+               if ( 'revision' === $type && wp_is_post_autosave( $revision ) )
+                       continue;
+
+               $date = wp_post_revision_title( $revision );
+               $name = get_author_name( $revision->post_author );
+
+               if ( 'form-table' == $format ) {
+                       if ( $left )
+                               $left_checked = $left == $revision->ID ? ' checked="checked"' : '';
+                       else
+                               $left_checked = $right_checked ? ' checked="checked"' : ''; // [sic] (the next one)
+                       $right_checked = $right == $revision->ID ? ' checked="checked"' : '';
+
+                       $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>';
+                       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<td>$date</td>\n";
+                       $rows .= "\t<td>$name</td>\n";
+                       $rows .= "\t<td class='action-links'>$actions</td>\n";
+                       $rows .= "</tr>\n";
+               } else {
+                       $title = sprintf( $titlef, $date, $name );
+                       $rows .= "\t<li>$title</li>\n";
+               }
+       }
+
+       if ( 'form-table' == $format ) : ?>
+
+<form action="revision.php" method="get">
+
+<div class="tablenav">
+       <div class="alignleft">
+               <input type="submit" class="button-secondary" value="<?php _e( 'Compare Revisions' ); ?>" />
+               <input type="hidden" name="action" value="diff" />
+       </div>
+</div>
+
+<br class="clear" />
+
+<table class="widefat post-revisions">
+       <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 _e( 'Author' ); ?></th>
+       <th scope="col" class="action-links"><?php _e( 'Actions' ); ?></th>
+</tr>
+</thead>
+<tbody>
+
+<?php echo $rows; ?>
+
+</tbody>
+</table>
+
+</form>
+
+<?php
+       else :
+               echo "<ul class='post-revisions'>\n";
+               echo $rows;
+               echo "</ul>";
+       endif;
+
+}
index cca4149a523d9c997b601c89eeaf2347936546a8..32526400baedfde00c815d022c2548a7d3e1d519 100644 (file)
@@ -1,6 +1,10 @@
 <?php
 /**
- * Post functions and post utility function
+ * Post functions and post utility function.
+ *
+ * Warning: The inline documentation for the functions contained
+ * in this file might be inaccurate, so the documentation is not
+ * authoritative at the moment.
  *
  * @package WordPress
  * @subpackage Post
  */
 
 /**
- * get_attached_file() - Get metadata for an attached file
+ * Retrieve attached file path based on attachment ID.
  *
- * {@internal Missing Long Description}}
+ * You can optionally send it through the 'get_attached_file' filter, but by
+ * default it will just return the file path unfiltered.
+ *
+ * The function works by getting the single post meta name, named
+ * '_wp_attached_file' and returning it. This is a convenience function to
+ * prevent looking up the meta name and provide a mechanism for sending the
+ * attached filename through a filter.
  *
  * @package WordPress
  * @subpackage Post
  * @since 2.0
+ * @uses apply_filters() Calls 'get_attached_file' on file path and attachment ID
  *
  * @param int $attachment_id Attachment ID
  * @param bool $unfiltered Whether to apply filters or not
- * @return array {@internal Missing Description}}
+ * @return string The file path to the attached file.
  */
 function get_attached_file( $attachment_id, $unfiltered = false ) {
        $file = get_post_meta( $attachment_id, '_wp_attached_file', true );
@@ -28,56 +39,89 @@ function get_attached_file( $attachment_id, $unfiltered = false ) {
 }
 
 /**
- * update_attached_file() - Update attached file metadata
+ * Update attachment file path based on attachment ID.
  *
- * {@internal Missing Long Description}}
+ * Used to update the file path of the attachment, which uses post meta name
+ * '_wp_attached_file' to store the path of the attachment.
  *
  * @package WordPress
  * @subpackage Post
  * @since 2.1
+ * @uses apply_filters() Calls 'update_attached_file' on file path and attachment ID
  *
  * @param int $attachment_id Attachment ID
- * @param string $file {@internal Missing Description}}
- * @return bool|mixed {@internal Missing Description}}
+ * @param string $file File path for the attachment
+ * @return bool False on failure, true on success.
  */
 function update_attached_file( $attachment_id, $file ) {
        if ( !get_post( $attachment_id ) )
                return false;
 
-       $old_file = get_attached_file( $attachment_id, true );
-
        $file = apply_filters( 'update_attached_file', $file, $attachment_id );
 
-       if ( $old_file )
-               return update_post_meta( $attachment_id, '_wp_attached_file', $file, $old_file );
-       else
-               return add_post_meta( $attachment_id, '_wp_attached_file', $file );
+       return update_post_meta( $attachment_id, '_wp_attached_file', $file );
 }
 
 /**
- * get_children() - Get post children
+ * Retrieve all children of the post parent ID.
  *
- * {@internal Missing Long Description}}
+ * Normally, without any enhancements, the children would apply to pages. In the
+ * context of the inner workings of WordPress, pages, posts, and attachments
+ * share the same table, so therefore the functionality could apply to any one
+ * of them. It is then noted that while this function does not work on posts, it
+ * does not mean that it won't work on posts. It is recommended that you know
+ * what context you wish to retrieve the children of.
+ *
+ * Attachments may also be made the child of a post, so if that is an accurate
+ * statement (which needs to be verified), it would then be possible to get
+ * all of the attachments for a post. Attachments have since changed since
+ * version 2.5, so this is most likely unaccurate, but serves generally as an
+ * example of what is possible.
+ *
+ * The arguments listed as defaults are for this function and also of the
+ * get_posts() function. The arguments are combined with the get_children
+ * defaults and are then passed to the get_posts() function, which accepts
+ * additional arguments. You can replace the defaults in this function, listed
+ * below and the additional arguments listed in the get_posts() function.
+ *
+ * The 'post_parent' is the most important argument and important attention
+ * needs to be paid to the $args parameter. If you pass either an object or an
+ * integer (number), then just the 'post_parent' is grabbed and everything else
+ * is lost. If you don't specify any arguments, then it is assumed that you are
+ * in The Loop and the post parent will be grabbed for from the current post.
+ *
+ * The 'post_parent' argument is the ID to get the children. The 'numberposts'
+ * is the amount of posts to retrieve that has a default of '-1', which is
+ * used to get all of the posts. Giving a number higher than 0 will only
+ * retrieve that amount of posts.
+ *
+ * The 'post_type' and 'post_status' arguments can be used to choose what
+ * criteria of posts to retrieve. The 'post_type' can be anything, but WordPress
+ * post types are 'post', 'pages', and 'attachments'. The 'post_status'
+ * argument will accept any post status within the write administration panels.
+ *
+ * @see get_posts() Has additional arguments that can be replaced.
+ * @internal Claims made in the long description might be inaccurate.
  *
  * @package WordPress
  * @subpackage Post
  * @since 2.0
  *
- * @param mixed $args {@internal Missing Description}}
- * @param string $output {@internal Missing Description}}
- * @return mixed {@internal Missing Description}}
+ * @param mixed $args Optional. User defined arguments for replacing the defaults.
+ * @param string $output Optional. Constant for return type, either OBJECT (default), ARRAY_A, ARRAY_N.
+ * @return array|bool False on failure and the type will be determined by $output parameter.
  */
 function &get_children($args = '', $output = OBJECT) {
        if ( empty( $args ) ) {
                if ( isset( $GLOBALS['post'] ) ) {
-                       $args = 'post_parent=' . (int) $GLOBALS['post']->post_parent;
+                       $args = array('post_parent' => (int) $GLOBALS['post']->post_parent );
                } else {
                        return false;
                }
        } elseif ( is_object( $args ) ) {
-               $args = 'post_parent=' . (int) $args->post_parent;
+               $args = array('post_parent' => (int) $args->post_parent );
        } elseif ( is_numeric( $args ) ) {
-               $args = 'post_parent=' . (int) $args;
+               $args = array('post_parent' => (int) $args);
        }
 
        $defaults = array(
@@ -88,7 +132,6 @@ function &get_children($args = '', $output = OBJECT) {
        $r = wp_parse_args( $args, $defaults );
 
        $children = get_posts( $r );
-
        if ( !$children )
                return false;
 
@@ -113,13 +156,13 @@ function &get_children($args = '', $output = OBJECT) {
 }
 
 /**
- * get_extended() - get extended entry info (<!--more-->)
+ * get_extended() - Get extended entry info (<!--more-->)
  *
  * {@internal Missing Long Description}}
  *
  * @package WordPress
  * @subpackage Post
- * @since 1.0.1
+ * @since 1.0.0
  *
  * @param string $post {@internal Missing Description}}
  * @return array {@internal Missing Description}}
@@ -149,6 +192,7 @@ function get_extended($post) {
  * @subpackage Post
  * @since 1.5.1
  * @uses $wpdb
+ * @link http://codex.wordpress.org/Function_Reference/get_post
  *
  * @param int|object &$post post ID or post object
  * @param string $output {@internal Missing Description}}
@@ -172,6 +216,8 @@ function &get_post(&$post, $output = OBJECT, $filter = 'raw') {
                $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));
+                       if ( ! $_post )
+                               return $null;
                        _get_post_ancestors($_post);
                        wp_cache_add($_post->ID, $_post, 'posts');
                }
@@ -193,18 +239,17 @@ function &get_post(&$post, $output = OBJECT, $filter = 'raw') {
 }
 
 /**
- * get_post_ancestors() - Retrieve ancestors for a post
+ * Retrieve ancestors of a post.
  *
  * @package WordPress
  * @subpackage Post
  * @since 2.5
  *
- * @param string $field {@internal Missing Description}}
- * @param int|object &$post post ID or post object
- * @return array of ancestor IDs
+ * @param int|object $post Post ID or post object
+ * @return array Ancestor IDs or empty array if none are found.
  */
 function get_post_ancestors($post) {
-       $post = get_post();
+       $post = get_post($post);
 
        if ( !empty($post->ancestors) )
                return $post->ancestors;
@@ -213,15 +258,22 @@ function get_post_ancestors($post) {
 }
 
 /**
- * get_post_field() - Retrieve a field based on a post ID.
+ * Retrieve data from a post field based on Post ID.
+ *
+ * Examples of the post field will be, 'post_type', 'post_status', 'content',
+ * etc and based off of the post object property or key names.
+ *
+ * The context values are based off of the taxonomy filter functions and
+ * supported values are found within those functions.
  *
  * @package WordPress
  * @subpackage Post
  * @since 2.3
+ * @uses sanitize_post_field() See for possible $context values.
  *
- * @param string $field {@internal Missing Description}}
+ * @param string $field Post field name
  * @param id $post Post ID
- * @param string $context Optional. How to filter the field
+ * @param string $context Optional. How to filter the field. Default is display.
  * @return WP_Error|string Value in post field or WP_Error on failure
  */
 function get_post_field( $field, $post, $context = 'display' ) {
@@ -241,13 +293,16 @@ function get_post_field( $field, $post, $context = 'display' ) {
 }
 
 /**
- * get_post_mime_type() - Takes a post ID, returns its mime type.
+ * Retrieve the mime type of an attachment based on the ID.
+ *
+ * This function can be used with any post type, but it makes more sense with
+ * attachments.
  *
  * @package WordPress
  * @subpackage Post
  * @since 2.0
  *
- * @param int $ID Post ID
+ * @param int $ID Optional. Post ID.
  * @return bool|string False on failure or returns the mime type
  */
 function get_post_mime_type($ID = '') {
@@ -260,16 +315,17 @@ function get_post_mime_type($ID = '') {
 }
 
 /**
- * get_post_status() - Takes a post ID and returns its status
+ * Retrieve the post status based on the Post ID.
  *
- * {@internal Missing Long Description}}
+ * If the post ID is of an attachment, then the parent post status will be given
+ * instead.
  *
  * @package WordPress
  * @subpackage Post
  * @since 2.0
  *
- * @param int $ID {@internal Missing Description}}
- * @return string|bool post status or false
+ * @param int $ID Post ID
+ * @return string|bool Post status or false on failure.
  */
 function get_post_status($ID = '') {
        $post = get_post($ID);
@@ -285,7 +341,7 @@ function get_post_status($ID = '') {
 }
 
 /**
- * get_post_statuses( ) - Retuns the possible user post status values
+ * Retrieve all of the WordPress supported post statuses.
  *
  * Posts have a limited set of valid status values, this provides the
  * post_status values and descriptions.
@@ -294,7 +350,7 @@ function get_post_status($ID = '') {
  * @subpackage Post
  * @since 2.5
  *
- * @return array
+ * @return array List of post statuses.
  */
 function get_post_statuses( ) {
        $status = array(
@@ -308,7 +364,7 @@ function get_post_statuses( ) {
 }
 
 /**
- * get_page_statuses( ) - Retuns the possible user page status values
+ * Retrieve all of the WordPress support page statuses.
  *
  * Pages have a limited set of valid status values, this provides the
  * post_status values and descriptions.
@@ -317,7 +373,7 @@ function get_post_statuses( ) {
  * @subpackage Page
  * @since 2.5
  *
- * @return array
+ * @return array List of page statuses.
  */
 function get_page_statuses( ) {
        $status = array(
@@ -397,92 +453,38 @@ function set_post_type( $post_id = 0, $post_type = 'post' ) {
  * @subpackage Post
  * @since 1.2
  * @uses $wpdb
+ * @link http://codex.wordpress.org/Template_Tags/get_posts
  *
  * @param array $args {@internal Missing Description}}
  * @return array {@internal Missing Description}}
  */
 function get_posts($args = null) {
-       global $wpdb;
-
        $defaults = array(
                'numberposts' => 5, 'offset' => 0,
                'category' => 0, 'orderby' => 'post_date',
                'order' => 'DESC', 'include' => '',
                'exclude' => '', 'meta_key' => '',
                'meta_value' =>'', 'post_type' => 'post',
-               'post_status' => 'publish', 'post_parent' => 0
+               'post_parent' => 0, 'suppress_filters' => true
        );
 
        $r = wp_parse_args( $args, $defaults );
-       extract( $r, EXTR_SKIP );
-
-       $numberposts = (int) $numberposts;
-       $offset = (int) $offset;
-       $category = (int) $category;
-       $post_parent = (int) $post_parent;
-
-       $inclusions = '';
-       if ( !empty($include) ) {
-               $offset = 0;    //ignore offset, category, exclude, meta_key, and meta_value, post_parent if using include
-               $category = 0;
-               $exclude = '';
-               $meta_key = '';
-               $meta_value = '';
-               $post_parent = 0;
-               $incposts = preg_split('/[\s,]+/',$include);
-               $numberposts = count($incposts);  // only the number of posts included
-               if ( count($incposts) ) {
-                       foreach ( $incposts as $incpost ) {
-                               if (empty($inclusions))
-                                       $inclusions = $wpdb->prepare(' AND ( ID = %d ', $incpost);
-                               else
-                                       $inclusions .= $wpdb->prepare(' OR ID = %d ', $incpost);
-                       }
-               }
-       }
-       if (!empty($inclusions))
-               $inclusions .= ')';
+       if ( empty( $r['post_status'] ) )
+               $r['post_status'] = ( 'attachment' == $r['post_type'] ) ? 'inherit' : 'publish';
+       if ( ! empty($r['numberposts']) )
+               $r['posts_per_page'] = $r['numberposts'];
+       if ( ! empty($r['category']) )
+               $r['cat'] = $r['category'];
+       if ( ! empty($r['include']) ) {
+               $incposts = preg_split('/[\s,]+/',$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']);
 
-       $exclusions = '';
-       if ( !empty($exclude) ) {
-               $exposts = preg_split('/[\s,]+/',$exclude);
-               if ( count($exposts) ) {
-                       foreach ( $exposts as $expost ) {
-                               if (empty($exclusions))
-                                       $exclusions = $wpdb->prepare(' AND ( ID <> %d ', $expost);
-                               else
-                                       $exclusions .= $wpdb->prepare(' AND ID <> %d ', $expost);
-                       }
-               }
-       }
-       if (!empty($exclusions))
-               $exclusions .= ')';
-
-       // orderby
-       if ( preg_match( '/.+ +(ASC|DESC)/i', $orderby ) )
-               $order = ''; // orderby has its own order, so we'll use that
+       $get_posts = new WP_Query;
+       return $get_posts->query($r);
 
-       $query  = "SELECT DISTINCT * FROM $wpdb->posts ";
-       $query .= empty( $category ) ? '' : ", $wpdb->term_relationships, $wpdb->term_taxonomy  ";
-       $query .= empty( $meta_key ) ? '' : ", $wpdb->postmeta ";
-       $query .= " WHERE 1=1 ";
-       $query .= empty( $post_type ) ? '' : $wpdb->prepare("AND post_type = %s ", $post_type);
-       $query .= empty( $post_status ) ? '' : $wpdb->prepare("AND post_status = %s ", $post_status);
-       $query .= "$exclusions $inclusions " ;
-       $query .= empty( $category ) ? '' : $wpdb->prepare("AND ($wpdb->posts.ID = $wpdb->term_relationships.object_id AND $wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id AND $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy = 'category')", $category);
-       $query .= empty( $post_parent ) ? '' : $wpdb->prepare("AND $wpdb->posts.post_parent = %d ", $post_parent);
-       // expected_slashed ($meta_key, $meta_value) -- Also, this looks really funky, doesn't seem like it works
-       $query .= empty( $meta_key ) | empty($meta_value)  ? '' : " AND ($wpdb->posts.ID = $wpdb->postmeta.post_id AND $wpdb->postmeta.meta_key = '$meta_key' AND $wpdb->postmeta.meta_value = '$meta_value' )";
-       $query .= empty( $post_mime_type ) ? '' : wp_post_mime_type_where($post_mime_type);
-       $query .= " GROUP BY $wpdb->posts.ID ORDER BY " . $orderby . ' ' . $order;
-       if ( 0 < $numberposts )
-               $query .= $wpdb->prepare(" LIMIT %d,%d", $offset, $numberposts);
-
-       $posts = $wpdb->get_results($query);
-
-       update_post_caches($posts);
-
-       return $posts;
 }
 
 //
@@ -498,6 +500,7 @@ function get_posts($args = null) {
  * @subpackage Post
  * @since 1.5
  * @uses $wpdb
+ * @link http://codex.wordpress.org/Function_Reference/add_post_meta
  *
  * @param int $post_id post ID
  * @param string $key {@internal Missing Description}}
@@ -508,6 +511,10 @@ function get_posts($args = null) {
 function add_post_meta($post_id, $meta_key, $meta_value, $unique = false) {
        global $wpdb;
 
+       // make sure meta is added to the post, not a revision
+       if ( $the_post = wp_is_post_revision($post_id) )
+               $post_id = $the_post;
+
        // expected_slashed ($meta_key)
        $meta_key = stripslashes($meta_key);
 
@@ -532,6 +539,7 @@ function add_post_meta($post_id, $meta_key, $meta_value, $unique = false) {
  * @subpackage Post
  * @since 1.5
  * @uses $wpdb
+ * @link http://codex.wordpress.org/Function_Reference/delete_post_meta
  *
  * @param int $post_id post ID
  * @param string $key {@internal Missing Description}}
@@ -574,6 +582,7 @@ function delete_post_meta($post_id, $key, $value = '') {
  * @subpackage Post
  * @since 1.5
  * @uses $wpdb
+ * @link http://codex.wordpress.org/Function_Reference/get_post_meta
  *
  * @param int $post_id post ID
  * @param string $key The meta key to retrieve
@@ -585,27 +594,20 @@ function get_post_meta($post_id, $key, $single = false) {
 
        $meta_cache = wp_cache_get($post_id, 'post_meta');
 
+       if ( !$meta_cache ) {
+               update_postmeta_cache($post_id);
+               $meta_cache = wp_cache_get($post_id, 'post_meta');
+       }
+
        if ( isset($meta_cache[$key]) ) {
                if ( $single ) {
                        return maybe_unserialize( $meta_cache[$key][0] );
                } else {
-                       return maybe_unserialize( $meta_cache[$key] );
+                       return array_map('maybe_unserialize', $meta_cache[$key]);
                }
        }
 
-       if ( !$meta_cache ) {
-               update_postmeta_cache($post_id);
-               $meta_cache = wp_cache_get($post_id, 'post_meta');
-       }
-
-       if ( $single ) {
-               if ( isset($meta_cache[$key][0]) )
-                       return maybe_unserialize($meta_cache[$key][0]);
-               else
-                       return '';
-       } else {
-               return maybe_unserialize($meta_cache[$key]);
-       }
+       return '';
 }
 
 /**
@@ -617,6 +619,7 @@ function get_post_meta($post_id, $key, $single = false) {
  * @subpackage Post
  * @since 1.5
  * @uses $wpdb
+ * @link http://codex.wordpress.org/Function_Reference/update_post_meta
  *
  * @param int $post_id post ID
  * @param string $key {@internal Missing Description}}
@@ -627,20 +630,22 @@ function get_post_meta($post_id, $key, $single = false) {
 function update_post_meta($post_id, $meta_key, $meta_value, $prev_value = '') {
        global $wpdb;
 
-       $meta_value = maybe_serialize($meta_value);
-       $prev_value = maybe_serialize($prev_value);
-
        // expected_slashed ($meta_key)
        $meta_key = stripslashes($meta_key);
 
-       if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT meta_key FROM $wpdb->postmeta WHERE meta_key = %s AND post_id = %d", $meta_key, $post_id ) ) )
-               return false;
+       if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT meta_key FROM $wpdb->postmeta WHERE meta_key = %s AND post_id = %d", $meta_key, $post_id ) ) ) {
+               return add_post_meta($post_id, $meta_key, $meta_value);
+       }
+
+       $meta_value = maybe_serialize($meta_value);
 
        $data  = compact( 'meta_value' );
        $where = compact( 'meta_key', 'post_id' );
 
-       if ( !empty( $prev_value ) )
+       if ( !empty( $prev_value ) ) {
+               $prev_value = maybe_serialize($prev_value);
                $where['meta_value'] = $prev_value;
+       }
 
        $wpdb->update( $wpdb->postmeta, $data, $where );
        wp_cache_delete($post_id, 'post_meta');
@@ -676,6 +681,7 @@ function delete_post_meta_by_key($post_meta_key) {
  * @package WordPress
  * @subpackage Post
  * @since 1.2
+ * @link http://codex.wordpress.org/Function_Reference/get_post_custom
  *
  * @uses $id
  * @uses $wpdb
@@ -703,6 +709,7 @@ function get_post_custom($post_id = 0) {
  * @package WordPress
  * @subpackage Post
  * @since 1.2
+ * @link http://codex.wordpress.org/Function_Reference/get_post_custom_keys
  *
  * @param int $post_id post ID
  * @return array|null Either array of the keys, or null if keys would not be retrieved
@@ -717,13 +724,37 @@ function get_post_custom_keys( $post_id = 0 ) {
                return $keys;
 }
 
-
+/**
+ * get_post_custom_values() - Retrieve values for a custom post field
+ *
+ * @package WordPress
+ * @subpackage Post
+ * @since 1.2
+ * @link http://codex.wordpress.org/Function_Reference/get_post_custom_values
+ *
+ * @param string $key field name
+ * @param int $post_id post ID
+ * @return mixed {@internal Missing Description}}
+ */
 function get_post_custom_values( $key = '', $post_id = 0 ) {
        $custom = get_post_custom($post_id);
 
        return $custom[$key];
 }
 
+/**
+ * sanitize_post() - Sanitize every post field
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @package WordPress
+ * @subpackage Post
+ * @since 2.3
+ *
+ * @param object|array $post The Post Object or Array
+ * @param string $context How to sanitize post fields
+ * @return object|array The now sanitized Post Object or Array (will be the same type as $post)
+ */
 function sanitize_post($post, $context = 'display') {
        if ( 'raw' == $context )
                return $post;
@@ -810,16 +841,24 @@ function sanitize_post_field($field, $value, $post_id, $context) {
 }
 
 /**
- * wp_count_posts() - Count number of posts with a given type
+ * Count number of posts of a post type and is user has permissions to view.
  *
- * {@internal Missing Long Description}}
+ * This function provides an efficient method of finding the amount of post's
+ * type a blog has. Another method is to count the amount of items in
+ * get_posts(), but that method has a lot of overhead with doing so. Therefore,
+ * when developing for 2.5+, use this function instead.
+ *
+ * The $perm parameter checks for 'readable' value and if the user can read
+ * private posts, it will display that for the user that is signed in.
  *
  * @package WordPress
  * @subpackage Post
  * @since 2.5
+ * @link http://codex.wordpress.org/Template_Tags/wp_count_posts
  *
- * @param string $type Post type
- * @return array Number of posts for each status
+ * @param string $type Optional. Post type to retrieve count
+ * @param string $perm Optional. 'readable' or empty.
+ * @return object Number of posts for each status
  */
 function wp_count_posts( $type = 'post', $perm = '' ) {
        global $wpdb;
@@ -973,7 +1012,7 @@ function wp_post_mime_type_where($post_mime_types) {
  *
  * @package WordPress
  * @subpackage Post
- * @since 1.0.1
+ * @since 1.0.0
  *
  * @param int $postid post ID
  * @return mixed {@internal Missing Description}}
@@ -1013,6 +1052,12 @@ function wp_delete_post($postid = 0) {
                $wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => 'page' ) );
        }
 
+       // Do raw query.  wp_get_post_revisions() is filtered
+       $revision_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'revision'", $postid ) );
+       // Use wp_delete_post (via wp_delete_post_revision) again.  Ensures any meta/misplaced data gets cleaned up.
+       foreach ( $revision_ids as $revision_id )
+               wp_delete_post_revision( $revision_id );
+
        // Point all attachments to this post up one level
        $wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => 'attachment' ) );
 
@@ -1095,7 +1140,7 @@ function wp_get_post_tags( $post_id = 0, $args = array() ) {
  *
  * @package WordPress
  * @subpackage Post
- * @since 1.0.1
+ * @since 1.0.0
  *
  * @param int $num number of posts to get
  * @return array {@internal Missing Description}}
@@ -1122,7 +1167,7 @@ function wp_get_recent_posts($num = 10) {
  *
  * @package WordPress
  * @subpackage Post
- * @since 1.0.1
+ * @since 1.0.0
  * @uses $wpdb
  *
  * @param int $postid post ID
@@ -1154,7 +1199,7 @@ function wp_get_single_post($postid = 0, $mode = OBJECT) {
  *
  * @package WordPress
  * @subpackage Post
- * @since 1.0.1
+ * @since 1.0.0
  *
  * @uses $wpdb
  * @uses $wp_rewrite
@@ -1164,7 +1209,7 @@ function wp_get_single_post($postid = 0, $mode = OBJECT) {
  * @param array $postarr post contents
  * @return int post ID or 0 on error
  */
-function wp_insert_post($postarr = array()) {
+function wp_insert_post($postarr = array(), $wp_error = false) {
        global $wpdb, $wp_rewrite, $user_ID;
 
        $defaults = array('post_status' => 'draft', 'post_type' => 'post', 'post_author' => $user_ID,
@@ -1187,8 +1232,12 @@ function wp_insert_post($postarr = array()) {
                $previous_status = 'new';
        }
 
-       if ( ('' == $post_content) && ('' == $post_title) && ('' == $post_excerpt) )
-               return 0;
+       if ( ('' == $post_content) && ('' == $post_title) && ('' == $post_excerpt) ) {
+               if ( $wp_error )
+                       return new WP_Error('empty_content', __('Content, title, and excerpt are empty.'));
+               else
+                       return 0;
+       }
 
        // Make sure we set a valid category
        if (0 == count($post_category) || !is_array($post_category)) {
@@ -1220,14 +1269,14 @@ function wp_insert_post($postarr = array()) {
        }
 
        // If the post date is empty (due to having been new or a draft) and status is not 'draft', set date to now
-       if (empty($post_date)) {
+       if ( empty($post_date) || '0000-00-00 00:00:00' == $post_date ) {
                if ( !in_array($post_status, array('draft', 'pending')) )
                        $post_date = current_time('mysql');
                else
                        $post_date = '0000-00-00 00:00:00';
        }
 
-       if (empty($post_date_gmt)) {
+       if ( empty($post_date_gmt) || '0000-00-00 00:00:00' == $post_date_gmt ) {
                if ( !in_array($post_status, array('draft', 'pending')) )
                        $post_date_gmt = get_gmt_from_date($post_date);
                else
@@ -1285,8 +1334,7 @@ function wp_insert_post($postarr = array()) {
                        $suffix = 2;
                        do {
                                $alt_post_name = substr($post_name, 0, 200-(strlen($suffix)+1)). "-$suffix";
-                               // expected_slashed ($alt_post_name, $post_name, $post_type)
-                               $post_name_check = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_name = '$alt_post_name' AND post_type = '$post_type' AND ID != %d AND post_parent = %d LIMIT 1", $post_ID, $post_parent));
+                               $post_name_check = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d AND post_parent = %d LIMIT 1", $alt_post_name, $post_type, $post_ID, $post_parent));
                                $suffix++;
                        } while ($post_name_check);
                        $post_name = $alt_post_name;
@@ -1300,10 +1348,20 @@ function wp_insert_post($postarr = array()) {
 
        if ($update) {
                do_action( 'pre_post_update', $post_ID );
-               $wpdb->update( $wpdb->posts, $data, $where );
+               if ( false === $wpdb->update( $wpdb->posts, $data, $where ) ) {
+                       if ( $wp_error )
+                               return new WP_Error('db_update_error', __('Could not update post in the database'), $wpdb->last_error);
+                       else
+                               return 0;
+               }
        } else {
                $data['post_mime_type'] = stripslashes( $post_mime_type ); // This isn't in the update
-               $wpdb->insert( $wpdb->posts, $data );
+               if ( false === $wpdb->insert( $wpdb->posts, $data ) ) {
+                       if ( $wp_error )
+                               return new WP_Error('db_insert_error', __('Could not insert post into the database'), $wpdb->last_error);
+                       else
+                               return 0;       
+               }
                $post_ID = (int) $wpdb->insert_id;
 
                // use the newly generated $post_ID
@@ -1320,19 +1378,28 @@ function wp_insert_post($postarr = array()) {
 
        $current_guid = get_post_field( 'guid', $post_ID );
 
-       if ( 'page' == $post_type ) {
+       if ( 'page' == $post_type )
                clean_page_cache($post_ID);
-       } else {
+       else
                clean_post_cache($post_ID);
-       }
 
        // Set GUID
        if ( !$update && '' == $current_guid )
                $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post_ID ) ), $where );
 
        $post = get_post($post_ID);
-       if ( !empty($page_template) )
+
+       if ( !empty($page_template) && 'page' == $post_type ) {
                $post->page_template = $page_template;
+               $page_templates = get_page_templates();
+               if ( 'default' != $page_template && !in_array($page_template, $page_templates) ) {
+                       if ( $wp_error )
+                               return new WP_Error('invalid_page_template', __('The page template is invalid.'));
+                       else
+                               return 0;
+               }
+               update_post_meta($post_ID, '_wp_page_template',  $page_template);
+       }
 
        wp_transition_post_status($post_status, $previous_status, $post);
 
@@ -1352,7 +1419,7 @@ function wp_insert_post($postarr = array()) {
  *
  * @package WordPress
  * @subpackage Post
- * @since 1.0.1
+ * @since 1.0.0
  * @uses $wpdb
  *
  * @param array $postarr post data
@@ -1465,12 +1532,39 @@ function check_and_publish_future_post($post_id) {
        return wp_publish_post($post_id);
 }
 
+/**
+ * wp_add_post_tags() - Adds the tags to a post
+ *
+ * @uses wp_set_post_tags() Same first two paraeters, but the last parameter is always set to true.
+ *
+ * @package WordPress
+ * @subpackage Post
+ * @since 2.3
+ *
+ * @param int $post_id Optional. Post ID
+ * @param string $tags The tags to set for the post
+ * @return bool|null Will return false if $post_id is not an integer or is 0. Will return null otherwise
+ */
 function wp_add_post_tags($post_id = 0, $tags = '') {
        return wp_set_post_tags($post_id, $tags, true);
 }
 
+/**
+ * wp_set_post_tags() - Set the tags for a post
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @package WordPress
+ * @subpackage Post
+ * @since 2.3
+ * @uses $wpdb
+ *
+ * @param int $post_id post ID
+ * @param string $tags The tags to set for the post
+ * @param bool $append If true, don't delete existing tags, just add on. If false, replace the tags with the new tags.
+ * @return bool|null Will return false if $post_id is not an integer or is 0. Will return null otherwise
+ */
 function wp_set_post_tags( $post_id = 0, $tags = '', $append = false ) {
-       /* $append - true = don't delete existing tags, just add on, false = replace the tags with the new tags */
 
        $post_id = (int) $post_id;
 
@@ -1563,7 +1657,20 @@ function add_ping($post_id, $uri) {
        return $wpdb->update( $wpdb->posts, array( 'pinged' => $new ), array( 'ID' => $post_id ) );
 }
 
-function get_enclosed($post_id) { // Get enclosures already enclosed for a post
+/**
+ * get_enclosed() - Get enclosures already enclosed for a post
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @package WordPress
+ * @subpackage Post
+ * @since 1.5
+ * @uses $wpdb
+ *
+ * @param int $post_id post ID
+ * @return array {@internal Missing Description}}
+ */
+function get_enclosed($post_id) {
        $custom_fields = get_post_custom( $post_id );
        $pung = array();
        if ( !is_array( $custom_fields ) )
@@ -1632,7 +1739,7 @@ function get_to_ping($post_id) {
  *
  * @package WordPress
  * @subpackage Post
- * @since 1.0.1
+ * @since 1.0.0
  *
  * @param string $tb_list comma separated list of URLs
  * @param int $post_id post ID
@@ -1845,7 +1952,7 @@ function get_page_hierarchy($posts, $parent = 0) {
  */
 function get_page_uri($page_id) {
        $page = get_page($page_id);
-       $uri = urldecode($page->post_name);
+       $uri = $page->post_name;
 
        // A page cannot be it's own parent.
        if ( $page->post_parent == $page->ID )
@@ -1853,7 +1960,7 @@ function get_page_uri($page_id) {
 
        while ($page->post_parent != 0) {
                $page = get_page($page->post_parent);
-               $uri = urldecode($page->post_name) . "/" . $uri;
+               $uri = $page->post_name . "/" . $uri;
        }
 
        return $uri;
@@ -1952,11 +2059,21 @@ function &get_pages($args = '') {
                }
        }
 
-       $query = "SELECT * FROM $wpdb->posts " ;
-       $query .= ( empty( $meta_key ) ? "" : ", $wpdb->postmeta " ) ;
-       $query .= " WHERE (post_type = 'page' AND post_status = 'publish') $exclusions $inclusions " ;
-       // expected_slashed ($meta_key, $meta_value) -- also, it looks funky
-       $query .= ( empty( $meta_key ) | empty($meta_value)  ? "" : " AND ($wpdb->posts.ID = $wpdb->postmeta.post_id AND $wpdb->postmeta.meta_key = '$meta_key' AND $wpdb->postmeta.meta_value = '$meta_value' )" ) ;
+       $join = '';
+       $where = "$exclusions $inclusions ";
+       if ( ! empty( $meta_key ) || ! empty( $meta_value ) ) {
+               $join = " LEFT JOIN $wpdb->postmeta ON ( $wpdb->posts.ID = $wpdb->postmeta.post_id )";
+               
+               // meta_key and met_value might be slashed 
+               $meta_key = stripslashes($meta_key);
+               $meta_value = stripslashes($meta_value);
+               if ( ! empty( $meta_key ) )
+                       $where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_key = %s", $meta_key);
+               if ( ! empty( $meta_value ) )
+                       $where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_value = %s", $meta_value);
+
+       }
+       $query = "SELECT * FROM $wpdb->posts $join WHERE (post_type = 'page' AND post_status = 'publish') $where ";
        $query .= $author_query;
        $query .= " ORDER BY " . $sort_column . " " . $sort_order ;
 
@@ -2258,14 +2375,9 @@ function wp_update_attachment_metadata( $post_id, $data ) {
        if ( !$post =& get_post( $post_id ) )
                return false;
 
-       $old_data = wp_get_attachment_metadata( $post->ID, true );
-
        $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID );
 
-       if ( $old_data )
-               return update_post_meta( $post->ID, '_wp_attachment_metadata', $data, $old_data );
-       else
-               return add_post_meta( $post->ID, '_wp_attachment_metadata', $data );
+       return update_post_meta( $post->ID, '_wp_attachment_metadata', $data);
 }
 
 /**
@@ -2309,7 +2421,7 @@ function wp_get_attachment_thumb_file( $post_id = 0 ) {
        $post_id = (int) $post_id;
        if ( !$post =& get_post( $post_id ) )
                return false;
-       if ( !$imagedata = wp_get_attachment_metadata( $post->ID ) )
+       if ( !is_array( $imagedata = wp_get_attachment_metadata( $post->ID ) ) )
                return false;
 
        $file = get_attached_file( $post->ID );
@@ -2419,7 +2531,7 @@ function wp_mime_type_icon( $mime = 0 ) {
 
                if ( !is_array($icon_files) ) {
                        $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/crystal' );
-                       $icon_dir_uri = apply_filters( 'icon_dir_uri', trailingslashit(get_option('siteurl')) . WPINC . '/images/crystal' );
+                       $icon_dir_uri = apply_filters( 'icon_dir_uri', includes_url('images/crystal') );
                        $dirs = apply_filters( 'icon_dirs', array($icon_dir => $icon_dir_uri) );
                        $icon_files = array();
                        while ( $dirs ) {
@@ -2943,10 +3055,6 @@ function _publish_post_hook($post_id) {
  */
 function _save_post_hook($post_id, $post) {
        if ( $post->post_type == 'page' ) {
-               if ( !empty($post->page_template) )
-                       if ( ! update_post_meta($post_id, '_wp_page_template',  $post->page_template))
-                               add_post_meta($post_id, '_wp_page_template',  $post->page_template, true);
-
                clean_page_cache($post_id);
                global $wp_rewrite;
                $wp_rewrite->flush_rules();
@@ -2978,4 +3086,353 @@ function _get_post_ancestors(&$_post) {
        }
 }
 
-?>
+/* Post Revisions */
+
+/**
+ * _wp_post_revision_fields() - determines which fields of posts are to be saved in revisions
+ *
+ * Does two things. If passed a post *array*, it will return a post array ready to be
+ * insterted into the posts table as a post revision.
+ * Otherwise, returns an array whose keys are the post fields to be saved for post revisions.
+ *
+ * @package WordPress
+ * @subpackage Post Revisions
+ * @since 2.6
+ *
+ * @param array $post optional a post array to be processed for insertion as a post revision
+ * @param bool $autosave optional Is the revision an autosave?
+ * @return array post array ready to be inserted as a post revision or array of fields that can be versioned
+ */
+function _wp_post_revision_fields( $post = null, $autosave = false ) {
+       static $fields = false;
+
+       if ( !$fields ) {
+               // Allow these to be versioned
+               $fields = array(
+                       'post_title' => __( 'Title' ),
+                       'post_content' => __( 'Content' ),
+                       'post_excerpt' => __( 'Excerpt' ),
+               );
+
+               // Runs only once
+               $fields = apply_filters( '_wp_post_revision_fields', $fields );
+
+               // WP uses these internally either in versioning or elsewhere - they cannot be versioned
+               foreach ( array( 'ID', 'post_name', 'post_parent', 'post_date', 'post_date_gmt', 'post_status', 'post_type', 'comment_count', 'post_author' ) as $protect )
+                       unset( $fields[$protect] );
+       }
+
+       if ( !is_array($post) )
+               return $fields;
+
+       $return = array();
+       foreach ( array_intersect( array_keys( $post ), array_keys( $fields ) ) as $field )
+               $return[$field] = $post[$field];
+
+       $return['post_parent']   = $post['ID'];
+       $return['post_status']   = 'inherit';
+       $return['post_type']     = 'revision';
+       $return['post_name']     = $autosave ? "$post[ID]-autosave" : "$post[ID]-revision";
+       $return['post_date']     = $post['post_modified'];
+       $return['post_date_gmt'] = $post['post_modified_gmt'];
+
+       return $return;
+}
+
+/**
+ * wp_save_post_revision() - Saves an already existing post as a post revision.  Typically used immediately prior to post updates.
+ *
+ * @package WordPress
+ * @subpackage Post Revisions
+ * @since 2.6
+ *
+ * @uses _wp_put_post_revision()
+ *
+ * @param int $post_id The ID of the post to save as a revision
+ * @return mixed null or 0 if error, new revision ID if success
+ */
+function wp_save_post_revision( $post_id ) {
+       // We do autosaves manually with wp_create_post_autosave()
+       if ( @constant( 'DOING_AUTOSAVE' ) )
+               return;
+
+       // WP_POST_REVISIONS = 0, false
+       if ( !constant('WP_POST_REVISIONS') )
+               return;
+
+       if ( !$post = get_post( $post_id, ARRAY_A ) )
+               return;
+
+       if ( !in_array( $post['post_type'], array( 'post', 'page' ) ) )
+               return;
+
+       $return = _wp_put_post_revision( $post );
+
+       // WP_POST_REVISIONS = true (default), -1
+       if ( !is_numeric( WP_POST_REVISIONS ) || WP_POST_REVISIONS < 0 )
+               return $return;
+
+       // all revisions and (possibly) one autosave
+       $revisions = wp_get_post_revisions( $post_id, array( 'order' => 'ASC' ) );
+
+       // WP_POST_REVISIONS = (int) (# of autasaves to save)
+       $delete = count($revisions) - WP_POST_REVISIONS;
+
+       if ( $delete < 1 )
+               return $return;
+
+       $revisions = array_slice( $revisions, 0, $delete );
+
+       for ( $i = 0; isset($revisions[$i]); $i++ ) {
+               if ( false !== strpos( $revisions[$i]->post_name, 'autosave' ) )
+                       continue;
+               wp_delete_post_revision( $revisions[$i]->ID );
+       }
+
+       return $return;
+}
+
+/**
+ * wp_get_post_autosave() - returns the autosaved data of the specified post.
+ *
+ * Returns a post object containing the information that was autosaved for the specified post.
+ *
+ * @package WordPress
+ * @subpackage Post Revisions
+ * @since 2.6
+ *
+ * @param int $post_id The post ID
+ * @return object|bool the autosaved data or false on failure or when no autosave exists
+ */
+function wp_get_post_autosave( $post_id ) {
+       global $wpdb;
+       if ( !$post = get_post( $post_id ) )
+               return false;
+
+       $q = array(
+               'name' => "{$post->ID}-autosave",
+               'post_parent' => $post->ID,
+               'post_type' => 'revision',
+               'post_status' => 'inherit'
+       );
+
+       // Use WP_Query so that the result gets cached
+       $autosave_query = new WP_Query;
+
+       add_action( 'parse_query', '_wp_get_post_autosave_hack' );
+       $autosave = $autosave_query->query( $q );
+       remove_action( 'parse_query', '_wp_get_post_autosave_hack' );
+
+       if ( $autosave && is_array($autosave) && is_object($autosave[0]) )
+               return $autosave[0];
+
+       return false;
+}
+
+// Internally used to hack WP_Query into submission
+function _wp_get_post_autosave_hack( $query ) {
+       $query->is_single = false;
+}
+
+
+/**
+ * wp_is_post_revision() - Determines if the specified post is a revision.
+ *
+ * @package WordPress
+ * @subpackage Post Revisions
+ * @since 2.6
+ *
+ * @param int|object $post post ID or post object
+ * @return bool|int false if not a revision, ID of revision's parent otherwise
+ */
+function wp_is_post_revision( $post ) {
+       if ( !$post = wp_get_post_revision( $post ) )
+               return false;
+       return (int) $post->post_parent;
+}
+
+/**
+ * wp_is_post_autosave() - Determines if the specified post is an autosave.
+ *
+ * @package WordPress
+ * @subpackage Post Revisions
+ * @since 2.6
+ *
+ * @param int|object $post post ID or post object
+ * @return bool|int false if not a revision, ID of autosave's parent otherwise
+ */
+function wp_is_post_autosave( $post ) {
+       if ( !$post = wp_get_post_revision( $post ) )
+               return false;
+       if ( "{$post->post_parent}-autosave" !== $post->post_name )
+               return false;
+       return (int) $post->post_parent;
+}
+
+/**
+ * _wp_put_post_revision() - Inserts post data into the posts table as a post revision
+ *
+ * @package WordPress
+ * @subpackage Post Revisions
+ * @since 2.6
+ *
+ * @uses wp_insert_post()
+ *
+ * @param int|object|array $post post ID, post object OR post array
+ * @param bool $autosave optional Is the revision an autosave?
+ * @return mixed null or 0 if error, new revision ID if success
+ */
+function _wp_put_post_revision( $post = null, $autosave = false ) {
+       if ( is_object($post) )
+               $post = get_object_vars( $post );
+       elseif ( !is_array($post) )
+               $post = get_post($post, ARRAY_A);
+       if ( !$post || empty($post['ID']) )
+               return;
+
+       if ( isset($post['post_type']) && 'revision' == $post['post_type'] )
+               return new WP_Error( 'post_type', __( 'Cannot create a revision of a revision' ) );
+
+       $post = _wp_post_revision_fields( $post, $autosave );
+
+       $revision_id = wp_insert_post( $post );
+       if ( is_wp_error($revision_id) )
+               return $revision_id;
+
+       if ( $revision_id )
+               do_action( '_wp_put_post_revision', $revision_id );
+       return $revision_id;
+}
+
+/**
+ * wp_get_post_revision() - Gets a post revision
+ *
+ * @package WordPress
+ * @subpackage Post Revisions
+ * @since 2.6
+ *
+ * @uses get_post()
+ *
+ * @param int|object $post post ID or post object
+ * @param $output optional OBJECT, ARRAY_A, or ARRAY_N
+ * @param string $filter optional sanitation filter.  @see sanitize_post()
+ * @return mixed null if error or post object if success
+ */
+function &wp_get_post_revision(&$post, $output = OBJECT, $filter = 'raw') {
+       $null = null;
+       if ( !$revision = get_post( $post, OBJECT, $filter ) )
+               return $revision;
+       if ( 'revision' !== $revision->post_type )
+               return $null;
+
+       if ( $output == OBJECT ) {
+               return $revision;
+       } elseif ( $output == ARRAY_A ) {
+               $_revision = get_object_vars($revision);
+               return $_revision;
+       } elseif ( $output == ARRAY_N ) {
+               $_revision = array_values(get_object_vars($revision));
+               return $_revision;
+       }
+
+       return $revision;
+}
+
+/**
+ * wp_restore_post_revision() - Restores a post to the specified revision
+ *
+ * Can restore a past using all fields of the post revision, or only selected fields.
+ *
+ * @package WordPress
+ * @subpackage Post Revisions
+ * @since 2.6
+ *
+ * @uses wp_get_post_revision()
+ * @uses wp_update_post()
+ *
+ * @param int|object $revision_id revision ID or revision object
+ * @param array $fields optional What fields to restore from.  Defaults to all.
+ * @return mixed null if error, false if no fields to restore, (int) post ID if success
+ */
+function wp_restore_post_revision( $revision_id, $fields = null ) {
+       if ( !$revision = wp_get_post_revision( $revision_id, ARRAY_A ) )
+               return $revision;
+
+       if ( !is_array( $fields ) )
+               $fields = array_keys( _wp_post_revision_fields() );
+
+       $update = array();
+       foreach( array_intersect( array_keys( $revision ), $fields ) as $field )
+               $update[$field] = $revision[$field];
+
+       if ( !$update )
+               return false;
+
+       $update['ID'] = $revision['post_parent'];
+
+       $post_id = wp_update_post( $update );
+       if ( is_wp_error( $post_id ) )
+               return $post_id;
+
+       if ( $post_id )
+               do_action( 'wp_restore_post_revision', $post_id, $revision['ID'] );
+
+       return $post_id;
+}
+
+/**
+ * wp_delete_post_revision() - Deletes a revision.
+ *
+ * Deletes the row from the posts table corresponding to the specified revision
+ *
+ * @package WordPress
+ * @subpackage Post Revisions
+ * @since 2.6
+ *
+ * @uses wp_get_post_revision()
+ * @uses wp_delete_post()
+ *
+ * @param int|object $revision_id revision ID or revision object
+ * @param array $fields optional What fields to restore from.  Defaults to all.
+ * @return mixed null if error, false if no fields to restore, (int) post ID if success
+ */
+function wp_delete_post_revision( $revision_id ) {
+       if ( !$revision = wp_get_post_revision( $revision_id ) )
+               return $revision;
+
+       $delete = wp_delete_post( $revision->ID );
+       if ( is_wp_error( $delete ) )
+               return $delete;
+
+       if ( $delete )
+               do_action( 'wp_delete_post_revision', $revision->ID, $revision );
+
+       return $delete;
+}
+
+/**
+ * wp_get_post_revisions() - Returns all revisions of specified post
+ *
+ * @package WordPress
+ * @subpackage Post Revisions
+ * @since 2.6
+ *
+ * @uses get_children()
+ *
+ * @param int|object $post_id post ID or post object
+ * @return array empty if no revisions
+ */
+function wp_get_post_revisions( $post_id = 0, $args = null ) {
+       if ( !constant('WP_POST_REVISIONS') )
+               return array();
+       if ( ( !$post = get_post( $post_id ) ) || empty( $post->ID ) )
+               return array();
+
+       $defaults = array( 'order' => 'DESC', 'orderby' => 'date' );
+       $args = wp_parse_args( $args, $defaults );
+       $args = array_merge( $args, array( 'post_parent' => $post->ID, 'post_type' => 'revision', 'post_status' => 'inherit' ) );
+
+       if ( !$revisions = get_children( $args ) )
+               return array();
+       return $revisions;
+}
index 8119f2cb5d01aa0dbf489e1e0a679194ce70a70d..40208f338d22056b5ee15837871869a42e0bf969 100644 (file)
@@ -453,6 +453,7 @@ class WP_Query {
                        'error'
                        , 'm'
                        , 'p'
+                       , 'post_parent'
                        , 'subpost'
                        , 'subpost_id'
                        , 'attachment'
@@ -477,6 +478,8 @@ class WP_Query {
                        , 'tb'
                        , 'paged'
                        , 'comments_popup'
+                       , 'meta_key'
+                       , 'meta_value'
                        , 'preview'
                );
 
@@ -485,7 +488,7 @@ class WP_Query {
                                $array[$key] = '';
                }
 
-               $array_keys = array('category__in', 'category__not_in', 'category__and',
+               $array_keys = 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');
 
                foreach ( $array_keys as $key ) {
@@ -512,17 +515,17 @@ class WP_Query {
                if ( ! empty($qv['robots']) )
                        $this->is_robots = true;
 
-               $qv['p'] =  (int) $qv['p'];
-               $qv['page_id'] =  (int) $qv['page_id'];
-               $qv['year'] = (int) $qv['year'];
-               $qv['monthnum'] = (int) $qv['monthnum'];
-               $qv['day'] = (int) $qv['day'];
-               $qv['w'] = (int) $qv['w'];
-               $qv['m'] =  (int) $qv['m'];
+               $qv['p'] =  absint($qv['p']);
+               $qv['page_id'] =  absint($qv['page_id']);
+               $qv['year'] = absint($qv['year']);
+               $qv['monthnum'] = absint($qv['monthnum']);
+               $qv['day'] = absint($qv['day']);
+               $qv['w'] = absint($qv['w']);
+               $qv['m'] = absint($qv['m']);
                $qv['cat'] = preg_replace( '|[^0-9,-]|', '', $qv['cat'] ); // comma separated list of positive or negative integers
-               if ( '' !== $qv['hour'] ) $qv['hour'] = (int) $qv['hour'];
-               if ( '' !== $qv['minute'] ) $qv['minute'] = (int) $qv['minute'];
-               if ( '' !== $qv['second'] ) $qv['second'] = (int) $qv['second'];
+               if ( '' !== $qv['hour'] ) $qv['hour'] = absint($qv['hour']);
+               if ( '' !== $qv['minute'] ) $qv['minute'] = absint($qv['minute']);
+               if ( '' !== $qv['second'] ) $qv['second'] = absint($qv['second']);
 
                // Compat.  Map subpost to attachment.
                if ( '' != $qv['subpost'] )
@@ -530,7 +533,7 @@ class WP_Query {
                if ( '' != $qv['subpost_id'] )
                        $qv['attachment_id'] = $qv['subpost_id'];
 
-               $qv['attachment_id'] = (int) $qv['attachment_id'];
+               $qv['attachment_id'] = absint($qv['attachment_id']);
 
                if ( ('' != $qv['attachment']) || !empty($qv['attachment_id']) ) {
                        $this->is_single = true;
@@ -621,47 +624,47 @@ class WP_Query {
                        if ( !is_array($qv['category__in']) || empty($qv['category__in']) ) {
                                $qv['category__in'] = array();
                        } else {
-                               $qv['category__in'] = array_map('intval', $qv['category__in']);
+                               $qv['category__in'] = array_map('absint', $qv['category__in']);
                                $this->is_category = true;
                        }
 
                        if ( !is_array($qv['category__not_in']) || empty($qv['category__not_in']) ) {
                                $qv['category__not_in'] = array();
                        } else {
-                               $qv['category__not_in'] = array_map('intval', $qv['category__not_in']);
+                               $qv['category__not_in'] = array_map('absint', $qv['category__not_in']);
                        }
 
                        if ( !is_array($qv['category__and']) || empty($qv['category__and']) ) {
                                $qv['category__and'] = array();
                        } else {
-                               $qv['category__and'] = array_map('intval', $qv['category__and']);
+                               $qv['category__and'] = array_map('absint', $qv['category__and']);
                                $this->is_category = true;
                        }
 
                        if (  '' != $qv['tag'] )
                                $this->is_tag = true;
 
-                       $qv['tag_id'] = (int) $qv['tag_id'];
+                       $qv['tag_id'] = absint($qv['tag_id']);
                        if (  !empty($qv['tag_id']) )
                                $this->is_tag = true;
 
                        if ( !is_array($qv['tag__in']) || empty($qv['tag__in']) ) {
                                $qv['tag__in'] = array();
                        } else {
-                               $qv['tag__in'] = array_map('intval', $qv['tag__in']);
+                               $qv['tag__in'] = array_map('absint', $qv['tag__in']);
                                $this->is_tag = true;
                        }
 
                        if ( !is_array($qv['tag__not_in']) || empty($qv['tag__not_in']) ) {
                                $qv['tag__not_in'] = array();
                        } else {
-                               $qv['tag__not_in'] = array_map('intval', $qv['tag__not_in']);
+                               $qv['tag__not_in'] = array_map('absint', $qv['tag__not_in']);
                        }
 
                        if ( !is_array($qv['tag__and']) || empty($qv['tag__and']) ) {
                                $qv['tag__and'] = array();
                        } else {
-                               $qv['tag__and'] = array_map('intval', $qv['tag__and']);
+                               $qv['tag__and'] = array_map('absint', $qv['tag__and']);
                                $this->is_category = true;
                        }
 
@@ -770,9 +773,9 @@ class WP_Query {
                        $qv['post_type'] = sanitize_user($qv['post_type'], true);
 
                if ( !empty($qv['post_status']) )
-                       $qv['post_status'] = sanitize_user($qv['post_status'], true);
+                       $qv['post_status'] = preg_replace('|[^a-z0-9_,-]|', '', $qv['post_status']);
 
-               if ( $this->is_posts_page && !$qv['withcomments'] )
+               if ( $this->is_posts_page && ( ! isset($qv['withcomments']) || ! $qv['withcomments'] ) )
                        $this->is_comment_feed = false;
 
                $this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;
@@ -826,7 +829,12 @@ class WP_Query {
                $join = '';
                $search = '';
                $groupby = '';
+               $fields = "$wpdb->posts.*";
                $post_status_join = false;
+               $page = 1;
+
+               if ( !isset($q['suppress_filters']) )
+                       $q['suppress_filters'] = false;
 
                if ( !isset($q['post_type']) ) {
                        if ( $this->is_search )
@@ -868,8 +876,7 @@ class WP_Query {
 
                if (isset($q['page'])) {
                        $q['page'] = trim($q['page'], '/');
-                       $q['page'] = (int) $q['page'];
-                       $q['page'] = abs($q['page']);
+                       $q['page'] = absint($q['page']);
                }
 
                // If a month is specified in the querystring, load that month
@@ -920,12 +927,13 @@ class WP_Query {
                                        $reqpage = 0;
                        }
 
-                       if  ( ('page' != get_option('show_on_front') ) || ( $reqpage != get_option('page_for_posts') ) ) {
+                       $page_for_posts = get_option('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));
                                $q['name'] = $q['pagename'];
-                               $where .= " AND (ID = '$reqpage')";
+                               $where .= " AND ($wpdb->posts.ID = '$reqpage')";
                                $reqpage_obj = get_page($reqpage);
                                if ( 'attachment' == $reqpage_obj->post_type ) {
                                        $this->is_attachment = true;
@@ -945,15 +953,25 @@ class WP_Query {
                        $where .= " AND WEEK($wpdb->posts.post_date, 1)='" . $q['w'] . "'";
 
                if ( intval($q['comments_popup']) )
-                       $q['p'] = intval($q['comments_popup']);
+                       $q['p'] = absint($q['comments_popup']);
 
                // If an attachment is requested by number, let it supercede any post number.
                if ( $q['attachment_id'] )
-                       $q['p'] = $q['attachment_id'];
+                       $q['p'] = absint($q['attachment_id']);
 
                // If a post number is specified, load that post
-               if ( $q['p'] )
-                       $where = " AND {$wpdb->posts}.ID = " . $q['p'];
+               if ( $q['p'] ) {
+                       $where .= " AND {$wpdb->posts}.ID = " . $q['p'];
+               } elseif ( $q['post__in'] ) {
+                       $post__in = implode(',', array_map( 'absint', $q['post__in'] ));
+                       $where .= " AND {$wpdb->posts}.ID IN ($post__in)";
+               } elseif ( $q['post__not_in'] ) {
+                       $post__not_in = implode(',',  array_map( 'absint', $q['post__not_in'] ));
+                       $where .= " AND {$wpdb->posts}.ID NOT IN ($post__not_in)";
+               }
+
+               if ( $q['post_parent'] )
+                       $where .= $wpdb->prepare( " AND $wpdb->posts.post_parent = %d ", $q['post_parent'] );
 
                if ( $q['page_id'] ) {
                        if  ( ('page' != get_option('show_on_front') ) || ( $q['page_id'] != get_option('page_for_posts') ) ) {
@@ -1110,9 +1128,9 @@ class WP_Query {
                        $whichcat .= " AND $wpdb->term_taxonomy.taxonomy = 'post_tag' ";
                        $include_tags = "'" . implode("', '", $q['tag_slug__in']) . "'";
                        $whichcat .= " AND $wpdb->terms.slug IN ($include_tags) ";
-                       $reqtag = is_term( $q['tag_slug__in'][0], 'post_tag' );
+                       $reqtag = get_term_by( 'slug', $q['tag_slug__in'][0], 'post_tag' );
                        if ( !empty($reqtag) )
-                               $q['tag_id'] = $reqtag['term_id'];
+                               $q['tag_id'] = $reqtag->term_id;
                }
 
                if ( !empty($q['tag__not_in']) ) {
@@ -1194,15 +1212,15 @@ class WP_Query {
                                $eq = '!=';
                                $andor = 'AND';
                                $q['author'] = explode('-', $q['author']);
-                               $q['author'] = ''.intval($q['author'][1]);
+                               $q['author'] = '' . absint($q['author'][1]);
                        } else {
                                $eq = '=';
                                $andor = 'OR';
                        }
                        $author_array = preg_split('/[,\s]+/', $q['author']);
-                       $whichauthor .= " AND ($wpdb->posts.post_author ".$eq.' '.intval($author_array[0]);
+                       $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.' '.intval($author_array[$i]);
+                               $whichauthor .= ' '.$andor." $wpdb->posts.post_author ".$eq.' '.absint($author_array[$i]);
                        }
                        $whichauthor .= ')';
                }
@@ -1220,7 +1238,7 @@ class WP_Query {
                        }
                        $q['author_name'] = sanitize_title($q['author_name']);
                        $q['author'] = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_nicename='".$q['author_name']."'");
-                       $whichauthor .= " AND ($wpdb->posts.post_author = ".intval($q['author']).')';
+                       $whichauthor .= " AND ($wpdb->posts.post_author = ".absint($q['author']).')';
                }
 
                // MIME-Type stuff for attachment browsing
@@ -1338,10 +1356,20 @@ class WP_Query {
                        $where .= ')';
                }
 
+               // postmeta queries
+               if ( ! empty($q['meta_key']) || ! empty($q['meta_value']) )
+                       $join .= " LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) ";
+               if ( ! empty($q['meta_key']) ) 
+                       $where .= $wpdb->prepare("AND $wpdb->postmeta.meta_key = %s ", $q['meta_key']);
+               if ( ! empty($q['meta_value']) )
+                       $where .= $wpdb->prepare("AND $wpdb->postmeta.meta_value = %s ", $q['meta_value']);
+
                // Apply filters on where and join prior to paging so that any
                // manipulations to them are reflected in the paging by day queries.
-               $where = apply_filters('posts_where', $where);
-               $join = apply_filters('posts_join', $join);
+               if ( !$q['suppress_filters'] ) {
+                       $where = apply_filters('posts_where', $where);
+                       $join = apply_filters('posts_join', $join);
+               }
 
                // Paging
                if ( empty($q['nopaging']) && !$this->is_singular ) {
@@ -1352,7 +1380,7 @@ class WP_Query {
 
                        if ( empty($q['offset']) ) {
                                $pgstrt = '';
-                               $pgstrt = (intval($page) -1) * $q['posts_per_page'] . ', ';
+                               $pgstrt = ($page - 1) * $q['posts_per_page'] . ', ';
                                $limits = 'LIMIT '.$pgstrt.$q['posts_per_page'];
                        } else { // we're ignoring $page and using 'offset'
                                $q['offset'] = absint($q['offset']);
@@ -1373,9 +1401,11 @@ class WP_Query {
                                $cgroupby = '';
                        }
 
-                       $cjoin = apply_filters('comment_feed_join', $cjoin);
-                       $cwhere = apply_filters('comment_feed_where', $cwhere);
-                       $cgroupby = apply_filters('comment_feed_groupby', $cgroupby);
+                       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);
+                       }
 
                        $this->comments = (array) $wpdb->get_results("SELECT $distinct $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby ORDER BY comment_date_gmt DESC LIMIT " . get_option('posts_per_rss'));
                        $this->comment_count = count($this->comments);
@@ -1393,28 +1423,33 @@ class WP_Query {
                                $where = "AND 0";
                }
 
+               $orderby = $q['orderby'];
+
                // Apply post-paging filters on where and join.  Only plugins that
                // manipulate paging queries should use these hooks.
-
-               $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', $q['orderby']);
-               $distinct = apply_filters('posts_distinct', $distinct);
-               $fields = apply_filters('posts_fields', "$wpdb->posts.*");
-               $limits = apply_filters( 'post_limits', $limits );
+               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);
+                       $fields = apply_filters('posts_fields', $fields);
+                       $limits = apply_filters( 'post_limits', $limits );
+               }
 
                // Announce current selection parameters.  For use by caching plugins.
                do_action( 'posts_selection', $where . $groupby . $orderby . $limits . $join );
 
                // Filter again for the benefit of caching plugins.  Regular plugins should use the hooks above.
-               $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 );
+               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 );
+               }
 
                if ( ! empty($groupby) )
                        $groupby = 'GROUP BY ' . $groupby;
@@ -1424,12 +1459,14 @@ class WP_Query {
                if ( !empty($limits) )
                        $found_rows = 'SQL_CALC_FOUND_ROWS';
 
-               $request = " SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits";
-               $this->request = apply_filters('posts_request', $request);
+               $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->posts = $wpdb->get_results($this->request);
                // Raw results filter.  Prior to status checks.
-               $this->posts = apply_filters('posts_results', $this->posts);
+               if ( !$q['suppress_filters'] )
+                       $this->posts = apply_filters('posts_results', $this->posts);
 
                if ( !empty($this->posts) && $this->is_comment_feed && $this->is_singular ) {
                        $cjoin = apply_filters('comment_feed_join', '');
@@ -1476,7 +1513,8 @@ class WP_Query {
                        }
                }
 
-               $this->posts = apply_filters('the_posts', $this->posts);
+               if ( !$q['suppress_filters'] )
+                       $this->posts = apply_filters('the_posts', $this->posts);
 
                update_post_caches($this->posts);
 
@@ -1509,7 +1547,7 @@ class WP_Query {
        function have_posts() {
                if ($this->current_post + 1 < $this->post_count) {
                        return true;
-               } elseif ($this->current_post + 1 == $this->post_count) {
+               } elseif ($this->current_post + 1 == $this->post_count && $this->post_count > 0) {
                        do_action('loop_end');
                        // Do some cleaning up after the loop
                        $this->rewind_posts();
@@ -1589,8 +1627,9 @@ class WP_Query {
                        $tax = $this->get('taxonomy');
                        $slug = $this->get('term');
                        $term = &get_terms($tax, array('slug'=>$slug));
-                       if ( is_wp_error($term) )
+                       if ( is_wp_error($term) || empty($term) )
                                return $term;
+                       $term = $term[0];
                        $this->queried_object = $term;
                        $this->queried_object_id = $term->term_id;
                } else if ($this->is_posts_page) {
index 22294974c2551a0bf2c5f95ed8fe4b207cc2044c..15247d8031eef436e62f6e090dde657c92f2dc97 100644 (file)
@@ -31,7 +31,8 @@ function add_feed($feedname, $function) {
                $wp_rewrite->feeds[] = $feedname;
        }
        $hook = 'do_feed_' . $feedname;
-       remove_action($hook, $function, 10, 1);
+       // Remove default function hook
+       remove_action($hook, $hook, 10, 1);
        add_action($hook, $function, 10, 1);
        return $hook;
 }
@@ -59,6 +60,20 @@ function add_rewrite_endpoint($name, $places) {
        $wp_rewrite->add_endpoint($name, $places);
 }
 
+/**
+  * _wp_filter_taxonomy_base() - filter the URL base for taxonomies, to remove any manually prepended /index.php/
+  * @param string $base the taxonomy base that we're going to filter
+  * @return string
+  * @author Mark Jaquith 
+  */
+function _wp_filter_taxonomy_base( $base ) {
+       if ( !empty( $base ) ) {
+               $base = preg_replace( '|^/index\.php/|', '', $base );
+               $base = trim( $base, '/' );
+       }
+       return $base;
+}
+
 // examine a url (supposedly from this blog) and try to
 // determine the post ID it represents.
 function url_to_postid($url) {
@@ -137,7 +152,7 @@ function url_to_postid($url) {
                        $query = preg_replace("!^.+\?!", '', $query);
 
                        // Substitute the substring matches into the query.
-                       eval("\$query = \"$query\";");
+                       eval("\$query = \"" . addslashes($query) . "\";");
                        // Filter out non-public query vars
                        global $wp;
                        parse_str($query, $query_vars);
@@ -432,9 +447,9 @@ class WP_Rewrite {
                }
 
                if (empty($this->category_base))
-                       $this->category_structure = $this->front . 'category/';
+                       $this->category_structure = trailingslashit( $this->front . 'category' );
                else
-                       $this->category_structure = $this->category_base . '/';
+                       $this->category_structure = trailingslashit( '/' . $this->root . $this->category_base );
 
                $this->category_structure .= '%category%';
 
@@ -452,9 +467,9 @@ class WP_Rewrite {
                }
 
                if (empty($this->tag_base))
-                       $this->tag_structure = $this->front . 'tag/';
+                       $this->tag_structure = trailingslashit( $this->front . 'tag' );
                else
-                       $this->tag_structure = $this->tag_base . '/';
+                       $this->tag_structure = trailingslashit( '/' . $this->root . $this->tag_base );
 
                $this->tag_structure .= '%tag%';
 
@@ -793,12 +808,12 @@ class WP_Rewrite {
                $robots_rewrite = array('robots.txt$' => $this->index . '?robots=1');
 
                //Default Feed rules - These are require to allow for the direct access files to work with permalink structure starting with %category%
-               $default_feeds = array( '.*/wp-atom.php$'       =>      $this->index .'?feed=atom',
-                                                               '.*/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');
+               $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');
 
                // Post
                $post_rewrite = $this->generate_rewrite_rules($this->permalink_structure, EP_PERMALINK);
index f91aac545a4d30420b0203984ec3641411056876..15b0a8dd78e34bca2df38c9f5376a2714176693a 100644 (file)
@@ -651,11 +651,12 @@ function is_server_error ($sc) {
 }
 
 class RSSCache {
-       var $BASE_CACHE = 'wp-content/cache';   // where the cache files are stored
+       var $BASE_CACHE;        // where the cache files are stored
        var $MAX_AGE    = 43200;                // when are files stale, default twelve hours
        var $ERROR              = '';                   // accumulate error messages
 
        function RSSCache ($base='', $age='') {
+               $this->BASE_CACHE = WP_CONTENT_DIR . '/cache';
                if ( $base ) {
                        $this->BASE_CACHE = $base;
                }
index 4a6fc281fe73ca6ec47e13d8d591f734af2ee7b7..0d9f966d2dccc671dc9e74485b31d97a531072dc 100644 (file)
 <?php
-class WP_Scripts {
-       var $scripts = array();
-       var $queue = array();
-       var $to_print = array();
-       var $printed = array();
-       var $args = array();
-
-       function WP_Scripts() {
-               $this->default_scripts();
-       }
 
-       function default_scripts() {
-               $this->add( 'common', '/wp-admin/js/common.js', array('jquery'), '20080318' );
-               $this->add( 'sack', '/wp-includes/js/tw-sack.js', false, '1.6.1' );
-
-               $this->add( 'quicktags', '/wp-includes/js/quicktags.js', false, '3958' );
-               $this->localize( 'quicktags', 'quicktagsL10n', array(
-                       'quickLinks' => __('(Quick Links)'),
-                       'wordLookup' => __('Enter a word to look up:'),
-                       'dictionaryLookup' => attribute_escape(__('Dictionary lookup')),
-                       'lookup' => attribute_escape(__('lookup')),
-                       'closeAllOpenTags' => attribute_escape(__('Close all open tags')),
-                       'closeTags' => attribute_escape(__('close tags')),
-                       'enterURL' => __('Enter the URL'),
-                       'enterImageURL' => __('Enter the URL of the image'),
-                       'enterImageDescription' => __('Enter a description of the image')
-               ) );
+require( ABSPATH . WPINC . '/class.wp-dependencies.php' );
+require( ABSPATH . WPINC . '/class.wp-scripts.php' );
+require( ABSPATH . WPINC . '/functions.wp-scripts.php' );
+require( ABSPATH . WPINC . '/class.wp-styles.php' );
+require( ABSPATH . WPINC . '/functions.wp-styles.php' );
+
+function wp_default_scripts( &$scripts ) {
+       if (!$guessurl = site_url())
+               $guessurl = wp_guess_url();
+       $scripts->base_url = $guessurl;
+       $scripts->default_version = get_bloginfo( 'version' );
+
+       $scripts->add( 'common', '/wp-admin/js/common.js', array('jquery'), '20080318' );
+       $scripts->add( 'sack', '/wp-includes/js/tw-sack.js', false, '1.6.1' );
+
+       $scripts->add( 'quicktags', '/wp-includes/js/quicktags.js', false, '3958' );
+       $scripts->localize( 'quicktags', 'quicktagsL10n', array(
+               'quickLinks' => __('(Quick Links)'),
+               'wordLookup' => __('Enter a word to look up:'),
+               'dictionaryLookup' => attribute_escape(__('Dictionary lookup')),
+               'lookup' => attribute_escape(__('lookup')),
+               'closeAllOpenTags' => attribute_escape(__('Close all open tags')),
+               'closeTags' => attribute_escape(__('close tags')),
+               'enterURL' => __('Enter the URL'),
+               'enterImageURL' => __('Enter the URL of the image'),
+               'enterImageDescription' => __('Enter a description of the image')
+       ) );
 
-               $this->add( 'colorpicker', '/wp-includes/js/colorpicker.js', array('prototype'), '3517' );
+       $scripts->add( 'colorpicker', '/wp-includes/js/colorpicker.js', array('prototype'), '3517' );
 
-               // Let a plugin replace the visual editor
-               $visual_editor = apply_filters('visual_editor', array('tiny_mce'));
-               $this->add( 'editor', false, $visual_editor, '20080321' );
+       // Let a plugin replace the visual editor
+       $visual_editor = apply_filters('visual_editor', array('tiny_mce'));
+       $scripts->add( 'editor', false, $visual_editor, '20080321' );
 
-               $this->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080325' );
+       $scripts->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080710' );
 
-               // Modify this version when tinyMCE plugins are changed.
-               $mce_version = apply_filters('tiny_mce_version', '20080414');
-               $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('editor_functions'), $mce_version );
+       // Modify this version when tinyMCE plugins are changed.
+       $mce_version = apply_filters('tiny_mce_version', '20080810');
+       $scripts->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('editor_functions'), $mce_version );
 
-               $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6');
+       $scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6');
 
-               $this->add( 'wp-ajax-response', '/wp-includes/js/wp-ajax-response.js', array('jquery'), '20080316' );
-               $this->localize( 'wp-ajax-response', 'wpAjax', array(
-                       'noPerm' => __('You do not have permission to do that.'),
-                       'broken' => __('An unidentified error has occurred.')
-               ) );
+       $scripts->add( 'wp-ajax-response', '/wp-includes/js/wp-ajax-response.js', array('jquery'), '20080316' );
+       $scripts->localize( 'wp-ajax-response', 'wpAjax', array(
+               'noPerm' => __('You do not have permission to do that.'),
+               'broken' => __('An unidentified error has occurred.')
+       ) );
 
-               $this->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '20080424' );
+       $scripts->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '20080622' );
 
-               $this->add( 'wp-ajax', '/wp-includes/js/wp-ajax.js', array('prototype'), '20070306');
-               $this->localize( 'wp-ajax', 'WPAjaxL10n', array(
-                       'defaultUrl' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php',
-                       'permText' => __("You do not have permission to do that."),
-                       'strangeText' => __("Something strange happened.  Try refreshing the page."),
-                       'whoaText' => __("Slow down, I'm still sending your data!")
-               ) );
+       $scripts->add( 'wp-lists', '/wp-includes/js/wp-lists.js', array('wp-ajax-response'), '20080729' );
+       $scripts->localize( 'wp-lists', 'wpListL10n', array(
+               'url' => admin_url('admin-ajax.php')
+       ) );
 
-               $this->add( 'wp-lists', '/wp-includes/js/wp-lists.js', array('wp-ajax-response'), '20080411' );
-               $this->localize( 'wp-lists', 'wpListL10n', array(
-                       'url' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php'
-               ) );
+       $scripts->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/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( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop'), '20070118');
+
+       $scripts->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.2.6');
+       $scripts->add( 'jquery-form', '/wp-includes/js/jquery/jquery.form.js', array('jquery'), '2.02');
+       $scripts->add( 'jquery-color', '/wp-includes/js/jquery/jquery.color.js', array('jquery'), '2.0-4561');
+       $scripts->add( 'interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.2' );
+       $scripts->add( 'suggest', '/wp-includes/js/jquery/suggest.js', array('jquery'), '1.1b');
+       $scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array('jquery'), '20');
+       $scripts->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.js', array('jquery'), '3.1-20080430');
+       $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2.0.2-20080430');
+       $scripts->add( 'swfupload-degrade', '/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js', array('swfupload'), '2.0.2');
+       $scripts->localize( 'swfupload-degrade', 'uploadDegradeOptions', array(
+               'is_lighttpd_before_150' => is_lighttpd_before_150(),
+       ) );
+       $scripts->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2.0.2');
+       $scripts->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.0.2-20080407');
+       // 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. Your php.ini upload_max_filesize is %s.'), @ini_get('upload_max_filesize')),
+                       '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.'),
+                       'missing_upload_url' => __('There was a configuration error. Please contact the server administrator.'),
+                       'upload_limit_exceeded' => __('You may only upload 1 file.'),
+                       'http_error' => __('HTTP error.'),
+                       'upload_failed' => __('Upload failed.'),
+                       'io_error' => __('IO error.'),
+                       'security_error' => __('Security error.'),
+                       'file_cancelled' => __('File cancelled.'),
+                       'upload_stopped' => __('Upload stopped.'),
+                       'dismiss' => __('Dismiss'),
+                       'crunching' => __('Crunching&hellip;'),
+                       'deleted' => __('Deleted'),
+       ) );
+
+       $scripts->add( 'jquery-ui-core', '/wp-includes/js/jquery/ui.core.js', array('jquery'), '1.5.1' );
+       $scripts->add( 'jquery-ui-tabs', '/wp-includes/js/jquery/ui.tabs.js', array('jquery-ui-core'), '1.5.1' );
+       $scripts->add( 'jquery-ui-sortable', '/wp-includes/js/jquery/ui.sortable.js', array('jquery-ui-core'), '1.5.1' );
 
-               $this->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/scriptaculous.js', array('prototype'), '1.8.0');
-               $this->add( 'scriptaculous-builder', '/wp-includes/js/scriptaculous/builder.js', array('scriptaculous-root'), '1.8.0');
-               $this->add( 'scriptaculous-dragdrop', '/wp-includes/js/scriptaculous/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.8.0');
-               $this->add( 'scriptaculous-effects', '/wp-includes/js/scriptaculous/effects.js', array('scriptaculous-root'), '1.8.0');
-               $this->add( 'scriptaculous-slider', '/wp-includes/js/scriptaculous/slider.js', array('scriptaculous-effects'), '1.8.0');
-               $this->add( 'scriptaculous-sound', '/wp-includes/js/scriptaculous/sound.js', array( 'scriptaculous-root' ), '1.8.0' );
-               $this->add( 'scriptaculous-controls', '/wp-includes/js/scriptaculous/controls.js', array('scriptaculous-root'), '1.8.0');
-               $this->add( 'scriptaculous', '', array('scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls'), '1.8.0');
-
-               $this->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop'), '20070118');
-
-               $this->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.2.3');
-               $this->add( 'jquery-form', '/wp-includes/js/jquery/jquery.form.js', array('jquery'), '2.02');
-               $this->add( 'jquery-color', '/wp-includes/js/jquery/jquery.color.js', array('jquery'), '2.0-4561');
-               $this->add( 'interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.2' );
-               $this->add( 'dimensions', '/wp-includes/js/jquery/jquery.dimensions.min.js', array('jquery'), '1.1.2');
-               $this->add( 'suggest', '/wp-includes/js/jquery/suggest.js', array('dimensions'), '1.1');
-               $this->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array('jquery'), '20');
-               $this->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.js', array('jquery'), '3.1');
-               $this->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2.0.2');
-               $this->add( 'swfupload-degrade', '/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js', array('swfupload'), '2.0.2');
-               $this->localize( 'swfupload-degrade', 'uploadDegradeOptions', array(
-                       'is_lighttpd_before_150' => is_lighttpd_before_150(),
+       if ( is_admin() ) {
+               $scripts->add( 'ajaxcat', '/wp-admin/js/cat.js', array( 'wp-lists' ), '20071101' );
+               $scripts->localize( 'ajaxcat', 'catL10n', array(
+                       'add' => attribute_escape(__('Add')),
+                       'how' => __('Separate multiple categories with commas.')
                ) );
-               $this->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2.0.2');
-               $this->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.0.2-20080407');
-               // these error messages came from the sample swfupload js, they might need changing.
-               $this->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. Your php.ini upload_max_filesize is %s.'), @ini_get('upload_max_filesize')),
-                               '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.'),
-                               'missing_upload_url' => __('There was a configuration error. Please contact the server administrator.'),
-                               'upload_limit_exceeded' => __('You may only upload 1 file.'),
-                               'http_error' => __('HTTP error.'),
-                               'upload_failed' => __('Upload failed.'),
-                               'io_error' => __('IO error.'),
-                               'security_error' => __('Security error.'),
-                               'file_cancelled' => __('File cancelled.'),
-                               'upload_stopped' => __('Upload stopped.'),
-                               'dismiss' => __('Dismiss'),
-                               'crunching' => __('Crunching&hellip;'),
-                               'deleted' => __('Deleted'),
+               $scripts->add( 'admin-categories', '/wp-admin/js/categories.js', array('wp-lists'), '20071031' );
+               $scripts->add( 'admin-tags', '/wp-admin/js/tags.js', array('wp-lists'), '20071031' );
+               $scripts->add( 'admin-custom-fields', '/wp-admin/js/custom-fields.js', array('wp-lists'), '20070823' );
+               $scripts->add( 'password-strength-meter', '/wp-admin/js/password-strength-meter.js', array('jquery'), '20070405' );
+               $scripts->localize( 'password-strength-meter', 'pwsL10n', array(
+                       'short' => __('Too short'),
+                       'bad' => __('Bad'),
+                       'good' => __('Good'),
+                       'strong' => __('Strong')
                ) );
-
-               $this->add( 'jquery-ui-tabs', '/wp-includes/js/jquery/ui.tabs.js', array('jquery'), '3' );
-
-               if ( is_admin() ) {
-                       $this->add( 'ajaxcat', '/wp-admin/js/cat.js', array( 'wp-lists' ), '20071101' );
-                       $this->localize( 'ajaxcat', 'catL10n', array(
-                               'add' => attribute_escape(__('Add')),
-                               'how' => __('Separate multiple categories with commas.')
-                       ) );
-                       $this->add( 'admin-categories', '/wp-admin/js/categories.js', array('wp-lists'), '20071031' );
-                       $this->add( 'admin-tags', '/wp-admin/js/tags.js', array('wp-lists'), '20071031' );
-                       $this->add( 'admin-custom-fields', '/wp-admin/js/custom-fields.js', array('wp-lists'), '20070823' );
-                       $this->add( 'password-strength-meter', '/wp-admin/js/password-strength-meter.js', array('jquery'), '20070405' );
-                       $this->localize( 'password-strength-meter', 'pwsL10n', array(
-                               'short' => __('Too short'),
-                               'bad' => __('Bad'),
-                               'good' => __('Good'),
-                               'strong' => __('Strong')
-                       ) );
-                       $this->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists'), '20080311' );
-                       $this->localize( 'admin-comments', 'adminCommentsL10n', array(
-                               'pending' => __('%i% pending') // must look like: "# blah blah"
-                       ) );
-                       $this->add( 'admin-users', '/wp-admin/js/users.js', array('wp-lists'), '20070823' );
-                       $this->add( 'admin-forms', '/wp-admin/js/forms.js', false, '20080317' );
-                       $this->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' );
-                       $this->add( 'upload', '/wp-admin/js/upload.js', array('jquery'), '20070518' );
-                       $this->add( 'postbox', '/wp-admin/js/postbox.js', array('jquery'), '20080128' );
-                       $this->localize( 'postbox', 'postboxL10n', array(
-                               'requestFile' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php',
-                       ) );
-                       $this->add( 'slug', '/wp-admin/js/slug.js', array('jquery'), '20080208' );
-                       $this->localize( 'slug', 'slugL10n', array(
-                               'requestFile' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php',
-                               'save' => __('Save'),
-                               'cancel' => __('Cancel'),
-                       ) );
-                       $this->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '20080422' );
-                       $this->localize( 'post', 'postL10n', array(
-                               'tagsUsed' =>  __('Tags used on this post:'),
-                               'add' => attribute_escape(__('Add')),
-                               'addTag' => attribute_escape(__('Add new tag')),
-                               'separate' => __('Separate tags with commas'),
-                               'cancel' => __('Cancel'),
-                               'edit' => __('Edit'),
-                       ) );
-                       $this->add( 'page', '/wp-admin/js/page.js', array('jquery', 'slug', 'postbox'), '20080318' );
-                       $this->localize( 'page', 'postL10n', array(
-                               'cancel' => __('Cancel'),
-                               'edit' => __('Edit'),
-                       ) );
-                       $this->add( 'link', '/wp-admin/js/link.js', array('jquery-ui-tabs', 'wp-lists', 'postbox'), '20080131' );
-                       $this->add( 'comment', '/wp-admin/js/comment.js', array('postbox'), '20080219' );
-                       $this->localize( 'comment', 'commentL10n', array(
-                                       'cancel' => __('Cancel'),
-                                       'edit' => __('Edit'),
-                               ) );
-                       $this->add( 'media-upload', '/wp-admin/js/media-upload.js', false, '20080109' );
-                       $this->localize( 'upload', 'uploadL10n', array(
-                               'browseTitle' => attribute_escape(__('Browse your files')),
-                               'back' => __('&laquo; Back'),
-                               'directTitle' => attribute_escape(__('Direct link to file')),
-                               'edit' => __('Edit'),
-                               'thumb' => __('Thumbnail'),
-                               'full' => __('Full size'),
-                               'icon' => __('Icon'),
-                               'title' => __('Title'),
-                               'show' => __('Show:'),
-                               'link' => __('Link to:'),
-                               'file' => __('File'),
-                               'page' => __('Page'),
-                               'none' => __('None'),
-                               'editorText' => attribute_escape(__('Send to editor &raquo;')),
-                               'insert' => __('Insert'),
-                               'urlText' => __('URL'),
-                               'desc' => __('Description'),
-                               'deleteText' => attribute_escape(__('Delete File')),
-                               'saveText' => attribute_escape(__('Save &raquo;')),
-                               'confirmText' => __("Are you sure you want to delete the file '%title%'?\nClick ok to delete or cancel to go back.")
-                       ) );
-                       $this->add( 'admin-widgets', '/wp-admin/js/widgets.js', array( 'interface' ), '20080407c' );
-                       $this->localize( 'admin-widgets', 'widgetsL10n', array(
-                               'add' => __('Add'),
-                               'edit' => __('Edit'),
-                               'cancel' => __('Cancel'),
-                       ));
-                       $this->add( 'editor', '/wp-admin/js/editor.js', array('tiny_mce'), '20080221' );
-               }
-       }
-
-       /**
-        * Prints script tags
-        *
-        * Prints the scripts passed to it or the print queue.  Also prints all necessary dependencies.
-        *
-        * @param mixed handles (optional) Scripts to be printed.  (void) prints queue, (string) prints that script, (array of strings) prints those scripts.
-        * @return array Scripts that have been printed
-        */
-       function print_scripts( $handles = false ) {
-               global $wp_db_version;
-
-               // Print the queue if nothing is passed.  If a string is passed, print that script.  If an array is passed, print those scripts.
-               $handles = false === $handles ? $this->queue : (array) $handles;
-               $this->all_deps( $handles );
-
-               $to_print = apply_filters( 'print_scripts_array', array_keys($this->to_print) );
-
-               foreach( $to_print as $handle ) {
-                       if ( !in_array($handle, $this->printed) && isset($this->scripts[$handle]) ) {
-                               if ( $this->scripts[$handle]->src ) { // Else it defines a group.
-                                       $ver = $this->scripts[$handle]->ver ? $this->scripts[$handle]->ver : $wp_db_version;
-                                       if ( isset($this->args[$handle]) )
-                                               $ver .= '&amp;' . $this->args[$handle];
-                                       $src = 0 === strpos($this->scripts[$handle]->src, 'http://') ? $this->scripts[$handle]->src : get_option( 'siteurl' ) . $this->scripts[$handle]->src;
-                                       $src = $this->scripts[$handle]->src;
-
-                                       if (!preg_match('|^https?://|', $src)) {
-                                               $src = get_option('siteurl') . $src;
-                                       }
-
-                                       $src = add_query_arg('ver', $ver, $src);
-                                       $src = clean_url(apply_filters( 'script_loader_src', $src ));
-                                       $this->print_scripts_l10n( $handle );
-                                       echo "<script type='text/javascript' src='$src'></script>\n";
-                               }
-                               $this->printed[] = $handle;
-                       }
-               }
-
-               $this->to_print = array();
-               return $this->printed;
-       }
-
-       function print_scripts_l10n( $handle ) {
-               if ( empty($this->scripts[$handle]->l10n_object) || empty($this->scripts[$handle]->l10n) || !is_array($this->scripts[$handle]->l10n) )
-                       return;
-
-               $object_name = $this->scripts[$handle]->l10n_object;
-
-               echo "<script type='text/javascript'>\n";
-               echo "/* <![CDATA[ */\n";
-               echo "\t$object_name = {\n";
-               $eol = '';
-               foreach ( $this->scripts[$handle]->l10n as $var => $val ) {
-                       echo "$eol\t\t$var: \"" . js_escape( $val ) . '"';
-                       $eol = ",\n";
-               }
-               echo "\n\t}\n";
-               echo "/* ]]> */\n";
-               echo "</script>\n";
-       }
-
-       /**
-        * Determines dependencies of scripts
-        *
-        * Recursively builds array of scripts to print taking dependencies into account.  Does NOT catch infinite loops.
-        *
-        * @param mixed handles Accepts (string) script name or (array of strings) script names
-        * @param bool recursion Used internally when function calls itself
-        */
-       function all_deps( $handles, $recursion = false ) {
-               if ( !$handles = (array) $handles )
-                       return false;
-
-               foreach ( $handles as $handle ) {
-                       $handle = explode('?', $handle);
-                       if ( isset($handle[1]) )
-                               $this->args[$handle[0]] = $handle[1];
-                       $handle = $handle[0];
-
-                       if ( isset($this->to_print[$handle]) ) // Already grobbed it and its deps
-                               continue;
-
-                       $keep_going = true;
-                       if ( !isset($this->scripts[$handle]) )
-                               $keep_going = false; // Script doesn't exist
-                       elseif ( $this->scripts[$handle]->deps && array_diff($this->scripts[$handle]->deps, array_keys($this->scripts)) )
-                               $keep_going = false; // Script requires deps which don't exist (not a necessary check.  efficiency?)
-                       elseif ( $this->scripts[$handle]->deps && !$this->all_deps( $this->scripts[$handle]->deps, true ) )
-                               $keep_going = false; // Script requires deps which don't exist
-
-                       if ( !$keep_going ) { // Either script or its deps don't exist.
-                               if ( $recursion )
-                                       return false; // Abort this branch.
-                               else
-                                       continue; // We're at the top level.  Move on to the next one.
-                       }
-
-                       $this->to_print[$handle] = true;
-               }
-
-               return true;
-       }
-
-       /**
-        * Adds script
-        *
-        * Adds the script only if no script of that name already exists
-        *
-        * @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 ver (optional) Script version (used for cache busting)
-        * @return array Hierarchical array of dependencies
-        */
-       function add( $handle, $src, $deps = array(), $ver = false ) {
-               if ( isset($this->scripts[$handle]) )
-                       return false;
-               $this->scripts[$handle] = new _WP_Script( $handle, $src, $deps, $ver );
-               return true;
-       }
-
-       /**
-        * Localizes a script
-        *
-        * Localizes only if script has already been added
-        *
-        * @param string handle Script name
-        * @param string object_name Name of JS object to hold l10n info
-        * @param array l10n Array of JS var name => localized string
-        * @return bool Successful localization
-        */
-       function localize( $handle, $object_name, $l10n ) {
-               if ( !isset($this->scripts[$handle]) )
-                       return false;
-               return $this->scripts[$handle]->localize( $object_name, $l10n );
-       }
-
-       function remove( $handles ) {
-               foreach ( (array) $handles as $handle )
-                       unset($this->scripts[$handle]);
-       }
-
-       function enqueue( $handles ) {
-               foreach ( (array) $handles as $handle ) {
-                       $handle = explode('?', $handle);
-                       if ( !in_array($handle[0], $this->queue) && isset($this->scripts[$handle[0]]) ) {
-                               $this->queue[] = $handle[0];
-                               if ( isset($handle[1]) )
-                                       $this->args[$handle[0]] = $handle[1];
-                       }
-               }
-       }
-
-       function dequeue( $handles ) {
-               foreach ( (array) $handles as $handle )
-                       unset( $this->queue[$handle] );
-       }
-
-       function query( $handle, $list = 'scripts' ) { // scripts, queue, or printed
-               switch ( $list ) :
-               case 'scripts':
-                       if ( isset($this->scripts[$handle]) )
-                               return $this->scripts[$handle];
-                       break;
-               default:
-                       if ( in_array($handle, $this->$list) )
-                               return true;
-                       break;
-               endswitch;
-               return false;
-       }
-
-}
-
-class _WP_Script {
-       var $handle;
-       var $src;
-       var $deps = array();
-       var $ver = false;
-       var $l10n_object = '';
-       var $l10n = array();
-
-       function _WP_Script() {
-               @list($this->handle, $this->src, $this->deps, $this->ver) = func_get_args();
-               if ( !is_array($this->deps) )
-                       $this->deps = array();
-               if ( !$this->ver )
-                       $this->ver = false;
-       }
-
-       function localize( $object_name, $l10n ) {
-               if ( !$object_name || !is_array($l10n) )
-                       return false;
-               $this->l10n_object = $object_name;
-               $this->l10n = $l10n;
-               return true;
-       }
-}
-
-/**
- * Prints script tags in document head
- *
- * Called by admin-header.php and by wp_head hook. Since it is called by wp_head on every page load,
- * the function does not instantiate the WP_Scripts object unless script names are explicitly passed.
- * Does make use of already instantiated $wp_scripts if present.
- * Use provided wp_print_scripts hook to register/enqueue new scripts.
- *
- * @see WP_Scripts::print_scripts()
- */
-function wp_print_scripts( $handles = false ) {
-       do_action( 'wp_print_scripts' );
-       if ( '' === $handles ) // for wp_head
-               $handles = false;
-
-       global $wp_scripts;
-       if ( !is_a($wp_scripts, 'WP_Scripts') ) {
-               if ( !$handles )
-                       return array(); // No need to instantiate if nothing's there.
-               else
-                       $wp_scripts = new WP_Scripts();
+               $scripts->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists'), '20080311' );
+               $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
+                       'pending' => __('%i% pending') // must look like: "# blah blah"
+               ) );
+               $scripts->add( 'admin-users', '/wp-admin/js/users.js', array('wp-lists'), '20070823' );
+               $scripts->add( 'admin-forms', '/wp-admin/js/forms.js', array('jquery'), '20080729');
+               $scripts->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' );
+               $scripts->add( 'upload', '/wp-admin/js/upload.js', array('jquery'), '20070518' );
+               $scripts->add( 'postbox', '/wp-admin/js/postbox.js', array('jquery'), '20080128' );
+               $scripts->localize( 'postbox', 'postboxL10n', array(
+                       'requestFile' => admin_url('admin-ajax.php'),
+               ) );
+               $scripts->add( 'slug', '/wp-admin/js/slug.js', array('jquery'), '20080208' );
+               $scripts->localize( 'slug', 'slugL10n', array(
+                       'requestFile' => admin_url('admin-ajax.php'),
+                       'save' => __('Save'),
+                       'cancel' => __('Cancel'),
+               ) );
+               $scripts->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '20080629' );
+               $scripts->localize( 'post', 'postL10n', array(
+                       'tagsUsed' =>  __('Tags used on this post:'),
+                       'add' => attribute_escape(__('Add')),
+                       'addTag' => attribute_escape(__('Add new tag')),
+                       'separate' => __('Separate tags with commas'),
+                       'cancel' => __('Cancel'),
+                       'edit' => __('Edit'),
+               ) );
+               $scripts->add( 'page', '/wp-admin/js/page.js', array('jquery', 'slug', 'postbox'), '20080318' );
+               $scripts->localize( 'page', 'postL10n', array(
+                       'cancel' => __('Cancel'),
+                       'edit' => __('Edit'),
+               ) );
+               $scripts->add( 'link', '/wp-admin/js/link.js', array('jquery-ui-tabs', 'wp-lists', 'postbox'), '20080131' );
+               $scripts->add( 'comment', '/wp-admin/js/comment.js', array('postbox'), '20080219' );
+               $scripts->localize( 'comment', 'commentL10n', array(
+                       'cancel' => __('Cancel'),
+                       'edit' => __('Edit'),
+               ) );
+               $scripts->add( 'admin-gallery', '/wp-admin/js/gallery.js', array( 'jquery-ui-sortable' ), '20080709' );
+               $scripts->add( 'media-upload', '/wp-admin/js/media-upload.js', array( 'thickbox' ), '20080710' );
+               $scripts->localize( 'upload', 'uploadL10n', array(
+                       'browseTitle' => attribute_escape(__('Browse your files')),
+                       'back' => __('&laquo; Back'),
+                       'directTitle' => attribute_escape(__('Direct link to file')),
+                       'edit' => __('Edit'),
+                       'thumb' => __('Thumbnail'),
+                       'full' => __('Full size'),
+                       'icon' => __('Icon'),
+                       'title' => __('Title'),
+                       'show' => __('Show:'),
+                       'link' => __('Link to:'),
+                       'file' => __('File'),
+                       'page' => __('Page'),
+                       'none' => __('None'),
+                       'editorText' => attribute_escape(__('Send to editor &raquo;')),
+                       'insert' => __('Insert'),
+                       'urlText' => __('URL'),
+                       'desc' => __('Description'),
+                       'deleteText' => attribute_escape(__('Delete File')),
+                       'saveText' => attribute_escape(__('Save &raquo;')),
+                       'confirmText' => __("Are you sure you want to delete the file '%title%'?\nClick ok to delete or cancel to go back.")
+               ) );
+               $scripts->add( 'admin-widgets', '/wp-admin/js/widgets.js', array( 'interface' ), '20080503' );
+               $scripts->localize( 'admin-widgets', 'widgetsL10n', array(
+                       'add' => __('Add'),
+                       'edit' => __('Edit'),
+                       'cancel' => __('Cancel'),
+               ));
+
+               $scripts->add( 'word-count', '/wp-admin/js/word-count.js', array( 'jquery' ), '20080423' );
+               $scripts->localize( 'word-count', 'wordCountL10n', array(
+                       'count' => __('Word count: %d')
+               ));
+               
+               $scripts->add( 'wp-gears', '/wp-admin/js/wp-gears.js', false, '20080721' );
+               $scripts->localize( 'wp-gears', 'wpGearsL10n', array(
+                       'updateCompleted' => __('Update completed.'),
+                       'error' => __('Error:')
+               ));
+               
+               $scripts->add( 'theme-preview', '/wp-admin/js/theme-preview.js', array( 'thickbox', 'jquery' ), '20080625' );
        }
-
-       return $wp_scripts->print_scripts( $handles );
 }
 
-function wp_register_script( $handle, $src, $deps = array(), $ver = false ) {
-       global $wp_scripts;
-       if ( !is_a($wp_scripts, 'WP_Scripts') )
-               $wp_scripts = new WP_Scripts();
-
-       $wp_scripts->add( $handle, $src, $deps, $ver );
-}
-
-/**
- * Localizes a script
- *
- * Localizes only if script has already been added
- *
- * @see WP_Script::localize()
- */
-function wp_localize_script( $handle, $object_name, $l10n ) {
-       global $wp_scripts;
-       if ( !is_a($wp_scripts, 'WP_Scripts') )
-               return false;
-
-       return $wp_scripts->localize( $handle, $object_name, $l10n );
-}
-
-function wp_deregister_script( $handle ) {
-       global $wp_scripts;
-       if ( !is_a($wp_scripts, 'WP_Scripts') )
-               $wp_scripts = new WP_Scripts();
-
-       $wp_scripts->remove( $handle );
-}
-
-/**
- * Equeues script
- *
- * Registers the script if src provided (does NOT overwrite) and enqueues.
- *
- * @see WP_Script::add(), WP_Script::enqueue()
-*/
-function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false ) {
-       global $wp_scripts;
-       if ( !is_a($wp_scripts, 'WP_Scripts') )
-               $wp_scripts = new WP_Scripts();
-
-       if ( $src ) {
-               $_handle = explode('?', $handle);
-               $wp_scripts->add( $_handle[0], $src, $deps, $ver );
-       }
-       $wp_scripts->enqueue( $handle );
+function wp_default_styles( &$styles ) {
+       if (!$guessurl = site_url())
+               $guessurl = wp_guess_url();
+       $styles->base_url = $guessurl;
+       $styles->default_version = get_bloginfo( 'version' );
+       $styles->text_direction = 'rtl' == get_bloginfo( 'text_direction' ) ? 'rtl' : 'ltr';
+
+       $rtl_styles = array( 'global', 'colors', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'press-this-ie' );
+
+       $styles->add( 'wp-admin', '/wp-admin/wp-admin.css' );
+       $styles->add_data( 'wp-admin', 'rtl', '/wp-admin/rtl.css' );
+
+       $styles->add( 'ie', '/wp-admin/css/ie.css' );
+       $styles->add_data( 'ie', 'conditional', 'gte IE 6' );
+
+       $styles->add( 'colors', true ); // Register "meta" stylesheet for admin colors
+       $styles->add( 'colors-fresh', '/wp-admin/css/colors-fresh.css' ); // for login.php.  Is there a better way?
+       $styles->add_data( 'colors-fresh', 'rtl', true );
+
+       $styles->add( 'global', '/wp-admin/css/global.css' );
+       $styles->add( 'media', '/wp-admin/css/media.css', array(), '20080709' );
+       $styles->add( 'widgets', '/wp-admin/css/widgets.css' );
+       $styles->add( 'dashboard', '/wp-admin/css/dashboard.css' );
+       $styles->add( 'install', '/wp-admin/css/install.css', array(), '20080708' );
+       $styles->add( 'theme-editor', '/wp-admin/css/theme-editor.css' );
+       $styles->add( 'press-this', '/wp-admin/css/press-this.css', array(), '20080710' );
+       $styles->add( 'press-this-ie', '/wp-admin/css/press-this-ie.css', array(), '20080710' );
+       $styles->add_data( 'press-this-ie', 'conditional', 'gte IE 6' );
+       $styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array(), '20080613' );
+       $styles->add( 'login', '/wp-admin/css/login.css' );
+
+       foreach ( $rtl_styles as $rtl_style )
+               $styles->add_data( $rtl_style, 'rtl', true );
 }
 
 function wp_prototype_before_jquery( $js_array ) {
@@ -497,12 +263,36 @@ function wp_just_in_time_script_localization() {
                'autosaveInterval' => AUTOSAVE_INTERVAL,
                'previewPageText' => __('Preview this Page'),
                'previewPostText' => __('Preview this Post'),
-               'requestFile' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php',
+               'requestFile' => admin_url('admin-ajax.php'),
                'savingText' => __('Saving Draft&#8230;')
        ) );
 }
 
+function wp_style_loader_src( $src, $handle ) {
+       if ( defined('WP_INSTALLING') )
+               return preg_replace( '#^wp-admin/#', './', $src );
+
+       if ( 'colors' == $handle || 'colors-rtl' == $handle ) {
+               global $_wp_admin_css_colors;
+               $color = get_user_option('admin_color');
+               if ( empty($color) || !isset($_wp_admin_css_colors[$color]) )
+                       $color = 'fresh';
+               $color = $_wp_admin_css_colors[$color];
+               $parsed = parse_url( $src );
+               $url = $color->url;
+               if ( isset($parsed['query']) && $parsed['query'] ) {
+                       wp_parse_str( $parsed['query'], $qv );
+                       $url = add_query_arg( $qv, $url );
+               }
+               return $url;
+       }
+
+       return $src;
+}
+
+add_action( 'wp_default_scripts', 'wp_default_scripts' );
 add_filter( 'wp_print_scripts', 'wp_just_in_time_script_localization' );
 add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' );
 
-?>
+add_action( 'wp_default_styles', 'wp_default_styles' );
+add_filter( 'style_loader_src', 'wp_style_loader_src', 10, 2 );
index 907f7ff30a311987683dc19103f687282dae25da..2cc808ce481b36c11f36413d3f2a7d1ff6013713 100644 (file)
@@ -1,52 +1,95 @@
 <?php
-
-/*
-
-An API for creating shortcode tags that support attributes and enclosed content, such as:
-
-[shortcode /]
-[shortcode foo="bar" baz="bing" /]
-[shortcode foo="bar"]content[/shortcode]
-
-tag and attrbute parsing regexp code based on the Textpattern tag parser.
-
-To apply shortcode tags to content:
-
-$out = do_shortcode($content);
-
-Simplest example of a shortcode tag using the API:
-
-// [footag foo="bar"]
-function footag_func($atts) {
-       return "foo = {$atts[foo]}";
-}
-add_shortcode('footag', 'footag_func');
-
-Example with nice attribute defaults:
-
-// [bartag foo="bar"]
-function bartag_func($atts) {
-       extract(shortcode_atts(array(
-               'foo' => 'no foo',
-               'baz' => 'default baz',
-       ), $atts));
-
-       return "foo = {$foo}";
-}
-add_shortcode('bartag', 'bartag_func');
-
-Example with enclosed content:
-
-// [baztag]content[/baztag]
-function baztag_func($atts, $content='') {
-       return "content = $content";
-}
-add_shortcode('baztag', 'baztag_func');
-
-*/
-
+/**
+ * WordPress API for creating bbcode like tags or what WordPress calls
+ * "shortcodes." The tag and attribute parsing or regular expression code is
+ * based on the Textpattern tag parser.
+ *
+ * A few examples are below:
+ *
+ * [shortcode /]
+ * [shortcode foo="bar" baz="bing" /]
+ * [shortcode foo="bar"]content[/shortcode]
+ *
+ * Shortcode tags support attributes and enclosed content, but does not entirely
+ * support inline shortcodes in other shortcodes. You will have to call the
+ * shortcode parser in your function to account for that.
+ *
+ * {@internal
+ * Please be aware that the above note was made during the beta of WordPress 2.6
+ * and in the future may not be accurate. Please update the note when it is no
+ * longer the case.}}
+ *
+ * To apply shortcode tags to content:
+ *
+ * <code>
+ * $out = do_shortcode($content);
+ * </code>
+ *
+ * @link http://codex.wordpress.org/Shortcode_API
+ *
+ * @package WordPress
+ * @subpackage Shortcodes
+ * @since 2.5
+ */
+
+/**
+ * Container for storing shortcode tags and their hook to call for the shortcode
+ *
+ * @since 2.5
+ * @name $shortcode_tags
+ * @var array
+ * @global array $shortcode_tags
+ */
 $shortcode_tags = array();
 
+/**
+ * Add hook for shortcode tag.
+ *
+ * There can only be one hook for each shortcode. Which means that if another
+ * plugin has a similar shortcode, it will override yours or yours will override
+ * theirs depending on which order the plugins are included and/or ran.
+ * 
+ * Simplest example of a shortcode tag using the API:
+ *
+ * <code>
+ * // [footag foo="bar"]
+ * function footag_func($atts) {
+ *     return "foo = {$atts[foo]}";
+ * }
+ * add_shortcode('footag', 'footag_func');
+ * </code>
+ *
+ * Example with nice attribute defaults:
+ *
+ * <code>
+ * // [bartag foo="bar"]
+ * function bartag_func($atts) {
+ *     extract(shortcode_atts(array(
+ *             'foo' => 'no foo',
+ *             'baz' => 'default baz',
+ *     ), $atts));
+ *
+ *     return "foo = {$foo}";
+ * }
+ * add_shortcode('bartag', 'bartag_func');
+ * </code>
+ *
+ * Example with enclosed content:
+ *
+ * <code>
+ * // [baztag]content[/baztag]
+ * function baztag_func($atts, $content='') {
+ *     return "content = $content";
+ * }
+ * add_shortcode('baztag', 'baztag_func');
+ * </code>
+ *
+ * @since 2.5
+ * @uses $shortcode_tags
+ *
+ * @param string $tag Shortcode tag to be searched in post content.
+ * @param callable $func Hook to run when shortcode is found.
+ */
 function add_shortcode($tag, $func) {
        global $shortcode_tags;
 
@@ -54,18 +97,50 @@ function add_shortcode($tag, $func) {
                $shortcode_tags[$tag] = $func;
 }
 
+/**
+ * Removes hook for shortcode.
+ *
+ * @since 2.5
+ * @uses $shortcode_tags
+ *
+ * @param string $tag shortcode tag to remove hook for.
+ */
 function remove_shortcode($tag) {
        global $shortcode_tags;
 
        unset($shortcode_tags[$tag]);
 }
 
+/**
+ * Clear all shortcodes.
+ *
+ * This function is simple, it clears all of the shortcode tags by replacing the
+ * shortcodes global by a empty array. This is actually a very efficient method
+ * for removing all shortcodes.
+ *
+ * @since 2.5
+ * @uses $shortcode_tags
+ */
 function remove_all_shortcodes() {
        global $shortcode_tags;
 
        $shortcode_tags = array();
 }
 
+/**
+ * Search content for shortcodes and filter shortcodes through their hooks.
+ *
+ * If there are no shortcode tags defined, then the content will be returned
+ * without any filtering. This might cause issues when plugins are disabled but
+ * the shortcode will still show up in the post or content.
+ *
+ * @since 2.5
+ * @uses $shortcode_tags
+ * @uses get_shortcode_regex() Gets the search pattern for searching shortcodes.
+ *
+ * @param string $content Content to search for shortcodes
+ * @return string Content with shortcodes filtered out.
+ */
 function do_shortcode($content) {
        global $shortcode_tags;
 
@@ -76,6 +151,17 @@ function do_shortcode($content) {
        return preg_replace_callback('/'.$pattern.'/s', 'do_shortcode_tag', $content);
 }
 
+/**
+ * Retrieve the shortcode regular expression for searching.
+ *
+ * The regular expression combines the shortcode tags in the regular expression
+ * in a regex class.
+ *
+ * @since 2.5
+ * @uses $shortcode_tags
+ *
+ * @return string The shortcode search regular expression
+ */
 function get_shortcode_regex() {
        global $shortcode_tags;
        $tagnames = array_keys($shortcode_tags);
@@ -84,6 +170,16 @@ function get_shortcode_regex() {
        return '\[('.$tagregexp.')\b(.*?)(?:(\/))?\](?:(.+?)\[\/\1\])?';
 }
 
+/**
+ * Regular Expression callable for do_shortcode() for calling shortcode hook.
+ *
+ * @since 2.5
+ * @access private
+ * @uses $shortcode_tags
+ *
+ * @param array $m Regular expression match array
+ * @return mixed False on failure.
+ */
 function do_shortcode_tag($m) {
        global $shortcode_tags;
 
@@ -99,6 +195,18 @@ function do_shortcode_tag($m) {
        }
 }
 
+/**
+ * Retrieve all attributes from the shortcodes tag.
+ *
+ * The attributes list has the attribute name as the key and the value of the
+ * attribute as the value in the key/value pair. This allows for easier
+ * retrieval of the attributes, since all attributes have to be known.
+ *
+ * @since 2.5
+ *
+ * @param string $text 
+ * @return array List of attributes and their value.
+ */
 function shortcode_parse_atts($text) {
        $atts = array();
        $pattern = '/(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/';
@@ -122,6 +230,22 @@ function shortcode_parse_atts($text) {
        return $atts;
 }
 
+/**
+ * Combine user attributes with known attributes and fill in defaults when needed.
+ *
+ * The pairs should be considered to be all of the attributes which are
+ * supported by the caller and given as a list. The returned attributes will
+ * only contain the attributes in the $pairs list.
+ *
+ * If the $atts list has unsupported attributes, then they will be ignored and
+ * removed from the final returned list.
+ *
+ * @since 2.5
+ *
+ * @param array $pairs Entire list of supported attributes and their defaults.
+ * @param array $atts User defined attributes in shortcode tag.
+ * @return array Combined and filtered attribute list.
+ */
 function shortcode_atts($pairs, $atts) {
        $atts = (array)$atts;
        $out = array();
@@ -134,6 +258,26 @@ function shortcode_atts($pairs, $atts) {
        return $out;
 }
 
+/**
+ * Remove all shortcode tags from the given content.
+ *
+ * @since 2.5
+ * @uses $shortcode_tags
+ *
+ * @param string $content Content to remove shortcode tags.
+ * @return string Content without shortcode tags.
+ */
+function strip_shortcodes( $content ) {
+       global $shortcode_tags;
+
+       if (empty($shortcode_tags) || !is_array($shortcode_tags))
+               return $content;
+
+       $pattern = get_shortcode_regex();
+
+       return preg_replace('/'.$pattern.'/s', '', $content);
+}
+
 add_filter('the_content', 'do_shortcode', 11); // AFTER wpautop() 
 
-?>
+?>
\ No newline at end of file
index 595acd775b80df8dbacf757bb9eedccb0ea56b67..60b617de8fb601a9305db22aaa5e3538f3720903 100644 (file)
@@ -58,21 +58,39 @@ class StringReader {
   function StringReader($str='') {
     $this->_str = $str;
     $this->_pos = 0;
+    // If string functions are overloaded, we need to use the mb versions
+    $this->is_overloaded = ((ini_get("mbstring.func_overload") & 2) != 0) && function_exists('mb_substr');
+  }
+
+  function _substr($string, $start, $length) {
+       if ($this->is_overloaded) {
+               return mb_substr($string,$start,$length,'ascii');
+       } else {
+               return substr($string,$start,$length);
+       }
+  }
+
+  function _strlen($string) {
+       if ($this->is_overloaded) {
+               return mb_strlen($string,'ascii');
+       } else {
+               return strlen($string);
+       }
   }
 
   function read($bytes) {
-    $data = substr($this->_str, $this->_pos, $bytes);
+         $data = $this->_substr($this->_str, $this->_pos, $bytes);
     $this->_pos += $bytes;
-    if (strlen($this->_str)<$this->_pos)
-      $this->_pos = strlen($this->_str);
+    if ($this->_strlen($this->_str)<$this->_pos)
+      $this->_pos = $this->_strlen($this->_str);
 
     return $data;
   }
 
   function seekto($pos) {
     $this->_pos = $pos;
-    if (strlen($this->_str)<$this->_pos)
-      $this->_pos = strlen($this->_str);
+    if ($this->_strlen($this->_str)<$this->_pos)
+      $this->_pos = $this->_strlen($this->_str);
     return $this->_pos;
   }
 
@@ -81,9 +99,8 @@ class StringReader {
   }
 
   function length() {
-    return strlen($this->_str);
+    return $this->_strlen($this->_str);
   }
-
 }
 
 
@@ -149,17 +166,19 @@ class FileReader {
 // over it (it assumes knowledge of StringReader internals)
 class CachedFileReader extends StringReader {
   function CachedFileReader($filename) {
+    parent::StringReader();
+
     if (file_exists($filename)) {
 
       $length=filesize($filename);
       $fd = fopen($filename,'rb');
 
       if (!$fd) {
-       $this->error = 3; // Cannot read file, probably permissions
-       return false;
+        $this->error = 3; // Cannot read file, probably permissions
+        return false;
       }
       $this->_str = fread($fd, $length);
-      fclose($fd);
+         fclose($fd);
 
     } else {
       $this->error = 2; // File doesn't exist
@@ -169,4 +188,4 @@ class CachedFileReader extends StringReader {
 }
 
 
-?>
\ No newline at end of file
+?>
index 2407e14ec09314635cd35c75bba16659d7998d2b..e8da100c7fbf3990f7dbea9e412ed8354fbf7845 100644 (file)
@@ -20,13 +20,13 @@ $wp_taxonomies['post_tag'] = (object) array('name' => 'post_tag', 'object_type'
 $wp_taxonomies['link_category'] = (object) array('name' => 'link_category', 'object_type' => 'link', 'hierarchical' => false);
 
 /**
- * get_object_taxonomies() - Return all of the taxonomy names that are of $object_type
+ * Return all of the taxonomy names that are of $object_type.
  *
  * It appears that this function can be used to find all of the names inside of
  * $wp_taxonomies global variable.
  *
- * <code><?php $taxonomies = get_object_taxonomies('post'); ?></code>
- * Should result in <code>Array('category', 'post_tag')</code>
+ * <code><?php $taxonomies = get_object_taxonomies('post'); ?></code> Should
+ * result in <code>Array('category', 'post_tag')</code>
  *
  * @package WordPress
  * @subpackage Taxonomy
@@ -58,7 +58,7 @@ function get_object_taxonomies($object) {
 }
 
 /**
- * get_taxonomy() - Returns the taxonomy object of $taxonomy.
+ * Retrieves the taxonomy object of $taxonomy.
  *
  * The get_taxonomy function will first check that the parameter string given
  * is a taxonomy object and if it is, it will return it.
@@ -83,7 +83,7 @@ function get_taxonomy( $taxonomy ) {
 }
 
 /**
- * is_taxonomy() - Checks that the taxonomy name exists
+ * Checks that the taxonomy name exists.
  *
  * @package WordPress
  * @subpackage Taxonomy
@@ -101,10 +101,10 @@ function is_taxonomy( $taxonomy ) {
 }
 
 /**
- * is_taxonomy_hierarchical() - Whether the taxonomy object is hierarchical
+ * Whether the taxonomy object is hierarchical.
  *
- * Checks to make sure that the taxonomy is an object first. Then Gets the object, and finally
- * returns the hierarchical value in the object.
+ * Checks to make sure that the taxonomy is an object first. Then Gets the
+ * object, and finally returns the hierarchical value in the object.
  *
  * A false return value might also mean that the taxonomy does not exist.
  *
@@ -127,19 +127,29 @@ function is_taxonomy_hierarchical($taxonomy) {
 }
 
 /**
- * register_taxonomy() - Create or modify a taxonomy object. Do not use before init.
+ * Create or modify a taxonomy object. Do not use before init.
  *
- * A simple function for creating or modifying a taxonomy object based on the parameters given.
- * The function will accept an array (third optional parameter), along with strings for the
- * taxonomy name and another string for the object type.
+ * A simple function for creating or modifying a taxonomy object based on the
+ * parameters given. The function will accept an array (third optional
+ * 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 whether taxonomy exists.
+ * Nothing is returned, so expect error maybe or use is_taxonomy() to check
+ * whether taxonomy exists.
  *
  * Optional $args contents:
- * hierarachical - 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 when the count is updated.
- * rewrite - false to prevent rewrite, or array('slug'=>$slug) to customize permastruct; default will use $taxonomy as slug
- * query_var - false to prevent queries, or string to customize query var (?$query_var=$term); default will use $taxonomy as query var
+ *
+ * hierarachical - 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
+ * when the count is updated.
+ *
+ * rewrite - false to prevent rewrite, or array('slug'=>$slug) to customize
+ * permastruct; default will use $taxonomy as slug.
+ *
+ * query_var - false to prevent queries, or string to customize query var
+ * (?$query_var=$term); default will use $taxonomy as query var.
  *
  * @package WordPress
  * @subpackage Taxonomy
@@ -159,7 +169,7 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
        $args = wp_parse_args($args, $defaults);
 
        if ( false !== $args['query_var'] && !empty($wp) ) {
-               if ( empty($args['query_var']) )
+               if ( true === $args['query_var'] )
                        $args['query_var'] = $taxonomy;
                $args['query_var'] = sanitize_title_with_dashes($args['query_var']);
                $wp->add_query_var($args['query_var']);
@@ -184,18 +194,19 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
 //
 
 /**
- * get_objects_in_term() - Return object_ids of valid taxonomy and term
+ * Retrieve object_ids of valid taxonomy and term.
  *
- * The strings of $taxonomies must exist before this function will continue. On failure of finding
- * a valid taxonomy, it will return an WP_Error class, kind of like Exceptions in PHP 5, except you
- * can't catch them. Even so, you can still test for the WP_Error class and get the error message.
+ * The strings of $taxonomies must exist before this function will continue. On
+ * failure of finding a valid taxonomy, it will return an WP_Error class, kind
+ * of like Exceptions in PHP 5, except you can't catch them. Even so, you can
+ * still test for the WP_Error class and get the error message.
  *
- * The $terms aren't checked the same as $taxonomies, but still need to exist for $object_ids to
- * be returned.
+ * The $terms aren't checked the same as $taxonomies, but still need to exist
+ * for $object_ids to be returned.
  *
- * It is possible to change the order that object_ids is returned by either using PHP sort family
- * functions or using the database by using $args with either ASC or DESC array. The value should
- * be in the key named 'order'.
+ * It is possible to change the order that object_ids is returned by either
+ * using PHP sort family functions or using the database by using $args with
+ * either ASC or DESC array. The value should be in the key named 'order'.
  *
  * @package WordPress
  * @subpackage Taxonomy
@@ -244,26 +255,29 @@ function get_objects_in_term( $terms, $taxonomies, $args = array() ) {
 }
 
 /**
- * get_term() - Get all Term data from database by Term ID.
+ * Get all Term data from database by Term ID.
  *
- * The usage of the get_term function is to apply filters to a term object.
- * It is possible to get a term object from the database before applying the
+ * The usage of the get_term function is to apply filters to a term object. It
+ * is possible to get a term object from the database before applying the
  * filters.
  *
- * $term ID must be part of $taxonomy, to get from the database. Failure, might be
- * able to be captured by the hooks. Failure would be the same value as $wpdb returns for the
- * get_row method.
+ * $term ID must be part of $taxonomy, to get from the database. Failure, might
+ * be able to be captured by the hooks. Failure would be the same value as $wpdb
+ * returns for the get_row method.
  *
- * There are two hooks, one is specifically for each term, named 'get_term', and the second is
- * for the taxonomy name, 'term_$taxonomy'. Both hooks gets the term object, and the taxonomy
- * name as parameters. Both hooks are expected to return a Term object.
+ * There are two hooks, one is specifically for each term, named 'get_term', and
+ * the second is for the taxonomy name, 'term_$taxonomy'. Both hooks gets the
+ * term object, and the taxonomy name as parameters. Both hooks are expected to
+ * return a Term object.
  *
- * 'get_term' hook - Takes two parameters the term Object and the taxonomy name. Must return
- * term object. Used in get_term() as a catch-all filter for every $term.
+ * 'get_term' hook - Takes two parameters the term Object and the taxonomy name.
+ * Must return term object. Used in get_term() as a catch-all filter for every
+ * $term.
  *
- * 'get_$taxonomy' hook - Takes two parameters the term Object and the taxonomy name. Must return
- * term object. $taxonomy will be the taxonomy name, so for example, if 'category', it would be
- * 'get_category' as the filter name. Useful for custom taxonomies or plugging into default taxonomies.
+ * 'get_$taxonomy' hook - Takes two parameters the term Object and the taxonomy
+ * name. Must return term object. $taxonomy will be the taxonomy name, so for
+ * example, if 'category', it would be 'get_category' as the filter name. Useful
+ * for custom taxonomies or plugging into default taxonomies.
  *
  * @package WordPress
  * @subpackage Taxonomy
@@ -316,15 +330,16 @@ function &get_term($term, $taxonomy, $output = OBJECT, $filter = 'raw') {
 }
 
 /**
- * get_term_by() - Get all Term data from database by Term field and data.
+ * Get all Term data from database by Term field and data.
  *
- * Warning: $value is not escaped for 'name' $field. You must do it yourself, if required.
+ * Warning: $value is not escaped for 'name' $field. You must do it yourself, if
+ * required.
  *
- * The default $field is 'id', therefore it is possible to also use null for field, but not
- * recommended that you do so.
+ * The default $field is 'id', therefore it is possible to also use null for
+ * field, but not recommended that you do so.
  *
- * If $value does not exist, the return value will be false. If $taxonomy exists and $field
- * and $value combinations exist, the Term will be returned.
+ * If $value does not exist, the return value will be false. If $taxonomy exists
+ * and $field and $value combinations exist, the Term will be returned.
  *
  * @package WordPress
  * @subpackage Taxonomy
@@ -380,10 +395,10 @@ function get_term_by($field, $value, $taxonomy, $output = OBJECT, $filter = 'raw
 }
 
 /**
- * get_term_children() - Merge all term children into a single array.
+ * Merge all term children into a single array.
  *
- * This recursive function will merge all of the children of $term into
- * the same array. Only useful for taxonomies which are hierarchical.
+ * This recursive function will merge all of the children of $term into the same
+ * array. Only useful for taxonomies which are hierarchical.
  *
  * Will return an empty array if $term does not exist in $taxonomy.
  *
@@ -419,11 +434,11 @@ function get_term_children( $term, $taxonomy ) {
 }
 
 /**
- * get_term_field() - Get sanitized Term field
+ * Get sanitized Term field.
  *
- * Does checks for $term, based on the $taxonomy. The function is for
- * contextual reasons and for simplicity of usage. See sanitize_term_field() for
- * more information.
+ * Does checks for $term, based on the $taxonomy. The function is for contextual
+ * reasons and for simplicity of usage. See sanitize_term_field() for more
+ * information.
  *
  * @package WordPress
  * @subpackage Taxonomy
@@ -453,10 +468,10 @@ function get_term_field( $field, $term, $taxonomy, $context = 'display' ) {
 }
 
 /**
- * get_term_to_edit() - Sanitizes Term for editing
+ * Sanitizes Term for editing.
  *
- * Return value is sanitize_term() and usage is for sanitizing the term
- * for editing. Function is for contextual and simplicity.
+ * Return value is sanitize_term() and usage is for sanitizing the term for
+ * editing. Function is for contextual and simplicity.
  *
  * @package WordPress
  * @subpackage Taxonomy
@@ -481,20 +496,24 @@ function get_term_to_edit( $id, $taxonomy ) {
 }
 
 /**
- * get_terms() - Retrieve the terms in taxonomy or list of taxonomies.
+ * Retrieve the terms in taxonomy or list of taxonomies.
  *
- * You can fully inject any customizations to the query before it is sent, as well as control
- * the output with a filter.
+ * You can fully inject any customizations to the query before it is sent, as
+ * well as control the output with a filter.
  *
- * The 'get_terms' filter will be called when the cache has the term and will pass the found
- * term along with the array of $taxonomies and array of $args. This filter is also called
- * before the array of terms is passed and will pass the array of terms, along with the $taxonomies
- * and $args.
+ * The 'get_terms' filter will be called when the cache has the term and will
+ * pass the found term along with the array of $taxonomies and array of $args.
+ * This filter is also called before the array of terms is passed and will pass
+ * the array of terms, along with the $taxonomies and $args.
  *
- * The 'list_terms_exclusions' filter passes the compiled exclusions along with the $args.
+ * The 'list_terms_exclusions' filter passes the compiled exclusions along with
+ * the $args.
  *
  * The list that $args can contain, which will overwrite the defaults.
- * orderby - Default is 'name'. Can be name, count, or nothing (will use term_id).
+ *
+ * orderby - Default is 'name'. Can be name, count, or nothing (will use
+ * term_id).
+ *
  * order - Default is ASC. Can use DESC.
  * hide_empty - Default is true. Will not return empty $terms.
  * fields - Default is all.
@@ -502,19 +521,21 @@ function get_term_to_edit( $id, $taxonomy ) {
  * hierarchical - Whether to return hierarchical taxonomy. Default is true.
  * name__like - Default is empty string.
  *
- * The argument 'pad_counts' will count all of the children along with the $terms.
+ * The argument 'pad_counts' will count all of the children along with the
+ * $terms.
  *
- * The 'get' argument allows for overwriting 'hide_empty' and 'child_of', which can be done by
- * setting the value to 'all', instead of its default empty string value.
+ * The 'get' argument allows for overwriting 'hide_empty' and 'child_of', which
+ * can be done by setting the value to 'all', instead of its default empty
+ * string value.
  *
- * The 'child_of' argument will be used if you use multiple taxonomy or the first $taxonomy
- * isn't hierarchical or 'parent' isn't used. The default is 0, which will be translated to
- * a false value. If 'child_of' is set, then 'child_of' value will be tested against
- * $taxonomy to see if 'child_of' is contained within. Will return an empty array if test
- * fails.
+ * The 'child_of' argument will be used if you use multiple taxonomy or the
+ * first $taxonomy isn't hierarchical or 'parent' isn't used. The default is 0,
+ * which will be translated to a false value. If 'child_of' is set, then
+ * 'child_of' value will be tested against $taxonomy to see if 'child_of' is
+ * contained within. Will return an empty array if test fails.
  *
- * If 'parent' is set, then it will be used to test against the first taxonomy. Much like
- * 'child_of'. Will return an empty array if the test fails.
+ * If 'parent' is set, then it will be used to test against the first taxonomy.
+ * Much like 'child_of'. Will return an empty array if the test fails.
  *
  * @package WordPress
  * @subpackage Taxonomy
@@ -523,7 +544,6 @@ function get_term_to_edit( $id, $taxonomy ) {
  * @uses $wpdb
  * @uses wp_parse_args() Merges the defaults with those defined by $args and allows for strings.
  *
- *
  * @param string|array Taxonomy name or list of Taxonomy names
  * @param string|array $args The values of what to search for when returning terms
  * @return array|WP_Error List of Term Objects and their children. Will return WP_Error, if any of $taxonomies do not exist.
@@ -581,7 +601,8 @@ function &get_terms($taxonomies, $args = '') {
        }
 
        // $args can be whatever, only use the args defined in defaults to compute the key
-       $key = md5( serialize( compact(array_keys($defaults)) ) . serialize( $taxonomies ) );
+       $filter_key = ( has_filter('list_terms_exclusions') ) ? serialize($GLOBALS['wp_filter']['list_terms_exclusions']) : '';
+       $key = md5( serialize( compact(array_keys($defaults)) ) . serialize( $taxonomies ) . $filter_key );
 
        if ( $cache = wp_cache_get( 'get_terms', 'terms' ) ) {
                if ( isset( $cache[ $key ] ) )
@@ -723,7 +744,7 @@ function &get_terms($taxonomies, $args = '') {
 }
 
 /**
- * is_term() - Check if Term exists
+ * Check if Term exists.
  *
  * Returns the index of a defined term, or 0 (false) if the term doesn't exist.
  *
@@ -740,28 +761,44 @@ function &get_terms($taxonomies, $args = '') {
 function is_term($term, $taxonomy = '') {
        global $wpdb;
 
+       $select = "SELECT term_id FROM $wpdb->terms as t WHERE ";
+       $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
+
        if ( is_int($term) ) {
                if ( 0 == $term )
                        return 0;
-               $where = $wpdb->prepare( "t.term_id = %d", $term );
-       } else {
-               if ( '' === $term = sanitize_title($term) )
-                       return 0;
-               $where = $wpdb->prepare( "t.slug = %s", $term );
+               $where = 't.term_id = %d';
+               if ( !empty($taxonomy) )
+                       return $wpdb->get_row( $wpdb->prepare( $tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy ), ARRAY_A );
+               else
+                       return $wpdb->get_var( $wpdb->prepare( $select . $where, $term ) );
        }
 
-       if ( !empty($taxonomy) )
-               return $wpdb->get_row("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = '$taxonomy'", ARRAY_A);
+       if ( '' === $slug = sanitize_title($term) )
+               return 0;
+
+       $where = 't.slug = %s';
+       $else_where = 't.name = %s';
 
-       return $wpdb->get_var("SELECT term_id FROM $wpdb->terms as t WHERE $where");
+       if ( !empty($taxonomy) ) {
+               if ( $result = $wpdb->get_row( $wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $slug, $taxonomy), ARRAY_A) )
+                       return $result;
+                       
+               return $wpdb->get_row( $wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $else_where AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
+       }
+
+       if ( $result = $wpdb->get_var( $wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $slug) ) )
+               return $result;
+
+       return $wpdb->get_var( $wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $else_where", $term) );
 }
 
 /**
- * sanitize_term() - Sanitize Term all fields
+ * Sanitize Term all fields.
  *
- * Relys on sanitize_term_field() to sanitize the term. The difference
- * is that this function will sanitize <strong>all</strong> fields. The context
- * is based on sanitize_term_field().
+ * Relys on sanitize_term_field() to sanitize the term. The difference is that
+ * this function will sanitize <strong>all</strong> fields. The context is based
+ * on sanitize_term_field().
  *
  * The $term is expected to be either an array or an object.
  *
@@ -798,15 +835,17 @@ function sanitize_term($term, $taxonomy, $context = 'display') {
 }
 
 /**
- * sanitize_term_field() - Cleanse the field value in the term based on the context
+ * Cleanse the field value in the term based on the context.
  *
- * Passing a term field value through the function should be assumed to have cleansed
- * the value for whatever context the term field is going to be used.
+ * Passing a term field value through the function should be assumed to have
+ * cleansed the value for whatever context the term field is going to be used.
  *
- * If no context or an unsupported context is given, then default filters will be applied.
+ * If no context or an unsupported context is given, then default filters will
+ * be applied.
  *
- * There are enough filters for each context to support a custom filtering without creating
- * your own filter function. Simply create a function that hooks into the filter you need.
+ * There are enough filters for each context to support a custom filtering
+ * without creating your own filter function. Simply create a function that
+ * hooks into the filter you need.
  *
  * @package WordPress
  * @subpackage Taxonomy
@@ -863,10 +902,10 @@ function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) {
 }
 
 /**
- * wp_count_terms() - Count how many terms are in Taxonomy
+ * 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 'ignore_empty' which can be <code>'ignore_empty=true'</code>
+ * or <code>array('ignore_empty' => true);</code>.
  *
  * @package WordPress
  * @subpackage Taxonomy
@@ -890,16 +929,15 @@ function wp_count_terms( $taxonomy, $args = array() ) {
        if ( $ignore_empty )
                $where = 'AND count > 0';
 
-       $taxonomy = $wpdb->escape( $taxonomy );
-       return $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->term_taxonomy WHERE taxonomy = '$taxonomy' $where");
+       return $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_taxonomy WHERE taxonomy = %s $where", $taxonomy) );
 }
 
 /**
- * wp_delete_object_term_relationships() - Will unlink the term from the taxonomy
+ * Will unlink the term from the taxonomy.
  *
- * Will remove the term's relationship to the taxonomy, not the term or taxonomy itself.
- * The term and taxonomy will still exist. Will require the term's object ID to perform
- * the operation.
+ * Will remove the term's relationship to the taxonomy, not the term or taxonomy
+ * itself. The term and taxonomy will still exist. Will require the term's
+ * object ID to perform the operation.
  *
  * @package WordPress
  * @subpackage Taxonomy
@@ -920,16 +958,16 @@ function wp_delete_object_term_relationships( $object_id, $taxonomies ) {
        foreach ( $taxonomies as $taxonomy ) {
                $terms = wp_get_object_terms($object_id, $taxonomy, 'fields=tt_ids');
                $in_terms = "'" . implode("', '", $terms) . "'";
-               $wpdb->query("DELETE FROM $wpdb->term_relationships WHERE object_id = '$object_id' AND term_taxonomy_id IN ($in_terms)");
+               $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id IN ($in_terms)", $object_id) );
                wp_update_term_count($terms, $taxonomy);
        }
 }
 
 /**
- * wp_delete_term() - Removes a term from the database.
+ * Removes a term from the database.
  *
- * If the term is a parent of other terms, then the children will be updated
- * to that term's parent.
+ * If the term is a parent of other terms, then the children will be updated to
+ * that term's parent.
  *
  * The $args 'default' will only override the terms found, if there is only one
  * term found. Any other and the found terms are used.
@@ -939,9 +977,9 @@ function wp_delete_object_term_relationships( $object_id, $taxonomies ) {
  * @since 2.3
  *
  * @uses $wpdb
- * @uses do_action() Calls both 'delete_term' and 'delete_$taxonomy' action hooks,
- *     passing term object, term id. 'delete_term' gets an additional parameter with
- *     the $taxonomy parameter.
+ * @uses do_action() Calls both 'delete_term' and 'delete_$taxonomy' action
+ *     hooks, passing term object, term id. 'delete_term' gets an additional
+ *     parameter with the $taxonomy parameter.
  *
  * @param int $term Term ID
  * @param string $taxonomy Taxonomy Name
@@ -1007,24 +1045,26 @@ function wp_delete_term( $term, $taxonomy, $args = array() ) {
 }
 
 /**
- * wp_get_object_terms() - Retrieves the terms associated with the given object(s), in the supplied taxonomies.
+ * Retrieves the terms associated with the given object(s), in the supplied taxonomies.
  *
- * The following information has to do the $args parameter and for what can be contained in the string
- * or array of that parameter, if it exists.
+ * The following information has to do the $args parameter and for what can be
+ * contained in the string or array of that parameter, if it exists.
  *
- * The first argument is called, 'orderby' and has the default value of 'name'. The other value that is
- * supported is 'count'.
+ * The first argument is called, 'orderby' and has the default value of 'name'.
+ * The other value that is supported is 'count'.
  *
- * The second argument is called, 'order' and has the default value of 'ASC'. The only other value that
- * will be acceptable is 'DESC'.
+ * The second argument is called, 'order' and has the default value of 'ASC'.
+ * The only other value that will be acceptable is 'DESC'.
  *
- * The final argument supported is called, 'fields' and has the default value of 'all'. There are
- * multiple other options that can be used instead. Supported values are as follows: 'all', 'ids',
- * 'names', and finally 'all_with_object_id'.
+ * The final argument supported is called, 'fields' and has the default value of
+ * 'all'. There are multiple other options that can be used instead. Supported
+ * values are as follows: 'all', 'ids', 'names', and finally
+ * 'all_with_object_id'.
  *
- * The fields argument also decides what will be returned. If 'all' or 'all_with_object_id' is choosen or
- * the default kept intact, then all matching terms objects will be returned. If either 'ids' or 'names'
- * is used, then an array of all matching term ids or term names will be returned respectively.
+ * The fields argument also decides what will be returned. If 'all' or
+ * 'all_with_object_id' is choosen or the default kept intact, then all matching
+ * terms objects will be returned. If either 'ids' or 'names' is used, then an
+ * array of all matching term ids or term names will be returned respectively.
  *
  * @package WordPress
  * @subpackage Taxonomy
@@ -1058,14 +1098,14 @@ function wp_get_object_terms($object_ids, $taxonomies, $args = array()) {
        if ( count($taxonomies) > 1 ) {
                foreach ( $taxonomies as $index => $taxonomy ) {
                        $t = get_taxonomy($taxonomy);
-                       if ( is_array($t->args) && $args != array_merge($args, $t->args) ) {
+                       if ( isset($t->args) && is_array($t->args) && $args != array_merge($args, $t->args) ) {
                                unset($taxonomies[$index]);
                                $terms = array_merge($terms, wp_get_object_terms($object_ids, $taxonomy, array_merge($args, $t->args)));
                        }
                }
        } else {
                $t = get_taxonomy($taxonomies[0]);
-               if ( is_array($t->args) )
+               if ( isset($t->args) && is_array($t->args) )
                        $args = array_merge($args, $t->args);
        }
 
@@ -1115,34 +1155,40 @@ function wp_get_object_terms($object_ids, $taxonomies, $args = array()) {
 }
 
 /**
- * wp_insert_term() - Adds a new term to the database. Optionally marks it as an alias of an existing term.
+ * Adds a new term to the database. Optionally marks it as an alias of an existing term.
  *
- * Error handling is assigned for the nonexistance of the $taxonomy and $term parameters before inserting.
- * If both the term id and taxonomy exist previously, then an array will be returned that contains the term
- * id and the contents of what is returned. The keys of the array are 'term_id' and 'term_taxonomy_id' containing
- * numeric values.
+ * Error handling is assigned for the nonexistance of the $taxonomy and $term
+ * parameters before inserting. If both the term id and taxonomy exist
+ * previously, then an array will be returned that contains the term id and the
+ * contents of what is returned. The keys of the array are 'term_id' and
+ * 'term_taxonomy_id' containing numeric values.
  *
- * It is assumed that the term does not yet exist or the above will apply. The term will be first added to the term
- * table and then related to the taxonomy if everything is well. If everything is correct, then several actions
- * will be run prior to a filter and then several actions will be run after the filter is run.
+ * It is assumed that the term does not yet exist or the above will apply. The
+ * term will be first added to the term table and then related to the taxonomy
+ * if everything is well. If everything is correct, then several actions will be
+ * run prior to a filter and then several actions will be run after the filter
+ * is run.
  *
- * The arguments decide how the term is handled based on the $args parameter. The following
- * is a list of the available overrides and the defaults.
+ * The arguments decide how the term is handled based on the $args parameter.
+ * The following is a list of the available overrides and the defaults.
  *
- * 'alias_of'. There is no default, but if added, expected is the slug that the term will be an alias of.
- * Expected to be a string.
+ * 'alias_of'. There is no default, but if added, expected is the slug that the
+ * term will be an alias of. Expected to be a string.
  *
- * 'description'. There is no default. If exists, will be added to the database along with the term. Expected
- * to be a string.
+ * 'description'. There is no default. If exists, will be added to the database
+ * along with the term. Expected to be a string.
  *
- * 'parent'. Expected to be numeric and default is 0 (zero). Will assign value of 'parent' to the term.
+ * 'parent'. Expected to be numeric and default is 0 (zero). Will assign value
+ * of 'parent' to the term.
  *
  * 'slug'. Expected to be a string. There is no default.
  *
- * If 'slug' argument exists then the slug will be checked to see if it is not a valid term. If that check
- * succeeds (it is not a valid term), then it is added and the term id is given. If it fails, then a check
- * is made to whether the taxonomy is hierarchical and the parent argument is not empty. If the second check
- * succeeds, the term will be inserted and the term id will be given.
+ * If 'slug' argument exists then the slug will be checked to see if it is not
+ * a valid term. If that check succeeds (it is not a valid term), then it is
+ * added and the term id is given. If it fails, then a check is made to whether
+ * the taxonomy is hierarchical and the parent argument is not empty. If the
+ * second check succeeds, the term will be inserted and the term id will be
+ * given.
  *
  * @package WordPress
  * @subpackage Taxonomy
@@ -1169,6 +1215,9 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) {
        if ( is_int($term) && 0 == $term )
                return new WP_Error('invalid_term_id', __('Invalid term ID'));
 
+       if ( '' == trim($term) )
+               return new WP_Error('empty_term_name', __('A name is required for this term'));
+
        $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
        $args = wp_parse_args($args, $defaults);
        $args['name'] = $term;
@@ -1236,13 +1285,15 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) {
 }
 
 /**
- * wp_set_object_terms() - Create Term and Taxonomy Relationships
+ * Create Term and Taxonomy Relationships.
  *
- * Relates an object (post, link etc) to a term and taxonomy type. Creates the term and taxonomy
- * relationship if it doesn't already exist. Creates a term if it doesn't exist (using the slug).
+ * Relates an object (post, link etc) to a term and taxonomy type. Creates the
+ * term and taxonomy relationship if it doesn't already exist. Creates a term if
+ * it doesn't exist (using the slug).
  *
- * A relationship means that the term is grouped in or belongs to the taxonomy. A term has no
- * meaning until it is given context by defining which taxonomy it exists under.
+ * A relationship means that the term is grouped in or belongs to the taxonomy.
+ * A term has no meaning until it is given context by defining which taxonomy it
+ * exists under.
  *
  * @package WordPress
  * @subpackage Taxonomy
@@ -1295,7 +1346,7 @@ function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) {
                $delete_terms = array_diff($old_terms, $tt_ids);
                if ( $delete_terms ) {
                        $in_delete_terms = "'" . implode("', '", $delete_terms) . "'";
-                       $wpdb->query("DELETE FROM $wpdb->term_relationships WHERE object_id = '$object_id' AND term_taxonomy_id IN ($in_delete_terms)");
+                       $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id IN ($in_delete_terms)", $object_id) );
                        wp_update_term_count($delete_terms, $taxonomy);
                }
        }
@@ -1304,10 +1355,10 @@ function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) {
        if ( ! $append && isset($t->sort) && $t->sort ) {
                $values = array();
                $term_order = 0;
-               $final_term_ids = wp_get_object_terms($object_id, $taxonomy, 'fields=tt_ids');
-               foreach ( $term_ids as $term_id )
-                       if ( in_array($term_id, $final_term_ids) )
-                               $values[] = $wpdb->prepare( "(%d, %d, %d)", $object_id, $term_id, ++$term_order);
+               $final_tt_ids = wp_get_object_terms($object_id, $taxonomy, '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);
                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)");
        }
@@ -1316,17 +1367,17 @@ function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) {
 }
 
 /**
- * wp_unique_term_slug() - Will make slug unique, if it isn't already
+ * Will make slug unique, if it isn't already.
  *
- * The $slug has to be unique global to every taxonomy, meaning that one taxonomy
- * term can't have a matching slug with another taxonomy term. Each slug has to be
- * globally unique for every taxonomy.
+ * The $slug has to be unique global to every taxonomy, meaning that one
+ * taxonomy term can't have a matching slug with another taxonomy term. Each
+ * 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.
+ * 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.
  *
- * 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.
+ * 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.
  *
  * The only purpose for $term is for appending a parent, if one exists.
  *
@@ -1377,25 +1428,25 @@ function wp_unique_term_slug($slug, $term) {
 }
 
 /**
- * wp_update_term() - Update term based on arguments provided
+ * Update term based on arguments provided.
  *
- * The $args will indiscriminately override all values with the same field name. Care
- * must be taken to not override important information need to update or update will
- * fail (or perhaps create a new term, neither would be acceptable).
+ * The $args will indiscriminately override all values with the same field name.
+ * Care must be taken to not override important information need to update or
+ * update will fail (or perhaps create a new term, neither would be acceptable).
  *
- * Defaults will set 'alias_of', 'description', 'parent', and 'slug' if not defined
- * in $args already.
+ * Defaults will set 'alias_of', 'description', 'parent', and 'slug' if not
+ * defined in $args already.
  *
- * 'alias_of' will create a term group, if it doesn't already exist, and update it for
- * the $term.
+ * 'alias_of' will create a term group, if it doesn't already exist, and update
+ * it for the $term.
  *
- * If the 'slug' argument in $args is missing, then the 'name' in $args will be used.
- * It should also be noted that if you set 'slug' and it isn't unique then a WP_Error
- * will be passed back. If you don't pass any slug, then a unique one will be created
- * for you.
+ * If the 'slug' argument in $args is missing, then the 'name' in $args will be
+ * used. It should also be noted that if you set 'slug' and it isn't unique then
+ * a WP_Error will be passed back. If you don't pass any slug, then a unique one
+ * will be created for you.
  *
- * For what can be overrode in $args, check the term scheme can contain and stay away
- * from the term keys.
+ * For what can be overrode in $args, check the term scheme can contain and stay
+ * away from the term keys.
  *
  * @package WordPress
  * @subpackage Taxonomy
@@ -1403,8 +1454,8 @@ function wp_unique_term_slug($slug, $term) {
  *
  * @uses $wpdb
  * @uses do_action() Will call both 'edit_term' and 'edit_$taxonomy' twice.
- * @uses apply_filters() Will call the 'term_id_filter' filter and pass the term id and
- *     taxonomy id.
+ * @uses apply_filters() Will call the 'term_id_filter' filter and pass the term
+ *     id and taxonomy id.
  *
  * @param int $term The ID of the term
  * @param string $taxonomy The context in which to relate the term to the object.
@@ -1437,6 +1488,9 @@ function wp_update_term( $term, $taxonomy, $args = array() ) {
        $name = stripslashes($name);
        $description = stripslashes($description);
 
+       if ( '' == trim($name) )
+               return new WP_Error('empty_term_name', __('A name is required for this term'));
+
        $empty_slug = false;
        if ( empty($slug) ) {
                $empty_slug = true;
@@ -1490,8 +1544,14 @@ function wp_update_term( $term, $taxonomy, $args = array() ) {
        return array('term_id' => $term_id, 'term_taxonomy_id' => $tt_id);
 }
 
-// enable or disable term count deferring
-// if no value is supplied, the current value of the defer setting is returned
+/**
+ * Enable or disable term counting.
+ *
+ * @since 2.6
+ *
+ * @param bool $defer Optional.
+ * @return bool
+ */
 function wp_defer_term_counting($defer=NULL) {
        static $_defer = false;
 
@@ -1506,12 +1566,13 @@ function wp_defer_term_counting($defer=NULL) {
 }
 
 /**
- * wp_update_term_count() - Updates the amount of terms in taxonomy
+ * Updates the amount of terms in taxonomy.
  *
- * If there is a taxonomy callback applyed, then it will be called for updating the count.
+ * If there is a taxonomy callback applyed, then it will be called for updating
+ * the count.
  *
- * The default action is to count what the amount of terms have the relationship of term ID.
- * Once that is done, then update the database.
+ * The default action is to count what the amount of terms have the relationship
+ * of term ID. Once that is done, then update the database.
  *
  * @package WordPress
  * @subpackage Taxonomy
@@ -1548,6 +1609,15 @@ function wp_update_term_count( $terms, $taxonomy, $do_deferred=false ) {
        return wp_update_term_count_now( $terms, $taxonomy );
 }
 
+/**
+ * Perform term count update immediately.
+ *
+ * @since 2.6
+ *
+ * @param array $terms IDs of Terms to update.
+ * @param string $taxonomy The context of the term.
+ * @return bool Always true when complete.
+ */
 function wp_update_term_count_now( $terms, $taxonomy ) {
        global $wpdb;
 
@@ -1574,11 +1644,13 @@ function wp_update_term_count_now( $terms, $taxonomy ) {
 // Cache
 //
 
+
 /**
- * clean_object_term_cache() - Removes the taxonomy relationship to terms from the cache.
+ * Removes the taxonomy relationship to terms from the cache.
  *
- * Will remove the entire taxonomy relationship containing term $object_id. The term IDs
- * have to exist within the taxonomy $object_type for the deletion to take place.
+ * Will remove the entire taxonomy relationship containing term $object_id. The
+ * term IDs have to exist within the taxonomy $object_type for the deletion to
+ * take place.
  *
  * @package WordPress
  * @subpackage Taxonomy
@@ -1602,8 +1674,9 @@ function clean_object_term_cache($object_ids, $object_type) {
        do_action('clean_object_term_cache', $object_ids, $object_type);
 }
 
+
 /**
- * clean_term_cache() - Will remove all of the term ids from the cache
+ * Will remove all of the term ids from the cache.
  *
  * @package WordPress
  * @subpackage Taxonomy
@@ -1647,8 +1720,9 @@ function clean_term_cache($ids, $taxonomy = '') {
        do_action('clean_term_cache', $ids, $taxonomy);
 }
 
+
 /**
- * get_object_term_cache() - Retrieves the taxonomy relationship to the term object id.
+ * Retrieves the taxonomy relationship to the term object id.
  *
  * @package WordPress
  * @subpackage Taxonomy
@@ -1665,19 +1739,19 @@ function &get_object_term_cache($id, $taxonomy) {
        return $cache;
 }
 
+
 /**
- * update_object_term_cache() - Updates the cache for Term ID(s)
+ * Updates the cache for Term ID(s).
  *
  * Will only update the cache for terms not already cached.
  *
- * The $object_ids expects that the ids be separated by commas, if it is
- * string.
+ * The $object_ids expects that the ids be separated by commas, if it is a
+ * string.
  *
- * It should be noted that update_object_term_cache() is very time extensive.
- * It is advised that the function is not called very often or at least not
- * for a lot of terms that exist in a lot of taxonomies. The amount of time
- * increases for each term and it also increases for each taxonomy the term
- * belongs to.
+ * It should be noted that update_object_term_cache() is very time extensive. It
+ * is advised that the function is not called very often or at least not for a
+ * lot of terms that exist in a lot of taxonomies. The amount of time increases
+ * for each term and it also increases for each taxonomy the term belongs to.
  *
  * @package WordPress
  * @subpackage Taxonomy
@@ -1735,8 +1809,9 @@ function update_object_term_cache($object_ids, $object_type) {
        }
 }
 
+
 /**
- * update_term_cache() - Updates Terms to Taxonomy in cache.
+ * Updates Terms to Taxonomy in cache.
  *
  * @package WordPress
  * @subpackage Taxonomy
@@ -1759,16 +1834,17 @@ function update_term_cache($terms, $taxonomy = '') {
 // Private
 //
 
+
 /**
- * _get_term_hierarchy() - Retrieves children of taxonomy
+ * Retrieves children of taxonomy.
  *
  * @package WordPress
  * @subpackage Taxonomy
  * @access private
  * @since 2.3
  *
- * @uses update_option() Stores all of the children in "$taxonomy_children" option.
- *     That is the name of the taxonomy, immediately followed by '_children'.
+ * @uses update_option() Stores all of the children in "$taxonomy_children"
+ *      option. That is the name of the taxonomy, immediately followed by '_children'.
  *
  * @param string $taxonomy Taxonomy Name
  * @return array Empty if $taxonomy isn't hierarachical or returns children.
@@ -1791,11 +1867,13 @@ function _get_term_hierarchy($taxonomy) {
        return $children;
 }
 
+
 /**
- * _get_term_children() - Get array of child terms
+ * Get array of child terms.
  *
- * If $terms is an array of objects, then objects will returned from the function.
- * If $terms is an array of IDs, then an array of ids of children will be returned.
+ * If $terms is an array of objects, then objects will returned from the
+ * function. If $terms is an array of IDs, then an array of ids of children will
+ * be returned.
  *
  * @package WordPress
  * @subpackage Taxonomy
@@ -1847,11 +1925,12 @@ function &_get_term_children($term_id, $terms, $taxonomy) {
        return $term_list;
 }
 
+
 /**
- * _pad_term_counts() - Add count of children to parent count
+ * Add count of children to parent count.
  *
- * Recalculates term counts by including items from child terms.
- * Assumes all relevant children are already in the $terms argument
+ * Recalculates term counts by including items from child terms. Assumes all
+ * relevant children are already in the $terms argument.
  *
  * @package WordPress
  * @subpackage Taxonomy
@@ -1911,9 +1990,10 @@ function _pad_term_counts(&$terms, $taxonomy) {
 //
 
 /**
- * _update_post_term_count() - Will update term count based on posts
+ * Will update term count based on posts.
  *
- * Private function for the default callback for post_tag and category taxonomies.
+ * Private function for the default callback for post_tag and category
+ * taxonomies.
  *
  * @package WordPress
  * @subpackage Taxonomy
@@ -1932,8 +2012,11 @@ function _update_post_term_count( $terms ) {
        }
 }
 
+
 /**
- * get_term_link() - Generates a permalink for a taxonomy term archive
+ * Generates a permalink for a taxonomy term archive.
+ *
+ * @since 2.6
  *
  * @param object|int|string $term
  * @param string $taxonomy
@@ -1976,6 +2059,24 @@ function get_term_link( $term, $taxonomy ) {
        return apply_filters('term_link', $termlink, $term, $taxonomy);
 }
 
+/**
+ * Display the taxonomies of a post with available options.
+ *
+ * This function can be used within the loop to display the taxonomies for a
+ * post without specifying the Post ID. You can also use it outside the Loop to
+ * display the taxonomies for a specific post.
+ *
+ * The available defaults are:
+ * 'post' : default is 0. The post ID to get taxonomies of.
+ * 'before' : default is empty string. Display before taxonomies list.
+ * 'sep' : default is empty string. Separate every taxonomy with value in this.
+ * 'after' : default is empty string. Display this after the taxonomies list.
+ *
+ * @since 2.6
+ * @uses get_the_taxonomies()
+ *
+ * @param array $args Override the defaults.
+ */
 function the_taxonomies($args = array()) {
        $defaults = array(
                'post' => 0,
@@ -1990,6 +2091,17 @@ function the_taxonomies($args = array()) {
        echo $before . join($sep, get_the_taxonomies($post)) . $after;
 }
 
+/**
+ * Retrieve all taxonomies associated with a post.
+ *
+ * This function can be used within the loop. It will also return an array of
+ * the taxonomies with links to the taxonomy and name.
+ *
+ * @since 2.6
+ *
+ * @param int $post Optional. Post ID or will use Global Post ID (in loop).
+ * @return array
+ */
 function get_the_taxonomies($post = 0) {
        if ( is_int($post) )
                $post =& get_post($post);
@@ -2027,10 +2139,19 @@ function get_the_taxonomies($post = 0) {
        return $taxonomies;
 }
 
+/**
+ * Retrieve all taxonomies of a post with just the names.
+ *
+ * @since 2.6
+ * @uses get_object_taxonomies()
+ *
+ * @param int $post Optional. Post ID
+ * @return array
+ */
 function get_post_taxonomies($post = 0) {
        $post =& get_post($post);
 
        return get_object_taxonomies($post);
 }
 
-?>
+?>
\ No newline at end of file
index e2a24f204fcfa6d1b9c5e05f965f7449e0c5f234..9fd4ffe5171d860ea89aeff68b7886badcd20087 100644 (file)
@@ -20,6 +20,9 @@ if ( defined('WP_USE_THEMES') && constant('WP_USE_THEMES') ) {
        } 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;
@@ -39,9 +42,6 @@ if ( defined('WP_USE_THEMES') && constant('WP_USE_THEMES') ) {
        } else if ( is_tag() && $template = get_tag_template()) {
                include($template);
                return;
-       } else if ( is_tax() && $template = get_taxonomy_template()) {
-               include($template);
-               return;
        } else if ( is_author() && $template = get_author_template() ) {
                include($template);
                return;
index 984b4ee222e57dcf03e7ddff8234c723ea4d99f1..2ed733582d424db9d57ef85a3bb2854a70cdf8b8 100644 (file)
@@ -128,8 +128,8 @@ function get_themes() {
        $themes = array();
        $wp_broken_themes = array();
        $theme_loc = $theme_root = get_theme_root();
-       if ( '/' != ABSPATH ) // don't want to replace all forward slashes, see Trac #4541
-               $theme_loc = str_replace(ABSPATH, '', $theme_root);
+       if ( '/' != WP_CONTENT_DIR ) // don't want to replace all forward slashes, see Trac #4541
+               $theme_loc = str_replace(WP_CONTENT_DIR, '', $theme_root);
 
        // Files in wp-content/themes directory and one subdir down
        $themes_dir = @ opendir($theme_root);
@@ -333,11 +333,11 @@ function get_current_theme() {
 }
 
 function get_theme_root() {
-       return apply_filters('theme_root', ABSPATH . "wp-content/themes");
+       return apply_filters('theme_root', WP_CONTENT_DIR . "/themes");
 }
 
 function get_theme_root_uri() {
-       return apply_filters('theme_root_uri', get_option('siteurl') . "/wp-content/themes", get_option('siteurl'));
+       return apply_filters('theme_root_uri', content_url('themes'), get_option('siteurl'));
 }
 
 function get_query_template($type) {
@@ -419,7 +419,7 @@ function get_page_template() {
        if ( 'default' == $template )
                $template = '';
 
-       if ( !empty($template) && file_exists(TEMPLATEPATH . "/$template") )
+       if ( !empty($template) && !validate_file($template) && file_exists(TEMPLATEPATH . "/$template") )
                $template = TEMPLATEPATH . "/$template";
        elseif ( file_exists(TEMPLATEPATH . "/page.php") )
                $template = TEMPLATEPATH . "/page.php";
@@ -479,6 +479,53 @@ function locale_stylesheet() {
        echo '<link rel="stylesheet" href="' . $stylesheet . '" type="text/css" media="screen" />';
 }
 
+function preview_theme() {
+       if ( ! (isset($_GET['template']) && isset($_GET['preview'])) )
+               return;
+
+       if ( !current_user_can( 'switch_themes' ) )
+               return;
+
+       $_GET[template] = preg_replace('|[^a-z0-9_.-]|i', '', $_GET[template]);
+
+       if ( validate_file($_GET[template]) )
+               return;
+
+       add_filter('template', create_function('', "return '$_GET[template]';") );
+
+       if ( isset($_GET['stylesheet']) ) {
+               $_GET[stylesheet] = preg_replace('|[^a-z0-9_.-]|i', '', $_GET[stylesheet]);
+               if ( validate_file($_GET[stylesheet]) )
+                       return;
+               add_filter('stylesheet', create_function('', "return '$_GET[stylesheet]';") );
+       }
+
+       ob_start( 'preview_theme_ob_filter' );
+}
+add_action('setup_theme', 'preview_theme');
+
+function preview_theme_ob_filter( $content ) {
+       return preg_replace_callback( "|(<a.*?href=([\"']))(.*?)([\"'].*?>)|", 'preview_theme_ob_filter_callback', $content );
+}
+
+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], '/feed/') )
+       ||
+               ( false !== strpos($matches[3], '/trackback/') )
+       )
+               return $matches[1] . "#$matches[2] onclick=$matches[2]return false;" . $matches[4];
+
+       $link = add_query_arg( array('preview' => 1, 'template' => $_GET['template'], 'stylesheet' => @$_GET['stylesheet'] ), $matches[3] );
+       if ( 0 === strpos($link, 'preview=1') )
+               $link = "?$link";
+       return $matches[1] . attribute_escape( $link ) . $matches[4];
+}
+
 function switch_theme($template, $stylesheet) {
        update_option('template', $template);
        update_option('stylesheet', $stylesheet);
index 297bcbdeb3cf8308c966f4afbfa6d39bd160e466..beeee9fcfe2913700b0e5f807a893ddf9307fd67 100644 (file)
@@ -10,7 +10,7 @@
  * wp_version_check() - Check WordPress version against the newest version.
  *
  * The WordPress version, PHP version, and Locale is sent. Checks against the WordPress server at
- * api.wordpress.org server. Will only check if PHP has fsockopen enabled and WordPress isn't installing.
+ * api.wordpress.org. Will only check if PHP has fsockopen enabled and WordPress isn't installing.
  *
  * @package WordPress
  * @since 2.3
@@ -19,7 +19,7 @@
  * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
  */
 function wp_version_check() {
-       if ( !function_exists('fsockopen') || strpos($_SERVER['PHP_SELF'], 'install.php') !== false || defined('WP_INSTALLING') )
+       if ( !function_exists('fsockopen') || defined('WP_INSTALLING') )
                return;
 
        global $wp_version;
@@ -69,7 +69,105 @@ function wp_version_check() {
        }
        update_option( 'update_core', $new_option );
 }
-
 add_action( 'init', 'wp_version_check' );
 
-?>
\ No newline at end of file
+/**
+ * wp_update_plugins() - Check plugin versions against the latest versions hosted on WordPress.org.
+ *
+ * The WordPress version, PHP version, and Locale is sent along with a list of all plugins installed.
+ * Checks against the WordPress server at api.wordpress.org.
+ * Will only check if PHP has fsockopen enabled and WordPress isn't installing.
+ *
+ * @package WordPress
+ * @since 2.3
+ * @uses $wp_version Used to notidy the WordPress version.
+ *
+ * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
+ */
+function wp_update_plugins() {
+       global $wp_version;
+
+       if ( !function_exists('fsockopen') || defined('WP_INSTALLING') )
+               return false;
+
+       // If running blog-side, bail unless we've not checked in the last 12 hours
+       if ( !function_exists( 'get_plugins' ) )
+               require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
+
+       $plugins = get_plugins();
+       $active  = get_option( 'active_plugins' );
+       $current = get_option( 'update_plugins' );
+
+       $new_option = '';
+       $new_option->last_checked = time();
+       $time_not_changed = isset( $current->last_checked ) && 43200 > ( time() - $current->last_checked );
+
+       $plugin_changed = false;
+       foreach ( $plugins as $file => $p ) {
+               $new_option->checked[ $file ] = $p['Version'];
+
+               if ( !isset( $current->checked[ $file ] ) ) {
+                       $plugin_changed = true;
+                       continue;
+               }
+
+               if ( strval($current->checked[ $file ]) !== strval($p['Version']) )
+                       $plugin_changed = true;
+       }
+
+       foreach ( (array) $current->response as $plugin_file => $update_details ) {
+               if ( ! isset($plugins[ $plugin_file ]) ) {
+                       $plugin_changed = true;
+               }
+       }
+
+       // Bail if we've checked in the last 12 hours and if nothing has changed
+       if ( $time_not_changed && !$plugin_changed )
+               return false;
+
+       $to_send->plugins = $plugins;
+       $to_send->active = $active;
+       $send = serialize( $to_send );
+
+       $request = 'plugins=' . urlencode( $send );
+       $http_request  = "POST /plugins/update-check/1.0/ HTTP/1.0\r\n";
+       $http_request .= "Host: api.wordpress.org\r\n";
+       $http_request .= "Content-Type: application/x-www-form-urlencoded; charset=" . get_option('blog_charset') . "\r\n";
+       $http_request .= "Content-Length: " . strlen($request) . "\r\n";
+       $http_request .= 'User-Agent: WordPress/' . $wp_version . '; ' . get_bloginfo('url') . "\r\n";
+       $http_request .= "\r\n";
+       $http_request .= $request;
+
+       $response = '';
+       if( false != ( $fs = @fsockopen( 'api.wordpress.org', 80, $errno, $errstr, 3) ) && is_resource($fs) ) {
+               fwrite($fs, $http_request);
+
+               while ( !feof($fs) )
+                       $response .= fgets($fs, 1160); // One TCP-IP packet
+               fclose($fs);
+               $response = explode("\r\n\r\n", $response, 2);
+       }
+
+       $response = unserialize( $response[1] );
+
+       if ( $response )
+               $new_option->response = $response;
+
+       update_option( 'update_plugins', $new_option );
+}
+
+function _maybe_update_plugins() {
+       $current = get_option( 'update_plugins' );
+       if ( isset( $current->last_checked ) && 43200 > ( time() - $current->last_checked ) )
+               return;
+       wp_update_plugins();
+}
+
+add_action( 'load-plugins.php', 'wp_update_plugins' );
+add_action( 'admin_init', '_maybe_update_plugins' );
+add_action( 'wp_update_plugins', 'wp_update_plugins' );
+
+if ( !wp_next_scheduled('wp_update_plugins') )
+       wp_schedule_event(time(), 'twicedaily', 'wp_update_plugins');
+
+?>
index c861be0311fbd5b0eecdb7c7ab4f0235e28d6309..f7988638fe1c1f3dddea81398d05989c7fcc8c16 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function wp_signon( $credentials = '' ) {
+function wp_signon( $credentials = '', $secure_cookie = '' ) {
        if ( empty($credentials) ) {
                if ( ! empty($_POST['log']) )
                        $credentials['user_login'] = $_POST['log'];
@@ -21,13 +21,21 @@ function wp_signon( $credentials = '' ) {
 
        do_action_ref_array('wp_authenticate', array(&$credentials['user_login'], &$credentials['user_password']));
 
+       if ( '' === $secure_cookie )
+               $secure_cookie = is_ssl() ? true : false;
+       
        // If no credential info provided, check cookie.
        if ( empty($credentials['user_login']) && empty($credentials['user_password']) ) {
                        $user = wp_validate_auth_cookie();
                        if ( $user )
                                return new WP_User($user);
 
-                       if ( !empty($_COOKIE[AUTH_COOKIE]) )
+                       if ( $secure_cookie )
+                               $auth_cookie = SECURE_AUTH_COOKIE;
+                       else
+                               $auth_cookie = AUTH_COOKIE;
+
+                       if ( !empty($_COOKIE[$auth_cookie]) )
                                return new WP_Error('expired_session', __('Please log in again.'));
 
                        // If the cookie is not set, be silent.
@@ -48,7 +56,7 @@ function wp_signon( $credentials = '' ) {
        if ( is_wp_error($user) )
                return $user;
 
-       wp_set_auth_cookie($user->ID, $credentials['remember']);
+       wp_set_auth_cookie($user->ID, $credentials['remember'], $secure_cookie);
        do_action('wp_login', $credentials['user_login']);
        return $user;
 }
@@ -57,13 +65,13 @@ function get_profile($field, $user = false) {
        global $wpdb;
        if ( !$user )
                $user = $wpdb->escape($_COOKIE[USER_COOKIE]);
-       return $wpdb->get_var("SELECT $field FROM $wpdb->users WHERE user_login = '$user'");
+       return $wpdb->get_var( $wpdb->prepare("SELECT $field FROM $wpdb->users WHERE user_login = %s", $user) );
 }
 
 function get_usernumposts($userid) {
        global $wpdb;
        $userid = (int) $userid;
-       return $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '$userid' AND post_type = 'post' AND " . get_private_posts_cap_sql('post'));
+       return $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = %d AND post_type = 'post' AND ", $userid) . get_private_posts_cap_sql('post'));
 }
 
 // TODO: xmlrpc only.  Maybe move to xmlrpc.php.
@@ -130,9 +138,9 @@ function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) {
        $meta_value = trim( $meta_value );
 
        if ( ! empty($meta_value) )
-               $wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = '$user_id' AND meta_key = '$meta_key' AND meta_value = '$meta_value'");
+               $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s AND meta_value = %s", $userid, $meta_key, $meta_value) );
        else
-               $wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = '$user_id' AND meta_key = '$meta_key'");
+               $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');
 
@@ -183,19 +191,18 @@ function update_usermeta( $user_id, $meta_key, $meta_value ) {
        if ( is_string($meta_value) )
                $meta_value = stripslashes($meta_value);
        $meta_value = maybe_serialize($meta_value);
-       $meta_value = $wpdb->escape($meta_value);
 
        if (empty($meta_value)) {
                return delete_usermeta($user_id, $meta_key);
        }
 
-       $cur = $wpdb->get_row("SELECT * FROM $wpdb->usermeta WHERE user_id = '$user_id' AND meta_key = '$meta_key'");
+       $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
        if ( !$cur ) {
-               $wpdb->query("INSERT INTO $wpdb->usermeta ( user_id, meta_key, meta_value )
+               $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->usermeta ( user_id, meta_key, meta_value )
                VALUES
-               ( '$user_id', '$meta_key', '$meta_value' )");
+               ( %d, %s, %s )", $user_id, $meta_key, $meta_value) );
        } else if ( $cur->meta_value != $meta_value ) {
-               $wpdb->query("UPDATE $wpdb->usermeta SET meta_value = '$meta_value' WHERE user_id = '$user_id' AND meta_key = '$meta_key'");
+               $wpdb->query( $wpdb->prepare("UPDATE $wpdb->usermeta SET meta_value = %s WHERE user_id = %d AND meta_key = %s", $meta_value, $user_id, $meta_key) );
        } else {
                return false;
        }
index 77e9ca3e7658e9cf91cc25be5a262d59665fb330..dcb659dc7ec2d3daba548211f52b6b52ab74f6b0 100644 (file)
@@ -34,10 +34,12 @@ if ( is_admin() ) {
 }
 
 // Simple browser detection
-$is_lynx = $is_gecko = $is_winIE = $is_macIE = $is_opera = $is_NS4 = false;
+$is_lynx = $is_gecko = $is_winIE = $is_macIE = $is_opera = $is_NS4 = $is_safari = false;
 
 if (strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx') !== false) {
        $is_lynx = true;
+} elseif ( strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'webkit') !== false ) {
+       $is_safari = true;
 } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') !== false) {
        $is_gecko = true;
 } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Win') !== false) {
@@ -66,4 +68,4 @@ $is_apache = ((strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false) || (strp
  */
 $is_IIS = (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false) ? true : false;
 
-?>
\ No newline at end of file
+?>
index 5aaa15eb981eb122f8fc07d0c6bf30608602a5da..d532c5262ce727d725b6727d201e283af6a16952 100644 (file)
@@ -8,14 +8,13 @@
  *
  * @global string $wp_version
  */
-$wp_version = '2.5.1';
+$wp_version = '2.6.2';
 
 /**
- * Holds the WordPress DB revision, increments when changes are made to the WordPress DB scheme
- * changes.
+ * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
  *
  * @global int $wp_db_version
  */
-$wp_db_version = 7796;
+$wp_db_version = 8204;
 
 ?>
index 9fa26306f8a16513051d4bff684f6551a64540b3..73e1f6e8ca681f55cf997f78167a92010e001eaf 100644 (file)
@@ -57,7 +57,7 @@ function register_sidebar($args = array()) {
                'after_title' => "</h2>\n",
        );
 
-       $sidebar = array_merge($defaults, $args);
+       $sidebar = array_merge($defaults, (array) $args);
 
        $wp_registered_sidebars[$sidebar['id']] = $sidebar;
 
@@ -95,6 +95,8 @@ function register_sidebar_widget($name, $output_callback, $classname = '') {
 function wp_register_sidebar_widget($id, $name, $output_callback, $options = array()) {
        global $wp_registered_widgets;
 
+       $id = strtolower($id);
+
        if ( empty($output_callback) ) {
                unset($wp_registered_widgets[$id]);
                return;
@@ -164,6 +166,8 @@ function register_widget_control($name, $control_callback, $width = '', $height
  */
 function wp_register_widget_control($id, $name, $control_callback, $options = array()) {
        global $wp_registered_widget_controls;
+       
+       $id = strtolower($id);
 
        if ( empty($control_callback) ) {
                unset($wp_registered_widget_controls[$id]);
@@ -306,9 +310,9 @@ function wp_get_sidebars_widgets($update = true) {
                                        $_sidebars_widgets[$index][$i] = $id;
                                        continue;
                                }
-                               
+
                                $found = false;
-                               
+
                                foreach ( $wp_registered_widgets as $widget_id => $widget ) {
                                        if ( strtolower($widget['name']) == strtolower($name) ) {
                                                $_sidebars_widgets[$index][$i] = $widget['id'];
@@ -320,10 +324,10 @@ function wp_get_sidebars_widgets($update = true) {
                                                break;
                                        }
                                }
-                               
+
                                if ( $found )
                                        continue;
-                               
+
                                unset($_sidebars_widgets[$index][$i]);
                        }
                        $_sidebars_widgets['array_version'] = 2;
@@ -381,7 +385,7 @@ function wp_widget_pages( $args ) {
        extract( $args );
        $options = get_option( 'widget_pages' );
 
-       $title = empty( $options['title'] ) ? __( 'Pages' ) : $options['title'];
+       $title = empty( $options['title'] ) ? __( 'Pages' ) : apply_filters('widget_title', $options['title']);
        $sortby = empty( $options['sortby'] ) ? 'menu_order' : $options['sortby'];
        $exclude = empty( $options['exclude'] ) ? '' : $options['exclude'];
 
@@ -448,25 +452,31 @@ function wp_widget_links($args) {
        extract($args, EXTR_SKIP);
 
        $before_widget = preg_replace('/id="[^"]*"/','id="%id"', $before_widget);
-       wp_list_bookmarks(array(
+       wp_list_bookmarks(apply_filters('widget_links_args', array(
                'title_before' => $before_title, 'title_after' => $after_title,
                'category_before' => $before_widget, 'category_after' => $after_widget,
                'show_images' => true, 'class' => 'linkcat widget'
-       ));
+       )));
 }
 
 function wp_widget_search($args) {
        extract($args);
-?>
-               <?php echo $before_widget; ?>
-                       <form id="searchform" method="get" action="<?php bloginfo('home'); ?>">
-                       <div>
-                       <input type="text" name="s" id="s" size="15" /><br />
+       $searchform_template = get_template_directory() . '/searchform.php';
+       
+       echo $before_widget;
+       
+       // Use current theme search form if it exists
+       if ( file_exists($searchform_template) ) {
+               include_once($searchform_template);
+       } else { ?>
+               <form id="searchform" method="get" action="<?php bloginfo('url'); ?>/"><div>
+                       <label class="hidden" for="s"><?php _e('Search for:'); ?></label>
+                       <input type="text" name="s" id="s" size="15" value="<?php the_search_query(); ?>" />
                        <input type="submit" value="<?php echo attribute_escape(__('Search')); ?>" />
-                       </div>
-                       </form>
-               <?php echo $after_widget; ?>
-<?php
+               </div></form>
+       <?php }
+       
+       echo $after_widget;
 }
 
 function wp_widget_archives($args) {
@@ -474,7 +484,7 @@ function wp_widget_archives($args) {
        $options = get_option('widget_archives');
        $c = $options['count'] ? '1' : '0';
        $d = $options['dropdown'] ? '1' : '0';
-       $title = empty($options['title']) ? __('Archives') : $options['title'];
+       $title = empty($options['title']) ? __('Archives') : apply_filters('widget_title', $options['title']);
 
        echo $before_widget;
        echo $before_title . $title . $after_title;
@@ -522,7 +532,7 @@ function wp_widget_archives_control() {
 function wp_widget_meta($args) {
        extract($args);
        $options = get_option('widget_meta');
-       $title = empty($options['title']) ? __('Meta') : $options['title'];
+       $title = empty($options['title']) ? __('Meta') : apply_filters('widget_title', $options['title']);
 ?>
                <?php echo $before_widget; ?>
                        <?php echo $before_title . $title . $after_title; ?>
@@ -556,7 +566,7 @@ function wp_widget_meta_control() {
 function wp_widget_calendar($args) {
        extract($args);
        $options = get_option('widget_calendar');
-       $title = $options['title'];
+       $title = apply_filters('widget_title', $options['title']);
        if ( empty($title) )
                $title = '&nbsp;';
        echo $before_widget . $before_title . $title . $after_title;
@@ -593,7 +603,7 @@ function wp_widget_text($args, $widget_args = 1) {
        if ( !isset($options[$number]) )
                return;
 
-       $title = $options[$number]['title'];
+       $title = apply_filters('widget_title', $options[$number]['title']);
        $text = apply_filters( 'widget_text', $options[$number]['text'] );
 ?>
                <?php echo $before_widget; ?>
@@ -705,15 +715,16 @@ function wp_widget_categories($args, $widget_args = 1) {
        $h = $options[$number]['hierarchical'] ? '1' : '0';
        $d = $options[$number]['dropdown'] ? '1' : '0';
 
-       $title = empty($options[$number]['title']) ? __('Categories') : $options[$number]['title'];
+       $title = empty($options[$number]['title']) ? __('Categories') : apply_filters('widget_title', $options[$number]['title']);
 
        echo $before_widget;
        echo $before_title . $title . $after_title;
 
-       $cat_args = "orderby=name&show_count={$c}&hierarchical={$h}";
+       $cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h);
 
        if ( $d ) {
-               wp_dropdown_categories($cat_args . '&show_option_none= ' . __('Select Category'));
+               $cat_args['show_option_none'] = __('Select Category');
+               wp_dropdown_categories($cat_args);
 ?>
 
 <script type='text/javascript'>
@@ -732,7 +743,10 @@ function wp_widget_categories($args, $widget_args = 1) {
        } else {
 ?>
                <ul>
-               <?php wp_list_categories($cat_args . '&title_li='); ?>
+               <?php 
+                       $cat_args['title_li'] = '';
+                       wp_list_categories($cat_args); 
+               ?>
                </ul>
 <?php
        }
@@ -890,7 +904,7 @@ function wp_widget_recent_entries($args) {
 
        extract($args);
        $options = get_option('widget_recent_entries');
-       $title = empty($options['title']) ? __('Recent Posts') : $options['title'];
+       $title = empty($options['title']) ? __('Recent Posts') : apply_filters('widget_title', $options['title']);
        if ( !$number = (int) $options['number'] )
                $number = 10;
        else if ( $number < 1 )
@@ -898,7 +912,7 @@ function wp_widget_recent_entries($args) {
        else if ( $number > 15 )
                $number = 15;
 
-       $r = new WP_Query("showposts=$number&what_to_show=posts&nopaging=0&post_status=publish");
+       $r = new WP_Query(array('showposts' => $number, 'what_to_show' => 'posts', 'nopaging' => 0, 'post_status' => 'publish'));
        if ($r->have_posts()) :
 ?>
                <?php echo $before_widget; ?>
@@ -955,7 +969,7 @@ function wp_widget_recent_comments($args) {
        global $wpdb, $comments, $comment;
        extract($args, EXTR_SKIP);
        $options = get_option('widget_recent_comments');
-       $title = empty($options['title']) ? __('Recent Comments') : $options['title'];
+       $title = empty($options['title']) ? __('Recent Comments') : apply_filters('widget_title', $options['title']);
        if ( !$number = (int) $options['number'] )
                $number = 5;
        else if ( $number < 1 )
@@ -1029,7 +1043,7 @@ function wp_widget_recent_comments_register() {
 function wp_widget_rss($args, $widget_args = 1) {
        extract($args, EXTR_SKIP);
        if ( is_numeric($widget_args) )
-               $widget_args = array( 'number' => $widegt_args );
+               $widget_args = array( 'number' => $widget_args );
        $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) );
        extract($widget_args, EXTR_SKIP);
 
@@ -1061,11 +1075,12 @@ function wp_widget_rss($args, $widget_args = 1) {
                $title = $desc;
        if ( empty($title) )
                $title = __('Unknown Feed');
+       $title = apply_filters('widget_title', $title );
        $url = clean_url(strip_tags($url));
        if ( file_exists(dirname(__FILE__) . '/rss.png') )
-               $icon = str_replace(ABSPATH, get_option('siteurl').'/', dirname(__FILE__)) . '/rss.png';
+               $icon = str_replace(ABSPATH, site_url() . '/', dirname(__FILE__)) . '/rss.png';
        else
-               $icon = get_option('siteurl').'/wp-includes/images/rss.png';
+               $icon = includes_url('images/rss.png');
        $title = "<a class='rsswidget' href='$url' title='" . attribute_escape(__('Syndicate this content')) ."'><img style='background:orange;color:white;border:none;' width='14' height='14' src='$icon' alt='RSS' /></a> <a class='rsswidget' href='$link' title='$desc'>$title</a>";
 
        echo $before_widget;
@@ -1110,18 +1125,11 @@ function wp_widget_rss_output( $rss, $args = array() ) {
                        if ( empty($title) )
                                $title = __('Untitled');
                        $desc = '';
-                               if ( isset( $item['description'] ) && is_string( $item['description'] ) )
-                                       $desc = str_replace(array("\n", "\r"), ' ', attribute_escape(strip_tags(html_entity_decode($item['description'], ENT_QUOTES))));
-                               elseif ( isset( $item['summary'] ) && is_string( $item['summary'] ) )
-                                       $desc = str_replace(array("\n", "\r"), ' ', attribute_escape(strip_tags(html_entity_decode($item['summary'], ENT_QUOTES))));
-
                        $summary = '';
                        if ( isset( $item['description'] ) && is_string( $item['description'] ) )
-                               $summary = $item['description'];
+                               $desc = $summary = str_replace(array("\n", "\r"), ' ', attribute_escape(strip_tags(html_entity_decode($item['description'], ENT_QUOTES))));
                        elseif ( isset( $item['summary'] ) && is_string( $item['summary'] ) )
-                               $summary = $item['summary'];
-
-                       $desc = str_replace(array("\n", "\r"), ' ', attribute_escape(strip_tags(html_entity_decode($summary, ENT_QUOTES))));
+                               $desc = $summary = str_replace(array("\n", "\r"), ' ', attribute_escape(strip_tags(html_entity_decode($item['summary'], ENT_QUOTES))));
 
                        if ( $show_summary ) {
                                $desc = '';
@@ -1140,7 +1148,7 @@ function wp_widget_rss_output( $rss, $args = array() ) {
 
                                if ( $date ) {
                                        if ( $date_stamp = strtotime( $date ) )
-                                               $date = '<span class="rss-date">' . date_i18n( get_option( 'date_format' ), $date_stamp ) . '</span>';
+                                               $date = ' <span class="rss-date">' . date_i18n( get_option( 'date_format' ), $date_stamp ) . '</span>';
                                        else
                                                $date = '';
                                }
@@ -1154,8 +1162,12 @@ function wp_widget_rss_output( $rss, $args = array() ) {
                                        $author = ' <cite>' . wp_specialchars( strip_tags( $item['author_name'] ) ) . '</cite>';
                        }
 
-                       echo "<li><a class='rsswidget' href='$link' title='$desc'>$title</a>{$date}{$summary}{$author}</li>";
-               }
+                       if ( $link == '' ) {
+                               echo "<li>$title{$date}{$summary}{$author}</li>"; 
+                       } else {
+                               echo "<li><a class='rsswidget' href='$link' title='$desc'>$title</a>{$date}{$summary}{$author}</li>"; 
+                       }
+}
                echo '</ul>';
        } else {
                echo '<ul><li>' . __( 'An error has occurred; the feed is probably down. Try again later.' ) . '</li></ul>';
@@ -1353,7 +1365,7 @@ function wp_widget_rss_register() {
 function wp_widget_tag_cloud($args) {
        extract($args);
        $options = get_option('widget_tag_cloud');
-       $title = empty($options['title']) ? __('Tags') : $options['title'];
+       $title = empty($options['title']) ? __('Tags') : apply_filters('widget_title', $options['title']);
 
        echo $before_widget;
        echo $before_title . $title . $after_title;
@@ -1496,7 +1508,7 @@ function widget_many_control( $widget_args = 1 ) {
                        $options[$widget_number] = array( 'something' => $something );  // Even simple widgets should store stuff in array, rather than in scalar
                }
 
-               update_option('widget_text', $options);
+               update_option('widget_many', $options);
 
                $updated = true; // So that we don't go through this more than once
        }
@@ -1538,8 +1550,8 @@ function widget_many_register() {
                // $id should look like {$id_base}-{$o}
                $id = "many-$o"; // Never never never translate an id
                $registered = true;
-               wp_register_sidebar_widget( $id, $name, 'wp_widget_text', $widget_ops, array( 'number' => $o ) );
-               wp_register_widget_control( $id, $name, 'wp_widget_text_control', $control_ops, array( 'number' => $o ) );
+               wp_register_sidebar_widget( $id, $name, 'widget_many', $widget_ops, array( 'number' => $o ) );
+               wp_register_widget_control( $id, $name, 'widget_many_control', $control_ops, array( 'number' => $o ) );
        }
 
        // If there are none, we register the widget's existance with a generic template
index 216c9cf027261e75d011e60d6393a1a8203abe8f..db44afe5d03aeaef2a1c5bb1c8e81172ed07740a 100644 (file)
 <?php
-//  WordPress DB Class
-
-//  ORIGINAL CODE FROM:
-//  Justin Vincent (justin@visunet.ie)
-//     http://php.justinvincent.com
-
+/**
+ * WordPress DB Class
+ *
+ * Original code from {@link http://php.justinvincent.com Justin Vincent (justin@visunet.ie)}
+ *
+ * @package WordPress
+ * @subpackage Database
+ * @since 0.71
+ */
+
+/**
+ * @since 0.71
+ */
 define('EZSQL_VERSION', 'WP1.25');
+
+/**
+ * @since 0.71
+ */
 define('OBJECT', 'OBJECT', true);
+
+/**
+ * @since {@internal Version Unknown}}
+ */
 define('OBJECT_K', 'OBJECT_K', false);
+
+/**
+ * @since 0.71
+ */
 define('ARRAY_A', 'ARRAY_A', false);
-define('ARRAY_N', 'ARRAY_N', false);
 
-if (!defined('SAVEQUERIES'))
-       define('SAVEQUERIES', false);
+/**
+ * @since 0.71
+ */
+define('ARRAY_N', 'ARRAY_N', false);
 
+/**
+ * WordPress Database Access Abstraction Object
+ *
+ * It is possible to replace this class with your own
+ * by setting the $wpdb global variable in wp-content/wpdb.php
+ * file with your class. You can name it wpdb also, since
+ * this file will not be included, if the other file is
+ * available.
+ *
+ * @link http://codex.wordpress.org/Function_Reference/wpdb_Class
+ *
+ * @package WordPress
+ * @subpackage Database
+ * @since 0.71
+ * @final
+ */
 class wpdb {
 
+       /**
+        * Whether to show SQL/DB errors
+        *
+        * @since 0.71
+        * @access private
+        * @var bool
+        */
        var $show_errors = false;
+
+       /**
+        * Whether to suppress errors during the DB bootstrapping.
+        *
+        * @access private
+        * @since {@internal Version Unknown}}
+        * @var bool
+        */
        var $suppress_errors = false;
+
+       /**
+        * The last error during query.
+        *
+        * @since {@internal Version Unknown}}
+        * @var string
+        */
        var $last_error = '';
+
+       /**
+        * Amount of queries made
+        *
+        * @since 1.2.0
+        * @access private
+        * @var int
+        */
        var $num_queries = 0;
+
+       /**
+        * Saved result of the last query made
+        *
+        * @since 1.2.0
+        * @access private
+        * @var array
+        */
        var $last_query;
+
+       /**
+        * Saved info on the table column
+        *
+        * @since 1.2.0
+        * @access private
+        * @var array
+        */
        var $col_info;
+
+       /**
+        * Saved queries that were executed
+        *
+        * @since 1.5.0
+        * @access private
+        * @var array
+        */
        var $queries;
+
+       /**
+        * WordPress table prefix
+        *
+        * You can set this to have multiple WordPress installations
+        * in a single database. The second reason is for possible
+        * security precautions.
+        *
+        * @since 0.71
+        * @access private
+        * @var string
+        */
        var $prefix = '';
+
+       /**
+        * Whether the database queries are ready to start executing.
+        *
+        * @since 2.5.0
+        * @access private
+        * @var bool
+        */
        var $ready = false;
 
-       // Our tables
+       /**
+        * WordPress Posts table
+        *
+        * @since 1.5.0
+        * @access public
+        * @var string
+        */
        var $posts;
+
+       /**
+        * WordPress Users table
+        *
+        * @since 1.5.0
+        * @access public
+        * @var string
+        */
        var $users;
+
+       /**
+        * WordPress Categories table
+        *
+        * @since 1.5.0
+        * @access public
+        * @var string
+        */
        var $categories;
+
+       /**
+        * WordPress Post to Category table
+        *
+        * @since 1.5.0
+        * @access public
+        * @var string
+        */
        var $post2cat;
+
+       /**
+        * WordPress Comments table
+        *
+        * @since 1.5.0
+        * @access public
+        * @var string
+        */
        var $comments;
+
+       /**
+        * WordPress Links table
+        *
+        * @since 1.5.0
+        * @access public
+        * @var string
+        */
        var $links;
+
+       /**
+        * WordPress Options table
+        *
+        * @since 1.5.0
+        * @access public
+        * @var string
+        */
        var $options;
+
+       /**
+        * WordPress Post Metadata table
+        *
+        * @since {@internal Version Unknown}}
+        * @access public
+        * @var string
+        */
        var $postmeta;
+
+       /**
+        * WordPress User Metadata table
+        *
+        * @since 2.3.0
+        * @access public
+        * @var string
+        */
        var $usermeta;
+
+       /**
+        * WordPress Terms table
+        *
+        * @since 2.3.0
+        * @access public
+        * @var string
+        */
        var $terms;
+
+       /**
+        * WordPress Term Taxonomy table
+        *
+        * @since 2.3.0
+        * @access public
+        * @var string
+        */
        var $term_taxonomy;
+
+       /**
+        * WordPress Term Relationships table
+        *
+        * @since 2.3.0
+        * @access public
+        * @var string
+        */
        var $term_relationships;
+
+       /**
+        * List of WordPress tables
+        *
+        * @since {@internal Version Unknown}}
+        * @access private
+        * @var array
+        */
        var $tables = array('users', 'usermeta', 'posts', 'categories', 'post2cat', 'comments', 'links', 'link2cat', 'options',
                        'postmeta', 'terms', 'term_taxonomy', 'term_relationships');
+
+       /**
+        * Database table columns charset
+        *
+        * @since 2.2.0
+        * @access public
+        * @var string
+        */
        var $charset;
+
+       /**
+        * Database table columns collate
+        *
+        * @since 2.2.0
+        * @access public
+        * @var string
+        */
        var $collate;
 
        /**
         * Connects to the database server and selects a database
-        * @param string $dbuser
-        * @param string $dbpassword
-        * @param string $dbname
-        * @param string $dbhost
+        *
+        * PHP4 compatibility layer for calling the PHP5 constructor.
+        *
+        * @uses wpdb::__construct() Passes parameters and returns result
+        * @since 0.71
+        *
+        * @param string $dbuser MySQL database user
+        * @param string $dbpassword MySQL database password
+        * @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);
        }
 
+       /**
+        * Connects to the database server and selects a database
+        *
+        * PHP5 style constructor for compatibility with PHP5. Does
+        * the actual setting up of the class properties and connection
+        * to the database.
+        *
+        * @since 2.0.8
+        *
+        * @param string $dbuser MySQL database user
+        * @param string $dbpassword MySQL database password
+        * @param string $dbname MySQL database name
+        * @param string $dbhost MySQL database host
+        */
        function __construct($dbuser, $dbpassword, $dbname, $dbhost) {
                register_shutdown_function(array(&$this, "__destruct"));
 
@@ -69,35 +317,63 @@ class wpdb {
 
                $this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword, true);
                if (!$this->dbh) {
-                       $this->bail("
+                       $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>$dbhost</code>. This could mean your host's database server is down.</p>
+<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*/, $dbhost));
                        return;
                }
 
                $this->ready = true;
 
-               if ( !empty($this->charset) && version_compare(mysql_get_server_info($this->dbh), '4.1.0', '>=') )
-                       $this->query("SET NAMES '$this->charset'");
-
+               if ( $this->supports_collation() ) {
+                       $collation_query = '';
+                       if ( !empty($this->charset) ) {
+                               $collation_query = "SET NAMES '{$this->charset}'";
+                               if (!empty($this->collate) )
+                                       $collation_query .= " COLLATE '{$this->collate}'";
+                       }
+                       
+                       if ( !empty($collation_query) )
+                               $this->query($collation_query);
+                       
+               }
+               
                $this->select($dbname);
        }
 
+       /**
+        * PHP5 style destructor and will run when database object is destroyed.
+        *
+        * @since 2.0.8
+        *
+        * @return bool Always true
+        */
        function __destruct() {
                return true;
        }
 
+       /**
+        * 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.
+        *
+        * @since 2.5.0
+        *
+        * @param string $prefix Alphanumeric name for the new prefix.
+        * @return string Old prefix
+        */
        function set_prefix($prefix) {
 
                if ( preg_match('|[^a-z0-9_]|i', $prefix) )
-                       return new WP_Error('invalid_db_prefix', 'Invalid database prefix'); // No gettext here
+                       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;
@@ -115,21 +391,28 @@ class wpdb {
        }
 
        /**
-        * Selects a database using the current class's $this->dbh
-        * @param string $db name
+        * Selects a database using the current database connection.
+        *
+        * The database name will be changed based on the current database
+        * connection. On failure, the execution will bail and display an DB error.
+        *
+        * @since 0.71
+        *
+        * @param string $db MySQL database name
+        * @return null Always null.
         */
        function select($db) {
                if (!@mysql_select_db($db, $this->dbh)) {
                        $this->ready = false;
-                       $this->bail("
+                       $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>$db</code> database.</p>
+<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>
 <li>Are you sure it exists?</li>
-<li>Does the user <code>".DB_USER."</code> have permission to use the <code>$db</code> database?</li>
+<li>Does the user <code>%2$s</code> have permission to use the <code>%1$s</code> database?</li>
 <li>On some systems the name of your database is prefixed with your username, so it would be like username_wordpress. Could that be the problem?</li>
 </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>");
+<p>If you don\'t know how to setup a database you should <strong>contact your host</strong>. If all else fails you may find help at the <a href="http://wordpress.org/support/">WordPress Support Forums</a>.</p>'/*/WP_I18N_DB_SELECT_DB*/, $db, DB_USER));
                        return;
                }
        }
@@ -137,6 +420,8 @@ class wpdb {
        /**
         * Escapes content for insertion into the database, for security
         *
+        * @since 0.71
+        *
         * @param string $string
         * @return string query safe string
         */
@@ -153,6 +438,9 @@ class wpdb {
 
        /**
         * Escapes content by reference for insertion into the database, for security
+        *
+        * @since 2.3.0
+        *
         * @param string $s
         */
        function escape_by_ref(&$s) {
@@ -160,10 +448,17 @@ class wpdb {
        }
 
        /**
-        * Prepares a SQL query for safe use, using sprintf() syntax
+        * Prepares a SQL query for safe use, using sprintf() syntax.
+        *
+        * @link http://php.net/sprintf See for syntax to use for query string.
+        * @since 2.3.0
+        *
+        * @param null|string $args If string, first parameter must be query statement
+        * @param mixed $args,... If additional parameters, they will be set inserted into the query.
+        * @return null|string Sanitized query string
         */
-       function prepare($args=NULL) {
-               if ( NULL === $args )
+       function prepare($args=null) {
+               if ( is_null( $args ) )
                        return;
                $args = func_get_args();
                $query = array_shift($args);
@@ -174,22 +469,28 @@ class wpdb {
                return @vsprintf($query, $args);
        }
 
-       // ==================================================================
-       //      Print SQL/DB error.
-
+       /**
+        * Print SQL/DB error.
+        *
+        * @since 0.71
+        * @global array $EZSQL_ERROR Stores error information of query and error string
+        *
+        * @param string $str The error to display
+        * @return bool False if the showing of errors is disabled.
+        */
        function print_error($str = '') {
                global $EZSQL_ERROR;
 
                if (!$str) $str = mysql_error($this->dbh);
-               $EZSQL_ERROR[] =
-               array ('query' => $this->last_query, 'error_str' => $str);
+               $EZSQL_ERROR[] = array ('query' => $this->last_query, 'error_str' => $str);
 
                if ( $this->suppress_errors )
                        return false;
 
-               $error_str = "WordPress database error $str for query $this->last_query";
                if ( $caller = $this->get_caller() )
-                       $error_str .= " made by $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);
 
                $log_error = true;
                if ( ! function_exists('error_log') )
@@ -216,39 +517,71 @@ class wpdb {
                </div>";
        }
 
-       // ==================================================================
-       //      Turn error handling on or off..
-
+       /**
+        * Enables showing of database errors.
+        *
+        * This function should be used only to enable showing of errors.
+        * wpdb::hide_errors() should be used instead for hiding of errors. However,
+        * this function can be used to enable and disable showing of database
+        * errors.
+        *
+        * @since 0.71
+        *
+        * @param bool $show Whether to show or hide errors
+        * @return bool Old value for showing errors.
+        */
        function show_errors( $show = true ) {
                $errors = $this->show_errors;
                $this->show_errors = $show;
                return $errors;
        }
 
+       /**
+        * Disables showing of database errors.
+        *
+        * @since 0.71
+        *
+        * @return bool Whether showing of errors was active or not
+        */
        function hide_errors() {
                $show = $this->show_errors;
                $this->show_errors = false;
                return $show;
        }
 
+       /**
+        * Whether to suppress database errors.
+        *
+        * @param unknown_type $suppress
+        * @return unknown
+        */
        function suppress_errors( $suppress = true ) {
                $errors = $this->suppress_errors;
                $this->suppress_errors = $suppress;
                return $errors;
        }
 
-       // ==================================================================
-       //      Kill cached query results
-
+       /**
+        * Kill cached query results.
+        *
+        * @since 0.71
+        */
        function flush() {
                $this->last_result = array();
                $this->col_info = null;
                $this->last_query = null;
        }
 
-       // ==================================================================
-       //      Basic Query     - see docs for more detail
-
+       /**
+        * Perform a MySQL database query, using current database connection.
+        *
+        * More information can be found on the codex page.
+        *
+        * @since 0.71
+        *
+        * @param string $query
+        * @return unknown
+        */
        function query($query) {
                if ( ! $this->ready )
                        return false;
@@ -269,13 +602,13 @@ class wpdb {
                $this->last_query = $query;
 
                // Perform the query via std mysql_query function..
-               if (SAVEQUERIES)
+               if ( defined('SAVEQUERIES') && SAVEQUERIES )
                        $this->timer_start();
 
                $this->result = @mysql_query($query, $this->dbh);
                ++$this->num_queries;
 
-               if (SAVEQUERIES)
+               if ( defined('SAVEQUERIES') && SAVEQUERIES )
                        $this->queries[] = array( $query, $this->timer_stop(), $this->get_caller() );
 
                // If there is an error then take note of it..
@@ -317,10 +650,13 @@ class wpdb {
        }
 
        /**
-        * Insert an array of data into a table
+        * Insert an array of data into a table.
+        *
+        * @since 2.5.0
+        *
         * @param string $table WARNING: not sanitized!
-        * @param array $data should not already be SQL-escaped
-        * @return mixed results of $this->query()
+        * @param array $data Should not already be SQL-escaped
+        * @return mixed Results of $this->query()
         */
        function insert($table, $data) {
                $data = add_magic_quotes($data);
@@ -329,11 +665,14 @@ class wpdb {
        }
 
        /**
-        * Update a row in the table with an array of data
+        * Update a row in the table with an array of data.
+        *
+        * @since 2.5.0
+        *
         * @param string $table WARNING: not sanitized!
-        * @param array $data should not already be SQL-escaped
-        * @param array $where a named array of WHERE column => value relationships.  Multiple member pairs will be joined with ANDs.  WARNING: the column names are not currently sanitized!
-        * @return mixed results of $this->query()
+        * @param array $data Should not already be SQL-escaped
+        * @param array $where A named array of WHERE column => value relationships.  Multiple member pairs will be joined with ANDs.  WARNING: the column names are not currently sanitized!
+        * @return mixed Results of $this->query()
         */
        function update($table, $data, $where){
                $data = add_magic_quotes($data);
@@ -346,15 +685,26 @@ class wpdb {
                                $wheres[] = "$c = '" . $this->escape( $v ) . "'";
                else
                        return false;
-               return $this->query( "UPDATE $table SET " . implode( ', ', $bits ) . ' WHERE ' . implode( ' AND ', $wheres ) . ' LIMIT 1' );
+                       
+               return $this->query( "UPDATE $table SET " . implode( ', ', $bits ) . ' WHERE ' . implode( ' AND ', $wheres ) );
        }
 
        /**
-        * Get one variable from the database
-        * @param string $query (can be null as well, for caching, see codex)
-        * @param int $x = 0 row num to return
-        * @param int $y = 0 col num to return
-        * @return mixed results
+        * Retrieve one variable from the database.
+        *
+        * This combines the functionality of wpdb::get_row() and wpdb::get_col(),
+        * so both the column and row can be picked.
+        *
+        * It is possible to use this function without executing more queries. If
+        * you already made a query, you can set the $query to 'null' value and just
+        * retrieve either the column and row of the last query result.
+        *
+        * @since 0.71
+        *
+        * @param string $query Can be null as well, for caching
+        * @param int $x Column num to return
+        * @param int $y Row num to return
+        * @return mixed Database query results
         */
        function get_var($query=null, $x = 0, $y = 0) {
                $this->func_call = "\$db->get_var(\"$query\",$x,$y)";
@@ -371,11 +721,14 @@ class wpdb {
        }
 
        /**
-        * Get one row from the database
-        * @param string $query
+        * Retrieve one row from the database.
+        *
+        * @since 0.71
+        *
+        * @param string $query SQL query
         * @param string $output ARRAY_A | ARRAY_N | OBJECT
-        * @param int $y row num to return
-        * @return mixed results
+        * @param int $y Row num to return
+        * @return mixed Database query results
         */
        function get_row($query = null, $output = OBJECT, $y = 0) {
                $this->func_call = "\$db->get_row(\"$query\",$output,$y)";
@@ -394,15 +747,18 @@ class wpdb {
                } elseif ( $output == ARRAY_N ) {
                        return $this->last_result[$y] ? array_values(get_object_vars($this->last_result[$y])) : null;
                } else {
-                       $this->print_error(" \$db->get_row(string query, output type, int offset) -- Output type must be one of: OBJECT, ARRAY_A, ARRAY_N");
+                       $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*/);
                }
        }
 
        /**
-        * Gets one column from the database
-        * @param string $query (can be null as well, for caching, see codex)
-        * @param int $x col num to return
-        * @return array results
+        * Retrieve one column from the database.
+        *
+        * @since 0.71
+        *
+        * @param string $query Can be null as well, for caching
+        * @param int $x Col num to return. Starts from 0.
+        * @return array Column results
         */
        function get_col($query = null , $x = 0) {
                if ( $query )
@@ -417,10 +773,13 @@ class wpdb {
        }
 
        /**
-        * Return an entire result set from the database
-        * @param string $query (can also be null to pull from the cache)
+        * Retrieve an entire result set from the database.
+        *
+        * @since 0.71
+        *
+        * @param string|null $query Can also be null to pull from the cache
         * @param string $output ARRAY_A | ARRAY_N | OBJECT_K | OBJECT
-        * @return mixed results
+        * @return mixed Database query results
         */
        function get_results($query = null, $output = OBJECT) {
                $this->func_call = "\$db->get_results(\"$query\", $output)";
@@ -462,10 +821,13 @@ class wpdb {
        }
 
        /**
-        * Grabs column metadata from the last query
+        * Retrieve column metadata from the last query.
+        *
+        * @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
-        * @return mixed results
+        * @return mixed Column Results
         */
        function get_col_info($info_type = 'name', $col_offset = -1) {
                if ( $this->col_info ) {
@@ -483,7 +845,11 @@ class wpdb {
        }
 
        /**
-        * Starts the timer, for debugging purposes
+        * Starts the timer, for debugging purposes.
+        *
+        * @since 1.5.0
+        *
+        * @return bool Always returns true
         */
        function timer_start() {
                $mtime = microtime();
@@ -493,8 +859,11 @@ class wpdb {
        }
 
        /**
-        * Stops the debugging timer
-        * @return int total time spent on the query, in milliseconds
+        * Stops the debugging timer.
+        *
+        * @since 1.5.0
+        *
+        * @return int Total time spent on the query, in milliseconds
         */
        function timer_stop() {
                $mtime = microtime();
@@ -506,9 +875,13 @@ class wpdb {
 
        /**
         * Wraps fatal errors in a nice header and footer and dies.
+        *
+        * @since 1.5.0
+        *
         * @param string $message
+        * @return unknown
         */
-       function bail($message) { // Just wraps errors in a nice header and footer
+       function bail($message) {
                if ( !$this->show_errors ) {
                        if ( class_exists('WP_Error') )
                                $this->error = new WP_Error('500', $message);
@@ -520,8 +893,12 @@ class wpdb {
        }
 
        /**
-        * Checks wether of not the database version is high enough to support the features WordPress uses
-        * @global $wp_version
+        * Whether or not MySQL database is minimal required version.
+        *
+        * @since 2.5.0
+        * @uses $wp_version
+        *
+        * @return WP_Error
         */
        function check_database_version()
        {
@@ -533,8 +910,13 @@ class wpdb {
        }
 
        /**
-        * This function is called when WordPress is generating the table schema to determine wether or not the current database
-        * supports or needs the collation statements.
+        * Whether of not the database version supports collation.
+        *
+        * Called when WordPress is generating the table scheme.
+        *
+        * @since 2.5.0
+        *
+        * @return bool True if collation is supported, false if version does not
         */
        function supports_collation()
        {
@@ -542,8 +924,14 @@ class wpdb {
        }
 
        /**
-        * Get the name of the function that called wpdb.
-        * @return string the name of the calling function
+        * Retrieve the name of the function that called wpdb.
+        *
+        * Requires PHP 4.3 and searches up the list of functions until it reaches
+        * the one that would most logically had called this method.
+        *
+        * @since 2.5.0
+        *
+        * @return string The name of the calling function
         */
        function get_caller() {
                // requires PHP 4.3+
@@ -571,6 +959,12 @@ class wpdb {
 
 }
 
-if ( ! isset($wpdb) )
+if ( ! isset($wpdb) ) {
+       /**
+        * WordPress Database Object, if it isn't set already in wp-content/wpdb.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);
+}
 ?>
diff --git a/wp-includes/wp-diff.php b/wp-includes/wp-diff.php
new file mode 100644 (file)
index 0000000..e43903d
--- /dev/null
@@ -0,0 +1,318 @@
+<?php
+
+if ( !class_exists( 'Text_Diff' ) ) {
+       require( dirname(__FILE__).'/Text/Diff.php' );
+       require( dirname(__FILE__).'/Text/Diff/Renderer.php' );
+       require( dirname(__FILE__).'/Text/Diff/Renderer/inline.php' );
+}
+
+
+/* Descendent of a bastard child of piece of an old MediaWiki Diff Formatter
+ *
+ * Basically all that remains is the table structure and some method names.
+ */
+
+class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
+       var $_leading_context_lines  = 10000;
+       var $_trailing_context_lines = 10000;
+       var $_diff_threshold = 0.6;
+
+       var $inline_diff_renderer = 'WP_Text_Diff_Renderer_inline';
+
+       function Text_Diff_Renderer_Table( $params = array() ) {
+               $parent = get_parent_class($this);
+               $this->$parent( $params );
+       }
+
+       function _startBlock( $header ) {
+               return '';
+       }
+
+       function _lines( $lines, $prefix=' ' ) {
+       }
+
+       // HTML-escape parameter before calling this
+       function addedLine( $line ) {
+               return "<td>+</td><td class='diff-addedline'>{$line}</td>";
+       }
+
+       // HTML-escape parameter before calling this
+       function deletedLine( $line ) {
+               return "<td>-</td><td class='diff-deletedline'>{$line}</td>";
+       }
+
+       // HTML-escape parameter before calling this
+       function contextLine( $line ) {
+               return "<td> </td><td class='diff-context'>{$line}</td>";
+       }
+
+       function emptyLine() {
+               return '<td colspan="2">&nbsp;</td>';
+       }
+
+       function _added( $lines, $encode = true ) {
+               $r = '';
+               foreach ($lines as $line) {
+                       if ( $encode )
+                               $line = htmlspecialchars( $line );
+                       $r .= '<tr>' . $this->emptyLine() . $this->addedLine( $line ) . "</tr>\n";
+               }
+               return $r;
+       }
+
+       function _deleted( $lines, $encode = true ) {
+               $r = '';
+               foreach ($lines as $line) {
+                       if ( $encode )
+                               $line = htmlspecialchars( $line );
+                       $r .= '<tr>' . $this->deletedLine( $line ) . $this->emptyLine() . "</tr>\n";
+               }
+               return $r;
+       }
+
+       function _context( $lines, $encode = true ) {
+               $r = '';
+               foreach ($lines as $line) {
+                       if ( $encode )
+                               $line = htmlspecialchars( $line );
+                       $r .= '<tr>' .
+                               $this->contextLine( $line ) . $this->contextLine( $line ) . "</tr>\n";
+               }
+               return $r;
+       }
+
+       // Process changed lines to do word-by-word diffs for extra highlighting (TRAC style)
+       // sometimes these lines can actually be deleted or added rows - we do additional processing
+       // to figure that out
+       function _changed( $orig, $final ) {
+               $r = '';
+
+               // Does the aforementioned additional processing
+               // *_matches tell what rows are "the same" in orig and final.  Those pairs will be diffed to get word changes
+               //      match is numeric: an index in other column
+               //      match is 'X': no match.  It is a new row
+               // *_rows are column vectors for the orig column and the final column.
+               //      row >= 0: an indix of the $orig or $final array
+               //      row  < 0: a blank row for that column
+               list($orig_matches, $final_matches, $orig_rows, $final_rows) = $this->interleave_changed_lines( $orig, $final );
+
+
+               // These will hold the word changes as determined by an inline diff
+               $orig_diffs  = array();
+               $final_diffs = array();
+
+               // Compute word diffs for each matched pair using the inline diff
+               foreach ( $orig_matches as $o => $f ) {
+                       if ( is_numeric($o) && is_numeric($f) ) {
+                               $text_diff = new Text_Diff( 'auto', array( array($orig[$o]), array($final[$f]) ) );
+                               $renderer = new $this->inline_diff_renderer;
+                               $diff = $renderer->render( $text_diff );
+
+                               // If they're too different, don't include any <ins> or <dels>
+                               if ( $diff_count = preg_match_all( '!(<ins>.*?</ins>|<del>.*?</del>)!', $diff, $diff_matches ) ) {
+                                       // length of all text between <ins> or <del>
+                                       $stripped_matches = strlen(strip_tags( join(' ', $diff_matches[0]) ));
+                                       // since we count lengith of text between <ins> or <del> (instead of picking just one),
+                                       //      we double the length of chars not in those tags.
+                                       $stripped_diff = strlen(strip_tags( $diff )) * 2 - $stripped_matches;
+                                       $diff_ratio = $stripped_matches / $stripped_diff;
+                                       if ( $diff_ratio > $this->_diff_threshold )
+                                               continue; // Too different.  Don't save diffs.
+                               }
+
+                               // Un-inline the diffs by removing del or ins
+                               $orig_diffs[$o]  = preg_replace( '|<ins>.*?</ins>|', '', $diff );
+                               $final_diffs[$f] = preg_replace( '|<del>.*?</del>|', '', $diff );
+                       }
+               }
+
+               foreach ( array_keys($orig_rows) as $row ) {
+                       // Both columns have blanks.  Ignore them.
+                       if ( $orig_rows[$row] < 0 && $final_rows[$row] < 0 )
+                               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 ( $orig_rows[$row] < 0 ) { // Orig is blank.  This is really an added row.
+                               $r .= $this->_added( array($final_line), false );
+                       } elseif ( $final_rows[$row] < 0 ) { // Final is blank.  This is really a deleted row.
+                               $r .= $this->_deleted( array($orig_line), false );
+                       } else { // A true changed row.
+                               $r .= '<tr>' . $this->deletedLine( $orig_line ) . $this->addedLine( $final_line ) . "</tr>\n";
+                       }
+               }
+
+               return $r;
+       }
+
+       // Takes changed blocks and matches which rows in orig turned into which rows in final.
+       // Returns
+       //      *_matches ( which rows match with which )
+       //      *_rows ( order of rows in each column interleaved with blank rows as necessary )
+       function interleave_changed_lines( $orig, $final ) {
+
+               // Contains all pairwise string comparisons.  Keys are such that this need only be a one dimensional array.
+               $matches = array();
+               foreach ( array_keys($orig) as $o ) {
+                       foreach ( array_keys($final) as $f ) {
+                               $matches["$o,$f"] = $this->compute_string_distance( $orig[$o], $final[$f] );
+                       }
+               }
+               asort($matches); // Order by string distance.
+
+               $orig_matches  = array();
+               $final_matches = array();
+
+               foreach ( $matches as $keys => $difference ) {
+                       list($o, $f) = explode(',', $keys);
+                       $o = (int) $o;
+                       $f = (int) $f;
+
+                       // Already have better matches for these guys
+                       if ( isset($orig_matches[$o]) && isset($final_matches[$f]) )
+                               continue;
+
+                       // First match for these guys.  Must be best match
+                       if ( !isset($orig_matches[$o]) && !isset($final_matches[$f]) ) {
+                               $orig_matches[$o] = $f;
+                               $final_matches[$f] = $o;
+                               continue;
+                       }
+
+                       // Best match of this final is already taken?  Must mean this final is a new row.
+                       if ( isset($orig_matches[$o]) )
+                               $final_matches[$f] = 'x';
+
+                       // Best match of this orig is already taken?  Must mean this orig is a deleted row.
+                       elseif ( isset($final_matches[$f]) )
+                               $orig_matches[$o] = 'x';
+               }
+
+               // We read the text in this order
+               ksort($orig_matches);
+               ksort($final_matches);
+
+
+               // Stores rows and blanks for each column.
+               $orig_rows = $orig_rows_copy = array_keys($orig_matches);
+               $final_rows = array_keys($final_matches);
+
+               // Interleaves rows with blanks to keep matches aligned.
+               // We may end up with some extraneous blank rows, but we'll just ignore them later.
+               foreach ( $orig_rows_copy as $orig_row ) {
+                       $final_pos = array_search($orig_matches[$orig_row], $final_rows, true);
+                       $orig_pos = (int) array_search($orig_row, $orig_rows, true);
+
+                       if ( false === $final_pos ) { // This orig is paired with a blank final.
+                               array_splice( $final_rows, $orig_pos, 0, -1 );
+                       } elseif ( $final_pos < $orig_pos ) { // This orig's match is up a ways.  Pad final with blank rows.
+                               $diff_pos = $final_pos - $orig_pos;
+                               while ( $diff_pos < 0 )
+                                       array_splice( $final_rows, $orig_pos, 0, $diff_pos++ );
+                       } elseif ( $final_pos > $orig_pos ) { // This orig's match is down a ways.  Pad orig with blank rows.
+                               $diff_pos = $orig_pos - $final_pos;
+                               while ( $diff_pos < 0 )
+                                       array_splice( $orig_rows, $orig_pos, 0, $diff_pos++ );
+                       }
+               }
+
+
+               // Pad the ends with blank rows if the columns aren't the same length
+               $diff_count = count($orig_rows) - count($final_rows);
+               if ( $diff_count < 0 ) {
+                       while ( $diff_count < 0 )
+                               array_push($orig_rows, $diff_count++);
+               } elseif ( $diff_count > 0 ) {
+                       $diff_count = -1 * $diff_count;
+                       while ( $diff_count < 0 )
+                               array_push($final_rows, $diff_count++);
+               }
+
+               return array($orig_matches, $final_matches, $orig_rows, $final_rows);
+
+/*
+               // Debug
+               echo "\n\n\n\n\n";
+
+               echo "-- DEBUG Matches: Orig -> Final --";
+
+               foreach ( $orig_matches as $o => $f ) {
+                       echo "\n\n\n\n\n";
+                       echo "ORIG: $o, FINAL: $f\n";
+                       var_dump($orig[$o],$final[$f]);
+               }
+               echo "\n\n\n\n\n";
+
+               echo "-- DEBUG Matches: Final -> Orig --";
+
+               foreach ( $final_matches as $f => $o ) {
+                       echo "\n\n\n\n\n";
+                       echo "FINAL: $f, ORIG: $o\n";
+                       var_dump($final[$f],$orig[$o]);
+               }
+               echo "\n\n\n\n\n";
+
+               echo "-- DEBUG Rows: Orig -- Final --";
+
+               echo "\n\n\n\n\n";
+               foreach ( $orig_rows as $row => $o ) {
+                       if ( $o < 0 )
+                               $o = 'X';
+                       $f = $final_rows[$row];
+                       if ( $f < 0 )
+                               $f = 'X';
+                       echo "$o -- $f\n";
+               }
+               echo "\n\n\n\n\n";
+
+               echo "-- END DEBUG --";
+
+               echo "\n\n\n\n\n";
+
+               return array($orig_matches, $final_matches, $orig_rows, $final_rows);
+*/
+       }
+
+
+       // Computes a number that is intended to reflect the "distance" between two strings.
+       function compute_string_distance( $string1, $string2 ) {
+               // Vectors containing character frequency for all chars in each string
+               $chars1 = count_chars($string1);
+               $chars2 = count_chars($string2);
+
+               // L1-norm of difference vector.
+               $difference = array_sum( array_map( array(&$this, 'difference'), $chars1, $chars2 ) );
+
+               // $string1 has zero length? Odd.  Give huge penalty by not dividing.
+               if ( !$string1 )
+                       return $difference;
+
+               // Return distance per charcter (of string1)
+               return $difference / strlen($string1);
+       }
+
+       function difference( $a, $b ) {
+               return abs( $a - $b );
+       }
+
+}
+
+// Better word splitting than the PEAR package provides
+class WP_Text_Diff_Renderer_inline extends Text_Diff_Renderer_inline {
+
+       function _splitOnWords($string, $newlineEscape = "\n") {
+               $string = str_replace("\0", '', $string);
+               $words  = preg_split( '/([^\w])/u', $string, -1, PREG_SPLIT_DELIM_CAPTURE );
+               $words  = str_replace( "\n", $newlineEscape, $words );
+               return $words;
+       }
+
+}
+
+?>
index dfa3a44e12078ad53423bde12c532959f4a5e6cd..f536d61650e5a09362867dbd9a6f2ed2c31e4718 100644 (file)
@@ -1,7 +1,19 @@
 <?php
+/**
+ * Outputs the OPML XML format for getting the links defined in the link
+ * administration. This can be used to export links from one blog over to
+ * another. Links aren't exported by the WordPress export, so this file handles
+ * that.
+ *
+ * This file is not added by default to WordPress theme pages when outputting
+ * feed links. It will have to be added manually for browsers and users to pick
+ * up that this file exists.
+ *
+ * @package WordPress
+ */
 
 if (empty($wp)) {
-       require_once('./wp-config.php');
+       require_once('./wp-load.php');
        wp();
 }
 
diff --git a/wp-load.php b/wp-load.php
new file mode 100644 (file)
index 0000000..423edf5
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+/**
+ * Bootstrap file for setting the ABSPATH constant
+ * and loading the wp-config.php file. The wp-config.php
+ * file will then load the wp-settings.php file, which
+ * will then set up the WordPress environment.
+ *
+ * If the wp-config.php file is not found then an error
+ * will be displayed asking the visitor to set up the
+ * wp-config.php file.
+ *
+ * Will also search for wp-config.php in WordPress' parent
+ * directory to allow the WordPress directory to remain
+ * untouched.
+ *
+ * @package WordPress
+ */
+
+/** Define ABSPATH as this files directory */
+define( 'ABSPATH', dirname(__FILE__) . '/' );
+
+error_reporting(E_ALL ^ E_NOTICE ^ E_USER_NOTICE);
+
+if ( file_exists( ABSPATH . 'wp-config.php') ) {
+
+       /** The config file resides in ABSPATH */
+       require_once( ABSPATH . 'wp-config.php' );
+
+} elseif ( file_exists( dirname(ABSPATH) . '/wp-config.php' ) ) {
+
+       /** The config file resides one level below ABSPATH */
+       require_once( dirname(ABSPATH) . '/wp-config.php' );
+
+} else {
+
+       // A config file doesn't exist
+
+       // Set a path for the link to the installer
+       if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $path = '';
+       else $path = 'wp-admin/';
+
+       // Die with an error message
+       require_once( ABSPATH . '/wp-includes/classes.php' );
+       require_once( ABSPATH . '/wp-includes/functions.php' );
+       require_once( ABSPATH . '/wp-includes/plugin.php' );
+       wp_die(sprintf(/*WP_I18N_NO_CONFIG*/"There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.</p><p><a href='%ssetup-config.php' class='button'>Create a Configuration File</a>"/*/WP_I18N_NO_CONFIG*/, $path), /*WP_I18N_ERROR_TITLE*/"WordPress &rsaquo; Error"/*/WP_I18N_ERROR_TITLE*/);
+
+}
+
+?>
index af9b1610936e7a894143d0f78048b4c546a1494f..265a223f981c4426d658b2113e26f58edfad7009 100644 (file)
@@ -1,7 +1,44 @@
 <?php
-require( dirname(__FILE__) . '/wp-config.php' );
+/**
+ * WordPress User Page
+ *
+ * Handles authentication, registering, resetting passwords, forgot password,
+ * and other user handling.
+ *
+ * @package WordPress
+ */
+
+/** Make sure that the WordPress bootstrap has ran before continuing. */
+require( dirname(__FILE__) . '/wp-load.php' );
+
+// Redirect to https login if forced to use SSL
+if ( force_ssl_admin() && !is_ssl() ) {
+       if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) {
+               wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
+               exit();
+       } else {
+               wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
+               exit();                 
+       }
+}
 
-// Rather than duplicating this HTML all over the place, we'll stick it in function
+/**
+ * login_header() - Outputs the header for the login page
+ *
+ * @package WordPress
+ * @uses do_action() Calls the 'login_head' for outputting HTML in the Login
+ *             header.
+ * @uses apply_filters() Calls 'login_headerurl' for the top login link.
+ * @uses apply_filters() Calls 'login_headertitle' for the top login title.
+ * @uses apply_filters() Calls 'login_message' on the message to display in the
+ *             header.
+ * @uses $error The error global, which is checked for displaying errors.
+ *
+ * @param string $title Optional. WordPress Login Page title to display in
+ *             <title/> element.
+ * @param string $message Optional. Message to display in header.
+ * @param WP_Error $wp_error Optional. WordPress Error Object
+ */
 function login_header($title = 'Login', $message = '', $wp_error = '') {
        global $error;
 
@@ -14,16 +51,9 @@ function login_header($title = 'Login', $message = '', $wp_error = '') {
        <title><?php bloginfo('name'); ?> &rsaquo; <?php echo $title; ?></title>
        <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
        <?php
-       wp_admin_css( 'css/login' );
-       wp_admin_css( 'css/colors-fresh' );
-       ?>
-       <script type="text/javascript">
-               function focusit() {
-                       document.getElementById('user_login').focus();
-               }
-               window.onload = focusit;
-       </script>
-<?php do_action('login_head'); ?>
+       wp_admin_css( 'login', true );
+       wp_admin_css( 'colors-fresh', true );
+       do_action('login_head'); ?>
 </head>
 <body class="login">
 
@@ -56,6 +86,15 @@ function login_header($title = 'Login', $message = '', $wp_error = '') {
        }
 } // End of login_header()
 
+/**
+ * retrieve_password() - Handles sending password retrieval email to user
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @uses $wpdb WordPress Database object
+ *
+ * @return bool|WP_Error True: when finish. WP_Error on error
+ */
 function retrieve_password() {
        global $wpdb;
 
@@ -90,10 +129,17 @@ function retrieve_password() {
        do_action('retreive_password', $user_login);  // Misspelled and deprecated
        do_action('retrieve_password', $user_login);
 
+       $allow = apply_filters('allow_password_reset', true, $user_data->ID);
+
+       if ( ! $allow )
+               return new WP_Error('no_password_reset', __('Password reset is not allowed for this user'));
+       else if ( is_wp_error($allow) )
+               return $allow;
+               
        $key = $wpdb->get_var($wpdb->prepare("SELECT user_activation_key FROM $wpdb->users WHERE user_login = %s", $user_login));
        if ( empty($key) ) {
                // Generate something random for a key...
-               $key = wp_generate_password();
+               $key = wp_generate_password(20, false);
                do_action('retrieve_password_key', $user_login, $key);
                // Now insert the new md5 key into the db
                $wpdb->query($wpdb->prepare("UPDATE $wpdb->users SET user_activation_key = %s WHERE user_login = %s", $key, $user_login));
@@ -102,7 +148,7 @@ function retrieve_password() {
        $message .= get_option('siteurl') . "\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 .= get_option('siteurl') . "/wp-login.php?action=rp&key=$key\r\n";
+       $message .= site_url("wp-login.php?action=rp&key=$key", 'login') . "\r\n";
 
        if ( !wp_mail($user_email, sprintf(__('[%s] Password Reset'), get_option('blogname')), $message) )
                die('<p>' . __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') . '</p>');
@@ -110,6 +156,16 @@ function retrieve_password() {
        return true;
 }
 
+/**
+ * reset_password() - Handles resetting the user's password
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @uses $wpdb WordPress Database object
+ *
+ * @param string $key Hash to validate sending user's password
+ * @return bool|WP_Error
+ */
 function reset_password($key) {
        global $wpdb;
 
@@ -129,7 +185,7 @@ function reset_password($key) {
        wp_set_password($new_pass, $user->ID);
        $message  = sprintf(__('Username: %s'), $user->user_login) . "\r\n";
        $message .= sprintf(__('Password: %s'), $new_pass) . "\r\n";
-       $message .= get_option('siteurl') . "/wp-login.php\r\n";
+       $message .= site_url('wp-login.php', 'login') . "\r\n";
 
        if (  !wp_mail($user->user_email, sprintf(__('[%s] Your new password'), get_option('blogname')), $message) )
                die('<p>' . __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') . '</p>');
@@ -144,6 +200,15 @@ function reset_password($key) {
        return true;
 }
 
+/**
+ * register_new_user() - Handles registering a new user
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @param string $user_login User's username for logging in
+ * @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) {
        $errors = new WP_Error();
 
@@ -247,7 +312,7 @@ case 'retrievepassword' :
        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);
 ?>
 
-<form name="lostpasswordform" id="lostpasswordform" action="wp-login.php?action=lostpassword" method="post">
+<form name="lostpasswordform" id="lostpasswordform" action="<?php echo site_url('wp-login.php?action=lostpassword', 'login_post') ?>" method="post">
        <p>
                <label><?php _e('Username or E-mail:') ?><br />
                <input type="text" name="user_login" id="user_login" class="input" value="<?php echo attribute_escape(stripslashes($_POST['user_login'])); ?>" size="20" tabindex="10" /></label>
@@ -258,10 +323,10 @@ case 'retrievepassword' :
 
 <p id="nav">
 <?php if (get_option('users_can_register')) : ?>
-<a href="<?php bloginfo('wpurl'); ?>/wp-login.php"><?php _e('Log in') ?></a> |
-<a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=register"><?php _e('Register') ?></a>
+<a href="<?php echo site_url('wp-login.php', 'login') ?>"><?php _e('Log in') ?></a> |
+<a href="<?php echo site_url('wp-login.php?action=register', 'login') ?>"><?php _e('Register') ?></a>
 <?php else : ?>
-<a href="<?php bloginfo('wpurl'); ?>/wp-login.php"><?php _e('Log in') ?></a>
+<a href="<?php echo site_url('wp-login.php', 'login') ?>"><?php _e('Log in') ?></a>
 <?php endif; ?>
 </p>
 
@@ -269,6 +334,9 @@ case 'retrievepassword' :
 
 <p id="backtoblog"><a href="<?php bloginfo('url'); ?>/" title="<?php _e('Are you lost?') ?>"><?php printf(__('&laquo; Back to %s'), get_bloginfo('title', 'display' )); ?></a></p>
 
+<script type="text/javascript">
+try{document.getElementById('user_login').focus();}catch(e){}
+</script>
 </body>
 </html>
 <?php
@@ -311,7 +379,7 @@ case 'register' :
        login_header(__('Registration Form'), '<p class="message register">' . __('Register For This Site') . '</p>', $errors);
 ?>
 
-<form name="registerform" id="registerform" action="wp-login.php?action=register" method="post">
+<form name="registerform" id="registerform" action="<?php echo site_url('wp-login.php?action=register', 'login_post') ?>" method="post">
        <p>
                <label><?php _e('Username') ?><br />
                <input type="text" name="user_login" id="user_login" class="input" value="<?php echo attribute_escape(stripslashes($user_login)); ?>" size="20" tabindex="10" /></label>
@@ -326,14 +394,17 @@ case 'register' :
 </form>
 
 <p id="nav">
-<a href="<?php bloginfo('wpurl'); ?>/wp-login.php"><?php _e('Log in') ?></a> |
-<a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=lostpassword" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a>
+<a href="<?php echo site_url('wp-login.php', 'login') ?>"><?php _e('Log in') ?></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>
 </p>
 
 </div>
 
 <p id="backtoblog"><a href="<?php bloginfo('url'); ?>/" title="<?php _e('Are you lost?') ?>"><?php printf(__('&laquo; Back to %s'), get_bloginfo('title', 'display' )); ?></a></p>
 
+<script type="text/javascript">
+try{document.getElementById('user_login').focus();}catch(e){}
+</script>
 </body>
 </html>
 <?php
@@ -344,14 +415,21 @@ default:
        if ( isset( $_REQUEST['redirect_to'] ) )
                $redirect_to = $_REQUEST['redirect_to'];
        else
-               $redirect_to = 'wp-admin/';
+               $redirect_to = admin_url();
+
+       if ( is_ssl() && force_ssl_login() && !force_ssl_admin() && ( 0 !== strpos($redirect_to, 'https') ) && ( 0 === strpos($redirect_to, 'http') ) )
+               $secure_cookie = false;
+       else
+               $secure_cookie = '';
 
-       $user = wp_signon();
+       $user = wp_signon('', $secure_cookie);
+
+       $redirect_to = apply_filters('login_redirect', $redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '', $user);
 
        if ( !is_wp_error($user) ) {
                // If the user can't edit posts, send them to their profile.
                if ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' ) )
-                       $redirect_to = get_option('siteurl') . '/wp-admin/profile.php';
+                       $redirect_to = admin_url('profile.php');
                wp_safe_redirect($redirect_to);
                exit();
        }
@@ -375,7 +453,7 @@ default:
        login_header(__('Login'), '', $errors);
 ?>
 
-<form name="loginform" id="loginform" action="wp-login.php" method="post">
+<form name="loginform" id="loginform" action="<?php echo site_url('wp-login.php', 'login_post') ?>" method="post">
 <?php if ( !isset($_GET['checkemail']) || !in_array( $_GET['checkemail'], array('confirm', 'newpass') ) ) : ?>
        <p>
                <label><?php _e('Username') ?><br />
@@ -400,10 +478,10 @@ default:
 <p id="nav">
 <?php if ( isset($_GET['checkemail']) && in_array( $_GET['checkemail'], array('confirm', 'newpass') ) ) : ?>
 <?php elseif (get_option('users_can_register')) : ?>
-<a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=register"><?php _e('Register') ?></a> |
-<a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=lostpassword" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a>
+<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 bloginfo('wpurl'); ?>/wp-login.php?action=lostpassword" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></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 endif; ?>
 </p>
 
@@ -411,10 +489,13 @@ default:
 
 <p id="backtoblog"><a href="<?php bloginfo('url'); ?>/" title="<?php _e('Are you lost?') ?>"><?php printf(__('&laquo; Back to %s'), get_bloginfo('title', 'display' )); ?></a></p>
 
+<script type="text/javascript">
+try{document.getElementById('user_login').focus();}catch(e){}
+</script>
 </body>
 </html>
 <?php
 
 break;
 } // end action switch
-?>
+?>
\ No newline at end of file
index 9e767fb3b053812d9ead98a6b52e224f95446918..52d05cb8d3f130337b87305ce3651c59bef2972c 100644 (file)
@@ -1,8 +1,18 @@
 <?php
-require(dirname(__FILE__) . '/wp-config.php');
+/**
+ * Gets the email message from the user's mailbox to add as
+ * a WordPress post. Will only run if this is setup and enabled.
+ *
+ * @package WordPress
+ */
 
+/** Make sure that the WordPress bootstrap has ran before continuing. */
+require(dirname(__FILE__) . '/wp-load.php');
+
+/** Get the POP3 class for which to access the mailbox. */
 require_once(ABSPATH.WPINC.'/class-pop3.php');
 
+// WTF is this? Use constants instead.
 error_reporting(2037);
 
 $time_difference = get_option('gmt_offset') * 3600;
@@ -193,4 +203,4 @@ endfor;
 
 $pop3->quit();
 
-?>
+?>
\ No newline at end of file
index 709a63b07ff293f24cacf690ce850b385ceb20ab..1be8095cc01aa026a5098b381f4a1353fef14fad 100644 (file)
@@ -1,5 +1,13 @@
 <?php
-require( dirname(__FILE__) . '/wp-config.php');
+/**
+ * Creates the password cookie and redirects back to where the
+ * visitor was before.
+ *
+ * @package WordPress
+ */
+
+/** Make sure that the WordPress bootstrap has ran before continuing. */
+require( dirname(__FILE__) . '/wp-load.php');
 
 if ( get_magic_quotes_gpc() )
        $_POST['post_password'] = stripslashes($_POST['post_password']);
index e18b54d2747efe28a8d6401058c45aa0760941f7..fac4a8da2e280bb99e376f13a2800fac23107987 100644 (file)
@@ -1,7 +1,20 @@
-<?php /* RDF 1.0 generator, original version by garym@teledyn.com */
+<?php
+/**
+ * Outputs the RDF feed using the feed-rdf.php
+ * file in wp-includes folder.
+ *
+ * This file only sets the feed format and includes the
+ * feed-rdf.php.
+ *
+ * This file is no longer used in WordPress and while it is
+ * not deprecated now. This file will most likely be
+ * deprecated or removed in a later version.
+ *
+ * @package WordPress
+ */
 
 if (empty($wp)) {
-       require_once('./wp-config.php');
+       require_once('./wp-load.php');
        wp('feed=rdf');
 }
 
index e58a2f519212bd0ff25a104818a9e38e0c41acf1..caad4f2b21c37b9ffdb53ce8b081c7949ec4f74e 100644 (file)
@@ -1,9 +1,15 @@
 <?php
+/**
+ * Used to be the page which displayed the registration form.
+ *
+ * This file is no longer used in WordPress and is
+ * deprecated.
+ *
+ * @package WordPress
+ * @deprecated Use wp_register() to create a registration link instead
+ */
 
-# This file is deprecated, but you shouldn't have been linking to it directly anyway :P
-# Use wp_register() to create a registration link instead, it's much better ;)
-
-require('./wp-config.php');
+require('./wp-load.php');
 wp_redirect('wp-login.php?action=register');
 
 ?>
\ No newline at end of file
index 6f08ee8dc6e38afee3ce04c8e5ce923fc4d18d80..705c1f5cc5db7ab1669a0c39eede84222306b5e9 100644 (file)
@@ -1,7 +1,20 @@
 <?php
+/**
+ * Outputs the RSS feed RDF format using the feed-rss.php
+ * file in wp-includes folder.
+ *
+ * This file only sets the feed format and includes the
+ * feed-rss.php.
+ *
+ * This file is no longer used in WordPress and while it is
+ * not deprecated now. This file will most likely be
+ * deprecated or removed in a later version.
+ *
+ * @package WordPress
+ */
 
 if (empty($wp)) {
-       require_once('./wp-config.php');
+       require_once('./wp-load.php');
        wp('feed=rss');
 }
 
index 54531d324038690b5a0a20379254762959cab672..ba84ce99f5a409ed4d51f1f44a34ab20f73a7f7e 100644 (file)
@@ -1,7 +1,18 @@
 <?php
+/**
+ * Outputs the RSS2 feed XML format using the feed-rss2.php file in wp-includes
+ * folder. This file only sets the feed format and includes the feed-rss2.php.
+ *
+ * This file is no longer used in WordPress and while it is not deprecated now.
+ * This file will most likely be deprecated or removed in a later version.
+ *
+ * The link for the rss2 feed is /index.php?feed=rss2 with permalinks off.
+ *
+ * @package WordPress
+ */
 
 if (empty($wp)) {
-       require_once('./wp-config.php');
+       require_once('./wp-load.php');
        wp('feed=rss2');
 }
 
index 1480288e0a92fa4d3cbab0f67a97c68ca84d10f7..466f04a16774c947dbabe97dadb88b0ddae8446c 100644 (file)
@@ -68,6 +68,10 @@ if ( empty( $_SERVER['REQUEST_URI'] ) ) {
        }
        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'] )
@@ -97,11 +101,14 @@ if ( empty($PHP_SELF) )
        $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]);
 
 if ( version_compare( '4.3', phpversion(), '>' ) ) {
-       die( 'Your server is running PHP version ' . phpversion() . ' but WordPress requires at least 4.3.' );
+       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 ( !extension_loaded('mysql') && !file_exists(ABSPATH . 'wp-content/db.php') )
-       die( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' );
+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 ( !extension_loaded('mysql') && !file_exists(WP_CONTENT_DIR . '/db.php') )
+       die( /*WP_I18N_OLD_MYSQL*/'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'/*/WP_I18N_OLD_MYSQL*/ );
 
 /**
  * timer_start() - PHP 4 standard microtime start capture
@@ -166,7 +173,7 @@ if (defined('WP_DEBUG') and WP_DEBUG == true) {
 
 // For an advanced caching plugin to use, static because you would only want one
 if ( defined('WP_CACHE') )
-       @include ABSPATH . 'wp-content/advanced-cache.php';
+       @include WP_CONTENT_DIR . '/advanced-cache.php';
 
 /**
  * Stores the location of the WordPress directory of functions, classes, and core content.
@@ -175,30 +182,28 @@ if ( defined('WP_CACHE') )
  */
 define('WPINC', 'wp-includes');
 
-if ( !defined('LANGDIR') ) {
+if ( !defined('WP_LANG_DIR') ) {
        /**
-        * Stores the location of the language directory. First looks for language folder in wp-content
+        * 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(ABSPATH . 'wp-content/languages') && @is_dir(ABSPATH . 'wp-content/languages') )
-               define('LANGDIR', 'wp-content/languages'); // no leading slash, no trailing slash
-       else
-               define('LANGDIR', WPINC . '/languages'); // no leading slash, no trailing slash
+       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');
+               }
+       }
 }
 
-/**
- * Allows for the plugins directory to be moved from the default location.
- *
- * This isn't used everywhere. Constant is not used in plugin_basename()
- * which might cause conflicts with changing this.
- *
- * @since 2.1
- */
-if ( !defined('PLUGINDIR') )
-       define('PLUGINDIR', 'wp-content/plugins'); // no leading slash, no trailing slash
-
 require (ABSPATH . WPINC . '/compat.php');
 require (ABSPATH . WPINC . '/functions.php');
 require (ABSPATH . WPINC . '/classes.php');
@@ -211,14 +216,18 @@ if ( !empty($wpdb->error) )
 $prefix = $wpdb->set_prefix($table_prefix);
 
 if ( is_wp_error($prefix) )
-       wp_die('<strong>ERROR</strong>: <code>$table_prefix</code> in <code>wp-config.php</code> can only contain numbers, letters, and underscores.');
+       wp_die(/*WP_I18N_BAD_PREFIX*/'<strong>ERROR</strong>: <code>$table_prefix</code> in <code>wp-config.php</code> can only contain numbers, letters, and underscores.'/*/WP_I18N_BAD_PREFIX*/);
 
-if ( file_exists(ABSPATH . 'wp-content/object-cache.php') )
-       require_once (ABSPATH . 'wp-content/object-cache.php');
+if ( file_exists(WP_CONTENT_DIR . '/object-cache.php') )
+       require_once (WP_CONTENT_DIR . '/object-cache.php');
 else
        require_once (ABSPATH . WPINC . '/cache.php');
 
 wp_cache_init();
+if ( function_exists('wp_cache_add_global_groups') ) {
+       wp_cache_add_global_groups(array ('users', 'userlogins', 'usermeta'));
+       wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' ));
+}
 
 require (ABSPATH . WPINC . '/plugin.php');
 require (ABSPATH . WPINC . '/default-filters.php');
@@ -268,7 +277,22 @@ require (ABSPATH . WPINC . '/canonical.php');
 require (ABSPATH . WPINC . '/shortcodes.php');
 require (ABSPATH . WPINC . '/media.php');
 
-if (strpos($_SERVER['PHP_SELF'], 'install.php') === false) {
+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
+ */
+if ( !defined('WP_PLUGIN_DIR') )
+       define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // full path, no trailing slash
+if ( !defined('WP_PLUGIN_URL') )
+       define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); // full url, no trailing slash
+if ( !defined('PLUGINDIR') )
+       define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH.  For back compat.
+
+if ( ! defined('WP_INSTALLING') ) {
        // Used to guarantee unique hash cookies
        $cookiehash = md5(get_option('siteurl'));
        /**
@@ -305,6 +329,20 @@ if ( !defined('PASS_COOKIE') )
 if ( !defined('AUTH_COOKIE') )
        define('AUTH_COOKIE', 'wordpress_' . COOKIEHASH);
 
+/**
+ * It is possible to define this in wp-config.php
+ * @since 2.6
+ */
+if ( !defined('SECURE_AUTH_COOKIE') )
+       define('SECURE_AUTH_COOKIE', 'wordpress_sec_' . COOKIEHASH);
+
+/**
+ * It is possible to define this in wp-config.php
+ * @since 2.6
+ */
+if ( !defined('LOGGED_IN_COOKIE') )
+       define('LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH);
+
 /**
  * It is possible to define this in wp-config.php
  * @since 2.3.0
@@ -326,13 +364,43 @@ if ( !defined('COOKIEPATH') )
 if ( !defined('SITECOOKIEPATH') )
        define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) );
 
+/**
+ * It is possible to define this in wp-config.php
+ * @since 2.6
+ */
+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
+ */
+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
+ */
+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
+ */
+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
@@ -353,8 +421,8 @@ if ( get_option('active_plugins') ) {
        $current_plugins = get_option('active_plugins');
        if ( is_array($current_plugins) ) {
                foreach ($current_plugins as $plugin) {
-                       if ('' != $plugin && file_exists(ABSPATH . PLUGINDIR . '/' . $plugin))
-                               include_once(ABSPATH . PLUGINDIR . '/' . $plugin);
+                       if ( '' != $plugin && 0 == validate_file($plugin) && file_exists(WP_PLUGIN_DIR . '/' . $plugin) )
+                               include_once(WP_PLUGIN_DIR . '/' . $plugin);
                }
        }
 }
@@ -376,6 +444,11 @@ if ( defined('WP_CACHE') && function_exists('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);
+
 // If already slashed, strip.
 if ( get_magic_quotes_gpc() ) {
        $_GET    = stripslashes_deep($_GET   );
@@ -420,6 +493,7 @@ $wp_rewrite   =& new WP_Rewrite();
  */
 $wp           =& new WP();
 
+do_action('setup_theme');
 
 /**
  * Web Path to the current active template directory
@@ -441,7 +515,7 @@ load_default_textdomain();
  * @since 1.5.0
  */
 $locale = get_locale();
-$locale_file = ABSPATH . LANGDIR . "/$locale.php";
+$locale_file = WP_LANG_DIR . "/$locale.php";
 if ( is_readable($locale_file) )
        require_once($locale_file);
 
index 26f8763ede5ad32da3f0aeb5fb1c9b39c7d50df6..58886f8dc574c6924766edbc239498d6a6eb56bf 100644 (file)
@@ -1,10 +1,21 @@
 <?php
+/**
+ * Handle Trackbacks and Pingbacks sent to WordPress
+ *
+ * @package WordPress
+ */
 
 if (empty($wp)) {
-       require_once('./wp-config.php');
+       require_once('./wp-load.php');
        wp('tb=1');
 }
 
+/**
+ * trackback_response() - Respond with error or success XML message
+ *
+ * @param int|bool $error Whether there was an error or not
+ * @param string $error_message Error message if an error occurred
+ */
 function trackback_response($error = 0, $error_message = '') {
        header('Content-Type: text/xml; charset=' . get_option('blog_charset') );
        if ($error) {
@@ -86,7 +97,7 @@ if ( !empty($tb_url) && !empty($title) ) {
        $comment_content = "<strong>$title</strong>\n\n$excerpt";
        $comment_type = 'trackback';
 
-       $dupe = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$comment_post_ID' AND comment_author_url = '$comment_author_url'");
+       $dupe = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_author_url = %s", $comment_post_ID, $comment_author_url) );
        if ( $dupe )
                trackback_response(1, 'We already have a ping from that URL for this post.');
 
@@ -97,4 +108,4 @@ if ( !empty($tb_url) && !empty($title) ) {
        do_action('trackback_post', $wpdb->insert_id);
        trackback_response(0);
 }
-?>
+?>
\ No newline at end of file
index c04abed0afa85ca81cd360dfd77dd4c1f3230b3a..e52e454658db0d73444ecfac6db3ea8560bb8503 100644 (file)
@@ -1,5 +1,16 @@
 <?php
-
+/**
+ * XML-RPC protocol support for WordPress
+ *
+ * @license GPL v2 <./license.txt>
+ * @package WordPress
+ */
+
+/**
+ * Whether this is a XMLRPC Request
+ *
+ * @var bool
+ */
 define('XMLRPC_REQUEST', true);
 
 // Some browser-embedded clients send cookies. We don't want them.
@@ -11,11 +22,12 @@ if ( !isset( $HTTP_RAW_POST_DATA ) ) {
        $HTTP_RAW_POST_DATA = file_get_contents( 'php://input' );
 }
 
-# fix for mozBlog and other cases where '<?xml' isn't on the very first line
+// fix for mozBlog and other cases where '<?xml' isn't on the very first line
 if ( isset($HTTP_RAW_POST_DATA) )
        $HTTP_RAW_POST_DATA = trim($HTTP_RAW_POST_DATA);
 
-include('./wp-config.php');
+/** Include the bootstrap for setting up WordPress environment */
+include('./wp-load.php');
 
 if ( isset( $_GET['rsd'] ) ) { // http://archipelago.phrasewise.com/rsd
 header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
@@ -27,11 +39,11 @@ header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
     <engineLink>http://wordpress.org/</engineLink>
     <homePageLink><?php bloginfo_rss('url') ?></homePageLink>
     <apis>
-      <api name="WordPress" blogID="1" preferred="true" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" />
-      <api name="Movable Type" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" />
-      <api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" />
-      <api name="Blogger" blogID="1" preferred="false" apiLink="<?php bloginfo_rss('wpurl') ?>/xmlrpc.php" />
-      <api name="Atom" blogID="" preferred="false" apiLink="<?php echo apply_filters('atom_service_url', (get_bloginfo('url')."/wp-app.php/service"))?>" />
+      <api name="WordPress" blogID="1" preferred="true" apiLink="<?php echo site_url('xmlrpc.php') ?>" />
+      <api name="Movable Type" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php') ?>" />
+      <api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php') ?>" />
+      <api name="Blogger" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php') ?>" />
+      <api name="Atom" blogID="" preferred="false" apiLink="<?php echo apply_filters('atom_service_url', site_url('wp-app.php/service') ) ?>" />
     </apis>
   </service>
 </rsd>
@@ -45,10 +57,32 @@ include_once(ABSPATH . WPINC . '/class-IXR.php');
 // Turn off all warnings and errors.
 // error_reporting(0);
 
-$post_default_title = ""; // posts submitted via the xmlrpc interface get that title
-
+/**
+ * Posts submitted via the xmlrpc interface get that title
+ * @name post_default_title
+ * @var string
+ */
+$post_default_title = "";
+
+/**
+ * Whether to enable XMLRPC Logging.
+ *
+ * @name xmlrpc_logging
+ * @var int|bool
+ */
 $xmlrpc_logging = 0;
 
+/**
+ * logIO() - Writes logging info to a file.
+ *
+ * @uses $xmlrpc_logging
+ * @package WordPress
+ * @subpackage Logging
+ *
+ * @param string $io Whether input or output
+ * @param string $msg Information describing logging reason.
+ * @return bool Always return true
+ */
 function logIO($io,$msg) {
        global $xmlrpc_logging;
        if ($xmlrpc_logging) {
@@ -59,21 +93,24 @@ function logIO($io,$msg) {
                fclose($fp);
        }
        return true;
-       }
-
-function starify($string) {
-       $i = strlen($string);
-       return str_repeat('*', $i);
 }
 
 if ( isset($HTTP_RAW_POST_DATA) )
-  logIO("I", $HTTP_RAW_POST_DATA);
-
+       logIO("I", $HTTP_RAW_POST_DATA);
+
+/**
+ * @internal
+ * Left undocumented to work on later. If you want to finish, then please do so.
+ *
+ * @package WordPress
+ * @subpackage Publishing
+ */
 class wp_xmlrpc_server extends IXR_Server {
 
        function wp_xmlrpc_server() {
                $this->methods = array(
                        // WordPress API
+                       'wp.getUsersBlogs'              => 'this:wp_getUsersBlogs',
                        'wp.getPage'                    => 'this:wp_getPage',
                        'wp.getPages'                   => 'this:wp_getPages',
                        'wp.newPage'                    => 'this:wp_newPage',
@@ -89,6 +126,9 @@ class wp_xmlrpc_server extends IXR_Server {
                        'wp.getCommentCount'    => 'this:wp_getCommentCount',
                        'wp.getPostStatusList'  => 'this:wp_getPostStatusList',
                        'wp.getPageStatusList'  => 'this:wp_getPageStatusList',
+                       'wp.getPageTemplates'   => 'this:wp_getPageTemplates',
+                       'wp.getOptions'                 => 'this:wp_getOptions',
+                       'wp.setOptions'                 => 'this:wp_setOptions',
 
                        // Blogger API
                        'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs',
@@ -133,6 +173,8 @@ class wp_xmlrpc_server extends IXR_Server {
                        'demo.sayHello' => 'this:sayHello',
                        'demo.addTwoNumbers' => 'this:addTwoNumbers'
                );
+
+               $this->initialise_blog_option_info( );
                $this->methods = apply_filters('xmlrpc_methods', $this->methods);
                $this->IXR_Server($this->methods);
        }
@@ -148,6 +190,11 @@ 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') ) );
+                       return false;
+               }
+
                if (!user_pass_ok($user_login, $user_pass)) {
                        $this->error = new IXR_Error(403, __('Bad login/pass combination.'));
                        return false;
@@ -217,6 +264,105 @@ class wp_xmlrpc_server extends IXR_Server {
                }
        }
 
+       function initialise_blog_option_info( ) {
+               global $wp_version;
+
+               $this->blog_options = array(
+                       // Read only options
+                       'software_name'         => array(
+                               'desc'                  => __( 'Software Name' ),
+                               'readonly'              => true,
+                               'value'                 => 'WordPress'
+                       ),
+                       'software_version'      => array(
+                               'desc'                  => __( 'Software Version' ),
+                               'readonly'              => true,
+                               'value'                 => $wp_version
+                       ),
+                       'blog_url'                      => array(
+                               'desc'                  => __( 'Blog URL' ),
+                               'readonly'              => true,
+                               'option'                => 'siteurl'
+                       ),
+
+                       // Updatable options
+                       'time_zone'                     => array(
+                               'desc'                  => __( 'Time Zone' ),
+                               'readonly'              => false,
+                               'option'                => 'gmt_offset'
+                       ),
+                       'blog_title'            => array(
+                               'desc'                  => __( 'Blog Title' ),
+                               'readonly'              => false,
+                               'option'                        => 'blogname'
+                       ),
+                       'blog_tagline'          => array(
+                               'desc'                  => __( 'Blog Tagline' ),
+                               'readonly'              => false,
+                               'option'                => 'blogdescription'
+                       ),
+                       'date_format'           => array(
+                               'desc'                  => __( 'Date Format' ),
+                               'readonly'              => false,
+                               'option'                => 'date_format'
+                       ),
+                       'time_format'           => array(
+                               'desc'                  => __( 'Time Format' ),
+                               'readonly'              => false,
+                               'option'                => 'time_format'
+                       )
+               );
+
+               $this->blog_options = apply_filters( 'xmlrpc_blog_options', $this->blog_options );
+       }
+
+       /**
+        * WordPress XML-RPC API
+        * wp_getUsersBlogs
+        */
+       function wp_getUsersBlogs( $args ) {
+               // If this isn't on WPMU then just use blogger_getUsersBlogs
+               if( !function_exists( 'is_site_admin' ) ) {
+                       array_unshift( $args, 1 );
+                       return $this->blogger_getUsersBlogs( $args );
+               }
+
+               $this->escape( $args );
+
+               $username = $args[0];
+               $password = $args[1];
+
+               if( !$this->login_pass_ok( $username, $password ) )
+                       return $this->error;
+
+               do_action( 'xmlrpc_call', 'wp.getUsersBlogs' );
+
+               $user = set_current_user( 0, $username );
+
+               $blogs = (array) get_blogs_of_user( $user->ID );
+               $struct = array( );
+
+               foreach( $blogs as $blog ) {
+                       // Don't include blogs that aren't hosted at this site
+                       if( $blog->site_id != 1 )
+                               continue;
+
+                       $blog_id = $blog->userblog_id;
+                       switch_to_blog($blog_id);
+                       $is_admin = current_user_can('level_8');
+
+                       $struct[] = array(
+                               'isAdmin'               => $is_admin,
+                               'url'                   => get_option( 'home' ) . '/',
+                               'blogid'                => $blog_id,
+                               'blogName'              => get_option( 'blogname' ),
+                               'xmlrpc'                => get_option( 'home' ) . '/xmlrpc.php'
+                       );
+               }
+
+               return $struct;
+       }
+
        /**
         * WordPress XML-RPC API
         * wp_getPage
@@ -272,6 +418,10 @@ class wp_xmlrpc_server extends IXR_Server {
                        // Get the author info.
                        $author = get_userdata($page->post_author);
 
+                       $page_template = get_post_meta( $page->ID, '_wp_page_template', true );
+                       if( empty( $page_template ) )
+                               $page_template = 'default';
+
                        $page_struct = array(
                                "dateCreated"                   => new IXR_Date($page_date),
                                "userid"                                => $page->post_author,
@@ -295,7 +445,8 @@ class wp_xmlrpc_server extends IXR_Server {
                                "wp_author_id"                  => $author->ID,
                                "wp_author_display_name"        => $author->display_name,
                                "date_created_gmt"              => new IXR_Date($page_date_gmt),
-                               "custom_fields"                 => $this->get_custom_fields($page_id)
+                               "custom_fields"                 => $this->get_custom_fields($page_id),
+                               "wp_page_template"              => $page_template
                        );
 
                        return($page_struct);
@@ -687,7 +838,7 @@ class wp_xmlrpc_server extends IXR_Server {
                $post_id        = (int) $args[3];
 
                if( !$this->login_pass_ok( $username, $password ) ) {
-                       return new IXR_Error( 403, __( 'Bad login/pass combination.' ) );
+                       return $this->error;
                }
 
                set_current_user( 0, $username );
@@ -697,7 +848,13 @@ class wp_xmlrpc_server extends IXR_Server {
 
                do_action('xmlrpc_call', 'wp.getCommentCount');
 
-               return get_comment_count( $post_id );
+               $count = wp_count_comments( $post_id );
+               return array(
+                       "approved" => $count->approved,
+                       "awaiting_moderation" => $count->moderated,
+                       "spam" => $count->spam,
+                       "total_comments" => $count->total_comments
+               );
        }
 
 
@@ -709,7 +866,7 @@ class wp_xmlrpc_server extends IXR_Server {
                $password       = $args[2];
 
                if( !$this->login_pass_ok( $username, $password ) ) {
-                       return new IXR_Error( 403, __( 'Bad login/pass combination.' ) );
+                       return $this->error;
                }
 
                set_current_user( 0, $username );
@@ -731,7 +888,7 @@ class wp_xmlrpc_server extends IXR_Server {
                $password       = $args[2];
 
                if( !$this->login_pass_ok( $username, $password ) ) {
-                       return new IXR_Error( 403, __( 'Bad login/pass combination.' ) );
+                       return $this->error;
                }
 
                set_current_user( 0, $username );
@@ -744,6 +901,99 @@ class wp_xmlrpc_server extends IXR_Server {
                return get_page_statuses( );
        }
 
+       function wp_getPageTemplates( $args ) {
+               $this->escape( $args );
+
+               $blog_id        = (int) $args[0];
+               $username       = $args[1];
+               $password       = $args[2];
+
+               if( !$this->login_pass_ok( $username, $password ) ) {
+                       return $this->error;
+               }
+
+               set_current_user( 0, $username );
+               if( !current_user_can( 'edit_pages' ) ) {
+                       return new IXR_Error( 403, __( 'You are not allowed access to details about this blog.' ) );
+               }
+
+               $templates = get_page_templates( );
+               $templates['Default'] = 'default';
+
+               return $templates;
+       }
+
+       function wp_getOptions( $args ) {
+               $this->escape( $args );
+
+               $blog_id        = (int) $args[0];
+               $username       = $args[1];
+               $password       = $args[2];
+               $options        = (array) $args[3];
+
+               if( !$this->login_pass_ok( $username, $password ) )
+                       return $this->error;
+
+               $user = set_current_user( 0, $username );
+
+               // If no specific options where asked for, return all of them
+               if (count( $options ) == 0 ) {
+                       $options = array_keys($this->blog_options);
+               }
+
+               return $this->_getOptions($options);
+       }
+
+       function _getOptions($options)
+       {
+               $data = array( );
+               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'] ) ) {
+                                       $data[$option]['value'] = get_option( $data[$option]['option'] );
+                                       unset($data[$option]['option']);
+                               }
+                       }
+               }
+
+               return $data;
+       }
+
+       function wp_setOptions( $args ) {
+               $this->escape( $args );
+
+               $blog_id        = (int) $args[0];
+               $username       = $args[1];
+               $password       = $args[2];
+               $options        = (array) $args[3];
+
+               if( !$this->login_pass_ok( $username, $password ) )
+                       return $this->error;
+
+               $user = set_current_user( 0, $username );
+               if( !current_user_can( 'manage_options' ) )
+                       return new IXR_Error( 403, __( 'You are not allowed to update options.' ) );
+
+               foreach( $options as $o_name => $o_value ) {
+                       $option_names[] = $o_name;
+                       if( empty( $o_value ) )
+                               continue;
+
+                       if( !array_key_exists( $o_name, $this->blog_options ) )
+                               continue;
+
+                       if( $this->blog_options[$o_name]['readonly'] == true )
+                               continue;
+
+                       update_option( $this->blog_options[$o_name]['option'], $o_value );
+               }
+
+               //Now return the updated values
+               return $this->_getOptions($option_names);
+       }
 
        /* Blogger API functions
         * specs on http://plant.blogger.com/api and http://groups.yahoo.com/group/bloggerDev/
@@ -765,13 +1015,14 @@ class wp_xmlrpc_server extends IXR_Server {
                do_action('xmlrpc_call', 'blogger.getUsersBlogs');
 
                set_current_user(0, $user_login);
-               $is_admin = current_user_can('level_8');
+               $is_admin = current_user_can('manage_options');
 
                $struct = array(
                        'isAdmin'  => $is_admin,
                        'url'      => get_option('home') . '/',
                        'blogid'   => '1',
-                       'blogName' => get_option('blogname')
+                       'blogName' => get_option('blogname'),
+                       'xmlrpc'   => get_option('home') . '/xmlrpc.php',
                );
 
                return array($struct);
@@ -1135,11 +1386,14 @@ class wp_xmlrpc_server extends IXR_Server {
                $cap = ( $publish ) ? 'publish_posts' : 'edit_posts';
                $error_message = __( 'Sorry, you are not allowed to publish posts on this blog.' );
                $post_type = 'post';
+               $page_template = '';
                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.' );
                                $post_type = 'page';
+                               if( !empty( $content_struct['wp_page_template'] ) )
+                                       $page_template = $content_struct['wp_page_template'];
                        }
                        elseif( $content_struct['post_type'] == 'post' ) {
                                // This is the default, no changes needed
@@ -1296,7 +1550,7 @@ class wp_xmlrpc_server extends IXR_Server {
                }
 
                if ($post_more) {
-                       $post_content = $post_content . "\n<!--more-->\n" . $post_more;
+                       $post_content = $post_content . "<!--more-->" . $post_more;
                }
 
                $to_ping = $content_struct['mt_tb_ping_urls'];
@@ -1328,9 +1582,9 @@ class wp_xmlrpc_server extends IXR_Server {
                }
 
                // We've got all the data -- post it:
-               $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping', 'post_type', 'post_name', 'post_password', 'post_parent', 'menu_order', 'tags_input');
+               $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping', 'post_type', 'post_name', 'post_password', 'post_parent', 'menu_order', 'tags_input', 'page_template');
 
-               $post_ID = wp_insert_post($postdata);
+               $post_ID = wp_insert_post($postdata, true);
                if ( is_wp_error( $post_ID ) )
                        return new IXR_Error(500, $post_ID->get_error_message());
 
@@ -1342,6 +1596,12 @@ class wp_xmlrpc_server extends IXR_Server {
                        $this->set_custom_fields($post_ID, $content_struct['custom_fields']);
                }
 
+               // Handle enclosures 
+               $enclosure = $content_struct['enclosure']; 
+               if( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) { 
+                       add_post_meta( $post_ID, 'enclosure', $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type'] );
+               } 
+
                $this->attach_uploads( $post_ID, $post_content );
 
                logIO('O', "Posted ! ID: $post_ID");
@@ -1357,7 +1617,7 @@ class wp_xmlrpc_server extends IXR_Server {
                if( is_array( $attachments ) ) {
                        foreach( $attachments as $file ) {
                                if( strpos( $post_content, $file->guid ) !== false ) {
-                                       $wpdb->query( "UPDATE {$wpdb->posts} SET post_parent = '$post_ID' WHERE ID = '{$file->ID}'" );
+                                       $wpdb->query( $wpdb->prepare("UPDATE {$wpdb->posts} SET post_parent = %d WHERE ID = %d", $post_ID, $file->ID) );
                                }
                        }
                }
@@ -1384,11 +1644,14 @@ class wp_xmlrpc_server extends IXR_Server {
                $cap = ( $publish ) ? 'publish_posts' : 'edit_posts';
                $error_message = __( 'Sorry, you are not allowed to publish posts on this blog.' );
                $post_type = 'post';
+               $page_template = '';
                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.' );
                                $post_type = 'page';
+                               if( !empty( $content_struct['wp_page_template'] ) )
+                                       $page_template = $content_struct['wp_page_template'];
                        }
                        elseif( $content_struct['post_type'] == 'post' ) {
                                // This is the default, no changes needed
@@ -1565,7 +1828,7 @@ class wp_xmlrpc_server extends IXR_Server {
                }
 
                if ($post_more) {
-                       $post_content = $post_content . "\n<!--more-->\n" . $post_more;
+                       $post_content = $post_content . "<!--more-->" . $post_more;
                }
 
                $to_ping = $content_struct['mt_tb_ping_urls'];
@@ -1587,9 +1850,12 @@ class wp_xmlrpc_server extends IXR_Server {
                }
 
                // We've got all the data -- post it:
-               $newpost = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'post_date', 'post_date_gmt', 'to_ping', 'post_name', 'post_password', 'post_parent', 'menu_order', 'post_author', 'tags_input');
+               $newpost = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'post_date', 'post_date_gmt', 'to_ping', 'post_name', 'post_password', 'post_parent', 'menu_order', 'post_author', 'tags_input', 'page_template');
+
+               $result = wp_update_post($newpost, true);
+               if ( is_wp_error( $result ) )
+                       return new IXR_Error(500, $result->get_error_message());
 
-               $result = wp_update_post($newpost);
                if (!$result) {
                        return new IXR_Error(500, __('Sorry, your entry could not be edited. Something wrong happened.'));
                }
@@ -1598,6 +1864,12 @@ class wp_xmlrpc_server extends IXR_Server {
                        $this->set_custom_fields($post_ID, $content_struct['custom_fields']);
                }
 
+               // Handle enclosures 
+               $enclosure = $content_struct['enclosure']; 
+               if( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) { 
+                       add_post_meta( $post_ID, 'enclosure', $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type'] );
+               } 
+
                $this->attach_uploads( $ID, $post_content );
 
                logIO('O',"(MW) Edited ! ID: $post_ID");
@@ -2098,7 +2370,7 @@ class wp_xmlrpc_server extends IXR_Server {
                        return new IXR_Error(404, __('Sorry, no such post.'));
                }
 
-               $comments = $wpdb->get_results("SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = $post_ID");
+               $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) {
                        return array();
@@ -2211,7 +2483,7 @@ class wp_xmlrpc_server extends IXR_Server {
                        } elseif (is_string($urltest['fragment'])) {
                                // ...or a string #title, a little more complicated
                                $title = preg_replace('/[^a-z0-9]/i', '.', $urltest['fragment']);
-                               $sql = "SELECT ID FROM $wpdb->posts WHERE post_title RLIKE '$title'";
+                               $sql = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_title RLIKE %s", $title);
                                if (! ($post_ID = $wpdb->get_var($sql)) ) {
                                        // returning unknown error '0' is better than die()ing
                                        return new IXR_Error(0, '');
@@ -2240,7 +2512,7 @@ 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\'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("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post_ID' AND comment_author_url = '$pagelinkedfrom'");
+               $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.'));
@@ -2349,7 +2621,7 @@ class wp_xmlrpc_server extends IXR_Server {
                        return new IXR_Error(32, __('The specified target URL does not exist.'));
                }
 
-               $comments = $wpdb->get_results("SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = $post_ID");
+               $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) {
                        return array();