WordPress.org

Make WordPress Core


Ignore:
Location:
branches/2.8
Files:
72 edited

Legend:

Unmodified
Added
Removed
  • branches/2.8/readme.html

    r11553 r11698  
    99<h1 id="logo" style="text-align: center">
    1010    <img alt="WordPress" src="wp-admin/images/wordpress-logo.png" />
    11     <br /> Version 2.8
     11    <br /> Version 2.8.1
    1212</h1>
    1313<p style="text-align: center">Semantic Personal Publishing Platform</p>
     
    3030<h1>Upgrading</h1>
    3131<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>
    32 <h2>Upgrading from any previous WordPress to 2.8:</h2>
     32<h2>Upgrading from any previous WordPress to 2.8.1:</h2>
    3333<ol>
    3434    <li>Delete your old WP files, saving ones you've modified.</li>
  • branches/2.8/wp-admin/admin-ajax.php

    r11553 r11698  
    603603        die('-1');
    604604    $search = isset($_POST['s']) ? $_POST['s'] : false;
    605     $start = isset($_POST['page']) ? intval($_POST['page']) * 25 - 1: 24;
    606     $status = isset($_POST['comment_status']) ? $_POST['comment_status'] : false;
     605    $status = isset($_POST['comment_status']) ? $_POST['comment_status'] : 'all';
     606    $per_page = isset($_POST['per_page']) ?  (int) $_POST['per_page'] + 8 : 28;
     607    $start = isset($_POST['page']) ? ( intval($_POST['page']) * $per_page ) -1 : $per_page - 1;
     608    if ( 1 > $start )
     609        $start = 27;
     610
    607611    $mode = isset($_POST['mode']) ? $_POST['mode'] : 'detail';
    608612    $p = isset($_POST['p']) ? $_POST['p'] : 0;
     
    815819        if ( !current_user_can( 'edit_post', $meta->post_id ) )
    816820            die('-1');
    817         if ( !$u = update_meta( $mid, $key, $value ) )
    818             die('0'); // We know meta exists; we also know it's unchanged (or DB error, in which case there are bigger problems).
     821        if ( $meta->meta_value != stripslashes($value) ) {
     822            if ( !$u = update_meta( $mid, $key, $value ) )
     823                die('0'); // We know meta exists; we also know it's unchanged (or DB error, in which case there are bigger problems).
     824        }
    819825
    820826        $key = stripslashes($key);
  • branches/2.8/wp-admin/admin.php

    r11553 r11698  
    147147    // Make sure rules are flushed
    148148    global $wp_rewrite;
    149     $wp_rewrite->flush_rules();
     149    $wp_rewrite->flush_rules(false);
    150150
    151151    exit();
  • branches/2.8/wp-admin/css/colors-classic.css

    r11553 r11698  
    268268}
    269269
    270 .side-info h5, .bordertitle {
     270.side-info h5 {
    271271    border-bottom-color: #dadada;
    272272}
  • branches/2.8/wp-admin/css/colors-fresh.css

    r11553 r11698  
    268268}
    269269
    270 .side-info h5, .bordertitle {
     270.side-info h5 {
    271271    border-bottom-color: #dadada;
    272272}
  • branches/2.8/wp-admin/css/global.css

    r11553 r11698  
    376376    border-width: 1px;
    377377    border-style: solid;
    378     border-collapse: separate;
    379378    border-spacing: 0;
    380379    width: 100%;
  • branches/2.8/wp-admin/css/ie.css

    r11553 r11698  
    247247#col-container,
    248248#col-left,
    249 #col-right {
     249#col-right,
     250.fileedit-sub {
    250251    display: block;
    251252    zoom: 100%;
     
    338339}
    339340
     341.widefat {
     342    empty-cells: show;
     343    border-collapse: collapse;
     344}
     345
    340346.tablenav a.button-secondary {
    341347    display: inline-block;
  • branches/2.8/wp-admin/css/theme-editor-rtl.css

    r11553 r11698  
    22    float: left;
    33}
    4 #themeselector {
    5     padding-right: 0;
    6     padding-left: 5px;
    7     float: left;
    8 }
    9 div.tablenav {
    10     margin-right: 0;
    11     margin-left: 210px;
    12 }
  • branches/2.8/wp-admin/css/theme-editor.css

    r11553 r11698  
    1212    float: right;
    1313    width: 190px;
     14    word-wrap: break-word;
    1415}
    1516
    16 #templateside h3, #postcustomstuff p.submit {
     17#templateside h3,
     18#postcustomstuff p.submit {
    1719    margin: 0;
    1820}
    1921
    20 h3#bordertitle {
    21     margin-bottom: 10px;
     22#templateside h4 {
     23    margin: 1em 0 0;
    2224}
    2325
    24 #templateside h4 {
    25     margin-bottom: 0;
    26 }
    27 
    28 #templateside ol, #templateside ul {
    29     list-style: none;
     26#templateside ol,
     27#templateside ul {
    3028    margin: .5em;
    3129    padding: 0;
    3230}
    3331
    34 #templateside ol li, #templateside ul li {
    35     margin: 1px 0;
    36 }
    37 
    38 #themeselector {
    39     padding-right: 5px;
    40     float: right;
    41     position: relative;
    42     bottom: 25px;
    43     top:20px;
    44 }
    45 
    46 #themeselector select {
    47     margin: 0;
    48     padding: 0;
     32#templateside li {
     33    margin: 4px 0;
    4934}
    5035
     
    5540.highlight {
    5641    padding: 1px;
    57 }
    58 
    59 div.bordertitle h2 {
    60     border: none;
    61     padding-bottom: 0;
    6242}
    6343
     
    7454    font-weight: bold;
    7555}
     56
     57.fileedit-sub {
     58    padding: 10px 0 8px;
     59    line-height: 180%;
     60}
  • branches/2.8/wp-admin/edit-category-form.php

    r11553 r11698  
    7070            <span class="description"><?php _e('The description is not prominent by default, however some themes may show it.'); ?></span></td>
    7171        </tr>
     72        <?php do_action('edit_category_form_fields', $category); ?>
    7273    </table>
    7374<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php esc_attr_e('Update Category'); ?>" /></p>
  • branches/2.8/wp-admin/edit-comments.php

    r11553 r11698  
    194194$start = $offset = ( $page - 1 ) * $comments_per_page;
    195195
    196 list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, $comments_per_page + 5, $post_id, $comment_type ); // Grab a few extra
     196list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, $comments_per_page + 8, $post_id, $comment_type ); // Grab a few extra
    197197
    198198$_comment_post_ids = array();
     
    359359    <input type="hidden" name="mode" value="<?php echo esc_attr($mode); ?>" />
    360360    <input type="hidden" name="comment_status" value="<?php echo esc_attr($comment_status); ?>" />
    361     <input type="hidden" name="page" value="<?php echo isset($_REQUEST['page']) ? absint( $_REQUEST['page'] ) : 1; ?>" />
     361    <input type="hidden" name="page" value="<?php echo esc_attr($page); ?>" />
     362    <input type="hidden" name="per_page" value="<?php echo esc_attr($comments_per_page); ?>" />
    362363    <input type="hidden" name="p" value="<?php echo esc_attr( $post_id ); ?>" />
    363364    <input type="hidden" name="comment_type" value="<?php echo esc_attr( $comment_type ); ?>" />
  • branches/2.8/wp-admin/edit-link-category-form.php

    r11553 r11698  
    7575            <td><textarea name="description" id="description" rows="5" cols="50" style="width: 97%;"><?php echo $category->description; ?></textarea></td>
    7676        </tr>
     77        <?php do_action('edit_link_category_form_fields', $category); ?>
    7778    </table>
    7879<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php echo esc_attr($submit_text) ?>" /></p>
  • branches/2.8/wp-admin/edit-tag-form.php

    r11553 r11698  
    4040            <span class="description"><?php _e('The description is not prominent by default, however some themes may show it.'); ?></span></td>
    4141        </tr>
     42        <?php do_action('edit_tag_form_fields', $tag); ?>
    4243    </table>
    4344<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php esc_attr_e('Update Tag'); ?>" /></p>
  • branches/2.8/wp-admin/includes/class-wp-filesystem-direct.php

    r11553 r11698  
    2121        $this->method = 'direct';
    2222        $this->errors = new WP_Error();
    23         $this->permission = umask();
    2423    }
    2524    function connect() {
     
    6564    }
    6665    function chmod($file, $mode = false, $recursive = false) {
    67         if ( ! $mode )
    68             $mode = $this->permission;
    6966        if ( ! $this->exists($file) )
    7067            return false;
    71         if ( ! $recursive )
    72             return @chmod($file,$mode);
     68
     69        if ( ! $mode ) {
     70            if ( $this->permission )
     71                $mode = $this->permission;
     72            elseif ( $this->is_file($file) )
     73                $mode = FS_CHMOD_FILE;
     74            elseif ( $this->is_dir($file) )
     75                $mode = FS_CHMOD_DIR;
     76            else
     77                return false;   
     78        }
     79
     80        if ( ! $recursive )
     81            return @chmod($file, $mode);
    7382        if ( ! $this->is_dir($file) )
    7483            return @chmod($file, $mode);
     
    198207
    199208    function mkdir($path, $chmod = false, $chown = false, $chgrp = false){
    200         if ( ! $chmod)
    201             $chmod = $this->permission;
    202 
    203         if ( ! @mkdir($path, $chmod) )
    204             return false;
     209        if ( ! @mkdir($path) )
     210            return false;
     211        $this->chmod($path, $chmod);
    205212        if ( $chown )
    206213            $this->chown($path, $chown);
  • branches/2.8/wp-admin/includes/class-wp-filesystem-ssh2.php

    r11553 r11698  
    1414 * @contrib http://kevin.vanzonneveld.net/techblog/article/make_ssh_connections_with_php/ - Installation Notes
    1515 *
    16  * Complie libssh2 (Note: Only 0.14 is officaly working with PHP 5.2.6+ right now.)
     16 * 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)
    1717 *
    1818 * cd /usr/src
     
    2323 * make all install
    2424 *
    25  * Note: No not leave the directory yet!
     25 * Note: Do not leave the directory yet!
    2626 *
    2727 * Enter: pecl install -f ssh2
     
    3434 * Check phpinfo() streams to confirm that: ssh2.shell, ssh2.exec, ssh2.tunnel, ssh2.scp, ssh2.sftp  exist.
    3535 *
     36 * Note: as of WordPress 2.8, This utilises the PHP5+ function 'stream_get_contents'
    3637 *
    3738 * @since 2.7
     
    4647    var $keys = false;
    4748    /*
    48      * This is the timeout value for ssh results to comeback.
     49     * This is the timeout value for ssh results.
    4950     * Slower servers might need this incressed, but this number otherwise should not change.
    5051     *
     
    6768            return false;
    6869        }
    69         if ( ! version_compare(phpversion(), '5', '>=') ) {
    70             $this->errors->add('ssh2_php_requirement', __('The ssh2 PHP extension is available, however requires PHP 5+'));
     70        if ( !function_exists('stream_get_contents') ) {
     71            $this->errors->add('ssh2_php_requirement', __('The ssh2 PHP extension is available, however, we require the PHP5 function <code>stream_get_contents()</code>'));
    7172            return false;
    7273        }
     
    102103
    103104        if ( empty ($opt['password']) ) {
    104             if ( !$this->keys ) //   password can be blank if we are using keys
     105            if ( !$this->keys ) //password can be blank if we are using keys
    105106                $this->errors->add('empty_password', __('SSH2 password is required'));
    106107        } else {
     
    129130        } else {
    130131            if ( ! @ssh2_auth_pubkey_file($this->link, $this->options['username'], $this->options['public_key'], $this->options['private_key'], $this->options['password'] ) ) {
    131                 $this->errors->add('auth', sprintf(__('Public and Private keys incorrent for %s'), $this->options['username']));
     132                $this->errors->add('auth', sprintf(__('Public and Private keys incorrect for %s'), $this->options['username']));
    132133                return false;
    133134            }
     
    149150            stream_set_blocking( $stream, true );
    150151            stream_set_timeout( $stream, $this->timeout );
    151             $data = stream_get_contents($stream);
     152            $data = stream_get_contents( $stream );
     153            fclose( $stream );
    152154
    153155            if ( $returnbool )
    154                 return '' != trim($data);
     156                return ( $data === false ) ? false : '' != trim($data);
    155157            else
    156158                return $data;
     
    167169    function get_contents($file, $type = '', $resumepos = 0 ) {
    168170        $file = ltrim($file, '/');
    169         return file_get_contents('ssh2.sftp://' . $this->sftp_link .'/' . $file);
     171        return file_get_contents('ssh2.sftp://' . $this->sftp_link . '/' . $file);
    170172    }
    171173
    172174    function get_contents_array($file) {
    173175        $file = ltrim($file, '/');
    174         return file('ssh2.sftp://' . $this->sftp_link .'/' . $file);
     176        return file('ssh2.sftp://' . $this->sftp_link . '/' . $file);
    175177    }
    176178
    177179    function put_contents($file, $contents, $type = '' ) {
    178180        $file = ltrim($file, '/');
    179         return file_put_contents('ssh2.sftp://' . $this->sftp_link .'/' . $file, $contents);
     181        return file_put_contents('ssh2.sftp://' . $this->sftp_link . '/' . $file, $contents);
    180182    }
    181183
     
    271273
    272274    function exists($file) {
    273         //return $this->run_command(sprintf('ls -lad %s', escapeshellarg($file)), true);
    274         $file = ltrim($file, '/');
    275         return file_exists('ssh2.sftp://' . $this->sftp_link .'/' . $file);
     275        $file = ltrim($file, '/');
     276        return file_exists('ssh2.sftp://' . $this->sftp_link . '/' . $file);
    276277    }
    277278
    278279    function is_file($file) {
    279280        $file = ltrim($file, '/');
    280         return is_file('ssh2.sftp://' . $this->sftp_link .'/' . $file);
     281        return is_file('ssh2.sftp://' . $this->sftp_link . '/' . $file);
    281282    }
    282283
    283284    function is_dir($path) {
    284285        $path = ltrim($path, '/');
    285         return is_dir('ssh2.sftp://' . $this->sftp_link .'/' . $path);
     286        return is_dir('ssh2.sftp://' . $this->sftp_link . '/' . $path);
    286287    }
    287288
    288289    function is_readable($file) {
    289290        $file = ltrim($file, '/');
    290         return is_readable('ssh2.sftp://' . $this->sftp_link .'/' . $file);
     291        return is_readable('ssh2.sftp://' . $this->sftp_link . '/' . $file);
    291292    }
    292293
    293294    function is_writable($file) {
    294295        $file = ltrim($file, '/');
    295         return is_writable('ssh2.sftp://' . $this->sftp_link .'/' . $file);
     296        return is_writable('ssh2.sftp://' . $this->sftp_link . '/' . $file);
    296297    }
    297298
    298299    function atime($file) {
    299300        $file = ltrim($file, '/');
    300         return fileatime('ssh2.sftp://' . $this->sftp_link .'/' . $file);
     301        return fileatime('ssh2.sftp://' . $this->sftp_link . '/' . $file);
    301302    }
    302303
    303304    function mtime($file) {
    304305        $file = ltrim($file, '/');
    305         return filemtime('ssh2.sftp://' . $this->sftp_link .'/' . $file);
     306        return filemtime('ssh2.sftp://' . $this->sftp_link . '/' . $file);
    306307    }
    307308
    308309    function size($file) {
    309310        $file = ltrim($file, '/');
    310         return filesize('ssh2.sftp://' . $this->sftp_link .'/' . $file);
     311        return filesize('ssh2.sftp://' . $this->sftp_link . '/' . $file);
    311312    }
    312313
  • branches/2.8/wp-admin/includes/dashboard.php

    r11553 r11698  
    606606
    607607function wp_dashboard_incoming_links() {
    608     wp_dashboard_cached_rss_widget( 'dashboard_incoming_links', 'wp_dashboard_incoming_links_output' );
     608    echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>';
    609609}
    610610
     
    635635    echo "<ul>\n";
    636636
    637     $count = 0;
    638     foreach ( $rss->get_items() as $item ) {
     637    if ( !isset($items) )
     638        $items = 10;
     639
     640    foreach ( $rss->get_items(0, $items) as $item ) {
    639641        $publisher = '';
    640642        $site_link = '';
     
    645647
    646648        $author = $item->get_author();
    647         $site_link = esc_url( strip_tags( $author->get_link() ) );
    648 
    649         if ( !$publisher = esc_html( strip_tags( $author->get_name() ) ) )
    650             $publisher = __( 'Somebody' );
     649        if ( $author ) {
     650            $site_link = esc_url( strip_tags( $author->get_link() ) );
     651
     652            if ( !$publisher = esc_html( strip_tags( $author->get_name() ) ) )
     653                $publisher = __( 'Somebody' );
     654        } else {
     655          $publisher = __( 'Somebody' );
     656        }
    651657        if ( $site_link )
    652658            $publisher = "<a href='$site_link'>$publisher</a>";
     
    685691
    686692function wp_dashboard_primary() {
    687     wp_dashboard_cached_rss_widget( 'dashboard_primary', 'wp_dashboard_rss_output' );
     693    echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>';
    688694}
    689695
     
    707713
    708714function wp_dashboard_secondary() {
    709     wp_dashboard_cached_rss_widget( 'dashboard_secondary', 'wp_dashboard_secondary_output' );
     715    echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>';
    710716}
    711717
     
    742748
    743749function wp_dashboard_plugins() {
    744     wp_dashboard_cached_rss_widget( 'dashboard_plugins', 'wp_dashboard_plugins_output', array(
    745         'http://wordpress.org/extend/plugins/rss/browse/popular/',
    746         'http://wordpress.org/extend/plugins/rss/browse/new/',
    747         'http://wordpress.org/extend/plugins/rss/browse/updated/'
    748     ) );
     750    echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>';
    749751}
    750752
  • branches/2.8/wp-admin/includes/file.php

    r11553 r11698  
    446446        return new WP_Error('http_no_file', __('Could not create Temporary file'));
    447447
    448     $response = wp_remote_get($url, array('timeout' => 30));
     448    $response = wp_remote_get($url, array('timeout' => 60));
    449449
    450450    if ( is_wp_error($response) ) {
     
    646646    }
    647647
    648     if ( ! $method && isset($args['connection_type']) && 'ssh' == $args['connection_type'] && extension_loaded('ssh2') && extension_loaded('sockets') ) $method = 'ssh2';
     648    if ( ! $method && isset($args['connection_type']) && 'ssh' == $args['connection_type'] && extension_loaded('ssh2') && function_exists('stream_get_contents') ) $method = 'ssh2';
    649649    if ( ! $method && extension_loaded('ftp') ) $method = 'ftpext';
    650650    if ( ! $method && ( extension_loaded('sockets') || function_exists('fsockopen') ) ) $method = 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread
     
    762762</tr>
    763763
    764 <?php if ( extension_loaded('ssh2') ) : ?>
     764<?php if ( extension_loaded('ssh2') && function_exists('stream_get_contents') ) : ?>
    765765<tr id="ssh_keys" valign="top" style="<?php if ( 'ssh' != $connection_type ) echo 'display:none' ?>">
    766766<th scope="row"><?php _e('Authentication Keys') ?>
     
    782782<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>
    783783<?php endif; ?>
    784 <?php if ( extension_loaded('ssh2') ) : ?>
     784<?php if ( extension_loaded('ssh2') && function_exists('stream_get_contents') ) : ?>
    785785<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>
    786786<?php endif; ?>
  • branches/2.8/wp-admin/includes/manifest.php

    r11553 r11698  
    9393    if ( @is_file('../wp-includes/js/tinymce/tiny_mce.js') ) :
    9494    $mce = array(
    95         array('../wp-includes/js/tinymce/wp-tinymce.php', 'c=1&' . $mce_ver, true),
    96         array('../wp-includes/js/tinymce/wp-tinymce.php', 'c=0&' . $mce_ver, true),
     95        array('../wp-includes/js/tinymce/wp-tinymce.php', $mce_ver, true),
    9796
    9897        array('../wp-includes/js/tinymce/tiny_mce.js', $mce_ver, true),
  • branches/2.8/wp-admin/includes/media.php

    r11553 r11698  
    370370}
    371371add_action( 'media_buttons', 'media_buttons' );
    372 add_action('media_upload_media', 'media_upload_handler');
    373372
    374373/**
     
    382381    check_admin_referer('media-form');
    383382
    384     $errors = array();
     383    $errors = null;
    385384
    386385    if ( isset($_POST['send']) ) {
     
    13131312    var settings = {
    13141313            button_text: '<span class="button"><?php _e('Select Files'); ?></span>',
    1315             button_text_style: '.button { text-align: center; font-weight: bold; font-family:"Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana,sans-serif; }',
     1314            button_text_style: '.button { text-align: center; font-weight: bold; font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif; }',
    13161315            button_height: "24",
    13171316            button_width: "132",
    1318             button_text_top_padding: 1,
     1317            button_text_top_padding: 2,
    13191318            button_image_url: '<?php echo includes_url('images/upload.png'); ?>',
    13201319            button_placeholder_id: "flash-browse-button",
  • branches/2.8/wp-admin/includes/misc.php

    r11553 r11698  
    7373        }
    7474
    75         $f = fopen( $filename, 'w' );
     75        if ( !$f = @fopen( $filename, 'w' ) )
     76            return false;
     77
    7678        $foundit = false;
    7779        if ( $markerdata ) {
     
    271273        return array();
    272274
     275    if ( !function_exists('token_get_all') )
     276        return array();
     277
    273278    $tokens = token_get_all( $content );
    274279    $functions = array();
  • branches/2.8/wp-admin/includes/plugin-install.php

    r11553 r11698  
    4747                $res = new WP_Error('plugins_api_failed', __('An unknown error occurred'), $request['body']);
    4848        }
     49    } elseif ( !is_wp_error($res) ) {
     50        $res->external = true;
    4951    }
    5052
     
    442444            $type = 'install';
    443445            //Check to see if this plugin is known to be installed, and has an update awaiting it.
    444             $update_plugins = get_option('update_plugins');
     446            $update_plugins = get_transient('update_plugins');
    445447            if ( is_object( $update_plugins ) ) {
    446448                foreach ( (array)$update_plugins->response as $file => $plugin ) {
     
    463465                    } else {
    464466                        //If the above update check failed, Then that probably means that the update checker has out-of-date information, force a refresh
    465                         delete_option('update_plugins');
     467                        delete_transient('update_plugins');
    466468                        $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
    467469                        $type = 'update_available';
     
    510512<?php endif; if ( ! empty($api->downloaded) ) : ?>
    511513            <li><strong><?php _e('Downloaded:') ?></strong> <?php printf(_n('%s time', '%s times', $api->downloaded), number_format_i18n($api->downloaded)) ?></li>
    512 <?php endif; if ( ! empty($api->slug) ) : ?>
     514<?php endif; if ( ! empty($api->slug) && empty($api->external) ) : ?>
    513515            <li><a target="_blank" href="http://wordpress.org/extend/plugins/<?php echo $api->slug ?>/"><?php _e('WordPress.org Plugin Page &#187;') ?></a></li>
    514516<?php endif; if ( ! empty($api->homepage) ) : ?>
     
    516518<?php endif; ?>
    517519        </ul>
     520        <?php if ( ! empty($api->rating) ) : ?>
    518521        <h2><?php _e('Average Rating') ?></h2>
    519522        <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)); ?>">
     
    526529        </div>
    527530        <small><?php printf(_n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings)); ?></small>
     531        <?php endif; ?>
    528532    </div>
    529533    <div id="section-holder" class="wrap">
  • branches/2.8/wp-admin/includes/plugin.php

    r11553 r11698  
    586586
    587587function add_menu_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '' ) {
    588     global $menu, $admin_page_hooks;
     588    global $menu, $admin_page_hooks, $_registered_pages;
    589589
    590590    $file = plugin_basename( $file );
     
    603603    $menu[] = array ( $menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url );
    604604
     605    $_registered_pages[$hookname] = true;
     606
    605607    return $hookname;
    606608}
    607609
    608610function add_object_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '') {
    609     global $menu, $admin_page_hooks, $_wp_last_object_menu;
     611    global $menu, $admin_page_hooks, $_wp_last_object_menu, $_registered_pages;
    610612
    611613    $file = plugin_basename( $file );
     
    624626    $menu[$_wp_last_object_menu] = array ( $menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url );
    625627
     628    $_registered_pages[$hookname] = true;
     629
    626630    return $hookname;
    627631}
    628632
    629633function add_utility_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '') {
    630     global $menu, $admin_page_hooks, $_wp_last_utility_menu;
     634    global $menu, $admin_page_hooks, $_wp_last_utility_menu, $_registered_pages;
    631635
    632636    $file = plugin_basename( $file );
     
    646650
    647651    $menu[$_wp_last_utility_menu] = array ( $menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url );
     652
     653    $_registered_pages[$hookname] = true;
    648654
    649655    return $hookname;
     
    655661    global $_wp_real_parent_file;
    656662    global $_wp_submenu_nopriv;
     663    global $_registered_pages;
    657664
    658665    $file = plugin_basename( $file );
     
    683690    if (!empty ( $function ) && !empty ( $hookname ))
    684691        add_action( $hookname, $function );
     692
     693    $_registered_pages[$hookname] = true;
     694    // backwards-compatibility for plugins using add_management page.  See wp-admin/admin.php for redirect from edit.php to tools.php
     695    if ( 'tools.php' == $parent )
     696        $_registered_pages[get_plugin_page_hookname( $file, 'edit.php')] = true;
    685697
    686698    return $hookname;
     
    920932    global $_wp_submenu_nopriv;
    921933    global $plugin_page;
     934    global $_registered_pages;
    922935
    923936    $parent = get_admin_page_parent();
     
    926939        return false;
    927940
    928     if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$parent][$plugin_page] ) )
    929         return false;
     941    if ( isset( $plugin_page ) ) {
     942        if ( isset( $_wp_submenu_nopriv[$parent][$plugin_page] ) )
     943            return false;
     944
     945        $hookname = get_plugin_page_hookname($plugin_page, $parent);
     946        if ( !isset($_registered_pages[$hookname]) )
     947            return false;
     948    }
    930949
    931950    if ( empty( $parent) ) {
     
    936955        if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) )
    937956            return false;
     957        if ( isset( $plugin_page ) && isset( $_wp_menu_nopriv[$plugin_page] ) )
     958            return false;
    938959        foreach (array_keys( $_wp_submenu_nopriv ) as $key ) {
    939960            if ( isset( $_wp_submenu_nopriv[$key][$pagenow] ) )
     
    944965        return true;
    945966    }
     967
     968    if ( isset( $plugin_page ) && ( $plugin_page == $parent ) && isset( $_wp_menu_nopriv[$plugin_page] ) )
     969        return false;
    946970
    947971    if ( isset( $submenu[$parent] ) ) {
  • branches/2.8/wp-admin/includes/template.php

    r11553 r11698  
    14481448                $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this post')) . '">' . __('Edit') . '</a>';
    14491449                $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this post inline')) . '">' . __('Quick&nbsp;Edit') . '</a>';
     1450            }
     1451            if ( current_user_can('delete_post', $post->ID) ) {
    14501452                $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>";
    14511453            }
     
    16611663            $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr(__('Edit this page')) . '">' . __('Edit') . '</a>';
    16621664            $actions['inline'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
     1665        }
     1666        if ( current_user_can('delete_page', $page->ID) ) {
    16631667            $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>";
    16641668        }
     
    34723476            }
    34733477            break;
    3474         case 'theme-editor':
    3475         case 'plugin-editor':
    3476             $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";
    3477             $show_screen = true;
    3478             break;
    34793478        case 'widgets':
    34803479            if ( !isset($_wp_contextual_help['widgets']) ) {
  • branches/2.8/wp-admin/includes/update-core.php

    r11553 r11698  
    230230    if ( is_wp_error($result) ) {
    231231        $wp_filesystem->delete($maintenance_file);
    232         $wp_filesystem->delete($working_dir, true);
     232        $wp_filesystem->delete($from, true);
    233233        return $result;
    234234    }
  • branches/2.8/wp-admin/includes/user.php

    r11553 r11698  
    254254            return array($user->id);
    255255        else
    256             return false;
     256            return array();
    257257    }
    258258
  • branches/2.8/wp-admin/includes/widgets.php

    r11553 r11698  
    9898function next_widget_id_number($id_base) {
    9999    global $wp_registered_widgets;
    100     $number = 2;
    101 
    102     while ( isset($wp_registered_widgets["$id_base-$number"]) )
    103         $number++;
     100    $number = 1;
     101
     102    foreach ( $wp_registered_widgets as $widget_id => $widget ) {
     103        if ( preg_match( '/' . $id_base . '-([0-9]+)$/', $widget_id, $matches ) )
     104            $number = max($number, $matches[1]);
     105    }
     106    $number++;
    104107
    105108    return $number;
  • branches/2.8/wp-admin/js/dashboard.dev.js

    r11553 r11698  
     1var ajaxWidgets, ajaxPopulateWidgets, quickPressLoad;
    12
    23jQuery(document).ready( function($) {
    3     var ajaxWidgets, ajaxPopulateWidgets, quickPressLoad;
    44    // These widgets are sometimes populated via ajax
    55    ajaxWidgets = [
     
    1010    ];
    1111
    12     ajaxPopulateWidgets = function() {
    13         $.each( ajaxWidgets, function() {
    14             var e = jQuery('#' + this + ':visible div.inside').find('.widget-loading');
    15             if ( e.size() ) { e.parent().load('index-extra.php?jax=' + this); }
    16         } );
     12    ajaxPopulateWidgets = function(el) {
     13        show = function(id, i) {
     14            var p, e = $('#' + id + ' div.inside:visible').find('.widget-loading');
     15            if ( e.length ) {
     16                p = e.parent();
     17                setTimeout( function(){
     18                    p.load('index-extra.php?jax=' + id, '', function() {
     19                        p.hide().slideDown('normal', function(){
     20                            $(this).css('display', '');
     21                            if ( 'dashboard_plugins' == id && $.isFunction(tb_init) )
     22                                tb_init('#dashboard_plugins a.thickbox');
     23                        });
     24                    });
     25                }, i * 500 );
     26            }
     27        }
     28        if ( el ) {
     29            el = el.toString();
     30            if ( $.inArray(el, ajaxWidgets) != -1 )
     31                show(el, 0);
     32        } else {
     33            $.each( ajaxWidgets, function(i) {
     34                show(this, i);
     35            });
     36        }
    1737    };
    1838    ajaxPopulateWidgets();
    1939
    20     postboxes.add_postbox_toggles('dashboard', { onShow: ajaxPopulateWidgets } );
     40    postboxes.add_postbox_toggles('dashboard', { pbshow: ajaxPopulateWidgets } );
    2141
    2242    /* QuickPress */
  • branches/2.8/wp-admin/js/dashboard.js

    r11553 r11698  
    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()});
     1var 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()});
  • branches/2.8/wp-admin/js/edit-comments.dev.js

    r11553 r11698  
    2424            n = n + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 );
    2525            if ( n < 0 ) { n = 0; }
    26             $('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
     26            a.parents('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
    2727            n = n.toString();
    2828            if ( n.length > 3 )
     
    7878            }
    7979            if ( n < 0 ) { n = 0; }
    80             $('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
     80            a.parents('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
    8181            n = n.toString();
    8282            if ( n.length > 3 )
  • branches/2.8/wp-admin/js/edit-comments.js

    r11553 r11698  
    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);
     1var 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);
  • branches/2.8/wp-admin/js/post.dev.js

    r11553 r11698  
    213213    var noSyncChecks = false, syncChecks, catAddAfter, stamp = $('#timestamp').html(), visibility = $('#post-visibility-display').html(), sticky = '';
    214214
    215     // for Press This
    216     if ( typeof autosave != 'function' )
    217         autosave = function(){};
    218 
    219215    // postboxes
    220216    postboxes.add_postbox_toggles('post');
     
    226222    tag_init();
    227223
    228     $('#title').blur( function() { if ( ($("#post_ID").val() > 0) || ($("#title").val().length == 0) ) return; autosave(); } );
     224    $('#title').blur( function() {
     225        if ( ($("#post_ID").val() > 0) || ($("#title").val().length == 0) )
     226            return;
     227
     228        if ( typeof(autosave) != 'undefined' )
     229            autosave();
     230    });
    229231
    230232    // auto-suggest stuff
     
    478480    $('#the-list').wpList( { addAfter: function( xml, s ) {
    479481        $('table#list-table').show();
    480         if ( $.isFunction( autosave_update_post_ID ) ) {
     482        if ( typeof( autosave_update_post_ID ) != 'undefined' ) {
    481483            autosave_update_post_ID(s.parsed.responses[0].supplemental.postid);
    482484        }
  • branches/2.8/wp-admin/js/post.js

    r11553 r11698  
    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}})});
     1function 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}})});
  • branches/2.8/wp-admin/js/postbox.dev.js

    r11553 r11698  
    55            this.init(page,args);
    66            $('.postbox h3, .postbox .handlediv').click( function() {
    7                 var p = $(this).parent('.postbox');
    8                 /*
    9                 if ( p.hasClass('noclick') ) {
    10                     p.removeClass('noclick');
    11                     return false;
    12                 }
    13                 */
     7                var p = $(this).parent('.postbox'), id = p.attr('id');
    148                p.toggleClass('closed');
    159                postboxes.save_state(page);
     10                if ( id ) {
     11                    if ( !p.hasClass('closed') && $.isFunction(postboxes.pbshow) )
     12                        postboxes.pbshow(id);
     13                    else if ( p.hasClass('closed') && $.isFunction(postboxes.pbhide) )
     14                        postboxes.pbhide(id);
     15                }
    1616            } );
    1717            $('.postbox h3 a').click( function(e) {
  • branches/2.8/wp-admin/js/postbox.js

    r11553 r11698  
    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));
     1var 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));
  • branches/2.8/wp-admin/link-parse-opml.php

    r11553 r11698  
    77 */
    88
    9 /** Load WordPress Bootstrap */
    10 require_once('../wp-load.php');
     9if ( ! defined('ABSPATH') )
     10    die();
    1111
    1212global $opml, $map;
  • branches/2.8/wp-admin/media-upload.php

    r11553 r11698  
    3030
    3131if ( isset($_GET['inline']) ) {
    32 
    33     if ( isset($_GET['upload-page-form']) ) {
    34         $errors = media_upload_form_handler();
    35 
    36         $location = 'upload.php';
    37         if ( $errors )
    38             $location .= '?message=3';
    39 
    40         wp_redirect( admin_url($location) );
    41     }
     32    $errors = array();
    4233
    4334    if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
     
    4940            $id = false;
    5041        }
     42    }
     43
     44    if ( isset($_GET['upload-page-form']) ) {
     45        $errors = array_merge($errors, (array) media_upload_form_handler());
     46
     47        $location = 'upload.php';
     48        if ( $errors )
     49            $location .= '?message=3';
     50
     51        wp_redirect( admin_url($location) );
    5152    }
    5253
  • branches/2.8/wp-admin/menu-header.php

    r11553 r11698  
    7575            $submenu[$item[2]] = array_values($submenu[$item[2]]);  // Re-index.
    7676            $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
    77             if ( ( ('index.php' != $submenu[$item[2]][0][2]) && file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") ) || !empty($menu_hook)) {
     77            $menu_file = $submenu[$item[2]][0][2];
     78            if ( false !== $pos = strpos($menu_file, '?') )
     79                $menu_file = substr($menu_file, 0, $pos);
     80            if ( ( ('index.php' != $submenu[$item[2]][0][2]) && file_exists(WP_PLUGIN_DIR . "/$menu_file") ) || !empty($menu_hook)) {
    7881                $admin_is_parent = true;
    7982                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>";
     
    8386        } else if ( current_user_can($item[1]) ) {
    8487            $menu_hook = get_plugin_page_hook($item[2], 'admin.php');
    85             if ( ('index.php' != $item[2]) && file_exists(WP_PLUGIN_DIR . "/{$item[2]}") || !empty($menu_hook) ) {
     88            $menu_file = $item[2];
     89            if ( false !== $pos = strpos($menu_file, '?') )
     90                $menu_file = substr($menu_file, 0, $pos);
     91            if ( ('index.php' != $item[2]) && file_exists(WP_PLUGIN_DIR . "/$menu_file") || !empty($menu_hook) ) {
    8692                $admin_is_parent = true;
    8793                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>";
     
    103109                    $first = false;
    104110                }
     111
     112                $menu_file = $item[2];
     113                if ( false !== $pos = strpos($menu_file, '?') )
     114                    $menu_file = substr($menu_file, 0, $pos);
     115
    105116                if ( isset($submenu_file) ) {
    106117                    if ( $submenu_file == $sub_item[2] )
     
    108119                // If plugin_page is set the parent must either match the current page or not physically exist.
    109120                // This allows plugin pages with the same hook to exist under different parents.
    110                 } else if ( (isset($plugin_page) && $plugin_page == $sub_item[2] && (!file_exists($item[2]) || ($item[2] == $self))) || (!isset($plugin_page) && $self == $sub_item[2]) ) {
     121                } else if ( (isset($plugin_page) && $plugin_page == $sub_item[2] && (!file_exists($menu_file) || ($item[2] == $self))) || (!isset($plugin_page) && $self == $sub_item[2]) ) {
    111122                    $class[] = 'current';
    112123                }
     
    115126
    116127                $menu_hook = get_plugin_page_hook($sub_item[2], $item[2]);
     128                $sub_file = $sub_item[2];
     129                if ( false !== $pos = strpos($sub_file, '?') )
     130                    $sub_file = substr($sub_file, 0, $pos);
    117131
    118                 if ( ( ('index.php' != $sub_item[2]) && file_exists(WP_PLUGIN_DIR . "/{$sub_item[2]}") ) || ! empty($menu_hook) ) {
     132                if ( ( ('index.php' != $sub_item[2]) && file_exists(WP_PLUGIN_DIR . "/$sub_file") ) || ! empty($menu_hook) ) {
    119133                    // If admin.php is the current page or if the parent exists as a file in the plugins or admin dir
    120                     $parent_exists = (!$admin_is_parent && file_exists(WP_PLUGIN_DIR . "/{$item[2]}") && !is_dir(WP_PLUGIN_DIR . "/{$item[2]}") ) || file_exists($item[2]);
     134                   
     135                    $parent_exists = (!$admin_is_parent && file_exists(WP_PLUGIN_DIR . "/$menu_file") && !is_dir(WP_PLUGIN_DIR . "/{$item[2]}") ) || file_exists($menu_file);
    121136                    if ( $parent_exists )
    122137                        echo "<li$class><a href='{$item[2]}?page={$sub_item[2]}'$class$tabindex>{$sub_item[0]}</a></li>";
  • branches/2.8/wp-admin/options-general.php

    r11553 r11698  
    158158<br />
    159159<span>
    160 <?php if (get_option('timezone_string')) : ?>
     160<?php if ($tzstring) : ?>
    161161    <?php
    162162    $now = localtime(time(),true);
     
    166166    <br />
    167167    <?php
    168     if (function_exists('timezone_transitions_get') && $tzstring) {
     168    if (function_exists('timezone_transitions_get')) {
    169169        $dateTimeZoneSelected = new DateTimeZone($tzstring);
    170170        foreach (timezone_transitions_get($dateTimeZoneSelected) as $tr) {
    171171            if ($tr['ts'] > time()) {
    172                     $found = true;
     172                $found = true;
    173173                break;
    174174            }
     
    180180                __('Daylight savings time begins on: <code>%s</code>.') :
    181181                __('Standard time begins  on: <code>%s</code>.');
    182             $tz = new DateTimeZone($tzstring);
    183             $d = new DateTime( "@{$tr['ts']}" );
    184             $d->setTimezone($tz);
    185             printf( $message, date_i18n(get_option('date_format').' '.get_option('time_format'), $d->format('U') ) );
     182            printf( $message, date_i18n(get_option('date_format').' '.get_option('time_format'), $tr['ts'] ) );
    186183        } else {
    187184            _e('This timezone does not observe daylight savings time.');
  • branches/2.8/wp-admin/plugin-editor.php

    r11553 r11698  
    8484    }
    8585
    86     if ( use_codepress() )
    87         wp_enqueue_script( 'codepress' );
    88 
    8986    // List of allowable extensions
    9087    $editable_extensions = array('php', 'txt', 'text', 'js', 'css', 'html', 'htm', 'xml', 'inc', 'include');
     
    112109        $functions = wp_doc_link_parse( $content );
    113110
    114         $docs_select = '<select name="docs-list" id="docs-list">';
    115         $docs_select .= '<option value="">' . __( 'Function Name...' ) . '</option>';
    116         foreach ( $functions as $function) {
    117             $docs_select .= '<option value="' . esc_attr( $function ) . '">' . htmlspecialchars( $function ) . '()</option>';
     111        if ( !empty($functions) ) {
     112            $docs_select = '<select name="docs-list" id="docs-list">';
     113            $docs_select .= '<option value="">' . __( 'Function Name...' ) . '</option>';
     114            foreach ( $functions as $function) {
     115                $docs_select .= '<option value="' . esc_attr( $function ) . '">' . htmlspecialchars( $function ) . '()</option>';
     116            }
     117            $docs_select .= '</select>';
    118118        }
    119         $docs_select .= '</select>';
    120119    }
    121120
     
    137136<?php screen_icon(); ?>
    138137<h2><?php echo esc_html( $title ); ?></h2>
    139 <div class="bordertitle">
    140     <form id="themeselector" action="plugin-editor.php" method="post">
    141         <strong><label for="plugin"><?php _e('Select plugin to edit:'); ?> </label></strong>
    142         <select name="plugin" id="plugin">
    143 <?php
    144     foreach ( $plugins as $plugin_key => $a_plugin ) {
    145         $plugin_name = $a_plugin['Name'];
    146         if ( $plugin_key == $plugin )
    147             $selected = " selected='selected'";
    148         else
    149             $selected = '';
    150         $plugin_name = esc_attr($plugin_name);
    151         $plugin_key = esc_attr($plugin_key);
    152         echo "\n\t<option value=\"$plugin_key\" $selected>$plugin_name</option>";
    153     }
    154 ?>
    155         </select>
    156         <input type="submit" name="Submit" value="<?php esc_attr_e('Select') ?>" class="button" />
    157     </form>
    158 </div>
    159 <div class="tablenav">
     138
     139<div class="fileedit-sub">
    160140<div class="alignleft">
    161141<big><?php
     
    173153    ?></big>
    174154</div>
     155<div class="alignright">
     156    <form action="plugin-editor.php" method="post">
     157        <strong><label for="plugin"><?php _e('Select plugin to edit:'); ?> </label></strong>
     158        <select name="plugin" id="plugin">
     159<?php
     160    foreach ( $plugins as $plugin_key => $a_plugin ) {
     161        $plugin_name = $a_plugin['Name'];
     162        if ( $plugin_key == $plugin )
     163            $selected = " selected='selected'";
     164        else
     165            $selected = '';
     166        $plugin_name = esc_attr($plugin_name);
     167        $plugin_key = esc_attr($plugin_key);
     168        echo "\n\t<option value=\"$plugin_key\" $selected>$plugin_name</option>";
     169    }
     170?>
     171        </select>
     172        <input type="submit" name="Submit" value="<?php esc_attr_e('Select') ?>" class="button" />
     173    </form>
     174</div>
    175175<br class="clear" />
    176176</div>
    177 <br class="clear" />
    178     <div id="templateside">
    179     <h3 id="bordertitle"><?php _e('Plugin Files'); ?></h3>
     177
     178<div id="templateside">
     179    <h3><?php _e('Plugin Files'); ?></h3>
    180180
    181181    <ul>
     
    196196<?php endforeach; ?>
    197197    </ul>
    198     </div>
    199     <form name="template" id="template" action="plugin-editor.php" method="post">
     198</div>
     199<form name="template" id="template" action="plugin-editor.php" method="post">
    200200    <?php wp_nonce_field('edit-plugin_' . $file) ?>
    201201        <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1" class="codepress <?php echo $codepress_lang ?>"><?php echo $content ?></textarea>
     
    204204        <input type="hidden" name="plugin" value="<?php echo esc_attr($plugin) ?>" />
    205205        </div>
    206         <?php if ( isset( $functions ) ) : ?>
     206        <?php if ( !empty( $docs_select ) ) : ?>
    207207        <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>
    208208        <?php endif; ?>
     
    222222    <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>
    223223<?php endif; ?>
    224  </form>
    225 <div class="clear"> &nbsp; </div>
     224</form>
     225<br class="clear" />
    226226</div>
    227227<?php
    228228    break;
    229229}
    230 include("admin-footer.php") ?>
     230include("admin-footer.php");
  • branches/2.8/wp-admin/rtl.css

    r11553 r11698  
    138138.folded #adminmenu img.wp-menu-image {
    139139    padding: 7px 6px 0 0;
     140}
     141#adminmenu a.separator {
     142    cursor: e-resize;
     143}
     144.folded #adminmenu a.separator {
     145    cursor: w-resize;
    140146}
    141147#adminmenu .wp-submenu .wp-submenu-head {
  • branches/2.8/wp-admin/theme-editor.php

    r11553 r11698  
    2323} else {
    2424    $theme = stripslashes($theme);
    25  }
    26 
     25}
    2726
    2827if ( ! isset($themes[$theme]) )
     
    6665
    6766    $location = wp_kses_no_null($location);
    68     $strip = array('%0d', '%0a');
    69     $location = str_replace($strip, '', $location);
     67    $strip = array('%0d', '%0a', '%0D', '%0A');
     68    $location = _deep_replace($strip, $location);
    7069    header("Location: $location");
    7170    exit();
     
    7776    if ( !current_user_can('edit_themes') )
    7877        wp_die('<p>'.__('You do not have sufficient permissions to edit themes for this blog.').'</p>');
    79 
    80     if ( use_codepress() )
    81         wp_enqueue_script( 'codepress' );
    8278
    8379    require_once('admin-header.php');
     
    118114<?php screen_icon(); ?>
    119115<h2><?php echo esc_html( $title ); ?></h2>
    120 <div class="bordertitle">
    121     <form id="themeselector" action="theme-editor.php" method="post">
     116
     117<div class="fileedit-sub">
     118<div class="alignleft">
     119<big><?php echo sprintf($desc_header, $file_show); ?></big>
     120</div>
     121<div class="alignright">
     122    <form action="theme-editor.php" method="post">
    122123        <strong><label for="theme"><?php _e('Select theme to edit:'); ?> </label></strong>
    123124        <select name="theme" id="theme">
     
    135136    </form>
    136137</div>
    137 <div class="tablenav">
    138 <div class="alignleft">
    139 <big><?php echo sprintf($desc_header, $file_show); ?></big>
    140 </div>
    141138<br class="clear" />
    142139</div>
    143 <br class="clear" />
    144     <div id="templateside">
    145     <h3 id="bordertitle"><?php _e("Theme Files"); ?></h3>
     140
     141<div id="templateside">
     142    <h3><?php _e("Theme Files"); ?></h3>
    146143
    147144<?php
     
    194191<?php endif; ?>
    195192</div>
    196     <?php
    197     if (!$error) {
    198     ?>
    199     <form name="template" id="template" action="theme-editor.php" method="post">
     193
     194<?php if (!$error) { ?>
     195<form name="template" id="template" action="theme-editor.php" method="post">
    200196    <?php wp_nonce_field('edit-theme_' . $file . $theme) ?>
    201197         <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1" class="codepress <?php echo $codepress_lang ?>"><?php echo $content ?></textarea>
     
    223219<?php endif; ?>
    224220        </div>
    225     </form>
    226     <?php
     221</form>
     222<?php
    227223    } else {
    228224        echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
    229225    }
    230     ?>
    231 <div class="clear"> &nbsp; </div>
     226?>
     227<br class="clear" />
    232228</div>
    233229<?php
     
    235231}
    236232
    237 include("admin-footer.php") ?>
     233include("admin-footer.php");
  • branches/2.8/wp-admin/update-core.php

    r11553 r11698  
    1515function list_core_update( $update ) {
    1616    global $wp_local_package;
    17     $version_string = 'en_US' == $update->locale ?
     17    $version_string = ('en_US' == $update->locale && 'en_US' == get_locale() ) ?
    1818            $update->current : sprintf("%s&ndash;<strong>%s</strong>", $update->current, $update->locale);
    1919    $current = false;
     
    5454    if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) )
    5555        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>';
     56    else if ( 'en_US' == $update->locale && get_locale() != 'en_US' ) {
     57        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>';
     58    }
    5659    echo '</form>';
    5760
  • branches/2.8/wp-admin/upgrade.php

    r11553 r11698  
    6969    case 1:
    7070        wp_upgrade();
    71 
    72         if ( empty( $_GET['backto'] ) )
    73             $backto = __get_option( 'home' ) . '/';
    74         else {
    75             $backto = stripslashes( urldecode( $_GET['backto'] ) );
     71           
     72            $backto = empty($_GET['backto']) ? '' : $_GET['backto'] ;
     73            $backto = stripslashes( urldecode( $backto ) );
    7674            $backto = esc_url_raw( $backto  );
    77         }
     75            $backto = wp_validate_redirect($backto, __get_option( 'home' ) . '/');
    7876?>
    7977<h2><?php _e( 'Upgrade Complete' ); ?></h2>
  • branches/2.8/wp-admin/wp-admin.css

    r11553 r11698  
    438438}
    439439
     440#timezone_string option {
     441    margin-left: 1em;
     442}
     443
    440444.approve {
    441445    display: none;
     
    20932097}
    20942098
    2095 .bordertitle {
    2096     padding-bottom: 5px;
    2097     border-bottom-width: 1px;
    2098     border-bottom-style: solid;
    2099 }
    2100 
    21012099/* Edit posts */
    21022100
     
    31873185}
    31883186
     3187.widefat td p {
     3188    margin: 2px 0 0.8em;
     3189}
     3190
    31893191table .vers,
    31903192table .column-visible,
  • branches/2.8/wp-content/plugins/hello.php

    r11553 r11698  
    33 * @package Hello_Dolly
    44 * @author Matt Mullenweg
    5  * @version 1.5
     5 * @version 1.5.1
    66 */
    77/*
     
    1010Description: 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.
    1111Author: Matt Mullenweg
    12 Version: 1.5
     12Version: 1.5.1
    1313Author URI: http://ma.tt/
    1414*/
     
    6363// We need some CSS to position the paragraph
    6464function dolly_css() {
     65    // This makes sure that the posinioning is also good for right-to-left languages
     66    $x = ( 'rtl' == get_bloginfo( 'text_direction' ) ) ? 'left' : 'right';
     67
    6568    echo "
    6669    <style type='text/css'>
     
    7073        margin: 0;
    7174        padding: 0;
    72         right: 215px;
     75        $x: 215px;
    7376        font-size: 11px;
    7477    }
  • branches/2.8/wp-includes/class-simplepie.php

    r11553 r11698  
    752752    function __destruct()
    753753    {
    754         if (!empty($this->data['items']))
    755         {
    756             foreach ($this->data['items'] as $item)
    757             {
    758                 $item->__destruct();
    759             }
    760             unset($this->data['items']);
    761         }
    762         if (!empty($this->data['ordered_items']))
    763         {
    764             foreach ($this->data['ordered_items'] as $item)
    765             {
    766                 $item->__destruct();
    767             }
    768             unset($this->data['ordered_items']);
     754        if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode'))
     755        {
     756            if (!empty($this->data['items']))
     757            {
     758                foreach ($this->data['items'] as $item)
     759                {
     760                    $item->__destruct();
     761                }
     762                unset($item, $this->data['items']);
     763            }
     764            if (!empty($this->data['ordered_items']))
     765            {
     766                foreach ($this->data['ordered_items'] as $item)
     767                {
     768                    $item->__destruct();
     769                }
     770                unset($item, $this->data['ordered_items']);
     771            }
    769772        }
    770773    }
     
    16841687                $headers = $file->headers;
    16851688                $data = $file->body;
    1686                 $sniffer = new $this->content_type_sniffer_class($file);
     1689                $sniffer =& new $this->content_type_sniffer_class($file);
    16871690                $sniffed = $sniffer->get_type();
    16881691            }
     
    19621965                    if ($file->success && ($file->status_code == 200 || ($file->status_code > 206 && $file->status_code < 300)) && strlen($file->body) > 0)
    19631966                    {
    1964                         $sniffer = new $this->content_type_sniffer_class($file);
     1967                        $sniffer =& new $this->content_type_sniffer_class($file);
    19651968                        if (substr($sniffer->get_type(), 0, 6) === 'image/')
    19661969                        {
     
    30833086    function __destruct()
    30843087    {
    3085         unset($this->feed);
     3088        if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode'))
     3089        {
     3090            unset($this->feed);
     3091        }
    30863092    }
    30873093
     
    56835689    }
    56845690
    5685     /**
    5686      * Remove items that link back to this before destroying this object
    5687      */
    5688     function __destruct()
    5689     {
    5690         unset($this->item);
    5691     }
    5692 
    56935691    function get_source_tags($namespace, $tag)
    56945692    {
     
    77477745                                    case 'gzip':
    77487746                                    case 'x-gzip':
    7749                                         $decoder = new SimplePie_gzdecode($this->body);
     7747                                        $decoder =& new SimplePie_gzdecode($this->body);
    77507748                                        if (!$decoder->parse())
    77517749                                        {
     
    89558953    function parse_url($url)
    89568954    {
    8957         static $cache = array();
    8958         if (isset($cache[$url]))
    8959         {
    8960             return $cache[$url];
    8961         }
    8962         elseif (preg_match('/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/', $url, $match))
    8963         {
    8964             for ($i = count($match); $i <= 9; $i++)
    8965             {
    8966                 $match[$i] = '';
    8967             }
    8968             return $cache[$url] = array('scheme' => $match[2], 'authority' => $match[4], 'path' => $match[5], 'query' => $match[7], 'fragment' => $match[9]);
    8969         }
    8970         else
    8971         {
    8972             return $cache[$url] = array('scheme' => '', 'authority' => '', 'path' => '', 'query' => '', 'fragment' => '');
    8973         }
     8955        preg_match('/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/', $url, $match);
     8956        for ($i = count($match); $i <= 9; $i++)
     8957        {
     8958            $match[$i] = '';
     8959        }
     8960        return array('scheme' => $match[2], 'authority' => $match[4], 'path' => $match[5], 'query' => $match[7], 'fragment' => $match[9]);
    89748961    }
    89758962
     
    1055610543    function entities_decode($data)
    1055710544    {
    10558         $decoder = new SimplePie_Decode_HTML_Entities($data);
     10545        $decoder =& new SimplePie_Decode_HTML_Entities($data);
    1055910546        return $decoder->parse();
    1056010547    }
     
    1081010797    function codepoint_to_utf8($codepoint)
    1081110798    {
    10812         static $cache = array();
    1081310799        $codepoint = (int) $codepoint;
    10814         if (isset($cache[$codepoint]))
    10815         {
    10816             return $cache[$codepoint];
    10817         }
    10818         elseif ($codepoint < 0)
    10819         {
    10820             return $cache[$codepoint] = false;
     10800        if ($codepoint < 0)
     10801        {
     10802            return false;
    1082110803        }
    1082210804        else if ($codepoint <= 0x7f)
    1082310805        {
    10824             return $cache[$codepoint] = chr($codepoint);
     10806            return chr($codepoint);
    1082510807        }
    1082610808        else if ($codepoint <= 0x7ff)
    1082710809        {
    10828             return $cache[$codepoint] = chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f));
     10810            return chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f));
    1082910811        }
    1083010812        else if ($codepoint <= 0xffff)
    1083110813        {
    10832             return $cache[$codepoint] = chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
     10814            return chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
    1083310815        }
    1083410816        else if ($codepoint <= 0x10ffff)
    1083510817        {
    10836             return $cache[$codepoint] = chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
     10818            return chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
    1083710819        }
    1083810820        else
    1083910821        {
    1084010822            // U+FFFD REPLACEMENT CHARACTER
    10841             return $cache[$codepoint] = "\xEF\xBF\xBD";
     10823            return "\xEF\xBF\xBD";
    1084210824        }
    1084310825    }
     
    1095710939            if ($pos = strpos($data, "\x00\x00\x00\x3F\x00\x00\x00\x3E"))
    1095810940            {
    10959                 $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32BE', 'UTF-8'));
     10941                $parser =& new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32BE', 'UTF-8'));
    1096010942                if ($parser->parse())
    1096110943                {
     
    1097010952            if ($pos = strpos($data, "\x3F\x00\x00\x00\x3E\x00\x00\x00"))
    1097110953            {
    10972                 $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32LE', 'UTF-8'));
     10954                $parser =& new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32LE', 'UTF-8'));
    1097310955                if ($parser->parse())
    1097410956                {
     
    1098310965            if ($pos = strpos($data, "\x00\x3F\x00\x3E"))
    1098410966            {
    10985                 $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16BE', 'UTF-8'));
     10967                $parser =& new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16BE', 'UTF-8'));
    1098610968                if ($parser->parse())
    1098710969                {
     
    1099610978            if ($pos = strpos($data, "\x3F\x00\x3E\x00"))
    1099710979            {
    10998                 $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16LE', 'UTF-8'));
     10980                $parser =& new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16LE', 'UTF-8'));
    1099910981                if ($parser->parse())
    1100010982                {
     
    1100910991            if ($pos = strpos($data, "\x3F\x3E"))
    1101010992            {
    11011                 $parser = new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
     10993                $parser =& new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
    1101210994                if ($parser->parse())
    1101310995                {
     
    1173511717        if (!isset($cache[get_class($this)]))
    1173611718        {
    11737             if (extension_loaded('Reflection'))
    11738             {
    11739                 $class = new ReflectionClass(get_class($this));
    11740                 $methods = $class->getMethods();
    11741                 $all_methods = array();
    11742                 foreach ($methods as $method)
    11743                 {
    11744                     $all_methods[] = $method->getName();
    11745                 }
    11746             }
    11747             else
    11748             {
    11749                 $all_methods = get_class_methods($this);
    11750             }
     11719            $all_methods = get_class_methods($this);
    1175111720
    1175211721            foreach ($all_methods as $method)
     
    1177511744        if (!$object)
    1177611745        {
    11777             $object = new SimplePie_Parse_Date;
     11746            $object =& new SimplePie_Parse_Date;
    1177811747        }
    1177911748        return $object;
     
    1281012779        if ($this->file->method & SIMPLEPIE_FILE_SOURCE_REMOTE)
    1281112780        {
    12812             $sniffer = new $this->content_type_sniffer_class($this->file);
     12781            $sniffer =& new $this->content_type_sniffer_class($this->file);
    1281312782            if ($sniffer->get_type() !== 'text/html')
    1281412783            {
     
    1285612825        if ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE)
    1285712826        {
    12858             $sniffer = new $this->content_type_sniffer_class($file);
     12827            $sniffer =& new $this->content_type_sniffer_class($file);
    1285912828            $sniffed = $sniffer->get_type();
    1286012829            if (in_array($sniffed, array('application/rss+xml', 'application/rdf+xml', 'text/rdf', 'application/atom+xml', 'text/xml', 'application/xml')))
     
    1308413053        if (substr($data, 0, 5) === '<?xml' && strspn(substr($data, 5, 1), "\x09\x0A\x0D\x20") && ($pos = strpos($data, '?>')) !== false)
    1308513054        {
    13086             $declaration = new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
     13055            $declaration =& new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
    1308713056            if ($declaration->parse())
    1308813057            {
  • branches/2.8/wp-includes/default-widgets.php

    r11553 r11698  
    527527            $cache = array();
    528528
    529         if ( isset($cache[$args['widget_id']]) )
    530             return $cache[$args['widget_id']];
     529        if ( isset($cache[$args['widget_id']]) ) {
     530            echo $cache[$args['widget_id']];
     531            return;
     532        }
    531533
    532534        ob_start();
  • branches/2.8/wp-includes/formatting.php

    r11553 r11698  
    8181
    8282function wptexturize_pushpop_element($text, &$stack, $disabled_elements, $opening = '<', $closing = '>') {
    83     $o = preg_quote($opening);
    84     $c = preg_quote($closing);
     83    $o = preg_quote($opening, '/');
     84    $c = preg_quote($closing, '/');
    8585    foreach($disabled_elements as $element) {
    8686        if (preg_match('/^'.$o.$element.'\b/', $text)) array_push($stack, $element);
     
    20432043    if ('' == $url) return $url;
    20442044    $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url);
    2045     $strip = array('%0d', '%0a');
    2046     $url = str_replace($strip, '', $url);
     2045    $strip = array('%0d', '%0a', '%0D', '%0A');
     2046    $url = _deep_replace($strip, $url);
    20472047    $url = str_replace(';//', '://', $url);
    20482048    /* If the URL doesn't appear to contain a scheme, we
     
    20662066
    20672067    return apply_filters('clean_url', $url, $original_url, $context);
     2068}
     2069
     2070/**
     2071 * Perform a deep string replace operation to ensure the values in $search are no longer present
     2072 *
     2073 * Repeats the replacement operation until it no longer replaces anything so as to remove "nested" values
     2074 * e.g. $subject = '%0%0%0DDD', $search ='%0D', $result ='' rather than the '%0%0DD' that
     2075 * str_replace would return
     2076 *
     2077 * @since 2.8.1
     2078 * @access private
     2079 *
     2080 * @param string|array $search
     2081 * @param string $subject
     2082 * @return string The processed string
     2083 */
     2084function _deep_replace($search, $subject){
     2085    $found = true;
     2086    while($found) {
     2087        $found = false;
     2088        foreach( (array) $search as $val ) {
     2089            while(strpos($subject, $val) !== false) {
     2090                $found = true;
     2091                $subject = str_replace($val, '', $subject);
     2092            }
     2093        }
     2094    }
     2095   
     2096    return $subject;
    20682097}
    20692098
  • branches/2.8/wp-includes/functions.php

    r11553 r11698  
    26832683            $wp_smiliessearch .= '|';
    26842684        }
    2685         $wp_smiliessearch .= preg_quote($rest);
     2685        $wp_smiliessearch .= preg_quote($rest, '/');
    26862686    }
    26872687
     
    31503150 */
    31513151function wp_timezone_override_offset() {
    3152     if (!wp_timezone_supported()) return false;
    3153 
    3154     $tz = get_option('timezone_string');
    3155     if (empty($tz)) return false;
    3156 
    3157     @date_default_timezone_set($tz);
    3158 
    3159     $dateTimeZoneSelected = timezone_open($tz);
    3160     $dateTimeServer = date_create();
    3161     if ($dateTimeZoneSelected === false || $dateTimeServer === false) return false;
    3162 
    3163     $timeOffset = timezone_offset_get($dateTimeZoneSelected, $dateTimeServer);
    3164     $timeOffset = $timeOffset / 3600;
    3165 
    3166     return $timeOffset;
     3152    if ( !wp_timezone_supported() ) {
     3153        return false;
     3154    }
     3155    if ( !$timezone_string = get_option( 'timezone_string' ) ) {
     3156        return false;
     3157    }
     3158
     3159    @date_default_timezone_set( $timezone_string );
     3160    $timezone_object = timezone_open( $timezone_string );
     3161    $datetime_object = date_create();
     3162    if ( false === $timezone_object || false === $datetime_object ) {
     3163        return false;
     3164    }
     3165    return round( timezone_offset_get( $timezone_object, $datetime_object ) / 3600, 2 );
    31673166}
    31683167
    31693168/**
    31703169 * Check for PHP timezone support
    3171  *
    31723170 */
    31733171function wp_timezone_supported() {
    3174     if (function_exists('date_default_timezone_set')
    3175         && function_exists('timezone_identifiers_list')
    3176         && function_exists('timezone_open')
    3177         && function_exists('timezone_offset_get')
    3178         )
    3179         return apply_filters('timezone_support',true);
    3180 
    3181     return apply_filters('timezone_support',false);
     3172    $support = false;
     3173    if (
     3174        function_exists( 'date_default_timezone_set' ) &&
     3175        function_exists( 'timezone_identifiers_list' ) &&
     3176        function_exists( 'timezone_open' ) &&
     3177        function_exists( 'timezone_offset_get' )
     3178    ) {
     3179        $support = true;
     3180    }
     3181    return apply_filters( 'timezone_support', $support );
     3182}
     3183
     3184function _wp_timezone_choice_usort_callback( $a, $b ) {
     3185    // Don't use translated versions of Etc
     3186    if ( 'Etc' === $a['continent'] && 'Etc' === $b['continent'] ) {
     3187        // Make the order of these more like the old dropdown
     3188        if ( 'GMT+' === substr( $a['city'], 0, 4 ) && 'GMT+' === substr( $b['city'], 0, 4 ) ) {
     3189            return -1 * ( strnatcasecmp( $a['city'], $b['city'] ) );
     3190        }
     3191        if ( 'UTC' === $a['city'] ) {
     3192            if ( 'GMT+' === substr( $b['city'], 0, 4 ) ) {
     3193                return 1;
     3194            }
     3195            return -1;
     3196        }
     3197        if ( 'UTC' === $b['city'] ) {
     3198            if ( 'GMT+' === substr( $a['city'], 0, 4 ) ) {
     3199                return -1;
     3200            }
     3201            return 1;
     3202        }
     3203        return strnatcasecmp( $a['city'], $b['city'] );
     3204    }
     3205    if ( $a['t_continent'] == $b['t_continent'] ) {
     3206        if ( $a['t_city'] == $b['t_city'] ) {
     3207            return strnatcasecmp( $a['t_subcity'], $b['t_subcity'] );
     3208        }
     3209        return strnatcasecmp( $a['t_city'], $b['t_city'] );
     3210    } else {
     3211        // Force Etc to the bottom of the list
     3212        if ( 'Etc' === $a['continent'] ) {
     3213            return 1;
     3214        }
     3215        if ( 'Etc' === $b['continent'] ) {
     3216            return -1;
     3217        }
     3218        return strnatcasecmp( $a['t_continent'], $b['t_continent'] );
     3219    }
    31823220}
    31833221
     
    31853223 * Gives a nicely formatted list of timezone strings // temporary! Not in final
    31863224 *
    3187  * @param string $selectedzone - which zone should be the selected one
    3188  *
    3189  */
    3190 function wp_timezone_choice($selectedzone) {
     3225 * @param $selected_zone string Selected Zone
     3226 *
     3227 */
     3228function wp_timezone_choice( $selected_zone ) {
    31913229    static $mo_loaded = false;
    31923230
    3193     $continents = array('Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific', 'Etc');
     3231    $continents = array( 'Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific', 'Etc' );
    31943232
    31953233    // Load translations for continents and cities
    3196     if ( ! $mo_loaded ) {
     3234    if ( !$mo_loaded ) {
    31973235        $locale = get_locale();
    3198         $mofile = WP_LANG_DIR . "/continents-cities-$locale.mo";
    3199         load_textdomain('continents-cities', $mofile);
     3236        $mofile = WP_LANG_DIR . '/continents-cities-' . $locale . '.mo';
     3237        load_textdomain( 'continents-cities', $mofile );
    32003238        $mo_loaded = true;
    32013239    }
    32023240
    3203     $all = timezone_identifiers_list();
    3204 
    3205     $i = 0;
    3206     foreach ( $all as $zone ) {
    3207         $zone = explode('/',$zone);
    3208         if ( ! in_array($zone[0], $continents) )
     3241    $zonen = array();
     3242    foreach ( timezone_identifiers_list() as $zone ) {
     3243        $zone = explode( '/', $zone );
     3244        if ( !in_array( $zone[0], $continents ) ) {
    32093245            continue;
    3210         if ( $zone[0] == 'Etc' && in_array($zone[1], array('UCT', 'GMT', 'GMT0', 'GMT+0', 'GMT-0', 'Greenwich', 'Universal', 'Zulu')) )
     3246        }
     3247        if ( 'Etc' === $zone[0] && in_array( $zone[1], array( 'UCT', 'GMT', 'GMT0', 'GMT+0', 'GMT-0', 'Greenwich', 'Universal', 'Zulu' ) ) ) {
    32113248            continue;
    3212         $zonen[$i]['continent'] = isset($zone[0]) ? $zone[0] : '';
    3213         $zonen[$i]['city'] = isset($zone[1]) ? $zone[1] : '';
    3214         $zonen[$i]['subcity'] = isset($zone[2]) ? $zone[2] : '';
    3215         $i++;
    3216     }
    3217 
    3218     usort($zonen, create_function(
    3219         '$a, $b', '
    3220         $t = create_function(\'$s\', \'return translate(str_replace("_", " ", $s), "continents-cities");\');
    3221         $a_continent = $t($a["continent"]);
    3222         $b_continent = $t($b["continent"]);
    3223         $a_city = $t($a["city"]);
    3224         $b_city = $t($b["city"]);
    3225         $a_subcity = $t($a["subcity"]);
    3226         $b_subcity = $t($b["subcity"]);
    3227         if ( $a_continent == $b_continent && $a_city == $b_city )
    3228             return strnatcasecmp($a_subcity, $b_subcity);
    3229         elseif ( $a_continent == $b_continent )
    3230             return strnatcasecmp($a_city, $b_city);
    3231         else
    3232             return strnatcasecmp($a_continent, $b_continent);
    3233         '));
    3234 
    3235     $structure = '';
    3236     $pad = '&nbsp;&nbsp;&nbsp;';
    3237 
    3238     if ( empty($selectedzone) )
    3239         $structure .= '<option selected="selected" value="">' . __('Select a city') . "</option>\n";
    3240     foreach ( $zonen as $zone ) {
    3241         extract($zone);
    3242         if ( empty($selectcontinent) && !empty($city) ) {
    3243             $selectcontinent = $continent;
    3244             $structure .= '<optgroup label="'. esc_attr( translate( $continent, "continents-cities" ) ) .'">' . "\n"; // continent
    3245         } elseif ( !empty($selectcontinent) && $selectcontinent != $continent ) {
    3246             $structure .= "</optgroup>\n";
    3247             $selectcontinent = '';
    3248             if ( !empty($city) ) {
    3249                 $selectcontinent = $continent;
    3250                 $structure .= '<optgroup label="'. esc_attr( translate( $continent, "continents-cities" ) ) .'">' . "\n"; // continent
     3249        }
     3250
     3251        // This determines what gets set and translated - we don't translate Etc/* strings here, they are done later
     3252        $exists = array(
     3253            0 => ( isset( $zone[0] ) && $zone[0] ) ? true : false,
     3254            1 => ( isset( $zone[1] ) && $zone[1] ) ? true : false,
     3255            2 => ( isset( $zone[2] ) && $zone[2] ) ? true : false
     3256        );
     3257        $exists[3] = ( $exists[0] && 'Etc' !== $zone[0] ) ? true : false;
     3258        $exists[4] = ( $exists[1] && $exists[3] ) ? true : false;
     3259        $exists[5] = ( $exists[2] && $exists[3] ) ? true : false;
     3260
     3261        $zonen[] = array(
     3262            'continent'   => ( $exists[0] ? $zone[0] : '' ),
     3263            'city'        => ( $exists[1] ? $zone[1] : '' ),
     3264            'subcity'     => ( $exists[2] ? $zone[2] : '' ),
     3265            't_continent' => ( $exists[3] ? translate( str_replace( '_', ' ', $zone[0] ), 'continents-cities' ) : '' ),
     3266            't_city'      => ( $exists[4] ? translate( str_replace( '_', ' ', $zone[1] ), 'continents-cities' ) : '' ),
     3267            't_subcity'   => ( $exists[5] ? translate( str_replace( '_', ' ', $zone[2] ), 'continents-cities' ) : '' )
     3268        );
     3269    }
     3270    usort( $zonen, '_wp_timezone_choice_usort_callback' );
     3271
     3272    $structure = array();
     3273
     3274    if ( empty( $selected_zone ) ) {
     3275        $structure[] = '<option selected="selected" value="">' . __( 'Select a city' ) . '</option>';
     3276    }
     3277
     3278    foreach ( $zonen as $key => $zone ) {
     3279        // Build value in an array to join later
     3280        $value = array( $zone['continent'] );
     3281
     3282        if ( empty( $zone['city'] ) ) {
     3283            // It's at the continent level (generally won't happen)
     3284            $display = $zone['t_continent'];
     3285        } else {
     3286            // It's inside a continent group
     3287           
     3288            // Continent optgroup
     3289            if ( !isset( $zonen[$key - 1] ) || $zonen[$key - 1]['continent'] !== $zone['continent'] ) {
     3290                $label = ( 'Etc' === $zone['continent'] ) ? __( 'Manual offsets' ) : $zone['t_continent'];
     3291                $structure[] = '<optgroup label="'. esc_attr( $label ) .'">';
     3292            }
     3293           
     3294            // Add the city to the value
     3295            $value[] = $zone['city'];
     3296            if ( 'Etc' === $zone['continent'] ) {
     3297                if ( 'UTC' === $zone['city'] ) {
     3298                    $display = '';
     3299                } else {
     3300                    $display = str_replace( 'GMT', '', $zone['city'] );
     3301                    $display = strtr( $display, '+-', '-+' ) . ':00';
     3302                }
     3303                $display = sprintf( __( 'UTC %s' ), $display );
     3304            } else {
     3305                $display = $zone['t_city'];
     3306                if ( !empty( $zone['subcity'] ) ) {
     3307                    // Add the subcity to the value
     3308                    $value[] = $zone['subcity'];
     3309                    $display .= ' - ' . $zone['t_subcity'];
     3310                }
    32513311            }
    32523312        }
    32533313
    3254         if ( !empty($city) ) {
    3255             $display = str_replace('_',' ',$city);
    3256             $display = translate($display, "continents-cities");
    3257             if ( !empty($subcity) ) {
    3258                 $display_subcity = str_replace('_', ' ', $subcity);
    3259                 $display_subcity = translate($display_subcity, "continents-cities");
    3260                 $city = $city . '/'. $subcity;
    3261                 $display = $display . '/' . $display_subcity;
    3262             }
    3263             if ( $continent == 'Etc' )
    3264                 $display = strtr($display, '+-', '-+');
    3265             $structure .= "\t<option ".((($continent.'/'.$city)==$selectedzone)?'selected="selected"':'')." value=\"".($continent.'/'.$city)."\">$pad".$display."</option>\n"; //Timezone
    3266         } else {
    3267             $structure .= "<option ".(($continent==$selectedzone)?'selected="selected"':'')." value=\"".$continent."\">" . translate($continent, "continents-cities") . "</option>\n"; //Timezone
     3314        // Build the value
     3315        $value = join( '/', $value );
     3316        $selected = '';
     3317        if ( $value === $selected_zone ) {
     3318            $selected = 'selected="selected" ';
    32683319        }
    3269     }
    3270 
    3271     if ( !empty($selectcontinent) )
    3272         $structure .= "</optgroup>\n";
    3273     return $structure;
     3320        $structure[] = '<option ' . $selected . 'value="' . esc_attr( $value ) . '">' . esc_html( $display ) . "</option>";
     3321       
     3322        // Close continent optgroup
     3323        if ( !empty( $zone['city'] ) && ( !isset($zonen[$key + 1]) || (isset( $zonen[$key + 1] ) && $zonen[$key + 1]['continent'] !== $zone['continent']) ) ) {
     3324            $structure[] = '</optgroup>';
     3325        }
     3326    }
     3327
     3328    return join( "\n", $structure );
    32743329}
    32753330
  • branches/2.8/wp-includes/functions.wp-styles.php

    r11553 r11698  
    9393function wp_style_is( $handle, $list = 'queue' ) {
    9494    global $wp_styles;
    95     if ( !is_a($wp_styles, 'WP_Scripts') )
     95    if ( !is_a($wp_styles, 'WP_Styles') )
    9696        $wp_styles = new WP_Styles();
    9797
  • branches/2.8/wp-includes/http.php

    r11553 r11698  
    7474     * that object to be used later.
    7575     *
    76      * The order for the GET/HEAD requests are HTTP Extension, FSockopen Streams,
    77      * Fopen, and finally cURL. Whilst Fsockopen has the highest overhead, Its
    78      * used 2nd due to high compatibility with most hosts, The HTTP Extension is
    79      * tested first due to hosts which have it enabled, are likely to work
    80      * correctly with it.
     76     * The order for the GET/HEAD requests are Streams, HTTP Extension, Fopen,
     77     * and finally Fsockopen. fsockopen() is used last, because it has the most
     78     * overhead in its implementation. There isn't any real way around it, since
     79     * redirects have to be supported, much the same way the other transports
     80     * also handle redirects.
    8181     *
    8282     * There are currently issues with "localhost" not resolving correctly with
     
    9999                $working_transport['exthttp'] = new WP_Http_ExtHttp();
    100100                $blocking_transport[] = &$working_transport['exthttp'];
    101             } else if ( true === WP_Http_Fsockopen::test($args) ) {
    102                 $working_transport['fsockopen'] = new WP_Http_Fsockopen();
    103                 $blocking_transport[] = &$working_transport['fsockopen'];
     101            } else if ( true === WP_Http_Curl::test($args) ) {
     102                $working_transport['curl'] = new WP_Http_Curl();
     103                $blocking_transport[] = &$working_transport['curl'];
    104104            } else if ( true === WP_Http_Streams::test($args) ) {
    105105                $working_transport['streams'] = new WP_Http_Streams();
     
    108108                $working_transport['fopen'] = new WP_Http_Fopen();
    109109                $blocking_transport[] = &$working_transport['fopen'];
    110             } else if ( true === WP_Http_Curl::test($args) ) {
    111                 $working_transport['curl'] = new WP_Http_Curl();
    112                 $blocking_transport[] = &$working_transport['curl'];
     110            } else if ( true === WP_Http_Fsockopen::test($args) ) {
     111                $working_transport['fsockopen'] = new WP_Http_Fsockopen();
     112                $blocking_transport[] = &$working_transport['fsockopen'];
    113113            }
    114114
     
    150150                $working_transport['exthttp'] = new WP_Http_ExtHttp();
    151151                $blocking_transport[] = &$working_transport['exthttp'];
     152            } else if ( true === WP_Http_Curl::test($args) ) {
     153                $working_transport['curl'] = new WP_Http_Curl();
     154                $blocking_transport[] = &$working_transport['curl'];
     155            } else if ( true === WP_Http_Streams::test($args) ) {
     156                $working_transport['streams'] = new WP_Http_Streams();
     157                $blocking_transport[] = &$working_transport['streams'];
    152158            } else if ( true === WP_Http_Fsockopen::test($args) ) {
    153159                $working_transport['fsockopen'] = new WP_Http_Fsockopen();
    154160                $blocking_transport[] = &$working_transport['fsockopen'];
    155             } else if ( true === WP_Http_Streams::test($args) ) {
    156                 $working_transport['streams'] = new WP_Http_Streams();
    157                 $blocking_transport[] = &$working_transport['streams'];
    158             } else if ( true === WP_Http_Curl::test($args) ) {
    159                 $working_transport['curl'] = new WP_Http_Curl();
    160                 $blocking_transport[] = &$working_transport['curl'];
    161161            }
    162162
     
    240240
    241241        if ( $this->block_request( $url ) )
    242             return new WP_Error('http_request_failed', 'User has blocked requests through HTTP.');
     242            return new WP_Error('http_request_failed', __('User has blocked requests through HTTP.'));
    243243
    244244        // Determine if this is a https call and pass that on to the transport functions
  • branches/2.8/wp-includes/js/tinymce/wp-tinymce.php

    r11553 r11698  
    99
    1010    if ( ! $path || ! @is_file($path) )
    11         return '';
     11        return false;
    1212
    1313    return @file_get_contents($path);
     
    2121header("Cache-Control: public, max-age=$expires_offset");
    2222
    23 if ( isset($_GET['c']) && 1 == $_GET['c'] && false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') ) {
     23if ( isset($_GET['c']) && 1 == $_GET['c'] && false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && ( $file = get_file($basepath . '/wp-tinymce.js.gz') ) ) {
    2424    header('Content-Encoding: gzip');
    25     echo get_file($basepath . '/wp-tinymce.js.gz');
     25    echo $file;
    2626} else {
    2727    echo get_file($basepath . '/wp-tinymce.js');
  • branches/2.8/wp-includes/kses.php

    r11553 r11698  
    120120        'h1' => array(
    121121            'align' => array (),
    122             'class' => array ()),
    123         'h2' => array(
    124             'align' => array (),
    125             'class' => array ()),
    126         'h3' => array(
    127             'align' => array (),
    128             'class' => array ()),
    129         'h4' => array(
    130             'align' => array (),
    131             'class' => array ()),
    132         'h5' => array(
    133             'align' => array (),
    134             'class' => array ()),
    135         'h6' => array(
    136             'align' => array (),
    137             'class' => array ()),
    138         'hr' => array(
     122            'class' => array (),
     123            'id'    => array (),
     124            'style' => array ()),
     125        'h2' => array (
     126            'align' => array (),
     127            'class' => array (),
     128            'id'    => array (),
     129            'style' => array ()),
     130        'h3' => array (
     131            'align' => array (),
     132            'class' => array (),
     133            'id'    => array (),
     134            'style' => array ()),
     135        'h4' => array (
     136            'align' => array (),
     137            'class' => array (),
     138            'id'    => array (),
     139            'style' => array ()),
     140        'h5' => array (
     141            'align' => array (),
     142            'class' => array (),
     143            'id'    => array (),
     144            'style' => array ()),
     145        'h6' => array (
     146            'align' => array (),
     147            'class' => array (),
     148            'id'    => array (),
     149            'style' => array ()),
     150        'hr' => array (
    139151            'align' => array (),
    140152            'class' => array (),
     
    522534                }
    523535
     536            if ( $arreach['name'] == 'style' ) {
     537                $orig_value = $arreach['value'];
     538
     539                $value = safecss_filter_attr($orig_value);
     540
     541                if ( empty($value) )
     542                    continue;
     543
     544                $arreach['value'] = $value;
     545
     546                $arreach['whole'] = str_replace($orig_value, $value, $arreach['whole']);
     547            }
     548
    524549            if ($ok)
    525550                $attr2 .= ' '.$arreach['whole']; # it passed them
     
    11231148add_action('init', 'kses_init');
    11241149add_action('set_current_user', 'kses_init');
    1125 ?>
     1150
     1151function safecss_filter_attr( $css, $deprecated = '' ) {
     1152    $css = wp_kses_no_null($css);
     1153    $css = str_replace(array("\n","\r","\t"), '', $css);
     1154
     1155    if ( preg_match( '%[\\(&]|/\*%', $css ) ) // remove any inline css containing \ ( & or comments
     1156        return '';
     1157
     1158    $css_array = split( ';', trim( $css ) );
     1159    $allowed_attr = apply_filters( 'safe_style_css', array( 'text-align', 'margin', 'color', 'float',
     1160    'border', 'background', 'background-color', 'border-bottom', 'border-bottom-color',
     1161    'border-bottom-style', 'border-bottom-width', 'border-collapse', 'border-color', 'border-left',
     1162    'border-left-color', 'border-left-style', 'border-left-width', 'border-right', 'border-right-color',
     1163    'border-right-style', 'border-right-width', 'border-spacing', 'border-style', 'border-top',
     1164    'border-top-color', 'border-top-style', 'border-top-width', 'border-width', 'caption-side',
     1165    'clear', 'cursor', 'direction', 'font', 'font-family', 'font-size', 'font-style',
     1166    'font-variant', 'font-weight', 'height', 'letter-spacing', 'line-height', 'margin-bottom',
     1167    'margin-left', 'margin-right', 'margin-top', 'overflow', 'padding', 'padding-bottom',
     1168    'padding-left', 'padding-right', 'padding-top', 'text-decoration', 'text-indent', 'vertical-align',
     1169    'width' ) );
     1170
     1171    if ( empty($allowed_attr) )
     1172        return $css;
     1173
     1174    $css = '';
     1175    foreach ( $css_array as $css_item ) {
     1176        if ( $css_item == '' )
     1177            continue;
     1178        $css_item = trim( $css_item );
     1179        $found = false;
     1180        if ( strpos( $css_item, ':' ) === false ) {
     1181            $found = true;
     1182        } else {
     1183            $parts = split( ':', $css_item );
     1184            if ( in_array( trim( $parts[0] ), $allowed_attr ) )
     1185                $found = true;
     1186        }
     1187        if ( $found ) {
     1188            if( $css != '' )
     1189                $css .= ';';
     1190            $css .= $css_item;
     1191        }
     1192    }
     1193
     1194    return $css;
     1195}
  • branches/2.8/wp-includes/l10n.php

    r11553 r11698  
    302302
    303303/**
    304  * Loads MO file into the list of domains.
    305  *
    306  * If the domain already exists, the inclusion will fail. If the MO file is not
    307  * readable, the inclusion will fail.
     304 * Loads a MO file into the domain $domain.
     305 *
     306 * If the domain already exists, the translations will be merged. If both
     307 * sets have the same string, the translation from the original value will be taken.
    308308 *
    309309 * On success, the .mo file will be placed in the $l10n global by $domain
    310  * and will be an gettext_reader object.
     310 * and will be a MO object.
    311311 *
    312312 * @since 1.5.0
    313  * @uses $l10n Gets list of domain translated string (gettext_reader) objects
    314  * @uses CacheFileReader Reads the MO file
    315  * @uses gettext_reader Allows for retrieving translated strings
     313 * @uses $l10n Gets list of domain translated string objects
    316314 *
    317315 * @param string $domain Unique identifier for retrieving translated strings
    318316 * @param string $mofile Path to the .mo file
    319  * @return null On failure returns null and also on success returns nothing.
     317 * @return bool true on success, false on failure
    320318 */
    321319function load_textdomain($domain, $mofile) {
    322320    global $l10n;
    323321
    324     if ( !is_readable($mofile)) return;
     322    if ( !is_readable( $mofile ) ) return false;
    325323
    326324    $mo = new MO();
    327     $mo->import_from_file( $mofile );
    328 
    329     if (isset($l10n[$domain]))
     325    if ( !$mo->import_from_file( $mofile ) ) return false;
     326
     327    if ( isset( $l10n[$domain] ) )
    330328        $mo->merge_with( $l10n[$domain] );
    331329
    332330    $l10n[$domain] = &$mo;
     331    return true;
    333332}
    334333
     
    346345    $mofile = WP_LANG_DIR . "/$locale.mo";
    347346
    348     load_textdomain('default', $mofile);
     347    return load_textdomain('default', $mofile);
    349348}
    350349
     
    373372
    374373    $mofile = $path . '/'. $domain . '-' . $locale . '.mo';
    375     load_textdomain($domain, $mofile);
     374    return load_textdomain($domain, $mofile);
    376375}
    377376
     
    394393
    395394    $mofile = "$path/$locale.mo";
    396     load_textdomain($domain, $mofile);
     395    return load_textdomain($domain, $mofile);
    397396}
    398397
     
    424423 */
    425424function translate_user_role( $name ) {
    426     return before_last_bar( translate_with_gettext_context( $name, 'User role' ) );
     425    return translate_with_gettext_context( before_last_bar($name), 'User role' );
    427426}
    428427?>
  • branches/2.8/wp-includes/link-template.php

    r11553 r11698  
    16941694    $orig_scheme = $scheme;
    16951695    if ( !in_array($scheme, array('http', 'https')) ) {
    1696         if ( ('login_post' == $scheme) && ( force_ssl_login() || force_ssl_admin() ) )
     1696        if ( ( 'login_post' == $scheme || 'rpc' == $scheme ) && ( force_ssl_login() || force_ssl_admin() ) )
    16971697            $scheme = 'https';
    16981698        elseif ( ('login' == $scheme) && ( force_ssl_admin() ) )
  • branches/2.8/wp-includes/pluggable.php

    r11553 r11698  
    881881
    882882    // remove %0d and %0a from location
    883     $strip = array('%0d', '%0a');
    884     $found = true;
    885     while($found) {
    886         $found = false;
    887         foreach( (array) $strip as $val ) {
    888             while(strpos($location, $val) !== false) {
    889                 $found = true;
    890                 $location = str_replace($val, '', $location);
    891             }
    892         }
    893     }
     883    $strip = array('%0d', '%0a', '%0D', '%0A');
     884    $location = _deep_replace($strip, $location);
    894885    return $location;
    895886}
     
    909900 *
    910901 * @since 2.3
    911  * @uses apply_filters() Calls 'allowed_redirect_hosts' on an array containing
    912  *      WordPress host string and $location host string.
     902 * @uses wp_validate_redirect() To validate the redirect is to an allowed host.
    913903 *
    914904 * @return void Does not return anything
     
    919909    $location = wp_sanitize_redirect($location);
    920910
     911    $location = wp_validate_redirect($location, admin_url());
     912
     913    wp_redirect($location, $status);
     914}
     915endif;
     916
     917if ( !function_exists('wp_validate_redirect') ) :
     918/**
     919 * Validates a URL for use in a redirect.
     920 *
     921 * Checks whether the $location is using an allowed host, if it has an absolute
     922 * path. A plugin can therefore set or remove allowed host(s) to or from the
     923 * list.
     924 *
     925 * If the host is not allowed, then the redirect is to $default supplied
     926 *
     927 * @since 2.8.1
     928 * @uses apply_filters() Calls 'allowed_redirect_hosts' on an array containing
     929 *      WordPress host string and $location host string.
     930 *
     931 * @param string $location The redirect to validate
     932 * @param string $default The value to return is $location is not allowed
     933 * @return string redirect-sanitized URL
     934 **/
     935function wp_validate_redirect($location, $default = '') {
    921936    // browsers will assume 'http' is your protocol, and will obey a redirect to a URL starting with '//'
    922937    if ( substr($location, 0, 2) == '//' )
     
    932947
    933948    if ( isset($lp['host']) && ( !in_array($lp['host'], $allowed_hosts) && $lp['host'] != strtolower($wpp['host'])) )
    934         $location = admin_url();
    935 
    936     wp_redirect($location, $status);
     949        $location = $default;
     950
     951    return $location;
    937952}
    938953endif;
  • branches/2.8/wp-includes/plugin.php

    r11553 r11698  
    5454 * @since 0.71
    5555 * @global array $wp_filter Stores all of the filters added in the form of
    56  *  wp_filter['tag']['array of priorities']['array of functions serialized']['array of ['array (functions, accepted_args)]']
     56 *  wp_filter['tag']['array of priorities']['array of functions serialized']['array of ['array (functions, accepted_args)']']
    5757 * @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.
    5858 *
     
    496496    $mu_plugin_dir = preg_replace('|/+|','/', $mu_plugin_dir); // remove any duplicate slash
    497497    $file = preg_replace('#^' . preg_quote($plugin_dir, '#') . '/|^' . preg_quote($mu_plugin_dir, '#') . '/#','',$file); // get relative path from plugins dir
     498    $file = trim($file, '/');
    498499    return $file;
    499500}
  • branches/2.8/wp-includes/pomo/entry.php

    r11553 r11698  
    33 * Contains Translation_Entry class
    44 *
    5  * @version $Id: entry.php 13 2008-04-21 12:03:37Z nbachiyski $
     5 * @version $Id: entry.php 115 2009-05-11 18:56:15Z nbachiyski $
    66 * @package pomo
    77 * @subpackage entry
     
    4949        $object_varnames = array_keys(get_object_vars($this));
    5050        foreach ($args as $varname => $value) {
    51             if (in_array($varname, $object_varnames)) {
    52                 $this->$varname = $value;
    53             }
     51            $this->$varname = $value;
    5452        }
    5553        if (isset($args['plural'])) $this->is_plural = true;
  • branches/2.8/wp-includes/pomo/mo.php

    r11553 r11698  
    33 * Class for working with MO files
    44 *
    5  * @version $Id: mo.php 33 2009-02-16 09:33:39Z nbachiyski $
     5 * @version $Id: mo.php 106 2009-04-23 19:48:22Z nbachiyski $
    66 * @package pomo
    77 * @subpackage mo
     
    1111require_once dirname(__FILE__) . '/streams.php';
    1212
    13 class MO extends Translations {
     13class MO extends Gettext_Translations {
    1414
    1515    var $_nplurals = 2;
    16 
    17     function set_header($header, $value) {
    18         parent::set_header($header, $value);
    19         if ('Plural-Forms' == $header)
    20             $this->_gettext_select_plural_form = $this->_make_gettext_select_plural_form($value);
    21     }
    2216
    2317    /**
     
    3327        return $this->import_from_reader($reader);
    3428    }
     29   
     30    function export_to_file($filename) {
     31        $fh = fopen($filename, 'wb');
     32        if ( !$fh ) return false;
     33        $entries = array_filter($this->entries, create_function('$e', 'return !empty($e->translations);'));
     34        ksort($entries);
     35        $magic = 0x950412de;
     36        $revision = 0;
     37        $total = count($entries) + 1; // all the headers are one entry
     38        $originals_lenghts_addr = 28;
     39        $translations_lenghts_addr = $originals_lenghts_addr + 8 * $total;
     40        $size_of_hash = 0;
     41        $hash_addr = $translations_lenghts_addr + 8 * $total;
     42        $current_addr = $hash_addr;
     43        fwrite($fh, pack('V*', $magic, $revision, $total, $originals_lenghts_addr,
     44            $translations_lenghts_addr, $size_of_hash, $hash_addr));
     45        fseek($fh, $originals_lenghts_addr);
     46       
     47        // headers' msgid is an empty string
     48        fwrite($fh, pack('VV', 0, $current_addr));
     49        $current_addr++;
     50        $originals_table = chr(0);
     51
     52        foreach($entries as $entry) {
     53            $originals_table .= $this->export_original($entry) . chr(0);
     54            $length = strlen($this->export_original($entry));
     55            fwrite($fh, pack('VV', $length, $current_addr));
     56            $current_addr += $length + 1; // account for the NULL byte after
     57        }
     58       
     59        $exported_headers = $this->export_headers();
     60        fwrite($fh, pack('VV', strlen($exported_headers), $current_addr));
     61        $current_addr += strlen($exported_headers) + 1;
     62        $translations_table = $exported_headers . chr(0);
     63       
     64        foreach($entries as $entry) {
     65            $translations_table .= $this->export_translations($entry) . chr(0);
     66            $length = strlen($this->export_translations($entry));
     67            fwrite($fh, pack('VV', $length, $current_addr));
     68            $current_addr += $length + 1;
     69        }
     70       
     71        fwrite($fh, $originals_table);
     72        fwrite($fh, $translations_table);
     73        fclose($fh);
     74    }
     75   
     76    function export_original($entry) {
     77        //TODO: warnings for control characters
     78        $exported = $entry->singular;
     79        if ($entry->is_plural) $exported .= chr(0).$entry->plural;
     80        if (!is_null($entry->context)) $exported = $entry->context . chr(4) . $exported;
     81        return $exported;
     82    }
     83   
     84    function export_translations($entry) {
     85        //TODO: warnings for control characters
     86        return implode(chr(0), $entry->translations);
     87    }
     88   
     89    function export_headers() {
     90        $exported = '';
     91        foreach($this->headers as $header => $value) {
     92            $exported.= "$header: $value\n";
     93        }
     94        return $exported;
     95    }
    3596
    3697    function get_byteorder($magic) {
     
    43104        // 0xde120495
    44105        $magic_big = ((int) - 569244523) && 0xFFFFFFFF;
    45 
     106       
    46107        if ($magic_little == $magic || $magic_little_64 == $magic) {
    47108            return 'little';
     
    64125        $total = $reader->readint32();
    65126        // get addresses of array of lenghts and offsets for original string and translations
    66         $originals_lo_addr = $reader->readint32();
    67         $translations_lo_addr = $reader->readint32();
     127        $originals_lenghts_addr = $reader->readint32();
     128        $translations_lenghts_addr = $reader->readint32();
    68129
    69         $reader->seekto($originals_lo_addr);
    70         $originals_lo = $reader->readint32array($total * 2); // each of
    71         $reader->seekto($translations_lo_addr);
    72         $translations_lo = $reader->readint32array($total * 2);
     130        $reader->seekto($originals_lenghts_addr);
     131        $originals_lenghts = $reader->readint32array($total * 2); // each of
     132        $reader->seekto($translations_lenghts_addr);
     133        $translations_lenghts = $reader->readint32array($total * 2);
    73134
    74135        $length = create_function('$i', 'return $i * 2 + 1;');
     
    76137
    77138        for ($i = 0; $i < $total; ++$i) {
    78             $reader->seekto($originals_lo[$offset($i)]);
    79             $original = $reader->read($originals_lo[$length($i)]);
    80             $reader->seekto($translations_lo[$offset($i)]);
    81             $translation = $reader->read($translations_lo[$length($i)]);
     139            $reader->seekto($originals_lenghts[$offset($i)]);
     140            $original = $reader->read($originals_lenghts[$length($i)]);
     141            $reader->seekto($translations_lenghts[$offset($i)]);
     142            $translation = $reader->read($translations_lenghts[$length($i)]);
    82143            if ('' == $original) {
    83144                $this->set_headers($this->make_headers($translation));
     
    87148        }
    88149        return true;
    89     }
    90 
    91     function make_headers($translation) {
    92         $headers = array();
    93         $lines = explode("\n", $translation);
    94         foreach($lines as $line) {
    95             $parts = explode(':', $line, 2);
    96             if (!isset($parts[1])) continue;
    97             $headers[trim($parts[0])] = trim($parts[1]);
    98         }
    99         return $headers;
    100150    }
    101151
  • branches/2.8/wp-includes/pomo/po.php

    r11553 r11698  
    33 * Class for working with PO files
    44 *
    5  * @version $Id: po.php 33 2009-02-16 09:33:39Z nbachiyski $
     5 * @version $Id: po.php 123 2009-05-13 19:35:43Z nbachiyski $
    66 * @package pomo
    77 * @subpackage po
     
    1717 * Routines for working with PO files
    1818 */
    19 class PO extends Translations {
    20 
     19class PO extends Gettext_Translations {
     20   
    2121
    2222    /**
     
    7676    }
    7777
    78 
    7978    /**
    8079     * Formats a string in PO-style
     
    8887        $slash = '\\';
    8988        $newline = "\n";
    90         $tab = "\t";
    9189
    9290        $replaces = array(
    9391            "$slash"    => "$slash$slash",
    94             "$tab"      => '\t',
    9592            "$quote"    => "$slash$quote",
     93            "\t"        => '\t',
    9694        );
     95
    9796        $string = str_replace(array_keys($replaces), array_values($replaces), $string);
    9897
    99         $po = array();
    100         foreach (explode($newline, $string) as $line) {
    101             $po[] = wordwrap($line, PO_MAX_LINE_LEN - 2, " $quote$newline$quote");
    102         }
    103         $po = $quote.implode("${slash}n$quote$newline$quote", $po).$quote;
     98        $po = $quote.implode("${slash}n$quote$newline$quote", explode($newline, $string)).$quote;
    10499        // add empty string on first line for readbility
    105         if (false !== strpos($po, $newline)) {
     100        if (false !== strpos($string, $newline) &&
     101                (substr_count($string, $newline) > 1 || !($newline === substr($string, -strlen($newline))))) {
    106102            $po = "$quote$quote$newline$po";
    107103        }
     
    110106        return $po;
    111107    }
    112 
    113     /**
    114      * Inserts $with in the beginning of every new line of $string and
     108   
     109    /**
     110     * Gives back the original string from a PO-formatted string
     111     *
     112     * @static
     113     * @param string $string PO-formatted string
     114     * @return string enascaped string
     115     */
     116    function unpoify($string) {
     117        $escapes = array('t' => "\t", 'n' => "\n", '\\' => '\\');
     118        $lines = array_map('trim', explode("\n", $string));
     119        $lines = array_map(array('PO', 'trim_quotes'), $lines);
     120        $unpoified = '';
     121        $previous_is_backslash = false;
     122        foreach($lines as $line) {
     123            preg_match_all('/./u', $line, $chars);
     124            $chars = $chars[0];
     125            foreach($chars as $char) {
     126                if (!$previous_is_backslash) {
     127                    if ('\\' == $char)
     128                        $previous_is_backslash = true;
     129                    else
     130                        $unpoified .= $char;
     131                } else {
     132                    $previous_is_backslash = false;
     133                    $unpoified .= isset($escapes[$char])? $escapes[$char] : $char;
     134                }
     135            }
     136        }
     137        return $unpoified;
     138    }
     139
     140    /**
     141     * Inserts $with in the beginning of every new line of $string and
    115142     * returns the modified string
    116143     *
     
    158185        if (!empty($entry->extracted_comments)) $po[] = PO::comment_block($entry->extracted_comments, '.');
    159186        if (!empty($entry->references)) $po[] = PO::comment_block(implode(' ', $entry->references), ':');
    160         if (!empty($entry->flags)) $po[] = PO::comment_block(implode("\n", $entry->flags), ',');
     187        if (!empty($entry->flags)) $po[] = PO::comment_block(implode(", ", $entry->flags), ',');
    161188        if (!is_null($entry->context)) $po[] = 'msgctxt '.PO::poify($entry->context);
    162189        $po[] = 'msgid '.PO::poify($entry->singular);
     
    174201    }
    175202
     203    function import_from_file($filename) {
     204        $f = fopen($filename, 'r');
     205        if (!$f) return false;
     206        $lineno = 0;
     207        while (true) {
     208            $res = $this->read_entry($f, $lineno);
     209            if (!$res) break;
     210            if ($res['entry']->singular == '') {
     211                $this->set_headers($this->make_headers($res['entry']->translations[0]));
     212            } else {
     213                $this->add_entry($res['entry']);
     214            }
     215        }
     216        PO::read_line($f, 'clear');
     217        return $res !== false;
     218    }
     219   
     220    function read_entry($f, $lineno = 0) {
     221        $entry = new Translation_Entry();
     222        // where were we in the last step
     223        // can be: comment, msgctxt, msgid, msgid_plural, msgstr, msgstr_plural
     224        $context = '';
     225        $msgstr_index = 0;
     226        $is_final = create_function('$context', 'return $context == "msgstr" || $context == "msgstr_plural";');
     227        while (true) {
     228            $lineno++;
     229            $line = PO::read_line($f);
     230            if (!$line)  {
     231                if (feof($f)) {
     232                    if ($is_final($context))
     233                        break;
     234                    elseif (!$context) // we haven't read a line and eof came
     235                        return null;
     236                    else
     237                        return false;
     238                } else {
     239                    return false;
     240                }
     241            }
     242            if ($line == "\n") continue;
     243            $line = trim($line);
     244            if (preg_match('/^#/', $line, $m)) {
     245                // the comment is the start of a new entry
     246                if ($is_final($context)) {
     247                    PO::read_line($f, 'put-back');
     248                    $lineno--;
     249                    break;
     250                }
     251                // comments have to be at the beginning
     252                if ($context && $context != 'comment') {
     253                    return false;
     254                }
     255                // add comment
     256                $this->add_comment_to_entry($entry, $line);;
     257            } elseif (preg_match('/^msgctxt\s+(".*")/', $line, $m)) {
     258                if ($is_final($context)) {
     259                    PO::read_line($f, 'put-back');
     260                    $lineno--;
     261                    break;
     262                }
     263                if ($context && $context != 'comment') {
     264                    return false;
     265                }
     266                $context = 'msgctxt';
     267                $entry->context .= PO::unpoify($m[1]);
     268            } elseif (preg_match('/^msgid\s+(".*")/', $line, $m)) {
     269                if ($is_final($context)) {
     270                    PO::read_line($f, 'put-back');
     271                    $lineno--;
     272                    break;
     273                }
     274                if ($context && $context != 'msgctxt' && $context != 'comment') {
     275                    return false;
     276                }
     277                $context = 'msgid';
     278                $entry->singular .= PO::unpoify($m[1]);
     279            } elseif (preg_match('/^msgid_plural\s+(".*")/', $line, $m)) {
     280                if ($context != 'msgid') {
     281                    return false;
     282                }
     283                $context = 'msgid_plural';
     284                $entry->is_plural = true;
     285                $entry->plural .= PO::unpoify($m[1]);
     286            } elseif (preg_match('/^msgstr\s+(".*")/', $line, $m)) {
     287                if ($context != 'msgid') {
     288                    return false;
     289                }
     290                $context = 'msgstr';
     291                $entry->translations = array(PO::unpoify($m[1]));
     292            } elseif (preg_match('/^msgstr\[(\d+)\]\s+(".*")/', $line, $m)) {
     293                if ($context != 'msgid_plural' && $context != 'msgstr_plural') {
     294                    return false;
     295                }
     296                $context = 'msgstr_plural';
     297                $msgstr_index = $m[1];
     298                $entry->translations[$m[1]] = PO::unpoify($m[2]);
     299            } elseif (preg_match('/^".*"$/', $line)) {
     300                $unpoified = PO::unpoify($line);
     301                switch ($context) {
     302                    case 'msgid':
     303                        $entry->singular .= $unpoified; break;
     304                    case 'msgctxt':
     305                        $entry->context .= $unpoified; break;
     306                    case 'msgid_plural':
     307                        $entry->plural .= $unpoified; break;
     308                    case 'msgstr':
     309                        $entry->translations[0] .= $unpoified; break;
     310                    case 'msgstr_plural':
     311                        $entry->translations[$msgstr_index] .= $unpoified; break;
     312                    default:
     313                        return false;
     314                }
     315            } else {
     316                return false;
     317            }
     318        }
     319        if (array() == array_filter($entry->translations)) $entry->translations = array();
     320        return array('entry' => $entry, 'lineno' => $lineno);
     321    }
     322   
     323    function read_line($f, $action = 'read') {
     324        static $last_line = '';
     325        static $use_last_line = false;
     326        if ('clear' == $action) {
     327            $last_line = '';
     328            return true;
     329        }
     330        if ('put-back' == $action) {
     331            $use_last_line = true;
     332            return true;
     333        }
     334        $line = $use_last_line? $last_line : fgets($f);
     335        $last_line = $line;
     336        $use_last_line = false;
     337        return $line;
     338    }
     339   
     340    function add_comment_to_entry(&$entry, $po_comment_line) {
     341        $first_two = substr($po_comment_line, 0, 2);
     342        $comment = trim(substr($po_comment_line, 2));
     343        if ('#:' == $first_two) {
     344            $entry->references = array_merge($entry->references, preg_split('/\s+/', $comment));
     345        } elseif ('#.' == $first_two) {
     346            $entry->extracted_comments = trim($entry->extracted_comments . "\n" . $comment);
     347        } elseif ('#,' == $first_two) {
     348            $entry->flags = array_merge($entry->flags, preg_split('/,\s*/', $comment));
     349        } else {
     350            $entry->translator_comments = trim($entry->translator_comments . "\n" . $comment);
     351        }
     352    }
     353   
     354    function trim_quotes($s) {
     355        if ( substr($s, 0, 1) == '"') $s = substr($s, 1);
     356        if ( substr($s, -1, 1) == '"') $s = substr($s, 0, -1);
     357        return $s;
     358    }
    176359}
    177360?>
  • branches/2.8/wp-includes/pomo/streams.php

    r11553 r11698  
    44 * Based on the classes from Danilo Segan <danilo@kvota.net>
    55 *
    6  * @version $Id: streams.php 33 2009-02-16 09:33:39Z nbachiyski $
     6 * @version $Id: streams.php 138 2009-06-23 13:22:09Z nbachiyski $
    77 * @package pomo
    88 * @subpackage streams
     
    1818  var $_str;
    1919
    20   function POMO_StringReader($str = '') {
    21     $this->_str = $str;
    22     $this->_pos = 0;
    23   }
     20    function POMO_StringReader($str = '') {
     21        $this->_str = $str;
     22        $this->_pos = 0;
     23        $this->is_overloaded = ((ini_get("mbstring.func_overload") & 2) != 0) && function_exists('mb_substr');
     24    }
    2425
    25   function read($bytes) {
    26     $data = substr($this->_str, $this->_pos, $bytes);
    27     $this->_pos += $bytes;
    28     if (strlen($this->_str)<$this->_pos)
    29       $this->_pos = strlen($this->_str);
     26    function _substr($string, $start, $length) {
     27        if ($this->is_overloaded) {
     28            return mb_substr($string,$start,$length,'ascii');
     29        } else {
     30            return substr($string,$start,$length);
     31        }
     32    }
     33   
     34    function _strlen($string) {
     35        if ($this->is_overloaded) {
     36            return mb_strlen($string,'ascii');
     37        } else {
     38            return strlen($string);
     39        }
     40    }
    3041
    31     return $data;
    32   }
     42    function read($bytes) {
     43        $data = $this->_substr($this->_str, $this->_pos, $bytes);
     44        $this->_pos += $bytes;
     45        if ($this->_strlen($this->_str) < $this->_pos) $this->_pos = $this->_strlen($this->_str);
     46        return $data;
     47    }
    3348
    34   function seekto($pos) {
    35     $this->_pos = $pos;
    36     if (strlen($this->_str)<$this->_pos)
    37       $this->_pos = strlen($this->_str);
    38     return $this->_pos;
    39   }
     49    function seekto($pos) {
     50        $this->_pos = $pos;
     51        if ($this->_strlen($this->_str) < $this->_pos) $this->_pos = $this->_strlen($this->_str);
     52        return $this->_pos;
     53    }
    4054
    41   function pos() {
    42     return $this->_pos;
    43   }
     55    function pos() {
     56        return $this->_pos;
     57    }
    4458
    45   function length() {
    46     return strlen($this->_str);
    47   }
     59    function length() {
     60        return $this->_strlen($this->_str);
     61    }
    4862
    4963}
     
    5468class POMO_CachedFileReader extends POMO_StringReader {
    5569    function POMO_CachedFileReader($filename) {
     70        parent::POMO_StringReader();
    5671        $this->_str = file_get_contents($filename);
    5772        if (false === $this->_str)
    5873            return false;
    59         $this->pos = 0;
     74        $this->_pos = 0;
    6075    }
    6176}
     
    97112    function readint32() {
    98113        $bytes = $this->read(4);
    99         if (4 != strlen($bytes))
     114        if (4 != $this->_strlen($bytes))
    100115            return false;
    101116        $endian_letter = ('big' == $this->endian)? 'N' : 'V';
     
    113128    function readint32array($count) {
    114129        $bytes = $this->read(4 * $count);
    115         if (4*$count != strlen($bytes))
     130        if (4*$count != $this->_strlen($bytes))
    116131            return false;
    117132        $endian_letter = ('big' == $this->endian)? 'N' : 'V';
  • branches/2.8/wp-includes/pomo/translations.php

    r11553 r11698  
    33 * Class for a set of entries for translation and their associated headers
    44 *
    5  * @version $Id: translations.php 35 2009-02-16 12:54:57Z nbachiyski $
     5 * @version $Id: translations.php 114 2009-05-11 17:30:38Z nbachiyski $
    66 * @package pomo
    77 * @subpackage translations
     
    2020     * @return bool true on success, false if the entry doesn't have a key
    2121     */
    22     function add_entry(&$entry) {
     22    function add_entry($entry) {
     23        if (is_array($entry)) {
     24            $entry = new Translation_Entry($entry);
     25        }
    2326        $key = $entry->key();
    2427        if (false === $key) return false;
    25         $this->entries[$key] = &$entry;
     28        $this->entries[$key] = $entry;
    2629        return true;
    2730    }
     
    8891        if ($translated && 0 <= $index && $index < $total_plural_forms &&
    8992                is_array($translated->translations) &&
    90                 count($translated->translations) == $total_plural_forms)
     93                isset($translated->translations[$index]))
    9194            return $translated->translations[$index];
    9295        else
     
    9497    }
    9598
     99    /**
     100     * Merge $other in the current object.
     101     *
     102     * @param Object &$other Another Translation object, whose translations will be merged in this one
     103     * @return void
     104     **/
     105    function merge_with(&$other) {
     106        $this->entries = array_merge($this->entries, $other->entries);
     107    }
     108}
     109
     110class Gettext_Translations extends Translations {
    96111    /**
    97112     * The gettext implmentation of select_plural_form.
     
    131146     * Adds parantheses to the inner parts of ternary operators in
    132147     * plural expressions, because PHP evaluates ternary oerators from left to right
    133      *
     148     * 
    134149     * @param string $expression the expression without parentheses
    135150     * @return string the expression with parentheses added
     
    159174        return rtrim($res, ';');
    160175    }
     176   
     177    function make_headers($translation) {
     178        $headers = array();
     179        // sometimes \ns are used instead of real new lines
     180        $translation = str_replace('\n', "\n", $translation);
     181        $lines = explode("\n", $translation);
     182        foreach($lines as $line) {
     183            $parts = explode(':', $line, 2);
     184            if (!isset($parts[1])) continue;
     185            $headers[trim($parts[0])] = trim($parts[1]);
     186        }
     187        return $headers;
     188    }
    161189
    162     /**
    163      * Merge $other in the current object.
    164      *
    165      * @param Object &$other Another Translation object, whose translations will be merged in this one
    166      * @return void
    167      **/
    168     function merge_with(&$other) {
    169         $this->entries = array_merge($this->entries, $other->entries);
     190    function set_header($header, $value) {
     191        parent::set_header($header, $value);
     192        if ('Plural-Forms' == $header)
     193            $this->_gettext_select_plural_form = $this->_make_gettext_select_plural_form($value);
    170194    }
     195
     196   
    171197}
    172198
  • branches/2.8/wp-includes/post-template.php

    r11553 r11698  
    431431            $classes[] = 'page-parent';
    432432
    433         if ( $wp_query->post->post_parent )
     433        if ( $wp_query->post->post_parent ) {
    434434            $classes[] = 'page-child';
    435435            $classes[] = 'parent-pageid-' . $wp_query->post->post_parent;
    436 
    437         if ( is_page_template() )
     436        }
     437        if ( is_page_template() ) {
    438438            $classes[] = 'page-template';
    439439            $classes[] = 'page-template-' . str_replace( '.php', '-php', get_post_meta( $pageID, '_wp_page_template', true ) );
     440        }
    440441    } elseif ( is_search() ) {
    441442        if ( !empty($wp_query->posts) )
     
    806807 */
    807808function wp_page_menu( $args = array() ) {
    808     $defaults = array('sort_column' => 'post_title', 'menu_class' => 'menu', 'echo' => true, 'link_before' => '', 'link_after' => '');
     809    $defaults = array('sort_column' => 'menu_order, post_title', 'menu_class' => 'menu', 'echo' => true, 'link_before' => '', 'link_after' => '');
    809810    $args = wp_parse_args( $args, $defaults );
    810811    $args = apply_filters( 'wp_page_menu_args', $args );
  • branches/2.8/wp-includes/post.php

    r11553 r11698  
    11931193            clean_page_cache($child->ID);
    11941194
    1195         $wp_rewrite->flush_rules();
     1195        $wp_rewrite->flush_rules(false);
    11961196    } else {
    11971197        clean_post_cache($postid);
     
    33553355        if ( !defined('WP_IMPORTING') ) {
    33563356            global $wp_rewrite;
    3357             $wp_rewrite->flush_rules();
     3357            $wp_rewrite->flush_rules(false);
    33583358        }
    33593359    } else {
  • branches/2.8/wp-includes/query.php

    r11553 r11698  
    12351235        $qv['w'] = absint($qv['w']);
    12361236        $qv['m'] = absint($qv['m']);
     1237        $qv['paged'] = absint($qv['paged']);
    12371238        $qv['cat'] = preg_replace( '|[^0-9,-]|', '', $qv['cat'] ); // comma separated list of positive or negative integers
    12381239        $qv['pagename'] = trim( $qv['pagename'] );
  • branches/2.8/wp-includes/rewrite.php

    r11553 r11698  
    18231823     * @since 2.0.1
    18241824     * @access public
    1825      */
    1826     function flush_rules() {
     1825     * @param $hard bool Whether to update .htaccess (hard flush) or just update rewrite_rules transient (soft flush). Default is true (hard).
     1826     */
     1827    function flush_rules($hard = true) {
    18271828        delete_transient('rewrite_rules');
    18281829        $this->wp_rewrite_rules();
    1829         if ( function_exists('save_mod_rewrite_rules') )
     1830        if ( $hard && function_exists('save_mod_rewrite_rules') )
    18301831            save_mod_rewrite_rules();
    1831         if ( function_exists('iis7_save_url_rewrite_rules') )
     1832        if ( $hard && function_exists('iis7_save_url_rewrite_rules') )
    18321833            iis7_save_url_rewrite_rules();
    18331834    }
  • branches/2.8/wp-includes/script-loader.php

    r11553 r11698  
    241241        $scripts->add_data( 'user-profile', 'group', 1 );
    242242
    243         $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20090209' );
     243        $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20090627' );
    244244        $scripts->add_data( 'admin-comments', 'group', 1 );
    245245        $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
     
    250250        $scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", false, '3517m' );
    251251
    252         $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20090327' );
     252        $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20090618' );
    253253        $scripts->add_data( 'postbox', 'group', 1 );
    254254        $scripts->localize( 'postbox', 'postboxL10n', array(
     
    265265        ) );
    266266
    267         $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox', 'slug'), '20090526' );
     267        $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox', 'slug'), '20090624' );
    268268        $scripts->add_data( 'post', 'group', 1 );
    269269        $scripts->localize( 'post', 'postL10n', array(
     
    378378        $scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array('jquery'), '1.2' );
    379379
    380         $scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox' ), '20090201' );
     380        $scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox' ), '20090618' );
    381381        $scripts->add_data( 'dashboard', 'group', 1 );
    382382
     
    422422
    423423    // all colors stylesheets need to have the same query strings (cache manifest compat)
    424     $colors_version = '20090610';
    425 
    426     $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20090610' );
     424    $colors_version = '20090625';
     425
     426    $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20090625' );
    427427    $styles->add_data( 'wp-admin', 'rtl', '/wp-admin/rtl.css' );
    428428
    429     $styles->add( 'ie', '/wp-admin/css/ie.css', array(), '20090514' );
     429    $styles->add( 'ie', '/wp-admin/css/ie.css', array(), '20090630' );
    430430    $styles->add_data( 'ie', 'conditional', 'lte IE 7' );
    431431
     
    439439    $styles->add_data( 'colors-classic', 'rtl', true );
    440440
    441     $styles->add( 'global', '/wp-admin/css/global.css', array(), '20090514' );
     441    $styles->add( 'global', '/wp-admin/css/global.css', array(), '20090630' );
    442442    $styles->add( 'media', '/wp-admin/css/media.css', array(), '20090516' );
    443443    $styles->add( 'widgets', '/wp-admin/css/widgets.css', array(), '20090603' );
    444444    $styles->add( 'dashboard', '/wp-admin/css/dashboard.css', array(), '20090514' );
    445445    $styles->add( 'install', '/wp-admin/css/install.css', array(), '20090514' );
    446     $styles->add( 'theme-editor', '/wp-admin/css/theme-editor.css', array(), '20090514' );
     446    $styles->add( 'theme-editor', '/wp-admin/css/theme-editor.css', array(), '20090625' );
    447447    $styles->add( 'press-this', '/wp-admin/css/press-this.css', array(), '20090514' );
    448448    $styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array(), '20090514' );
  • branches/2.8/wp-includes/update.php

    r11553 r11698  
    116116    $new_option = new stdClass;
    117117    $new_option->last_checked = time();
    118     $timeout = 'load-plugins.php' == current_filter() ? 360 : 43200; //Check for updated every 60 minutes if hitting the themes page, Else, check every 12 hours
     118    $timeout = 'load-plugins.php' == current_filter() ? 3600 : 43200; //Check for updated every 60 minutes if hitting the themes page, Else, check every 12 hours
    119119    $time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked );
    120120
     
    199199    $new_option = new stdClass;
    200200    $new_option->last_checked = time( );
    201     $timeout = 'load-themes.php' == current_filter() ? 360 : 43200; //Check for updated every 60 minutes if hitting the themes page, Else, check every 12 hours
     201    $timeout = 'load-themes.php' == current_filter() ? 3600 : 43200; //Check for updated every 60 minutes if hitting the themes page, Else, check every 12 hours
    202202    $time_not_changed = isset( $current_theme->last_checked ) && $timeout > ( time( ) - $current_theme->last_checked );
    203203
  • branches/2.8/wp-includes/version.php

    r11553 r11698  
    99 * @global string $wp_version
    1010 */
    11 $wp_version = '2.8.1-rare';
     11$wp_version = '2.8.1-RC1';
    1212
    1313/**
     
    3030 * @global string $manifest_version
    3131 */
    32 $manifest_version = '20090610';
     32$manifest_version = '20090616';
  • branches/2.8/wp-includes/widgets.php

    r11553 r11698  
    886886    global $wp_registered_widgets;
    887887
    888     $sidebars_widgets = wp_get_sidebars_widgets(false);
     888    $sidebars_widgets = wp_get_sidebars_widgets();
    889889
    890890    if ( is_array($sidebars_widgets) ) {
     
    936936function is_active_sidebar( $index ) {
    937937    $index = ( is_int($index) ) ? "sidebar-$index" : sanitize_title($index);
    938     $sidebars_widgets = get_option( 'sidebars_widgets', array() );
     938    $sidebars_widgets = wp_get_sidebars_widgets();
    939939    if ( isset($sidebars_widgets[$index]) && !empty($sidebars_widgets[$index]) )
    940940        return true;
     
    954954 * @access private
    955955 *
    956  * @param bool $update Optional, default is true. Whether to save upgrade of widget array list.
    957  * @return array Upgraded list of widgets to version 2 array format.
    958  */
    959 function wp_get_sidebars_widgets($update = true) {
     956 * @param bool $update Optional, deprecated.
     957 * @return array Upgraded list of widgets to version 3 array format when called from the admin.
     958 */
     959function wp_get_sidebars_widgets($deprecated = true) {
    960960    global $wp_registered_widgets, $wp_registered_sidebars, $_wp_sidebars_widgets;
    961961
    962962    // If loading from front page, consult $_wp_sidebars_widgets rather than options
    963963    // to see if wp_convert_widget_settings() has made manipulations in memory.
    964     if ( is_admin() ) {
     964    if ( !is_admin() ) {
     965        if ( empty($_wp_sidebars_widgets) )
     966            $_wp_sidebars_widgets = get_option('sidebars_widgets', array());
     967
     968        $sidebars_widgets = $_wp_sidebars_widgets;
     969    } else {
    965970        $sidebars_widgets = get_option('sidebars_widgets', array());
    966     } else {
    967         if ( empty($_wp_sidebars_widgets) )
    968             $sidebars_widgets = get_option('sidebars_widgets', array());
    969         else
    970             $sidebars_widgets = &$_wp_sidebars_widgets;
    971     }
    972     $_sidebars_widgets = array();
    973 
    974     if ( !isset($sidebars_widgets['array_version']) )
    975         $sidebars_widgets['array_version'] = 1;
    976 
    977     switch ( $sidebars_widgets['array_version'] ) {
    978         case 1 :
    979             foreach ( (array) $sidebars_widgets as $index => $sidebar )
    980             if ( is_array($sidebar) )
    981             foreach ( (array) $sidebar as $i => $name ) {
    982                 $id = strtolower($name);
    983                 if ( isset($wp_registered_widgets[$id]) ) {
    984                     $_sidebars_widgets[$index][$i] = $id;
    985                     continue;
     971        $_sidebars_widgets = array();
     972
     973        if ( isset($sidebars_widgets['wp_inactive_widgets']) )
     974            $sidebars_widgets['array_version'] = 3;
     975        elseif ( !isset($sidebars_widgets['array_version']) )
     976            $sidebars_widgets['array_version'] = 1;
     977
     978        switch ( $sidebars_widgets['array_version'] ) {
     979            case 1 :
     980                foreach ( (array) $sidebars_widgets as $index => $sidebar )
     981                if ( is_array($sidebar) )
     982                foreach ( (array) $sidebar as $i => $name ) {
     983                    $id = strtolower($name);
     984                    if ( isset($wp_registered_widgets[$id]) ) {
     985                        $_sidebars_widgets[$index][$i] = $id;
     986                        continue;
     987                    }
     988                    $id = sanitize_title($name);
     989                    if ( isset($wp_registered_widgets[$id]) ) {
     990                        $_sidebars_widgets[$index][$i] = $id;
     991                        continue;
     992                    }
     993
     994                    $found = false;
     995
     996                    foreach ( $wp_registered_widgets as $widget_id => $widget ) {
     997                        if ( strtolower($widget['name']) == strtolower($name) ) {
     998                            $_sidebars_widgets[$index][$i] = $widget['id'];
     999                            $found = true;
     1000                            break;
     1001                        } elseif ( sanitize_title($widget['name']) == sanitize_title($name) ) {
     1002                            $_sidebars_widgets[$index][$i] = $widget['id'];
     1003                            $found = true;
     1004                            break;
     1005                        }
     1006                    }
     1007
     1008                    if ( $found )
     1009                        continue;
     1010
     1011                    unset($_sidebars_widgets[$index][$i]);
    9861012                }
    987                 $id = sanitize_title($name);
    988                 if ( isset($wp_registered_widgets[$id]) ) {
    989                     $_sidebars_widgets[$index][$i] = $id;
    990                     continue;
    991                 }
    992 
    993                 $found = false;
    994 
    995                 foreach ( $wp_registered_widgets as $widget_id => $widget ) {
    996                     if ( strtolower($widget['name']) == strtolower($name) ) {
    997                         $_sidebars_widgets[$index][$i] = $widget['id'];
    998                         $found = true;
    999                         break;
    1000                     } elseif ( sanitize_title($widget['name']) == sanitize_title($name) ) {
    1001                         $_sidebars_widgets[$index][$i] = $widget['id'];
    1002                         $found = true;
    1003                         break;
    1004                     }
    1005                 }
    1006 
    1007                 if ( $found )
    1008                     continue;
    1009 
    1010                 unset($_sidebars_widgets[$index][$i]);
    1011             }
    1012             $_sidebars_widgets['array_version'] = 2;
    1013             $sidebars_widgets = $_sidebars_widgets;
    1014             unset($_sidebars_widgets);
    1015 
    1016         case 2 :
    1017             $sidebars = array_keys( $wp_registered_sidebars );
    1018             if ( !empty( $sidebars ) ) {
    1019                 // Move the known-good ones first
    1020                 foreach ( (array) $sidebars as $id ) {
    1021                     if ( array_key_exists( $id, $sidebars_widgets ) ) {
    1022                         $_sidebars_widgets[$id] = $sidebars_widgets[$id];
    1023                         unset($sidebars_widgets[$id], $sidebars[$id]);
    1024                     }
    1025                 }
    1026 
    1027                 // Assign to each unmatched registered sidebar the first available orphan
    1028                 unset( $sidebars_widgets[ 'array_version' ] );
    1029                 while ( ( $sidebar = array_shift( $sidebars ) ) && $widgets = array_shift( $sidebars_widgets ) )
    1030                     $_sidebars_widgets[ $sidebar ] = $widgets;
    1031 
    1032                 $_sidebars_widgets['array_version'] = 3;
     1013                $_sidebars_widgets['array_version'] = 2;
    10331014                $sidebars_widgets = $_sidebars_widgets;
    10341015                unset($_sidebars_widgets);
    1035             }
    1036 
    1037             if ( $update && is_admin() )
    1038                 update_option('sidebars_widgets', $sidebars_widgets);
     1016
     1017            case 2 :
     1018                $sidebars = array_keys( $wp_registered_sidebars );
     1019                if ( !empty( $sidebars ) ) {
     1020                    // Move the known-good ones first
     1021                    foreach ( (array) $sidebars as $id ) {
     1022                        if ( array_key_exists( $id, $sidebars_widgets ) ) {
     1023                            $_sidebars_widgets[$id] = $sidebars_widgets[$id];
     1024                            unset($sidebars_widgets[$id], $sidebars[$id]);
     1025                        }
     1026                    }
     1027
     1028                    // move the rest to wp_inactive_widgets
     1029                    if ( !isset($_sidebars_widgets['wp_inactive_widgets']) )
     1030                        $_sidebars_widgets['wp_inactive_widgets'] = array();
     1031
     1032                    if ( !empty($sidebars_widgets) ) {
     1033                        foreach ( $sidebars_widgets as $lost => $val ) {
     1034                            if ( is_array($val) )
     1035                                $_sidebars_widgets['wp_inactive_widgets'] = array_merge( (array) $_sidebars_widgets['wp_inactive_widgets'], $val );
     1036                        }
     1037                    }
     1038
     1039                    $sidebars_widgets = $_sidebars_widgets;
     1040                    unset($_sidebars_widgets);
     1041                }
     1042        }
    10391043    }
    10401044
     
    10871091 */
    10881092function wp_convert_widget_settings($base_name, $option_name, $settings) {
    1089     global $_wp_sidebars_widgets;
    10901093    // This test may need expanding.
    1091     $single = false;
     1094    $single = $changed = false;
    10921095    if ( empty($settings) ) {
    10931096        $single = true;
     
    11111114        } else {
    11121115            if ( empty($GLOBALS['_wp_sidebars_widgets']) )
    1113                 $GLOBALS['_wp_sidebars_widgets'] = get_option('sidebars_widgets');
     1116                $GLOBALS['_wp_sidebars_widgets'] = get_option('sidebars_widgets', array());
    11141117            $sidebars_widgets = &$GLOBALS['_wp_sidebars_widgets'];
    11151118        }
     
    11201123                    if ( $base_name == $name ) {
    11211124                        $sidebars_widgets[$index][$i] = "$name-2";
     1125                        $changed = true;
    11221126                        break 2;
    11231127                    }
     
    11261130        }
    11271131
    1128         if ( is_admin() )
     1132        if ( is_admin() && $changed )
    11291133            update_option('sidebars_widgets', $sidebars_widgets);
    11301134    }
  • branches/2.8/wp-settings.php

    r11553 r11698  
    6161    $blog_id = 1;
    6262
    63 // Fix for IIS, which doesn't set REQUEST_URI
    64 if ( empty( $_SERVER['REQUEST_URI'] ) ) {
     63// Fix for IIS when running with PHP ISAPI
     64if ( empty( $_SERVER['REQUEST_URI'] ) || ( php_sapi_name() != 'cgi-fcgi' && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) ) ) {
    6565
    6666    // IIS Mod-Rewrite
     
    317317    require_once(ABSPATH . WPINC . '/kses.php');
    318318    require_once(ABSPATH . WPINC . '/pluggable.php');
     319    require_once(ABSPATH . WPINC . '/formatting.php');
    319320    wp_redirect($link);
    320321    die(); // have to die here ~ Mark
     
    529530require (ABSPATH . WPINC . '/vars.php');
    530531
     532// make taxonomies available to plugins and themes
     533// @plugin authors: warning: this gets registered again on the init hook
     534create_initial_taxonomies();
     535
    531536// Check for hacks file if the option is enabled
    532537if ( get_option('hack_file') ) {
  • branches/2.8/xmlrpc.php

    r11553 r11698  
    4040    <homePageLink><?php bloginfo_rss('url') ?></homePageLink>
    4141    <apis>
    42       <api name="WordPress" blogID="1" preferred="true" apiLink="<?php echo site_url('xmlrpc.php') ?>" />
    43       <api name="Movable Type" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php') ?>" />
    44       <api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php') ?>" />
    45       <api name="Blogger" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php') ?>" />
    46       <api name="Atom" blogID="" preferred="false" apiLink="<?php echo apply_filters('atom_service_url', site_url('wp-app.php/service') ) ?>" />
     42      <api name="WordPress" blogID="1" preferred="true" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
     43      <api name="Movable Type" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
     44      <api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
     45      <api name="Blogger" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
     46      <api name="Atom" blogID="" preferred="false" apiLink="<?php echo apply_filters('atom_service_url', site_url('wp-app.php/service', 'rpc') ) ?>" />
    4747    </apis>
    4848  </service>
     
    25742574            $post_date = mysql2date('Ymd\TH:i:s', $postdata['post_date'], false);
    25752575            $post_date_gmt = mysql2date('Ymd\TH:i:s', $postdata['post_date_gmt'], false);
     2576
     2577            // For drafts use the GMT version of the post date
     2578            if ( $postdata['post_status'] == 'draft' ) {
     2579                $post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $postdata['post_date'] ) );
     2580                $post_date_gmt = preg_replace( '|\-|', '', $post_date_gmt );
     2581                $post_date_gmt = preg_replace( '| |', 'T', $post_date_gmt );
     2582            }
    25762583
    25772584            $categories = array();
     
    32943301        $p = explode( "\n\n", $linea );
    32953302
    3296         $preg_target = preg_quote($pagelinkedto);
     3303        $preg_target = preg_quote($pagelinkedto, '|');
    32973304
    32983305        foreach ( $p as $para ) {
     
    33163323                $excerpt = strip_tags($excerpt, '<wpcontext>');        // strip all tags but our context marker
    33173324                $excerpt = trim($excerpt);
    3318                 $preg_marker = preg_quote($marker);
     3325                $preg_marker = preg_quote($marker, '|');
    33193326                $excerpt = preg_replace("|.*?\s(.{0,100}$preg_marker.{0,100})\s.*|s", '$1', $excerpt);
    33203327                $excerpt = strip_tags($excerpt); // YES, again, to remove the marker wrapper
Note: See TracChangeset for help on using the changeset viewer.