X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/596d585e1dc1eb25bccd3781e37210a4e2504179..6c8f14c09105d0afa4c1574215c59b5021040e76:/wp-admin/includes/template.php diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 38348745..788a4bd5 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -166,10 +166,10 @@ function wp_terms_checklist($post_id = 0, $args = array()) { * @return array List of popular term IDs. */ function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo = true ) { - global $post_ID; + $post = get_post(); - if ( $post_ID ) - $checked_terms = wp_get_object_terms($post_ID, $taxonomy, array('fields'=>'ids')); + if ( $post && $post->ID ) + $checked_terms = wp_get_object_terms($post->ID, $taxonomy, array('fields'=>'ids')); else $checked_terms = array(); @@ -332,17 +332,17 @@ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single', @@ -350,17 +350,17 @@ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single',
'strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close' ); - wp_editor( '', 'replycontent', array( 'media_buttons' => false, 'tinymce' => false, 'quicktags' => $quicktags_settings, 'tabindex' => 104 ) ); + wp_editor( '', 'replycontent', array( 'media_buttons' => false, 'tinymce' => false, 'quicktags' => $quicktags_settings ) ); ?>

- - + - + +

@@ -421,7 +421,7 @@ function list_meta( $meta ) { ' . __( 'Value' ) . ' - + '; //TBODY needed for list-manipulation JS @@ -436,7 +436,7 @@ function list_meta( $meta ) { - + "; - $r .= "\n\t\t"; + $r .= "\n\t\t"; $r .= "\n\t\t
"; - $r .= get_submit_button( __( 'Delete' ), "delete:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$delete_nonce deletemeta", "deletemeta[{$entry['meta_id']}]", false, array( 'tabindex' => '6' ) ); + $r .= get_submit_button( __( 'Delete' ), 'deletemeta small', "deletemeta[{$entry['meta_id']}]", false, array( 'data-wp-lists' => "delete:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$delete_nonce" ) ); $r .= "\n\t\t"; - $r .= get_submit_button( __( 'Update' ), "add:the-list:meta-{$entry['meta_id']}::_ajax_nonce-add-meta=$update_nonce updatemeta" , 'updatemeta', false, array( 'tabindex' => '6' ) ); + $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" ) ); $r .= "
"; $r .= wp_nonce_field( 'change-meta', '_ajax_nonce', false, false ); $r .= ""; - $r .= "\n\t\t\n\t"; + $r .= "\n\t\t\n\t"; return $r; } @@ -534,7 +534,7 @@ function meta_form() { - - + - + - + - - 'addmetasub', 'tabindex' => '9' ) ); ?> + +
+ 'newmeta-submit', 'data-wp-lists' => 'add:the-list:newmeta' ) ); ?> +
@@ -575,7 +577,8 @@ function meta_form() { * @param unknown_type $multi */ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) { - global $wp_locale, $post, $comment; + global $wp_locale, $comment; + $post = get_post(); if ( $for_post ) $edit = ! ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) ); @@ -670,17 +673,16 @@ function page_template_dropdown( $default = '' ) { * @return unknown */ function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) { - global $wpdb, $post_ID; + global $wpdb; + $post = get_post(); $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) ); if ( $items ) { foreach ( $items as $item ) { // A page cannot be its own parent. - if (!empty ( $post_ID ) ) { - if ( $item->ID == $post_ID ) { - continue; - } - } + if ( $post->ID && $item->ID == $post->ID ) + continue; + $pad = str_repeat( ' ', $level * 3 ); if ( $item->ID == $default) $current = ' selected="selected"'; @@ -705,7 +707,7 @@ function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) { */ function the_attachment_links( $id = false ) { $id = (int) $id; - $post = & get_post( $id ); + $post = get_post( $id ); if ( $post->post_type != 'attachment' ) return false; @@ -769,56 +771,6 @@ function wp_dropdown_roles( $selected = false ) { echo $p . $r; } -/** - * {@internal Missing Short Description}} - * - * @since 2.3.0 - * - * @param unknown_type $size - * @return unknown - */ -function wp_convert_hr_to_bytes( $size ) { - $size = strtolower($size); - $bytes = (int) $size; - if ( strpos($size, 'k') !== false ) - $bytes = intval($size) * 1024; - elseif ( strpos($size, 'm') !== false ) - $bytes = intval($size) * 1024 * 1024; - elseif ( strpos($size, 'g') !== false ) - $bytes = intval($size) * 1024 * 1024 * 1024; - return $bytes; -} - -/** - * {@internal Missing Short Description}} - * - * @since 2.3.0 - * - * @param unknown_type $bytes - * @return unknown - */ -function wp_convert_bytes_to_hr( $bytes ) { - $units = array( 0 => 'B', 1 => 'kB', 2 => 'MB', 3 => 'GB' ); - $log = log( $bytes, 1024 ); - $power = (int) $log; - $size = pow(1024, $log - $power); - return $size . $units[$power]; -} - -/** - * {@internal Missing Short Description}} - * - * @since 2.5.0 - * - * @return unknown - */ -function wp_max_upload_size() { - $u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) ); - $p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) ); - $bytes = apply_filters( 'upload_size_limit', min($u_bytes, $p_bytes), $u_bytes, $p_bytes ); - return $bytes; -} - /** * Outputs the form used by the importers to accept the data to be imported * @@ -835,7 +787,7 @@ function wp_import_upload_form( $action ) {

-
+

() @@ -1040,10 +992,15 @@ function add_settings_section($id, $title, $callback, $page) { global $wp_settings_sections; if ( 'misc' == $page ) { - _deprecated_argument( __FUNCTION__, '3.0', __( 'The miscellaneous options group has been removed. Use another settings group.' ) ); + _deprecated_argument( __FUNCTION__, '3.0', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'misc' ) ); $page = 'general'; } + if ( 'privacy' == $page ) { + _deprecated_argument( __FUNCTION__, '3.5', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'privacy' ) ); + $page = 'reading'; + } + if ( !isset($wp_settings_sections) ) $wp_settings_sections = array(); if ( !isset($wp_settings_sections[$page]) ) @@ -1084,6 +1041,11 @@ function add_settings_field($id, $title, $callback, $page, $section = 'default', $page = 'general'; } + if ( 'privacy' == $page ) { + _deprecated_argument( __FUNCTION__, '3.5', __( 'The privacy options group has been removed. Use another settings group.' ) ); + $page = 'reading'; + } + if ( !isset($wp_settings_fields) ) $wp_settings_fields = array(); if ( !isset($wp_settings_fields[$page]) ) @@ -1107,20 +1069,23 @@ function add_settings_field($id, $title, $callback, $page, $section = 'default', * * @param string $page The slug name of the page whos settings sections you want to output */ -function do_settings_sections($page) { +function do_settings_sections( $page ) { global $wp_settings_sections, $wp_settings_fields; - if ( !isset($wp_settings_sections) || !isset($wp_settings_sections[$page]) ) + if ( ! isset( $wp_settings_sections ) || !isset( $wp_settings_sections[$page] ) ) return; foreach ( (array) $wp_settings_sections[$page] as $section ) { if ( $section['title'] ) echo "

{$section['title']}

\n"; - call_user_func($section['callback'], $section); - if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section['id']]) ) + + if ( $section['callback'] ) + call_user_func( $section['callback'], $section ); + + if ( ! isset( $wp_settings_fields ) || !isset( $wp_settings_fields[$page] ) || !isset( $wp_settings_fields[$page][$section['id']] ) ) continue; echo ''; - do_settings_fields($page, $section['id']); + do_settings_fields( $page, $section['id'] ); echo '
'; } } @@ -1148,7 +1113,7 @@ function do_settings_fields($page, $section) { foreach ( (array) $wp_settings_fields[$page][$section] as $field ) { echo ''; if ( !empty($field['args']['label_for']) ) - echo ''; + echo ''; else echo '' . $field['title'] . ''; echo ''; @@ -1224,27 +1189,29 @@ function get_settings_errors( $setting = '', $sanitize = false ) { // This allows the $sanitize_callback from register_setting() to run, adding // any settings errors you want to show by default. if ( $sanitize ) - sanitize_option( $setting, get_option($setting)); + sanitize_option( $setting, get_option( $setting ) ); // If settings were passed back from options.php then use them - // Ignore transients if $sanitize is true, we don't want the old values anyway - if ( isset($_GET['settings-updated']) && $_GET['settings-updated'] && get_transient('settings_errors') ) { - $settings_errors = get_transient('settings_errors'); - delete_transient('settings_errors'); - // Otherwise check global in case validation has been run on this pageload - } elseif ( count( $wp_settings_errors ) ) { - $settings_errors = $wp_settings_errors; - } else { - return; + if ( isset( $_GET['settings-updated'] ) && $_GET['settings-updated'] && get_transient( 'settings_errors' ) ) { + $wp_settings_errors = array_merge( (array) $wp_settings_errors, get_transient( 'settings_errors' ) ); + delete_transient( 'settings_errors' ); } + // Check global in case errors have been added on this pageload + if ( ! count( $wp_settings_errors ) ) + return array(); + // Filter the results to those of a specific setting if one was set if ( $setting ) { - foreach ( (array) $settings_errors as $key => $details ) - if ( $setting != $details['setting'] ) - unset( $settings_errors[$key] ); + $setting_errors = array(); + foreach ( (array) $wp_settings_errors as $key => $details ) { + if ( $setting == $details['setting'] ) + $setting_errors[] = $wp_settings_errors[$key]; + } + return $setting_errors; } - return $settings_errors; + + return $wp_settings_errors; } /** @@ -1276,7 +1243,7 @@ function settings_errors( $setting = '', $sanitize = false, $hide_on_update = fa $settings_errors = get_settings_errors( $setting, $sanitize ); - if ( ! is_array( $settings_errors ) ) + if ( empty( $settings_errors ) ) return; $output = ''; @@ -1311,18 +1278,8 @@ function find_posts_div($found_action = '') { -
- - true), 'objects' ); - foreach ( $post_types as $post ) { - if ( 'attachment' == $post->name ) - continue; - ?> - name, 'post'); ?> /> - - + +
@@ -1344,8 +1301,9 @@ function find_posts_div($found_action = '') { * @since 2.7.0 */ function the_post_password() { - global $post; - if ( isset( $post->post_password ) ) echo esc_attr( $post->post_password ); + $post = get_post(); + if ( isset( $post->post_password ) ) + echo esc_attr( $post->post_password ); } /** @@ -1355,13 +1313,13 @@ function the_post_password() { * returned. * * @since 2.7.0 - * @param int $post_id The post id. If not supplied the global $post is used. + * @param mixed $post Post id or object. If not supplied the global $post is used. * @return string The post title if set */ -function _draft_or_post_title( $post_id = 0 ) { - $title = get_the_title($post_id); - if ( empty($title) ) - $title = __('(no title)'); +function _draft_or_post_title( $post = 0 ) { + $title = get_the_title( $post ); + if ( empty( $title ) ) + $title = __( '(no title)' ); return $title; } @@ -1394,6 +1352,7 @@ function iframe_header( $title = '', $limit_styles = false ) { $current_screen = get_current_screen(); + @header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) ); _wp_admin_html_begin(); ?> <?php bloginfo('name') ?> › <?php echo $title ?> — <?php _e('WordPress'); ?> @@ -1430,7 +1389,7 @@ do_action('admin_head'); $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) ); ?> - class="wp-admin no-js iframe "> + class="wp-admin wp-core-ui no-js iframe ">