Wordpress 2.8.2 wordpress-2.8.2
authorEdward Z. Yang <ezyang@mit.edu>
Sat, 21 Nov 2009 01:54:57 +0000 (20:54 -0500)
committerEdward Z. Yang <ezyang@mit.edu>
Sat, 21 Nov 2009 01:54:57 +0000 (20:54 -0500)
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
78 files changed:
readme.html
wp-admin/admin-ajax.php
wp-admin/admin.php
wp-admin/comment.php
wp-admin/css/colors-classic.css
wp-admin/css/colors-fresh.css
wp-admin/css/global.css
wp-admin/css/ie.css
wp-admin/css/theme-editor-rtl.css
wp-admin/css/theme-editor.css
wp-admin/edit-category-form.php
wp-admin/edit-comments.php
wp-admin/edit-form-comment.php
wp-admin/edit-link-category-form.php
wp-admin/edit-tag-form.php
wp-admin/includes/class-wp-filesystem-direct.php
wp-admin/includes/class-wp-filesystem-ssh2.php
wp-admin/includes/comment.php
wp-admin/includes/dashboard.php
wp-admin/includes/file.php
wp-admin/includes/manifest.php
wp-admin/includes/media.php
wp-admin/includes/misc.php
wp-admin/includes/plugin-install.php
wp-admin/includes/plugin.php
wp-admin/includes/template.php
wp-admin/includes/update-core.php
wp-admin/includes/user.php
wp-admin/includes/widgets.php
wp-admin/js/dashboard.dev.js
wp-admin/js/dashboard.js
wp-admin/js/edit-comments.dev.js
wp-admin/js/edit-comments.js
wp-admin/js/post.dev.js
wp-admin/js/post.js
wp-admin/js/postbox.dev.js
wp-admin/js/postbox.js
wp-admin/link-parse-opml.php
wp-admin/media-upload.php
wp-admin/menu-header.php
wp-admin/options-general.php
wp-admin/plugin-editor.php
wp-admin/rtl.css
wp-admin/theme-editor.php
wp-admin/update-core.php
wp-admin/upgrade.php
wp-admin/wp-admin.css
wp-content/plugins/akismet/akismet.php
wp-content/plugins/akismet/readme.txt
wp-content/plugins/hello.php
wp-includes/class-simplepie.php
wp-includes/comment-template.php
wp-includes/default-widgets.php
wp-includes/formatting.php
wp-includes/functions.php
wp-includes/functions.wp-styles.php
wp-includes/http.php
wp-includes/js/tinymce/wp-tinymce.php
wp-includes/kses.php
wp-includes/l10n.php
wp-includes/link-template.php
wp-includes/pluggable.php
wp-includes/plugin.php
wp-includes/pomo/entry.php
wp-includes/pomo/mo.php
wp-includes/pomo/po.php
wp-includes/pomo/streams.php
wp-includes/pomo/translations.php
wp-includes/post-template.php
wp-includes/post.php
wp-includes/query.php
wp-includes/rewrite.php
wp-includes/script-loader.php
wp-includes/update.php
wp-includes/version.php
wp-includes/widgets.php
wp-settings.php
xmlrpc.php

index 3b5b51d874cb2e255fde276457f4ed2b9817ba6d..06a9fa539c30f56a3c6e2fd1739ec787a57c6842 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.8
+       <br /> Version 2.8.2
 </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.8:</h2>
+<h2>Upgrading from any previous WordPress to 2.8.2:</h2>
 <ol>
        <li>Delete your old WP files, saving ones you've modified.</li>
        <li>Upload the new files.</li>
index 1fd0df5342c40c498be99d785b196a9733b8091e..7f04dd7d1473714701897d98f7621c400edddd3c 100644 (file)
@@ -602,8 +602,12 @@ case 'add-comment' :
        if ( !current_user_can( 'edit_post', $id ) )
                die('-1');
        $search = isset($_POST['s']) ? $_POST['s'] : false;
-       $start = isset($_POST['page']) ? intval($_POST['page']) * 25 - 1: 24;
-       $status = isset($_POST['comment_status']) ? $_POST['comment_status'] : false;
+       $status = isset($_POST['comment_status']) ? $_POST['comment_status'] : 'all';
+       $per_page = isset($_POST['per_page']) ?  (int) $_POST['per_page'] + 8 : 28;
+       $start = isset($_POST['page']) ? ( intval($_POST['page']) * $per_page ) -1 : $per_page - 1;
+       if ( 1 > $start )
+               $start = 27;
+
        $mode = isset($_POST['mode']) ? $_POST['mode'] : 'detail';
        $p = isset($_POST['p']) ? $_POST['p'] : 0;
        $comment_type = isset($_POST['comment_type']) ? $_POST['comment_type'] : '';
@@ -814,8 +818,10 @@ case 'add-meta' :
                        die('0'); // if meta doesn't exist
                if ( !current_user_can( 'edit_post', $meta->post_id ) )
                        die('-1');
-               if ( !$u = update_meta( $mid, $key, $value ) )
-                       die('0'); // We know meta exists; we also know it's unchanged (or DB error, in which case there are bigger problems).
+               if ( $meta->meta_value != stripslashes($value) ) {
+                       if ( !$u = update_meta( $mid, $key, $value ) )
+                               die('0'); // We know meta exists; we also know it's unchanged (or DB error, in which case there are bigger problems).
+               }
 
                $key = stripslashes($key);
                $value = stripslashes($value);
index 2c216386dd9f880112c785a5eddcb9aac5888876..f8405f9a09406c3ba940eeddaa9b84425bd54e49 100644 (file)
@@ -146,7 +146,7 @@ if (isset($plugin_page)) {
 
        // Make sure rules are flushed
        global $wp_rewrite;
-       $wp_rewrite->flush_rules();
+       $wp_rewrite->flush_rules(false);
 
        exit();
 } else {
index f6437e575eaa56f356b2b57bf8868d1fed322ef7..6499c08dc91c63ecdc5d5dbf7e95d13831f102fb 100644 (file)
@@ -22,7 +22,7 @@ if ( isset( $_POST['deletecomment'] ) )
  *
  * @param string $msg Error Message. Assumed to contain HTML and be sanitized.
  */
-function comment_footer_die( $msg ) {  //
+function comment_footer_die( $msg ) {
        echo "<div class='wrap'><p>$msg</p></div>";
        include('admin-footer.php');
        die;
@@ -119,7 +119,7 @@ if ( 'spam' == $_GET['dt'] ) {
 <?php if ( $comment->comment_author_url ) { ?>
 <tr>
 <th scope="row"><?php _e('URL'); ?></th>
-<td><a href='<?php echo $comment->comment_author_url; ?>'><?php echo $comment->comment_author_url; ?></a></td>
+<td><a href="<?php echo $comment->comment_author_url; ?>"><?php echo $comment->comment_author_url; ?></a></td>
 </tr>
 <?php } ?>
 <tr>
index d02fb62b5c2b2f113f56c7603c645d3ceae86158..a6cb4f94a86f9b1ef7cc81abdfe5d35c60a6c79f 100644 (file)
@@ -267,7 +267,7 @@ td.help {
        color: #000;
 }
 
-.side-info h5, .bordertitle {
+.side-info h5 {
        border-bottom-color: #dadada;
 }
 
index 9142cd94fa7958d5237125498c703f6f8d6b1e19..7b73e98c00aa1ad14b56dcaa9832e05d32102657 100644 (file)
@@ -267,7 +267,7 @@ td.help {
        color: #000;
 }
 
-.side-info h5, .bordertitle {
+.side-info h5 {
        border-bottom-color: #dadada;
 }
 
index 3afbd2f6f6d905d5b2972315f0b40dfe906bc30b..0ca08320ff80245f67993f4f41e1b1c741f1a804 100644 (file)
@@ -375,7 +375,6 @@ ol.ol-decimal > li {
 .widefat {
        border-width: 1px;
        border-style: solid;
-       border-collapse: separate;
        border-spacing: 0;
        width: 100%;
        clear: both;
index 6c59c93ad41953924d7aaa29bc9605dae35551b9..3ced032d73852e3ea435eaca3d74bfdf953ddc63 100644 (file)
@@ -246,7 +246,8 @@ a.button {
 .tagchecklist,
 #col-container,
 #col-left,
-#col-right {
+#col-right,
+.fileedit-sub {
        display: block;
        zoom: 100%;
 }
@@ -337,6 +338,11 @@ table.ie-fixed {
        padding: 4px 0 22px;
 }
 
+.widefat {
+       empty-cells: show;
+       border-collapse: collapse;
+}
+
 .tablenav a.button-secondary {
        display: inline-block;
        padding: 2px 5px;
index d06a26c0003ce7d456a8e463df0d6aed93bdd615..a4dcb46ebb9b533870ccff1eba2063b88a48175b 100644 (file)
@@ -1,12 +1,3 @@
 #templateside {
        float: left;
 }
-#themeselector {
-       padding-right: 0;
-       padding-left: 5px;
-       float: left;
-}
-div.tablenav {
-       margin-right: 0;
-       margin-left: 210px;
-}
index 2f938d84fe507accaefa00a7415ec372688d6ca9..0a2a554e0b512817a90815bb0f3d9a9660048f36 100644 (file)
 #templateside {
        float: right;
        width: 190px;
+       word-wrap: break-word;
 }
 
-#templateside h3, #postcustomstuff p.submit {
+#templateside h3,
+#postcustomstuff p.submit {
        margin: 0;
 }
 
-h3#bordertitle {
-       margin-bottom: 10px;
-}
-
 #templateside h4 {
-       margin-bottom: 0;
+       margin: 1em 0 0;
 }
 
-#templateside ol, #templateside ul {
-       list-style: none;
+#templateside ol,
+#templateside ul {
        margin: .5em;
        padding: 0;
 }
 
-#templateside ol li, #templateside ul li {
-       margin: 1px 0;
-}
-
-#themeselector {
-       padding-right: 5px;
-       float: right;
-       position: relative;
-       bottom: 25px;
-       top:20px;
-}
-
-#themeselector select {
-       margin: 0;
-       padding: 0;
+#templateside li {
+       margin: 4px 0;
 }
 
 .nonessential {
@@ -56,11 +41,6 @@ h3#bordertitle {
        padding: 1px;
 }
 
-div.bordertitle h2 {
-       border: none;
-       padding-bottom: 0;
-}
-
 div.tablenav {
        margin-right: 210px;
 }
@@ -72,4 +52,9 @@ div.tablenav {
        line-height: 22px;
        vertical-align: top;
        font-weight: bold;
-}
\ No newline at end of file
+}
+
+.fileedit-sub {
+       padding: 10px 0 8px;
+       line-height: 180%;
+}
index 02289aa5c255334d5adb6e31fbdc1d20562324cb..2e37f796411048e53141c9babd159fb01db5c6bf 100644 (file)
@@ -69,6 +69,7 @@ _fill_empty_category($category);
                        <td><textarea name="category_description" id="category_description" rows="5" cols="50" style="width: 97%;"><?php echo esc_html($category->description); ?></textarea><br />
             <span class="description"><?php _e('The description is not prominent by default, however some themes may show it.'); ?></span></td>
                </tr>
+               <?php do_action('edit_category_form_fields', $category); ?>
        </table>
 <p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php esc_attr_e('Update Category'); ?>" /></p>
 <?php do_action('edit_category_form', $category); ?>
index da5ce02048a282e223ea74ddc73f7cc61b0bbc2a..7df02103324fa09daa1845c0bb3466f72f76564c 100644 (file)
@@ -193,7 +193,7 @@ else
 
 $start = $offset = ( $page - 1 ) * $comments_per_page;
 
