Changeset 47119
- Timestamp:
- 01/29/2020 12:33:45 AM (5 years ago)
- Location:
- trunk/src/wp-admin/includes
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/meta-boxes.php
r47088 r47119 1 1 <?php 2 3 // -- Post related Meta Boxes 2 /** 3 * WordPress Administration Meta Boxes API. 4 * 5 * @package WordPress 6 * @subpackage Administration 7 */ 8 9 // 10 // Post-related Meta Boxes. 11 // 4 12 5 13 /** … … 31 39 <div id="minor-publishing"> 32 40 33 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>41 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key. ?> 34 42 <div style="display:none;"> 35 43 <?php submit_button( __( 'Save' ), '', 'save' ); ?> … … 72 80 <input type="hidden" name="wp-preview" id="wp-preview" value="" /> 73 81 </div> 74 <?php endif; // public post type?>82 <?php endif; // is_post_type_viewable() ?> 75 83 <?php 76 84 /** … … 203 211 204 212 if ( 0 != $post->ID ) { 205 if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date213 if ( 'future' == $post->post_status ) { // Scheduled for publishing at a future date. 206 214 /* translators: Post date information. %s: Date on which the post is currently scheduled to be published. */ 207 215 $stamp = __( 'Scheduled for: %s' ); 208 } elseif ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published216 } elseif ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // Already published. 209 217 /* translators: Post date information. %s: Date on which the post was published. */ 210 218 $stamp = __( 'Published on: %s' ); 211 } elseif ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified219 } elseif ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // Draft, 1 or more saves, no date specified. 212 220 $stamp = __( 'Publish <b>immediately</b>' ); 213 } elseif ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified221 } elseif ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // Draft, 1 or more saves, future date specified. 214 222 /* translators: Post date information. %s: Date on which the post is to be published. */ 215 223 $stamp = __( 'Schedule for: %s' ); 216 } else { // draft, 1 or more saves, date specified224 } else { // Draft, 1 or more saves, date specified. 217 225 /* translators: Post date information. %s: Date on which the post is to be published. */ 218 226 $stamp = __( 'Publish on: %s' ); … … 223 231 date_i18n( $time_format, strtotime( $post->post_date ) ) 224 232 ); 225 } else { // draft (no saves, and thus no date specified)233 } else { // Draft (no saves, and thus no date specified). 226 234 $stamp = __( 'Publish <b>immediately</b>' ); 227 235 $date = sprintf( … … 244 252 endif; 245 253 246 if ( $can_publish ) : // Contributors don't get to choose the date of publish 254 if ( $can_publish ) : // Contributors don't get to choose the date of publish. 247 255 ?> 248 256 <div class="misc-pub-section curtime misc-pub-curtime"> … … 372 380 <div id="minor-publishing"> 373 381 374 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>382 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key. ?> 375 383 <div style="display:none;"> 376 384 <?php submit_button( __( 'Save' ), '', 'save' ); ?> … … 463 471 $post_format = '0'; 464 472 } 465 // Add in the current one if it isn't there yet, in case the current theme doesn't support it 473 // Add in the current one if it isn't there yet, in case the current theme doesn't support it. 466 474 if ( $post_format && ! in_array( $post_format, $post_formats[0] ) ) { 467 475 $post_formats[0][] = $post_format; … … 592 600 <?php 593 601 $name = ( $tax_name == 'category' ) ? 'post_category' : 'tax_input[' . $tax_name . ']'; 594 echo "<input type='hidden' name='{$name}[]' value='0' />"; // Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. 602 // Allows for an empty term set to be sent. 0 is an invalid term ID and will be ignored by empty() checks. 603 echo "<input type='hidden' name='{$name}[]' value='0' />"; 595 604 ?> 596 605 <ul id="<?php echo $tax_name; ?>checklist" data-wp-lists="list:<?php echo $tax_name; ?>" class="categorychecklist form-no-clear"> … … 793 802 * @param WP_Post $post WP_Post object of the current post. 794 803 */ 795 do_action( 'post_comment_status_meta_box-options', $post ); 804 do_action( 'post_comment_status_meta_box-options', $post ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores 796 805 ?> 797 806 </p> … … 904 913 } 905 914 906 // -- Page related Meta Boxes 915 // 916 // Page-related Meta Boxes. 917 // 907 918 908 919 /** … … 942 953 <?php echo $pages; ?> 943 954 <?php 944 endif; // end empty pages check945 endif; // end hierarchical check.955 endif; // End empty pages check. 956 endif; // End hierarchical check. 946 957 947 958 if ( count( get_page_templates( $post ) ) > 0 && get_option( 'page_for_posts' ) != $post->ID ) : … … 999 1010 } 1000 1011 1001 // -- Link related Meta Boxes 1012 // 1013 // Link-related Meta Boxes. 1014 // 1002 1015 1003 1016 /** … … 1014 1027 <div id="minor-publishing"> 1015 1028 1016 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>1029 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key. ?> 1017 1030 <div style="display:none;"> 1018 1031 <?php submit_button( __( 'Save' ), '', 'save', false ); ?> … … 1164 1177 1165 1178 if ( ! empty( $deprecated ) ) { 1166 _deprecated_argument( __FUNCTION__, '2.5.0' ); // Never implemented 1179 _deprecated_argument( __FUNCTION__, '2.5.0' ); // Never implemented. 1167 1180 } 1168 1181 … … 1414 1427 // We should aim to show the revisions meta box only when there are revisions. 1415 1428 if ( count( $revisions ) > 1 ) { 1416 reset( $revisions ); // Reset pointer for key() 1429 reset( $revisions ); // Reset pointer for key(). 1417 1430 $publish_callback_args = array( 1418 1431 'revisions_count' => count( $revisions ), … … 1441 1454 } 1442 1455 1443 // all taxonomies1456 // All taxonomies. 1444 1457 foreach ( get_object_taxonomies( $post ) as $tax_name ) { 1445 1458 $taxonomy = get_taxonomy( $tax_name ); … … 1524 1537 1525 1538 if ( in_array( get_post_status( $post ), $stati ) ) { 1526 // If the post type support comments, or the post has comments, allow the1527 // Comments meta box.1539 // If the post type support comments, or the post has comments, 1540 // allow the Comments meta box. 1528 1541 if ( comments_open( $post ) || pings_open( $post ) || $post->comment_count > 0 || post_type_supports( $post_type, 'comments' ) ) { 1529 1542 add_meta_box( 'commentsdiv', __( 'Comments' ), 'post_comment_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); -
trunk/src/wp-admin/includes/misc.php
r47088 r47119 179 179 } 180 180 181 // Split out the existing file into the preceding lines, and those that appear after the marker 181 // Split out the existing file into the preceding lines, and those that appear after the marker. 182 182 $pre_lines = array(); 183 183 $post_lines = array(); … … 202 202 } 203 203 204 // Check to see if there was a change 204 // Check to see if there was a change. 205 205 if ( $existing_lines === $insertion ) { 206 206 flock( $fp, LOCK_UN ); … … 210 210 } 211 211 212 // Generate the new file data 212 // Generate the new file data. 213 213 $new_file_data = implode( 214 214 "\n", … … 222 222 ); 223 223 224 // Write to the start of the file, and truncate it to that length 224 // Write to the start of the file, and truncate it to that length. 225 225 fseek( $fp, 0 ); 226 226 $bytes = fwrite( $fp, $new_file_data ); … … 297 297 $web_config_file = $home_path . 'web.config'; 298 298 299 // Using win_is_writable() instead of is_writable() because of a bug in Windows PHP 299 // Using win_is_writable() instead of is_writable() because of a bug in Windows PHP. 300 300 if ( iis7_supports_permalinks() && ( ( ! file_exists( $web_config_file ) && win_is_writable( $home_path ) && $wp_rewrite->using_mod_rewrite_permalinks() ) || win_is_writable( $web_config_file ) ) ) { 301 301 $rule = $wp_rewrite->iis7_url_rewrite_rules( false ); … … 599 599 600 600 if ( T_STRING == $tokens[ $t ][0] && ( '(' == $tokens[ $t + 1 ] || '(' == $tokens[ $t + 2 ] ) ) { 601 // If it's a function or class defined locally, there's not going to be any docs available 601 // If it's a function or class defined locally, there's not going to be any docs available. 602 602 if ( ( isset( $tokens[ $t - 2 ][1] ) && in_array( $tokens[ $t - 2 ][1], array( 'function', 'class' ) ) ) || ( isset( $tokens[ $t - 2 ][0] ) && T_OBJECT_OPERATOR == $tokens[ $t - 1 ][0] ) ) { 603 603 $ignore_functions[] = $tokens[ $t ][1]; 604 604 } 605 // Add this to our stack of unique references 605 // Add this to our stack of unique references. 606 606 $functions[] = $tokens[ $t ][1]; 607 607 } … … 674 674 case 'export_personal_data_requests_per_page': 675 675 case 'remove_personal_data_requests_per_page': 676 // Network admin 676 // Network admin. 677 677 case 'sites_network_per_page': 678 678 case 'users_network_per_page': … … 703 703 * @param int $value The number of rows to use. 704 704 */ 705 $value = apply_filters( 'set-screen-option', false, $option, $value ); 705 $value = apply_filters( 'set-screen-option', false, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores 706 706 707 707 if ( false === $value ) { … … 761 761 */ 762 762 function iis7_delete_rewrite_rule( $filename ) { 763 // If configuration file does not exist then rules also do not exist so there is nothing to delete763 // If configuration file does not exist then rules also do not exist, so there is nothing to delete. 764 764 if ( ! file_exists( $filename ) ) { 765 765 return true; … … 818 818 $xpath = new DOMXPath( $doc ); 819 819 820 // First check if the rule already exists as in that case there is no need to re-add it 820 // First check if the rule already exists as in that case there is no need to re-add it. 821 821 $wordpress_rules = $xpath->query( '/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')] | /configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'WordPress\')]' ); 822 822 if ( $wordpress_rules->length > 0 ) { … … 824 824 } 825 825 826 // Check the XPath to the rewrite rule and create XML nodes if they do not exist 826 // Check the XPath to the rewrite rule and create XML nodes if they do not exist. 827 827 $xmlnodes = $xpath->query( '/configuration/system.webServer/rewrite/rules' ); 828 828 if ( $xmlnodes->length > 0 ) { -
trunk/src/wp-admin/includes/ms-admin-filters.php
r46586 r47119 8 8 */ 9 9 10 // Media Hooks.10 // Media hooks. 11 11 add_filter( 'wp_handle_upload_prefilter', 'check_upload_size' ); 12 12 13 // User Hooks13 // User hooks. 14 14 add_action( 'user_admin_notices', 'new_user_email_admin_notice' ); 15 15 add_action( 'network_admin_notices', 'new_user_email_admin_notice' ); … … 17 17 add_action( 'admin_page_access_denied', '_access_denied_splash', 99 ); 18 18 19 // Site Hooks.19 // Site hooks. 20 20 add_action( 'wpmueditblogaction', 'upload_space_setting' ); 21 21 22 // Network hooks 22 // Network hooks. 23 23 add_action( 'update_site_option_admin_email', 'wp_network_admin_email_change_notification', 10, 4 ); 24 24 25 // Taxonomy Hooks25 // Taxonomy hooks. 26 26 add_filter( 'get_term', 'sync_category_tag_slugs', 10, 2 ); 27 27 28 // Post Hooks.28 // Post hooks. 29 29 add_filter( 'wp_insert_post_data', 'avoid_blog_page_permalink_collision', 10, 2 ); 30 30 31 // Tools Hooks.31 // Tools hooks. 32 32 add_filter( 'import_allow_create_users', 'check_import_new_users' ); 33 33 34 // Notices Hooks34 // Notices hooks. 35 35 add_action( 'admin_notices', 'site_admin_notice' ); 36 36 add_action( 'network_admin_notices', 'site_admin_notice' ); 37 37 38 // Update Hooks38 // Update hooks. 39 39 add_action( 'network_admin_notices', 'update_nag', 3 ); 40 40 add_action( 'network_admin_notices', 'maintenance_nag', 10 ); 41 41 42 // Network Admin Hooks42 // Network Admin hooks. 43 43 add_action( 'add_site_option_new_admin_email', 'update_network_option_new_admin_email', 10, 2 ); 44 44 add_action( 'update_site_option_new_admin_email', 'update_network_option_new_admin_email', 10, 2 ); -
trunk/src/wp-admin/includes/ms.php
r47093 r47119 21 21 } 22 22 23 if ( $file['error'] != '0' ) { // there's already an error23 if ( $file['error'] != '0' ) { // There's already an error. 24 24 return $file; 25 25 } … … 130 130 * @since 3.0.0 131 131 * 132 * @todo Merge with wp_delete_user() 132 * @todo Merge with wp_delete_user()? 133 133 * 134 134 * @global wpdb $wpdb WordPress database abstraction object. … … 178 178 } 179 179 180 // Clean links 180 // Clean links. 181 181 $link_ids = $wpdb->get_col( $wpdb->prepare( "SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id ) ); 182 182 … … 221 221 $space_allowed = get_space_allowed(); 222 222 if ( ! is_numeric( $space_allowed ) ) { 223 $space_allowed = 10; // Default space allowed is 10 MB 223 $space_allowed = 10; // Default space allowed is 10 MB. 224 224 } 225 225 $space_used = get_space_used(); … … 645 645 $code_lang = basename( $val, '.mo' ); 646 646 647 if ( $code_lang == 'en_US' ) { // American English 647 if ( $code_lang == 'en_US' ) { // American English. 648 648 $flag = true; 649 649 $ae = __( 'American English' ); 650 650 $output[ $ae ] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . $ae . '</option>'; 651 } elseif ( $code_lang == 'en_GB' ) { // British English 651 } elseif ( $code_lang == 'en_GB' ) { // British English. 652 652 $flag = true; 653 653 $be = __( 'British English' ); … … 659 659 } 660 660 661 if ( $flag === false ) { // WordPress english661 if ( $flag === false ) { // WordPress English. 662 662 $output[] = '<option value=""' . selected( $current, '', false ) . '>' . __( 'English' ) . '</option>'; 663 663 } 664 664 665 // Order by name 665 // Order by name. 666 666 uksort( $output, 'strnatcasecmp' ); 667 667 … … 1068 1068 ); 1069 1069 1070 // Parse arguments 1070 // Parse arguments. 1071 1071 $parsed_args = wp_parse_args( 1072 1072 $args, … … 1078 1078 ); 1079 1079 1080 // Setup the links array 1080 // Setup the links array. 1081 1081 $screen_links = array(); 1082 1082 1083 // Loop through tabs 1083 // Loop through tabs. 1084 1084 foreach ( $parsed_args['links'] as $link_id => $link ) { 1085 1085 1086 // Skip link if user can't access 1086 // Skip link if user can't access. 1087 1087 if ( ! current_user_can( $link['cap'], $parsed_args['blog_id'] ) ) { 1088 1088 continue; 1089 1089 } 1090 1090 1091 // Link classes 1091 // Link classes. 1092 1092 $classes = array( 'nav-tab' ); 1093 1093 … … 1095 1095 $aria_current = ''; 1096 1096 1097 // Selected is set by the parent OR assumed by the $pagenow global 1097 // Selected is set by the parent OR assumed by the $pagenow global. 1098 1098 if ( $parsed_args['selected'] === $link_id || $link['url'] === $GLOBALS['pagenow'] ) { 1099 1099 $classes[] = 'nav-tab-active'; … … 1101 1101 } 1102 1102 1103 // Escape each class 1103 // Escape each class. 1104 1104 $esc_classes = implode( ' ', $classes ); 1105 1105 1106 // Get the URL for this link 1106 // Get the URL for this link. 1107 1107 $url = add_query_arg( array( 'id' => $parsed_args['blog_id'] ), network_admin_url( $link['url'] ) ); 1108 1108 1109 // Add link to nav links 1109 // Add link to nav links. 1110 1110 $screen_links[ $link_id ] = '<a href="' . esc_url( $url ) . '" id="' . esc_attr( $link_id ) . '" class="' . $esc_classes . '"' . $aria_current . '>' . esc_html( $link['label'] ) . '</a>'; 1111 1111 } -
trunk/src/wp-admin/includes/nav-menu.php
r46842 r47119 139 139 */ 140 140 function wp_nav_menu_setup() { 141 // Register meta boxes 141 // Register meta boxes. 142 142 wp_nav_menu_post_type_meta_boxes(); 143 143 add_meta_box( 'add-custom-links', __( 'Custom Links' ), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' ); 144 144 wp_nav_menu_taxonomy_meta_boxes(); 145 145 146 // Register advanced menu items (columns) 146 // Register advanced menu items (columns). 147 147 add_filter( 'manage_nav-menus_columns', 'wp_nav_menu_manage_columns' ); 148 148 … … 423 423 } 424 424 425 // @todo transient caching of these results with proper invalidation on updating of a post of this type425 // @todo Transient caching of these results with proper invalidation on updating of a post of this type. 426 426 $get_posts = new WP_Query; 427 427 $posts = $get_posts->query( $args ); … … 922 922 // Or URL is the default. 923 923 in_array( $_item_object_data['menu-item-url'], array( 'https://', 'http://', '' ) ) || 924 ! ( 'custom' == $_item_object_data['menu-item-type'] && ! isset( $_item_object_data['menu-item-db-id'] ) ) || // or it's not a custom menu item (but not the custom home page) 924 // Or it's not a custom menu item (but not the custom home page). 925 ! ( 'custom' == $_item_object_data['menu-item-type'] && ! isset( $_item_object_data['menu-item-db-id'] ) ) || 925 926 // Or it *is* a custom menu item that already exists. 926 927 ! empty( $_item_object_data['menu-item-db-id'] ) … … 1143 1144 $messages = array(); 1144 1145 $menu_items = array(); 1145 // Index menu items by db ID1146 // Index menu items by DB ID. 1146 1147 foreach ( $unsorted_menu_items as $_item ) { 1147 1148 $menu_items[ $_item->db_id ] = $_item; … … 1165 1166 1166 1167 wp_defer_term_counting( true ); 1167 // Loop through all the menu items' POST variables 1168 // Loop through all the menu items' POST variables. 1168 1169 if ( ! empty( $_POST['menu-item-db-id'] ) ) { 1169 1170 foreach ( (array) $_POST['menu-item-db-id'] as $_key => $k ) { 1170 1171 1171 // Menu item title can't be blank 1172 // Menu item title can't be blank. 1172 1173 if ( ! isset( $_POST['menu-item-title'][ $_key ] ) || '' == $_POST['menu-item-title'][ $_key ] ) { 1173 1174 continue; … … 1189 1190 } 1190 1191 1191 // Remove menu items from the menu that weren't in $_POST 1192 // Remove menu items from the menu that weren't in $_POST. 1192 1193 if ( ! empty( $menu_items ) ) { 1193 1194 foreach ( array_keys( $menu_items ) as $menu_item_id ) { … … 1214 1215 } 1215 1216 } 1216 // Remove non existent/deleted menus1217 // Remove non-existent/deleted menus. 1217 1218 $nav_menu_option['auto_add'] = array_intersect( $nav_menu_option['auto_add'], wp_get_nav_menus( array( 'fields' => 'ids' ) ) ); 1218 1219 update_option( 'nav_menu_options', $nav_menu_option ); … … 1253 1254 foreach ( $data as $post_input_data ) { 1254 1255 // For input names that are arrays (e.g. `menu-item-db-id[3][4][5]`), 1255 // derive the array path 1256 // derive the array path keys via regex and set the value in $_POST. 1256 1257 preg_match( '#([^\[]*)(\[(.+)\])?#', $post_input_data->name, $matches ); 1257 1258 … … 1265 1266 1266 1267 // Build the new array value from leaf to trunk. 1267 for ( $i = count( $array_bits ) - 1; $i >= 0; $i 1268 for ( $i = count( $array_bits ) - 1; $i >= 0; $i-- ) { 1268 1269 if ( $i == count( $array_bits ) - 1 ) { 1269 1270 $new_post_data[ $array_bits[ $i ] ] = wp_slash( $post_input_data->value ); -
trunk/src/wp-admin/includes/network.php
r47085 r47119 182 182 if ( isset( $_POST['subdomain_install'] ) ) { 183 183 $subdomain_install = (bool) $_POST['subdomain_install']; 184 } elseif ( apache_mod_loaded( 'mod_rewrite' ) ) { // assume nothing184 } elseif ( apache_mod_loaded( 'mod_rewrite' ) ) { // Assume nothing. 185 185 $subdomain_install = true; 186 186 } elseif ( ! allow_subdirectory_install() ) { … … 189 189 $subdomain_install = false; 190 190 $got_mod_rewrite = got_mod_rewrite(); 191 if ( $got_mod_rewrite ) { // dangerous assumptions191 if ( $got_mod_rewrite ) { // Dangerous assumptions. 192 192 echo '<div class="updated inline"><p><strong>' . __( 'Note:' ) . '</strong> '; 193 193 printf( … … 207 207 } 208 208 209 if ( $got_mod_rewrite || $is_apache ) { // Protect against mod_rewrite mimicry (but ! Apache) 209 if ( $got_mod_rewrite || $is_apache ) { // Protect against mod_rewrite mimicry (but ! Apache). 210 210 echo '<p>'; 211 211 printf( … … 226 226 <strong><?php _e( 'You cannot change this later.' ); ?></strong></p> 227 227 <p><?php _e( 'You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality.' ); ?></p> 228 <?php // @todo :Link to an MS readme? ?>228 <?php // @todo Link to an MS readme? ?> 229 229 <table class="form-table" role="presentation"> 230 230 <tr> … … 548 548 <?php 549 549 if ( iis7_supports_permalinks() ) : 550 // IIS doesn't support RewriteBase, all your RewriteBase are belong to us 550 // IIS doesn't support RewriteBase, all your RewriteBase are belong to us. 551 551 $iis_subdir_match = ltrim( $base, '/' ) . $subdir_match; 552 552 $iis_rewrite_base = ltrim( $base, '/' ) . $rewrite_base; … … 617 617 618 618 <?php 619 else : // end iis7_supports_permalinks(). construct anhtaccess file instead:619 else : // End iis7_supports_permalinks(). Construct an .htaccess file instead: 620 620 621 621 $ms_files_rewriting = ''; … … 659 659 660 660 <?php 661 endif; // end IIS/Apache code branches.661 endif; // End IIS/Apache code branches. 662 662 663 663 if ( ! is_multisite() ) { -
trunk/src/wp-admin/includes/plugin-install.php
r46463 r47119 101 101 */ 102 102 function plugins_api( $action, $args = array() ) { 103 // include an unmodified $wp_version103 // Include an unmodified $wp_version. 104 104 include( ABSPATH . WPINC . '/version.php' ); 105 105 … … 119 119 120 120 if ( ! isset( $args->wp_version ) ) { 121 $args->wp_version = substr( $wp_version, 0, 3 ); // X.y121 $args->wp_version = substr( $wp_version, 0, 3 ); // x.y 122 122 } 123 123 … … 286 286 echo $api_tags->get_error_message(); 287 287 } else { 288 // Set up the tags in a way which can be interpreted by wp_generate_tag_cloud()288 // Set up the tags in a way which can be interpreted by wp_generate_tag_cloud(). 289 289 $tags = array(); 290 290 foreach ( (array) $api_tags as $tag ) { … … 438 438 } 439 439 440 // Default to a "new" plugin 440 // Default to a "new" plugin. 441 441 $status = 'install'; 442 442 $url = false; … … 471 471 } 472 472 } else { 473 $key = array_keys( $installed_plugin ); 474 $key = reset( $key ); //Use the first plugin regardless of the name, Could have issues for multiple-plugins in one directory if they share different version numbers 473 $key = array_keys( $installed_plugin ); 474 // Use the first plugin regardless of the name. 475 // Could have issues for multiple plugins in one directory if they share different version numbers. 476 $key = reset( $key ); 477 475 478 $update_file = $api->slug . '/' . $key; 476 479 if ( version_compare( $api->version, $installed_plugin[ $key ]['Version'], '=' ) ) { … … 480 483 $version = $installed_plugin[ $key ]['Version']; 481 484 } else { 482 // If the above update check failed, Then that probably means that the update checker has out-of-date information, force a refresh485 // If the above update check failed, then that probably means that the update checker has out-of-date information, force a refresh. 483 486 if ( ! $loop ) { 484 487 delete_site_transient( 'update_plugins' ); … … 489 492 } 490 493 } else { 491 // "install" & no directory with that slug 494 // "install" & no directory with that slug. 492 495 if ( current_user_can( 'install_plugins' ) ) { 493 496 $url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $api->slug ), 'install-plugin_' . $api->slug ); … … 571 574 ); 572 575 573 // Sanitize HTML 576 // Sanitize HTML. 574 577 foreach ( (array) $api->sections as $section_name => $content ) { 575 578 $api->sections[ $section_name ] = wp_kses( $content, $plugins_allowedtags ); … … 584 587 $_tab = esc_attr( $tab ); 585 588 586 $section = isset( $_REQUEST['section'] ) ? wp_unslash( $_REQUEST['section'] ) : 'description'; // Default to the Description tab, Do not translate, API returns English. 589 // Default to the Description tab, Do not translate, API returns English. 590 $section = isset( $_REQUEST['section'] ) ? wp_unslash( $_REQUEST['section'] ) : 'description'; 587 591 if ( empty( $section ) || ! isset( $api->sections[ $section ] ) ) { 588 592 $section_titles = array_keys( (array) $api->sections ); -
trunk/src/wp-admin/includes/plugin.php
r47113 r47119 332 332 } 333 333 334 $plugin_data = get_plugin_data( "$plugin_root/$plugin_file", false, false ); //Do not apply markup/translate as it'll be cached. 334 // Do not apply markup/translate as it will be cached. 335 $plugin_data = get_plugin_data( "$plugin_root/$plugin_file", false, false ); 335 336 336 337 if ( empty( $plugin_data['Name'] ) ) { … … 358 359 */ 359 360 function get_mu_plugins() { 360 $wp_plugins = array(); 361 // Files in wp-content/mu-plugins directory. 361 $wp_plugins = array(); 362 362 $plugin_files = array(); 363 363 … … 365 365 return $wp_plugins; 366 366 } 367 368 // Files in wp-content/mu-plugins directory. 367 369 $plugins_dir = @opendir( WPMU_PLUGIN_DIR ); 368 370 if ( $plugins_dir ) { … … 387 389 } 388 390 389 $plugin_data = get_plugin_data( WPMU_PLUGIN_DIR . "/$plugin_file", false, false ); //Do not apply markup/translate as it'll be cached. 391 // Do not apply markup/translate as it will be cached. 392 $plugin_data = get_plugin_data( WPMU_PLUGIN_DIR . "/$plugin_file", false, false ); 390 393 391 394 if ( empty( $plugin_data['Name'] ) ) { … … 396 399 } 397 400 398 if ( isset( $wp_plugins['index.php'] ) && filesize( WPMU_PLUGIN_DIR . '/index.php' ) <= 30 ) { // silence is golden 401 if ( isset( $wp_plugins['index.php'] ) && filesize( WPMU_PLUGIN_DIR . '/index.php' ) <= 30 ) { 402 // Silence is golden. 399 403 unset( $wp_plugins['index.php'] ); 400 404 } … … 432 436 $_dropins = _get_dropins(); 433 437 434 // These exist in thewp-content directory.438 // Files in wp-content directory. 435 439 $plugins_dir = @opendir( WP_CONTENT_DIR ); 436 440 if ( $plugins_dir ) { … … 454 458 continue; 455 459 } 456 $plugin_data = get_plugin_data( WP_CONTENT_DIR . "/$plugin_file", false, false ); //Do not apply markup/translate as it'll be cached. 460 461 // Do not apply markup/translate as it will be cached. 462 $plugin_data = get_plugin_data( WP_CONTENT_DIR . "/$plugin_file", false, false ); 463 457 464 if ( empty( $plugin_data['Name'] ) ) { 458 465 $plugin_data['Name'] = $plugin_file; 459 466 } 467 460 468 $dropins[ $plugin_file ] = $plugin_data; 461 469 } … … 478 486 function _get_dropins() { 479 487 $dropins = array( 480 'advanced-cache.php' => array( __( 'Advanced caching plugin.' ), 'WP_CACHE' ), // WP_CACHE481 'db.php' => array( __( 'Custom database class.' ), true ), // auto on load482 'db-error.php' => array( __( 'Custom database error message.' ), true ), // auto on error483 'install.php' => array( __( 'Custom installation script.' ), true ), // auto on installation484 'maintenance.php' => array( __( 'Custom maintenance message.' ), true ), // auto on maintenance485 'object-cache.php' => array( __( 'External object cache.' ), true ), // auto on load486 'php-error.php' => array( __( 'Custom PHP error message.' ), true ), // auto on error487 'fatal-error-handler.php' => array( __( 'Custom PHP fatal error handler.' ), true ), // auto on error488 'advanced-cache.php' => array( __( 'Advanced caching plugin.' ), 'WP_CACHE' ), // WP_CACHE 489 'db.php' => array( __( 'Custom database class.' ), true ), // Auto on load. 490 'db-error.php' => array( __( 'Custom database error message.' ), true ), // Auto on error. 491 'install.php' => array( __( 'Custom installation script.' ), true ), // Auto on installation. 492 'maintenance.php' => array( __( 'Custom maintenance message.' ), true ), // Auto on maintenance. 493 'object-cache.php' => array( __( 'External object cache.' ), true ), // Auto on load. 494 'php-error.php' => array( __( 'Custom PHP error message.' ), true ), // Auto on error. 495 'fatal-error-handler.php' => array( __( 'Custom PHP fatal error handler.' ), true ), // Auto on error. 488 496 ); 489 497 490 498 if ( is_multisite() ) { 491 499 $dropins['sunrise.php'] = array( __( 'Executed before Multisite is loaded.' ), 'SUNRISE' ); // SUNRISE 492 $dropins['blog-deleted.php'] = array( __( 'Custom site deleted message.' ), true ); // auto on deleted blog493 $dropins['blog-inactive.php'] = array( __( 'Custom site inactive message.' ), true ); // auto on inactive blog494 $dropins['blog-suspended.php'] = array( __( 'Custom site suspended message.' ), true ); // auto on archived or spammed blog500 $dropins['blog-deleted.php'] = array( __( 'Custom site deleted message.' ), true ); // Auto on deleted blog. 501 $dropins['blog-inactive.php'] = array( __( 'Custom site inactive message.' ), true ); // Auto on inactive blog. 502 $dropins['blog-suspended.php'] = array( __( 'Custom site suspended message.' ), true ); // Auto on archived or spammed blog. 495 503 } 496 504 … … 639 647 if ( ( $network_wide && ! isset( $current[ $plugin ] ) ) || ( ! $network_wide && ! in_array( $plugin, $current ) ) ) { 640 648 if ( ! empty( $redirect ) ) { 641 wp_redirect( add_query_arg( '_error_nonce', wp_create_nonce( 'plugin-activation-error_' . $plugin ), $redirect ) ); // we'll override this later if the plugin can be included without fatal error 649 // We'll override this later if the plugin can be included without fatal error. 650 wp_redirect( add_query_arg( '_error_nonce', wp_create_nonce( 'plugin-activation-error_' . $plugin ), $redirect ) ); 642 651 } 643 652 … … 909 918 if ( ! WP_Filesystem( $credentials ) ) { 910 919 ob_start(); 911 request_filesystem_credentials( $url, '', true ); // Failed to connect, Error and request again. 920 // Failed to connect. Error and request again. 921 request_filesystem_credentials( $url, '', true ); 912 922 $data = ob_get_clean(); 913 923 … … 959 969 960 970 // If plugin is in its own directory, recursively delete the directory. 961 if ( strpos( $plugin_file, '/' ) && $this_plugin_dir != $plugins_dir ) { //base check on if plugin includes directory separator AND that it's not the root plugin folder 971 // Base check on if plugin includes directory separator AND that it's not the root plugin folder. 972 if ( strpos( $plugin_file, '/' ) && $this_plugin_dir != $plugins_dir ) { 962 973 $deleted = $wp_filesystem->delete( $this_plugin_dir, true ); 963 974 } else { … … 1238 1249 1239 1250 // 1240 // Menu 1251 // Menu. 1241 1252 // 1242 1253 … … 1307 1318 $_registered_pages[ $hookname ] = true; 1308 1319 1309 // No parent as top level 1320 // No parent as top level. 1310 1321 $_parent_pages[ $menu_slug ] = false; 1311 1322 … … 1413 1424 } 1414 1425 } 1415 // Sort the parent array 1426 // Sort the parent array. 1416 1427 ksort( $submenu[ $parent_slug ] ); 1417 1428 … … 1794 1805 1795 1806 // 1796 // Pluggable Menu Support -- Private 1807 // Pluggable Menu Support -- Private. 1797 1808 // 1798 1809 /** … … 1933 1944 } 1934 1945 1935 if ( $submenu_array[2] != $pagenow || isset( $_GET['page'] ) ) { // not the current page1946 if ( $submenu_array[2] != $pagenow || isset( $_GET['page'] ) ) { // Not the current page. 1936 1947 continue; 1937 1948 } -
trunk/src/wp-admin/includes/post.php
r46826 r47119 93 93 $post_data['post_status'] = sanitize_key( $post_data['post_status'] ); 94 94 95 // No longer an auto-draft 95 // No longer an auto-draft. 96 96 if ( 'auto-draft' === $post_data['post_status'] ) { 97 97 $post_data['post_status'] = 'draft'; … … 103 103 } 104 104 105 // What to do based on which button they pressed 105 // What to do based on which button they pressed. 106 106 if ( isset( $post_data['saveasdraft'] ) && '' != $post_data['saveasdraft'] ) { 107 107 $post_data['post_status'] = 'draft'; … … 133 133 $published_statuses = array( 'publish', 'future' ); 134 134 135 // Posts 'submitted for approval' presentare submitted to $_POST the same as if they were being published.135 // Posts 'submitted for approval' are submitted to $_POST the same as if they were being published. 136 136 // Change status from 'publish' to 'pending' if user lacks permissions to publish or to resave published posts. 137 137 if ( isset( $post_data['post_status'] ) && ( in_array( $post_data['post_status'], $published_statuses ) && ! current_user_can( $ptype->cap->publish_posts ) ) ) { … … 209 209 } 210 210 211 // Pass through errors 211 // Pass through errors. 212 212 if ( is_wp_error( $post_data ) ) { 213 213 return $post_data; … … 269 269 $revision = current( $revisions ); 270 270 271 // Check if the revisions have been upgraded 271 // Check if the revisions have been upgraded. 272 272 if ( $revisions && _wp_get_post_revision_version( $revision ) < 1 ) { 273 273 _wp_upgrade_revisions_of_post( $post, wp_get_post_revisions( $post_ID ) ); … … 297 297 $translated = _wp_get_allowed_postdata( $post_data ); 298 298 299 // Post Formats299 // Post formats. 300 300 if ( isset( $post_data['post_format'] ) ) { 301 301 set_post_format( $post_ID, $post_data['post_format'] ); … … 337 337 } 338 338 339 // Meta Stuff339 // Meta stuff. 340 340 if ( isset( $post_data['meta'] ) && $post_data['meta'] ) { 341 341 foreach ( $post_data['meta'] as $key => $value ) { … … 373 373 } 374 374 375 // Attachment stuff 375 // Attachment stuff. 376 376 if ( 'attachment' == $post_data['post_type'] ) { 377 377 if ( isset( $post_data['_wp_attachment_image_alt'] ) ) { 378 378 $image_alt = wp_unslash( $post_data['_wp_attachment_image_alt'] ); 379 379 380 if ( $image_alt != get_post_meta( $post_ID, '_wp_attachment_image_alt', true ) ) { 380 381 $image_alt = wp_strip_all_tags( $image_alt, true ); 381 // update_meta expects slashed. 382 383 // update_post_meta() expects slashed. 382 384 update_post_meta( $post_ID, '_wp_attachment_image_alt', wp_slash( $image_alt ) ); 383 385 } … … 406 408 407 409 $success = wp_update_post( $translated ); 408 // If the save failed, see if we can sanity check the main fields and try again 410 411 // If the save failed, see if we can sanity check the main fields and try again. 409 412 if ( ! $success && is_callable( array( $wpdb, 'strip_invalid_text_for_column' ) ) ) { 410 413 $fields = array( 'post_title', 'post_content', 'post_excerpt' ); … … 419 422 } 420 423 421 // Now that we have an ID we can fix any attachment anchor hrefs 424 // Now that we have an ID we can fix any attachment anchor hrefs. 422 425 _fix_attachment_links( $post_ID ); 423 426 … … 677 680 } 678 681 679 // Schedule auto-draft cleanup 682 // Schedule auto-draft cleanup. 680 683 if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) ) { 681 684 wp_schedule_event( time(), 'daily', 'wp_scheduled_auto_draft_delete' ); … … 817 820 unset( $_POST['filter'] ); 818 821 819 // Edit don't write if we have a post id.822 // Edit, don't write, if we have a post ID. 820 823 if ( isset( $_POST['post_ID'] ) ) { 821 824 return edit_post(); … … 858 861 add_post_meta( $post_ID, '_edit_last', $GLOBALS['current_user']->ID ); 859 862 860 // Now that we have an ID we can fix any attachment anchor hrefs 863 // Now that we have an ID we can fix any attachment anchor hrefs. 861 864 _fix_attachment_links( $post_ID ); 862 865 … … 883 886 884 887 // 885 // Post Meta 888 // Post Meta. 886 889 // 887 890 … … 914 917 915 918 if ( $metakeyinput ) { 916 $metakey = $metakeyinput; // default919 $metakey = $metakeyinput; // Default. 917 920 } 918 921 … … 927 930 928 931 return false; 929 } // add_meta932 } 930 933 931 934 /** … … 1018 1021 1019 1022 // 1020 // Private 1023 // Private. 1021 1024 // 1022 1025 … … 1039 1042 } 1040 1043 1041 // Short if there aren't any links or no '?attachment_id=' strings (strpos cannot be zero) 1044 // Short if there aren't any links or no '?attachment_id=' strings (strpos cannot be zero). 1042 1045 if ( ! strpos( $content, '?attachment_id=' ) || ! preg_match_all( '/<a ([^>]+)>[\s\S]+?<\/a>/', $content, $link_matches ) ) { 1043 1046 return; … … 1045 1048 1046 1049 $site_url = get_bloginfo( 'url' ); 1047 $site_url = substr( $site_url, (int) strpos( $site_url, '://' ) ); // remove the http(s)1050 $site_url = substr( $site_url, (int) strpos( $site_url, '://' ) ); // Remove the http(s). 1048 1051 $replace = ''; 1049 1052 … … 1055 1058 } 1056 1059 1057 $quote = $url_match[1]; // the quote (single or double)1060 $quote = $url_match[1]; // The quote (single or double). 1058 1061 $url_id = (int) $url_match[2]; 1059 1062 $rel_id = (int) $rel_match[1]; … … 1345 1348 } 1346 1349 1347 // If the user wants to set a new name -- override the current one 1348 // Note: if empty name is supplied -- use the title instead, see #6072 1350 // If the user wants to set a new name -- override the current one. 1351 // Note: if empty name is supplied -- use the title instead, see #6072. 1349 1352 if ( ! is_null( $name ) ) { 1350 1353 $post->post_name = sanitize_title( $name ? $name : $title, $post->ID ); … … 1357 1360 $permalink = get_permalink( $post, true ); 1358 1361 1359 // Replace custom post_type Token with generic pagename token for ease of use.1362 // Replace custom post_type token with generic pagename token for ease of use. 1360 1363 $permalink = str_replace( "%$post->post_type%", '%pagename%', $permalink ); 1361 1364 1362 // Handle page hierarchy 1365 // Handle page hierarchy. 1363 1366 if ( $ptype->hierarchical ) { 1364 1367 $uri = get_page_uri( $post ); … … 1432 1435 $view_link = get_permalink( $post ); 1433 1436 } else { 1434 // Allow non-published (private, future) to be viewed at a pretty permalink, in case $post->post_name is set 1437 // Allow non-published (private, future) to be viewed at a pretty permalink, in case $post->post_name is set. 1435 1438 $view_link = str_replace( array( '%pagename%', '%postname%' ), $post->post_name, $permalink ); 1436 1439 } … … 1438 1441 } 1439 1442 1440 // Permalinks without a post/page name placeholder don't have anything to edit 1443 // Permalinks without a post/page name placeholder don't have anything to edit. 1441 1444 if ( false === strpos( $permalink, '%postname%' ) && false === strpos( $permalink, '%pagename%' ) ) { 1442 1445 $return = '<strong>' . __( 'Permalink:' ) . "</strong>\n"; … … 1449 1452 } 1450 1453 1451 // Encourage a pretty permalink setting 1454 // Encourage a pretty permalink setting. 1452 1455 if ( '' == get_option( 'permalink_structure' ) && current_user_can( 'manage_options' ) && ! ( 'page' == get_option( 'show_on_front' ) && $id == get_option( 'page_on_front' ) ) ) { 1453 1456 $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __( 'Change Permalinks' ) . "</a></span>\n"; … … 1693 1696 if ( get_post_type_object( $post->post_type )->public ) { 1694 1697 if ( 'publish' == $post->post_status || $user->ID != $post->post_author ) { 1695 // Latest content is in autosave 1698 // Latest content is in autosave. 1696 1699 $nonce = wp_create_nonce( 'post_preview_' . $post->ID ); 1697 1700 $query_args['preview_id'] = $post->ID; … … 1748 1751 } 1749 1752 1750 // Allow plugins to prevent some users overriding the post lock 1753 // Allow plugins to prevent some users overriding the post lock. 1751 1754 if ( $override ) { 1752 1755 ?> … … 1820 1823 $new_autosave['post_author'] = $post_author; 1821 1824 1825 $post = get_post( $post_id ); 1826 1822 1827 // If the new autosave has the same content as the post, delete the autosave. 1823 $post = get_post( $post_id );1824 1828 $autosave_is_different = false; 1825 1829 foreach ( array_intersect( array_keys( $new_autosave ), array_keys( _wp_post_revision_fields( $post ) ) ) as $field ) { … … 1850 1854 $post_data = wp_unslash( $post_data ); 1851 1855 1852 // Otherwise create the new autosave as a special post revision 1856 // Otherwise create the new autosave as a special post revision. 1853 1857 return _wp_put_post_revision( $post_data, true ); 1854 1858 } … … 1923 1927 */ 1924 1928 function wp_autosave( $post_data ) { 1925 // Back-compat 1929 // Back-compat. 1926 1930 if ( ! defined( 'DOING_AUTOSAVE' ) ) { 1927 1931 define( 'DOING_AUTOSAVE', true ); … … 1951 1955 1952 1956 if ( ! wp_check_post_lock( $post->ID ) && get_current_user_id() == $post->post_author && ( 'auto-draft' == $post->post_status || 'draft' == $post->post_status ) ) { 1953 // Drafts and auto-drafts are just overwritten by autosave for the same user if the post is not locked 1957 // Drafts and auto-drafts are just overwritten by autosave for the same user if the post is not locked. 1954 1958 return edit_post( wp_slash( $post_data ) ); 1955 1959 } else { 1956 // Non drafts or other users drafts are not overwritten. The autosave is stored in a special post revision for each user. 1960 // Non-drafts or other users' drafts are not overwritten. 1961 // The autosave is stored in a special post revision for each user. 1957 1962 return wp_create_post_autosave( wp_slash( $post_data ) ); 1958 1963 }
Note: See TracChangeset
for help on using the changeset viewer.