Changes in branches/2.8 [11553:11698]
- Location:
- branches/2.8
- Files:
-
- 72 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.8/readme.html
r11553 r11698 9 9 <h1 id="logo" style="text-align: center"> 10 10 <img alt="WordPress" src="wp-admin/images/wordpress-logo.png" /> 11 <br /> Version 2.8 11 <br /> Version 2.8.1 12 12 </h1> 13 13 <p style="text-align: center">Semantic Personal Publishing Platform</p> … … 30 30 <h1>Upgrading</h1> 31 31 <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> 33 33 <ol> 34 34 <li>Delete your old WP files, saving ones you've modified.</li> -
branches/2.8/wp-admin/admin-ajax.php
r11553 r11698 603 603 die('-1'); 604 604 $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 607 611 $mode = isset($_POST['mode']) ? $_POST['mode'] : 'detail'; 608 612 $p = isset($_POST['p']) ? $_POST['p'] : 0; … … 815 819 if ( !current_user_can( 'edit_post', $meta->post_id ) ) 816 820 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 } 819 825 820 826 $key = stripslashes($key); -
branches/2.8/wp-admin/admin.php
r11553 r11698 147 147 // Make sure rules are flushed 148 148 global $wp_rewrite; 149 $wp_rewrite->flush_rules( );149 $wp_rewrite->flush_rules(false); 150 150 151 151 exit(); -
branches/2.8/wp-admin/css/colors-classic.css
r11553 r11698 268 268 } 269 269 270 .side-info h5 , .bordertitle{270 .side-info h5 { 271 271 border-bottom-color: #dadada; 272 272 } -
branches/2.8/wp-admin/css/colors-fresh.css
r11553 r11698 268 268 } 269 269 270 .side-info h5 , .bordertitle{270 .side-info h5 { 271 271 border-bottom-color: #dadada; 272 272 } -
branches/2.8/wp-admin/css/global.css
r11553 r11698 376 376 border-width: 1px; 377 377 border-style: solid; 378 border-collapse: separate;379 378 border-spacing: 0; 380 379 width: 100%; -
branches/2.8/wp-admin/css/ie.css
r11553 r11698 247 247 #col-container, 248 248 #col-left, 249 #col-right { 249 #col-right, 250 .fileedit-sub { 250 251 display: block; 251 252 zoom: 100%; … … 338 339 } 339 340 341 .widefat { 342 empty-cells: show; 343 border-collapse: collapse; 344 } 345 340 346 .tablenav a.button-secondary { 341 347 display: inline-block; -
branches/2.8/wp-admin/css/theme-editor-rtl.css
r11553 r11698 2 2 float: left; 3 3 } 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 12 12 float: right; 13 13 width: 190px; 14 word-wrap: break-word; 14 15 } 15 16 16 #templateside h3, #postcustomstuff p.submit { 17 #templateside h3, 18 #postcustomstuff p.submit { 17 19 margin: 0; 18 20 } 19 21 20 h3#bordertitle{21 margin -bottom: 10px;22 #templateside h4 { 23 margin: 1em 0 0; 22 24 } 23 25 24 #templateside h4 { 25 margin-bottom: 0; 26 } 27 28 #templateside ol, #templateside ul { 29 list-style: none; 26 #templateside ol, 27 #templateside ul { 30 28 margin: .5em; 31 29 padding: 0; 32 30 } 33 31 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; 49 34 } 50 35 … … 55 40 .highlight { 56 41 padding: 1px; 57 }58 59 div.bordertitle h2 {60 border: none;61 padding-bottom: 0;62 42 } 63 43 … … 74 54 font-weight: bold; 75 55 } 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 70 70 <span class="description"><?php _e('The description is not prominent by default, however some themes may show it.'); ?></span></td> 71 71 </tr> 72 <?php do_action('edit_category_form_fields', $category); ?> 72 73 </table> 73 74 <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 194 194 $start = $offset = ( $page - 1 ) * $comments_per_page; 195 195 196 list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, $comments_per_page + 5, $post_id, $comment_type ); // Grab a few extra196 list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, $comments_per_page + 8, $post_id, $comment_type ); // Grab a few extra 197 197 198 198 $_comment_post_ids = array(); … … 359 359 <input type="hidden" name="mode" value="<?php echo esc_attr($mode); ?>" /> 360 360 <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); ?>" /> 362 363 <input type="hidden" name="p" value="<?php echo esc_attr( $post_id ); ?>" /> 363 364 <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 75 75 <td><textarea name="description" id="description" rows="5" cols="50" style="width: 97%;"><?php echo $category->description; ?></textarea></td> 76 76 </tr> 77 <?php do_action('edit_link_category_form_fields', $category); ?> 77 78 </table> 78 79 <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 40 40 <span class="description"><?php _e('The description is not prominent by default, however some themes may show it.'); ?></span></td> 41 41 </tr> 42 <?php do_action('edit_tag_form_fields', $tag); ?> 42 43 </table> 43 44 <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 21 21 $this->method = 'direct'; 22 22 $this->errors = new WP_Error(); 23 $this->permission = umask();24 23 } 25 24 function connect() { … … 65 64 } 66 65 function chmod($file, $mode = false, $recursive = false) { 67 if ( ! $mode )68 $mode = $this->permission;69 66 if ( ! $this->exists($file) ) 70 67 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); 73 82 if ( ! $this->is_dir($file) ) 74 83 return @chmod($file, $mode); … … 198 207 199 208 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); 205 212 if ( $chown ) 206 213 $this->chown($path, $chown); -
branches/2.8/wp-admin/includes/class-wp-filesystem-ssh2.php
r11553 r11698 14 14 * @contrib http://kevin.vanzonneveld.net/techblog/article/make_ssh_connections_with_php/ - Installation Notes 15 15 * 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) 17 17 * 18 18 * cd /usr/src … … 23 23 * make all install 24 24 * 25 * Note: No not leave the directory yet!25 * Note: Do not leave the directory yet! 26 26 * 27 27 * Enter: pecl install -f ssh2 … … 34 34 * Check phpinfo() streams to confirm that: ssh2.shell, ssh2.exec, ssh2.tunnel, ssh2.scp, ssh2.sftp exist. 35 35 * 36 * Note: as of WordPress 2.8, This utilises the PHP5+ function 'stream_get_contents' 36 37 * 37 38 * @since 2.7 … … 46 47 var $keys = false; 47 48 /* 48 * This is the timeout value for ssh results to comeback.49 * This is the timeout value for ssh results. 49 50 * Slower servers might need this incressed, but this number otherwise should not change. 50 51 * … … 67 68 return false; 68 69 } 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>')); 71 72 return false; 72 73 } … … 102 103 103 104 if ( empty ($opt['password']) ) { 104 if ( !$this->keys ) // 105 if ( !$this->keys ) //password can be blank if we are using keys 105 106 $this->errors->add('empty_password', __('SSH2 password is required')); 106 107 } else { … … 129 130 } else { 130 131 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 incorre nt for %s'), $this->options['username']));132 $this->errors->add('auth', sprintf(__('Public and Private keys incorrect for %s'), $this->options['username'])); 132 133 return false; 133 134 } … … 149 150 stream_set_blocking( $stream, true ); 150 151 stream_set_timeout( $stream, $this->timeout ); 151 $data = stream_get_contents($stream); 152 $data = stream_get_contents( $stream ); 153 fclose( $stream ); 152 154 153 155 if ( $returnbool ) 154 return '' != trim($data);156 return ( $data === false ) ? false : '' != trim($data); 155 157 else 156 158 return $data; … … 167 169 function get_contents($file, $type = '', $resumepos = 0 ) { 168 170 $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); 170 172 } 171 173 172 174 function get_contents_array($file) { 173 175 $file = ltrim($file, '/'); 174 return file('ssh2.sftp://' . $this->sftp_link . '/' . $file);176 return file('ssh2.sftp://' . $this->sftp_link . '/' . $file); 175 177 } 176 178 177 179 function put_contents($file, $contents, $type = '' ) { 178 180 $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); 180 182 } 181 183 … … 271 273 272 274 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); 276 277 } 277 278 278 279 function is_file($file) { 279 280 $file = ltrim($file, '/'); 280 return is_file('ssh2.sftp://' . $this->sftp_link . '/' . $file);281 return is_file('ssh2.sftp://' . $this->sftp_link . '/' . $file); 281 282 } 282 283 283 284 function is_dir($path) { 284 285 $path = ltrim($path, '/'); 285 return is_dir('ssh2.sftp://' . $this->sftp_link . '/' . $path);286 return is_dir('ssh2.sftp://' . $this->sftp_link . '/' . $path); 286 287 } 287 288 288 289 function is_readable($file) { 289 290 $file = ltrim($file, '/'); 290 return is_readable('ssh2.sftp://' . $this->sftp_link . '/' . $file);291 return is_readable('ssh2.sftp://' . $this->sftp_link . '/' . $file); 291 292 } 292 293 293 294 function is_writable($file) { 294 295 $file = ltrim($file, '/'); 295 return is_writable('ssh2.sftp://' . $this->sftp_link . '/' . $file);296 return is_writable('ssh2.sftp://' . $this->sftp_link . '/' . $file); 296 297 } 297 298 298 299 function atime($file) { 299 300 $file = ltrim($file, '/'); 300 return fileatime('ssh2.sftp://' . $this->sftp_link . '/' . $file);301 return fileatime('ssh2.sftp://' . $this->sftp_link . '/' . $file); 301 302 } 302 303 303 304 function mtime($file) { 304 305 $file = ltrim($file, '/'); 305 return filemtime('ssh2.sftp://' . $this->sftp_link . '/' . $file);306 return filemtime('ssh2.sftp://' . $this->sftp_link . '/' . $file); 306 307 } 307 308 308 309 function size($file) { 309 310 $file = ltrim($file, '/'); 310 return filesize('ssh2.sftp://' . $this->sftp_link . '/' . $file);311 return filesize('ssh2.sftp://' . $this->sftp_link . '/' . $file); 311 312 } 312 313 -
branches/2.8/wp-admin/includes/dashboard.php
r11553 r11698 606 606 607 607 function 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…' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>'; 609 609 } 610 610 … … 635 635 echo "<ul>\n"; 636 636 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 ) { 639 641 $publisher = ''; 640 642 $site_link = ''; … … 645 647 646 648 $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 } 651 657 if ( $site_link ) 652 658 $publisher = "<a href='$site_link'>$publisher</a>"; … … 685 691 686 692 function 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…' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>'; 688 694 } 689 695 … … 707 713 708 714 function 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…' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>'; 710 716 } 711 717 … … 742 748 743 749 function 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…' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>'; 749 751 } 750 752 -
branches/2.8/wp-admin/includes/file.php
r11553 r11698 446 446 return new WP_Error('http_no_file', __('Could not create Temporary file')); 447 447 448 $response = wp_remote_get($url, array('timeout' => 30));448 $response = wp_remote_get($url, array('timeout' => 60)); 449 449 450 450 if ( is_wp_error($response) ) { … … 646 646 } 647 647 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'; 649 649 if ( ! $method && extension_loaded('ftp') ) $method = 'ftpext'; 650 650 if ( ! $method && ( extension_loaded('sockets') || function_exists('fsockopen') ) ) $method = 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread … … 762 762 </tr> 763 763 764 <?php if ( extension_loaded('ssh2') ) : ?>764 <?php if ( extension_loaded('ssh2') && function_exists('stream_get_contents') ) : ?> 765 765 <tr id="ssh_keys" valign="top" style="<?php if ( 'ssh' != $connection_type ) echo 'display:none' ?>"> 766 766 <th scope="row"><?php _e('Authentication Keys') ?> … … 782 782 <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> 783 783 <?php endif; ?> 784 <?php if ( extension_loaded('ssh2') ) : ?>784 <?php if ( extension_loaded('ssh2') && function_exists('stream_get_contents') ) : ?> 785 785 <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> 786 786 <?php endif; ?> -
branches/2.8/wp-admin/includes/manifest.php
r11553 r11698 93 93 if ( @is_file('../wp-includes/js/tinymce/tiny_mce.js') ) : 94 94 $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), 97 96 98 97 array('../wp-includes/js/tinymce/tiny_mce.js', $mce_ver, true), -
branches/2.8/wp-admin/includes/media.php
r11553 r11698 370 370 } 371 371 add_action( 'media_buttons', 'media_buttons' ); 372 add_action('media_upload_media', 'media_upload_handler');373 372 374 373 /** … … 382 381 check_admin_referer('media-form'); 383 382 384 $errors = array();383 $errors = null; 385 384 386 385 if ( isset($_POST['send']) ) { … … 1313 1312 var settings = { 1314 1313 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; }', 1316 1315 button_height: "24", 1317 1316 button_width: "132", 1318 button_text_top_padding: 1,1317 button_text_top_padding: 2, 1319 1318 button_image_url: '<?php echo includes_url('images/upload.png'); ?>', 1320 1319 button_placeholder_id: "flash-browse-button", -
branches/2.8/wp-admin/includes/misc.php
r11553 r11698 73 73 } 74 74 75 $f = fopen( $filename, 'w' ); 75 if ( !$f = @fopen( $filename, 'w' ) ) 76 return false; 77 76 78 $foundit = false; 77 79 if ( $markerdata ) { … … 271 273 return array(); 272 274 275 if ( !function_exists('token_get_all') ) 276 return array(); 277 273 278 $tokens = token_get_all( $content ); 274 279 $functions = array(); -
branches/2.8/wp-admin/includes/plugin-install.php
r11553 r11698 47 47 $res = new WP_Error('plugins_api_failed', __('An unknown error occurred'), $request['body']); 48 48 } 49 } elseif ( !is_wp_error($res) ) { 50 $res->external = true; 49 51 } 50 52 … … 442 444 $type = 'install'; 443 445 //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'); 445 447 if ( is_object( $update_plugins ) ) { 446 448 foreach ( (array)$update_plugins->response as $file => $plugin ) { … … 463 465 } else { 464 466 //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'); 466 468 $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 467 469 $type = 'update_available'; … … 510 512 <?php endif; if ( ! empty($api->downloaded) ) : ?> 511 513 <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) ) : ?> 513 515 <li><a target="_blank" href="http://wordpress.org/extend/plugins/<?php echo $api->slug ?>/"><?php _e('WordPress.org Plugin Page »') ?></a></li> 514 516 <?php endif; if ( ! empty($api->homepage) ) : ?> … … 516 518 <?php endif; ?> 517 519 </ul> 520 <?php if ( ! empty($api->rating) ) : ?> 518 521 <h2><?php _e('Average Rating') ?></h2> 519 522 <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)); ?>"> … … 526 529 </div> 527 530 <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; ?> 528 532 </div> 529 533 <div id="section-holder" class="wrap"> -
branches/2.8/wp-admin/includes/plugin.php
r11553 r11698 586 586 587 587 function 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; 589 589 590 590 $file = plugin_basename( $file ); … … 603 603 $menu[] = array ( $menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url ); 604 604 605 $_registered_pages[$hookname] = true; 606 605 607 return $hookname; 606 608 } 607 609 608 610 function 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; 610 612 611 613 $file = plugin_basename( $file ); … … 624 626 $menu[$_wp_last_object_menu] = array ( $menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url ); 625 627 628 $_registered_pages[$hookname] = true; 629 626 630 return $hookname; 627 631 } 628 632 629 633 function 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; 631 635 632 636 $file = plugin_basename( $file ); … … 646 650 647 651 $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; 648 654 649 655 return $hookname; … … 655 661 global $_wp_real_parent_file; 656 662 global $_wp_submenu_nopriv; 663 global $_registered_pages; 657 664 658 665 $file = plugin_basename( $file ); … … 683 690 if (!empty ( $function ) && !empty ( $hookname )) 684 691 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; 685 697 686 698 return $hookname; … … 920 932 global $_wp_submenu_nopriv; 921 933 global $plugin_page; 934 global $_registered_pages; 922 935 923 936 $parent = get_admin_page_parent(); … … 926 939 return false; 927 940 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 } 930 949 931 950 if ( empty( $parent) ) { … … 936 955 if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) ) 937 956 return false; 957 if ( isset( $plugin_page ) && isset( $_wp_menu_nopriv[$plugin_page] ) ) 958 return false; 938 959 foreach (array_keys( $_wp_submenu_nopriv ) as $key ) { 939 960 if ( isset( $_wp_submenu_nopriv[$key][$pagenow] ) ) … … 944 965 return true; 945 966 } 967 968 if ( isset( $plugin_page ) && ( $plugin_page == $parent ) && isset( $_wp_menu_nopriv[$plugin_page] ) ) 969 return false; 946 970 947 971 if ( isset( $submenu[$parent] ) ) { -
branches/2.8/wp-admin/includes/template.php
r11553 r11698 1448 1448 $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this post')) . '">' . __('Edit') . '</a>'; 1449 1449 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this post inline')) . '">' . __('Quick Edit') . '</a>'; 1450 } 1451 if ( current_user_can('delete_post', $post->ID) ) { 1450 1452 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this post')) . "' href='" . wp_nonce_url("post.php?action=delete&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>"; 1451 1453 } … … 1661 1663 $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr(__('Edit this page')) . '">' . __('Edit') . '</a>'; 1662 1664 $actions['inline'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>'; 1665 } 1666 if ( current_user_can('delete_page', $page->ID) ) { 1663 1667 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this page')) . "' href='" . wp_nonce_url("page.php?action=delete&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>"; 1664 1668 } … … 3472 3476 } 3473 3477 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;3479 3478 case 'widgets': 3480 3479 if ( !isset($_wp_contextual_help['widgets']) ) { -
branches/2.8/wp-admin/includes/update-core.php
r11553 r11698 230 230 if ( is_wp_error($result) ) { 231 231 $wp_filesystem->delete($maintenance_file); 232 $wp_filesystem->delete($ working_dir, true);232 $wp_filesystem->delete($from, true); 233 233 return $result; 234 234 } -
branches/2.8/wp-admin/includes/user.php
r11553 r11698 254 254 return array($user->id); 255 255 else 256 return false;256 return array(); 257 257 } 258 258 -
branches/2.8/wp-admin/includes/widgets.php
r11553 r11698 98 98 function next_widget_id_number($id_base) { 99 99 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++; 104 107 105 108 return $number; -
branches/2.8/wp-admin/js/dashboard.dev.js
r11553 r11698 1 var ajaxWidgets, ajaxPopulateWidgets, quickPressLoad; 1 2 2 3 jQuery(document).ready( function($) { 3 var ajaxWidgets, ajaxPopulateWidgets, quickPressLoad;4 4 // These widgets are sometimes populated via ajax 5 5 ajaxWidgets = [ … … 10 10 ]; 11 11 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 } 17 37 }; 18 38 ajaxPopulateWidgets(); 19 39 20 postboxes.add_postbox_toggles('dashboard', { onShow: ajaxPopulateWidgets } );40 postboxes.add_postbox_toggles('dashboard', { pbshow: ajaxPopulateWidgets } ); 21 41 22 42 /* 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()});1 var ajaxWidgets,ajaxPopulateWidgets,quickPressLoad;jQuery(document).ready(function(a){ajaxWidgets=["dashboard_incoming_links","dashboard_primary","dashboard_secondary","dashboard_plugins"];ajaxPopulateWidgets=function(b){show=function(g,c){var f,d=a("#"+g+" div.inside:visible").find(".widget-loading");if(d.length){f=d.parent();setTimeout(function(){f.load("index-extra.php?jax="+g,"",function(){f.hide().slideDown("normal",function(){a(this).css("display","");if("dashboard_plugins"==g&&a.isFunction(tb_init)){tb_init("#dashboard_plugins a.thickbox")}})})},c*500)}};if(b){b=b.toString();if(a.inArray(b,ajaxWidgets)!=-1){show(b,0)}}else{a.each(ajaxWidgets,function(c){show(this,c)})}};ajaxPopulateWidgets();postboxes.add_postbox_toggles("dashboard",{pbshow:ajaxPopulateWidgets});quickPressLoad=function(){var b=a("#quickpost-action"),c;c=a("#quick-press").submit(function(){a("#dashboard_quick_press h3").append('<img src="images/wpspin_light.gif" style="margin: 0 6px 0 0; vertical-align: middle" />');a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr("disabled","disabled");if("post"==b.val()){b.val("post-quickpress-publish")}a("#dashboard_quick_press div.inside").load(c.attr("action"),c.serializeArray(),function(){a("#dashboard_quick_press h3 img").remove();a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr("disabled","");a("#dashboard_quick_press ul").find("li").each(function(){a("#dashboard_recent_drafts ul").prepend(this)}).end().remove();tb_init("a.thickbox");quickPressLoad()});return false});a("#publish").click(function(){b.val("post-quickpress-publish")})};quickPressLoad()}); -
branches/2.8/wp-admin/js/edit-comments.dev.js
r11553 r11698 24 24 n = n + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 ); 25 25 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'); 27 27 n = n.toString(); 28 28 if ( n.length > 3 ) … … 78 78 } 79 79 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'); 81 81 n = n.toString(); 82 82 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);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}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 213 213 var noSyncChecks = false, syncChecks, catAddAfter, stamp = $('#timestamp').html(), visibility = $('#post-visibility-display').html(), sticky = ''; 214 214 215 // for Press This216 if ( typeof autosave != 'function' )217 autosave = function(){};218 219 215 // postboxes 220 216 postboxes.add_postbox_toggles('post'); … … 226 222 tag_init(); 227 223 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 }); 229 231 230 232 // auto-suggest stuff … … 478 480 $('#the-list').wpList( { addAfter: function( xml, s ) { 479 481 $('table#list-table').show(); 480 if ( $.isFunction( autosave_update_post_ID )) {482 if ( typeof( autosave_update_post_ID ) != 'undefined' ) { 481 483 autosave_update_post_ID(s.parsed.responses[0].supplemental.postid); 482 484 } -
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> '+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}})});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> '+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 5 5 this.init(page,args); 6 6 $('.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'); 14 8 p.toggleClass('closed'); 15 9 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 } 16 16 } ); 17 17 $('.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));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"),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 7 7 */ 8 8 9 /** Load WordPress Bootstrap */ 10 require_once('../wp-load.php');9 if ( ! defined('ABSPATH') ) 10 die(); 11 11 12 12 global $opml, $map; -
branches/2.8/wp-admin/media-upload.php
r11553 r11698 30 30 31 31 if ( 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(); 42 33 43 34 if ( isset($_POST['html-upload']) && !empty($_FILES) ) { … … 49 40 $id = false; 50 41 } 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) ); 51 52 } 52 53 -
branches/2.8/wp-admin/menu-header.php
r11553 r11698 75 75 $submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index. 76 76 $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)) { 78 81 $admin_is_parent = true; 79 82 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>"; … … 83 86 } else if ( current_user_can($item[1]) ) { 84 87 $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) ) { 86 92 $admin_is_parent = true; 87 93 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>"; … … 103 109 $first = false; 104 110 } 111 112 $menu_file = $item[2]; 113 if ( false !== $pos = strpos($menu_file, '?') ) 114 $menu_file = substr($menu_file, 0, $pos); 115 105 116 if ( isset($submenu_file) ) { 106 117 if ( $submenu_file == $sub_item[2] ) … … 108 119 // If plugin_page is set the parent must either match the current page or not physically exist. 109 120 // 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]) ) { 111 122 $class[] = 'current'; 112 123 } … … 115 126 116 127 $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); 117 131 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) ) { 119 133 // 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); 121 136 if ( $parent_exists ) 122 137 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 158 158 <br /> 159 159 <span> 160 <?php if ( get_option('timezone_string')) : ?>160 <?php if ($tzstring) : ?> 161 161 <?php 162 162 $now = localtime(time(),true); … … 166 166 <br /> 167 167 <?php 168 if (function_exists('timezone_transitions_get') && $tzstring) {168 if (function_exists('timezone_transitions_get')) { 169 169 $dateTimeZoneSelected = new DateTimeZone($tzstring); 170 170 foreach (timezone_transitions_get($dateTimeZoneSelected) as $tr) { 171 171 if ($tr['ts'] > time()) { 172 172 $found = true; 173 173 break; 174 174 } … … 180 180 __('Daylight savings time begins on: <code>%s</code>.') : 181 181 __('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'] ) ); 186 183 } else { 187 184 _e('This timezone does not observe daylight savings time.'); -
branches/2.8/wp-admin/plugin-editor.php
r11553 r11698 84 84 } 85 85 86 if ( use_codepress() )87 wp_enqueue_script( 'codepress' );88 89 86 // List of allowable extensions 90 87 $editable_extensions = array('php', 'txt', 'text', 'js', 'css', 'html', 'htm', 'xml', 'inc', 'include'); … … 112 109 $functions = wp_doc_link_parse( $content ); 113 110 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>'; 118 118 } 119 $docs_select .= '</select>';120 119 } 121 120 … … 137 136 <?php screen_icon(); ?> 138 137 <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"> 160 140 <div class="alignleft"> 161 141 <big><?php … … 173 153 ?></big> 174 154 </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> 175 175 <br class="clear" /> 176 176 </div> 177 <br class="clear" /> 178 179 <h3 id="bordertitle"><?php _e('Plugin Files'); ?></h3>177 178 <div id="templateside"> 179 <h3><?php _e('Plugin Files'); ?></h3> 180 180 181 181 <ul> … … 196 196 <?php endforeach; ?> 197 197 </ul> 198 199 198 </div> 199 <form name="template" id="template" action="plugin-editor.php" method="post"> 200 200 <?php wp_nonce_field('edit-plugin_' . $file) ?> 201 201 <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1" class="codepress <?php echo $codepress_lang ?>"><?php echo $content ?></textarea> … … 204 204 <input type="hidden" name="plugin" value="<?php echo esc_attr($plugin) ?>" /> 205 205 </div> 206 <?php if ( isset( $functions) ) : ?>206 <?php if ( !empty( $docs_select ) ) : ?> 207 207 <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() ) + '&locale=<?php echo urlencode( get_locale() ) ?>&version=<?php echo urlencode( $wp_version ) ?>&redirect=true'); }" /></div> 208 208 <?php endif; ?> … … 222 222 <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> 223 223 <?php endif; ?> 224 225 < div class="clear"> </div>224 </form> 225 <br class="clear" /> 226 226 </div> 227 227 <?php 228 228 break; 229 229 } 230 include("admin-footer.php") ?>230 include("admin-footer.php"); -
branches/2.8/wp-admin/rtl.css
r11553 r11698 138 138 .folded #adminmenu img.wp-menu-image { 139 139 padding: 7px 6px 0 0; 140 } 141 #adminmenu a.separator { 142 cursor: e-resize; 143 } 144 .folded #adminmenu a.separator { 145 cursor: w-resize; 140 146 } 141 147 #adminmenu .wp-submenu .wp-submenu-head { -
branches/2.8/wp-admin/theme-editor.php
r11553 r11698 23 23 } else { 24 24 $theme = stripslashes($theme); 25 } 26 25 } 27 26 28 27 if ( ! isset($themes[$theme]) ) … … 66 65 67 66 $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); 70 69 header("Location: $location"); 71 70 exit(); … … 77 76 if ( !current_user_can('edit_themes') ) 78 77 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' );82 78 83 79 require_once('admin-header.php'); … … 118 114 <?php screen_icon(); ?> 119 115 <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"> 122 123 <strong><label for="theme"><?php _e('Select theme to edit:'); ?> </label></strong> 123 124 <select name="theme" id="theme"> … … 135 136 </form> 136 137 </div> 137 <div class="tablenav">138 <div class="alignleft">139 <big><?php echo sprintf($desc_header, $file_show); ?></big>140 </div>141 138 <br class="clear" /> 142 139 </div> 143 <br class="clear" /> 144 145 <h3 id="bordertitle"><?php _e("Theme Files"); ?></h3>140 141 <div id="templateside"> 142 <h3><?php _e("Theme Files"); ?></h3> 146 143 147 144 <?php … … 194 191 <?php endif; ?> 195 192 </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"> 200 196 <?php wp_nonce_field('edit-theme_' . $file . $theme) ?> 201 197 <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1" class="codepress <?php echo $codepress_lang ?>"><?php echo $content ?></textarea> … … 223 219 <?php endif; ?> 224 220 </div> 225 226 221 </form> 222 <?php 227 223 } else { 228 224 echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>'; 229 225 } 230 231 < div class="clear"> </div>226 ?> 227 <br class="clear" /> 232 228 </div> 233 229 <?php … … 235 231 } 236 232 237 include("admin-footer.php") ?>233 include("admin-footer.php"); -
branches/2.8/wp-admin/update-core.php
r11553 r11698 15 15 function list_core_update( $update ) { 16 16 global $wp_local_package; 17 $version_string = 'en_US' == $update->locale?17 $version_string = ('en_US' == $update->locale && 'en_US' == get_locale() ) ? 18 18 $update->current : sprintf("%s–<strong>%s</strong>", $update->current, $update->locale); 19 19 $current = false; … … 54 54 if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) ) 55 55 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 } 56 59 echo '</form>'; 57 60 -
branches/2.8/wp-admin/upgrade.php
r11553 r11698 69 69 case 1: 70 70 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 ) ); 76 74 $backto = esc_url_raw( $backto ); 77 }75 $backto = wp_validate_redirect($backto, __get_option( 'home' ) . '/'); 78 76 ?> 79 77 <h2><?php _e( 'Upgrade Complete' ); ?></h2> -
branches/2.8/wp-admin/wp-admin.css
r11553 r11698 438 438 } 439 439 440 #timezone_string option { 441 margin-left: 1em; 442 } 443 440 444 .approve { 441 445 display: none; … … 2093 2097 } 2094 2098 2095 .bordertitle {2096 padding-bottom: 5px;2097 border-bottom-width: 1px;2098 border-bottom-style: solid;2099 }2100 2101 2099 /* Edit posts */ 2102 2100 … … 3187 3185 } 3188 3186 3187 .widefat td p { 3188 margin: 2px 0 0.8em; 3189 } 3190 3189 3191 table .vers, 3190 3192 table .column-visible, -
branches/2.8/wp-content/plugins/hello.php
r11553 r11698 3 3 * @package Hello_Dolly 4 4 * @author Matt Mullenweg 5 * @version 1.5 5 * @version 1.5.1 6 6 */ 7 7 /* … … 10 10 Description: This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from <cite>Hello, Dolly</cite> in the upper right of your admin screen on every page. 11 11 Author: Matt Mullenweg 12 Version: 1.5 12 Version: 1.5.1 13 13 Author URI: http://ma.tt/ 14 14 */ … … 63 63 // We need some CSS to position the paragraph 64 64 function 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 65 68 echo " 66 69 <style type='text/css'> … … 70 73 margin: 0; 71 74 padding: 0; 72 right: 215px;75 $x: 215px; 73 76 font-size: 11px; 74 77 } -
branches/2.8/wp-includes/class-simplepie.php
r11553 r11698 752 752 function __destruct() 753 753 { 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 } 769 772 } 770 773 } … … 1684 1687 $headers = $file->headers; 1685 1688 $data = $file->body; 1686 $sniffer = new $this->content_type_sniffer_class($file);1689 $sniffer =& new $this->content_type_sniffer_class($file); 1687 1690 $sniffed = $sniffer->get_type(); 1688 1691 } … … 1962 1965 if ($file->success && ($file->status_code == 200 || ($file->status_code > 206 && $file->status_code < 300)) && strlen($file->body) > 0) 1963 1966 { 1964 $sniffer = new $this->content_type_sniffer_class($file);1967 $sniffer =& new $this->content_type_sniffer_class($file); 1965 1968 if (substr($sniffer->get_type(), 0, 6) === 'image/') 1966 1969 { … … 3083 3086 function __destruct() 3084 3087 { 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 } 3086 3092 } 3087 3093 … … 5683 5689 } 5684 5690 5685 /**5686 * Remove items that link back to this before destroying this object5687 */5688 function __destruct()5689 {5690 unset($this->item);5691 }5692 5693 5691 function get_source_tags($namespace, $tag) 5694 5692 { … … 7747 7745 case 'gzip': 7748 7746 case 'x-gzip': 7749 $decoder = new SimplePie_gzdecode($this->body);7747 $decoder =& new SimplePie_gzdecode($this->body); 7750 7748 if (!$decoder->parse()) 7751 7749 { … … 8955 8953 function parse_url($url) 8956 8954 { 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]); 8974 8961 } 8975 8962 … … 10556 10543 function entities_decode($data) 10557 10544 { 10558 $decoder = new SimplePie_Decode_HTML_Entities($data);10545 $decoder =& new SimplePie_Decode_HTML_Entities($data); 10559 10546 return $decoder->parse(); 10560 10547 } … … 10810 10797 function codepoint_to_utf8($codepoint) 10811 10798 { 10812 static $cache = array();10813 10799 $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; 10821 10803 } 10822 10804 else if ($codepoint <= 0x7f) 10823 10805 { 10824 return $cache[$codepoint] =chr($codepoint);10806 return chr($codepoint); 10825 10807 } 10826 10808 else if ($codepoint <= 0x7ff) 10827 10809 { 10828 return $cache[$codepoint] =chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f));10810 return chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f)); 10829 10811 } 10830 10812 else if ($codepoint <= 0xffff) 10831 10813 { 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)); 10833 10815 } 10834 10816 else if ($codepoint <= 0x10ffff) 10835 10817 { 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)); 10837 10819 } 10838 10820 else 10839 10821 { 10840 10822 // U+FFFD REPLACEMENT CHARACTER 10841 return $cache[$codepoint] ="\xEF\xBF\xBD";10823 return "\xEF\xBF\xBD"; 10842 10824 } 10843 10825 } … … 10957 10939 if ($pos = strpos($data, "\x00\x00\x00\x3F\x00\x00\x00\x3E")) 10958 10940 { 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')); 10960 10942 if ($parser->parse()) 10961 10943 { … … 10970 10952 if ($pos = strpos($data, "\x3F\x00\x00\x00\x3E\x00\x00\x00")) 10971 10953 { 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')); 10973 10955 if ($parser->parse()) 10974 10956 { … … 10983 10965 if ($pos = strpos($data, "\x00\x3F\x00\x3E")) 10984 10966 { 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')); 10986 10968 if ($parser->parse()) 10987 10969 { … … 10996 10978 if ($pos = strpos($data, "\x3F\x00\x3E\x00")) 10997 10979 { 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')); 10999 10981 if ($parser->parse()) 11000 10982 { … … 11009 10991 if ($pos = strpos($data, "\x3F\x3E")) 11010 10992 { 11011 $parser = new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));10993 $parser =& new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5)); 11012 10994 if ($parser->parse()) 11013 10995 { … … 11735 11717 if (!isset($cache[get_class($this)])) 11736 11718 { 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); 11751 11720 11752 11721 foreach ($all_methods as $method) … … 11775 11744 if (!$object) 11776 11745 { 11777 $object = new SimplePie_Parse_Date;11746 $object =& new SimplePie_Parse_Date; 11778 11747 } 11779 11748 return $object; … … 12810 12779 if ($this->file->method & SIMPLEPIE_FILE_SOURCE_REMOTE) 12811 12780 { 12812 $sniffer = new $this->content_type_sniffer_class($this->file);12781 $sniffer =& new $this->content_type_sniffer_class($this->file); 12813 12782 if ($sniffer->get_type() !== 'text/html') 12814 12783 { … … 12856 12825 if ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE) 12857 12826 { 12858 $sniffer = new $this->content_type_sniffer_class($file);12827 $sniffer =& new $this->content_type_sniffer_class($file); 12859 12828 $sniffed = $sniffer->get_type(); 12860 12829 if (in_array($sniffed, array('application/rss+xml', 'application/rdf+xml', 'text/rdf', 'application/atom+xml', 'text/xml', 'application/xml'))) … … 13084 13053 if (substr($data, 0, 5) === '<?xml' && strspn(substr($data, 5, 1), "\x09\x0A\x0D\x20") && ($pos = strpos($data, '?>')) !== false) 13085 13054 { 13086 $declaration = new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));13055 $declaration =& new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5)); 13087 13056 if ($declaration->parse()) 13088 13057 { -
branches/2.8/wp-includes/default-widgets.php
r11553 r11698 527 527 $cache = array(); 528 528 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 } 531 533 532 534 ob_start(); -
branches/2.8/wp-includes/formatting.php
r11553 r11698 81 81 82 82 function 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, '/'); 85 85 foreach($disabled_elements as $element) { 86 86 if (preg_match('/^'.$o.$element.'\b/', $text)) array_push($stack, $element); … … 2043 2043 if ('' == $url) return $url; 2044 2044 $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); 2047 2047 $url = str_replace(';//', '://', $url); 2048 2048 /* If the URL doesn't appear to contain a scheme, we … … 2066 2066 2067 2067 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 */ 2084 function _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; 2068 2097 } 2069 2098 -
branches/2.8/wp-includes/functions.php
r11553 r11698 2683 2683 $wp_smiliessearch .= '|'; 2684 2684 } 2685 $wp_smiliessearch .= preg_quote($rest );2685 $wp_smiliessearch .= preg_quote($rest, '/'); 2686 2686 } 2687 2687 … … 3150 3150 */ 3151 3151 function 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 ); 3167 3166 } 3168 3167 3169 3168 /** 3170 3169 * Check for PHP timezone support 3171 *3172 3170 */ 3173 3171 function 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 3184 function _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 } 3182 3220 } 3183 3221 … … 3185 3223 * Gives a nicely formatted list of timezone strings // temporary! Not in final 3186 3224 * 3187 * @param string $selectedzone - which zone should be the selectedone3188 * 3189 */ 3190 function wp_timezone_choice( $selectedzone) {3225 * @param $selected_zone string Selected Zone 3226 * 3227 */ 3228 function wp_timezone_choice( $selected_zone ) { 3191 3229 static $mo_loaded = false; 3192 3230 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' ); 3194 3232 3195 3233 // Load translations for continents and cities 3196 if ( ! 3234 if ( !$mo_loaded ) { 3197 3235 $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 ); 3200 3238 $mo_loaded = true; 3201 3239 } 3202 3240 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 ) ) { 3209 3245 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' ) ) ) { 3211 3248 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 = ' '; 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 } 3251 3311 } 3252 3312 } 3253 3313 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" '; 3268 3319 } 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 ); 3274 3329 } 3275 3330 -
branches/2.8/wp-includes/functions.wp-styles.php
r11553 r11698 93 93 function wp_style_is( $handle, $list = 'queue' ) { 94 94 global $wp_styles; 95 if ( !is_a($wp_styles, 'WP_S cripts') )95 if ( !is_a($wp_styles, 'WP_Styles') ) 96 96 $wp_styles = new WP_Styles(); 97 97 -
branches/2.8/wp-includes/http.php
r11553 r11698 74 74 * that object to be used later. 75 75 * 76 * The order for the GET/HEAD requests are HTTP Extension, FSockopen Streams,77 * Fopen, and finally cURL. Whilst Fsockopen has the highest overhead, Its78 * used 2nd due to high compatibility with most hosts, The HTTP Extension is79 * tested first due to hosts which have it enabled, are likely to work80 * 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. 81 81 * 82 82 * There are currently issues with "localhost" not resolving correctly with … … 99 99 $working_transport['exthttp'] = new WP_Http_ExtHttp(); 100 100 $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']; 104 104 } else if ( true === WP_Http_Streams::test($args) ) { 105 105 $working_transport['streams'] = new WP_Http_Streams(); … … 108 108 $working_transport['fopen'] = new WP_Http_Fopen(); 109 109 $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']; 113 113 } 114 114 … … 150 150 $working_transport['exthttp'] = new WP_Http_ExtHttp(); 151 151 $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']; 152 158 } else if ( true === WP_Http_Fsockopen::test($args) ) { 153 159 $working_transport['fsockopen'] = new WP_Http_Fsockopen(); 154 160 $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'];161 161 } 162 162 … … 240 240 241 241 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.')); 243 243 244 244 // 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 9 9 10 10 if ( ! $path || ! @is_file($path) ) 11 return '';11 return false; 12 12 13 13 return @file_get_contents($path); … … 21 21 header("Cache-Control: public, max-age=$expires_offset"); 22 22 23 if ( isset($_GET['c']) && 1 == $_GET['c'] && false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') ) {23 if ( isset($_GET['c']) && 1 == $_GET['c'] && false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && ( $file = get_file($basepath . '/wp-tinymce.js.gz') ) ) { 24 24 header('Content-Encoding: gzip'); 25 echo get_file($basepath . '/wp-tinymce.js.gz');25 echo $file; 26 26 } else { 27 27 echo get_file($basepath . '/wp-tinymce.js'); -
branches/2.8/wp-includes/kses.php
r11553 r11698 120 120 'h1' => array( 121 121 '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 ( 139 151 'align' => array (), 140 152 'class' => array (), … … 522 534 } 523 535 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 524 549 if ($ok) 525 550 $attr2 .= ' '.$arreach['whole']; # it passed them … … 1123 1148 add_action('init', 'kses_init'); 1124 1149 add_action('set_current_user', 'kses_init'); 1125 ?> 1150 1151 function 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 302 302 303 303 /** 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 not307 * 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. 308 308 * 309 309 * On success, the .mo file will be placed in the $l10n global by $domain 310 * and will be a n gettext_readerobject.310 * and will be a MO object. 311 311 * 312 312 * @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 316 314 * 317 315 * @param string $domain Unique identifier for retrieving translated strings 318 316 * @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 320 318 */ 321 319 function load_textdomain($domain, $mofile) { 322 320 global $l10n; 323 321 324 if ( !is_readable( $mofile)) return;322 if ( !is_readable( $mofile ) ) return false; 325 323 326 324 $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] ) ) 330 328 $mo->merge_with( $l10n[$domain] ); 331 329 332 330 $l10n[$domain] = &$mo; 331 return true; 333 332 } 334 333 … … 346 345 $mofile = WP_LANG_DIR . "/$locale.mo"; 347 346 348 load_textdomain('default', $mofile);347 return load_textdomain('default', $mofile); 349 348 } 350 349 … … 373 372 374 373 $mofile = $path . '/'. $domain . '-' . $locale . '.mo'; 375 load_textdomain($domain, $mofile);374 return load_textdomain($domain, $mofile); 376 375 } 377 376 … … 394 393 395 394 $mofile = "$path/$locale.mo"; 396 load_textdomain($domain, $mofile);395 return load_textdomain($domain, $mofile); 397 396 } 398 397 … … 424 423 */ 425 424 function 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' ); 427 426 } 428 427 ?> -
branches/2.8/wp-includes/link-template.php
r11553 r11698 1694 1694 $orig_scheme = $scheme; 1695 1695 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() ) ) 1697 1697 $scheme = 'https'; 1698 1698 elseif ( ('login' == $scheme) && ( force_ssl_admin() ) ) -
branches/2.8/wp-includes/pluggable.php
r11553 r11698 881 881 882 882 // 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); 894 885 return $location; 895 886 } … … 909 900 * 910 901 * @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. 913 903 * 914 904 * @return void Does not return anything … … 919 909 $location = wp_sanitize_redirect($location); 920 910 911 $location = wp_validate_redirect($location, admin_url()); 912 913 wp_redirect($location, $status); 914 } 915 endif; 916 917 if ( !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 **/ 935 function wp_validate_redirect($location, $default = '') { 921 936 // browsers will assume 'http' is your protocol, and will obey a redirect to a URL starting with '//' 922 937 if ( substr($location, 0, 2) == '//' ) … … 932 947 933 948 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; 937 952 } 938 953 endif; -
branches/2.8/wp-includes/plugin.php
r11553 r11698 54 54 * @since 0.71 55 55 * @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)']'] 57 57 * @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. 58 58 * … … 496 496 $mu_plugin_dir = preg_replace('|/+|','/', $mu_plugin_dir); // remove any duplicate slash 497 497 $file = preg_replace('#^' . preg_quote($plugin_dir, '#') . '/|^' . preg_quote($mu_plugin_dir, '#') . '/#','',$file); // get relative path from plugins dir 498 $file = trim($file, '/'); 498 499 return $file; 499 500 } -
branches/2.8/wp-includes/pomo/entry.php
r11553 r11698 3 3 * Contains Translation_Entry class 4 4 * 5 * @version $Id: entry.php 1 3 2008-04-21 12:03:37Z nbachiyski $5 * @version $Id: entry.php 115 2009-05-11 18:56:15Z nbachiyski $ 6 6 * @package pomo 7 7 * @subpackage entry … … 49 49 $object_varnames = array_keys(get_object_vars($this)); 50 50 foreach ($args as $varname => $value) { 51 if (in_array($varname, $object_varnames)) { 52 $this->$varname = $value; 53 } 51 $this->$varname = $value; 54 52 } 55 53 if (isset($args['plural'])) $this->is_plural = true; -
branches/2.8/wp-includes/pomo/mo.php
r11553 r11698 3 3 * Class for working with MO files 4 4 * 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 $ 6 6 * @package pomo 7 7 * @subpackage mo … … 11 11 require_once dirname(__FILE__) . '/streams.php'; 12 12 13 class MO extends Translations {13 class MO extends Gettext_Translations { 14 14 15 15 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 }22 16 23 17 /** … … 33 27 return $this->import_from_reader($reader); 34 28 } 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 } 35 96 36 97 function get_byteorder($magic) { … … 43 104 // 0xde120495 44 105 $magic_big = ((int) - 569244523) && 0xFFFFFFFF; 45 106 46 107 if ($magic_little == $magic || $magic_little_64 == $magic) { 47 108 return 'little'; … … 64 125 $total = $reader->readint32(); 65 126 // get addresses of array of lenghts and offsets for original string and translations 66 $originals_l o_addr = $reader->readint32();67 $translations_l o_addr = $reader->readint32();127 $originals_lenghts_addr = $reader->readint32(); 128 $translations_lenghts_addr = $reader->readint32(); 68 129 69 $reader->seekto($originals_l o_addr);70 $originals_l o = $reader->readint32array($total * 2); // each of71 $reader->seekto($translations_l o_addr);72 $translations_l o= $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); 73 134 74 135 $length = create_function('$i', 'return $i * 2 + 1;'); … … 76 137 77 138 for ($i = 0; $i < $total; ++$i) { 78 $reader->seekto($originals_l o[$offset($i)]);79 $original = $reader->read($originals_l o[$length($i)]);80 $reader->seekto($translations_l o[$offset($i)]);81 $translation = $reader->read($translations_l o[$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)]); 82 143 if ('' == $original) { 83 144 $this->set_headers($this->make_headers($translation)); … … 87 148 } 88 149 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;100 150 } 101 151 -
branches/2.8/wp-includes/pomo/po.php
r11553 r11698 3 3 * Class for working with PO files 4 4 * 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 $ 6 6 * @package pomo 7 7 * @subpackage po … … 17 17 * Routines for working with PO files 18 18 */ 19 class PO extends Translations {20 19 class PO extends Gettext_Translations { 20 21 21 22 22 /** … … 76 76 } 77 77 78 79 78 /** 80 79 * Formats a string in PO-style … … 88 87 $slash = '\\'; 89 88 $newline = "\n"; 90 $tab = "\t";91 89 92 90 $replaces = array( 93 91 "$slash" => "$slash$slash", 94 "$tab" => '\t',95 92 "$quote" => "$slash$quote", 93 "\t" => '\t', 96 94 ); 95 97 96 $string = str_replace(array_keys($replaces), array_values($replaces), $string); 98 97 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; 104 99 // 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))))) { 106 102 $po = "$quote$quote$newline$po"; 107 103 } … … 110 106 return $po; 111 107 } 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 115 142 * returns the modified string 116 143 * … … 158 185 if (!empty($entry->extracted_comments)) $po[] = PO::comment_block($entry->extracted_comments, '.'); 159 186 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), ','); 161 188 if (!is_null($entry->context)) $po[] = 'msgctxt '.PO::poify($entry->context); 162 189 $po[] = 'msgid '.PO::poify($entry->singular); … … 174 201 } 175 202 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 } 176 359 } 177 360 ?> -
branches/2.8/wp-includes/pomo/streams.php
r11553 r11698 4 4 * Based on the classes from Danilo Segan <danilo@kvota.net> 5 5 * 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 $ 7 7 * @package pomo 8 8 * @subpackage streams … … 18 18 var $_str; 19 19 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 } 24 25 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 } 30 41 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 } 33 48 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 } 40 54 41 42 43 55 function pos() { 56 return $this->_pos; 57 } 44 58 45 46 returnstrlen($this->_str);47 59 function length() { 60 return $this->_strlen($this->_str); 61 } 48 62 49 63 } … … 54 68 class POMO_CachedFileReader extends POMO_StringReader { 55 69 function POMO_CachedFileReader($filename) { 70 parent::POMO_StringReader(); 56 71 $this->_str = file_get_contents($filename); 57 72 if (false === $this->_str) 58 73 return false; 59 $this-> pos = 0;74 $this->_pos = 0; 60 75 } 61 76 } … … 97 112 function readint32() { 98 113 $bytes = $this->read(4); 99 if (4 != strlen($bytes))114 if (4 != $this->_strlen($bytes)) 100 115 return false; 101 116 $endian_letter = ('big' == $this->endian)? 'N' : 'V'; … … 113 128 function readint32array($count) { 114 129 $bytes = $this->read(4 * $count); 115 if (4*$count != strlen($bytes))130 if (4*$count != $this->_strlen($bytes)) 116 131 return false; 117 132 $endian_letter = ('big' == $this->endian)? 'N' : 'V'; -
branches/2.8/wp-includes/pomo/translations.php
r11553 r11698 3 3 * Class for a set of entries for translation and their associated headers 4 4 * 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 $ 6 6 * @package pomo 7 7 * @subpackage translations … … 20 20 * @return bool true on success, false if the entry doesn't have a key 21 21 */ 22 function add_entry(&$entry) { 22 function add_entry($entry) { 23 if (is_array($entry)) { 24 $entry = new Translation_Entry($entry); 25 } 23 26 $key = $entry->key(); 24 27 if (false === $key) return false; 25 $this->entries[$key] = &$entry;28 $this->entries[$key] = $entry; 26 29 return true; 27 30 } … … 88 91 if ($translated && 0 <= $index && $index < $total_plural_forms && 89 92 is_array($translated->translations) && 90 count($translated->translations) == $total_plural_forms)93 isset($translated->translations[$index])) 91 94 return $translated->translations[$index]; 92 95 else … … 94 97 } 95 98 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 110 class Gettext_Translations extends Translations { 96 111 /** 97 112 * The gettext implmentation of select_plural_form. … … 131 146 * Adds parantheses to the inner parts of ternary operators in 132 147 * plural expressions, because PHP evaluates ternary oerators from left to right 133 * 148 * 134 149 * @param string $expression the expression without parentheses 135 150 * @return string the expression with parentheses added … … 159 174 return rtrim($res, ';'); 160 175 } 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 } 161 189 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); 170 194 } 195 196 171 197 } 172 198 -
branches/2.8/wp-includes/post-template.php
r11553 r11698 431 431 $classes[] = 'page-parent'; 432 432 433 if ( $wp_query->post->post_parent ) 433 if ( $wp_query->post->post_parent ) { 434 434 $classes[] = 'page-child'; 435 435 $classes[] = 'parent-pageid-' . $wp_query->post->post_parent; 436 437 if ( is_page_template() ) 436 } 437 if ( is_page_template() ) { 438 438 $classes[] = 'page-template'; 439 439 $classes[] = 'page-template-' . str_replace( '.php', '-php', get_post_meta( $pageID, '_wp_page_template', true ) ); 440 } 440 441 } elseif ( is_search() ) { 441 442 if ( !empty($wp_query->posts) ) … … 806 807 */ 807 808 function 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' => ''); 809 810 $args = wp_parse_args( $args, $defaults ); 810 811 $args = apply_filters( 'wp_page_menu_args', $args ); -
branches/2.8/wp-includes/post.php
r11553 r11698 1193 1193 clean_page_cache($child->ID); 1194 1194 1195 $wp_rewrite->flush_rules( );1195 $wp_rewrite->flush_rules(false); 1196 1196 } else { 1197 1197 clean_post_cache($postid); … … 3355 3355 if ( !defined('WP_IMPORTING') ) { 3356 3356 global $wp_rewrite; 3357 $wp_rewrite->flush_rules( );3357 $wp_rewrite->flush_rules(false); 3358 3358 } 3359 3359 } else { -
branches/2.8/wp-includes/query.php
r11553 r11698 1235 1235 $qv['w'] = absint($qv['w']); 1236 1236 $qv['m'] = absint($qv['m']); 1237 $qv['paged'] = absint($qv['paged']); 1237 1238 $qv['cat'] = preg_replace( '|[^0-9,-]|', '', $qv['cat'] ); // comma separated list of positive or negative integers 1238 1239 $qv['pagename'] = trim( $qv['pagename'] ); -
branches/2.8/wp-includes/rewrite.php
r11553 r11698 1823 1823 * @since 2.0.1 1824 1824 * @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) { 1827 1828 delete_transient('rewrite_rules'); 1828 1829 $this->wp_rewrite_rules(); 1829 if ( function_exists('save_mod_rewrite_rules') )1830 if ( $hard && function_exists('save_mod_rewrite_rules') ) 1830 1831 save_mod_rewrite_rules(); 1831 if ( function_exists('iis7_save_url_rewrite_rules') )1832 if ( $hard && function_exists('iis7_save_url_rewrite_rules') ) 1832 1833 iis7_save_url_rewrite_rules(); 1833 1834 } -
branches/2.8/wp-includes/script-loader.php
r11553 r11698 241 241 $scripts->add_data( 'user-profile', 'group', 1 ); 242 242 243 $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20090 209' );243 $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20090627' ); 244 244 $scripts->add_data( 'admin-comments', 'group', 1 ); 245 245 $scripts->localize( 'admin-comments', 'adminCommentsL10n', array( … … 250 250 $scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", false, '3517m' ); 251 251 252 $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20090 327' );252 $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20090618' ); 253 253 $scripts->add_data( 'postbox', 'group', 1 ); 254 254 $scripts->localize( 'postbox', 'postboxL10n', array( … … 265 265 ) ); 266 266 267 $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox', 'slug'), '20090 526' );267 $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox', 'slug'), '20090624' ); 268 268 $scripts->add_data( 'post', 'group', 1 ); 269 269 $scripts->localize( 'post', 'postL10n', array( … … 378 378 $scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array('jquery'), '1.2' ); 379 379 380 $scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox' ), '20090 201' );380 $scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox' ), '20090618' ); 381 381 $scripts->add_data( 'dashboard', 'group', 1 ); 382 382 … … 422 422 423 423 // all colors stylesheets need to have the same query strings (cache manifest compat) 424 $colors_version = '200906 10';425 426 $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '200906 10' );424 $colors_version = '20090625'; 425 426 $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20090625' ); 427 427 $styles->add_data( 'wp-admin', 'rtl', '/wp-admin/rtl.css' ); 428 428 429 $styles->add( 'ie', '/wp-admin/css/ie.css', array(), '20090 514' );429 $styles->add( 'ie', '/wp-admin/css/ie.css', array(), '20090630' ); 430 430 $styles->add_data( 'ie', 'conditional', 'lte IE 7' ); 431 431 … … 439 439 $styles->add_data( 'colors-classic', 'rtl', true ); 440 440 441 $styles->add( 'global', '/wp-admin/css/global.css', array(), '20090 514' );441 $styles->add( 'global', '/wp-admin/css/global.css', array(), '20090630' ); 442 442 $styles->add( 'media', '/wp-admin/css/media.css', array(), '20090516' ); 443 443 $styles->add( 'widgets', '/wp-admin/css/widgets.css', array(), '20090603' ); 444 444 $styles->add( 'dashboard', '/wp-admin/css/dashboard.css', array(), '20090514' ); 445 445 $styles->add( 'install', '/wp-admin/css/install.css', array(), '20090514' ); 446 $styles->add( 'theme-editor', '/wp-admin/css/theme-editor.css', array(), '20090 514' );446 $styles->add( 'theme-editor', '/wp-admin/css/theme-editor.css', array(), '20090625' ); 447 447 $styles->add( 'press-this', '/wp-admin/css/press-this.css', array(), '20090514' ); 448 448 $styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array(), '20090514' ); -
branches/2.8/wp-includes/update.php
r11553 r11698 116 116 $new_option = new stdClass; 117 117 $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 hours118 $timeout = 'load-plugins.php' == current_filter() ? 3600 : 43200; //Check for updated every 60 minutes if hitting the themes page, Else, check every 12 hours 119 119 $time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked ); 120 120 … … 199 199 $new_option = new stdClass; 200 200 $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 hours201 $timeout = 'load-themes.php' == current_filter() ? 3600 : 43200; //Check for updated every 60 minutes if hitting the themes page, Else, check every 12 hours 202 202 $time_not_changed = isset( $current_theme->last_checked ) && $timeout > ( time( ) - $current_theme->last_checked ); 203 203 -
branches/2.8/wp-includes/version.php
r11553 r11698 9 9 * @global string $wp_version 10 10 */ 11 $wp_version = '2.8.1- rare';11 $wp_version = '2.8.1-RC1'; 12 12 13 13 /** … … 30 30 * @global string $manifest_version 31 31 */ 32 $manifest_version = '2009061 0';32 $manifest_version = '20090616'; -
branches/2.8/wp-includes/widgets.php
r11553 r11698 886 886 global $wp_registered_widgets; 887 887 888 $sidebars_widgets = wp_get_sidebars_widgets( false);888 $sidebars_widgets = wp_get_sidebars_widgets(); 889 889 890 890 if ( is_array($sidebars_widgets) ) { … … 936 936 function is_active_sidebar( $index ) { 937 937 $index = ( is_int($index) ) ? "sidebar-$index" : sanitize_title($index); 938 $sidebars_widgets = get_option( 'sidebars_widgets', array());938 $sidebars_widgets = wp_get_sidebars_widgets(); 939 939 if ( isset($sidebars_widgets[$index]) && !empty($sidebars_widgets[$index]) ) 940 940 return true; … … 954 954 * @access private 955 955 * 956 * @param bool $update Optional, de fault 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 */ 959 function wp_get_sidebars_widgets($deprecated = true) { 960 960 global $wp_registered_widgets, $wp_registered_sidebars, $_wp_sidebars_widgets; 961 961 962 962 // If loading from front page, consult $_wp_sidebars_widgets rather than options 963 963 // 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 { 965 970 $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]); 986 1012 } 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; 1033 1014 $sidebars_widgets = $_sidebars_widgets; 1034 1015 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 } 1039 1043 } 1040 1044 … … 1087 1091 */ 1088 1092 function wp_convert_widget_settings($base_name, $option_name, $settings) { 1089 global $_wp_sidebars_widgets;1090 1093 // This test may need expanding. 1091 $single = false;1094 $single = $changed = false; 1092 1095 if ( empty($settings) ) { 1093 1096 $single = true; … … 1111 1114 } else { 1112 1115 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()); 1114 1117 $sidebars_widgets = &$GLOBALS['_wp_sidebars_widgets']; 1115 1118 } … … 1120 1123 if ( $base_name == $name ) { 1121 1124 $sidebars_widgets[$index][$i] = "$name-2"; 1125 $changed = true; 1122 1126 break 2; 1123 1127 } … … 1126 1130 } 1127 1131 1128 if ( is_admin() )1132 if ( is_admin() && $changed ) 1129 1133 update_option('sidebars_widgets', $sidebars_widgets); 1130 1134 } -
branches/2.8/wp-settings.php
r11553 r11698 61 61 $blog_id = 1; 62 62 63 // Fix for IIS , which doesn't set REQUEST_URI64 if ( empty( $_SERVER['REQUEST_URI'] ) ) {63 // Fix for IIS when running with PHP ISAPI 64 if ( empty( $_SERVER['REQUEST_URI'] ) || ( php_sapi_name() != 'cgi-fcgi' && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) ) ) { 65 65 66 66 // IIS Mod-Rewrite … … 317 317 require_once(ABSPATH . WPINC . '/kses.php'); 318 318 require_once(ABSPATH . WPINC . '/pluggable.php'); 319 require_once(ABSPATH . WPINC . '/formatting.php'); 319 320 wp_redirect($link); 320 321 die(); // have to die here ~ Mark … … 529 530 require (ABSPATH . WPINC . '/vars.php'); 530 531 532 // make taxonomies available to plugins and themes 533 // @plugin authors: warning: this gets registered again on the init hook 534 create_initial_taxonomies(); 535 531 536 // Check for hacks file if the option is enabled 532 537 if ( get_option('hack_file') ) { -
branches/2.8/xmlrpc.php
r11553 r11698 40 40 <homePageLink><?php bloginfo_rss('url') ?></homePageLink> 41 41 <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') ) ?>" /> 47 47 </apis> 48 48 </service> … … 2574 2574 $post_date = mysql2date('Ymd\TH:i:s', $postdata['post_date'], false); 2575 2575 $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 } 2576 2583 2577 2584 $categories = array(); … … 3294 3301 $p = explode( "\n\n", $linea ); 3295 3302 3296 $preg_target = preg_quote($pagelinkedto );3303 $preg_target = preg_quote($pagelinkedto, '|'); 3297 3304 3298 3305 foreach ( $p as $para ) { … … 3316 3323 $excerpt = strip_tags($excerpt, '<wpcontext>'); // strip all tags but our context marker 3317 3324 $excerpt = trim($excerpt); 3318 $preg_marker = preg_quote($marker );3325 $preg_marker = preg_quote($marker, '|'); 3319 3326 $excerpt = preg_replace("|.*?\s(.{0,100}$preg_marker.{0,100})\s.*|s", '$1', $excerpt); 3320 3327 $excerpt = strip_tags($excerpt); // YES, again, to remove the marker wrapper
Note: See TracChangeset
for help on using the changeset viewer.