-list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, $comments_per_page + 5, $post_id, $comment_type ); // Grab a few extra
+list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, $comments_per_page + 8, $post_id, $comment_type ); // Grab a few extra
 
 $_comment_post_ids = array();
 foreach ( $_comments as $_c ) {
@@ -358,7 +358,8 @@ if ( $page_links )
        <input type="hidden" name="s" value="<?php echo esc_attr($search); ?>" />
        <input type="hidden" name="mode" value="<?php echo esc_attr($mode); ?>" />
        <input type="hidden" name="comment_status" value="<?php echo esc_attr($comment_status); ?>" />
-       <input type="hidden" name="page" value="<?php echo isset($_REQUEST['page']) ? absint( $_REQUEST['page'] ) : 1; ?>" />
+       <input type="hidden" name="page" value="<?php echo esc_attr($page); ?>" />
+       <input type="hidden" name="per_page" value="<?php echo esc_attr($comments_per_page); ?>" />
        <input type="hidden" name="p" value="<?php echo esc_attr( $post_id ); ?>" />
        <input type="hidden" name="comment_type" value="<?php echo esc_attr( $comment_type ); ?>" />
        <?php wp_nonce_field( 'add-comment', '_ajax_nonce', false ); ?>
index 022c39011da2a1304ee5d9a5d06dd8e08a9bbcae..f58657830da708259c2664d5baf6c380d45f8443 100644 (file)
@@ -13,6 +13,7 @@ $submitbutton_text = __('Edit Comment');
 $toprow_title = sprintf(__('Editing Comment # %s'), $comment->comment_ID);
 $form_action = 'editedcomment';
 $form_extra = "' />\n<input type='hidden' name='comment_ID' value='" . esc_attr($comment->comment_ID) . "' />\n<input type='hidden' name='comment_post_ID' value='" . esc_attr($comment->comment_post_ID);
+$comment->comment_author_email = esc_attr($comment->comment_author_email);
 ?>
 
 <form name="post" action="comment.php" method="post" id="post">
@@ -24,12 +25,6 @@ $form_extra = "' />\n<input type='hidden' name='comment_ID' value='" . esc_attr(
 <div id="poststuff" class="metabox-holder has-right-sidebar">
 <input type="hidden" name="user_ID" value="<?php echo (int) $user_ID ?>" />
 <input type="hidden" name="action" value='<?php echo $form_action . $form_extra ?>' />
-<?php
-
-$email = esc_attr( $comment->comment_author_email );
-$url = esc_attr( $comment->comment_author_url );
-// add_meta_box('submitdiv', __('Save'), 'comment_submit_meta_box', 'comment', 'side', 'core');
-?>
 
 <div id="side-info-column" class="inner-sidebar">
 <div id="submitdiv" class="stuffbox" >
@@ -95,20 +90,19 @@ $date = date_i18n( $datef, strtotime( $comment->comment_date ) );
 <tr valign="top">
        <td class="first">
        <?php
-               if ( $email ) {
+               if ( $comment->comment_author_email ) {
                        printf( __( 'E-mail (%s):' ), get_comment_author_email_link( __( 'send e-mail' ), '', '' ) );
                } else {
                        _e( 'E-mail:' );
                }
 ?></td>
-       <td><input type="text" name="newcomment_author_email" size="30" value="<?php echo esc_attr($email); ?>" tabindex="2" id="email" /></td>
+       <td><input type="text" name="newcomment_author_email" size="30" value="<?php echo $comment->comment_author_email; ?>" tabindex="2" id="email" /></td>
 </tr>
 <tr valign="top">
        <td class="first">
        <?php
-               $url = get_comment_author_url();
-               if ( ! empty( $url ) && 'http://' != $url ) {
-                       $link = "<a href='$url' rel='external nofollow' target='_blank'>" . __('visit site') . "</a>";
+               if ( ! empty( $comment->comment_author_url ) && 'http://' != $comment->comment_author_url ) {
+                       $link = '<a href="' . $comment->comment_author_url . '" rel="external nofollow" target="_blank">' . __('visit site') . '</a>';
                        printf( __( 'URL (%s):' ), apply_filters('get_comment_author_link', $link ) );
                } else {
                        _e( 'URL:' );
index be52d1c01c65614bf0a9260384604a343ac21d93..bb721110c657dfa822a6eb0597998f51179bdf85 100644 (file)
@@ -74,6 +74,7 @@ _fill_empty_link_category($category);
                        <th scope="row" valign="top"><label for="description"><?php _e('Description (optional)') ?></label></th>
                        <td><textarea name="description" id="description" rows="5" cols="50" style="width: 97%;"><?php echo $category->description; ?></textarea></td>
                </tr>
+               <?php do_action('edit_link_category_form_fields', $category); ?>
        </table>
 <p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php echo esc_attr($submit_text) ?>" /></p>
 <?php do_action('edit_link_category_form', $category); ?>
index f1cc536600c858ffa11bcf495130c9252ea19fd9..efef02bcabbb03048c5efb96c1badf29cee120f5 100644 (file)
@@ -39,6 +39,7 @@ do_action('edit_tag_form_pre', $tag); ?>
                        <td><textarea name="description" id="description" rows="5" cols="50" style="width: 97%;"><?php echo esc_html($tag->description); ?></textarea><br />
             <span class="description"><?php _e('The description is not prominent by default, however some themes may show it.'); ?></span></td>
                </tr>
+               <?php do_action('edit_tag_form_fields', $tag); ?>
        </table>
 <p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php esc_attr_e('Update Tag'); ?>" /></p>
 <?php do_action('edit_tag_form', $tag); ?>
index 7878c2fa2b0eafb55a2f09b941263877ef7c2a82..03a797734c51dfa8b185e1d00a41e96bb28005f6 100644 (file)
@@ -20,7 +20,6 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
        function WP_Filesystem_Direct($arg) {
                $this->method = 'direct';
                $this->errors = new WP_Error();
-               $this->permission = umask();
        }
        function connect() {
                return true;
@@ -64,12 +63,22 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
                return true;
        }
        function chmod($file, $mode = false, $recursive = false) {
-               if ( ! $mode )
-                       $mode = $this->permission;
                if ( ! $this->exists($file) )
                        return false;
+
+               if ( ! $mode ) {
+                       if ( $this->permission )
+                               $mode = $this->permission;
+                       elseif ( $this->is_file($file) )
+                               $mode = FS_CHMOD_FILE;
+                       elseif ( $this->is_dir($file) )
+                               $mode = FS_CHMOD_DIR;
+                       else
+                               return false;   
+               }
+
                if ( ! $recursive )
-                       return @chmod($file,$mode);
+                       return @chmod($file, $mode);
                if ( ! $this->is_dir($file) )
                        return @chmod($file, $mode);
                //Is a directory, and we want recursive
@@ -197,11 +206,9 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
        }
 
        function mkdir($path, $chmod = false, $chown = false, $chgrp = false){
-               if ( ! $chmod)
-                       $chmod = $this->permission;
-
-               if ( ! @mkdir($path, $chmod) )
+               if ( ! @mkdir($path) )
                        return false;
+               $this->chmod($path, $chmod);
                if ( $chown )
                        $this->chown($path, $chown);
                if ( $chgrp )
index 7bcd4b74693c2b859d30284cf1d580c52ae9a228..89763df842bdeab903ac77536fbc8ec3145c433e 100644 (file)
@@ -13,7 +13,7 @@
  *
  * @contrib http://kevin.vanzonneveld.net/techblog/article/make_ssh_connections_with_php/ - Installation Notes
  *
- * Complie libssh2 (Note: Only 0.14 is officaly working with PHP 5.2.6+ right now.)
+ * Complie libssh2 (Note: Only 0.14 is officaly working with PHP 5.2.6+ right now, But many users have found the latest versions work)
  *
  * cd /usr/src
  * wget http://surfnet.dl.sourceforge.net/sourceforge/libssh2/libssh2-0.14.tar.gz
@@ -22,7 +22,7 @@
  * ./configure
  * make all install
  *
- * Note: No not leave the directory yet!
+ * Note: Do not leave the directory yet!
  *
  * Enter: pecl install -f ssh2
  *
@@ -33,6 +33,7 @@
  * Restart Apache!
  * Check phpinfo() streams to confirm that: ssh2.shell, ssh2.exec, ssh2.tunnel, ssh2.scp, ssh2.sftp  exist.
  *
+ * Note: as of WordPress 2.8, This utilises the PHP5+ function 'stream_get_contents'
  *
  * @since 2.7
  * @package WordPress
@@ -45,7 +46,7 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
        var $sftp_link = false;
        var $keys = false;
        /*
-        * This is the timeout value for ssh results to comeback.
+        * This is the timeout value for ssh results.
         * Slower servers might need this incressed, but this number otherwise should not change.
         *
         * @parm $timeout int
@@ -66,8 +67,8 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
                        $this->errors->add('no_ssh2_ext', __('The ssh2 PHP extension is not available'));
                        return false;
                }
-               if ( ! version_compare(phpversion(), '5', '>=') ) {
-                       $this->errors->add('ssh2_php_requirement', __('The ssh2 PHP extension is available, however requires PHP 5+'));
+               if ( !function_exists('stream_get_contents') ) {
+                       $this->errors->add('ssh2_php_requirement', __('The ssh2 PHP extension is available, however, we require the PHP5 function <code>stream_get_contents()</code>'));
                        return false;
                }
 
@@ -101,7 +102,7 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
                        $this->options['username'] = $opt['username'];
 
                if ( empty ($opt['password']) ) {
-                       if ( !$this->keys )     //       password can be blank if we are using keys
+                       if ( !$this->keys )     //password can be blank if we are using keys
                                $this->errors->add('empty_password', __('SSH2 password is required'));
                } else {
                        $this->options['password'] = $opt['password'];
@@ -128,7 +129,7 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
                        }
                } else {
                        if ( ! @ssh2_auth_pubkey_file($this->link, $this->options['username'], $this->options['public_key'], $this->options['private_key'], $this->options['password'] ) ) {
-                               $this->errors->add('auth', sprintf(__('Public and Private keys incorrent for %s'), $this->options['username']));
+                               $this->errors->add('auth', sprintf(__('Public and Private keys incorrect for %s'), $this->options['username']));
                                return false;
                        }
                }
@@ -148,10 +149,11 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
                } else {
                        stream_set_blocking( $stream, true );
                        stream_set_timeout( $stream, $this->timeout );
-                       $data = stream_get_contents($stream);
+                       $data = stream_get_contents( $stream );
+                       fclose( $stream );
 
                        if ( $returnbool )
-                               return '' != trim($data);
+                               return ( $data === false ) ? false : '' != trim($data);
                        else
                                return $data;
                }
@@ -166,17 +168,17 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
 
        function get_contents($file, $type = '', $resumepos = 0 ) {
                $file = ltrim($file, '/');
-               return file_get_contents('ssh2.sftp://' . $this->sftp_link .'/' . $file);
+               return file_get_contents('ssh2.sftp://' . $this->sftp_link . '/' . $file);
        }
 
        function get_contents_array($file) {
                $file = ltrim($file, '/');
-               return file('ssh2.sftp://' . $this->sftp_link .'/' . $file);
+               return file('ssh2.sftp://' . $this->sftp_link . '/' . $file);
        }
 
        function put_contents($file, $contents, $type = '' ) {
                $file = ltrim($file, '/');
-               return file_put_contents('ssh2.sftp://' . $this->sftp_link .'/' . $file, $contents);
+               return file_put_contents('ssh2.sftp://' . $this->sftp_link . '/' . $file, $contents);
        }
 
        function cwd() {
@@ -270,44 +272,43 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
        }
 
        function exists($file) {
-               //return $this->run_command(sprintf('ls -lad %s', escapeshellarg($file)), true);
                $file = ltrim($file, '/');
-               return file_exists('ssh2.sftp://' . $this->sftp_link .'/' . $file);
+               return file_exists('ssh2.sftp://' . $this->sftp_link . '/' . $file);
        }
 
        function is_file($file) {
                $file = ltrim($file, '/');
-               return is_file('ssh2.sftp://' . $this->sftp_link .'/' . $file);
+               return is_file('ssh2.sftp://' . $this->sftp_link . '/' . $file);
        }
 
        function is_dir($path) {
                $path = ltrim($path, '/');
-               return is_dir('ssh2.sftp://' . $this->sftp_link .'/' . $path);
+               return is_dir('ssh2.sftp://' . $this->sftp_link . '/' . $path);
        }
 
        function is_readable($file) {
                $file = ltrim($file, '/');
-               return is_readable('ssh2.sftp://' . $this->sftp_link .'/' . $file);
+               return is_readable('ssh2.sftp://' . $this->sftp_link . '/' . $file);
        }
 
        function is_writable($file) {
                $file = ltrim($file, '/');
-               return is_writable('ssh2.sftp://' . $this->sftp_link .'/' . $file);
+               return is_writable('ssh2.sftp://' . $this->sftp_link . '/' . $file);
        }
 
        function atime($file) {
                $file = ltrim($file, '/');
-               return fileatime('ssh2.sftp://' . $this->sftp_link .'/' . $file);
+               return fileatime('ssh2.sftp://' . $this->sftp_link . '/' . $file);
        }
 
        function mtime($file) {
                $file = ltrim($file, '/');
-               return filemtime('ssh2.sftp://' . $this->sftp_link .'/' . $file);
+               return filemtime('ssh2.sftp://' . $this->sftp_link . '/' . $file);
        }
 
        function size($file) {
                $file = ltrim($file, '/');
-               return filesize('ssh2.sftp://' . $this->sftp_link .'/' . $file);
+               return filesize('ssh2.sftp://' . $this->sftp_link . '/' . $file);
        }
 
        function touch($file, $time = 0, $atime = 0) {
@@ -379,4 +380,4 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
                unset($dir);
                return $ret;
        }
-}
\ No newline at end of file
+}
index 56e181afe6807f3152754836a9ad1b5961920152..26f25564a184a1707adb807035ed81a26bcf8bbd 100644 (file)
@@ -89,8 +89,8 @@ function get_comment_to_edit( $id ) {
 
        $comment->comment_author = format_to_edit( $comment->comment_author );
        $comment->comment_author_email = format_to_edit( $comment->comment_author_email );
-       $comment->comment_author_url = esc_url($comment->comment_author_url);
        $comment->comment_author_url = format_to_edit( $comment->comment_author_url );
+       $comment->comment_author_url = esc_url($comment->comment_author_url);
 
        return $comment;
 }
index ec93fb0d095d924f60223681eaf032521bfb4be0..56c5581ef8306ce12610387c61adccb3f29c9fb9 100644 (file)
@@ -605,7 +605,7 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
 }
 
 function wp_dashboard_incoming_links() {
-       wp_dashboard_cached_rss_widget( 'dashboard_incoming_links', 'wp_dashboard_incoming_links_output' );
+       echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>';
 }
 
 /**
@@ -634,8 +634,10 @@ function wp_dashboard_incoming_links_output() {
 
        echo "<ul>\n";
 
-       $count = 0;
-       foreach ( $rss->get_items() as $item ) {
+       if ( !isset($items) )
+               $items = 10;
+
+       foreach ( $rss->get_items(0, $items) as $item ) {
                $publisher = '';
                $site_link = '';
                $link = '';
@@ -644,10 +646,14 @@ function wp_dashboard_incoming_links_output() {
                $link = esc_url( strip_tags( $item->get_link() ) );
 
                $author = $item->get_author();
-               $site_link = esc_url( strip_tags( $author->get_link() ) );
+               if ( $author ) {
+                       $site_link = esc_url( strip_tags( $author->get_link() ) );
 
-               if ( !$publisher = esc_html( strip_tags( $author->get_name() ) ) )
-                       $publisher = __( 'Somebody' );
+                       if ( !$publisher = esc_html( strip_tags( $author->get_name() ) ) )
+                               $publisher = __( 'Somebody' );
+               } else {
+                 $publisher = __( 'Somebody' );
+               }
                if ( $site_link )
                        $publisher = "<a href='$site_link'>$publisher</a>";
                else
@@ -684,7 +690,7 @@ function wp_dashboard_incoming_links_control() {
 }
 
 function wp_dashboard_primary() {
-       wp_dashboard_cached_rss_widget( 'dashboard_primary', 'wp_dashboard_rss_output' );
+       echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>';
 }
 
 function wp_dashboard_primary_control() {
@@ -706,7 +712,7 @@ function wp_dashboard_rss_output( $widget_id ) {
 }
 
 function wp_dashboard_secondary() {
-       wp_dashboard_cached_rss_widget( 'dashboard_secondary', 'wp_dashboard_secondary_output' );
+       echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>';
 }
 
 function wp_dashboard_secondary_control() {
@@ -741,11 +747,7 @@ function wp_dashboard_secondary_output() {
 }
 
 function wp_dashboard_plugins() {
-       wp_dashboard_cached_rss_widget( 'dashboard_plugins', 'wp_dashboard_plugins_output', array(
-               'http://wordpress.org/extend/plugins/rss/browse/popular/',
-               'http://wordpress.org/extend/plugins/rss/browse/new/',
-               'http://wordpress.org/extend/plugins/rss/browse/updated/'
-       ) );
+       echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>';
 }
 
 /**
index 77baecd2a2fa22ffc9da9204d77a7af279979300..5cd7a454d6cdd1f5598c94a596d9566edaab37c6 100644 (file)
@@ -445,7 +445,7 @@ function download_url( $url ) {
        if ( ! $handle )
                return new WP_Error('http_no_file', __('Could not create Temporary file'));
 
-       $response = wp_remote_get($url, array('timeout' => 30));
+       $response = wp_remote_get($url, array('timeout' => 60));
 
        if ( is_wp_error($response) ) {
                fclose($handle);
@@ -645,7 +645,7 @@ function get_filesystem_method($args = array(), $context = false) {
                }
        }
 
-       if ( ! $method && isset($args['connection_type']) && 'ssh' == $args['connection_type'] && extension_loaded('ssh2') && extension_loaded('sockets') ) $method = 'ssh2';
+       if ( ! $method && isset($args['connection_type']) && 'ssh' == $args['connection_type'] && extension_loaded('ssh2') && function_exists('stream_get_contents') ) $method = 'ssh2';
        if ( ! $method && extension_loaded('ftp') ) $method = 'ftpext';
        if ( ! $method && ( extension_loaded('sockets') || function_exists('fsockopen') ) ) $method = 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread
        return apply_filters('filesystem_method', $method, $args);
@@ -761,7 +761,7 @@ jQuery(function($){
 <td><input name="password" type="password" id="password" value="<?php if ( defined('FTP_PASS') ) echo '*****'; ?>"<?php if ( defined('FTP_PASS') ) echo ' disabled="disabled"' ?> size="40" /></td>
 </tr>
 
-<?php if ( extension_loaded('ssh2') ) : ?>
+<?php if ( extension_loaded('ssh2') && function_exists('stream_get_contents') ) : ?>
 <tr id="ssh_keys" valign="top" style="<?php if ( 'ssh' != $connection_type ) echo 'display:none' ?>">
 <th scope="row"><?php _e('Authentication Keys') ?>
 <div class="key-labels textright">
@@ -781,7 +781,7 @@ jQuery(function($){
 <?php if ( 'ftpext' == $type ) : ?>
 <br /><label><input id="ftps" name="connection_type" type="radio" value="ftps" <?php checked('ftps', $connection_type); if ( defined('FTP_SSL') || defined('FTP_SSH') ) echo ' disabled="disabled"';  ?>/> <?php _e('FTPS (SSL)') ?></label>
 <?php endif; ?>
-<?php if ( extension_loaded('ssh2') ) : ?>
+<?php if ( extension_loaded('ssh2') && function_exists('stream_get_contents') ) : ?>
 <br /><label><input id="ssh" name="connection_type" type="radio" value="ssh" <?php checked('ssh', $connection_type);  if ( defined('FTP_SSL') || defined('FTP_SSH') ) echo ' disabled="disabled"'; ?>/> <?php _e('SSH') ?></label>
 <?php endif; ?>
 </fieldset>
index bdff9fd42a49267570c5cae99aef477d2e863abd..6b763df4545def5a1eebe3c55b0faaadeabab4a8 100644 (file)
@@ -92,8 +92,7 @@ function &get_manifest() {
 
        if ( @is_file('../wp-includes/js/tinymce/tiny_mce.js') ) :
        $mce = array(
-               array('../wp-includes/js/tinymce/wp-tinymce.php', 'c=1&' . $mce_ver, true),
-               array('../wp-includes/js/tinymce/wp-tinymce.php', 'c=0&' . $mce_ver, true),
+               array('../wp-includes/js/tinymce/wp-tinymce.php', $mce_ver, true),
 
                array('../wp-includes/js/tinymce/tiny_mce.js', $mce_ver, true),
                array('../wp-includes/js/tinymce/langs/wp-langs-en.js', $mce_ver, true),
index ab7cc58b143fbe88d9271718c0037482f3b6472f..e6e7b6b89136151a048393fc38e37bcf339ffd1b 100644 (file)
@@ -369,7 +369,6 @@ EOF;
        printf($context, $out);
 }
 add_action( 'media_buttons', 'media_buttons' );
-add_action('media_upload_media', 'media_upload_handler');
 
 /**
  * {@internal Missing Short Description}}
@@ -381,7 +380,7 @@ add_action('media_upload_media', 'media_upload_handler');
 function media_upload_form_handler() {
        check_admin_referer('media-form');
 
-       $errors = array();
+       $errors = null;
 
        if ( isset($_POST['send']) ) {
                $keys = array_keys($_POST['send']);
@@ -1312,10 +1311,10 @@ var swfu;
 SWFUpload.onload = function() {
        var settings = {
                        button_text: '<span class="button"><?php _e('Select Files'); ?></span>',
-                       button_text_style: '.button { text-align: center; font-weight: bold; font-family:"Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana,sans-serif; }',
+                       button_text_style: '.button { text-align: center; font-weight: bold; font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif; }',
                        button_height: "24",
                        button_width: "132",
-                       button_text_top_padding: 1,
+                       button_text_top_padding: 2,
                        button_image_url: '<?php echo includes_url('images/upload.png'); ?>',
                        button_placeholder_id: "flash-browse-button",
                        upload_url : "<?php echo esc_attr( $flash_action_url ); ?>",
index d020e74add59a42f0c157bbfbdd702f7134ac942..356c6b0018b1a16cd7af2a58fe7026f566840907 100644 (file)
@@ -72,7 +72,9 @@ function insert_with_markers( $filename, $marker, $insertion ) {
                        $markerdata = explode( "\n", implode( '', file( $filename ) ) );
                }
 
-               $f = fopen( $filename, 'w' );
+               if ( !$f = @fopen( $filename, 'w' ) )
+                       return false;
+
                $foundit = false;
                if ( $markerdata ) {
                        $state = true;
@@ -270,6 +272,9 @@ function wp_doc_link_parse( $content ) {
        if ( !is_string( $content ) || empty( $content ) )
                return array();
 
+       if ( !function_exists('token_get_all') )
+               return array();
+
        $tokens = token_get_all( $content );
        $functions = array();
        $ignore_functions = array();
index bcd9e1b2a20f0aec29d21a9bd91e13a3022439e3..f81ecc82d9f842266c8165a5b601de5a2274089a 100644 (file)
@@ -46,6 +46,8 @@ function plugins_api($action, $args = null) {
                        if ( ! $res )
                                $res = new WP_Error('plugins_api_failed', __('An unknown error occurred'), $request['body']);
                }
+       } elseif ( !is_wp_error($res) ) {
+               $res->external = true;
        }
 
        return apply_filters('plugins_api_result', $res, $action, $args);
@@ -441,7 +443,7 @@ function install_plugin_information() {
                        //Default to a "new" plugin
                        $type = 'install';
                        //Check to see if this plugin is known to be installed, and has an update awaiting it.
-                       $update_plugins = get_option('update_plugins');
+                       $update_plugins = get_transient('update_plugins');
                        if ( is_object( $update_plugins ) ) {
                                foreach ( (array)$update_plugins->response as $file => $plugin ) {
                                        if ( $plugin->slug === $api->slug ) {
@@ -462,7 +464,7 @@ function install_plugin_information() {
                                                $newer_version = $installed_plugin[ $key ]['Version'];
                                        } else {
                                                //If the above update check failed, Then that probably means that the update checker has out-of-date information, force a refresh
-                                               delete_option('update_plugins');
+                                               delete_transient('update_plugins');
                                                $update_file = $api->slug . '/' . $key; //This code branch only deals with a plugin which is in a folder the same name as its slug, Doesnt support plugins which have 'non-standard' names
                                                $type = 'update_available';
                                        }
@@ -509,12 +511,13 @@ function install_plugin_information() {
                        <li><strong><?php _e('Compatible up to:') ?></strong> <?php echo $api->tested ?></li>
 <?php endif; if ( ! empty($api->downloaded) ) : ?>
                        <li><strong><?php _e('Downloaded:') ?></strong> <?php printf(_n('%s time', '%s times', $api->downloaded), number_format_i18n($api->downloaded)) ?></li>
-<?php endif; if ( ! empty($api->slug) ) : ?>
+<?php endif; if ( ! empty($api->slug) && empty($api->external) ) : ?>
                        <li><a target="_blank" href="http://wordpress.org/extend/plugins/<?php echo $api->slug ?>/"><?php _e('WordPress.org Plugin Page &#187;') ?></a></li>
 <?php endif; if ( ! empty($api->homepage) ) : ?>
                        <li><a target="_blank" href="<?php echo $api->homepage ?>"><?php _e('Plugin Homepage  &#187;') ?></a></li>
 <?php endif; ?>
                </ul>
+               <?php if ( ! empty($api->rating) ) : ?>
                <h2><?php _e('Average Rating') ?></h2>
                <div class="star-holder" title="<?php printf(_n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings)); ?>">
                        <div class="star star-rating" style="width: <?php echo esc_attr($api->rating) ?>px"></div>
@@ -525,6 +528,7 @@ function install_plugin_information() {
                        <div class="star star1"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('1 star') ?>" /></div>
                </div>
                <small><?php printf(_n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings)); ?></small>
+               <?php endif; ?>
        </div>
        <div id="section-holder" class="wrap">
        <?php
index 4f469c9611806ea720da43e73c0f334a68267d20..88a95dda84d4e39e3a6dc44d66d13fe5cff77f59 100644 (file)
@@ -585,7 +585,7 @@ function uninstall_plugin($plugin) {
 //
 
 function add_menu_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '' ) {
-       global $menu, $admin_page_hooks;
+       global $menu, $admin_page_hooks, $_registered_pages;
 
        $file = plugin_basename( $file );
 
@@ -602,11 +602,13 @@ function add_menu_page( $page_title, $menu_title, $access_level, $file, $functio
 
        $menu[] = array ( $menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url );
 
+       $_registered_pages[$hookname] = true;
+
        return $hookname;
 }
 
 function add_object_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '') {
-       global $menu, $admin_page_hooks, $_wp_last_object_menu;
+       global $menu, $admin_page_hooks, $_wp_last_object_menu, $_registered_pages;
 
        $file = plugin_basename( $file );
 
@@ -623,11 +625,13 @@ function add_object_page( $page_title, $menu_title, $access_level, $file, $funct
 
        $menu[$_wp_last_object_menu] = array ( $menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url );
 
+       $_registered_pages[$hookname] = true;
+
        return $hookname;
 }
 
 function add_utility_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '') {
-       global $menu, $admin_page_hooks, $_wp_last_utility_menu;
+       global $menu, $admin_page_hooks, $_wp_last_utility_menu, $_registered_pages;
 
        $file = plugin_basename( $file );
 
@@ -646,6 +650,8 @@ function add_utility_page( $page_title, $menu_title, $access_level, $file, $func
 
        $menu[$_wp_last_utility_menu] = array ( $menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url );
 
+       $_registered_pages[$hookname] = true;
+
        return $hookname;
 }
 
@@ -654,6 +660,7 @@ function add_submenu_page( $parent, $page_title, $menu_title, $access_level, $fi
        global $menu;
        global $_wp_real_parent_file;
        global $_wp_submenu_nopriv;
+       global $_registered_pages;
 
        $file = plugin_basename( $file );
 
@@ -683,6 +690,11 @@ function add_submenu_page( $parent, $page_title, $menu_title, $access_level, $fi
        if (!empty ( $function ) && !empty ( $hookname ))
                add_action( $hookname, $function );
 
+       $_registered_pages[$hookname] = true;
+       // backwards-compatibility for plugins using add_management page.  See wp-admin/admin.php for redirect from edit.php to tools.php
+       if ( 'tools.php' == $parent ) 
+               $_registered_pages[get_plugin_page_hookname( $file, 'edit.php')] = true;
+
        return $hookname;
 }
 
@@ -919,14 +931,21 @@ function user_can_access_admin_page() {
        global $_wp_menu_nopriv;
        global $_wp_submenu_nopriv;
        global $plugin_page;
+       global $_registered_pages;
 
        $parent = get_admin_page_parent();
 
        if ( !isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$parent][$pagenow] ) )
                return false;
 
-       if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$parent][$plugin_page] ) )
-               return false;
+       if ( isset( $plugin_page ) ) {
+               if ( isset( $_wp_submenu_nopriv[$parent][$plugin_page] ) )
+                       return false;
+
+               $hookname = get_plugin_page_hookname($plugin_page, $parent);
+               if ( !isset($_registered_pages[$hookname]) )
+                       return false;
+       }
 
        if ( empty( $parent) ) {
                if ( isset( $_wp_menu_nopriv[$pagenow] ) )
@@ -935,6 +954,8 @@ function user_can_access_admin_page() {
                        return false;
                if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) )
                        return false;
+               if ( isset( $plugin_page ) && isset( $_wp_menu_nopriv[$plugin_page] ) )
+                       return false;
                foreach (array_keys( $_wp_submenu_nopriv ) as $key ) {
                        if ( isset( $_wp_submenu_nopriv[$key][$pagenow] ) )
                                return false;
@@ -944,6 +965,9 @@ function user_can_access_admin_page() {
                return true;
        }
 
+       if ( isset( $plugin_page ) && ( $plugin_page == $parent ) && isset( $_wp_menu_nopriv[$plugin_page] ) )
+               return false;
+
        if ( isset( $submenu[$parent] ) ) {
                foreach ( $submenu[$parent] as $submenu_array ) {
                        if ( isset( $plugin_page ) && ( $submenu_array[2] == $plugin_page ) ) {
index 13faf1063b9bfffb2c393c998d2c6d7fa01225d0..b47e079de14249607f482c70c94ba486876d193c 100644 (file)
@@ -1447,6 +1447,8 @@ function _post_row($a_post, $pending_comments, $mode) {
                        if ( current_user_can('edit_post', $post->ID) ) {
                                $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this post')) . '">' . __('Edit') . '</a>';
                                $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this post inline')) . '">' . __('Quick&nbsp;Edit') . '</a>';
+                       }
+                       if ( current_user_can('delete_post', $post->ID) ) {
                                $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this post')) . "' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
                        }
                        if ( in_array($post->post_status, array('pending', 'draft')) ) {
@@ -1660,6 +1662,8 @@ foreach ($posts_columns as $column_name=>$column_display_name) {
                if ( current_user_can('edit_page', $page->ID) ) {
                        $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr(__('Edit this page')) . '">' . __('Edit') . '</a>';
                        $actions['inline'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
+               }
+               if ( current_user_can('delete_page', $page->ID) ) {
                        $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this page')) . "' href='" . wp_nonce_url("page.php?action=delete&amp;post=$page->ID", 'delete-page_' . $page->ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf( ('draft' == $page->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this page '%s'\n 'Cancel' to stop, 'OK' to delete."), $page->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
                }
                if ( in_array($post->post_status, array('pending', 'draft')) ) {
@@ -2081,9 +2085,7 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true,
        $author_url = get_comment_author_url();
        if ( 'http://' == $author_url )
                $author_url = '';
-       $author_url_display = $author_url;
-       $author_url_display = str_replace('http://www.', '', $author_url_display);
-       $author_url_display = str_replace('http://', '', $author_url_display);
+       $author_url_display = preg_replace('|http://(www\.)?|i', '', $author_url);
        if ( strlen($author_url_display) > 50 )
                $author_url_display = substr($author_url_display, 0, 49) . '...';
 
@@ -3471,11 +3473,6 @@ function screen_meta($screen) {
                                $_wp_contextual_help[$screen] = $help;
                        }
                        break;
-               case 'theme-editor':
-               case 'plugin-editor':
-                       $settings = '<p><a id="codepress-on" href="' . $screen . '.php?codepress=on">' . __('Enable syntax highlighting') . '</a><a id="codepress-off" href="' . $screen . '.php?codepress=off">' . __('Disable syntax highlighting') . "</a></p>\n";
-                       $show_screen = true;
-                       break;
                case 'widgets':
                        if ( !isset($_wp_contextual_help['widgets']) ) {
                                $help = widgets_help();
index 9aac1e77b7ff2078ea1cc80389bc703f7aa50364..5abee7573a120e82e8a896aad543afbd24d42f0a 100644 (file)
@@ -229,7 +229,7 @@ function update_core($from, $to) {
        $result = copy_dir($from . '/wordpress', $to);
        if ( is_wp_error($result) ) {
                $wp_filesystem->delete($maintenance_file);
-               $wp_filesystem->delete($working_dir, true);
+               $wp_filesystem->delete($from, true);
                return $result;
        }
 
index 33e751f53c6a0c1e85636fa64ae2889425750533..8c6bf2b7c5057c57f3fb2bf74b3635ca8e2ca477 100644 (file)
@@ -253,7 +253,7 @@ function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'p
                if ( $user->has_cap("edit_{$post_type}s") || $exclude_zeros == false )
                        return array($user->id);
                else
-                       return false;
+                       return array();
        }
 
        $level_key = $wpdb->prefix . 'user_level';
index 2be814534500c5f5ba5fe3c25455b808c87bdd7d..d6d930dae0c8040a6b5b379eb02b08165b8b943f 100644 (file)
@@ -97,10 +97,13 @@ function wp_list_widget_controls_dynamic_sidebar( $params ) {
 
 function next_widget_id_number($id_base) {
        global $wp_registered_widgets;
-       $number = 2;
+       $number = 1;
 
-       while ( isset($wp_registered_widgets["$id_base-$number"]) )
-               $number++;
+       foreach ( $wp_registered_widgets as $widget_id => $widget ) {
+               if ( preg_match( '/' . $id_base . '-([0-9]+)$/', $widget_id, $matches ) )
+                       $number = max($number, $matches[1]);
+       }
+       $number++;
 
        return $number;
 }
index 75d4521de47d4a8c94f3664f52a76f27c29830b9..aa33391c8b018a19ba59a157148a1009a7d61660 100644 (file)
@@ -1,6 +1,6 @@
+var ajaxWidgets, ajaxPopulateWidgets, quickPressLoad;
 
 jQuery(document).ready( function($) {
-       var ajaxWidgets, ajaxPopulateWidgets, quickPressLoad;
        // These widgets are sometimes populated via ajax
        ajaxWidgets = [
                'dashboard_incoming_links',
@@ -9,15 +9,35 @@ jQuery(document).ready( function($) {
                'dashboard_plugins'
        ];
 
-       ajaxPopulateWidgets = function() {
-               $.each( ajaxWidgets, function() {
-                       var e = jQuery('#' + this + ':visible div.inside').find('.widget-loading');
-                       if ( e.size() ) { e.parent().load('index-extra.php?jax=' + this); }
-               } );
+       ajaxPopulateWidgets = function(el) {
+               show = function(id, i) {
+                       var p, e = $('#' + id + ' div.inside:visible').find('.widget-loading');
+                       if ( e.length ) {
+                               p = e.parent();
+                               setTimeout( function(){
+                                       p.load('index-extra.php?jax=' + id, '', function() {
+                                               p.hide().slideDown('normal', function(){
+                                                       $(this).css('display', '');
+                                                       if ( 'dashboard_plugins' == id && $.isFunction(tb_init) )
+                                                               tb_init('#dashboard_plugins a.thickbox');
+                                               });
+                                       });
+                               }, i * 500 );
+                       }
+               }
+               if ( el ) {
+                       el = el.toString();
+                       if ( $.inArray(el, ajaxWidgets) != -1 )
+                               show(el, 0);
+               } else {
+                       $.each( ajaxWidgets, function(i) {
+                               show(this, i);
+                       });
+               }
        };
        ajaxPopulateWidgets();
 
-       postboxes.add_postbox_toggles('dashboard', { onShow: ajaxPopulateWidgets } );
+       postboxes.add_postbox_toggles('dashboard', { pbshow: ajaxPopulateWidgets } );
 
        /* QuickPress */
        quickPressLoad = function() {
index 8c20f1ecf211d3972039bd55306785cb1fe26b77..c9886183e4d2febfcf62d78df3e180fa8d47a397 100644 (file)
@@ -1 +1 @@
-jQuery(document).ready(function(c){var a,b,d;a=["dashboard_incoming_links","dashboard_primary","dashboard_secondary","dashboard_plugins"];b=function(){c.each(a,function(){var f=jQuery("#"+this+":visible div.inside").find(".widget-loading");if(f.size()){f.parent().load("index-extra.php?jax="+this)}})};b();postboxes.add_postbox_toggles("dashboard",{onShow:b});d=function(){var e=c("#quickpost-action"),f;f=c("#quick-press").submit(function(){c("#dashboard_quick_press h3").append('<img src="images/wpspin_light.gif" style="margin: 0 6px 0 0; vertical-align: middle" />');c('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr("disabled","disabled");if("post"==e.val()){e.val("post-quickpress-publish")}c("#dashboard_quick_press div.inside").load(f.attr("action"),f.serializeArray(),function(){c("#dashboard_quick_press h3 img").remove();c('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr("disabled","");c("#dashboard_quick_press ul").find("li").each(function(){c("#dashboard_recent_drafts ul").prepend(this)}).end().remove();tb_init("a.thickbox");d()});return false});c("#publish").click(function(){e.val("post-quickpress-publish")})};d()});
\ No newline at end of file
+var ajaxWidgets,ajaxPopulateWidgets,quickPressLoad;jQuery(document).ready(function(a){ajaxWidgets=["dashboard_incoming_links","dashboard_primary","dashboard_secondary","dashboard_plugins"];ajaxPopulateWidgets=function(b){show=function(g,c){var f,d=a("#"+g+" div.inside:visible").find(".widget-loading");if(d.length){f=d.parent();setTimeout(function(){f.load("index-extra.php?jax="+g,"",function(){f.hide().slideDown("normal",function(){a(this).css("display","");if("dashboard_plugins"==g&&a.isFunction(tb_init)){tb_init("#dashboard_plugins a.thickbox")}})})},c*500)}};if(b){b=b.toString();if(a.inArray(b,ajaxWidgets)!=-1){show(b,0)}}else{a.each(ajaxWidgets,function(c){show(this,c)})}};ajaxPopulateWidgets();postboxes.add_postbox_toggles("dashboard",{pbshow:ajaxPopulateWidgets});quickPressLoad=function(){var b=a("#quickpost-action"),c;c=a("#quick-press").submit(function(){a("#dashboard_quick_press h3").append('<img src="images/wpspin_light.gif" style="margin: 0 6px 0 0; vertical-align: middle" />');a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr("disabled","disabled");if("post"==b.val()){b.val("post-quickpress-publish")}a("#dashboard_quick_press div.inside").load(c.attr("action"),c.serializeArray(),function(){a("#dashboard_quick_press h3 img").remove();a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr("disabled","");a("#dashboard_quick_press ul").find("li").each(function(){a("#dashboard_recent_drafts ul").prepend(this)}).end().remove();tb_init("a.thickbox");quickPressLoad()});return false});a("#publish").click(function(){b.val("post-quickpress-publish")})};quickPressLoad()});
\ No newline at end of file
index 2d7ddbe867516a97a940b392b291d795a48f1a87..6600e14b5c8ae0c4c2ed25b56abde1359bbd198c 100644 (file)
@@ -23,7 +23,7 @@ setCommentsList = function() {
                        if ( isNaN(n) ) return;
                        n = n + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 );
                        if ( n < 0 ) { n = 0; }
-                       $('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
+                       a.parents('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
                        n = n.toString();
                        if ( n.length > 3 )
                                n = n.substr(0, n.length-3)+' '+n.substr(-3);
@@ -77,7 +77,7 @@ setCommentsList = function() {
                                n = n + 1;
                        }
                        if ( n < 0 ) { n = 0; }
-                       $('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
+                       a.parents('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
                        n = n.toString();
                        if ( n.length > 3 )
                                n = n.substr(0, n.length-3)+' '+n.substr(-3);
index 91288b9466fda2cf1ceab02acb6feedf1429205e..e6ab98b5ea6a13f361a4e0683b097a202223c0aa 100644 (file)
@@ -1 +1 @@
-var theList,theExtraList,toggleWithKeyboard=false;(function(a){setCommentsList=function(){var g,i,h,f=0,c,e,d,b;g=a('#comments-form .tablenav :input[name="_total"]');i=a('#comments-form .tablenav :input[name="_per_page"]');h=a('#comments-form .tablenav :input[name="_page"]');c=function(k,j){var l=a("#"+j.element);if(l.is(".unapproved")){l.find("div.comment_status").html("0")}else{l.find("div.comment_status").html("1")}a("span.pending-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}o=o+(a("#"+j.element).is("."+j.dimClass)?1:-1);if(o<0){o=0}a("#awaiting-mod")[0==o?"addClass":"removeClass"]("count-0");o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)})};e=function(j){j.data._total=g.val();j.data._per_page=i.val();j.data._page=h.val();j.data._url=document.location.href;if("undefined"!=showNotice&&j.data.action&&j.data.action=="delete-comment"&&!j.data.spam){return showNotice.warn()?j:false}return j};d=function(j,k,l){if(k<f){return}g.val(j.toString());if(l){f=k}a("span.total-type-count").each(function(){var m=a(this),o;o=g.val().toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)})};b=function(l,j){a("span.pending-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}if(a("#"+j.element).is(".unapproved")){o=o-1}else{if(a(j.target).parents("span.unapprove").size()){o=o+1}}if(o<0){o=0}a("#awaiting-mod")[0==o?"addClass":"removeClass"]("count-0");o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)});a("span.spam-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}if(a(j.target).parents("span.spam").size()){o=o+1}else{if(a("#"+j.element).is(".spam")){o=o-1}}if(o<0){o=0}o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)});if(("object"==typeof l)&&f<j.parsed.responses[0].supplemental.time){d(j.parsed.responses[0].supplemental.total,j.parsed.responses[0].supplemental.time,true);if(a.trim(j.parsed.responses[0].supplemental.pageLinks)){a(".tablenav-pages").find(".page-numbers").remove().end().append(a(j.parsed.responses[0].supplemental.pageLinks))}else{if("undefined"!=typeof j.parsed.responses[0].supplemental.pageLinks){a(".tablenav-pages").find(".page-numbers").remove()}}}else{var k=parseInt(g.val(),10);if(k--<0){k=0}d(k,l,false)}if(theExtraList.size()==0||theExtraList.children().size()==0){return}theList.get(0).wpList.add(theExtraList.children(":eq(0)").remove().clone());a("#get-extra-comments").submit()};theExtraList=a("#the-extra-comment-list").wpList({alt:"",delColor:"none",addColor:"none"});theList=a("#the-comment-list").wpList({alt:"",delBefore:e,dimAfter:c,delAfter:b,addColor:"none"})};commentReply={init:function(){var b=a("#replyrow");a("a.cancel",b).click(function(){return commentReply.revert()});a("a.save",b).click(function(){return commentReply.send()});a("input#author, input#author-email, input#author-url",b).keypress(function(c){if(c.which==13){commentReply.send();c.preventDefault();return false}});a("#the-comment-list .column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())});a("#doaction, #doaction2, #post-query-submit").click(function(c){if(a("#the-comment-list #replyrow").length>0){commentReply.close()}});this.comments_listing=a('#comments-form > input[name="comment_status"]').val()||""},addEvents:function(b){b.each(function(){a(this).find(".column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())})})},toggle:function(b){if(a(b).css("display")!="none"){a(b).find("a.vim-q").click()}},revert:function(){if(a("#the-comment-list #replyrow").length<1){return false}a("#replyrow").fadeOut("fast",function(){commentReply.close()});return false},close:function(){a(this.o).fadeIn("fast").css("backgroundColor","");a("#com-reply").append(a("#replyrow"));a("#replycontent").val("");a("#edithead input").val("");a("#replysubmit .error").html("").hide();a("#replysubmit .waiting").hide();if(a.browser.msie){a("#replycontainer, #replycontent").css("height","120px")}else{a("#replycontainer").resizable("destroy").css("height","120px")}},open:function(i,g,c){var e=this,d,b,f;e.close();e.o="#comment-"+i;a("#replyrow td").attr("colspan",a(".widefat thead th:visible").length);d=a("#replyrow"),rowData=a("#inline-"+i);b=e.act=(c=="edit")?"edit-comment":"replyto-comment";a("#action",d).val(b);a("#comment_post_ID",d).val(g);a("#comment_ID",d).val(i);if(c=="edit"){a("#author",d).val(a("div.author",rowData).text());a("#author-email",d).val(a("div.author-email",rowData).text());a("#author-url",d).val(a("div.author-url",rowData).text());a("#status",d).val(a("div.comment_status",rowData).text());a("#replycontent",d).val(a("textarea.comment",rowData).val());a("#edithead, #savebtn",d).show();a("#replyhead, #replybtn",d).hide();f=a(e.o).height();if(f>220){if(a.browser.msie){a("#replycontainer, #replycontent",d).height(f-105)}else{a("#replycontainer",d).height(f-105)}}a(e.o).after(d.hide()).fadeOut("fast",function(){a("#replyrow").fadeIn("fast")})}else{a("#edithead, #savebtn",d).hide();a("#replyhead, #replybtn",d).show();a(e.o).after(d);a("#replyrow").hide().fadeIn("fast")}if(!a.browser.msie){a("#replycontainer").resizable({handles:"s",axis:"y",minHeight:80,stop:function(){a("#replycontainer").width("auto")}})}setTimeout(function(){var l,j,m,h,k;l=a("#replyrow").offset().top;j=l+a("#replyrow").height();m=window.pageYOffset||document.documentElement.scrollTop;h=document.documentElement.clientHeight||self.innerHeight||0;k=m+h;if(k-20<j){window.scroll(0,j-h+35)}else{if(l-20<m){window.scroll(0,l-35)}}a("#replycontent").focus().keyup(function(n){if(n.which==27){commentReply.revert()}})},600);return false},send:function(){var b={};a("#replysubmit .waiting").show();a("#replyrow input").each(function(){b[a(this).attr("name")]=a(this).val()});b.content=a("#replycontent").val();b.id=b.comment_post_ID;b.comments_listing=this.comments_listing;a.ajax({type:"POST",url:wpListL10n.url,data:b,success:function(c){commentReply.show(c)},error:function(c){commentReply.error(c)}});return false},show:function(b){var e,g,f,d;if(typeof(b)=="string"){this.error({responseText:b});return false}e=wpAjax.parseAjaxResponse(b);if(e.errors){this.error({responseText:wpAjax.broken});return false}if("edit-comment"==this.act){a(this.o).remove()}e=e.responses[0];g=e.data;a(g).hide();a("#replyrow").after(g);this.o=f="#comment-"+e.id;this.revert();this.addEvents(a(f));d=a(f).hasClass("unapproved")?"#ffffe0":"#fff";a(f).animate({backgroundColor:"#CCEEBB"},600).animate({backgroundColor:d},600);a.fn.wpList.process(a(f))},error:function(b){var c=b.statusText;a("#replysubmit .waiting").hide();if(b.responseText){c=b.responseText.replace(/<.[^<>]*?>/g,"")}if(c){a("#replysubmit .error").html(c).show()}}};a(document).ready(function(){var e,b,c,d;setCommentsList();commentReply.init();a("span.delete a.delete").click(function(){return false});if(typeof QTags!="undefined"){ed_reply=new QTags("ed_reply","replycontent","replycontainer","more")}if(typeof a.table_hotkeys!="undefined"){e=function(f){return function(){var h,g;h="next"==f?"first":"last";g=a("."+f+".page-numbers");if(g.length){window.location=g[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g,"")+"&hotkeys_highlight_"+h+"=1"}}};b=function(g,f){window.location=a("span.edit a",f).attr("href")};c=function(){toggleWithKeyboard=true;a("#comments-form thead #cb input:checkbox").click().attr("checked","");toggleWithKeyboard=false};d=function(f){return function(h,g){a("option[value="+f+"]").attr("selected","selected");a("form#comments-form")[0].submit()}};a.table_hotkeys(a("table.widefat"),["a","u","s","d","r","q",["e",b],["shift+a",d("approve")],["shift+s",d("markspam")],["shift+d",d("delete")],["shift+x",c],["shift+u",d("unapprove")]],{highlight_first:adminCommentsL10n.hotkeys_highlight_first,highlight_last:adminCommentsL10n.hotkeys_highlight_last,prev_page_link_cb:e("prev"),next_page_link_cb:e("next")})}})})(jQuery);
\ No newline at end of file
+var theList,theExtraList,toggleWithKeyboard=false;(function(a){setCommentsList=function(){var g,i,h,f=0,c,e,d,b;g=a('#comments-form .tablenav :input[name="_total"]');i=a('#comments-form .tablenav :input[name="_per_page"]');h=a('#comments-form .tablenav :input[name="_page"]');c=function(k,j){var l=a("#"+j.element);if(l.is(".unapproved")){l.find("div.comment_status").html("0")}else{l.find("div.comment_status").html("1")}a("span.pending-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}o=o+(a("#"+j.element).is("."+j.dimClass)?1:-1);if(o<0){o=0}m.parents("#awaiting-mod")[0==o?"addClass":"removeClass"]("count-0");o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)})};e=function(j){j.data._total=g.val();j.data._per_page=i.val();j.data._page=h.val();j.data._url=document.location.href;if("undefined"!=showNotice&&j.data.action&&j.data.action=="delete-comment"&&!j.data.spam){return showNotice.warn()?j:false}return j};d=function(j,k,l){if(k<f){return}g.val(j.toString());if(l){f=k}a("span.total-type-count").each(function(){var m=a(this),o;o=g.val().toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)})};b=function(l,j){a("span.pending-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}if(a("#"+j.element).is(".unapproved")){o=o-1}else{if(a(j.target).parents("span.unapprove").size()){o=o+1}}if(o<0){o=0}m.parents("#awaiting-mod")[0==o?"addClass":"removeClass"]("count-0");o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)});a("span.spam-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}if(a(j.target).parents("span.spam").size()){o=o+1}else{if(a("#"+j.element).is(".spam")){o=o-1}}if(o<0){o=0}o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)});if(("object"==typeof l)&&f<j.parsed.responses[0].supplemental.time){d(j.parsed.responses[0].supplemental.total,j.parsed.responses[0].supplemental.time,true);if(a.trim(j.parsed.responses[0].supplemental.pageLinks)){a(".tablenav-pages").find(".page-numbers").remove().end().append(a(j.parsed.responses[0].supplemental.pageLinks))}else{if("undefined"!=typeof j.parsed.responses[0].supplemental.pageLinks){a(".tablenav-pages").find(".page-numbers").remove()}}}else{var k=parseInt(g.val(),10);if(k--<0){k=0}d(k,l,false)}if(theExtraList.size()==0||theExtraList.children().size()==0){return}theList.get(0).wpList.add(theExtraList.children(":eq(0)").remove().clone());a("#get-extra-comments").submit()};theExtraList=a("#the-extra-comment-list").wpList({alt:"",delColor:"none",addColor:"none"});theList=a("#the-comment-list").wpList({alt:"",delBefore:e,dimAfter:c,delAfter:b,addColor:"none"})};commentReply={init:function(){var b=a("#replyrow");a("a.cancel",b).click(function(){return commentReply.revert()});a("a.save",b).click(function(){return commentReply.send()});a("input#author, input#author-email, input#author-url",b).keypress(function(c){if(c.which==13){commentReply.send();c.preventDefault();return false}});a("#the-comment-list .column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())});a("#doaction, #doaction2, #post-query-submit").click(function(c){if(a("#the-comment-list #replyrow").length>0){commentReply.close()}});this.comments_listing=a('#comments-form > input[name="comment_status"]').val()||""},addEvents:function(b){b.each(function(){a(this).find(".column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())})})},toggle:function(b){if(a(b).css("display")!="none"){a(b).find("a.vim-q").click()}},revert:function(){if(a("#the-comment-list #replyrow").length<1){return false}a("#replyrow").fadeOut("fast",function(){commentReply.close()});return false},close:function(){a(this.o).fadeIn("fast").css("backgroundColor","");a("#com-reply").append(a("#replyrow"));a("#replycontent").val("");a("#edithead input").val("");a("#replysubmit .error").html("").hide();a("#replysubmit .waiting").hide();if(a.browser.msie){a("#replycontainer, #replycontent").css("height","120px")}else{a("#replycontainer").resizable("destroy").css("height","120px")}},open:function(i,g,c){var e=this,d,b,f;e.close();e.o="#comment-"+i;a("#replyrow td").attr("colspan",a(".widefat thead th:visible").length);d=a("#replyrow"),rowData=a("#inline-"+i);b=e.act=(c=="edit")?"edit-comment":"replyto-comment";a("#action",d).val(b);a("#comment_post_ID",d).val(g);a("#comment_ID",d).val(i);if(c=="edit"){a("#author",d).val(a("div.author",rowData).text());a("#author-email",d).val(a("div.author-email",rowData).text());a("#author-url",d).val(a("div.author-url",rowData).text());a("#status",d).val(a("div.comment_status",rowData).text());a("#replycontent",d).val(a("textarea.comment",rowData).val());a("#edithead, #savebtn",d).show();a("#replyhead, #replybtn",d).hide();f=a(e.o).height();if(f>220){if(a.browser.msie){a("#replycontainer, #replycontent",d).height(f-105)}else{a("#replycontainer",d).height(f-105)}}a(e.o).after(d.hide()).fadeOut("fast",function(){a("#replyrow").fadeIn("fast")})}else{a("#edithead, #savebtn",d).hide();a("#replyhead, #replybtn",d).show();a(e.o).after(d);a("#replyrow").hide().fadeIn("fast")}if(!a.browser.msie){a("#replycontainer").resizable({handles:"s",axis:"y",minHeight:80,stop:function(){a("#replycontainer").width("auto")}})}setTimeout(function(){var l,j,m,h,k;l=a("#replyrow").offset().top;j=l+a("#replyrow").height();m=window.pageYOffset||document.documentElement.scrollTop;h=document.documentElement.clientHeight||self.innerHeight||0;k=m+h;if(k-20<j){window.scroll(0,j-h+35)}else{if(l-20<m){window.scroll(0,l-35)}}a("#replycontent").focus().keyup(function(n){if(n.which==27){commentReply.revert()}})},600);return false},send:function(){var b={};a("#replysubmit .waiting").show();a("#replyrow input").each(function(){b[a(this).attr("name")]=a(this).val()});b.content=a("#replycontent").val();b.id=b.comment_post_ID;b.comments_listing=this.comments_listing;a.ajax({type:"POST",url:wpListL10n.url,data:b,success:function(c){commentReply.show(c)},error:function(c){commentReply.error(c)}});return false},show:function(b){var e,g,f,d;if(typeof(b)=="string"){this.error({responseText:b});return false}e=wpAjax.parseAjaxResponse(b);if(e.errors){this.error({responseText:wpAjax.broken});return false}if("edit-comment"==this.act){a(this.o).remove()}e=e.responses[0];g=e.data;a(g).hide();a("#replyrow").after(g);this.o=f="#comment-"+e.id;this.revert();this.addEvents(a(f));d=a(f).hasClass("unapproved")?"#ffffe0":"#fff";a(f).animate({backgroundColor:"#CCEEBB"},600).animate({backgroundColor:d},600);a.fn.wpList.process(a(f))},error:function(b){var c=b.statusText;a("#replysubmit .waiting").hide();if(b.responseText){c=b.responseText.replace(/<.[^<>]*?>/g,"")}if(c){a("#replysubmit .error").html(c).show()}}};a(document).ready(function(){var e,b,c,d;setCommentsList();commentReply.init();a("span.delete a.delete").click(function(){return false});if(typeof QTags!="undefined"){ed_reply=new QTags("ed_reply","replycontent","replycontainer","more")}if(typeof a.table_hotkeys!="undefined"){e=function(f){return function(){var h,g;h="next"==f?"first":"last";g=a("."+f+".page-numbers");if(g.length){window.location=g[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g,"")+"&hotkeys_highlight_"+h+"=1"}}};b=function(g,f){window.location=a("span.edit a",f).attr("href")};c=function(){toggleWithKeyboard=true;a("#comments-form thead #cb input:checkbox").click().attr("checked","");toggleWithKeyboard=false};d=function(f){return function(h,g){a("option[value="+f+"]").attr("selected","selected");a("form#comments-form")[0].submit()}};a.table_hotkeys(a("table.widefat"),["a","u","s","d","r","q",["e",b],["shift+a",d("approve")],["shift+s",d("markspam")],["shift+d",d("delete")],["shift+x",c],["shift+u",d("unapprove")]],{highlight_first:adminCommentsL10n.hotkeys_highlight_first,highlight_last:adminCommentsL10n.hotkeys_highlight_last,prev_page_link_cb:e("prev"),next_page_link_cb:e("next")})}})})(jQuery);
\ No newline at end of file
index dcb12a43a408aecb9d3267c2d2725f6d4e495f82..95d7bc200bd260a02847be34d3a2346fd4a049c3 100644 (file)
@@ -212,10 +212,6 @@ var commentsBox, tagCloud;
 jQuery(document).ready( function($) {
        var noSyncChecks = false, syncChecks, catAddAfter, stamp = $('#timestamp').html(), visibility = $('#post-visibility-display').html(), sticky = '';
 
-       // for Press This
-       if ( typeof autosave != 'function' )
-               autosave = function(){};
-
        // postboxes
        postboxes.add_postbox_toggles('post');
 
@@ -225,7 +221,13 @@ jQuery(document).ready( function($) {
        // prepare the tag UI
        tag_init();
 
-       $('#title').blur( function() { if ( ($("#post_ID").val() > 0) || ($("#title").val().length == 0) ) return; autosave(); } );
+       $('#title').blur( function() {
+               if ( ($("#post_ID").val() > 0) || ($("#title").val().length == 0) )
+                       return;
+
+               if ( typeof(autosave) != 'undefined' )
+                       autosave();
+       });
 
        // auto-suggest stuff
        $('.newtag').each(function(){
@@ -477,7 +479,7 @@ jQuery(document).ready( function($) {
        // Custom Fields
        $('#the-list').wpList( { addAfter: function( xml, s ) {
                $('table#list-table').show();
-               if ( $.isFunction( autosave_update_post_ID ) ) {
+               if ( typeof( autosave_update_post_ID ) != 'undefined' ) {
                        autosave_update_post_ID(s.parsed.responses[0].supplemental.postid);
                }
        }, addBefore: function( s ) {
index 1d0f21e4f34266f7624762c1dacd26f651b0a224..bfc6d917bef99ba9fb44b0202b41fc77a18fff2b 100644 (file)
@@ -1 +1 @@
-function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}function new_tag_remove_tag(){var e=jQuery(this).attr("id"),a=e.split("-check-num-")[1],c=jQuery(this).parents(".tagsdiv"),b=c.find(".the-tags").val().split(","),d=[];delete b[a];jQuery.each(b,function(f,g){g=jQuery.trim(g);if(g){d.push(g)}});c.find(".the-tags").val(d.join(",").replace(/\s*,+\s*/,",").replace(/,+/,",").replace(/,+\s+,+/,",").replace(/,+\s*$/,"").replace(/^\s*,+/,""));tag_update_quickclicks(c);return false}function tag_update_quickclicks(b){if(jQuery(b).find(".the-tags").length==0){return}var a=jQuery(b).find(".the-tags").val().split(",");jQuery(b).find(".tagchecklist").empty();shown=false;jQuery.each(a,function(e,f){var c,d;f=jQuery.trim(f);if(!f.match(/^\s+$/)&&""!=f){d=jQuery(b).attr("id")+"-check-num-"+e;c='<span><a id="'+d+'" class="ntdelbutton">X</a>&nbsp;'+f+"</span> ";jQuery(b).find(".tagchecklist").append(c);jQuery("#"+d).click(new_tag_remove_tag)}});if(shown){jQuery(b).find(".tagchecklist").prepend("<strong>"+postL10n.tagsUsed+"</strong><br />")}}function tag_flush_to_text(g,b){b=b||false;var e,f,c,d;e=jQuery("#"+g);f=b?jQuery(b).text():e.find("input.newtag").val();if(e.find("input.newtag").hasClass("form-input-tip")&&!b){return false}c=e.find(".the-tags").val();d=c?c+","+f:f;d=d.replace(/\s+,+\s*/g,",").replace(/,+/g,",").replace(/,+\s+,+/g,",").replace(/,+\s*$/g,"").replace(/^\s*,+/g,"");d=array_unique_noempty(d.split(",")).join(",");e.find(".the-tags").val(d);tag_update_quickclicks(e);if(!b){e.find("input.newtag").val("").focus()}return false}function tag_save_on_publish(){jQuery(".tagsdiv").each(function(a){if(!jQuery(this).find("input.newtag").hasClass("form-input-tip")){tag_flush_to_text(jQuery(this).parents(".tagsdiv").attr("id"))}})}function tag_press_key(a){if(13==a.which){tag_flush_to_text(jQuery(a.target).parents(".tagsdiv").attr("id"));return false}}function tag_init(){jQuery(".ajaxtag").show();jQuery(".tagsdiv").each(function(a){tag_update_quickclicks(this)});jQuery(".ajaxtag input.tagadd").click(function(){tag_flush_to_text(jQuery(this).parents(".tagsdiv").attr("id"))});jQuery(".ajaxtag input.newtag").focus(function(){if(!this.cleared){this.cleared=true;jQuery(this).val("").removeClass("form-input-tip")}});jQuery(".ajaxtag input.newtag").blur(function(){if(this.value==""){this.cleared=false;jQuery(this).val(postL10n.addTag).addClass("form-input-tip")}});jQuery("#publish").click(tag_save_on_publish);jQuery("#save-post").click(tag_save_on_publish);jQuery(".ajaxtag input.newtag").keypress(tag_press_key)}var commentsBox,tagCloud;(function(a){commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="5">'+wpAjax.broken+"</td></tr>")});return false}};tagCloud={init:function(){a(".tagcloud-link").click(function(){tagCloud.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){var f=a(this).parents("p").attr("id");tag_flush_to_text(f.substr(f.indexOf("-")+1),this);return false});a("#"+c).after(e)})}};a(document).ready(function(){tagCloud.init()})})(jQuery);jQuery(document).ready(function(g){var d=false,i,e,a=g("#timestamp").html(),b=g("#post-visibility-display").html(),h="";if(typeof autosave!="function"){autosave=function(){}}postboxes.add_postbox_toggles("post");make_slugedit_clickable();tag_init();g("#title").blur(function(){if((g("#post_ID").val()>0)||(g("#title").val().length==0)){return}autosave()});g(".newtag").each(function(){var j=g(this).parents("div.tagsdiv").attr("id");g(this).suggest("admin-ajax.php?action=ajax-tag-search&tax="+j,{delay:500,minchars:2,multiple:true,multipleSep:", "})});g("#category-tabs a").click(function(){var j=g(this).attr("href");g(this).parent().addClass("tabs").siblings("li").removeClass("tabs");g(".tabs-panel").hide();g(j).show();if("#categories-all"==j){deleteUserSetting("cats")}else{setUserSetting("cats","pop")}return false});if(getUserSetting("cats")){g('#category-tabs a[href="#categories-pop"]').click()}g("#newcat").one("focus",function(){g(this).val("").removeClass("form-input-tip")});g("#category-add-sumbit").click(function(){g("#newcat").focus()});i=function(){if(d){return}d=true;var j=jQuery(this),l=j.is(":checked"),k=j.val().toString();g("#in-category-"+k+", #in-popular-category-"+k).attr("checked",l);d=false};popularCats=g("#categorychecklist-pop :checkbox").map(function(){return parseInt(jQuery(this).val(),10)}).get().join(",");catAddBefore=function(j){if(!g("#newcat").val()){return false}j.data+="&popular_ids="+popularCats+"&"+jQuery("#categorychecklist :checked").serialize();return j};e=function(m,k){var j=jQuery("#newcat_parent"),l=j.find('option[value="-1"]');g(k.what+" response_data",m).each(function(){var n=g(g(this).text());n.find("label").each(function(){var q=g(this),s=q.find("input").val(),t=q.find("input")[0].id,p,r;g("#"+t).change(i).change();if(j.find('option[value="'+s+'"]').size()){return}p=g.trim(q.text());r=g('<option value="'+parseInt(s,10)+'"></option>').text(p);j.prepend(r)});l.attr("selected","selected")})};g("#categorychecklist").wpList({alt:"",response:"category-ajax-response",addBefore:catAddBefore,addAfter:e});g("#category-add-toggle").click(function(){g("#category-adder").toggleClass("wp-hidden-children");g('#category-tabs a[href="#categories-all"]').click();return false});g(".categorychecklist .popular-category :checkbox").change(i).filter(":checked").change(),h="";function f(){if(g("#post-visibility-select input:radio:checked").val()!="public"){g("#sticky").attr("checked",false);g("#sticky-span").hide()}else{g("#sticky-span").show()}if(g("#post-visibility-select input:radio:checked").val()!="password"){g("#password-span").hide()}else{g("#password-span").show()}}function c(){var j,l,k,m;j=new Date(g("#aa").val(),g("#mm").val()-1,g("#jj").val(),g("#hh").val(),g("#mn").val());l=new Date(g("#hidden_aa").val(),g("#hidden_mm").val()-1,g("#hidden_jj").val(),g("#hidden_hh").val(),g("#hidden_mn").val());k=new Date(g("#cur_aa").val(),g("#cur_mm").val()-1,g("#cur_jj").val(),g("#cur_hh").val(),g("#cur_mn").val());if(j>k&&g("#original_post_status").val()!="future"){m=postL10n.publishOnFuture;g("#publish").val(postL10n.schedule)}else{if(j<=k&&g("#original_post_status").val()!="publish"){m=postL10n.publishOn;g("#publish").val(postL10n.publish)}else{m=postL10n.publishOnPast;g("#publish").val(postL10n.update)}}if(l.toUTCString()==j.toUTCString()){g("#timestamp").html(a)}else{g("#timestamp").html(m+" <b>"+g("#mm option[value="+g("#mm").val()+"]").text()+" "+g("#jj").val()+", "+g("#aa").val()+" @ "+g("#hh").val()+":"+g("#mn").val()+"</b> ")}if(g("#post-visibility-select input:radio:checked").val()=="private"){g("#publish").val(postL10n.update);if(g("#post_status option[value=publish]").length==0){g("#post_status").append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}g("#post_status option[value=publish]").html(postL10n.privatelyPublished);g("#post_status option[value=publish]").attr("selected",true);g(".edit-post-status").hide()}else{if(g("#original_post_status").val()=="future"||g("#original_post_status").val()=="draft"){if(g("#post_status option[value=publish]").length!=0){g("#post_status option[value=publish]").remove();g("#post_status").val(g("#hidden_post_status").val())}}else{g("#post_status option[value=publish]").html(postL10n.published)}g(".edit-post-status").show()}g("#post-status-display").html(g("#post_status :selected").text());if(g("#post_status :selected").val()=="private"||g("#post_status :selected").val()=="publish"){g("#save-post").hide()}else{g("#save-post").show();if(g("#post_status :selected").val()=="pending"){g("#save-post").show().val(postL10n.savePending)}else{g("#save-post").show().val(postL10n.saveDraft)}}}g(".edit-visibility").click(function(){if(g("#post-visibility-select").is(":hidden")){f();g("#post-visibility-select").slideDown("normal");g(".edit-visibility").hide()}return false});g(".cancel-post-visibility").click(function(){g("#post-visibility-select").slideUp("normal");g("#visibility-radio-"+g("#hidden-post-visibility").val()).attr("checked",true);g("#post_password").val(g("#hidden_post_password").val());g("#sticky").attr("checked",g("#hidden-post-sticky").attr("checked"));g("#post-visibility-display").html(b);g(".edit-visibility").show();c();return false});g(".save-post-visibility").click(function(){g("#post-visibility-select").slideUp("normal");g(".edit-visibility").show();c();if(g("#post-visibility-select input:radio:checked").val()!="public"){g("#sticky").attr("checked",false)}if(true==g("#sticky").attr("checked")){h="Sticky"}else{h=""}g("#post-visibility-display").html(postL10n[g("#post-visibility-select input:radio:checked").val()+h]);return false});g("#post-visibility-select input:radio").change(function(){f()});g(".edit-timestamp").click(function(){if(g("#timestampdiv").is(":hidden")){g("#timestampdiv").slideDown("normal");g(".edit-timestamp").hide()}return false});g(".cancel-timestamp").click(function(){g("#timestampdiv").slideUp("normal");g("#mm").val(g("#hidden_mm").val());g("#jj").val(g("#hidden_jj").val());g("#aa").val(g("#hidden_aa").val());g("#hh").val(g("#hidden_hh").val());g("#mn").val(g("#hidden_mn").val());g(".edit-timestamp").show();c();return false});g(".save-timestamp").click(function(){g("#timestampdiv").slideUp("normal");g(".edit-timestamp").show();c();return false});g(".edit-post-status").click(function(){if(g("#post-status-select").is(":hidden")){g("#post-status-select").slideDown("normal");g(this).hide()}return false});g(".save-post-status").click(function(){g("#post-status-select").slideUp("normal");g(".edit-post-status").show();c();return false});g(".cancel-post-status").click(function(){g("#post-status-select").slideUp("normal");g("#post_status").val(g("#hidden_post_status").val());g(".edit-post-status").show();c();return false});g("#the-list").wpList({addAfter:function(j,k){g("table#list-table").show();if(g.isFunction(autosave_update_post_ID)){autosave_update_post_ID(k.parsed.responses[0].supplemental.postid)}},addBefore:function(j){j.data+="&post_id="+g("#post_ID").val();return j}})});
\ No newline at end of file
+function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}function new_tag_remove_tag(){var e=jQuery(this).attr("id"),a=e.split("-check-num-")[1],c=jQuery(this).parents(".tagsdiv"),b=c.find(".the-tags").val().split(","),d=[];delete b[a];jQuery.each(b,function(f,g){g=jQuery.trim(g);if(g){d.push(g)}});c.find(".the-tags").val(d.join(",").replace(/\s*,+\s*/,",").replace(/,+/,",").replace(/,+\s+,+/,",").replace(/,+\s*$/,"").replace(/^\s*,+/,""));tag_update_quickclicks(c);return false}function tag_update_quickclicks(b){if(jQuery(b).find(".the-tags").length==0){return}var a=jQuery(b).find(".the-tags").val().split(",");jQuery(b).find(".tagchecklist").empty();shown=false;jQuery.each(a,function(e,f){var c,d;f=jQuery.trim(f);if(!f.match(/^\s+$/)&&""!=f){d=jQuery(b).attr("id")+"-check-num-"+e;c='<span><a id="'+d+'" class="ntdelbutton">X</a>&nbsp;'+f+"</span> ";jQuery(b).find(".tagchecklist").append(c);jQuery("#"+d).click(new_tag_remove_tag)}});if(shown){jQuery(b).find(".tagchecklist").prepend("<strong>"+postL10n.tagsUsed+"</strong><br />")}}function tag_flush_to_text(g,b){b=b||false;var e,f,c,d;e=jQuery("#"+g);f=b?jQuery(b).text():e.find("input.newtag").val();if(e.find("input.newtag").hasClass("form-input-tip")&&!b){return false}c=e.find(".the-tags").val();d=c?c+","+f:f;d=d.replace(/\s+,+\s*/g,",").replace(/,+/g,",").replace(/,+\s+,+/g,",").replace(/,+\s*$/g,"").replace(/^\s*,+/g,"");d=array_unique_noempty(d.split(",")).join(",");e.find(".the-tags").val(d);tag_update_quickclicks(e);if(!b){e.find("input.newtag").val("").focus()}return false}function tag_save_on_publish(){jQuery(".tagsdiv").each(function(a){if(!jQuery(this).find("input.newtag").hasClass("form-input-tip")){tag_flush_to_text(jQuery(this).parents(".tagsdiv").attr("id"))}})}function tag_press_key(a){if(13==a.which){tag_flush_to_text(jQuery(a.target).parents(".tagsdiv").attr("id"));return false}}function tag_init(){jQuery(".ajaxtag").show();jQuery(".tagsdiv").each(function(a){tag_update_quickclicks(this)});jQuery(".ajaxtag input.tagadd").click(function(){tag_flush_to_text(jQuery(this).parents(".tagsdiv").attr("id"))});jQuery(".ajaxtag input.newtag").focus(function(){if(!this.cleared){this.cleared=true;jQuery(this).val("").removeClass("form-input-tip")}});jQuery(".ajaxtag input.newtag").blur(function(){if(this.value==""){this.cleared=false;jQuery(this).val(postL10n.addTag).addClass("form-input-tip")}});jQuery("#publish").click(tag_save_on_publish);jQuery("#save-post").click(tag_save_on_publish);jQuery(".ajaxtag input.newtag").keypress(tag_press_key)}var commentsBox,tagCloud;(function(a){commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="5">'+wpAjax.broken+"</td></tr>")});return false}};tagCloud={init:function(){a(".tagcloud-link").click(function(){tagCloud.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){var f=a(this).parents("p").attr("id");tag_flush_to_text(f.substr(f.indexOf("-")+1),this);return false});a("#"+c).after(e)})}};a(document).ready(function(){tagCloud.init()})})(jQuery);jQuery(document).ready(function(g){var d=false,i,e,a=g("#timestamp").html(),b=g("#post-visibility-display").html(),h="";postboxes.add_postbox_toggles("post");make_slugedit_clickable();tag_init();g("#title").blur(function(){if((g("#post_ID").val()>0)||(g("#title").val().length==0)){return}if(typeof(autosave)!="undefined"){autosave()}});g(".newtag").each(function(){var j=g(this).parents("div.tagsdiv").attr("id");g(this).suggest("admin-ajax.php?action=ajax-tag-search&tax="+j,{delay:500,minchars:2,multiple:true,multipleSep:", "})});g("#category-tabs a").click(function(){var j=g(this).attr("href");g(this).parent().addClass("tabs").siblings("li").removeClass("tabs");g(".tabs-panel").hide();g(j).show();if("#categories-all"==j){deleteUserSetting("cats")}else{setUserSetting("cats","pop")}return false});if(getUserSetting("cats")){g('#category-tabs a[href="#categories-pop"]').click()}g("#newcat").one("focus",function(){g(this).val("").removeClass("form-input-tip")});g("#category-add-sumbit").click(function(){g("#newcat").focus()});i=function(){if(d){return}d=true;var j=jQuery(this),l=j.is(":checked"),k=j.val().toString();g("#in-category-"+k+", #in-popular-category-"+k).attr("checked",l);d=false};popularCats=g("#categorychecklist-pop :checkbox").map(function(){return parseInt(jQuery(this).val(),10)}).get().join(",");catAddBefore=function(j){if(!g("#newcat").val()){return false}j.data+="&popular_ids="+popularCats+"&"+jQuery("#categorychecklist :checked").serialize();return j};e=function(m,k){var j=jQuery("#newcat_parent"),l=j.find('option[value="-1"]');g(k.what+" response_data",m).each(function(){var n=g(g(this).text());n.find("label").each(function(){var q=g(this),s=q.find("input").val(),t=q.find("input")[0].id,p,r;g("#"+t).change(i).change();if(j.find('option[value="'+s+'"]').size()){return}p=g.trim(q.text());r=g('<option value="'+parseInt(s,10)+'"></option>').text(p);j.prepend(r)});l.attr("selected","selected")})};g("#categorychecklist").wpList({alt:"",response:"category-ajax-response",addBefore:catAddBefore,addAfter:e});g("#category-add-toggle").click(function(){g("#category-adder").toggleClass("wp-hidden-children");g('#category-tabs a[href="#categories-all"]').click();return false});g(".categorychecklist .popular-category :checkbox").change(i).filter(":checked").change(),h="";function f(){if(g("#post-visibility-select input:radio:checked").val()!="public"){g("#sticky").attr("checked",false);g("#sticky-span").hide()}else{g("#sticky-span").show()}if(g("#post-visibility-select input:radio:checked").val()!="password"){g("#password-span").hide()}else{g("#password-span").show()}}function c(){var j,l,k,m;j=new Date(g("#aa").val(),g("#mm").val()-1,g("#jj").val(),g("#hh").val(),g("#mn").val());l=new Date(g("#hidden_aa").val(),g("#hidden_mm").val()-1,g("#hidden_jj").val(),g("#hidden_hh").val(),g("#hidden_mn").val());k=new Date(g("#cur_aa").val(),g("#cur_mm").val()-1,g("#cur_jj").val(),g("#cur_hh").val(),g("#cur_mn").val());if(j>k&&g("#original_post_status").val()!="future"){m=postL10n.publishOnFuture;g("#publish").val(postL10n.schedule)}else{if(j<=k&&g("#original_post_status").val()!="publish"){m=postL10n.publishOn;g("#publish").val(postL10n.publish)}else{m=postL10n.publishOnPast;g("#publish").val(postL10n.update)}}if(l.toUTCString()==j.toUTCString()){g("#timestamp").html(a)}else{g("#timestamp").html(m+" <b>"+g("#mm option[value="+g("#mm").val()+"]").text()+" "+g("#jj").val()+", "+g("#aa").val()+" @ "+g("#hh").val()+":"+g("#mn").val()+"</b> ")}if(g("#post-visibility-select input:radio:checked").val()=="private"){g("#publish").val(postL10n.update);if(g("#post_status option[value=publish]").length==0){g("#post_status").append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}g("#post_status option[value=publish]").html(postL10n.privatelyPublished);g("#post_status option[value=publish]").attr("selected",true);g(".edit-post-status").hide()}else{if(g("#original_post_status").val()=="future"||g("#original_post_status").val()=="draft"){if(g("#post_status option[value=publish]").length!=0){g("#post_status option[value=publish]").remove();g("#post_status").val(g("#hidden_post_status").val())}}else{g("#post_status option[value=publish]").html(postL10n.published)}g(".edit-post-status").show()}g("#post-status-display").html(g("#post_status :selected").text());if(g("#post_status :selected").val()=="private"||g("#post_status :selected").val()=="publish"){g("#save-post").hide()}else{g("#save-post").show();if(g("#post_status :selected").val()=="pending"){g("#save-post").show().val(postL10n.savePending)}else{g("#save-post").show().val(postL10n.saveDraft)}}}g(".edit-visibility").click(function(){if(g("#post-visibility-select").is(":hidden")){f();g("#post-visibility-select").slideDown("normal");g(".edit-visibility").hide()}return false});g(".cancel-post-visibility").click(function(){g("#post-visibility-select").slideUp("normal");g("#visibility-radio-"+g("#hidden-post-visibility").val()).attr("checked",true);g("#post_password").val(g("#hidden_post_password").val());g("#sticky").attr("checked",g("#hidden-post-sticky").attr("checked"));g("#post-visibility-display").html(b);g(".edit-visibility").show();c();return false});g(".save-post-visibility").click(function(){g("#post-visibility-select").slideUp("normal");g(".edit-visibility").show();c();if(g("#post-visibility-select input:radio:checked").val()!="public"){g("#sticky").attr("checked",false)}if(true==g("#sticky").attr("checked")){h="Sticky"}else{h=""}g("#post-visibility-display").html(postL10n[g("#post-visibility-select input:radio:checked").val()+h]);return false});g("#post-visibility-select input:radio").change(function(){f()});g(".edit-timestamp").click(function(){if(g("#timestampdiv").is(":hidden")){g("#timestampdiv").slideDown("normal");g(".edit-timestamp").hide()}return false});g(".cancel-timestamp").click(function(){g("#timestampdiv").slideUp("normal");g("#mm").val(g("#hidden_mm").val());g("#jj").val(g("#hidden_jj").val());g("#aa").val(g("#hidden_aa").val());g("#hh").val(g("#hidden_hh").val());g("#mn").val(g("#hidden_mn").val());g(".edit-timestamp").show();c();return false});g(".save-timestamp").click(function(){g("#timestampdiv").slideUp("normal");g(".edit-timestamp").show();c();return false});g(".edit-post-status").click(function(){if(g("#post-status-select").is(":hidden")){g("#post-status-select").slideDown("normal");g(this).hide()}return false});g(".save-post-status").click(function(){g("#post-status-select").slideUp("normal");g(".edit-post-status").show();c();return false});g(".cancel-post-status").click(function(){g("#post-status-select").slideUp("normal");g("#post_status").val(g("#hidden_post_status").val());g(".edit-post-status").show();c();return false});g("#the-list").wpList({addAfter:function(j,k){g("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(k.parsed.responses[0].supplemental.postid)}},addBefore:function(j){j.data+="&post_id="+g("#post_ID").val();return j}})});
\ No newline at end of file
index 32e7898b0c40313770fadcd79b1c5aa983d732e0..d9ca79987ef906bb224c05cd4ffdd1976a545a3e 100644 (file)
@@ -4,15 +4,15 @@ var postboxes;
                add_postbox_toggles : function(page,args) {
                        this.init(page,args);
                        $('.postbox h3, .postbox .handlediv').click( function() {
-                               var p = $(this).parent('.postbox');
-                               /*
-                               if ( p.hasClass('noclick') ) {
-                                       p.removeClass('noclick');
-                                       return false;
-                               }
-                               */
+                               var p = $(this).parent('.postbox'), id = p.attr('id');
                                p.toggleClass('closed');
                                postboxes.save_state(page);
+                               if ( id ) {
+                                       if ( !p.hasClass('closed') && $.isFunction(postboxes.pbshow) )
+                                               postboxes.pbshow(id);
+                                       else if ( p.hasClass('closed') && $.isFunction(postboxes.pbhide) )
+                                               postboxes.pbhide(id);
+                               }
                        } );
                        $('.postbox h3 a').click( function(e) {
                                e.stopPropagation();
index 3d5d21b31984f310140e4e9e0e79e530b565c824..3b6415b170c06d070b12e19535806856948c7765 100644 (file)
@@ -1 +1 @@
-var postboxes;(function(a){postboxes={add_postbox_toggles:function(c,b){this.init(c,b);a(".postbox h3, .postbox .handlediv").click(function(){var e=a(this).parent(".postbox");e.toggleClass("closed");postboxes.save_state(c)});a(".postbox h3 a").click(function(f){f.stopPropagation()});a(".hide-postbox-tog").click(function(){var e=a(this).val();if(a(this).attr("checked")){a("#"+e).show();if(a.isFunction(postboxes.pbshow)){postboxes.pbshow(e)}}else{a("#"+e).hide();if(a.isFunction(postboxes.pbhide)){postboxes.pbhide(e)}}postboxes.save_state(c)});a('.columns-prefs input[type="radio"]').click(function(){var e=a(this).val(),f,g,h=a("#poststuff");if(h.length){if(e==2){h.addClass("has-right-sidebar");a("#side-sortables").addClass("temp-border")}else{if(e==1){h.removeClass("has-right-sidebar");a("#normal-sortables").append(a("#side-sortables").children(".postbox"))}}}else{for(f=4;(f>e&&f>1);f--){g=a("#"+d(f)+"-sortables");a("#"+d(f-1)+"-sortables").append(g.children(".postbox"));g.parent().hide()}for(f=1;f<=e;f++){g=a("#"+d(f)+"-sortables");if(g.parent().is(":hidden")){g.addClass("temp-border").parent().show()}}a(".postbox-container:visible").css("width",98/e+"%")}postboxes.save_order(c)});function d(e){switch(e){case 1:return"normal";break;case 2:return"side";break;case 3:return"column3";break;case 4:return"column4";break;default:return""}}},init:function(c,b){a.extend(this,b||{});a("#wpbody-content").css("overflow","hidden");a(".meta-box-sortables").sortable({placeholder:"sortable-placeholder",connectWith:".meta-box-sortables",items:".postbox",handle:".hndle",cursor:"move",distance:2,tolerance:"pointer",forcePlaceholderSize:true,helper:"clone",opacity:0.65,start:function(f,d){a("body").css({WebkitUserSelect:"none",KhtmlUserSelect:"none"})},stop:function(f,d){postboxes.save_order(c);d.item.parent().removeClass("temp-border");a("body").css({WebkitUserSelect:"",KhtmlUserSelect:""})}})},save_state:function(d){var b=a(".postbox").filter(".closed").map(function(){return this.id}).get().join(","),c=a(".postbox").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(postboxL10n.requestFile,{action:"closed-postboxes",closed:b,hidden:c,closedpostboxesnonce:jQuery("#closedpostboxesnonce").val(),page:d})},save_order:function(c){var b,d=a(".columns-prefs input:checked").val()||0;b={action:"meta-box-order",_ajax_nonce:a("#meta-box-order-nonce").val(),page_columns:d,page:c};a(".meta-box-sortables").each(function(){b["order["+this.id.split("-")[0]+"]"]=a(this).sortable("toArray").join(",")});a.post(postboxL10n.requestFile,b)},pbshow:false,pbhide:false}}(jQuery));
\ No newline at end of file
+var postboxes;(function(a){postboxes={add_postbox_toggles:function(c,b){this.init(c,b);a(".postbox h3, .postbox .handlediv").click(function(){var e=a(this).parent(".postbox"),f=e.attr("id");e.toggleClass("closed");postboxes.save_state(c);if(f){if(!e.hasClass("closed")&&a.isFunction(postboxes.pbshow)){postboxes.pbshow(f)}else{if(e.hasClass("closed")&&a.isFunction(postboxes.pbhide)){postboxes.pbhide(f)}}}});a(".postbox h3 a").click(function(f){f.stopPropagation()});a(".hide-postbox-tog").click(function(){var e=a(this).val();if(a(this).attr("checked")){a("#"+e).show();if(a.isFunction(postboxes.pbshow)){postboxes.pbshow(e)}}else{a("#"+e).hide();if(a.isFunction(postboxes.pbhide)){postboxes.pbhide(e)}}postboxes.save_state(c)});a('.columns-prefs input[type="radio"]').click(function(){var e=a(this).val(),f,g,h=a("#poststuff");if(h.length){if(e==2){h.addClass("has-right-sidebar");a("#side-sortables").addClass("temp-border")}else{if(e==1){h.removeClass("has-right-sidebar");a("#normal-sortables").append(a("#side-sortables").children(".postbox"))}}}else{for(f=4;(f>e&&f>1);f--){g=a("#"+d(f)+"-sortables");a("#"+d(f-1)+"-sortables").append(g.children(".postbox"));g.parent().hide()}for(f=1;f<=e;f++){g=a("#"+d(f)+"-sortables");if(g.parent().is(":hidden")){g.addClass("temp-border").parent().show()}}a(".postbox-container:visible").css("width",98/e+"%")}postboxes.save_order(c)});function d(e){switch(e){case 1:return"normal";break;case 2:return"side";break;case 3:return"column3";break;case 4:return"column4";break;default:return""}}},init:function(c,b){a.extend(this,b||{});a("#wpbody-content").css("overflow","hidden");a(".meta-box-sortables").sortable({placeholder:"sortable-placeholder",connectWith:".meta-box-sortables",items:".postbox",handle:".hndle",cursor:"move",distance:2,tolerance:"pointer",forcePlaceholderSize:true,helper:"clone",opacity:0.65,start:function(f,d){a("body").css({WebkitUserSelect:"none",KhtmlUserSelect:"none"})},stop:function(f,d){postboxes.save_order(c);d.item.parent().removeClass("temp-border");a("body").css({WebkitUserSelect:"",KhtmlUserSelect:""})}})},save_state:function(d){var b=a(".postbox").filter(".closed").map(function(){return this.id}).get().join(","),c=a(".postbox").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(postboxL10n.requestFile,{action:"closed-postboxes",closed:b,hidden:c,closedpostboxesnonce:jQuery("#closedpostboxesnonce").val(),page:d})},save_order:function(c){var b,d=a(".columns-prefs input:checked").val()||0;b={action:"meta-box-order",_ajax_nonce:a("#meta-box-order-nonce").val(),page_columns:d,page:c};a(".meta-box-sortables").each(function(){b["order["+this.id.split("-")[0]+"]"]=a(this).sortable("toArray").join(",")});a.post(postboxL10n.requestFile,b)},pbshow:false,pbhide:false}}(jQuery));
\ No newline at end of file
index 7d03a15382adf64d5899d20608aaabea62364456..ca3e7ebac40d5afbca4b93732fed6dc8ae46654c 100644 (file)
@@ -6,8 +6,8 @@
  * @subpackage Administration
  */
 
-/** Load WordPress Bootstrap */
-require_once('../wp-load.php');
+if ( ! defined('ABSPATH') )
+       die();
 
 global $opml, $map;
 
index ccb364e00f0d6745044c4da30f3f313cfb2541ff..3766db8a611e0fec0783ef213f85ac5b59724bad 100644 (file)
@@ -29,16 +29,7 @@ if ( isset($action) && $action == 'edit' && !$ID )
        wp_die(__("You are not allowed to be here"));
 
 if ( isset($_GET['inline']) ) {
-
-       if ( isset($_GET['upload-page-form']) ) {
-               $errors = media_upload_form_handler();
-
-               $location = 'upload.php';
-               if ( $errors )
-                       $location .= '?message=3';
-
-               wp_redirect( admin_url($location) );
-       }
+       $errors = array();
 
        if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
                // Upload File button was clicked
@@ -50,6 +41,16 @@ if ( isset($_GET['inline']) ) {
                }
        }
 
+       if ( isset($_GET['upload-page-form']) ) {
+               $errors = array_merge($errors, (array) media_upload_form_handler());
+
+               $location = 'upload.php';
+               if ( $errors )
+                       $location .= '?message=3';
+
+               wp_redirect( admin_url($location) );
+       }
+
        $title = __('Upload New Media');
        $parent_file = 'upload.php';
        require_once('admin-header.php'); ?>
index 1f652455e8bed19d2ff7484beec92b7e5ff0cd60..1009f9ca976cc9891ac57e3056f497c9c61eb25a 100644 (file)
@@ -74,7 +74,10 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
                } elseif ( $submenu_as_parent && !empty($submenu[$item[2]]) ) {
                        $submenu[$item[2]] = array_values($submenu[$item[2]]);  // Re-index.
                        $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
-                       if ( ( ('index.php' != $submenu[$item[2]][0][2]) && file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") ) || !empty($menu_hook)) {
+                       $menu_file = $submenu[$item[2]][0][2];
+                       if ( false !== $pos = strpos($menu_file, '?') )
+                               $menu_file = substr($menu_file, 0, $pos);
+                       if ( ( ('index.php' != $submenu[$item[2]][0][2]) && file_exists(WP_PLUGIN_DIR . "/$menu_file") ) || !empty($menu_hook)) {
                                $admin_is_parent = true;
                                echo "<div class='wp-menu-image'><a href='admin.php?page={$submenu[$item[2]][0][2]}'>$img</a></div>$toggle<a href='admin.php?page={$submenu[$item[2]][0][2]}'$class$tabindex>{$item[0]}</a>";
                        } else {
@@ -82,7 +85,10 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
                        }
                } else if ( current_user_can($item[1]) ) {
                        $menu_hook = get_plugin_page_hook($item[2], 'admin.php');
-                       if ( ('index.php' != $item[2]) && file_exists(WP_PLUGIN_DIR . "/{$item[2]}") || !empty($menu_hook) ) {
+                       $menu_file = $item[2];
+                       if ( false !== $pos = strpos($menu_file, '?') )
+                               $menu_file = substr($menu_file, 0, $pos);
+                       if ( ('index.php' != $item[2]) && file_exists(WP_PLUGIN_DIR . "/$menu_file") || !empty($menu_hook) ) {
                                $admin_is_parent = true;
                                echo "\n\t<div class='wp-menu-image'><a href='admin.php?page={$item[2]}'>$img</a></div>$toggle<a href='admin.php?page={$item[2]}'$class$tabindex>{$item[0]}</a>";
                        } else {
@@ -102,22 +108,31 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
                                        $class[] = 'wp-first-item';
                                        $first = false;
                                }
+
+                               $menu_file = $item[2];
+                               if ( false !== $pos = strpos($menu_file, '?') )
+                                       $menu_file = substr($menu_file, 0, $pos);
+
                                if ( isset($submenu_file) ) {
                                        if ( $submenu_file == $sub_item[2] )
                                                $class[] = 'current';
                                // If plugin_page is set the parent must either match the current page or not physically exist.
                                // This allows plugin pages with the same hook to exist under different parents.
-                               } else if ( (isset($plugin_page) && $plugin_page == $sub_item[2] && (!file_exists($item[2]) || ($item[2] == $self))) || (!isset($plugin_page) && $self == $sub_item[2]) ) {
+                               } else if ( (isset($plugin_page) && $plugin_page == $sub_item[2] && (!file_exists($menu_file) || ($item[2] == $self))) || (!isset($plugin_page) && $self == $sub_item[2]) ) {
                                        $class[] = 'current';
                                }
 
                                $class = $class ? ' class="' . join( ' ', $class ) . '"' : '';
 
                                $menu_hook = get_plugin_page_hook($sub_item[2], $item[2]);
+                               $sub_file = $sub_item[2];
+                               if ( false !== $pos = strpos($sub_file, '?') )
+                                       $sub_file = substr($sub_file, 0, $pos);
 
-                               if ( ( ('index.php' != $sub_item[2]) && file_exists(WP_PLUGIN_DIR . "/{$sub_item[2]}") ) || ! empty($menu_hook) ) {
+                               if ( ( ('index.php' != $sub_item[2]) && file_exists(WP_PLUGIN_DIR . "/$sub_file") ) || ! empty($menu_hook) ) {
                                        // If admin.php is the current page or if the parent exists as a file in the plugins or admin dir
-                                       $parent_exists = (!$admin_is_parent && file_exists(WP_PLUGIN_DIR . "/{$item[2]}") && !is_dir(WP_PLUGIN_DIR . "/{$item[2]}") ) || file_exists($item[2]);
+                                       
+                                       $parent_exists = (!$admin_is_parent && file_exists(WP_PLUGIN_DIR . "/$menu_file") && !is_dir(WP_PLUGIN_DIR . "/{$item[2]}") ) || file_exists($menu_file);
                                        if ( $parent_exists )
                                                echo "<li$class><a href='{$item[2]}?page={$sub_item[2]}'$class$tabindex>{$sub_item[0]}</a></li>";
                                        elseif ( 'admin.php' == $pagenow || !$parent_exists )
index cd4b8cdb3ad5731fb0900a0124f9d4f5804b3ee5..3f2588856b9a79857db800a520519b9be02dde3f 100644 (file)
@@ -157,7 +157,7 @@ if (empty($tzstring)) { // set the Etc zone if no timezone string exists
 <span class="description"><?php _e('Choose a city in the same timezone as you.'); ?></span>
 <br />
 <span>
-<?php if (get_option('timezone_string')) : ?>
+<?php if ($tzstring) : ?>
        <?php
        $now = localtime(time(),true);
        if ($now['tm_isdst']) _e('This timezone is currently in daylight savings time.');
@@ -165,11 +165,11 @@ if (empty($tzstring)) { // set the Etc zone if no timezone string exists
        ?>
        <br />
        <?php
-       if (function_exists('timezone_transitions_get') && $tzstring) {
+       if (function_exists('timezone_transitions_get')) {
                $dateTimeZoneSelected = new DateTimeZone($tzstring);
                foreach (timezone_transitions_get($dateTimeZoneSelected) as $tr) {
                        if ($tr['ts'] > time()) {
-                               $found = true;
+                           $found = true;
                                break;
                        }
                }
@@ -179,10 +179,7 @@ if (empty($tzstring)) { // set the Etc zone if no timezone string exists
                        $message = $tr['isdst'] ?
                                __('Daylight savings time begins on: <code>%s</code>.') :
                                __('Standard time begins  on: <code>%s</code>.');
-                       $tz = new DateTimeZone($tzstring);
-                       $d = new DateTime( "@{$tr['ts']}" );
-                       $d->setTimezone($tz);
-                       printf( $message, date_i18n(get_option('date_format').' '.get_option('time_format'), $d->format('U') ) );
+                       printf( $message, date_i18n(get_option('date_format').' '.get_option('time_format'), $tr['ts'] ) );
                } else {
                        _e('This timezone does not observe daylight savings time.');
                }
index e297ef4ce62bbf558f1b4ccaef0461e757225033..8b1602c312ed1e1093333eadfb5e96d94df360de 100644 (file)
@@ -83,9 +83,6 @@ default:
                exit;
        }
 
-       if ( use_codepress() )
-               wp_enqueue_script( 'codepress' );
-
        // List of allowable extensions
        $editable_extensions = array('php', 'txt', 'text', 'js', 'css', 'html', 'htm', 'xml', 'inc', 'include');
        $editable_extensions = (array) apply_filters('editable_extensions', $editable_extensions);
@@ -111,12 +108,14 @@ default:
        if ( '.php' == substr( $real_file, strrpos( $real_file, '.' ) ) ) {
                $functions = wp_doc_link_parse( $content );
 
-               $docs_select = '<select name="docs-list" id="docs-list">';
-               $docs_select .= '<option value="">' . __( 'Function Name...' ) . '</option>';
-               foreach ( $functions as $function) {
-                       $docs_select .= '<option value="' . esc_attr( $function ) . '">' . htmlspecialchars( $function ) . '()</option>';
+               if ( !empty($functions) ) {
+                       $docs_select = '<select name="docs-list" id="docs-list">';
+                       $docs_select .= '<option value="">' . __( 'Function Name...' ) . '</option>';
+                       foreach ( $functions as $function) {
+                               $docs_select .= '<option value="' . esc_attr( $function ) . '">' . htmlspecialchars( $function ) . '()</option>';
+                       }
+                       $docs_select .= '</select>';
                }
-               $docs_select .= '</select>';
        }
 
        $content = htmlspecialchars( $content );
@@ -136,8 +135,25 @@ default:
 <div class="wrap">
 <?php screen_icon(); ?>
 <h2><?php echo esc_html( $title ); ?></h2>
-<div class="bordertitle">
-       <form id="themeselector" action="plugin-editor.php" method="post">
+
+<div class="fileedit-sub">
+<div class="alignleft">
+<big><?php
+       if ( is_plugin_active($plugin) ) {
+               if ( is_writeable($real_file) )
+                       echo sprintf(__('Editing <strong>%s</strong> (active)'), $file);
+               else
+                       echo sprintf(__('Browsing <strong>%s</strong> (active)'), $file);
+       } else {
+               if ( is_writeable($real_file) )
+                       echo sprintf(__('Editing <strong>%s</strong> (inactive)'), $file);
+               else
+                       echo sprintf(__('Browsing <strong>%s</strong> (inactive)'), $file);
+       }
+       ?></big>
+</div>
+<div class="alignright">
+       <form action="plugin-editor.php" method="post">
                <strong><label for="plugin"><?php _e('Select plugin to edit:'); ?> </label></strong>
                <select name="plugin" id="plugin">
 <?php
@@ -156,27 +172,11 @@ default:
                <input type="submit" name="Submit" value="<?php esc_attr_e('Select') ?>" class="button" />
        </form>
 </div>
-<div class="tablenav">
-<div class="alignleft">
-<big><?php
-       if ( is_plugin_active($plugin) ) {
-               if ( is_writeable($real_file) )
-                       echo sprintf(__('Editing <strong>%s</strong> (active)'), $file);
-               else
-                       echo sprintf(__('Browsing <strong>%s</strong> (active)'), $file);
-       } else {
-               if ( is_writeable($real_file) )
-                       echo sprintf(__('Editing <strong>%s</strong> (inactive)'), $file);
-               else
-                       echo sprintf(__('Browsing <strong>%s</strong> (inactive)'), $file);
-       }
-       ?></big>
-</div>
 <br class="clear" />
 </div>
-<br class="clear" />
-       <div id="templateside">
-       <h3 id="bordertitle"><?php _e('Plugin Files'); ?></h3>
+
+<div id="templateside">
+       <h3><?php _e('Plugin Files'); ?></h3>
 
        <ul>
 <?php
@@ -195,15 +195,15 @@ foreach ( $plugin_files as $plugin_file ) :
                <li<?php echo $file == $plugin_file ? ' class="highlight"' : ''; ?>><a href="plugin-editor.php?file=<?php echo $plugin_file; ?>&amp;plugin=<?php echo $plugin; ?>"><?php echo $plugin_file ?></a></li>
 <?php endforeach; ?>
        </ul>
-       </div>
-       <form name="template" id="template" action="plugin-editor.php" method="post">
+</div>
+<form name="template" id="template" action="plugin-editor.php" method="post">
        <?php wp_nonce_field('edit-plugin_' . $file) ?>
                <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1" class="codepress <?php echo $codepress_lang ?>"><?php echo $content ?></textarea>
                <input type="hidden" name="action" value="update" />
                <input type="hidden" name="file" value="<?php echo esc_attr($file) ?>" />
                <input type="hidden" name="plugin" value="<?php echo esc_attr($plugin) ?>" />
                </div>
-               <?php if ( isset( $functions ) ) : ?>
+               <?php if ( !empty( $docs_select ) ) : ?>
                <div id="documentation"><label for="docs-list"><?php _e('Documentation:') ?></label> <?php echo $docs_select ?> <input type="button" class="button" value="<?php esc_attr_e( 'Lookup' ) ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'http://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&amp;locale=<?php echo urlencode( get_locale() ) ?>&amp;version=<?php echo urlencode( $wp_version ) ?>&amp;redirect=true'); }" /></div>
                <?php endif; ?>
 <?php if ( is_writeable($real_file) ) : ?>
@@ -221,10 +221,10 @@ foreach ( $plugin_files as $plugin_file ) :
 <?php else : ?>
        <p><em><?php _e('You need to make this file writable before you can save your changes. See <a href="http://codex.wordpress.org/Changing_File_Permissions">the Codex</a> for more information.'); ?></em></p>
 <?php endif; ?>
- </form>
-<div class="clear"> &nbsp; </div>
+</form>
+<br class="clear" />
 </div>
 <?php
        break;
 }
-include("admin-footer.php") ?>
+include("admin-footer.php");
index d56c2ef62049482418b6f092c64423214b5288f8..201dfa67cefb4ed3f8610a35ae30d5d297ff7eb4 100644 (file)
@@ -138,6 +138,12 @@ td.available-theme {
 .folded #adminmenu img.wp-menu-image {
        padding: 7px 6px 0 0;
 }
+#adminmenu a.separator {
+       cursor: e-resize;
+}
+.folded #adminmenu a.separator {
+       cursor: w-resize;
+}
 #adminmenu .wp-submenu .wp-submenu-head {
        padding: 6px 10px 6px 4px;
 }
index db79d786ea1fded62d83b5181d40a98453d97e3d..c7343a7a521d9a4c972fdb7fe6559bd2c608108d 100644 (file)
@@ -22,8 +22,7 @@ if (empty($theme)) {
        $theme = get_current_theme();
 } else {
        $theme = stripslashes($theme);
- }
-
+}
 
 if ( ! isset($themes[$theme]) )
        wp_die(__('The requested theme does not exist.'));
@@ -65,8 +64,8 @@ case 'update':
        }
 
        $location = wp_kses_no_null($location);
-       $strip = array('%0d', '%0a');
-       $location = str_replace($strip, '', $location);
+       $strip = array('%0d', '%0a', '%0D', '%0A');
+       $location = _deep_replace($strip, $location);
        header("Location: $location");
        exit();
 
@@ -77,9 +76,6 @@ default:
        if ( !current_user_can('edit_themes') )
                wp_die('<p>'.__('You do not have sufficient permissions to edit themes for this blog.').'</p>');
 
-       if ( use_codepress() )
-               wp_enqueue_script( 'codepress' );
-
        require_once('admin-header.php');
 
        update_recently_edited($file);
@@ -117,8 +113,13 @@ $desc_header = ( $description != $file_show ) ? "<strong>$description</strong> (
 <div class="wrap">
 <?php screen_icon(); ?>
 <h2><?php echo esc_html( $title ); ?></h2>
-<div class="bordertitle">
-       <form id="themeselector" action="theme-editor.php" method="post">
+
+<div class="fileedit-sub">
+<div class="alignleft">
+<big><?php echo sprintf($desc_header, $file_show); ?></big>
+</div>
+<div class="alignright">
+       <form action="theme-editor.php" method="post">
                <strong><label for="theme"><?php _e('Select theme to edit:'); ?> </label></strong>
                <select name="theme" id="theme">
 <?php
@@ -134,15 +135,11 @@ $desc_header = ( $description != $file_show ) ? "<strong>$description</strong> (
                <input type="submit" name="Submit" value="<?php esc_attr_e('Select') ?>" class="button" />
        </form>
 </div>
-<div class="tablenav">
-<div class="alignleft">
-<big><?php echo sprintf($desc_header, $file_show); ?></big>
-</div>
 <br class="clear" />
 </div>
-<br class="clear" />
-       <div id="templateside">
-       <h3 id="bordertitle"><?php _e("Theme Files"); ?></h3>
+
+<div id="templateside">
+       <h3><?php _e("Theme Files"); ?></h3>
 
 <?php
 if ($allowed_files) :
@@ -193,10 +190,9 @@ if ($allowed_files) :
        </ul>
 <?php endif; ?>
 </div>
-       <?php
-       if (!$error) {
-       ?>
-       <form name="template" id="template" action="theme-editor.php" method="post">
+
+<?php if (!$error) { ?>
+<form name="template" id="template" action="theme-editor.php" method="post">
        <?php wp_nonce_field('edit-theme_' . $file . $theme) ?>
                 <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1" class="codepress <?php echo $codepress_lang ?>"><?php echo $content ?></textarea>
                 <input type="hidden" name="action" value="update" />
@@ -222,16 +218,16 @@ if ($allowed_files) :
 <p><em><?php _e('You need to make this file writable before you can save your changes. See <a href="http://codex.wordpress.org/Changing_File_Permissions">the Codex</a> for more information.'); ?></em></p>
 <?php endif; ?>
                </div>
-       </form>
-       <?php
+</form>
+<?php
        } else {
                echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
        }
-       ?>
-<div class="clear"> &nbsp; </div>
+?>
+<br class="clear" />
 </div>
 <?php
 break;
 }
 
-include("admin-footer.php") ?>
+include("admin-footer.php");
index 1f45824216e580fe1105195f072eeac60cc08c06..5bd44c7a9e744b1016653ef828b27a4f7df3c835 100644 (file)
@@ -14,7 +14,7 @@ if ( ! current_user_can('update_plugins') )
 
 function list_core_update( $update ) {
        global $wp_local_package;
-       $version_string = 'en_US' == $update->locale ?
+       $version_string = ('en_US' == $update->locale && 'en_US' == get_locale() ) ?
                        $update->current : sprintf("%s&ndash;<strong>%s</strong>", $update->current, $update->locale);
        $current = false;
        if ( !isset($update->response) || 'latest' == $update->response )
@@ -53,6 +53,9 @@ function list_core_update( $update ) {
        echo '</p>';
        if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) )
            echo '<p class="hint">'.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'</p>';
+       else if ( 'en_US' == $update->locale && get_locale() != 'en_US' ) {
+           echo '<p class="hint">'.sprintf( __('You are about to install WordPress %s <strong>in English.</strong> There is a chance this upgrade will break your translation. You may prefer to wait for the localized version to be released.'), $update->current ).'</p>';
+       }
        echo '</form>';
 
 }
index 6f19e70cb4a1968db9571d387e23d182f9b138ca..7c093d1c8c0b701aa2ec7a306e6277a4c76996af 100644 (file)
@@ -68,13 +68,11 @@ switch ( $step ) :
                break;
        case 1:
                wp_upgrade();
-
-               if ( empty( $_GET['backto'] ) )
-                       $backto = __get_option( 'home' ) . '/';
-               else {
-                       $backto = stripslashes( urldecode( $_GET['backto'] ) );
+                       
+                       $backto = empty($_GET['backto']) ? '' : $_GET['backto'] ;
+                       $backto = stripslashes( urldecode( $backto ) );
                        $backto = esc_url_raw( $backto  );
-               }
+                       $backto = wp_validate_redirect($backto, __get_option( 'home' ) . '/');
 ?>
 <h2><?php _e( 'Upgrade Complete' ); ?></h2>
        <p><?php _e( 'Your WordPress database has been successfully upgraded!' ); ?></p>
index 21284cba7bd6a788eb203f88a6a164e7c35bf38b..aaa6757eb65e7200d99761945f8fc1005f8694d5 100644 (file)
@@ -437,6 +437,10 @@ a.button-secondary {
        padding: 2px;
 }
 
+#timezone_string option {
+       margin-left: 1em;
+}
+
 .approve {
        display: none;
 }
@@ -2092,12 +2096,6 @@ p.search-box {
        padding: 0 0 .2em 1px;
 }
 
-.bordertitle {
-       padding-bottom: 5px;
-       border-bottom-width: 1px;
-       border-bottom-style: solid;
-}
-
 /* Edit posts */
 
 td.post-title strong, td.plugin-title strong {
@@ -3186,6 +3184,10 @@ table.fixed {
        overflow: hidden;
 }
 
+.widefat td p {
+       margin: 2px 0 0.8em;
+}
+
 table .vers,
 table .column-visible,
 table .column-rating {
index d08343f28aecc37d9b55b78a120461913c6c397f..423be94194312bdbd54aae731b02b1b5266c8ac9 100644 (file)
@@ -3,13 +3,16 @@
 Plugin Name: Akismet
 Plugin URI: http://akismet.com/
 Description: Akismet checks your comments against the Akismet web service to see if they look like spam or not. You need a <a href="http://wordpress.com/api-keys/">WordPress.com API key</a> to use it. You can review the spam it catches under "Comments." To show off your Akismet stats just put <code>&lt;?php akismet_counter(); ?&gt;</code> in your template. See also: <a href="http://wordpress.org/extend/plugins/stats/">WP Stats plugin</a>.
-Version: 2.2.4
+Version: 2.2.6
 Author: Matt Mullenweg
 Author URI: http://ma.tt/
 */
 
 // If you hardcode a WP.com API key here, all key config screens will be hidden
-$wpcom_api_key = '';
+if ( defined('WPCOM_API_KEY') )
+       $wpcom_api_key = constant('WPCOM_API_KEY');
+else
+       $wpcom_api_key = '';
 
 function akismet_init() {
        global $wpcom_api_key, $akismet_api_host, $akismet_api_port;
@@ -22,6 +25,7 @@ function akismet_init() {
        $akismet_api_port = 80;
        add_action('admin_menu', 'akismet_config_page');
        add_action('admin_menu', 'akismet_stats_page');
+       akismet_admin_warnings();
 }
 add_action('init', 'akismet_init');
 
@@ -83,6 +87,8 @@ function akismet_conf() {
                        update_option( 'akismet_discard_month', 'true' );
                else
                        update_option( 'akismet_discard_month', 'false' );
+       } elseif ( isset($_POST['check']) ) {
+               akismet_get_server_connectivity(0);
        }
 
        if ( $key_status != 'valid' ) {
@@ -118,7 +124,7 @@ function akismet_conf() {
                'key_valid' => array('color' => '2d2', 'text' => __('This key is valid.')),
                'key_failed' => array('color' => 'aa0', 'text' => __('The key below was previously validated but a connection to akismet.com can not be established at this time. Please check your server configuration.')));
 ?>
-<?php if ( !empty($_POST ) ) : ?>
+<?php if ( !empty($_POST['submit'] ) ) : ?>
 <div id="message" class="updated fade"><p><strong><?php _e('Options saved.') ?></strong></p></div>
 <?php endif; ?>
 <div class="wrap">
@@ -142,6 +148,66 @@ function akismet_conf() {
 <p><label><input name="akismet_discard_month" id="akismet_discard_month" value="true" type="checkbox" <?php if ( get_option('akismet_discard_month') == 'true' ) echo ' checked="checked" '; ?> /> <?php _e('Automatically discard spam comments on posts older than a month.'); ?></label></p>
        <p class="submit"><input type="submit" name="submit" value="<?php _e('Update options &raquo;'); ?>" /></p>
 </form>
+
+<form action="" method="post" id="akismet-connectivity" style="margin: auto; width: 400px; ">
+
+<h3><?php _e('Server Connectivity'); ?></h3>
+<?php
+       $servers = akismet_get_server_connectivity();
+       $fail_count = count($servers) - count( array_filter($servers) );
+       if ( is_array($servers) && count($servers) > 0 ) {
+               // some connections work, some fail
+               if ( $fail_count > 0 && $fail_count < count($servers) ) { ?>
+                       <p style="padding: .5em; background-color: #aa0; color: #fff; font-weight:bold;"><?php _e('Unable to reach some Akismet servers.'); ?></p>
+                       <p><?php echo sprintf( __('A network problem or firewall is blocking some connections from your web server to Akismet.com.  Akismet is working but this may cause problems during times of network congestion.  Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet and firewalls</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
+               <?php
+               // all connections fail
+               } elseif ( $fail_count > 0 ) { ?>
+                       <p style="padding: .5em; background-color: #d22; color: #fff; font-weight:bold;"><?php _e('Unable to reach any Akismet servers.'); ?></p>
+                       <p><?php echo sprintf( __('A network problem or firewall is blocking all connections from your web server to Akismet.com.  <strong>Akismet cannot work correctly until this is fixed.</strong>  Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet and firewalls</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
+               <?php
+               // all connections work
+               } else { ?>
+                       <p style="padding: .5em; background-color: #2d2; color: #fff; font-weight:bold;"><?php  _e('All Akismet servers are available.'); ?></p>
+                       <p><?php _e('Akismet is working correctly.  All servers are accessible.'); ?></p>
+               <?php
+               }
+       } elseif ( !is_callable('fsockopen') ) {
+               ?>
+                       <p style="padding: .5em; background-color: #d22; color: #fff; font-weight:bold;"><?php _e('Network functions are disabled.'); ?></p>
+                       <p><?php echo sprintf( __('Your web host or server administrator has disabled PHP\'s <code>fsockopen</code> function.  <strong>Akismet cannot work correctly until this is fixed.</strong>  Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet\'s system requirements</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
+               <?php
+       } else {
+               ?>
+                       <p style="padding: .5em; background-color: #d22; color: #fff; font-weight:bold;"><?php _e('Unable to find Akismet servers.'); ?></p>
+                       <p><?php echo sprintf( __('A DNS problem or firewall is preventing all access from your web server to Akismet.com.  <strong>Akismet cannot work correctly until this is fixed.</strong>  Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet and firewalls</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
+               <?php
+       }
+       
+       if ( !empty($servers) ) {
+?>
+<table style="width: 100%;">
+<thead><th><?php _e('Akismet server'); ?></th><th><?php _e('Network Status'); ?></th></thead>
+<tbody>
+<?php
+               asort($servers);
+               foreach ( $servers as $ip => $status ) {
+                       $color = ( $status ? '#2d2' : '#d22');
+       ?>
+               <tr>
+               <td><?php echo htmlspecialchars($ip); ?></td>
+               <td style="padding: 0 .5em; font-weight:bold; color: #fff; background-color: <?php echo $color; ?>"><?php echo ($status ? __('No problems') : __('Obstructed') ); ?></td>
+               
+       <?php
+               }
+       }
+?>
+</tbody>
+</table>
+       <p><?php if ( get_option('akismet_connectivity_time') ) echo sprintf( __('Last checked %s ago.'), human_time_diff( get_option('akismet_connectivity_time') ) ); ?></p>
+       <p class="submit"><input type="submit" name="check" value="<?php _e('Check network status &raquo;'); ?>" /></p>
+</form>
+
 </div>
 </div>
 <?php
@@ -191,29 +257,115 @@ function akismet_get_key() {
        return get_option('wordpress_api_key');
 }
 
-function akismet_verify_key( $key ) {
+function akismet_verify_key( $key, $ip = null ) {
        global $akismet_api_host, $akismet_api_port, $wpcom_api_key;
        $blog = urlencode( get_option('home') );
        if ( $wpcom_api_key )
                $key = $wpcom_api_key;
-       $response = akismet_http_post("key=$key&blog=$blog", 'rest.akismet.com', '/1.1/verify-key', $akismet_api_port);
+       $response = akismet_http_post("key=$key&blog=$blog", 'rest.akismet.com', '/1.1/verify-key', $akismet_api_port, $ip);
        if ( !is_array($response) || !isset($response[1]) || $response[1] != 'valid' && $response[1] != 'invalid' )
                return 'failed';
        return $response[1];
 }
 
-if ( !get_option('wordpress_api_key') && !$wpcom_api_key && !isset($_POST['submit']) ) {
-       function akismet_warning() {
-               echo "
-               <div id='akismet-warning' class='updated fade'><p><strong>".__('Akismet is almost ready.')."</strong> ".sprintf(__('You must <a href="%1$s">enter your WordPress.com API key</a> for it to work.'), "plugins.php?page=akismet-key-config")."</p></div>
-               ";
+// Check connectivity between the WordPress blog and Akismet's servers.
+// Returns an associative array of server IP addresses, where the key is the IP address, and value is true (available) or false (unable to connect).
+function akismet_check_server_connectivity() {
+       global $akismet_api_host, $akismet_api_port, $wpcom_api_key;
+       
+       $test_host = 'rest.akismet.com';
+       
+       // Some web hosts may disable one or both functions
+       if ( !is_callable('fsockopen') || !is_callable('gethostbynamel') )
+               return array();
+       
+       $ips = gethostbynamel($test_host);
+       if ( !$ips || !is_array($ips) || !count($ips) )
+               return array();
+               
+       $servers = array();
+       foreach ( $ips as $ip ) {
+               $response = akismet_verify_key( akismet_get_key(), $ip );
+               // even if the key is invalid, at least we know we have connectivity
+               if ( $response == 'valid' || $response == 'invalid' )
+                       $servers[$ip] = true;
+               else
+                       $servers[$ip] = false;
+       }
+
+       return $servers;
+}
+
+// Check the server connectivity and store the results in an option.
+// Cached results will be used if not older than the specified timeout in seconds; use $cache_timeout = 0 to force an update.
+// Returns the same associative array as akismet_check_server_connectivity()
+function akismet_get_server_connectivity( $cache_timeout = 86400 ) {
+       $servers = get_option('akismet_available_servers');
+       if ( (time() - get_option('akismet_connectivity_time') < $cache_timeout) && $servers !== false )
+               return $servers;
+       
+       // There's a race condition here but the effect is harmless.
+       $servers = akismet_check_server_connectivity();
+       update_option('akismet_available_servers', $servers);
+       update_option('akismet_connectivity_time', time());
+       return $servers;
+}
+
+// Returns true if server connectivity was OK at the last check, false if there was a problem that needs to be fixed.
+function akismet_server_connectivity_ok() {
+       $servers = akismet_get_server_connectivity();
+       return !( empty($servers) || !count($servers) || count( array_filter($servers) ) < count($servers) );
+}
+
+function akismet_admin_warnings() {
+       global $wpcom_api_key;
+       if ( !get_option('wordpress_api_key') && !$wpcom_api_key && !isset($_POST['submit']) ) {
+               function akismet_warning() {
+                       echo "
+                       <div id='akismet-warning' class='updated fade'><p><strong>".__('Akismet is almost ready.')."</strong> ".sprintf(__('You must <a href="%1$s">enter your WordPress.com API key</a> for it to work.'), "plugins.php?page=akismet-key-config")."</p></div>
+                       ";
+               }
+               add_action('admin_notices', 'akismet_warning');
+               return;
+       } elseif ( get_option('akismet_connectivity_time') && empty($_POST) && is_admin() && !akismet_server_connectivity_ok() ) {
+               function akismet_warning() {
+                       echo "
+                       <div id='akismet-warning' class='updated fade'><p><strong>".__('Akismet has detected a problem.')."</strong> ".sprintf(__('A server or network problem is preventing Akismet from working correctly.  <a href="%1$s">Click here for more information</a> about how to fix the problem.'), "plugins.php?page=akismet-key-config")."</p></div>
+                       ";
+               }
+               add_action('admin_notices', 'akismet_warning');
+               return;
+       }
+}
+
+function akismet_get_host($host) {
+       // if all servers are accessible, just return the host name.
+       // if not, return an IP that was known to be accessible at the last check.
+       if ( akismet_server_connectivity_ok() ) {
+               return $host;
+       } else {
+               $ips = akismet_get_server_connectivity();
+               // a firewall may be blocking access to some Akismet IPs
+               if ( count($ips) > 0 && count(array_filter($ips)) < count($ips) ) {
+                       // use DNS to get current IPs, but exclude any known to be unreachable
+                       $dns = (array)gethostbynamel( rtrim($host, '.') . '.' );
+                       $dns = array_filter($dns);
+                       foreach ( $dns as $ip ) {
+                               if ( array_key_exists( $ip, $ips ) && empty( $ips[$ip] ) )
+                                       unset($dns[$ip]);
+                       }
+                       // return a random IP from those available
+                       if ( count($dns) )
+                               return $dns[ array_rand($dns) ];
+                       
+               }
        }
-       add_action('admin_notices', 'akismet_warning');
-       return;
+       // if all else fails try the host name
+       return $host;
 }
 
 // Returns array with headers in $response[0] and body in $response[1]
-function akismet_http_post($request, $host, $path, $port = 80) {
+function akismet_http_post($request, $host, $path, $port = 80, $ip=null) {
        global $wp_version;
 
        $http_request  = "POST $path HTTP/1.0\r\n";
@@ -223,9 +375,17 @@ function akismet_http_post($request, $host, $path, $port = 80) {
        $http_request .= "User-Agent: WordPress/$wp_version | Akismet/2.0\r\n";
        $http_request .= "\r\n";
        $http_request .= $request;
+       
+       $http_host = $host;
+       // use a specific IP if provided - needed by akismet_check_server_connectivity()
+       if ( $ip && long2ip(ip2long($ip)) ) {
+               $http_host = $ip;
+       } else {
+               $http_host = akismet_get_host($host);
+       }
 
        $response = '';
-       if( false != ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) {
+       if( false != ( $fs = @fsockopen($http_host, $port, $errno, $errstr, 10) ) ) {
                fwrite($fs, $http_request);
 
                while ( !feof($fs) )
@@ -250,7 +410,7 @@ function akismet_auto_check_comment( $comment ) {
        $ignore = array( 'HTTP_COOKIE' );
 
        foreach ( $_SERVER as $key => $value )
-               if ( !in_array( $key, $ignore ) )
+               if ( !in_array( $key, $ignore ) && is_string($value) )
                        $comment["$key"] = $value;
 
        $query_string = '';
index 6b4a2426e17d54524027cad89349c20bf7b7d197..f34baf53dd86ee355e2f15ae0ab1fe932e5d0505 100644 (file)
@@ -1,6 +1,8 @@
 === Akismet ===
-Contributors: matt, ryan, andy, mdawaffe
+Contributors: matt, ryan, andy, mdawaffe, tellyworth
 Tags: akismet, comments, spam
+Requires at least: 2.0
+Tested up to: 2.8.2
 
 Akismet checks your comments against the Akismet web service to see if they look like spam or not.
 
@@ -20,3 +22,21 @@ PS: You'll need a [WordPress.com API key](http://wordpress.com/api-keys/) to use
 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!
+
+== Changelog ==
+
+= 2.2.6 =
+
+* Fix a global warning introduced in 2.2.5
+* Add changelog and additional readme.txt tags
+* Fix an array conversion warning in some versions of PHP
+* Support a new WPCOM_API_KEY constant for easier use with WordPress MU
+
+= 2.2.5 =
+
+* Include a new Server Connectivity diagnostic check, to detect problems caused by firewalls
+
+= 2.2.4 =
+
+* Fixed a key problem affecting the stats feature in WordPress MU
+* Provide additional blog information in Akismet API calls
index 08a01bbf3d8cf6b5809a97bf7014ba85ab1efb5d..a80b1ea24567683d171fb299372b9f605ca4566f 100644 (file)
@@ -2,14 +2,14 @@
 /**
  * @package Hello_Dolly
  * @author Matt Mullenweg
- * @version 1.5
+ * @version 1.5.1
  */
 /*
 Plugin Name: Hello Dolly
 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
+Version: 1.5.1
 Author URI: http://ma.tt/
 */
 
@@ -62,6 +62,9 @@ add_action('admin_footer', 'hello_dolly');
 
 // We need some CSS to position the paragraph
 function dolly_css() {
+       // This makes sure that the posinioning is also good for right-to-left languages
+       $x = ( 'rtl' == get_bloginfo( 'text_direction' ) ) ? 'left' : 'right';
+
        echo "
        <style type='text/css'>
        #dolly {
@@ -69,7 +72,7 @@ function dolly_css() {
                top: 4.5em;
                margin: 0;
                padding: 0;
-               right: 215px;
+               $x: 215px;
                font-size: 11px;
        }
        </style>
index 21cc5d24eb02247a0c3c68212a8e1b63420f741b..88050b3916efebff0024bc0ae3e214dd4180d870 100644 (file)
@@ -751,21 +751,24 @@ class SimplePie
         */
        function __destruct()
        {
-               if (!empty($this->data['items']))
+               if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode'))
                {
-                       foreach ($this->data['items'] as $item)
+                       if (!empty($this->data['items']))
                        {
-                               $item->__destruct();
+                               foreach ($this->data['items'] as $item)
+                               {
+                                       $item->__destruct();
+                               }
+                               unset($item, $this->data['items']);
                        }
-                       unset($this->data['items']);
-               }
-               if (!empty($this->data['ordered_items']))
-               {
-                       foreach ($this->data['ordered_items'] as $item)
+                       if (!empty($this->data['ordered_items']))
                        {
-                               $item->__destruct();
+                               foreach ($this->data['ordered_items'] as $item)
+                               {
+                                       $item->__destruct();
+                               }
+                               unset($item, $this->data['ordered_items']);
                        }
-                       unset($this->data['ordered_items']);
                }
        }
 
@@ -1683,7 +1686,7 @@ function embed_wmedia(width, height, link) {
 
                                $headers = $file->headers;
                                $data = $file->body;
-                               $sniffer = new $this->content_type_sniffer_class($file);
+                               $sniffer =& new $this->content_type_sniffer_class($file);
                                $sniffed = $sniffer->get_type();
                        }
                        else
@@ -1961,7 +1964,7 @@ function embed_wmedia(width, height, link) {
 
                                        if ($file->success && ($file->status_code == 200 || ($file->status_code > 206 && $file->status_code < 300)) && strlen($file->body) > 0)
                                        {
-                                               $sniffer = new $this->content_type_sniffer_class($file);
+                                               $sniffer =& new $this->content_type_sniffer_class($file);
                                                if (substr($sniffer->get_type(), 0, 6) === 'image/')
                                                {
                                                        if ($cache->save(array('headers' => $file->headers, 'body' => $file->body)))
@@ -3082,7 +3085,10 @@ class SimplePie_Item
         */
        function __destruct()
        {
-               unset($this->feed);
+               if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode'))
+               {
+                       unset($this->feed);
+               }
        }
 
        function get_item_tags($namespace, $tag)
@@ -5682,14 +5688,6 @@ class SimplePie_Source
                return md5(serialize($this->data));
        }
 
-       /**
-        * Remove items that link back to this before destroying this object
-        */
-       function __destruct()
-       {
-               unset($this->item);
-       }
-
        function get_source_tags($namespace, $tag)
        {
                if (isset($this->data['child'][$namespace][$tag]))
@@ -7746,7 +7744,7 @@ class SimplePie_File
                                                                {
                                                                        case 'gzip':
                                                                        case 'x-gzip':
-                                                                               $decoder = new SimplePie_gzdecode($this->body);
+                                                                               $decoder =& new SimplePie_gzdecode($this->body);
                                                                                if (!$decoder->parse())
                                                                                {
                                                                                        $this->error = 'Unable to decode HTTP "gzip" stream';
@@ -8954,23 +8952,12 @@ class SimplePie_Misc
 
        function parse_url($url)
        {
-               static $cache = array();
-               if (isset($cache[$url]))
-               {
-                       return $cache[$url];
-               }
-               elseif (preg_match('/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/', $url, $match))
+               preg_match('/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/', $url, $match);
+               for ($i = count($match); $i <= 9; $i++)
                {
-                       for ($i = count($match); $i <= 9; $i++)
-                       {
-                               $match[$i] = '';
-                       }
-                       return $cache[$url] = array('scheme' => $match[2], 'authority' => $match[4], 'path' => $match[5], 'query' => $match[7], 'fragment' => $match[9]);
-               }
-               else
-               {
-                       return $cache[$url] = array('scheme' => '', 'authority' => '', 'path' => '', 'query' => '', 'fragment' => '');
+                       $match[$i] = '';
                }
+               return array('scheme' => $match[2], 'authority' => $match[4], 'path' => $match[5], 'query' => $match[7], 'fragment' => $match[9]);
        }
 
        function compress_parse_url($scheme = '', $authority = '', $path = '', $query = '', $fragment = '')
@@ -10555,7 +10542,7 @@ class SimplePie_Misc
         */
        function entities_decode($data)
        {
-               $decoder = new SimplePie_Decode_HTML_Entities($data);
+               $decoder =& new SimplePie_Decode_HTML_Entities($data);
                return $decoder->parse();
        }
 
@@ -10809,36 +10796,31 @@ class SimplePie_Misc
         */
        function codepoint_to_utf8($codepoint)
        {
-               static $cache = array();
                $codepoint = (int) $codepoint;
-               if (isset($cache[$codepoint]))
-               {
-                       return $cache[$codepoint];
-               }
-               elseif ($codepoint < 0)
+               if ($codepoint < 0)
                {
-                       return $cache[$codepoint] = false;
+                       return false;
                }
                else if ($codepoint <= 0x7f)
                {
-                       return $cache[$codepoint] = chr($codepoint);
+                       return chr($codepoint);
                }
                else if ($codepoint <= 0x7ff)
                {
-                       return $cache[$codepoint] = chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f));
+                       return chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f));
                }
                else if ($codepoint <= 0xffff)
                {
-                       return $cache[$codepoint] = chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
+                       return chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
                }
                else if ($codepoint <= 0x10ffff)
                {
-                       return $cache[$codepoint] = chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
+                       return chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
                }
                else
                {
                        // U+FFFD REPLACEMENT CHARACTER
-                       return $cache[$codepoint] = "\xEF\xBF\xBD";
+                       return "\xEF\xBF\xBD";
                }
        }
 
@@ -10956,7 +10938,7 @@ class SimplePie_Misc
                {
                        if ($pos = strpos($data, "\x00\x00\x00\x3F\x00\x00\x00\x3E"))
                        {
-                               $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32BE', 'UTF-8'));
+                               $parser =& new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32BE', 'UTF-8'));
                                if ($parser->parse())
                                {
                                        $encoding[] = $parser->encoding;
@@ -10969,7 +10951,7 @@ class SimplePie_Misc
                {
                        if ($pos = strpos($data, "\x3F\x00\x00\x00\x3E\x00\x00\x00"))
                        {
-                               $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32LE', 'UTF-8'));
+                               $parser =& new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32LE', 'UTF-8'));
                                if ($parser->parse())
                                {
                                        $encoding[] = $parser->encoding;
@@ -10982,7 +10964,7 @@ class SimplePie_Misc
                {
                        if ($pos = strpos($data, "\x00\x3F\x00\x3E"))
                        {
-                               $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16BE', 'UTF-8'));
+                               $parser =& new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16BE', 'UTF-8'));
                                if ($parser->parse())
                                {
                                        $encoding[] = $parser->encoding;
@@ -10995,7 +10977,7 @@ class SimplePie_Misc
                {
                        if ($pos = strpos($data, "\x3F\x00\x3E\x00"))
                        {
-                               $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16LE', 'UTF-8'));
+                               $parser =& new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16LE', 'UTF-8'));
                                if ($parser->parse())
                                {
                                        $encoding[] = $parser->encoding;
@@ -11008,7 +10990,7 @@ class SimplePie_Misc
                {
                        if ($pos = strpos($data, "\x3F\x3E"))
                        {
-                               $parser = new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
+                               $parser =& new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
                                if ($parser->parse())
                                {
                                        $encoding[] = $parser->encoding;
@@ -11734,20 +11716,7 @@ class SimplePie_Parse_Date
                static $cache;
                if (!isset($cache[get_class($this)]))
                {
-                       if (extension_loaded('Reflection'))
-                       {
-                               $class = new ReflectionClass(get_class($this));
-                               $methods = $class->getMethods();
-                               $all_methods = array();
-                               foreach ($methods as $method)
-                               {
-                                       $all_methods[] = $method->getName();
-                               }
-                       }
-                       else
-                       {
-                               $all_methods = get_class_methods($this);
-                       }
+                       $all_methods = get_class_methods($this);
 
                        foreach ($all_methods as $method)
                        {
@@ -11774,7 +11743,7 @@ class SimplePie_Parse_Date
                static $object;
                if (!$object)
                {
-                       $object = new SimplePie_Parse_Date;
+                       $object =& new SimplePie_Parse_Date;
                }
                return $object;
        }
@@ -12809,7 +12778,7 @@ class SimplePie_Locator
 
                if ($this->file->method & SIMPLEPIE_FILE_SOURCE_REMOTE)
                {
-                       $sniffer = new $this->content_type_sniffer_class($this->file);
+                       $sniffer =& new $this->content_type_sniffer_class($this->file);
                        if ($sniffer->get_type() !== 'text/html')
                        {
                                return null;
@@ -12855,7 +12824,7 @@ class SimplePie_Locator
        {
                if ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE)
                {
-                       $sniffer = new $this->content_type_sniffer_class($file);
+                       $sniffer =& new $this->content_type_sniffer_class($file);
                        $sniffed = $sniffer->get_type();
                        if (in_array($sniffed, array('application/rss+xml', 'application/rdf+xml', 'text/rdf', 'application/atom+xml', 'text/xml', 'application/xml')))
                        {
@@ -13083,7 +13052,7 @@ class SimplePie_Parser
 
                if (substr($data, 0, 5) === '<?xml' && strspn(substr($data, 5, 1), "\x09\x0A\x0D\x20") && ($pos = strpos($data, '?>')) !== false)
                {
-                       $declaration = new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
+                       $declaration =& new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
                        if ($declaration->parse())
                        {
                                $data = substr($data, $pos + 2);
@@ -13669,4 +13638,4 @@ class SimplePie_Sanitize
        }
 }
 
-?>
\ No newline at end of file
+?>
index 2b6b60ac9744b9a99dd64af4de5df67fd03b8846..e87801b6d6a9e2c2ddfd3015f1cf7560d3c88949 100644 (file)
@@ -194,6 +194,7 @@ function comment_author_IP() {
 function get_comment_author_url() {
        global $comment;
        $url = ('http://' == $comment->comment_author_url) ? '' : $comment->comment_author_url;
+       $url = esc_url( $url, array('http', 'https') );
        return apply_filters('get_comment_author_url', $url);
 }
 
@@ -817,8 +818,28 @@ function comments_template( $file = '/comments.php', $separate_comments = false
                $file = '/comments.php';
 
        $req = get_option('require_name_email');
+
+       /**
+        * Comment author information fetched from the comment cookies.
+        *
+        * @uses wp_get_current_commenter()
+        */
        $commenter = wp_get_current_commenter();
-       extract($commenter, EXTR_SKIP);
+
+       /**
+        * The name of the current comment author escaped for use in attributes.
+        */
+       $comment_author = $commenter['comment_author']; // Escaped by sanitize_comment_cookies()
+
+       /**
+        * The email address of the current comment author escaped for use in attributes.
+        */     
+       $comment_author_email = $commenter['comment_author_email'];  // Escaped by sanitize_comment_cookies()
+
+       /**
+        * The url of the current comment author escaped for use in attributes.
+        */     
+       $comment_author_url = esc_url($commenter['comment_author_url']);
 
        /** @todo Use API instead of SELECTs. */
        if ( $user_ID) {
index d2bebc8021301d1bcfb26ebb6adc42c43ed8f188..54d1d4012d106f2e6c325ac26908bc7d02f151d6 100644 (file)
@@ -526,8 +526,10 @@ class WP_Widget_Recent_Posts extends WP_Widget {
                if ( !is_array($cache) )
                        $cache = array();
 
-               if ( isset($cache[$args['widget_id']]) )
-                       return $cache[$args['widget_id']];
+               if ( isset($cache[$args['widget_id']]) ) {
+                       echo $cache[$args['widget_id']];
+                       return;
+               }
 
                ob_start();
                extract($args);
@@ -710,7 +712,7 @@ class WP_Widget_RSS extends WP_Widget {
                if ( ! is_wp_error($rss) ) {
                        $desc = esc_attr(strip_tags(@html_entity_decode($rss->get_description(), ENT_QUOTES, get_option('blog_charset'))));
                        if ( empty($title) )
-                               $title = htmlentities(strip_tags($rss->get_title()));
+                               $title = esc_html(strip_tags($rss->get_title()));
                        $link = esc_url(strip_tags($rss->get_permalink()));
                        while ( stristr($link, 'http') != $link )
                                $link = substr($link, 1);
index 26bfc694e05c6a63bef0633bfdfe01ca6808bf16..53cfeeae89dba67a91d811145fb6dffc6dcc3fb8 100644 (file)
@@ -80,8 +80,8 @@ function wptexturize($text) {
 }
 
 function wptexturize_pushpop_element($text, &$stack, $disabled_elements, $opening = '<', $closing = '>') {
-       $o = preg_quote($opening);
-       $c = preg_quote($closing);
+       $o = preg_quote($opening, '/');
+       $c = preg_quote($closing, '/');
        foreach($disabled_elements as $element) {
                if (preg_match('/^'.$o.$element.'\b/', $text)) array_push($stack, $element);
                if (preg_match('/^'.$o.'\/'.$element.$c.'/', $text)) {
@@ -2042,8 +2042,8 @@ function clean_url( $url, $protocols = null, $context = 'display' ) {
 
        if ('' == $url) return $url;
        $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url);
-       $strip = array('%0d', '%0a');
-       $url = str_replace($strip, '', $url);
+       $strip = array('%0d', '%0a', '%0D', '%0A');
+       $url = _deep_replace($strip, $url);
        $url = str_replace(';//', '://', $url);
        /* If the URL doesn't appear to contain a scheme, we
         * presume it needs http:// appended (unless a relative
@@ -2067,6 +2067,35 @@ function clean_url( $url, $protocols = null, $context = 'display' ) {
        return apply_filters('clean_url', $url, $original_url, $context);
 }
 
+/**
+ * Perform a deep string replace operation to ensure the values in $search are no longer present
+ * 
+ * Repeats the replacement operation until it no longer replaces anything so as to remove "nested" values
+ * e.g. $subject = '%0%0%0DDD', $search ='%0D', $result ='' rather than the '%0%0DD' that
+ * str_replace would return
+ * 
+ * @since 2.8.1
+ * @access private
+ * 
+ * @param string|array $search
+ * @param string $subject
+ * @return string The processed string
+ */
+function _deep_replace($search, $subject){
+       $found = true;
+       while($found) {
+               $found = false;
+               foreach( (array) $search as $val ) {
+                       while(strpos($subject, $val) !== false) {
+                               $found = true;
+                               $subject = str_replace($val, '', $subject);
+                       }
+               }
+       }
+       
+       return $subject;
+}
+
 /**
  * Escapes data for use in a MySQL query
  *
index cfd12badb200e39f2eae932acaf0eafed7b6352c..3984a3164fdd930dafa8ea57512856b0dd238baa 100644 (file)
@@ -2682,7 +2682,7 @@ function smilies_init() {
                } else {
                        $wp_smiliessearch .= '|';
                }
-               $wp_smiliessearch .= preg_quote($rest);
+               $wp_smiliessearch .= preg_quote($rest, '/');
        }
 
        $wp_smiliessearch .= ')(?:\s|$)/m';
@@ -3149,128 +3149,183 @@ function update_site_option( $key, $value ) {
  * Overrides the gmt_offset option if we have a timezone_string available
  */
 function wp_timezone_override_offset() {
-       if (!wp_timezone_supported()) return false;
-
-       $tz = get_option('timezone_string');
-       if (empty($tz)) return false;
-
-       @date_default_timezone_set($tz);
-
-       $dateTimeZoneSelected = timezone_open($tz);
-       $dateTimeServer = date_create();
-       if ($dateTimeZoneSelected === false || $dateTimeServer === false) return false;
-
-       $timeOffset = timezone_offset_get($dateTimeZoneSelected, $dateTimeServer);
-       $timeOffset = $timeOffset / 3600;
+       if ( !wp_timezone_supported() ) {
+               return false;
+       }
+       if ( !$timezone_string = get_option( 'timezone_string' ) ) {
+               return false;
+       }
 
-       return $timeOffset;
+       @date_default_timezone_set( $timezone_string );
+       $timezone_object = timezone_open( $timezone_string );
+       $datetime_object = date_create();
+       if ( false === $timezone_object || false === $datetime_object ) {
+               return false;
+       }
+       return round( timezone_offset_get( $timezone_object, $datetime_object ) / 3600, 2 );
 }
 
 /**
  * Check for PHP timezone support
- *
  */
 function wp_timezone_supported() {
-       if (function_exists('date_default_timezone_set')
-               && function_exists('timezone_identifiers_list')
-               && function_exists('timezone_open')
-               && function_exists('timezone_offset_get')
-               )
-               return apply_filters('timezone_support',true);
-
-       return apply_filters('timezone_support',false);
+       $support = false;
+       if (
+               function_exists( 'date_default_timezone_set' ) &&
+               function_exists( 'timezone_identifiers_list' ) &&
+               function_exists( 'timezone_open' ) &&
+               function_exists( 'timezone_offset_get' )
+       ) {
+               $support = true;
+       }
+       return apply_filters( 'timezone_support', $support );
+}
+
+function _wp_timezone_choice_usort_callback( $a, $b ) {
+       // Don't use translated versions of Etc
+       if ( 'Etc' === $a['continent'] && 'Etc' === $b['continent'] ) {
+               // Make the order of these more like the old dropdown
+               if ( 'GMT+' === substr( $a['city'], 0, 4 ) && 'GMT+' === substr( $b['city'], 0, 4 ) ) {
+                       return -1 * ( strnatcasecmp( $a['city'], $b['city'] ) );
+               }
+               if ( 'UTC' === $a['city'] ) {
+                       if ( 'GMT+' === substr( $b['city'], 0, 4 ) ) {
+                               return 1;
+                       }
+                       return -1;
+               }
+               if ( 'UTC' === $b['city'] ) {
+                       if ( 'GMT+' === substr( $a['city'], 0, 4 ) ) {
+                               return -1;
+                       }
+                       return 1;
+               }
+               return strnatcasecmp( $a['city'], $b['city'] );
+       }
+       if ( $a['t_continent'] == $b['t_continent'] ) {
+               if ( $a['t_city'] == $b['t_city'] ) {
+                       return strnatcasecmp( $a['t_subcity'], $b['t_subcity'] );
+               }
+               return strnatcasecmp( $a['t_city'], $b['t_city'] );
+       } else {
+               // Force Etc to the bottom of the list
+               if ( 'Etc' === $a['continent'] ) {
+                       return 1;
+               }
+               if ( 'Etc' === $b['continent'] ) {
+                       return -1;
+               }
+               return strnatcasecmp( $a['t_continent'], $b['t_continent'] );
+       }
 }
 
 /**
  * Gives a nicely formatted list of timezone strings // temporary! Not in final
  *
- * @param string $selectedzone - which zone should be the selected one
+ * @param $selected_zone string Selected Zone
  *
  */
-function wp_timezone_choice($selectedzone) {
+function wp_timezone_choice( $selected_zone ) {
        static $mo_loaded = false;
 
-       $continents = array('Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific', 'Etc');
+       $continents = array( 'Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific', 'Etc' );
 
        // Load translations for continents and cities
-       if ( ! $mo_loaded ) {
+       if ( !$mo_loaded ) {
                $locale = get_locale();
-               $mofile = WP_LANG_DIR . "/continents-cities-$locale.mo";
-               load_textdomain('continents-cities', $mofile);
+               $mofile = WP_LANG_DIR . '/continents-cities-' . $locale . '.mo';
+               load_textdomain( 'continents-cities', $mofile );
                $mo_loaded = true;
        }
 
-       $all = timezone_identifiers_list();
-
-       $i = 0;
-       foreach ( $all as $zone ) {
-               $zone = explode('/',$zone);
-               if ( ! in_array($zone[0], $continents) )
+       $zonen = array();
+       foreach ( timezone_identifiers_list() as $zone ) {
+               $zone = explode( '/', $zone );
+               if ( !in_array( $zone[0], $continents ) ) {
                        continue;
-               if ( $zone[0] == 'Etc' && in_array($zone[1], array('UCT', 'GMT', 'GMT0', 'GMT+0', 'GMT-0', 'Greenwich', 'Universal', 'Zulu')) )
+               }
+               if ( 'Etc' === $zone[0] && in_array( $zone[1], array( 'UCT', 'GMT', 'GMT0', 'GMT+0', 'GMT-0', 'Greenwich', 'Universal', 'Zulu' ) ) ) {
                        continue;
-               $zonen[$i]['continent'] = isset($zone[0]) ? $zone[0] : '';
-               $zonen[$i]['city'] = isset($zone[1]) ? $zone[1] : '';
-               $zonen[$i]['subcity'] = isset($zone[2]) ? $zone[2] : '';
-               $i++;
-       }
-
-       usort($zonen, create_function(
-               '$a, $b', '
-               $t = create_function(\'$s\', \'return translate(str_replace("_", " ", $s), "continents-cities");\');
-               $a_continent = $t($a["continent"]);
-               $b_continent = $t($b["continent"]);
-               $a_city = $t($a["city"]);
-               $b_city = $t($b["city"]);
-               $a_subcity = $t($a["subcity"]);
-               $b_subcity = $t($b["subcity"]);
-               if ( $a_continent == $b_continent && $a_city == $b_city )
-                       return strnatcasecmp($a_subcity, $b_subcity);
-               elseif ( $a_continent == $b_continent )
-                       return strnatcasecmp($a_city, $b_city);
-               else
-                       return strnatcasecmp($a_continent, $b_continent);
-               '));
-
-       $structure = '';
-       $pad = '&nbsp;&nbsp;&nbsp;';
-
-       if ( empty($selectedzone) )
-               $structure .= '<option selected="selected" value="">' . __('Select a city') . "</option>\n";
-       foreach ( $zonen as $zone ) {
-               extract($zone);
-               if ( empty($selectcontinent) && !empty($city) ) {
-                       $selectcontinent = $continent;
-                       $structure .= '<optgroup label="'. esc_attr( translate( $continent, "continents-cities" ) ) .'">' . "\n"; // continent
-               } elseif ( !empty($selectcontinent) && $selectcontinent != $continent ) {
-                       $structure .= "</optgroup>\n";
-                       $selectcontinent = '';
-                       if ( !empty($city) ) {
-                               $selectcontinent = $continent;
-                               $structure .= '<optgroup label="'. esc_attr( translate( $continent, "continents-cities" ) ) .'">' . "\n"; // continent
-                       }
                }
 
-               if ( !empty($city) ) {
-                       $display = str_replace('_',' ',$city);
-                       $display = translate($display, "continents-cities");
-                       if ( !empty($subcity) ) {
-                               $display_subcity = str_replace('_', ' ', $subcity);
-                               $display_subcity = translate($display_subcity, "continents-cities");
-                               $city = $city . '/'. $subcity;
-                               $display = $display . '/' . $display_subcity;
-                       }
-                       if ( $continent == 'Etc' )
-                               $display = strtr($display, '+-', '-+');
-                       $structure .= "\t<option ".((($continent.'/'.$city)==$selectedzone)?'selected="selected"':'')." value=\"".($continent.'/'.$city)."\">$pad".$display."</option>\n"; //Timezone
+               // This determines what gets set and translated - we don't translate Etc/* strings here, they are done later
+               $exists = array(
+                       0 => ( isset( $zone[0] ) && $zone[0] ) ? true : false,
+                       1 => ( isset( $zone[1] ) && $zone[1] ) ? true : false,
+                       2 => ( isset( $zone[2] ) && $zone[2] ) ? true : false
+               );
+               $exists[3] = ( $exists[0] && 'Etc' !== $zone[0] ) ? true : false;
+               $exists[4] = ( $exists[1] && $exists[3] ) ? true : false;
+               $exists[5] = ( $exists[2] && $exists[3] ) ? true : false;
+
+               $zonen[] = array(
+                       'continent'   => ( $exists[0] ? $zone[0] : '' ),
+                       'city'        => ( $exists[1] ? $zone[1] : '' ),
+                       'subcity'     => ( $exists[2] ? $zone[2] : '' ),
+                       't_continent' => ( $exists[3] ? translate( str_replace( '_', ' ', $zone[0] ), 'continents-cities' ) : '' ),
+                       't_city'      => ( $exists[4] ? translate( str_replace( '_', ' ', $zone[1] ), 'continents-cities' ) : '' ),
+                       't_subcity'   => ( $exists[5] ? translate( str_replace( '_', ' ', $zone[2] ), 'continents-cities' ) : '' )
+               );
+       }
+       usort( $zonen, '_wp_timezone_choice_usort_callback' );
+
+       $structure = array();
+
+       if ( empty( $selected_zone ) ) {
+               $structure[] = '<option selected="selected" value="">' . __( 'Select a city' ) . '</option>';
+       }
+
+       foreach ( $zonen as $key => $zone ) {
+               // Build value in an array to join later
+               $value = array( $zone['continent'] );
+
+               if ( empty( $zone['city'] ) ) {
+                       // It's at the continent level (generally won't happen)
+                       $display = $zone['t_continent'];
                } else {
-                       $structure .= "<option ".(($continent==$selectedzone)?'selected="selected"':'')." value=\"".$continent."\">" . translate($continent, "continents-cities") . "</option>\n"; //Timezone
+                       // It's inside a continent group
+                       
+                       // Continent optgroup
+                       if ( !isset( $zonen[$key - 1] ) || $zonen[$key - 1]['continent'] !== $zone['continent'] ) {
+                               $label = ( 'Etc' === $zone['continent'] ) ? __( 'Manual offsets' ) : $zone['t_continent'];
+                               $structure[] = '<optgroup label="'. esc_attr( $label ) .'">';
+                       }
+                       
+                       // Add the city to the value
+                       $value[] = $zone['city'];
+                       if ( 'Etc' === $zone['continent'] ) {
+                               if ( 'UTC' === $zone['city'] ) {
+                                       $display = '';
+                               } else {
+                                       $display = str_replace( 'GMT', '', $zone['city'] );
+                                       $display = strtr( $display, '+-', '-+' ) . ':00';
+                               }
+                               $display = sprintf( __( 'UTC %s' ), $display );
+                       } else {
+                               $display = $zone['t_city'];
+                               if ( !empty( $zone['subcity'] ) ) {
+                                       // Add the subcity to the value
+                                       $value[] = $zone['subcity'];
+                                       $display .= ' - ' . $zone['t_subcity'];
+                               }
+                       }
+               }
+
+               // Build the value
+               $value = join( '/', $value );
+               $selected = '';
+               if ( $value === $selected_zone ) {
+                       $selected = 'selected="selected" ';
+               }
+               $structure[] = '<option ' . $selected . 'value="' . esc_attr( $value ) . '">' . esc_html( $display ) . "</option>";
+               
+               // Close continent optgroup
+               if ( !empty( $zone['city'] ) && ( !isset($zonen[$key + 1]) || (isset( $zonen[$key + 1] ) && $zonen[$key + 1]['continent'] !== $zone['continent']) ) ) {
+                       $structure[] = '</optgroup>';
                }
        }
 
-       if ( !empty($selectcontinent) )
-               $structure .= "</optgroup>\n";
-       return $structure;
+       return join( "\n", $structure );
 }
 
 
index 22d1e160d5d83827c99eed2142f5c0127f7318d0..5251bdaab34232466e03bb9ef5cede10108c87cd 100644 (file)
@@ -92,7 +92,7 @@ function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false,
  */
 function wp_style_is( $handle, $list = 'queue' ) {
        global $wp_styles;
-       if ( !is_a($wp_styles, 'WP_Scripts') )
+       if ( !is_a($wp_styles, 'WP_Styles') )
                $wp_styles = new WP_Styles();
 
        $query = $wp_styles->query( $handle, $list );
index af4c43b33dd2e25f93e2e3fb78531bfe436c8cd2..e431bd199824fc748ce6a53bdaa5fc4091ae87a1 100644 (file)
@@ -73,11 +73,11 @@ class WP_Http {
         * Tests all of the objects and returns the object that passes. Also caches
         * that object to be used later.
         *
-        * The order for the GET/HEAD requests are HTTP Extension, FSockopen Streams, 
-        * Fopen, and finally cURL. Whilst Fsockopen has the highest overhead, Its
-        * used 2nd due to high compatibility with most hosts, The HTTP Extension is
-        * tested first due to hosts which have it enabled, are likely to work
-        * correctly with it.
+        * The order for the GET/HEAD requests are Streams, HTTP Extension, Fopen,
+        * and finally Fsockopen. fsockopen() is used last, because it has the most
+        * overhead in its implementation. There isn't any real way around it, since
+        * redirects have to be supported, much the same way the other transports
+        * also handle redirects.
         *
         * There are currently issues with "localhost" not resolving correctly with
         * DNS. This may cause an error "failed to open stream: A connection attempt
@@ -98,18 +98,18 @@ class WP_Http {
                        if ( true === WP_Http_ExtHttp::test($args) ) {
                                $working_transport['exthttp'] = new WP_Http_ExtHttp();
                                $blocking_transport[] = &$working_transport['exthttp'];
-                       } else if ( true === WP_Http_Fsockopen::test($args) ) {
-                               $working_transport['fsockopen'] = new WP_Http_Fsockopen();
-                               $blocking_transport[] = &$working_transport['fsockopen'];
+                       } else if ( true === WP_Http_Curl::test($args) ) {
+                               $working_transport['curl'] = new WP_Http_Curl();
+                               $blocking_transport[] = &$working_transport['curl'];
                        } else if ( true === WP_Http_Streams::test($args) ) {
                                $working_transport['streams'] = new WP_Http_Streams();
                                $blocking_transport[] = &$working_transport['streams'];
                        } else if ( true === WP_Http_Fopen::test($args) ) {
                                $working_transport['fopen'] = new WP_Http_Fopen();
                                $blocking_transport[] = &$working_transport['fopen'];
-                       } else if ( true === WP_Http_Curl::test($args) ) {
-                               $working_transport['curl'] = new WP_Http_Curl();
-                               $blocking_transport[] = &$working_transport['curl'];
+                       } else if ( true === WP_Http_Fsockopen::test($args) ) {
+                               $working_transport['fsockopen'] = new WP_Http_Fsockopen();
+                               $blocking_transport[] = &$working_transport['fsockopen'];
                        }
 
                        foreach ( array('curl', 'streams', 'fopen', 'fsockopen', 'exthttp') as $transport ) {
@@ -149,15 +149,15 @@ class WP_Http {
                        if ( true === WP_Http_ExtHttp::test($args) ) {
                                $working_transport['exthttp'] = new WP_Http_ExtHttp();
                                $blocking_transport[] = &$working_transport['exthttp'];
-                       } else if ( true === WP_Http_Fsockopen::test($args) ) {
-                               $working_transport['fsockopen'] = new WP_Http_Fsockopen();
-                               $blocking_transport[] = &$working_transport['fsockopen'];
-                       } else if ( true === WP_Http_Streams::test($args) ) {
-                               $working_transport['streams'] = new WP_Http_Streams();
-                               $blocking_transport[] = &$working_transport['streams'];
                        } else if ( true === WP_Http_Curl::test($args) ) {
                                $working_transport['curl'] = new WP_Http_Curl();
                                $blocking_transport[] = &$working_transport['curl'];
+                       } else if ( true === WP_Http_Streams::test($args) ) {
+                               $working_transport['streams'] = new WP_Http_Streams();
+                               $blocking_transport[] = &$working_transport['streams'];
+                       } else if ( true === WP_Http_Fsockopen::test($args) ) {
+                               $working_transport['fsockopen'] = new WP_Http_Fsockopen();
+                               $blocking_transport[] = &$working_transport['fsockopen'];
                        }
 
                        foreach ( array('curl', 'streams', 'fsockopen', 'exthttp') as $transport ) {
@@ -239,7 +239,7 @@ class WP_Http {
                $arrURL = parse_url($url);
 
                if ( $this->block_request( $url ) )
-                       return new WP_Error('http_request_failed', 'User has blocked requests through HTTP.');
+                       return new WP_Error('http_request_failed', __('User has blocked requests through HTTP.'));
 
                // Determine if this is a https call and pass that on to the transport functions
                // so that we can blacklist the transports that do not support ssl verification
index a51eeb7ec8a0d4c9441e84932d8214223e51e205..efd2f5985f94ebf165a9b3598dce656b9d354bce 100644 (file)
@@ -8,7 +8,7 @@ function get_file($path) {
                $path = realpath($path);
 
        if ( ! $path || ! @is_file($path) )
-               return '';
+               return false;
 
        return @file_get_contents($path);
 }
@@ -20,9 +20,9 @@ header('Vary: Accept-Encoding'); // Handle proxies
 header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
 header("Cache-Control: public, max-age=$expires_offset");
 
-if ( isset($_GET['c']) && 1 == $_GET['c'] && false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') ) {
+if ( isset($_GET['c']) && 1 == $_GET['c'] && false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && ( $file = get_file($basepath . '/wp-tinymce.js.gz') ) ) {
        header('Content-Encoding: gzip');
-       echo get_file($basepath . '/wp-tinymce.js.gz');
+       echo $file;
 } else {
        echo get_file($basepath . '/wp-tinymce.js');
 }
index 634cd4931e7e922c9967ebd4394e66cc85fb2231..4255128610b2274ddd025bf4026b8079a81b6042 100644 (file)
@@ -119,23 +119,35 @@ if (!CUSTOM_TAGS) {
                        'target' => array ()),
                'h1' => array(
                        'align' => array (),
-                       'class' => array ()),
-               'h2' => array(
+                       'class' => array (),
+                       'id'    => array (),
+                       'style' => array ()),
+               'h2' => array (
                        'align' => array (),
-                       'class' => array ()),
-               'h3' => array(
+                       'class' => array (),
+                       'id'    => array (),
+                       'style' => array ()),
+               'h3' => array (
                        'align' => array (),
-                       'class' => array ()),
-               'h4' => array(
+                       'class' => array (),
+                       'id'    => array (),
+                       'style' => array ()),
+               'h4' => array (
                        'align' => array (),
-                       'class' => array ()),
-               'h5' => array(
+                       'class' => array (),
+                       'id'    => array (),
+                       'style' => array ()),
+               'h5' => array (
                        'align' => array (),
-                       'class' => array ()),
-               'h6' => array(
+                       'class' => array (),
+                       'id'    => array (),
+                       'style' => array ()),
+               'h6' => array (
                        'align' => array (),
-                       'class' => array ()),
-               'hr' => array(
+                       'class' => array (),
+                       'id'    => array (),
+                       'style' => array ()),
+               'hr' => array (
                        'align' => array (),
                        'class' => array (),
                        'noshade' => array (),
@@ -521,6 +533,19 @@ function wp_kses_attr($element, $attr, $allowed_html, $allowed_protocols) {
                                        break;
                                }
 
+                       if ( $arreach['name'] == 'style' ) {
+                               $orig_value = $arreach['value'];
+
+                               $value = safecss_filter_attr($orig_value);
+
+                               if ( empty($value) )
+                                       continue;
+
+                               $arreach['value'] = $value;
+
+                               $arreach['whole'] = str_replace($orig_value, $value, $arreach['whole']);
+                       }
+
                        if ($ok)
                                $attr2 .= ' '.$arreach['whole']; # it passed them
                } # if !is_array($current)
@@ -1122,4 +1147,49 @@ function kses_init() {
 
 add_action('init', 'kses_init');
 add_action('set_current_user', 'kses_init');
-?>
+
+function safecss_filter_attr( $css, $deprecated = '' ) {
+       $css = wp_kses_no_null($css);
+       $css = str_replace(array("\n","\r","\t"), '', $css);
+
+       if ( preg_match( '%[\\(&]|/\*%', $css ) ) // remove any inline css containing \ ( & or comments
+               return '';
+
+       $css_array = split( ';', trim( $css ) );
+       $allowed_attr = apply_filters( 'safe_style_css', array( 'text-align', 'margin', 'color', 'float', 
+       'border', 'background', 'background-color', 'border-bottom', 'border-bottom-color', 
+       'border-bottom-style', 'border-bottom-width', 'border-collapse', 'border-color', 'border-left',
+       'border-left-color', 'border-left-style', 'border-left-width', 'border-right', 'border-right-color', 
+       'border-right-style', 'border-right-width', 'border-spacing', 'border-style', 'border-top', 
+       'border-top-color', 'border-top-style', 'border-top-width', 'border-width', 'caption-side', 
+       'clear', 'cursor', 'direction', 'font', 'font-family', 'font-size', 'font-style', 
+       'font-variant', 'font-weight', 'height', 'letter-spacing', 'line-height', 'margin-bottom', 
+       'margin-left', 'margin-right', 'margin-top', 'overflow', 'padding', 'padding-bottom', 
+       'padding-left', 'padding-right', 'padding-top', 'text-decoration', 'text-indent', 'vertical-align', 
+       'width' ) );
+
+       if ( empty($allowed_attr) )
+               return $css;
+
+       $css = '';
+       foreach ( $css_array as $css_item ) {
+               if ( $css_item == '' )
+                       continue;
+               $css_item = trim( $css_item );
+               $found = false;
+               if ( strpos( $css_item, ':' ) === false ) {
+                       $found = true;
+               } else {
+                       $parts = split( ':', $css_item );
+                       if ( in_array( trim( $parts[0] ), $allowed_attr ) )
+                               $found = true;
+               }
+               if ( $found ) {
+                       if( $css != '' )
+                               $css .= ';';
+                       $css .= $css_item;
+               }
+       }
+
+       return $css;
+}
index 335bc119c851f08738bb5151562702a9b8892352..048504972712c5e8df1dddda7210a8c5df71ff80 100644 (file)
@@ -301,35 +301,34 @@ function _nx_noop( $single, $plural, $context ) {
 
 
 /**
- * Loads MO file into the list of domains.
+ * Loads a MO file into the domain $domain.
  *
- * If the domain already exists, the inclusion will fail. If the MO file is not
- * readable, the inclusion will fail.
+ * If the domain already exists, the translations will be merged. If both
+ * sets have the same string, the translation from the original value will be taken.
  *
  * On success, the .mo file will be placed in the $l10n global by $domain
- * and will be an gettext_reader object.
+ * and will be a MO object.
  *
  * @since 1.5.0
- * @uses $l10n Gets list of domain translated string (gettext_reader) objects
- * @uses CacheFileReader Reads the MO file
- * @uses gettext_reader Allows for retrieving translated strings
+ * @uses $l10n Gets list of domain translated string objects
  *
  * @param string $domain Unique identifier for retrieving translated strings
  * @param string $mofile Path to the .mo file
- * @return null On failure returns null and also on success returns nothing.
+ * @return bool true on success, false on failure
  */
 function load_textdomain($domain, $mofile) {
        global $l10n;
 
-       if ( !is_readable($mofile)) return;
+       if ( !is_readable( $mofile ) ) return false;
 
        $mo = new MO();
-       $mo->import_from_file( $mofile );
+       if ( !$mo->import_from_file( $mofile ) ) return false;
 
-       if (isset($l10n[$domain]))
+       if ( isset( $l10n[$domain] ) )
                $mo->merge_with( $l10n[$domain] );
 
        $l10n[$domain] = &$mo;
+       return true;
 }
 
 /**
@@ -345,7 +344,7 @@ function load_default_textdomain() {
 
        $mofile = WP_LANG_DIR . "/$locale.mo";
 
-       load_textdomain('default', $mofile);
+       return load_textdomain('default', $mofile);
 }
 
 /**
@@ -372,7 +371,7 @@ function load_plugin_textdomain($domain, $abs_rel_path = false, $plugin_rel_path
                $path = WP_PLUGIN_DIR;
 
        $mofile = $path . '/'. $domain . '-' . $locale . '.mo';
-       load_textdomain($domain, $mofile);
+       return load_textdomain($domain, $mofile);
 }
 
 /**
@@ -393,7 +392,7 @@ function load_theme_textdomain($domain, $path = false) {
        $path = ( empty( $path ) ) ? get_template_directory() : $path;
 
        $mofile = "$path/$locale.mo";
-       load_textdomain($domain, $mofile);
+       return load_textdomain($domain, $mofile);
 }
 
 /**
@@ -423,6 +422,6 @@ function &get_translations_for_domain( $domain ) {
  * won't suffer from that problem.
  */
 function translate_user_role( $name ) {
-       return before_last_bar( translate_with_gettext_context( $name, 'User role' ) );
+       return translate_with_gettext_context( before_last_bar($name), 'User role' );
 }
 ?>
index fb111376169b57a0e8d79bb0d592350293349f11..471a6468baac86660f1683b080a76b3b5899315d 100644 (file)
@@ -1693,7 +1693,7 @@ function site_url($path = '', $scheme = null) {
        // should the list of allowed schemes be maintained elsewhere?
        $orig_scheme = $scheme;
        if ( !in_array($scheme, array('http', 'https')) ) {
-               if ( ('login_post' == $scheme) && ( force_ssl_login() || force_ssl_admin() ) )
+               if ( ( 'login_post' == $scheme || 'rpc' == $scheme ) && ( force_ssl_login() || force_ssl_admin() ) )
                        $scheme = 'https';
                elseif ( ('login' == $scheme) && ( force_ssl_admin() ) )
                        $scheme = 'https';
index 6074b00f323b1ecbadba86fff7d99256385e43a6..128d2dca756d14df0c3f0892450f30e8b0707303 100644 (file)
@@ -880,17 +880,8 @@ function wp_sanitize_redirect($location) {
        $location = wp_kses_no_null($location);
 
        // remove %0d and %0a from location
-       $strip = array('%0d', '%0a');
-       $found = true;
-       while($found) {
-               $found = false;
-               foreach( (array) $strip as $val ) {
-                       while(strpos($location, $val) !== false) {
-                               $found = true;
-                               $location = str_replace($val, '', $location);
-                       }
-               }
-       }
+       $strip = array('%0d', '%0a', '%0D', '%0A');
+       $location = _deep_replace($strip, $location);
        return $location;
 }
 endif;
@@ -908,8 +899,7 @@ if ( !function_exists('wp_safe_redirect') ) :
  * but only used in a few places.
  *
  * @since 2.3
- * @uses apply_filters() Calls 'allowed_redirect_hosts' on an array containing
- *             WordPress host string and $location host string.
+ * @uses wp_validate_redirect() To validate the redirect is to an allowed host.
  *
  * @return void Does not return anything
  **/
@@ -918,6 +908,31 @@ function wp_safe_redirect($location, $status = 302) {
        // Need to look at the URL the way it will end up in wp_redirect()
        $location = wp_sanitize_redirect($location);
 
+       $location = wp_validate_redirect($location, admin_url());
+
+       wp_redirect($location, $status);
+}
+endif;
+
+if ( !function_exists('wp_validate_redirect') ) :
+/**
+ * Validates a URL for use in a 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.
+ *
+ * If the host is not allowed, then the redirect is to $default supplied
+ *
+ * @since 2.8.1
+ * @uses apply_filters() Calls 'allowed_redirect_hosts' on an array containing
+ *             WordPress host string and $location host string.
+ *
+ * @param string $location The redirect to validate
+ * @param string $default The value to return is $location is not allowed
+ * @return string redirect-sanitized URL
+ **/
+function wp_validate_redirect($location, $default = '') {
        // browsers will assume 'http' is your protocol, and will obey a redirect to a URL starting with '//'
        if ( substr($location, 0, 2) == '//' )
                $location = 'http:' . $location;
@@ -931,9 +946,9 @@ function wp_safe_redirect($location, $status = 302) {
        $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 = admin_url();
+               $location = $default;
 
-       wp_redirect($location, $status);
+       return $location;
 }
 endif;
 
index 0588bc9ac7a9f2ae62f02ff6986f3f5aa4a35aa4..a1c7fcf72bd0cc923b7927f3228205be26db45c6 100644 (file)
@@ -53,7 +53,7 @@
  * @subpackage Plugin
  * @since 0.71
  * @global array $wp_filter Stores all of the filters added in the form of
- *     wp_filter['tag']['array of priorities']['array of functions serialized']['array of ['array (functions, accepted_args)]']
+ *     wp_filter['tag']['array of priorities']['array of functions serialized']['array of ['array (functions, accepted_args)']']
  * @global array $merged_filters Tracks the tags that need to be merged for later. If the hook is added, it doesn't need to run through that process.
  *
  * @param string $tag The name of the filter to hook the $function_to_add to.
@@ -495,6 +495,7 @@ function plugin_basename($file) {
        $mu_plugin_dir = str_replace('\\','/',WPMU_PLUGIN_DIR); // sanitize for Win32 installs
        $mu_plugin_dir = preg_replace('|/+|','/', $mu_plugin_dir); // remove any duplicate slash
        $file = preg_replace('#^' . preg_quote($plugin_dir, '#') . '/|^' . preg_quote($mu_plugin_dir, '#') . '/#','',$file); // get relative path from plugins dir
+       $file = trim($file, '/');
        return $file;
 }
 
index bb146a7d3e09c2551d909f7ac5ab6012d42321c4..feb5b34cf2fa474883e110c9c76b168b30aad1c0 100644 (file)
@@ -2,7 +2,7 @@
 /**
  * Contains Translation_Entry class
  *
- * @version $Id: entry.php 13 2008-04-21 12:03:37Z nbachiyski $
+ * @version $Id: entry.php 115 2009-05-11 18:56:15Z nbachiyski $
  * @package pomo
  * @subpackage entry
  */
@@ -48,9 +48,7 @@ class Translation_Entry {
                // get member variable values from args hash
                $object_varnames = array_keys(get_object_vars($this));
                foreach ($args as $varname => $value) {
-                       if (in_array($varname, $object_varnames)) {
-                               $this->$varname = $value;
-                       }
+                       $this->$varname = $value;
                }
                if (isset($args['plural'])) $this->is_plural = true;
                if (!is_array($this->translations)) $this->translations = array();
index 6055838d1626458a1968e08bf287d5d825afd8d8..0630ef285e21f51e10d2fd53d082b1b088daad02 100644 (file)
@@ -2,7 +2,7 @@
 /**
  * Class for working with MO files
  *
- * @version $Id: mo.php 33 2009-02-16 09:33:39Z nbachiyski $
+ * @version $Id: mo.php 106 2009-04-23 19:48:22Z nbachiyski $
  * @package pomo
  * @subpackage mo
  */
 require_once dirname(__FILE__) . '/translations.php';
 require_once dirname(__FILE__) . '/streams.php';
 
-class MO extends Translations {
+class MO extends Gettext_Translations {
 
        var $_nplurals = 2;
 
-       function set_header($header, $value) {
-               parent::set_header($header, $value);
-               if ('Plural-Forms' == $header)
-                       $this->_gettext_select_plural_form = $this->_make_gettext_select_plural_form($value);
-       }
-
        /**
         * Fills up with the entries from MO file $filename
         *
@@ -32,6 +26,73 @@ class MO extends Translations {
                }
                return $this->import_from_reader($reader);
        }
+       
+       function export_to_file($filename) {
+               $fh = fopen($filename, 'wb');
+               if ( !$fh ) return false;
+               $entries = array_filter($this->entries, create_function('$e', 'return !empty($e->translations);'));
+               ksort($entries);
+               $magic = 0x950412de;
+               $revision = 0;
+               $total = count($entries) + 1; // all the headers are one entry
+               $originals_lenghts_addr = 28;
+               $translations_lenghts_addr = $originals_lenghts_addr + 8 * $total;
+               $size_of_hash = 0;
+               $hash_addr = $translations_lenghts_addr + 8 * $total;
+               $current_addr = $hash_addr;
+               fwrite($fh, pack('V*', $magic, $revision, $total, $originals_lenghts_addr,
+                       $translations_lenghts_addr, $size_of_hash, $hash_addr));
+               fseek($fh, $originals_lenghts_addr);
+               
+               // headers' msgid is an empty string
+               fwrite($fh, pack('VV', 0, $current_addr));
+               $current_addr++;
+               $originals_table = chr(0);
+
+               foreach($entries as $entry) {
+                       $originals_table .= $this->export_original($entry) . chr(0);
+                       $length = strlen($this->export_original($entry));
+                       fwrite($fh, pack('VV', $length, $current_addr));
+                       $current_addr += $length + 1; // account for the NULL byte after
+               }
+               
+               $exported_headers = $this->export_headers();
+               fwrite($fh, pack('VV', strlen($exported_headers), $current_addr));
+               $current_addr += strlen($exported_headers) + 1;
+               $translations_table = $exported_headers . chr(0);
+               
+               foreach($entries as $entry) {
+                       $translations_table .= $this->export_translations($entry) . chr(0);
+                       $length = strlen($this->export_translations($entry));
+                       fwrite($fh, pack('VV', $length, $current_addr));
+                       $current_addr += $length + 1;
+               }
+               
+               fwrite($fh, $originals_table);
+               fwrite($fh, $translations_table);
+               fclose($fh);
+       }
+       
+       function export_original($entry) {
+               //TODO: warnings for control characters
+               $exported = $entry->singular;
+               if ($entry->is_plural) $exported .= chr(0).$entry->plural;
+               if (!is_null($entry->context)) $exported = $entry->context . chr(4) . $exported;
+               return $exported;
+       }
+       
+       function export_translations($entry) {
+               //TODO: warnings for control characters
+               return implode(chr(0), $entry->translations);
+       }
+       
+       function export_headers() {
+               $exported = '';
+               foreach($this->headers as $header => $value) {
+                       $exported.= "$header: $value\n";
+               }
+               return $exported;
+       }
 
        function get_byteorder($magic) {
 
@@ -42,7 +103,7 @@ class MO extends Translations {
                $magic_little_64 = (int) 2500072158;
                // 0xde120495
                $magic_big = ((int) - 569244523) && 0xFFFFFFFF;
-
+               
                if ($magic_little == $magic || $magic_little_64 == $magic) {
                        return 'little';
                } else if ($magic_big == $magic) {
@@ -63,22 +124,22 @@ class MO extends Translations {
                $revision = $reader->readint32();
                $total = $reader->readint32();
                // get addresses of array of lenghts and offsets for original string and translations
-               $originals_lo_addr = $reader->readint32();
-               $translations_lo_addr = $reader->readint32();
+               $originals_lenghts_addr = $reader->readint32();
+               $translations_lenghts_addr = $reader->readint32();
 
-               $reader->seekto($originals_lo_addr);
-               $originals_lo = $reader->readint32array($total * 2); // each of
-               $reader->seekto($translations_lo_addr);
-               $translations_lo = $reader->readint32array($total * 2);
+               $reader->seekto($originals_lenghts_addr);
+               $originals_lenghts = $reader->readint32array($total * 2); // each of 
+               $reader->seekto($translations_lenghts_addr);
+               $translations_lenghts = $reader->readint32array($total * 2);
 
                $length = create_function('$i', 'return $i * 2 + 1;');
                $offset = create_function('$i', 'return $i * 2 + 2;');
 
                for ($i = 0; $i < $total; ++$i) {
-                       $reader->seekto($originals_lo[$offset($i)]);
-                       $original = $reader->read($originals_lo[$length($i)]);
-                       $reader->seekto($translations_lo[$offset($i)]);
-                       $translation = $reader->read($translations_lo[$length($i)]);
+                       $reader->seekto($originals_lenghts[$offset($i)]);
+                       $original = $reader->read($originals_lenghts[$length($i)]);
+                       $reader->seekto($translations_lenghts[$offset($i)]);
+                       $translation = $reader->read($translations_lenghts[$length($i)]);
                        if ('' == $original) {
                                $this->set_headers($this->make_headers($translation));
                        } else {
@@ -88,17 +149,6 @@ class MO extends Translations {
                return true;
        }
 
-       function make_headers($translation) {
-               $headers = array();
-               $lines = explode("\n", $translation);
-               foreach($lines as $line) {
-                       $parts = explode(':', $line, 2);
-                       if (!isset($parts[1])) continue;
-                       $headers[trim($parts[0])] = trim($parts[1]);
-               }
-               return $headers;
-       }
-
        /**
         * @static
         */
index 50520670e523b18d95282e3a3915f48b861c58d3..6c40c5a4eee44ea7e9c9324ee32a4a2ab79d6a20 100644 (file)
@@ -2,7 +2,7 @@
 /**
  * Class for working with PO files
  *
- * @version $Id: po.php 33 2009-02-16 09:33:39Z nbachiyski $
+ * @version $Id: po.php 123 2009-05-13 19:35:43Z nbachiyski $
  * @package pomo
  * @subpackage po
  */
@@ -16,8 +16,8 @@ ini_set('auto_detect_line_endings', 1);
 /**
  * Routines for working with PO files
  */
-class PO extends Translations {
-
+class PO extends Gettext_Translations {
+       
 
        /**
         * Exports headers to a PO entry
@@ -75,7 +75,6 @@ class PO extends Translations {
                return fclose($fh);
        }
 
-
        /**
         * Formats a string in PO-style
         *
@@ -87,31 +86,59 @@ class PO extends Translations {
                $quote = '"';
                $slash = '\\';
                $newline = "\n";
-               $tab = "\t";
 
                $replaces = array(
                        "$slash"        => "$slash$slash",
-                       "$tab"          => '\t',
                        "$quote"        => "$slash$quote",
+                       "\t"            => '\t',
                );
+
                $string = str_replace(array_keys($replaces), array_values($replaces), $string);
 
-               $po = array();
-               foreach (explode($newline, $string) as $line) {
-                       $po[] = wordwrap($line, PO_MAX_LINE_LEN - 2, " $quote$newline$quote");
-               }
-               $po = $quote.implode("${slash}n$quote$newline$quote", $po).$quote;
+               $po = $quote.implode("${slash}n$quote$newline$quote", explode($newline, $string)).$quote;
                // add empty string on first line for readbility
-               if (false !== strpos($po, $newline)) {
+               if (false !== strpos($string, $newline) &&
+                               (substr_count($string, $newline) > 1 || !($newline === substr($string, -strlen($newline))))) {
                        $po = "$quote$quote$newline$po";
                }
                // remove empty strings
                $po = str_replace("$newline$quote$quote", '', $po);
                return $po;
        }
+       
+       /**
+        * Gives back the original string from a PO-formatted string
+        * 
+        * @static
+        * @param string $string PO-formatted string
+        * @return string enascaped string
+        */
+       function unpoify($string) {
+               $escapes = array('t' => "\t", 'n' => "\n", '\\' => '\\');
+               $lines = array_map('trim', explode("\n", $string));
+               $lines = array_map(array('PO', 'trim_quotes'), $lines);
+               $unpoified = '';
+               $previous_is_backslash = false;
+               foreach($lines as $line) {
+                       preg_match_all('/./u', $line, $chars);
+                       $chars = $chars[0];
+                       foreach($chars as $char) {
+                               if (!$previous_is_backslash) {
+                                       if ('\\' == $char)
+                                               $previous_is_backslash = true;
+                                       else
+                                               $unpoified .= $char;
+                               } else {
+                                       $previous_is_backslash = false;
+                                       $unpoified .= isset($escapes[$char])? $escapes[$char] : $char;
+                               }
+                       }
+               }
+               return $unpoified;
+       }
 
        /**
-        * Inserts $with in the beginning of every new line of $string and
+        * Inserts $with in the beginning of every new line of $string and 
         * returns the modified string
         *
         * @static
@@ -157,7 +184,7 @@ class PO extends Translations {
                if (!empty($entry->translator_comments)) $po[] = PO::comment_block($entry->translator_comments);
                if (!empty($entry->extracted_comments)) $po[] = PO::comment_block($entry->extracted_comments, '.');
                if (!empty($entry->references)) $po[] = PO::comment_block(implode(' ', $entry->references), ':');
-               if (!empty($entry->flags)) $po[] = PO::comment_block(implode("\n", $entry->flags), ',');
+               if (!empty($entry->flags)) $po[] = PO::comment_block(implode("", $entry->flags), ',');
                if (!is_null($entry->context)) $po[] = 'msgctxt '.PO::poify($entry->context);
                $po[] = 'msgid '.PO::poify($entry->singular);
                if (!$entry->is_plural) {
@@ -173,5 +200,161 @@ class PO extends Translations {
                return implode("\n", $po);
        }
 
+       function import_from_file($filename) {
+               $f = fopen($filename, 'r');
+               if (!$f) return false;
+               $lineno = 0;
+               while (true) {
+                       $res = $this->read_entry($f, $lineno);
+                       if (!$res) break;
+                       if ($res['entry']->singular == '') {
+                               $this->set_headers($this->make_headers($res['entry']->translations[0]));
+                       } else {
+                               $this->add_entry($res['entry']);
+                       }
+               }
+               PO::read_line($f, 'clear');
+               return $res !== false;
+       }
+       
+       function read_entry($f, $lineno = 0) {
+               $entry = new Translation_Entry();
+               // where were we in the last step
+               // can be: comment, msgctxt, msgid, msgid_plural, msgstr, msgstr_plural
+               $context = '';
+               $msgstr_index = 0;
+               $is_final = create_function('$context', 'return $context == "msgstr" || $context == "msgstr_plural";');
+               while (true) {
+                       $lineno++;
+                       $line = PO::read_line($f);
+                       if (!$line)  {
+                               if (feof($f)) {
+                                       if ($is_final($context))
+                                               break;
+                                       elseif (!$context) // we haven't read a line and eof came
+                                               return null;
+                                       else
+                                               return false;
+                               } else {
+                                       return false;
+                               }
+                       }
+                       if ($line == "\n") continue;
+                       $line = trim($line);
+                       if (preg_match('/^#/', $line, $m)) {
+                               // the comment is the start of a new entry
+                               if ($is_final($context)) {
+                                       PO::read_line($f, 'put-back');
+                                       $lineno--;
+                                       break;
+                               }
+                               // comments have to be at the beginning
+                               if ($context && $context != 'comment') {
+                                       return false;
+                               }
+                               // add comment
+                               $this->add_comment_to_entry($entry, $line);;
+                       } elseif (preg_match('/^msgctxt\s+(".*")/', $line, $m)) {
+                               if ($is_final($context)) {
+                                       PO::read_line($f, 'put-back');
+                                       $lineno--;
+                                       break;
+                               }
+                               if ($context && $context != 'comment') {
+                                       return false;
+                               }
+                               $context = 'msgctxt';
+                               $entry->context .= PO::unpoify($m[1]);
+                       } elseif (preg_match('/^msgid\s+(".*")/', $line, $m)) {
+                               if ($is_final($context)) {
+                                       PO::read_line($f, 'put-back');
+                                       $lineno--;
+                                       break;
+                               }
+                               if ($context && $context != 'msgctxt' && $context != 'comment') {
+                                       return false;
+                               }
+                               $context = 'msgid';
+                               $entry->singular .= PO::unpoify($m[1]);
+                       } elseif (preg_match('/^msgid_plural\s+(".*")/', $line, $m)) {
+                               if ($context != 'msgid') {
+                                       return false;
+                               }
+                               $context = 'msgid_plural';
+                               $entry->is_plural = true;
+                               $entry->plural .= PO::unpoify($m[1]);
+                       } elseif (preg_match('/^msgstr\s+(".*")/', $line, $m)) {
+                               if ($context != 'msgid') {
+                                       return false;
+                               }
+                               $context = 'msgstr';
+                               $entry->translations = array(PO::unpoify($m[1]));
+                       } elseif (preg_match('/^msgstr\[(\d+)\]\s+(".*")/', $line, $m)) {
+                               if ($context != 'msgid_plural' && $context != 'msgstr_plural') {
+                                       return false;
+                               }
+                               $context = 'msgstr_plural';
+                               $msgstr_index = $m[1];
+                               $entry->translations[$m[1]] = PO::unpoify($m[2]);
+                       } elseif (preg_match('/^".*"$/', $line)) {
+                               $unpoified = PO::unpoify($line);
+                               switch ($context) {
+                                       case 'msgid':
+                                               $entry->singular .= $unpoified; break;
+                                       case 'msgctxt':
+                                               $entry->context .= $unpoified; break;
+                                       case 'msgid_plural':
+                                               $entry->plural .= $unpoified; break;
+                                       case 'msgstr':
+                                               $entry->translations[0] .= $unpoified; break;
+                                       case 'msgstr_plural':
+                                               $entry->translations[$msgstr_index] .= $unpoified; break;
+                                       default:
+                                               return false;
+                               }
+                       } else {
+                               return false;
+                       }
+               }
+               if (array() == array_filter($entry->translations)) $entry->translations = array();
+               return array('entry' => $entry, 'lineno' => $lineno);
+       }
+       
+       function read_line($f, $action = 'read') {
+               static $last_line = '';
+               static $use_last_line = false;
+               if ('clear' == $action) {
+                       $last_line = '';
+                       return true;
+               }
+               if ('put-back' == $action) {
+                       $use_last_line = true;
+                       return true;
+               }
+               $line = $use_last_line? $last_line : fgets($f);
+               $last_line = $line;
+               $use_last_line = false;
+               return $line;
+       }
+       
+       function add_comment_to_entry(&$entry, $po_comment_line) {
+               $first_two = substr($po_comment_line, 0, 2);
+               $comment = trim(substr($po_comment_line, 2));
+               if ('#:' == $first_two) {
+                       $entry->references = array_merge($entry->references, preg_split('/\s+/', $comment));
+               } elseif ('#.' == $first_two) {
+                       $entry->extracted_comments = trim($entry->extracted_comments . "\n" . $comment);
+               } elseif ('#,' == $first_two) {
+                       $entry->flags = array_merge($entry->flags, preg_split('/,\s*/', $comment));
+               } else {
+                       $entry->translator_comments = trim($entry->translator_comments . "\n" . $comment);
+               }
+       }
+       
+       function trim_quotes($s) {
+               if ( substr($s, 0, 1) == '"') $s = substr($s, 1);
+               if ( substr($s, -1, 1) == '"') $s = substr($s, 0, -1);
+               return $s;
+       }
 }
 ?>
index 3b0241af4c45ad78744ced59f2aa335a69a5096d..6710746e8fbeb1f76507e5f36136ee97b2b0bb03 100644 (file)
@@ -3,7 +3,7 @@
  * Classes, which help reading streams of data from files.
  * Based on the classes from Danilo Segan <danilo@kvota.net>
  *
- * @version $Id: streams.php 33 2009-02-16 09:33:39Z nbachiyski $
+ * @version $Id: streams.php 138 2009-06-23 13:22:09Z nbachiyski $
  * @package pomo
  * @subpackage streams
  */
@@ -17,34 +17,48 @@ class POMO_StringReader {
   var $_pos;
   var $_str;
 
-  function POMO_StringReader($str = '') {
-    $this->_str = $str;
-    $this->_pos = 0;
-  }
+       function POMO_StringReader($str = '') {
+               $this->_str = $str;
+               $this->_pos = 0;
+               $this->is_overloaded = ((ini_get("mbstring.func_overload") & 2) != 0) && function_exists('mb_substr');
+       }
 
-  function read($bytes) {
-    $data = substr($this->_str, $this->_pos, $bytes);
-    $this->_pos += $bytes;
-    if (strlen($this->_str)<$this->_pos)
-      $this->_pos = strlen($this->_str);
+       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);
+               }
+       }
 
-    return $data;
-  }
+       function read($bytes) {
+               $data = $this->_substr($this->_str, $this->_pos, $bytes);
+               $this->_pos += $bytes;
+               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);
-    return $this->_pos;
-  }
+       function seekto($pos) {
+               $this->_pos = $pos;
+               if ($this->_strlen($this->_str) < $this->_pos) $this->_pos = $this->_strlen($this->_str);
+               return $this->_pos;
+       }
 
-  function pos() {
-    return $this->_pos;
-  }
+       function pos() {
+               return $this->_pos;
+       }
 
-  function length() {
-    return strlen($this->_str);
-  }
+       function length() {
+               return $this->_strlen($this->_str);
+       }
 
 }
 
@@ -53,10 +67,11 @@ class POMO_StringReader {
  */
 class POMO_CachedFileReader extends POMO_StringReader {
        function POMO_CachedFileReader($filename) {
+               parent::POMO_StringReader();
                $this->_str = file_get_contents($filename);
                if (false === $this->_str)
                        return false;
-               $this->pos = 0;
+               $this->_pos = 0;
        }
 }
 
@@ -96,7 +111,7 @@ class POMO_CachedIntFileReader extends POMO_CachedFileReader {
         */
        function readint32() {
                $bytes = $this->read(4);
-               if (4 != strlen($bytes))
+               if (4 != $this->_strlen($bytes))
                        return false;
                $endian_letter = ('big' == $this->endian)? 'N' : 'V';
                $int = unpack($endian_letter, $bytes);
@@ -112,7 +127,7 @@ class POMO_CachedIntFileReader extends POMO_CachedFileReader {
         */
        function readint32array($count) {
                $bytes = $this->read(4 * $count);
-               if (4*$count != strlen($bytes))
+               if (4*$count != $this->_strlen($bytes))
                        return false;
                $endian_letter = ('big' == $this->endian)? 'N' : 'V';
                return unpack($endian_letter.$count, $bytes);
index 0d73ee978ccebecf1e7db38aa358b8dd377e7180..a05ae6ceb2016110f932f57d06e09e61469625ff 100644 (file)
@@ -2,7 +2,7 @@
 /**
  * Class for a set of entries for translation and their associated headers
  *
- * @version $Id: translations.php 35 2009-02-16 12:54:57Z nbachiyski $
+ * @version $Id: translations.php 114 2009-05-11 17:30:38Z nbachiyski $
  * @package pomo
  * @subpackage translations
  */
@@ -19,10 +19,13 @@ class Translations {
         * @param object &$entry
         * @return bool true on success, false if the entry doesn't have a key
         */
-       function add_entry(&$entry) {
+       function add_entry($entry) {
+               if (is_array($entry)) {
+                       $entry = new Translation_Entry($entry);
+               }
                $key = $entry->key();
                if (false === $key) return false;
-               $this->entries[$key] = &$entry;
+               $this->entries[$key] = $entry;
                return true;
        }
 
@@ -87,12 +90,24 @@ class Translations {
                $total_plural_forms = $this->get_plural_forms_count();
                if ($translated && 0 <= $index && $index < $total_plural_forms &&
                                is_array($translated->translations) &&
-                               count($translated->translations) == $total_plural_forms)
+                               isset($translated->translations[$index]))
                        return $translated->translations[$index];
                else
                        return 1 == $count? $singular : $plural;
        }
 
+       /**
+        * Merge $other in the current object.
+        *
+        * @param Object &$other Another Translation object, whose translations will be merged in this one
+        * @return void
+        **/
+       function merge_with(&$other) {
+               $this->entries = array_merge($this->entries, $other->entries);
+       }
+}
+
+class Gettext_Translations extends Translations {
        /**
         * The gettext implmentation of select_plural_form.
         *
@@ -130,7 +145,7 @@ class Translations {
        /**
         * Adds parantheses to the inner parts of ternary operators in
         * plural expressions, because PHP evaluates ternary oerators from left to right
-        *
+        * 
         * @param string $expression the expression without parentheses
         * @return string the expression with parentheses added
         */
@@ -158,16 +173,27 @@ class Translations {
                }
                return rtrim($res, ';');
        }
+       
+       function make_headers($translation) {
+               $headers = array();
+               // sometimes \ns are used instead of real new lines
+               $translation = str_replace('\n', "\n", $translation);
+               $lines = explode("\n", $translation);
+               foreach($lines as $line) {
+                       $parts = explode(':', $line, 2);
+                       if (!isset($parts[1])) continue;
+                       $headers[trim($parts[0])] = trim($parts[1]);
+               }
+               return $headers;
+       }
 
-       /**
-        * Merge $other in the current object.
-        *
-        * @param Object &$other Another Translation object, whose translations will be merged in this one
-        * @return void
-        **/
-       function merge_with(&$other) {
-               $this->entries = array_merge($this->entries, $other->entries);
+       function set_header($header, $value) {
+               parent::set_header($header, $value);
+               if ('Plural-Forms' == $header)
+                       $this->_gettext_select_plural_form = $this->_make_gettext_select_plural_form($value);
        }
+
+       
 }
 
 ?>
index 30856c58465027aef2fdbf9e4d7549a06a6b686f..35a7caa9fbdd650f6408ff79c2c4d1bfd5100832 100644 (file)
@@ -430,13 +430,14 @@ function get_body_class( $class = '' ) {
                if ( $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' LIMIT 1", $pageID) ) )
                        $classes[] = 'page-parent';
 
-               if ( $wp_query->post->post_parent )
+               if ( $wp_query->post->post_parent ) {
                        $classes[] = 'page-child';
                        $classes[] = 'parent-pageid-' . $wp_query->post->post_parent;
-
-               if ( is_page_template() )
+               }
+               if ( is_page_template() ) {
                        $classes[] = 'page-template';
                        $classes[] = 'page-template-' . str_replace( '.php', '-php', get_post_meta( $pageID, '_wp_page_template', true ) );
+               }
        } elseif ( is_search() ) {
                if ( !empty($wp_query->posts) )
                        $classes[] = 'search-results';
@@ -805,7 +806,7 @@ function wp_list_pages($args = '') {
  * @param array|string $args
  */
 function wp_page_menu( $args = array() ) {
-       $defaults = array('sort_column' => 'post_title', 'menu_class' => 'menu', 'echo' => true, 'link_before' => '', 'link_after' => '');
+       $defaults = array('sort_column' => 'menu_order, post_title', 'menu_class' => 'menu', 'echo' => true, 'link_before' => '', 'link_after' => '');
        $args = wp_parse_args( $args, $defaults );
        $args = apply_filters( 'wp_page_menu_args', $args );
 
index 407b33c576970ed2d02a05beab297f236f42c585..0c0ba46d6d045a8bc157be02b174ee538f1af6d7 100644 (file)
@@ -1192,7 +1192,7 @@ function wp_delete_post($postid = 0) {
                foreach ( (array) $children as $child )
                        clean_page_cache($child->ID);
 
-               $wp_rewrite->flush_rules();
+               $wp_rewrite->flush_rules(false);
        } else {
                clean_post_cache($postid);
        }
@@ -3354,7 +3354,7 @@ function _save_post_hook($post_id, $post) {
                // Avoid flushing rules for every post during import.
                if ( !defined('WP_IMPORTING') ) {
                        global $wp_rewrite;
-                       $wp_rewrite->flush_rules();
+                       $wp_rewrite->flush_rules(false);
                }
        } else {
                clean_post_cache($post_id);
index 663133ffb05bb134ac8ecb005945078224f9ce50..c9f96558765dae4fdae38bd7407b01fb712c8014 100644 (file)
@@ -1234,6 +1234,7 @@ class WP_Query {
                $qv['day'] = absint($qv['day']);
                $qv['w'] = absint($qv['w']);
                $qv['m'] = absint($qv['m']);
+               $qv['paged'] = absint($qv['paged']);
                $qv['cat'] = preg_replace( '|[^0-9,-]|', '', $qv['cat'] ); // comma separated list of positive or negative integers
                $qv['pagename'] = trim( $qv['pagename'] );
                $qv['name'] = trim( $qv['name'] );
index c84b5205ed3cf7f76cf60ab93ad643e35e8f7844..3486c4a5b464be5d95bd8f0fc8bcc9084ce7abbc 100644 (file)
@@ -1822,13 +1822,14 @@ class WP_Rewrite {
         *
         * @since 2.0.1
         * @access public
+        * @param $hard bool Whether to update .htaccess (hard flush) or just update rewrite_rules transient (soft flush). Default is true (hard).
         */
-       function flush_rules() {
+       function flush_rules($hard = true) {
                delete_transient('rewrite_rules');
                $this->wp_rewrite_rules();
-               if ( function_exists('save_mod_rewrite_rules') )
+               if ( $hard && function_exists('save_mod_rewrite_rules') )
                        save_mod_rewrite_rules();
-               if ( function_exists('iis7_save_url_rewrite_rules') )
+               if ( $hard && function_exists('iis7_save_url_rewrite_rules') )
                        iis7_save_url_rewrite_rules();
        }
 
index 62256dfef7856de9eeede77798e37f042ea0a3a2..f3f6bf2b3130851ff38576e7964bfa0df4761301 100644 (file)
@@ -240,7 +240,7 @@ function wp_default_scripts( &$scripts ) {
                $scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array('jquery'), '20090514' );
                $scripts->add_data( 'user-profile', 'group', 1 );
 
-               $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20090209' );
+               $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20090627' );
                $scripts->add_data( 'admin-comments', 'group', 1 );
                $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
                        'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
@@ -249,7 +249,7 @@ function wp_default_scripts( &$scripts ) {
 
                $scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", false, '3517m' );
 
-               $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20090327' );
+               $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20090618' );
                $scripts->add_data( 'postbox', 'group', 1 );
                $scripts->localize( 'postbox', 'postboxL10n', array(
                        'requestFile' => admin_url('admin-ajax.php')
@@ -264,7 +264,7 @@ function wp_default_scripts( &$scripts ) {
                        'l10n_print_after' => 'try{convertEntities(slugL10n);}catch(e){};'
                ) );
 
-               $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox', 'slug'), '20090526' );
+               $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox', 'slug'), '20090624' );
                $scripts->add_data( 'post', 'group', 1 );
                $scripts->localize( 'post', 'postL10n', array(
                        'tagsUsed' =>  __('Tags used on this post:'),
@@ -377,7 +377,7 @@ function wp_default_scripts( &$scripts ) {
 
                $scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array('jquery'), '1.2' );
 
-               $scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox' ), '20090201' );
+               $scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox' ), '20090618' );
                $scripts->add_data( 'dashboard', 'group', 1 );
 
                $scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array('jquery'), '20090102' );
@@ -421,12 +421,12 @@ function wp_default_styles( &$styles ) {
        $rtl_styles = array( 'global', 'colors', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'plugin-install', 'farbtastic' );
 
        // all colors stylesheets need to have the same query strings (cache manifest compat)
-       $colors_version = '20090610';
+       $colors_version = '20090625';
 
-       $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20090610' );
+       $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20090625' );
        $styles->add_data( 'wp-admin', 'rtl', '/wp-admin/rtl.css' );
 
-       $styles->add( 'ie', '/wp-admin/css/ie.css', array(), '20090514' );
+       $styles->add( 'ie', '/wp-admin/css/ie.css', array(), '20090630' );
        $styles->add_data( 'ie', 'conditional', 'lte IE 7' );
 
        // Register "meta" stylesheet for admin colors. All colors-* style sheets should have the same version string.
@@ -438,12 +438,12 @@ function wp_default_styles( &$styles ) {
        $styles->add( 'colors-classic', '/wp-admin/css/colors-classic.css', array(), $colors_version);
        $styles->add_data( 'colors-classic', 'rtl', true );
 
-       $styles->add( 'global', '/wp-admin/css/global.css', array(), '20090514' );
+       $styles->add( 'global', '/wp-admin/css/global.css', array(), '20090630' );
        $styles->add( 'media', '/wp-admin/css/media.css', array(), '20090516' );
        $styles->add( 'widgets', '/wp-admin/css/widgets.css', array(), '20090603' );
        $styles->add( 'dashboard', '/wp-admin/css/dashboard.css', array(), '20090514' );
        $styles->add( 'install', '/wp-admin/css/install.css', array(), '20090514' );
-       $styles->add( 'theme-editor', '/wp-admin/css/theme-editor.css', array(), '20090514' );
+       $styles->add( 'theme-editor', '/wp-admin/css/theme-editor.css', array(), '20090625' );
        $styles->add( 'press-this', '/wp-admin/css/press-this.css', array(), '20090514' );
        $styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array(), '20090514' );
        $styles->add( 'login', '/wp-admin/css/login.css', array(), '20090514' );
index 756565b1d3f71fec7575e70a50195c4eac7d98a1..141cecfe2b8bcdc57a215f9695231b0497ef7479 100644 (file)
@@ -115,7 +115,7 @@ function wp_update_plugins() {
 
        $new_option = new stdClass;
        $new_option->last_checked = time();
-       $timeout = 'load-plugins.php' == current_filter() ? 360 : 43200; //Check for updated every 60 minutes if hitting the themes page, Else, check every 12 hours
+       $timeout = 'load-plugins.php' == current_filter() ? 3600 : 43200; //Check for updated every 60 minutes if hitting the themes page, Else, check every 12 hours
        $time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked );
 
        $plugin_changed = false;
@@ -198,7 +198,7 @@ function wp_update_themes( ) {
 
        $new_option = new stdClass;
        $new_option->last_checked = time( );
-       $timeout = 'load-themes.php' == current_filter() ? 360 : 43200; //Check for updated every 60 minutes if hitting the themes page, Else, check every 12 hours
+       $timeout = 'load-themes.php' == current_filter() ? 3600 : 43200; //Check for updated every 60 minutes if hitting the themes page, Else, check every 12 hours
        $time_not_changed = isset( $current_theme->last_checked ) && $timeout > ( time( ) - $current_theme->last_checked );
 
        if( $time_not_changed )
index dde44fbdca5243713896f2846f2dfb4c891b0c0f..bef1aba5cc95c26e1f40fdbd0a02f7de35dfb8cd 100644 (file)
@@ -8,7 +8,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '2.8';
+$wp_version = '2.8.2';
 
 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
@@ -29,4 +29,4 @@ $tinymce_version = '3241-1141';
  *
  * @global string $manifest_version
  */
-$manifest_version = '20090610';
+$manifest_version = '20090616';
index dadca24f52d4625a8f017436ceb32b853b8a83f9..2f0280d7ad1ce0165eefe62b92b03872fb7aca19 100644 (file)
@@ -885,7 +885,7 @@ function dynamic_sidebar($index = 1) {
 function is_active_widget($callback = false, $widget_id = false, $id_base = false, $skip_inactive = true) {
        global $wp_registered_widgets;
 
-       $sidebars_widgets = wp_get_sidebars_widgets(false);
+       $sidebars_widgets = wp_get_sidebars_widgets();
 
        if ( is_array($sidebars_widgets) ) {
                foreach ( $sidebars_widgets as $sidebar => $widgets ) {
@@ -935,7 +935,7 @@ function is_dynamic_sidebar() {
  */
 function is_active_sidebar( $index ) {
        $index = ( is_int($index) ) ? "sidebar-$index" : sanitize_title($index);
-       $sidebars_widgets = get_option( 'sidebars_widgets', array() );
+       $sidebars_widgets = wp_get_sidebars_widgets();
        if ( isset($sidebars_widgets[$index]) && !empty($sidebars_widgets[$index]) )
                return true;
 
@@ -953,89 +953,93 @@ function is_active_sidebar( $index ) {
  * @since 2.2.0
  * @access private
  *
- * @param bool $update Optional, default is true. Whether to save upgrade of widget array list.
- * @return array Upgraded list of widgets to version 2 array format.
+ * @param bool $update Optional, deprecated.
+ * @return array Upgraded list of widgets to version 3 array format when called from the admin.
  */
-function wp_get_sidebars_widgets($update = true) {
+function wp_get_sidebars_widgets($deprecated = true) {
        global $wp_registered_widgets, $wp_registered_sidebars, $_wp_sidebars_widgets;
 
        // If loading from front page, consult $_wp_sidebars_widgets rather than options
        // to see if wp_convert_widget_settings() has made manipulations in memory.
-       if ( is_admin() ) {
-               $sidebars_widgets = get_option('sidebars_widgets', array());
-       } else {
+       if ( !is_admin() ) {
                if ( empty($_wp_sidebars_widgets) )
-                       $sidebars_widgets = get_option('sidebars_widgets', array());
-               else
-                       $sidebars_widgets = &$_wp_sidebars_widgets;
-       }
-       $_sidebars_widgets = array();
-
-       if ( !isset($sidebars_widgets['array_version']) )
-               $sidebars_widgets['array_version'] = 1;
-
-       switch ( $sidebars_widgets['array_version'] ) {
-               case 1 :
-                       foreach ( (array) $sidebars_widgets as $index => $sidebar )
-                       if ( is_array($sidebar) )
-                       foreach ( (array) $sidebar as $i => $name ) {
-                               $id = strtolower($name);
-                               if ( isset($wp_registered_widgets[$id]) ) {
-                                       $_sidebars_widgets[$index][$i] = $id;
-                                       continue;
-                               }
-                               $id = sanitize_title($name);
-                               if ( isset($wp_registered_widgets[$id]) ) {
-                                       $_sidebars_widgets[$index][$i] = $id;
-                                       continue;
-                               }
+                       $_wp_sidebars_widgets = get_option('sidebars_widgets', array());
 
-                               $found = false;
-
-                               foreach ( $wp_registered_widgets as $widget_id => $widget ) {
-                                       if ( strtolower($widget['name']) == strtolower($name) ) {
-                                               $_sidebars_widgets[$index][$i] = $widget['id'];
-                                               $found = true;
-                                               break;
-                                       } elseif ( sanitize_title($widget['name']) == sanitize_title($name) ) {
-                                               $_sidebars_widgets[$index][$i] = $widget['id'];
-                                               $found = true;
-                                               break;
+               $sidebars_widgets = $_wp_sidebars_widgets;
+       } else {
+               $sidebars_widgets = get_option('sidebars_widgets', array());
+               $_sidebars_widgets = array();
+
+               if ( isset($sidebars_widgets['wp_inactive_widgets']) )
+                       $sidebars_widgets['array_version'] = 3;
+               elseif ( !isset($sidebars_widgets['array_version']) )
+                       $sidebars_widgets['array_version'] = 1;
+
+               switch ( $sidebars_widgets['array_version'] ) {
+                       case 1 :
+                               foreach ( (array) $sidebars_widgets as $index => $sidebar )
+                               if ( is_array($sidebar) )
+                               foreach ( (array) $sidebar as $i => $name ) {
+                                       $id = strtolower($name);
+                                       if ( isset($wp_registered_widgets[$id]) ) {
+                                               $_sidebars_widgets[$index][$i] = $id;
+                                               continue;
+                                       }
+                                       $id = sanitize_title($name);
+                                       if ( isset($wp_registered_widgets[$id]) ) {
+                                               $_sidebars_widgets[$index][$i] = $id;
+                                               continue;
                                        }
-                               }
-
-                               if ( $found )
-                                       continue;
 
-                               unset($_sidebars_widgets[$index][$i]);
-                       }
-                       $_sidebars_widgets['array_version'] = 2;
-                       $sidebars_widgets = $_sidebars_widgets;
-                       unset($_sidebars_widgets);
-
-               case 2 :
-                       $sidebars = array_keys( $wp_registered_sidebars );
-                       if ( !empty( $sidebars ) ) {
-                               // Move the known-good ones first
-                               foreach ( (array) $sidebars as $id ) {
-                                       if ( array_key_exists( $id, $sidebars_widgets ) ) {
-                                               $_sidebars_widgets[$id] = $sidebars_widgets[$id];
-                                               unset($sidebars_widgets[$id], $sidebars[$id]);
+                                       $found = false;
+
+                                       foreach ( $wp_registered_widgets as $widget_id => $widget ) {
+                                               if ( strtolower($widget['name']) == strtolower($name) ) {
+                                                       $_sidebars_widgets[$index][$i] = $widget['id'];
+                                                       $found = true;
+                                                       break;
+                                               } elseif ( sanitize_title($widget['name']) == sanitize_title($name) ) {
+                                                       $_sidebars_widgets[$index][$i] = $widget['id'];
+                                                       $found = true;
+                                                       break;
+                                               }
                                        }
-                               }
 
-                               // Assign to each unmatched registered sidebar the first available orphan
-                               unset( $sidebars_widgets[ 'array_version' ] );
-                               while ( ( $sidebar = array_shift( $sidebars ) ) && $widgets = array_shift( $sidebars_widgets ) )
-                                       $_sidebars_widgets[ $sidebar ] = $widgets;
+                                       if ( $found )
+                                               continue;
 
-                               $_sidebars_widgets['array_version'] = 3;
+                                       unset($_sidebars_widgets[$index][$i]);
+                               }
+                               $_sidebars_widgets['array_version'] = 2;
                                $sidebars_widgets = $_sidebars_widgets;
                                unset($_sidebars_widgets);
-                       }
 
-                       if ( $update && is_admin() )
-                               update_option('sidebars_widgets', $sidebars_widgets);
+                       case 2 :
+                               $sidebars = array_keys( $wp_registered_sidebars );
+                               if ( !empty( $sidebars ) ) {
+                                       // Move the known-good ones first
+                                       foreach ( (array) $sidebars as $id ) {
+                                               if ( array_key_exists( $id, $sidebars_widgets ) ) {
+                                                       $_sidebars_widgets[$id] = $sidebars_widgets[$id];
+                                                       unset($sidebars_widgets[$id], $sidebars[$id]);
+                                               }
+                                       }
+
+                                       // move the rest to wp_inactive_widgets
+                                       if ( !isset($_sidebars_widgets['wp_inactive_widgets']) )
+                                               $_sidebars_widgets['wp_inactive_widgets'] = array();
+
+                                       if ( !empty($sidebars_widgets) ) {
+                                               foreach ( $sidebars_widgets as $lost => $val ) {
+                                                       if ( is_array($val) )
+                                                               $_sidebars_widgets['wp_inactive_widgets'] = array_merge( (array) $_sidebars_widgets['wp_inactive_widgets'], $val );
+                                               }
+                                       }
+
+                                       $sidebars_widgets = $_sidebars_widgets;
+                                       unset($_sidebars_widgets);
+                               }
+               }
        }
 
        if ( isset($sidebars_widgets['array_version']) )
@@ -1086,9 +1090,8 @@ function wp_get_widget_defaults() {
  * @return array
  */
 function wp_convert_widget_settings($base_name, $option_name, $settings) {
-       global $_wp_sidebars_widgets;
        // This test may need expanding.
-       $single = false;
+       $single = $changed = false;
        if ( empty($settings) ) {
                $single = true;
        } else {
@@ -1110,7 +1113,7 @@ function wp_convert_widget_settings($base_name, $option_name, $settings) {
                        $sidebars_widgets = get_option('sidebars_widgets');
                } else {
                        if ( empty($GLOBALS['_wp_sidebars_widgets']) )
-                               $GLOBALS['_wp_sidebars_widgets'] = get_option('sidebars_widgets');
+                               $GLOBALS['_wp_sidebars_widgets'] = get_option('sidebars_widgets', array());
                        $sidebars_widgets = &$GLOBALS['_wp_sidebars_widgets'];
                }
 
@@ -1119,13 +1122,14 @@ function wp_convert_widget_settings($base_name, $option_name, $settings) {
                                foreach ( $sidebar as $i => $name ) {
                                        if ( $base_name == $name ) {
                                                $sidebars_widgets[$index][$i] = "$name-2";
+                                               $changed = true;
                                                break 2;
                                        }
                                }
                        }
                }
 
-               if ( is_admin() )
+               if ( is_admin() && $changed )
                        update_option('sidebars_widgets', $sidebars_widgets);
        }
 
index 807703f52b672f621b95a8512da47e5e3ade47c6..af78449d0d78520b7df4ab12df3c98f4f0535ae3 100644 (file)
@@ -60,8 +60,8 @@ $_REQUEST = array_merge($_GET, $_POST);
 if ( ! isset($blog_id) )
        $blog_id = 1;
 
-// Fix for IIS, which doesn't set REQUEST_URI
-if ( empty( $_SERVER['REQUEST_URI'] ) ) {
+// Fix for IIS when running with PHP ISAPI
+if ( empty( $_SERVER['REQUEST_URI'] ) || ( php_sapi_name() != 'cgi-fcgi' && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) ) ) {
 
        // IIS Mod-Rewrite
        if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) {
@@ -316,6 +316,7 @@ if ( !is_blog_installed() && (strpos($_SERVER['PHP_SELF'], 'install.php') === fa
                $link = preg_replace('|/[^/]+?$|', '/', $_SERVER['PHP_SELF']) . 'wp-admin/install.php';
        require_once(ABSPATH . WPINC . '/kses.php');
        require_once(ABSPATH . WPINC . '/pluggable.php');
+       require_once(ABSPATH . WPINC . '/formatting.php');
        wp_redirect($link);
        die(); // have to die here ~ Mark
 }
@@ -528,6 +529,10 @@ if ( !defined( 'AUTOSAVE_INTERVAL' ) )
 
 require (ABSPATH . WPINC . '/vars.php');
 
+// make taxonomies available to plugins and themes
+// @plugin authors: warning: this gets registered again on the init hook
+create_initial_taxonomies();
+
 // Check for hacks file if the option is enabled
 if ( get_option('hack_file') ) {
        if ( file_exists(ABSPATH . 'my-hacks.php') )
index 55279426cb1c76dca5d8cd583856541dc7020aea..e8d8a2e8357e0f6afed587789fd51c0594fd38b4 100644 (file)
@@ -39,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 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') ) ?>" />
+      <api name="WordPress" blogID="1" preferred="true" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
+      <api name="Movable Type" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
+      <api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
+      <api name="Blogger" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
+      <api name="Atom" blogID="" preferred="false" apiLink="<?php echo apply_filters('atom_service_url', site_url('wp-app.php/service', 'rpc') ) ?>" />
     </apis>
   </service>
 </rsd>
@@ -2574,6 +2574,13 @@ class wp_xmlrpc_server extends IXR_Server {
                        $post_date = mysql2date('Ymd\TH:i:s', $postdata['post_date'], false);
                        $post_date_gmt = mysql2date('Ymd\TH:i:s', $postdata['post_date_gmt'], false);
 
+                       // For drafts use the GMT version of the post date
+                       if ( $postdata['post_status'] == 'draft' ) {
+                               $post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $postdata['post_date'] ) );
+                               $post_date_gmt = preg_replace( '|\-|', '', $post_date_gmt );
+                               $post_date_gmt = preg_replace( '| |', 'T', $post_date_gmt );
+                       }
+
                        $categories = array();
                        $catids = wp_get_post_categories($post_ID);
                        foreach($catids as $catid)
@@ -3293,7 +3300,7 @@ class wp_xmlrpc_server extends IXR_Server {
 
                $p = explode( "\n\n", $linea );
 
-               $preg_target = preg_quote($pagelinkedto);
+               $preg_target = preg_quote($pagelinkedto, '|');
 
                foreach ( $p as $para ) {
                        if ( strpos($para, $pagelinkedto) !== false ) { // it exists, but is it a link?
@@ -3315,7 +3322,7 @@ class wp_xmlrpc_server extends IXR_Server {
                                $excerpt= str_replace($context[0], $marker, $excerpt); // swap out the link for our marker
                                $excerpt = strip_tags($excerpt, '<wpcontext>');        // strip all tags but our context marker
                                $excerpt = trim($excerpt);
-                               $preg_marker = preg_quote($marker);
+                               $preg_marker = preg_quote($marker, '|');
                                $excerpt = preg_replace("|.*?\s(.{0,100}$preg_marker.{0,100})\s.*|s", '$1', $excerpt);
                                $excerpt = strip_tags($excerpt); // YES, again, to remove the marker wrapper
                                break;