Changeset 42343 for trunk/src/wp-admin/includes/template.php
- Timestamp:
- 11/30/2017 11:09:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/template.php
r42146 r42343 39 39 */ 40 40 function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null, $checked_ontop = true ) { 41 wp_terms_checklist( $post_id, array( 42 'taxonomy' => 'category', 43 'descendants_and_self' => $descendants_and_self, 44 'selected_cats' => $selected_cats, 45 'popular_cats' => $popular_cats, 46 'walker' => $walker, 47 'checked_ontop' => $checked_ontop 48 ) ); 41 wp_terms_checklist( 42 $post_id, array( 43 'taxonomy' => 'category', 44 'descendants_and_self' => $descendants_and_self, 45 'selected_cats' => $selected_cats, 46 'popular_cats' => $popular_cats, 47 'walker' => $walker, 48 'checked_ontop' => $checked_ontop, 49 ) 50 ); 49 51 } 50 52 … … 76 78 */ 77 79 function wp_terms_checklist( $post_id = 0, $args = array() ) { 78 80 $defaults = array( 79 81 'descendants_and_self' => 0, 80 'selected_cats' => false,81 'popular_cats' => false,82 'walker' => null,83 'taxonomy' => 'category',84 'checked_ontop' => true,85 'echo' => true,82 'selected_cats' => false, 83 'popular_cats' => false, 84 'walker' => null, 85 'taxonomy' => 'category', 86 'checked_ontop' => true, 87 'echo' => true, 86 88 ); 87 89 … … 106 108 } 107 109 108 $taxonomy = $r['taxonomy'];110 $taxonomy = $r['taxonomy']; 109 111 $descendants_and_self = (int) $r['descendants_and_self']; 110 112 111 113 $args = array( 'taxonomy' => $taxonomy ); 112 114 113 $tax = get_taxonomy( $taxonomy );115 $tax = get_taxonomy( $taxonomy ); 114 116 $args['disabled'] = ! current_user_can( $tax->cap->assign_terms ); 115 117 … … 126 128 $args['popular_cats'] = $r['popular_cats']; 127 129 } else { 128 $args['popular_cats'] = get_terms( $taxonomy, array( 129 'fields' => 'ids', 130 'orderby' => 'count', 131 'order' => 'DESC', 132 'number' => 10, 133 'hierarchical' => false 134 ) ); 130 $args['popular_cats'] = get_terms( 131 $taxonomy, array( 132 'fields' => 'ids', 133 'orderby' => 'count', 134 'order' => 'DESC', 135 'number' => 10, 136 'hierarchical' => false, 137 ) 138 ); 135 139 } 136 140 if ( $descendants_and_self ) { 137 $categories = (array) get_terms( $taxonomy, array( 138 'child_of' => $descendants_and_self, 139 'hierarchical' => 0, 140 'hide_empty' => 0 141 ) ); 142 $self = get_term( $descendants_and_self, $taxonomy ); 141 $categories = (array) get_terms( 142 $taxonomy, array( 143 'child_of' => $descendants_and_self, 144 'hierarchical' => 0, 145 'hide_empty' => 0, 146 ) 147 ); 148 $self = get_term( $descendants_and_self, $taxonomy ); 143 149 array_unshift( $categories, $self ); 144 150 } else { … … 151 157 // Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache) 152 158 $checked_categories = array(); 153 $keys = array_keys( $categories );159 $keys = array_keys( $categories ); 154 160 155 161 foreach ( $keys as $k ) { 156 if ( in_array( $categories[ $k]->term_id, $args['selected_cats'] ) ) {157 $checked_categories[] = $categories[ $k];158 unset( $categories[ $k] );162 if ( in_array( $categories[ $k ]->term_id, $args['selected_cats'] ) ) { 163 $checked_categories[] = $categories[ $k ]; 164 unset( $categories[ $k ] ); 159 165 } 160 166 } … … 192 198 $post = get_post(); 193 199 194 if ( $post && $post->ID ) 195 $checked_terms = wp_get_object_terms( $post->ID, $taxonomy, array('fields'=>'ids'));196 else200 if ( $post && $post->ID ) { 201 $checked_terms = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) ); 202 } else { 197 203 $checked_terms = array(); 198 199 $terms = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false ) ); 200 201 $tax = get_taxonomy($taxonomy); 204 } 205 206 $terms = get_terms( 207 $taxonomy, array( 208 'orderby' => 'count', 209 'order' => 'DESC', 210 'number' => $number, 211 'hierarchical' => false, 212 ) 213 ); 214 215 $tax = get_taxonomy( $taxonomy ); 202 216 203 217 $popular_ids = array(); 204 218 foreach ( (array) $terms as $term ) { 205 219 $popular_ids[] = $term->term_id; 206 if ( ! $echo )// Hack for Ajax use.220 if ( ! $echo ) { // Hack for Ajax use. 207 221 continue; 208 $id = "popular-$taxonomy-$term->term_id"; 222 } 223 $id = "popular-$taxonomy-$term->term_id"; 209 224 $checked = in_array( $term->term_id, $checked_terms ) ? 'checked="checked"' : ''; 210 225 ?> … … 247 262 } 248 263 249 $categories = get_terms( 'link_category', array( 'orderby' => 'name', 'hide_empty' => 0 ) ); 250 251 if ( empty( $categories ) ) 264 $categories = get_terms( 265 'link_category', array( 266 'orderby' => 'name', 267 'hide_empty' => 0, 268 ) 269 ); 270 271 if ( empty( $categories ) ) { 252 272 return; 273 } 253 274 254 275 foreach ( $categories as $category ) { … … 256 277 257 278 /** This filter is documented in wp-includes/category-template.php */ 258 $name = esc_html( apply_filters( 'the_category', $category->name, '', '' ) );279 $name = esc_html( apply_filters( 'the_category', $category->name, '', '' ) ); 259 280 $checked = in_array( $cat_id, $checked_categories ) ? ' checked="checked"' : ''; 260 echo '<li id="link-category-', $cat_id, '"><label for="in-link-category-', $cat_id, '" class="selectit"><input value="', $cat_id, '" type="checkbox" name="link_category[]" id="in-link-category-', $cat_id, '"', $checked, '/> ', $name, "</label></li>";281 echo '<li id="link-category-', $cat_id, '"><label for="in-link-category-', $cat_id, '" class="selectit"><input value="', $cat_id, '" type="checkbox" name="link_category[]" id="in-link-category-', $cat_id, '"', $checked, '/> ', $name, '</label></li>'; 261 282 } 262 283 } … … 269 290 * @param WP_Post $post Post object. 270 291 */ 271 function get_inline_data( $post) {272 $post_type_object = get_post_type_object( $post->post_type);273 if ( ! current_user_can( 'edit_post', $post->ID ) ) 292 function get_inline_data( $post ) { 293 $post_type_object = get_post_type_object( $post->post_type ); 294 if ( ! current_user_can( 'edit_post', $post->ID ) ) { 274 295 return; 296 } 275 297 276 298 $title = esc_textarea( trim( $post->post_title ) ); … … 305 327 306 328 $taxonomy_names = get_object_taxonomies( $post->post_type ); 307 foreach ( $taxonomy_names as $taxonomy_name ) {329 foreach ( $taxonomy_names as $taxonomy_name ) { 308 330 $taxonomy = get_taxonomy( $taxonomy_name ); 309 331 … … 326 348 } 327 349 328 echo '<div class="tags_input" id="' .$taxonomy_name.'_'.$post->ID.'">'350 echo '<div class="tags_input" id="' . $taxonomy_name . '_' . $post->ID . '">' 329 351 . esc_html( str_replace( ',', ', ', $terms_to_edit ) ) . '</div>'; 330 352 … … 332 354 } 333 355 334 if ( !$post_type_object->hierarchical ) 335 echo '<div class="sticky">' . (is_sticky($post->ID) ? 'sticky' : '') . '</div>'; 336 337 if ( post_type_supports( $post->post_type, 'post-formats' ) ) 356 if ( ! $post_type_object->hierarchical ) { 357 echo '<div class="sticky">' . ( is_sticky( $post->ID ) ? 'sticky' : '' ) . '</div>'; 358 } 359 360 if ( post_type_supports( $post->post_type, 'post-formats' ) ) { 338 361 echo '<div class="post_format">' . esc_html( get_post_format( $post->ID ) ) . '</div>'; 362 } 339 363 340 364 echo '</div>'; … … 370 394 * @param array $args An array of default args. 371 395 */ 372 $content = apply_filters( 'wp_comment_reply', '', array( 'position' => $position, 'checkbox' => $checkbox, 'mode' => $mode ) ); 373 374 if ( ! empty($content) ) { 396 $content = apply_filters( 397 'wp_comment_reply', '', array( 398 'position' => $position, 399 'checkbox' => $checkbox, 400 'mode' => $mode, 401 ) 402 ); 403 404 if ( ! empty( $content ) ) { 375 405 echo $content; 376 406 return; … … 379 409 if ( ! $wp_list_table ) { 380 410 if ( $mode == 'single' ) { 381 $wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table');411 $wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table' ); 382 412 } else { 383 $wp_list_table = _get_list_table( 'WP_Comments_List_Table');413 $wp_list_table = _get_list_table( 'WP_Comments_List_Table' ); 384 414 } 385 415 } … … 403 433 <?php 404 434 $quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close' ); 405 wp_editor( '', 'replycontent', array( 'media_buttons' => false, 'tinymce' => false, 'quicktags' => $quicktags_settings ) ); 435 wp_editor( 436 '', 'replycontent', array( 437 'media_buttons' => false, 438 'tinymce' => false, 439 'quicktags' => $quicktags_settings, 440 ) 441 ); 406 442 ?> 407 443 </div> … … 409 445 <div id="edithead" style="display:none;"> 410 446 <div class="inside"> 411 <label for="author-name"><?php _e( 'Name' ) ?></label>447 <label for="author-name"><?php _e( 'Name' ); ?></label> 412 448 <input type="text" name="newcomment_author" size="50" value="" id="author-name" /> 413 449 </div> 414 450 415 451 <div class="inside"> 416 <label for="author-email"><?php _e( 'Email')?></label>452 <label for="author-email"><?php _e( 'Email' ); ?></label> 417 453 <input type="text" name="newcomment_author_email" size="50" value="" id="author-email" /> 418 454 </div> 419 455 420 456 <div class="inside"> 421 <label for="author-url"><?php _e( 'URL')?></label>457 <label for="author-url"><?php _e( 'URL' ); ?></label> 422 458 <input type="text" id="author-url" name="newcomment_author_url" class="code" size="103" value="" /> 423 459 </div> … … 446 482 <input type="hidden" name="position" id="position" value="<?php echo $position; ?>" /> 447 483 <input type="hidden" name="checkbox" id="checkbox" value="<?php echo $checkbox ? 1 : 0; ?>" /> 448 <input type="hidden" name="mode" id="mode" value="<?php echo esc_attr( $mode); ?>" />484 <input type="hidden" name="mode" id="mode" value="<?php echo esc_attr( $mode ); ?>" /> 449 485 <?php 450 486 wp_nonce_field( 'replyto-comment', '_ajax_nonce-replyto-comment', false ); 451 if ( current_user_can( 'unfiltered_html' ) ) 452 wp_nonce_field( 'unfiltered-html-comment', '_wp_unfiltered_html_comment', false ); 487 if ( current_user_can( 'unfiltered_html' ) ) { 488 wp_nonce_field( 'unfiltered-html-comment', '_wp_unfiltered_html_comment', false ); 489 } 453 490 ?> 454 491 </fieldset> … … 470 507 ?> 471 508 <div class="hidden" id="trash-undo-holder"> 472 <div class="trash-undo-inside"><?php printf( __('Comment by %s moved to the trash.'), '<strong></strong>'); ?> <span class="undo untrash"><a href="#"><?php _e('Undo'); ?></a></span></div>509 <div class="trash-undo-inside"><?php printf( __( 'Comment by %s moved to the trash.' ), '<strong></strong>' ); ?> <span class="undo untrash"><a href="#"><?php _e( 'Undo' ); ?></a></span></div> 473 510 </div> 474 511 <div class="hidden" id="spam-undo-holder"> 475 <div class="spam-undo-inside"><?php printf( __('Comment by %s marked as spam.'), '<strong></strong>'); ?> <span class="undo unspam"><a href="#"><?php _e('Undo'); ?></a></span></div>512 <div class="spam-undo-inside"><?php printf( __( 'Comment by %s marked as spam.' ), '<strong></strong>' ); ?> <span class="undo unspam"><a href="#"><?php _e( 'Undo' ); ?></a></span></div> 476 513 </div> 477 514 <?php … … 507 544 <thead> 508 545 <tr> 509 <th class="left"><?php _ex( 'Name', 'meta name' ) ?></th>510 <th><?php _e( 'Value' ) ?></th>546 <th class="left"><?php _ex( 'Name', 'meta name' ); ?></th> 547 <th><?php _e( 'Value' ); ?></th> 511 548 </tr> 512 549 </thead> 513 550 <tbody id='the-list' data-wp-lists='list:meta'> 514 551 <?php 515 foreach ( $meta as $entry ) 516 echo _list_meta_row( $entry, $count ); 552 foreach ( $meta as $entry ) { 553 echo _list_meta_row( $entry, $count ); 554 } 517 555 ?> 518 556 </tbody> … … 535 573 static $update_nonce = ''; 536 574 537 if ( is_protected_meta( $entry['meta_key'], 'post' ) ) 575 if ( is_protected_meta( $entry['meta_key'], 'post' ) ) { 538 576 return ''; 539 540 if ( ! $update_nonce ) 577 } 578 579 if ( ! $update_nonce ) { 541 580 $update_nonce = wp_create_nonce( 'add-meta' ); 581 } 542 582 543 583 $r = ''; … … 555 595 } 556 596 557 $entry['meta_key'] = esc_attr($entry['meta_key']);597 $entry['meta_key'] = esc_attr( $entry['meta_key'] ); 558 598 $entry['meta_value'] = esc_textarea( $entry['meta_value'] ); // using a <textarea /> 559 $entry['meta_id'] = (int) $entry['meta_id'];599 $entry['meta_id'] = (int) $entry['meta_id']; 560 600 561 601 $delete_nonce = wp_create_nonce( 'delete-meta_' . $entry['meta_id'] ); … … 568 608 $r .= "\n\t\t"; 569 609 $r .= get_submit_button( __( 'Update' ), 'updatemeta small', "meta-{$entry['meta_id']}-submit", false, array( 'data-wp-lists' => "add:the-list:meta-{$entry['meta_id']}::_ajax_nonce-add-meta=$update_nonce" ) ); 570 $r .= "</div>";610 $r .= '</div>'; 571 611 $r .= wp_nonce_field( 'change-meta', '_ajax_nonce', false, false ); 572 $r .= "</td>";612 $r .= '</td>'; 573 613 574 614 $r .= "\n\t\t<td><label class='screen-reader-text' for='meta-{$entry['meta_id']}-value'>" . __( 'Value' ) . "</label><textarea name='meta[{$entry['meta_id']}][value]' id='meta-{$entry['meta_id']}-value' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>\n\t</tr>"; … … 612 652 */ 613 653 $limit = apply_filters( 'postmeta_form_limit', 30 ); 614 $sql = "SELECT DISTINCT meta_key654 $sql = "SELECT DISTINCT meta_key 615 655 FROM $wpdb->postmeta 616 656 WHERE meta_key NOT BETWEEN '_' AND '_z' … … 618 658 ORDER BY meta_key 619 659 LIMIT %d"; 620 $keys = $wpdb->get_col( $wpdb->prepare( $sql, $wpdb->esc_like( '_' ) . '%', $limit ) );660 $keys = $wpdb->get_col( $wpdb->prepare( $sql, $wpdb->esc_like( '_' ) . '%', $limit ) ); 621 661 } 622 662 … … 628 668 } 629 669 ?> 630 <p><strong><?php _e( 'Add New Custom Field:' ) ?></strong></p>670 <p><strong><?php _e( 'Add New Custom Field:' ); ?></strong></p> 631 671 <table id="newmeta"> 632 672 <thead> 633 673 <tr> 634 <th class="left"><label for="<?php echo $meta_key_input_id; ?>"><?php _ex( 'Name', 'meta name' ) ?></label></th>635 <th><label for="metavalue"><?php _e( 'Value' ) ?></label></th>674 <th class="left"><label for="<?php echo $meta_key_input_id; ?>"><?php _ex( 'Name', 'meta name' ); ?></label></th> 675 <th><label for="metavalue"><?php _e( 'Value' ); ?></label></th> 636 676 </tr> 637 677 </thead> … … 645 685 <?php 646 686 647 foreach ( $keys as $key ) { 648 if ( is_protected_meta( $key, 'post' ) || ! current_user_can( 'add_post_meta', $post->ID, $key ) ) 649 continue; 650 echo "\n<option value='" . esc_attr($key) . "'>" . esc_html($key) . "</option>"; 651 } 687 foreach ( $keys as $key ) { 688 if ( is_protected_meta( $key, 'post' ) || ! current_user_can( 'add_post_meta', $post->ID, $key ) ) { 689 continue; 690 } 691 echo "\n<option value='" . esc_attr( $key ) . "'>" . esc_html( $key ) . '</option>'; 692 } 652 693 ?> 653 694 </select> 654 695 <input class="hide-if-js" type="text" id="metakeyinput" name="metakeyinput" value="" /> 655 696 <a href="#postcustomstuff" class="hide-if-no-js" onclick="jQuery('#metakeyinput, #metakeyselect, #enternew, #cancelnew').toggle();return false;"> 656 <span id="enternew"><?php _e( 'Enter new'); ?></span>657 <span id="cancelnew" class="hidden"><?php _e( 'Cancel'); ?></span></a>697 <span id="enternew"><?php _e( 'Enter new' ); ?></span> 698 <span id="cancelnew" class="hidden"><?php _e( 'Cancel' ); ?></span></a> 658 699 <?php } else { ?> 659 700 <input type="text" id="metakeyinput" name="metakeyinput" value="" /> … … 665 706 <tr><td colspan="2"> 666 707 <div class="submit"> 667 <?php submit_button( __( 'Add Custom Field' ), '', 'addmeta', false, array( 'id' => 'newmeta-submit', 'data-wp-lists' => 'add:the-list:newmeta' ) ); ?> 708 <?php 709 submit_button( 710 __( 'Add Custom Field' ), '', 'addmeta', false, array( 711 'id' => 'newmeta-submit', 712 'data-wp-lists' => 'add:the-list:newmeta', 713 ) 714 ); 715 ?> 668 716 </div> 669 717 <?php wp_nonce_field( 'add-meta', '_ajax_nonce-add-meta', false ); ?> … … 693 741 $post = get_post(); 694 742 695 if ( $for_post ) 696 $edit = ! ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) ); 743 if ( $for_post ) { 744 $edit = ! ( in_array( $post->post_status, array( 'draft', 'pending' ) ) && ( ! $post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) ); 745 } 697 746 698 747 $tab_index_attribute = ''; 699 if ( (int) $tab_index > 0 ) 748 if ( (int) $tab_index > 0 ) { 700 749 $tab_index_attribute = " tabindex=\"$tab_index\""; 750 } 701 751 702 752 // todo: Remove this? 703 753 // echo '<label for="timestamp" style="display: block;"><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp"'.$tab_index_attribute.' /> '.__( 'Edit timestamp' ).'</label><br />'; 704 754 705 $time_adj = current_time('timestamp');706 $post_date = ( $for_post) ? $post->post_date : get_comment()->comment_date;707 $jj = ($edit) ? mysql2date( 'd', $post_date, false ) : gmdate( 'd', $time_adj );708 $mm = ($edit) ? mysql2date( 'm', $post_date, false ) : gmdate( 'm', $time_adj );709 $aa = ($edit) ? mysql2date( 'Y', $post_date, false ) : gmdate( 'Y', $time_adj );710 $hh = ($edit) ? mysql2date( 'H', $post_date, false ) : gmdate( 'H', $time_adj );711 $mn = ($edit) ? mysql2date( 'i', $post_date, false ) : gmdate( 'i', $time_adj );712 $ss = ($edit) ? mysql2date( 's', $post_date, false ) : gmdate( 's', $time_adj );755 $time_adj = current_time( 'timestamp' ); 756 $post_date = ( $for_post ) ? $post->post_date : get_comment()->comment_date; 757 $jj = ( $edit ) ? mysql2date( 'd', $post_date, false ) : gmdate( 'd', $time_adj ); 758 $mm = ( $edit ) ? mysql2date( 'm', $post_date, false ) : gmdate( 'm', $time_adj ); 759 $aa = ( $edit ) ? mysql2date( 'Y', $post_date, false ) : gmdate( 'Y', $time_adj ); 760 $hh = ( $edit ) ? mysql2date( 'H', $post_date, false ) : gmdate( 'H', $time_adj ); 761 $mn = ( $edit ) ? mysql2date( 'i', $post_date, false ) : gmdate( 'i', $time_adj ); 762 $ss = ( $edit ) ? mysql2date( 's', $post_date, false ) : gmdate( 's', $time_adj ); 713 763 714 764 $cur_jj = gmdate( 'd', $time_adj ); … … 719 769 720 770 $month = '<label><span class="screen-reader-text">' . __( 'Month' ) . '</span><select ' . ( $multi ? '' : 'id="mm" ' ) . 'name="mm"' . $tab_index_attribute . ">\n"; 721 for ( $i = 1; $i < 13; $i = $i + 1 ) {722 $monthnum = zeroise($i, 2);771 for ( $i = 1; $i < 13; $i = $i + 1 ) { 772 $monthnum = zeroise( $i, 2 ); 723 773 $monthtext = $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) ); 724 $month .= "\t\t\t" . '<option value="' . $monthnum . '" data-text="' . $monthtext . '" ' . selected( $monthnum, $mm, false ) . '>';774 $month .= "\t\t\t" . '<option value="' . $monthnum . '" data-text="' . $monthtext . '" ' . selected( $monthnum, $mm, false ) . '>'; 725 775 /* translators: 1: month number (01, 02, etc.), 2: month abbreviation */ 726 776 $month .= sprintf( __( '%1$s-%2$s' ), $monthnum, $monthtext ) . "</option>\n"; … … 728 778 $month .= '</select></label>'; 729 779 730 $day = '<label><span class="screen-reader-text">' . __( 'Day' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="jj" ' ) . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" /></label>';731 $year = '<label><span class="screen-reader-text">' . __( 'Year' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="aa" ' ) . 'name="aa" value="' . $aa . '" size="4" maxlength="4"' . $tab_index_attribute . ' autocomplete="off" /></label>';732 $hour = '<label><span class="screen-reader-text">' . __( 'Hour' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="hh" ' ) . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" /></label>';780 $day = '<label><span class="screen-reader-text">' . __( 'Day' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="jj" ' ) . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" /></label>'; 781 $year = '<label><span class="screen-reader-text">' . __( 'Year' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="aa" ' ) . 'name="aa" value="' . $aa . '" size="4" maxlength="4"' . $tab_index_attribute . ' autocomplete="off" /></label>'; 782 $hour = '<label><span class="screen-reader-text">' . __( 'Hour' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="hh" ' ) . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" /></label>'; 733 783 $minute = '<label><span class="screen-reader-text">' . __( 'Minute' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="mn" ' ) . 'name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" /></label>'; 734 784 … … 739 789 echo '</div><input type="hidden" id="ss" name="ss" value="' . $ss . '" />'; 740 790 741 if ( $multi ) return; 791 if ( $multi ) { 792 return; 793 } 742 794 743 795 echo "\n\n"; … … 759 811 760 812 <p> 761 <a href="#edit_timestamp" class="save-timestamp hide-if-no-js button"><?php _e( 'OK'); ?></a>762 <a href="#edit_timestamp" class="cancel-timestamp hide-if-no-js button-cancel"><?php _e( 'Cancel'); ?></a>813 <a href="#edit_timestamp" class="save-timestamp hide-if-no-js button"><?php _e( 'OK' ); ?></a> 814 <a href="#edit_timestamp" class="cancel-timestamp hide-if-no-js button-cancel"><?php _e( 'Cancel' ); ?></a> 763 815 </p> 764 816 <?php … … 779 831 foreach ( array_keys( $templates ) as $template ) { 780 832 $selected = selected( $default, $templates[ $template ], false ); 781 echo "\n\t<option value='" . esc_attr( $templates[ $template ] ) . "' $selected>" . esc_html( $template ) . "</option>";833 echo "\n\t<option value='" . esc_attr( $templates[ $template ] ) . "' $selected>" . esc_html( $template ) . '</option>'; 782 834 } 783 835 } … … 800 852 function parent_dropdown( $default = 0, $parent = 0, $level = 0, $post = null ) { 801 853 global $wpdb; 802 $post = get_post( $post );803 $items = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent) );854 $post = get_post( $post ); 855 $items = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent ) ); 804 856 805 857 if ( $items ) { 806 858 foreach ( $items as $item ) { 807 859 // A page cannot be its own parent. 808 if ( $post && $post->ID && $item->ID == $post->ID ) 860 if ( $post && $post->ID && $item->ID == $post->ID ) { 809 861 continue; 810 811 $pad = str_repeat( ' ', $level * 3 ); 862 } 863 864 $pad = str_repeat( ' ', $level * 3 ); 812 865 $selected = selected( $default, $item->ID, false ); 813 866 814 echo "\n\t<option class='level-$level' value='$item->ID' $selected>$pad " . esc_html( $item->post_title) . "</option>";815 parent_dropdown( $default, $item->ID, $level + 1 );867 echo "\n\t<option class='level-$level' value='$item->ID' $selected>$pad " . esc_html( $item->post_title ) . '</option>'; 868 parent_dropdown( $default, $item->ID, $level + 1 ); 816 869 } 817 870 } else { … … 833 886 834 887 foreach ( $editable_roles as $role => $details ) { 835 $name = translate_user_role( $details['name'] );888 $name = translate_user_role( $details['name'] ); 836 889 // preselect specified role 837 890 if ( $selected == $role ) { … … 863 916 * @param int $max_upload_size Allowed upload size. Default 1 MB. 864 917 */ 865 $bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() );866 $size = size_format( $bytes );918 $bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() ); 919 $size = size_format( $bytes ); 867 920 $upload_dir = wp_upload_dir(); 868 921 if ( ! empty( $upload_dir['error'] ) ) : 869 ?><div class="error"><p><?php _e('Before you can upload your import file, you will need to fix the following error:'); ?></p> 870 <p><strong><?php echo $upload_dir['error']; ?></strong></p></div><?php 922 ?> 923 <div class="error"><p><?php _e( 'Before you can upload your import file, you will need to fix the following error:' ); ?></p> 924 <p><strong><?php echo $upload_dir['error']; ?></strong></p></div> 925 <?php 871 926 else : 872 927 ?> 873 928 <form enctype="multipart/form-data" id="import-upload-form" method="post" class="wp-upload-form" action="<?php echo esc_url( wp_nonce_url( $action, 'import-upload' ) ); ?>"> 874 929 <p> 875 <label for="upload"><?php _e( 'Choose a file from your computer:' ); ?></label> (<?php printf( __( 'Maximum size: %s' ), $size ); ?>)930 <label for="upload"><?php _e( 'Choose a file from your computer:' ); ?></label> (<?php printf( __( 'Maximum size: %s' ), $size ); ?>) 876 931 <input type="file" id="upload" name="import" size="25" /> 877 932 <input type="hidden" name="action" value="save" /> 878 933 <input type="hidden" name="max_file_size" value="<?php echo $bytes; ?>" /> 879 934 </p> 880 <?php submit_button( __( 'Upload file and import'), 'primary' ); ?>935 <?php submit_button( __( 'Upload file and import' ), 'primary' ); ?> 881 936 </form> 882 937 <?php … … 934 989 $page = $screen->id; 935 990 936 if ( ! isset($wp_meta_boxes) )991 if ( ! isset( $wp_meta_boxes ) ) { 937 992 $wp_meta_boxes = array(); 938 if ( !isset($wp_meta_boxes[$page]) ) 939 $wp_meta_boxes[$page] = array(); 940 if ( !isset($wp_meta_boxes[$page][$context]) ) 941 $wp_meta_boxes[$page][$context] = array(); 942 943 foreach ( array_keys($wp_meta_boxes[$page]) as $a_context ) { 944 foreach ( array('high', 'core', 'default', 'low') as $a_priority ) { 945 if ( !isset($wp_meta_boxes[$page][$a_context][$a_priority][$id]) ) 993 } 994 if ( ! isset( $wp_meta_boxes[ $page ] ) ) { 995 $wp_meta_boxes[ $page ] = array(); 996 } 997 if ( ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) { 998 $wp_meta_boxes[ $page ][ $context ] = array(); 999 } 1000 1001 foreach ( array_keys( $wp_meta_boxes[ $page ] ) as $a_context ) { 1002 foreach ( array( 'high', 'core', 'default', 'low' ) as $a_priority ) { 1003 if ( ! isset( $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ] ) ) { 946 1004 continue; 1005 } 947 1006 948 1007 // If a core box was previously added or removed by a plugin, don't add. 949 1008 if ( 'core' == $priority ) { 950 1009 // If core box previously deleted, don't add 951 if ( false === $wp_meta_boxes[ $page][$a_context][$a_priority][$id] )1010 if ( false === $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ] ) { 952 1011 return; 1012 } 953 1013 954 1014 /* … … 957 1017 */ 958 1018 if ( 'default' == $a_priority ) { 959 $wp_meta_boxes[ $page][$a_context]['core'][$id] = $wp_meta_boxes[$page][$a_context]['default'][$id];960 unset( $wp_meta_boxes[$page][$a_context]['default'][$id]);1019 $wp_meta_boxes[ $page ][ $a_context ]['core'][ $id ] = $wp_meta_boxes[ $page ][ $a_context ]['default'][ $id ]; 1020 unset( $wp_meta_boxes[ $page ][ $a_context ]['default'][ $id ] ); 961 1021 } 962 1022 return; 963 1023 } 964 1024 // If no priority given and id already present, use existing priority. 965 if ( empty( $priority) ) {1025 if ( empty( $priority ) ) { 966 1026 $priority = $a_priority; 967 /*968 969 970 1027 /* 1028 * Else, if we're adding to the sorted priority, we don't know the title 1029 * or callback. Grab them from the previously added context/priority. 1030 */ 971 1031 } elseif ( 'sorted' == $priority ) { 972 $title = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['title'];973 $callback = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['callback'];974 $callback_args = $wp_meta_boxes[ $page][$a_context][$a_priority][$id]['args'];1032 $title = $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ]['title']; 1033 $callback = $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ]['callback']; 1034 $callback_args = $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ]['args']; 975 1035 } 976 1036 // An id can be in only one priority and one context. 977 if ( $priority != $a_priority || $context != $a_context ) 978 unset($wp_meta_boxes[$page][$a_context][$a_priority][$id]); 979 } 980 } 981 982 if ( empty($priority) ) 1037 if ( $priority != $a_priority || $context != $a_context ) { 1038 unset( $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ] ); 1039 } 1040 } 1041 } 1042 1043 if ( empty( $priority ) ) { 983 1044 $priority = 'low'; 984 985 if ( !isset($wp_meta_boxes[$page][$context][$priority]) ) 986 $wp_meta_boxes[$page][$context][$priority] = array(); 987 988 $wp_meta_boxes[$page][$context][$priority][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $callback_args); 1045 } 1046 1047 if ( ! isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { 1048 $wp_meta_boxes[ $page ][ $context ][ $priority ] = array(); 1049 } 1050 1051 $wp_meta_boxes[ $page ][ $context ][ $priority ][ $id ] = array( 1052 'id' => $id, 1053 'title' => $title, 1054 'callback' => $callback, 1055 'args' => $callback_args, 1056 ); 989 1057 } 990 1058 … … 1010 1078 static $already_sorted = false; 1011 1079 1012 if ( empty( $screen ) ) 1080 if ( empty( $screen ) ) { 1013 1081 $screen = get_current_screen(); 1014 elseif ( is_string( $screen ) )1082 } elseif ( is_string( $screen ) ) { 1015 1083 $screen = convert_to_screen( $screen ); 1084 } 1016 1085 1017 1086 $page = $screen->id; … … 1019 1088 $hidden = get_hidden_meta_boxes( $screen ); 1020 1089 1021 printf( '<div id="%s-sortables" class="meta-box-sortables">', htmlspecialchars($context));1090 printf( '<div id="%s-sortables" class="meta-box-sortables">', htmlspecialchars( $context ) ); 1022 1091 1023 1092 // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose … … 1038 1107 if ( isset( $wp_meta_boxes[ $page ][ $context ] ) ) { 1039 1108 foreach ( array( 'high', 'sorted', 'core', 'default', 'low' ) as $priority ) { 1040 if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) {1109 if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { 1041 1110 foreach ( (array) $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { 1042 if ( false == $box || ! $box['title'] ) 1111 if ( false == $box || ! $box['title'] ) { 1043 1112 continue; 1113 } 1044 1114 $i++; 1045 $hidden_class = in_array( $box['id'], $hidden) ? ' hide-if-js' : '';1046 echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes( $box['id'], $page) . $hidden_class . '" ' . '>' . "\n";1115 $hidden_class = in_array( $box['id'], $hidden ) ? ' hide-if-js' : ''; 1116 echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes( $box['id'], $page ) . $hidden_class . '" ' . '>' . "\n"; 1047 1117 if ( 'dashboard_browser_nag' != $box['id'] ) { 1048 $widget_title = $box[ 'title'];1049 1050 if ( is_array( $box[ 'args' ] ) && isset( $box[ 'args' ][ '__widget_basename'] ) ) {1051 $widget_title = $box[ 'args' ][ '__widget_basename'];1118 $widget_title = $box['title']; 1119 1120 if ( is_array( $box['args'] ) && isset( $box['args']['__widget_basename'] ) ) { 1121 $widget_title = $box['args']['__widget_basename']; 1052 1122 // Do not pass this parameter to the user callback function. 1053 unset( $box[ 'args' ][ '__widget_basename'] );1123 unset( $box['args']['__widget_basename'] ); 1054 1124 } 1055 1125 … … 1061 1131 echo "<h2 class='hndle'><span>{$box['title']}</span></h2>\n"; 1062 1132 echo '<div class="inside">' . "\n"; 1063 call_user_func( $box['callback'], $object, $box);1133 call_user_func( $box['callback'], $object, $box ); 1064 1134 echo "</div>\n"; 1065 1135 echo "</div>\n"; … … 1069 1139 } 1070 1140 1071 echo "</div>";1141 echo '</div>'; 1072 1142 1073 1143 return $i; … … 1112 1182 $page = $screen->id; 1113 1183 1114 if ( ! isset($wp_meta_boxes) )1184 if ( ! isset( $wp_meta_boxes ) ) { 1115 1185 $wp_meta_boxes = array(); 1116 if ( !isset($wp_meta_boxes[$page]) ) 1117 $wp_meta_boxes[$page] = array(); 1118 if ( !isset($wp_meta_boxes[$page][$context]) ) 1119 $wp_meta_boxes[$page][$context] = array(); 1120 1121 foreach ( array('high', 'core', 'default', 'low') as $priority ) 1122 $wp_meta_boxes[$page][$context][$priority][$id] = false; 1186 } 1187 if ( ! isset( $wp_meta_boxes[ $page ] ) ) { 1188 $wp_meta_boxes[ $page ] = array(); 1189 } 1190 if ( ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) { 1191 $wp_meta_boxes[ $page ][ $context ] = array(); 1192 } 1193 1194 foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { 1195 $wp_meta_boxes[ $page ][ $context ][ $priority ][ $id ] = false; 1196 } 1123 1197 } 1124 1198 … … 1144 1218 wp_enqueue_script( 'accordion' ); 1145 1219 1146 if ( empty( $screen ) ) 1220 if ( empty( $screen ) ) { 1147 1221 $screen = get_current_screen(); 1148 elseif ( is_string( $screen ) )1222 } elseif ( is_string( $screen ) ) { 1149 1223 $screen = convert_to_screen( $screen ); 1224 } 1150 1225 1151 1226 $page = $screen->id; 1152 1227 1153 $hidden = get_hidden_meta_boxes( $screen );1228 $hidden = get_hidden_meta_boxes( $screen ); 1154 1229 ?> 1155 1230 <div id="side-sortables" class="accordion-container"> 1156 1231 <ul class="outer-border"> 1157 1232 <?php 1158 $i = 0;1233 $i = 0; 1159 1234 $first_open = false; 1160 1235 … … 1163 1238 if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { 1164 1239 foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { 1165 if ( false == $box || ! $box['title'] ) 1240 if ( false == $box || ! $box['title'] ) { 1166 1241 continue; 1242 } 1167 1243 $i++; 1168 1244 $hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : ''; … … 1219 1295 * add_options_page(); 1220 1296 */ 1221 function add_settings_section( $id, $title, $callback, $page) {1297 function add_settings_section( $id, $title, $callback, $page ) { 1222 1298 global $wp_settings_sections; 1223 1299 1224 1300 if ( 'misc' == $page ) { 1225 _deprecated_argument( __FUNCTION__, '3.0.0', 1301 _deprecated_argument( 1302 __FUNCTION__, '3.0.0', 1226 1303 /* translators: %s: misc */ 1227 sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 1304 sprintf( 1305 __( 'The "%s" options group has been removed. Use another settings group.' ), 1228 1306 'misc' 1229 1307 ) … … 1233 1311 1234 1312 if ( 'privacy' == $page ) { 1235 _deprecated_argument( __FUNCTION__, '3.5.0', 1313 _deprecated_argument( 1314 __FUNCTION__, '3.5.0', 1236 1315 /* translators: %s: privacy */ 1237 sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 1316 sprintf( 1317 __( 'The "%s" options group has been removed. Use another settings group.' ), 1238 1318 'privacy' 1239 1319 ) … … 1242 1322 } 1243 1323 1244 $wp_settings_sections[$page][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback); 1324 $wp_settings_sections[ $page ][ $id ] = array( 1325 'id' => $id, 1326 'title' => $title, 1327 'callback' => $callback, 1328 ); 1245 1329 } 1246 1330 … … 1280 1364 * } 1281 1365 */ 1282 function add_settings_field( $id, $title, $callback, $page, $section = 'default', $args = array()) {1366 function add_settings_field( $id, $title, $callback, $page, $section = 'default', $args = array() ) { 1283 1367 global $wp_settings_fields; 1284 1368 1285 1369 if ( 'misc' == $page ) { 1286 _deprecated_argument( __FUNCTION__, '3.0.0', 1370 _deprecated_argument( 1371 __FUNCTION__, '3.0.0', 1287 1372 /* translators: %s: misc */ 1288 sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 1373 sprintf( 1374 __( 'The "%s" options group has been removed. Use another settings group.' ), 1289 1375 'misc' 1290 1376 ) … … 1294 1380 1295 1381 if ( 'privacy' == $page ) { 1296 _deprecated_argument( __FUNCTION__, '3.5.0', 1382 _deprecated_argument( 1383 __FUNCTION__, '3.5.0', 1297 1384 /* translators: %s: privacy */ 1298 sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 1385 sprintf( 1386 __( 'The "%s" options group has been removed. Use another settings group.' ), 1299 1387 'privacy' 1300 1388 ) … … 1303 1391 } 1304 1392 1305 $wp_settings_fields[$page][$section][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $args); 1393 $wp_settings_fields[ $page ][ $section ][ $id ] = array( 1394 'id' => $id, 1395 'title' => $title, 1396 'callback' => $callback, 1397 'args' => $args, 1398 ); 1306 1399 } 1307 1400 … … 1322 1415 global $wp_settings_sections, $wp_settings_fields; 1323 1416 1324 if ( ! isset( $wp_settings_sections[ $page] ) )1417 if ( ! isset( $wp_settings_sections[ $page ] ) ) { 1325 1418 return; 1326 1327 foreach ( (array) $wp_settings_sections[$page] as $section ) { 1328 if ( $section['title'] ) 1419 } 1420 1421 foreach ( (array) $wp_settings_sections[ $page ] as $section ) { 1422 if ( $section['title'] ) { 1329 1423 echo "<h2>{$section['title']}</h2>\n"; 1330 1331 if ( $section['callback'] ) 1424 } 1425 1426 if ( $section['callback'] ) { 1332 1427 call_user_func( $section['callback'], $section ); 1333 1334 if ( ! isset( $wp_settings_fields ) || !isset( $wp_settings_fields[$page] ) || !isset( $wp_settings_fields[$page][$section['id']] ) ) 1428 } 1429 1430 if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[ $page ] ) || ! isset( $wp_settings_fields[ $page ][ $section['id'] ] ) ) { 1335 1431 continue; 1432 } 1336 1433 echo '<table class="form-table">'; 1337 1434 do_settings_fields( $page, $section['id'] ); … … 1354 1451 * @param string $section Slug title of the settings section who's fields you want to show. 1355 1452 */ 1356 function do_settings_fields( $page, $section) {1453 function do_settings_fields( $page, $section ) { 1357 1454 global $wp_settings_fields; 1358 1455 1359 if ( ! isset( $wp_settings_fields[ $page][$section] ) )1456 if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) { 1360 1457 return; 1361 1362 foreach ( (array) $wp_settings_fields[$page][$section] as $field ) { 1458 } 1459 1460 foreach ( (array) $wp_settings_fields[ $page ][ $section ] as $field ) { 1363 1461 $class = ''; 1364 1462 … … 1376 1474 1377 1475 echo '<td>'; 1378 call_user_func( $field['callback'], $field['args']);1476 call_user_func( $field['callback'], $field['args'] ); 1379 1477 echo '</td>'; 1380 1478 echo '</tr>'; … … 1413 1511 'code' => $code, 1414 1512 'message' => $message, 1415 'type' => $type 1513 'type' => $type, 1416 1514 ); 1417 1515 } … … 1448 1546 * any settings errors you want to show by default. 1449 1547 */ 1450 if ( $sanitize ) 1548 if ( $sanitize ) { 1451 1549 sanitize_option( $setting, get_option( $setting ) ); 1550 } 1452 1551 1453 1552 // If settings were passed back from options.php then use them. … … 1466 1565 $setting_errors = array(); 1467 1566 foreach ( (array) $wp_settings_errors as $key => $details ) { 1468 if ( $setting == $details['setting'] ) 1469 $setting_errors[] = $wp_settings_errors[$key]; 1567 if ( $setting == $details['setting'] ) { 1568 $setting_errors[] = $wp_settings_errors[ $key ]; 1569 } 1470 1570 } 1471 1571 return $setting_errors; … … 1504 1604 function settings_errors( $setting = '', $sanitize = false, $hide_on_update = false ) { 1505 1605 1506 if ( $hide_on_update && ! empty( $_GET['settings-updated'] ) ) 1606 if ( $hide_on_update && ! empty( $_GET['settings-updated'] ) ) { 1507 1607 return; 1608 } 1508 1609 1509 1610 $settings_errors = get_settings_errors( $setting, $sanitize ); 1510 1611 1511 if ( empty( $settings_errors ) ) 1612 if ( empty( $settings_errors ) ) { 1512 1613 return; 1614 } 1513 1615 1514 1616 $output = ''; 1515 1617 foreach ( $settings_errors as $key => $details ) { 1516 $css_id = 'setting-error-' . $details['code'];1618 $css_id = 'setting-error-' . $details['code']; 1517 1619 $css_class = $details['type'] . ' settings-error notice is-dismissible'; 1518 $output .= "<div id='$css_id' class='$css_class'> \n";1519 $output .= "<p><strong>{$details['message']}</strong></p>";1520 $output .= "</div> \n";1620 $output .= "<div id='$css_id' class='$css_class'> \n"; 1621 $output .= "<p><strong>{$details['message']}</strong></p>"; 1622 $output .= "</div> \n"; 1521 1623 } 1522 1624 echo $output; … … 1530 1632 * @param string $found_action 1531 1633 */ 1532 function find_posts_div( $found_action = '') {1634 function find_posts_div( $found_action = '' ) { 1533 1635 ?> 1534 1636 <div id="find-posts" class="find-box" style="display: none;"> … … 1540 1642 <div class="find-box-search"> 1541 1643 <?php if ( $found_action ) { ?> 1542 <input type="hidden" name="found_action" value="<?php echo esc_attr( $found_action); ?>" />1644 <input type="hidden" name="found_action" value="<?php echo esc_attr( $found_action ); ?>" /> 1543 1645 <?php } ?> 1544 1646 <input type="hidden" name="affected" id="affected" value="" /> … … 1569 1671 function the_post_password() { 1570 1672 $post = get_post(); 1571 if ( isset( $post->post_password ) ) 1673 if ( isset( $post->post_password ) ) { 1572 1674 echo esc_attr( $post->post_password ); 1675 } 1573 1676 } 1574 1677 … … 1586 1689 function _draft_or_post_title( $post = 0 ) { 1587 1690 $title = get_the_title( $post ); 1588 if ( empty( $title ) ) 1691 if ( empty( $title ) ) { 1589 1692 $title = __( '(no title)' ); 1693 } 1590 1694 return esc_html( $title ); 1591 1695 } … … 1600 1704 */ 1601 1705 function _admin_search_query() { 1602 echo isset( $_REQUEST['s']) ? esc_attr( wp_unslash( $_REQUEST['s'] ) ) : '';1706 echo isset( $_REQUEST['s'] ) ? esc_attr( wp_unslash( $_REQUEST['s'] ) ) : ''; 1603 1707 } 1604 1708 … … 1618 1722 show_admin_bar( false ); 1619 1723 global $hook_suffix, $admin_body_class, $wp_locale; 1620 $admin_body_class = preg_replace( '/[^a-z0-9_-]+/i', '-', $hook_suffix);1724 $admin_body_class = preg_replace( '/[^a-z0-9_-]+/i', '-', $hook_suffix ); 1621 1725 1622 1726 $current_screen = get_current_screen(); … … 1625 1729 _wp_admin_html_begin(); 1626 1730 ?> 1627 <title><?php bloginfo( 'name') ?> › <?php echo $title ?> — <?php _e('WordPress'); ?></title>1731 <title><?php bloginfo( 'name' ); ?> › <?php echo $title; ?> — <?php _e( 'WordPress' ); ?></title> 1628 1732 <?php 1629 1733 wp_enqueue_style( 'colors' ); … … 1664 1768 $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) ); 1665 1769 1666 if ( is_rtl() ) 1770 if ( is_rtl() ) { 1667 1771 $admin_body_class .= ' rtl'; 1772 } 1668 1773 1669 1774 ?> … … 1673 1778 $admin_body_classes = apply_filters( 'admin_body_class', '' ); 1674 1779 ?> 1675 <body<?php 1780 <body 1781 <?php 1676 1782 /** 1677 1783 * @global string $body_id 1678 1784 */ 1679 if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?> class="wp-admin wp-core-ui no-js iframe <?php echo $admin_body_classes . ' ' . $admin_body_class; ?>"> 1785 if ( isset( $GLOBALS['body_id'] ) ) { 1786 echo ' id="' . $GLOBALS['body_id'] . '"'; 1787 } 1788 ?> 1789 class="wp-admin wp-core-ui no-js iframe <?php echo $admin_body_classes . ' ' . $admin_body_class; ?>"> 1680 1790 <script type="text/javascript"> 1681 1791 (function(){ … … 1724 1834 1725 1835 /** 1726 *1727 1836 * @param WP_Post $post 1728 1837 */ 1729 function _post_states( $post) {1838 function _post_states( $post ) { 1730 1839 $post_states = array(); 1731 if ( isset( $_REQUEST['post_status'] ) ) 1840 if ( isset( $_REQUEST['post_status'] ) ) { 1732 1841 $post_status = $_REQUEST['post_status']; 1733 else1842 } else { 1734 1843 $post_status = ''; 1735 1736 if ( !empty($post->post_password) ) 1737 $post_states['protected'] = __('Password protected'); 1738 if ( 'private' == $post->post_status && 'private' != $post_status ) 1739 $post_states['private'] = __('Private'); 1844 } 1845 1846 if ( ! empty( $post->post_password ) ) { 1847 $post_states['protected'] = __( 'Password protected' ); 1848 } 1849 if ( 'private' == $post->post_status && 'private' != $post_status ) { 1850 $post_states['private'] = __( 'Private' ); 1851 } 1740 1852 if ( 'draft' === $post->post_status ) { 1741 1853 if ( get_post_meta( $post->ID, '_customize_changeset_uuid', true ) ) { … … 1747 1859 $post_states[] = __( 'Customization Draft' ); 1748 1860 } 1749 if ( 'pending' == $post->post_status && 'pending' != $post_status ) 1750 $post_states['pending'] = _x('Pending', 'post status'); 1751 if ( is_sticky($post->ID) ) 1752 $post_states['sticky'] = __('Sticky'); 1861 if ( 'pending' == $post->post_status && 'pending' != $post_status ) { 1862 $post_states['pending'] = _x( 'Pending', 'post status' ); 1863 } 1864 if ( is_sticky( $post->ID ) ) { 1865 $post_states['sticky'] = __( 'Sticky' ); 1866 } 1753 1867 1754 1868 if ( 'future' === $post->post_status ) { … … 1777 1891 $post_states = apply_filters( 'display_post_states', $post_states, $post ); 1778 1892 1779 if ( ! empty( $post_states) ) {1780 $state_count = count( $post_states);1781 $i = 0;1893 if ( ! empty( $post_states ) ) { 1894 $state_count = count( $post_states ); 1895 $i = 0; 1782 1896 echo ' — '; 1783 1897 foreach ( $post_states as $state ) { … … 1791 1905 1792 1906 /** 1793 *1794 1907 * @param WP_Post $post 1795 1908 */ 1796 1909 function _media_states( $post ) { 1797 1910 $media_states = array(); 1798 $stylesheet = get_option('stylesheet');1799 1800 if ( current_theme_supports( 'custom-header' ) ) {1801 $meta_header = get_post_meta( $post->ID, '_wp_attachment_is_custom_header', true );1911 $stylesheet = get_option( 'stylesheet' ); 1912 1913 if ( current_theme_supports( 'custom-header' ) ) { 1914 $meta_header = get_post_meta( $post->ID, '_wp_attachment_is_custom_header', true ); 1802 1915 1803 1916 if ( is_random_header_image() ) { … … 1822 1935 } 1823 1936 1824 if ( current_theme_supports( 'custom-background' ) ) {1825 $meta_background = get_post_meta( $post->ID, '_wp_attachment_is_custom_background', true );1937 if ( current_theme_supports( 'custom-background' ) ) { 1938 $meta_background = get_post_meta( $post->ID, '_wp_attachment_is_custom_background', true ); 1826 1939 1827 1940 if ( ! empty( $meta_background ) && $meta_background == $stylesheet ) { … … 1857 1970 if ( ! empty( $media_states ) ) { 1858 1971 $state_count = count( $media_states ); 1859 $i = 0;1972 $i = 0; 1860 1973 echo ' — '; 1861 1974 foreach ( $media_states as $state ) { … … 1979 2092 */ 1980 2093 function get_submit_button( $text = '', $type = 'primary large', $name = 'submit', $wrap = true, $other_attributes = '' ) { 1981 if ( ! is_array( $type ) ) 2094 if ( ! is_array( $type ) ) { 1982 2095 $type = explode( ' ', $type ); 2096 } 1983 2097 1984 2098 $button_shorthand = array( 'primary', 'small', 'large' ); 1985 $classes = array( 'button' );2099 $classes = array( 'button' ); 1986 2100 foreach ( $type as $t ) { 1987 if ( 'secondary' === $t || 'button-secondary' === $t ) 2101 if ( 'secondary' === $t || 'button-secondary' === $t ) { 1988 2102 continue; 2103 } 1989 2104 $classes[] = in_array( $t, $button_shorthand ) ? 'button-' . $t : $t; 1990 2105 } … … 2012 2127 // Don't output empty name and id attributes. 2013 2128 $name_attr = $name ? ' name="' . esc_attr( $name ) . '"' : ''; 2014 $id_attr = $id ? ' id="' . esc_attr( $id ) . '"' : '';2015 2016 $button = '<input type="submit"' . $name_attr . $id_attr . ' class="' . esc_attr( $class );2017 $button 2129 $id_attr = $id ? ' id="' . esc_attr( $id ) . '"' : ''; 2130 2131 $button = '<input type="submit"' . $name_attr . $id_attr . ' class="' . esc_attr( $class ); 2132 $button .= '" value="' . esc_attr( $text ) . '" ' . $attributes . ' />'; 2018 2133 2019 2134 if ( $wrap ) { … … 2025 2140 2026 2141 /** 2027 *2028 2142 * @global bool $is_IE 2029 2143 */ … … 2033 2147 $admin_html_class = ( is_admin_bar_showing() ) ? 'wp-toolbar' : ''; 2034 2148 2035 if ( $is_IE ) 2036 @header('X-UA-Compatible: IE=edge'); 2149 if ( $is_IE ) { 2150 @header( 'X-UA-Compatible: IE=edge' ); 2151 } 2037 2152 2038 2153 ?> 2039 2154 <!DOCTYPE html> 2040 2155 <!--[if IE 8]> 2041 <html xmlns="http://www.w3.org/1999/xhtml" class="ie8 <?php echo $admin_html_class; ?>" <?php 2042 /** 2043 * Fires inside the HTML tag in the admin header. 2044 * 2045 * @since 2.2.0 2046 */ 2047 do_action( 'admin_xml_ns' ); 2048 ?> <?php language_attributes(); ?>> 2156 <html xmlns="http://www.w3.org/1999/xhtml" class="ie8 <?php echo $admin_html_class; ?>" 2157 <?php 2158 /** 2159 * Fires inside the HTML tag in the admin header. 2160 * 2161 * @since 2.2.0 2162 */ 2163 do_action( 'admin_xml_ns' ); 2164 ?> 2165 <?php language_attributes(); ?>> 2049 2166 <![endif]--> 2050 2167 <!--[if !(IE 8) ]><!--> 2051 <html xmlns="http://www.w3.org/1999/xhtml" class="<?php echo $admin_html_class; ?>" <?php 2052 /** This action is documented in wp-admin/includes/template.php */ 2053 do_action( 'admin_xml_ns' ); 2054 ?> <?php language_attributes(); ?>> 2168 <html xmlns="http://www.w3.org/1999/xhtml" class="<?php echo $admin_html_class; ?>" 2169 <?php 2170 /** This action is documented in wp-admin/includes/template.php */ 2171 do_action( 'admin_xml_ns' ); 2172 ?> 2173 <?php language_attributes(); ?>> 2055 2174 <!--<![endif]--> 2056 2175 <head> 2057 <meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />2176 <meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php echo get_option( 'blog_charset' ); ?>" /> 2058 2177 <?php 2059 2178 } … … 2080 2199 '3.3.0' 2081 2200 ); 2082 return (object) array( 'id' => '_invalid', 'base' => '_are_belong_to_us' ); 2201 return (object) array( 2202 'id' => '_invalid', 2203 'base' => '_are_belong_to_us', 2204 ); 2083 2205 } 2084 2206 … … 2097 2219 <p class="local-restore"> 2098 2220 <?php _e( 'The backup of this post in your browser is different from the version below.' ); ?> 2099 <button type="button" class="button restore-backup"><?php _e( 'Restore the backup'); ?></button>2221 <button type="button" class="button restore-backup"><?php _e( 'Restore the backup' ); ?></button> 2100 2222 </p> 2101 2223 <p class="help"> … … 2136 2258 'echo' => true, 2137 2259 ); 2138 $r = wp_parse_args( $args, $defaults );2260 $r = wp_parse_args( $args, $defaults ); 2139 2261 2140 2262 // Non-English decimal places when the $rating is coming from a string … … 2147 2269 2148 2270 // Calculate the number of each type of star needed 2149 $full_stars = floor( $rating );2150 $half_stars = ceil( $rating - $full_stars );2271 $full_stars = floor( $rating ); 2272 $half_stars = ceil( $rating - $full_stars ); 2151 2273 $empty_stars = 5 - $full_stars - $half_stars; 2152 2274 … … 2154 2276 /* translators: 1: The rating, 2: The number of ratings */ 2155 2277 $format = _n( '%1$s rating based on %2$s rating', '%1$s rating based on %2$s ratings', $r['number'] ); 2156 $title = sprintf( $format, number_format_i18n( $rating, 1 ), number_format_i18n( $r['number'] ) );2278 $title = sprintf( $format, number_format_i18n( $rating, 1 ), number_format_i18n( $r['number'] ) ); 2157 2279 } else { 2158 2280 /* translators: 1: The rating */ … … 2160 2282 } 2161 2283 2162 $output = '<div class="star-rating">';2284 $output = '<div class="star-rating">'; 2163 2285 $output .= '<span class="screen-reader-text">' . $title . '</span>'; 2164 2286 $output .= str_repeat( '<div class="star star-full" aria-hidden="true"></div>', $full_stars );
Note: See TracChangeset
for help on using the changeset viewer.