X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/8f374b7233bc2815ccc387e448d208c5434eb961..a6f44f0edcda2471c5a33e4156c1c9488c7f3210:/wp-admin/includes/template.php
diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php
index 38348745..18349644 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';
@@ -166,20 +166,16 @@ 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();
$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 ) );
@@ -332,35 +328,35 @@ 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 ) );
+ $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 ) );
?>
-
-
+
-
+
+
@@ -421,7 +417,7 @@ function list_meta( $meta ) {
' . __( 'Value' ) . ' |
-
+
|
'; //TBODY needed for list-manipulation JS
@@ -436,7 +432,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,28 +530,32 @@ function meta_form() {
- |
- |
+ |
-
- 'addmetasub', 'tabindex' => '9' ) ); ?>
+ |
+
+ 'newmeta-submit', 'data-wp-lists' => 'add:the-list:newmeta' ) ); ?>
+
|
@@ -575,7 +575,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 ) );
@@ -618,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 '
';
@@ -670,17 +671,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 && $post->ID && $item->ID == $post->ID )
+ continue;
+
$pad = str_repeat( ' ', $level * 3 );
if ( $item->ID == $default)
$current = ' selected="selected"';
@@ -705,7 +705,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 +769,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
*
@@ -828,14 +778,14 @@ function wp_max_upload_size() {
*/
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'] ) ) :
?>
-