X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/baca9ce86a38dc54c4574890ee2d352fd81f78b2..61343b82c4f0da4c68e4c6373daafff4a81efdd1:/wp-admin/includes/template.php diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 788a4bd5..d8d82a0c 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -34,7 +34,7 @@ class Walker_Category_Checklist extends Walker { $output .= "$indent\n"; } - function start_el( &$output, $category, $depth, $args, $id = 0 ) { + function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) { extract($args); if ( empty($taxonomy) ) $taxonomy = 'category'; @@ -176,10 +176,6 @@ function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $ech $terms = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false ) ); $tax = get_taxonomy($taxonomy); - if ( ! current_user_can($tax->cap->assign_terms) ) - $disabled = 'disabled="disabled"'; - else - $disabled = ''; $popular_ids = array(); foreach ( (array) $terms as $term ) { @@ -192,7 +188,7 @@ function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $ech @@ -244,7 +240,7 @@ function wp_link_category_checklist( $link_id = 0 ) { */ function get_inline_data($post) { $post_type_object = get_post_type_object($post->post_type); - if ( ! current_user_can($post_type_object->cap->edit_post, $post->ID) ) + if ( ! current_user_can( 'edit_post', $post->ID ) ) return; $title = esc_textarea( trim( $post->post_title ) ); @@ -349,7 +345,7 @@ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single',
'strong,em,link,block,del,ins,img,ul,ol,li,code,spell,close' ); + $quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close' ); wp_editor( '', 'replycontent', array( 'media_buttons' => false, 'tinymce' => false, 'quicktags' => $quicktags_settings ) ); ?>
@@ -539,6 +535,8 @@ function meta_form() { " . esc_html($key) . ""; } ?> @@ -621,8 +619,8 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) { $minute = ''; echo '
'; - /* translators: 1: month input, 2: day input, 3: year input, 4: hour input, 5: minute input */ - printf(__('%1$s%2$s, %3$s @ %4$s : %5$s'), $month, $day, $year, $hour, $minute); + /* translators: 1: month, 2: day, 3: year, 4: hour, 5: minute */ + printf( __( '%1$s %2$s, %3$s @ %4$s : %5$s' ), $month, $day, $year, $hour, $minute ); echo '
'; @@ -680,7 +678,7 @@ function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) { if ( $items ) { foreach ( $items as $item ) { // A page cannot be its own parent. - if ( $post->ID && $item->ID == $post->ID ) + if ( $post && $post->ID && $item->ID == $post->ID ) continue; $pad = str_repeat( ' ', $level * 3 ); @@ -780,14 +778,14 @@ function wp_dropdown_roles( $selected = false ) { */ function wp_import_upload_form( $action ) { $bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() ); - $size = wp_convert_bytes_to_hr( $bytes ); + $size = size_format( $bytes ); $upload_dir = wp_upload_dir(); if ( ! empty( $upload_dir['error'] ) ) : ?>

-
+

() @@ -811,6 +809,7 @@ function wp_import_upload_form( $action ) { * @param string|object $screen Optional. The screen on which to show the box (post, page, link). Defaults to current screen. * @param string $context Optional. The context within the page where the boxes should show ('normal', 'advanced'). * @param string $priority Optional. The priority within the context where the boxes should show ('high', 'low'). + * @param array $callback_args Optional. Data that should be set as the "args" property of the box array (which is the second parameter passed to your callback). */ function add_meta_box( $id, $title, $callback, $screen = null, $context = 'advanced', $priority = 'default', $callback_args = null ) { global $wp_meta_boxes; @@ -917,7 +916,6 @@ function do_meta_boxes( $screen, $context, $object ) { if ( false == $box || ! $box['title'] ) continue; $i++; - $style = ''; $hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : ''; echo '

' . "\n"; if ( 'dashboard_browser_nag' != $box['id'] ) @@ -968,6 +966,79 @@ function remove_meta_box($id, $screen, $context) { $wp_meta_boxes[$page][$context][$priority][$id] = false; } +/** + * Meta Box Accordion Template Function + * + * Largely made up of abstracted code from {@link do_meta_boxes()}, this + * function serves to build meta boxes as list items for display as + * a collapsible accordion. + * + * @since 3.6.0 + * + * @uses global $wp_meta_boxes Used to retrieve registered meta boxes. + * + * @param string|object $screen The screen identifier. + * @param string $context The meta box context. + * @param mixed $object gets passed to the section callback function as first parameter. + * @return int number of meta boxes as accordion sections. + */ +function do_accordion_sections( $screen, $context, $object ) { + global $wp_meta_boxes; + + wp_enqueue_script( 'accordion' ); + + if ( empty( $screen ) ) + $screen = get_current_screen(); + elseif ( is_string( $screen ) ) + $screen = convert_to_screen( $screen ); + + $page = $screen->id; + + $hidden = get_hidden_meta_boxes( $screen ); + ?> +
+
    + +
  • +

    +
    +
    + +
    +
    +
  • + +
+
+ ', - 'uid': 'ID; ?>', - 'time':'' - }, - ajaxurl = '', +var ajaxurl = '', pagenow = 'id; ?>', typenow = 'post_type; ?>', adminpage = '', @@ -1440,7 +1506,7 @@ function _post_states($post) { if ( is_sticky($post->ID) ) $post_states['sticky'] = __('Sticky'); - $post_states = apply_filters( 'display_post_states', $post_states ); + $post_states = apply_filters( 'display_post_states', $post_states, $post ); if ( ! empty($post_states) ) { $state_count = count($post_states); @@ -1453,8 +1519,6 @@ function _post_states($post) { } } - if ( get_post_format( $post->ID ) ) - echo ' - ' . get_post_format_string( get_post_format( $post->ID ) ) . ''; } function _media_states( $post ) { @@ -1670,7 +1734,8 @@ final class WP_Internal_Pointers { $registered_pointers = array( 'index.php' => 'wp330_toolbar', 'post-new.php' => 'wp350_media', - 'post.php' => 'wp350_media', + 'post.php' => array( 'wp350_media', 'wp360_revisions' ), + 'edit.php' => 'wp360_locks', 'themes.php' => array( 'wp330_saving_widgets', 'wp340_customize_current_theme_link' ), 'appearance_page_custom-header' => 'wp340_choose_image_from_library', 'appearance_page_custom-background' => 'wp340_choose_image_from_library', @@ -1836,13 +1901,36 @@ final class WP_Internal_Pointers { ) ); } + public static function pointer_wp360_revisions() { + $content = '

' . __( 'Compare Revisions' ) . '

'; + $content .= '

' . __( 'View, compare, and restore other versions of this content on the improved revisions screen.' ) . '

'; + + self::print_js( 'wp360_revisions', '.misc-pub-section.num-revisions', array( + 'content' => $content, + 'position' => array( 'edge' => is_rtl() ? 'left' : 'right', 'align' => 'center', 'my' => is_rtl() ? 'left' : 'right-14px' ), + ) ); + } + + public static function pointer_wp360_locks() { + $content = '

' . __( 'Edit Lock' ) . '

'; + $content .= '

' . __( 'Someone else is editing this. No need to refresh; the lock will disappear when they’re done.' ) . '

'; + + if ( ! is_multi_author() ) + return; + + self::print_js( 'wp360_locks', 'tr.wp-locked .locked-indicator', array( + 'content' => $content, + 'position' => array( 'edge' => 'left', 'align' => 'left' ), + ) ); + } + /** * Prevents new users from seeing existing 'new feature' pointers. * * @since 3.3.0 */ public static function dismiss_pointers_for_new_users( $user_id ) { - add_user_meta( $user_id, 'dismissed_wp_pointers', 'wp330_toolbar,wp330_saving_widgets,wp340_choose_image_from_library,wp340_customize_current_theme_link,wp350_media' ); + add_user_meta( $user_id, 'dismissed_wp_pointers', 'wp330_toolbar,wp330_saving_widgets,wp340_choose_image_from_library,wp340_customize_current_theme_link,wp350_media,wp360_revisions,wp360_locks' ); } } @@ -1865,3 +1953,24 @@ function convert_to_screen( $hook_name ) { return WP_Screen::get( $hook_name ); } + +/** + * Output the HTML for restoring the post data from DOM storage + * + * @since 3.6 + * @access private + */ +function _local_storage_notice() { + ?> + +