X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/6c8f14c09105d0afa4c1574215c59b5021040e76..ceb5a929e00123b4e224977c6b5a149f6431b250:/wp-admin/includes/template.php diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 788a4bd5..07663826 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -24,17 +24,52 @@ class Walker_Category_Checklist extends Walker { var $tree_type = 'category'; var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this + /** + * Starts the list before the elements are added. + * + * @see Walker:start_lvl() + * + * @since 2.5.1 + * + * @param string $output Passed by reference. Used to append additional content. + * @param int $depth Depth of category. Used for tab indentation. + * @param array $args An array of arguments. @see wp_terms_checklist() + */ function start_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat("\t", $depth); $output .= "$indent\n"; } - function start_el( &$output, $category, $depth, $args, $id = 0 ) { + /** + * Start the element output. + * + * @see Walker::start_el() + * + * @since 2.5.1 + * + * @param string $output Passed by reference. Used to append additional content. + * @param object $category The current term object. + * @param int $depth Depth of the term in reference to parents. Default 0. + * @param array $args An array of arguments. @see wp_terms_checklist() + * @param int $id ID of the current term. + */ + function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) { extract($args); if ( empty($taxonomy) ) $taxonomy = 'category'; @@ -48,6 +83,18 @@ class Walker_Category_Checklist extends Walker { $output .= "\n
  • " . ''; } + /** + * Ends the element output, if needed. + * + * @see Walker::end_el() + * + * @since 2.5.1 + * + * @param string $output Passed by reference. Used to append additional content. + * @param object $category The current term object. + * @param int $depth Depth of the term in reference to parents. Default 0. + * @param array $args An array of arguments. @see wp_terms_checklist() + */ function end_el( &$output, $category, $depth = 0, $args = array() ) { $output .= "
  • \n"; } @@ -176,10 +223,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 +235,7 @@ function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $ech @@ -244,7 +287,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 +392,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 ) ); ?>
    @@ -504,12 +547,15 @@ function _list_meta_row( $entry, &$count ) { } /** - * {@internal Missing Short Description}} + * Prints the form in the Custom Fields meta box. * * @since 1.2.0 + * + * @param WP_Post $post Optional. The post being edited. */ -function meta_form() { +function meta_form( $post = null ) { global $wpdb; + $post = get_post( $post ); $limit = (int) apply_filters( 'postmeta_form_limit', 30 ); $keys = $wpdb->get_col( " SELECT meta_key @@ -539,6 +585,8 @@ function meta_form() { ID, $key ) ) + continue; echo "\n"; } ?> @@ -621,8 +669,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 '
    '; @@ -638,7 +686,7 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {

    - +

    ID && $item->ID == $post->ID ) + if ( $post && $post->ID && $item->ID == $post->ID ) continue; $pad = str_repeat( ' ', $level * 3 ); @@ -697,57 +745,6 @@ function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) { } } -/** - * {@internal Missing Short Description}} - * - * @since 2.0.0 - * - * @param unknown_type $id - * @return unknown - */ -function the_attachment_links( $id = false ) { - $id = (int) $id; - $post = get_post( $id ); - - if ( $post->post_type != 'attachment' ) - return false; - - $icon = wp_get_attachment_image( $post->ID, 'thumbnail', true ); - $attachment_data = wp_get_attachment_metadata( $id ); - $thumb = isset( $attachment_data['thumb'] ); -?> - - html elements for role selectors * @@ -759,7 +756,7 @@ function wp_dropdown_roles( $selected = false ) { $p = ''; $r = ''; - $editable_roles = get_editable_roles(); + $editable_roles = array_reverse( get_editable_roles() ); foreach ( $editable_roles as $role => $details ) { $name = translate_user_role($details['name'] ); @@ -780,14 +777,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 +808,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 +915,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 +965,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 ); + ?> +
    +
      + +
    • +

      +
      +
      + +
      +
      +
    • + +
    +
    + $id, 'title' => $title, 'callback' => $callback); } @@ -1046,13 +1109,6 @@ function add_settings_field($id, $title, $callback, $page, $section = 'default', $page = 'reading'; } - if ( !isset($wp_settings_fields) ) - $wp_settings_fields = array(); - if ( !isset($wp_settings_fields[$page]) ) - $wp_settings_fields[$page] = array(); - if ( !isset($wp_settings_fields[$page][$section]) ) - $wp_settings_fields[$page][$section] = array(); - $wp_settings_fields[$page][$section][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $args); } @@ -1072,7 +1128,7 @@ function add_settings_field($id, $title, $callback, $page, $section = 'default', 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[$page] ) ) return; foreach ( (array) $wp_settings_sections[$page] as $section ) { @@ -1107,7 +1163,7 @@ function do_settings_sections( $page ) { function do_settings_fields($page, $section) { global $wp_settings_fields; - if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section]) ) + if ( ! isset( $wp_settings_fields[$page][$section] ) ) return; foreach ( (array) $wp_settings_fields[$page][$section] as $field ) { @@ -1148,9 +1204,6 @@ function do_settings_fields($page, $section) { function add_settings_error( $setting, $code, $message, $type = 'error' ) { global $wp_settings_errors; - if ( !isset($wp_settings_errors) ) - $wp_settings_errors = array(); - $new_error = array( 'setting' => $setting, 'code' => $code, @@ -1185,7 +1238,7 @@ function add_settings_error( $setting, $code, $message, $type = 'error' ) { function get_settings_errors( $setting = '', $sanitize = false ) { global $wp_settings_errors; - // If $sanitize is true, manually re-run the sanitizisation for this option + // If $sanitize is true, manually re-run the sanitization for this option // This allows the $sanitize_callback from register_setting() to run, adding // any settings errors you want to show by default. if ( $sanitize ) @@ -1334,7 +1387,7 @@ function _draft_or_post_title( $post = 0 ) { * */ function _admin_search_query() { - echo isset($_REQUEST['s']) ? esc_attr( stripslashes( $_REQUEST['s'] ) ) : ''; + echo isset($_REQUEST['s']) ? esc_attr( wp_unslash( $_REQUEST['s'] ) ) : ''; } /** @@ -1363,12 +1416,7 @@ wp_enqueue_style( 'colors' ); //', - 'uid': 'ID; ?>', - 'time':'' - }, - ajaxurl = '', +var ajaxurl = '', pagenow = 'id; ?>', typenow = 'post_type; ?>', adminpage = '', @@ -1387,6 +1435,10 @@ do_action("admin_head-$hook_suffix"); do_action('admin_head'); $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) ); + +if ( is_rtl() ) + $admin_body_class .= ' rtl'; + ?> class="wp-admin wp-core-ui no-js iframe "> @@ -1440,7 +1492,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 +1505,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 ) { @@ -1635,7 +1685,13 @@ function get_submit_button( $text = null, $type = 'primary large', $name = 'subm } function _wp_admin_html_begin() { + global $is_IE; + $admin_html_class = ( is_admin_bar_showing() ) ? 'wp-toolbar' : ''; + + if ( $is_IE ) + @header('X-UA-Compatible: IE=edge'); + ?>