+
@@ -2392,40 +402,7 @@ function wp_comment_trashnotice() {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
- *
- * @param unknown_type $currentcat
- * @param unknown_type $currentparent
- * @param unknown_type $parent
- * @param unknown_type $level
- * @param unknown_type $categories
- * @return unknown
- */
-function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) {
- if (!$categories )
- $categories = get_categories( array('hide_empty' => 0) );
-
- if ( $categories ) {
- foreach ( $categories as $category ) {
- if ( $currentcat != $category->term_id && $parent == $category->parent) {
- $pad = str_repeat( '– ', $level );
- $category->name = esc_html( $category->name );
- echo "\n\tterm_id )
- echo " selected='selected'";
- echo ">$pad$category->name ";
- wp_dropdown_cats( $currentcat, $currentparent, $category->term_id, $level +1, $categories );
- }
- }
- } else {
- return false;
- }
-}
-
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
+ * @since 1.2.0
*
* @param unknown_type $meta
*/
@@ -2436,11 +413,11 @@ function list_meta( $meta ) {
- ' . __( 'Name' ) . '
+ ' . _x( 'Name', 'meta name' ) . '
' . __( 'Value' ) . '
-
+
'; //TBODY needed for list-manipulation JS
@@ -2451,11 +428,11 @@ function list_meta( $meta ) {
-
+
-
+
+ $entry['meta_value'] = esc_textarea( $entry['meta_value'] ); // using a
$entry['meta_id'] = (int) $entry['meta_id'];
$delete_nonce = wp_create_nonce( 'delete-meta_' . $entry['meta_id'] );
$r .= "\n\t";
- $r .= "\n\t\t" . __( 'Key' ) . " ";
+ $r .= "\n\t\t" . __( 'Key' ) . " ";
- $r .= "\n\t\t ";
- $r .= "\n\t\t
";
+ $r .= "\n\t\t";
+ $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' ), '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" . __( 'Value' ) . " \n\t ";
+ $r .= "\n\t\t" . __( 'Value' ) . " \n\t";
return $r;
}
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 1.2.0
*/
function meta_form() {
global $wpdb;
@@ -2531,16 +512,16 @@ function meta_form() {
FROM $wpdb->postmeta
GROUP BY meta_key
HAVING meta_key NOT LIKE '\_%'
- ORDER BY LOWER(meta_key)
+ ORDER BY meta_key
LIMIT $limit" );
if ( $keys )
natcasesort($keys);
?>
-
+
@@ -2583,7 +567,7 @@ function meta_form() {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 0.71
*
* @param unknown_type $edit
* @param unknown_type $for_post
@@ -2591,10 +575,11 @@ 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 ) ) ? false : true;
+ $edit = ! ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) );
$tab_index_attribute = '';
if ( (int) $tab_index > 0 )
@@ -2602,7 +587,7 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
// echo ' '.__( 'Edit timestamp' ).' ';
- $time_adj = time() + (get_option( 'gmt_offset' ) * 3600 );
+ $time_adj = current_time('timestamp');
$post_date = ($for_post) ? $post->post_date : $comment->comment_date;
$jj = ($edit) ? mysql2date( 'd', $post_date, false ) : gmdate( 'd', $time_adj );
$mm = ($edit) ? mysql2date( 'm', $post_date, false ) : gmdate( 'm', $time_adj );
@@ -2619,10 +604,12 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
$month = "\n";
for ( $i = 1; $i < 13; $i = $i +1 ) {
- $month .= "\t\t\t" . 'get_month_abbrev( $wp_locale->get_month( $i ) ) . " \n";
+ /* translators: 1: month number (01, 02, etc.), 2: month abbreviation */
+ $month .= '>' . sprintf( __( '%1$s-%2$s' ), $monthnum, $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) ) ) . "\n";
}
$month .= ' ';
@@ -2632,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 '
';
@@ -2657,7 +644,7 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 1.5.0
*
* @param unknown_type $default
*/
@@ -2676,7 +663,7 @@ function page_template_dropdown( $default = '' ) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 1.5.0
*
* @param unknown_type $default
* @param unknown_type $parent
@@ -2684,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"';
@@ -2712,31 +698,19 @@ function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
- */
-function browse_happy() {
- $getit = __( 'WordPress recommends a better browser' );
- echo '
-
-';
-}
-
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
+ * @since 2.0.0
*
* @param unknown_type $id
* @return unknown
*/
function the_attachment_links( $id = false ) {
$id = (int) $id;
- $post = & get_post( $id );
+ $post = get_post( $id );
if ( $post->post_type != 'attachment' )
return false;
- $icon = get_attachment_icon( $post->ID );
+ $icon = wp_get_attachment_image( $post->ID, 'thumbnail', true );
$attachment_data = wp_get_attachment_metadata( $id );
$thumb = isset( $attachment_data['thumb'] );
?>
@@ -2746,7 +720,7 @@ function the_attachment_links( $id = false ) {
-
+
@@ -2772,27 +746,22 @@ function the_attachment_links( $id = false ) {
html elements for role selectors based on $wp_roles
+ * Print out html elements for role selectors
*
- * @package WordPress
- * @subpackage Administration
- * @since 2.1
+ * @since 2.1.0
*
- * @uses $wp_roles
- * @param string $default slug for the role that should be already selected
+ * @param string $selected slug for the role that should be already selected
*/
function wp_dropdown_roles( $selected = false ) {
- global $wp_roles;
$p = '';
$r = '';
$editable_roles = get_editable_roles();
- foreach( $editable_roles as $role => $details ) {
+ foreach ( $editable_roles as $role => $details ) {
$name = translate_user_role($details['name'] );
- if ( $selected == $role ) // Make default first in list
+ if ( $selected == $role ) // preselect specified role
$p = "\n\t $name ";
else
$r .= "\n\t$name ";
@@ -2800,99 +769,35 @@ function wp_dropdown_roles( $selected = false ) {
echo $p . $r;
}
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @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 unknown
- *
- * @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 unknown
- *
- * @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
*
- * @since 2.0
+ * @since 2.0.0
*
* @param string $action The action attribute for the form.
*/
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'] ) ) :
?>
-
post_name); // just in case
- if ( strlen($name) )
- echo ' ';
-}
-
/**
* Add a meta box to an edit form.
*
@@ -2901,13 +806,21 @@ function wp_remember_old_slug() {
* @param string $id String for use in the 'id' attribute of tags.
* @param string $title Title of the meta box.
* @param string $callback Function that fills the box with the desired content. The function should echo its output.
- * @param string $page The type of edit page on which to show the box (post, page, link).
- * @param string $context The context within the page where the boxes should show ('normal', 'advanced').
- * @param string $priority The priority within the context where the boxes should show ('high', 'low').
+ * @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, $page, $context = 'advanced', $priority = 'default', $callback_args=null) {
+function add_meta_box( $id, $title, $callback, $screen = null, $context = 'advanced', $priority = 'default', $callback_args = null ) {
global $wp_meta_boxes;
+ if ( empty( $screen ) )
+ $screen = get_current_screen();
+ elseif ( is_string( $screen ) )
+ $screen = convert_to_screen( $screen );
+
+ $page = $screen->id;
+
if ( !isset($wp_meta_boxes) )
$wp_meta_boxes = array();
if ( !isset($wp_meta_boxes[$page]) )
@@ -2916,35 +829,35 @@ function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $pri
$wp_meta_boxes[$page][$context] = array();
foreach ( array_keys($wp_meta_boxes[$page]) as $a_context ) {
- foreach ( array('high', 'core', 'default', 'low') as $a_priority ) {
- if ( !isset($wp_meta_boxes[$page][$a_context][$a_priority][$id]) )
- continue;
-
- // If a core box was previously added or removed by a plugin, don't add.
- if ( 'core' == $priority ) {
- // If core box previously deleted, don't add
- if ( false === $wp_meta_boxes[$page][$a_context][$a_priority][$id] )
+ foreach ( array('high', 'core', 'default', 'low') as $a_priority ) {
+ if ( !isset($wp_meta_boxes[$page][$a_context][$a_priority][$id]) )
+ continue;
+
+ // If a core box was previously added or removed by a plugin, don't add.
+ if ( 'core' == $priority ) {
+ // If core box previously deleted, don't add
+ if ( false === $wp_meta_boxes[$page][$a_context][$a_priority][$id] )
+ return;
+ // If box was added with default priority, give it core priority to maintain sort order
+ if ( 'default' == $a_priority ) {
+ $wp_meta_boxes[$page][$a_context]['core'][$id] = $wp_meta_boxes[$page][$a_context]['default'][$id];
+ unset($wp_meta_boxes[$page][$a_context]['default'][$id]);
+ }
return;
- // If box was added with default priority, give it core priority to maintain sort order
- if ( 'default' == $a_priority ) {
- $wp_meta_boxes[$page][$a_context]['core'][$id] = $wp_meta_boxes[$page][$a_context]['default'][$id];
- unset($wp_meta_boxes[$page][$a_context]['default'][$id]);
}
- return;
- }
- // If no priority given and id already present, use existing priority
- if ( empty($priority) ) {
- $priority = $a_priority;
- // else if we're adding to the sorted priortiy, we don't know the title or callback. Glab them from the previously added context/priority.
- } elseif ( 'sorted' == $priority ) {
- $title = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['title'];
- $callback = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['callback'];
- $callback_args = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['args'];
+ // If no priority given and id already present, use existing priority
+ if ( empty($priority) ) {
+ $priority = $a_priority;
+ // else if we're adding to the sorted priority, we don't know the title or callback. Grab them from the previously added context/priority.
+ } elseif ( 'sorted' == $priority ) {
+ $title = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['title'];
+ $callback = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['callback'];
+ $callback_args = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['args'];
+ }
+ // An id can be in only one priority and one context
+ if ( $priority != $a_priority || $context != $a_context )
+ unset($wp_meta_boxes[$page][$a_context][$a_priority][$id]);
}
- // An id can be in only one priority and one context
- if ( $priority != $a_priority || $context != $a_context )
- unset($wp_meta_boxes[$page][$a_context][$a_priority][$id]);
- }
}
if ( empty($priority) )
@@ -2957,33 +870,40 @@ function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $pri
}
/**
- * {@internal Missing Short Description}}
+ * Meta-Box template function
*
- * @since unknown
+ * @since 2.5.0
*
- * @param unknown_type $page
- * @param unknown_type $context
- * @param unknown_type $object
+ * @param string|object $screen Screen identifier
+ * @param string $context box context
+ * @param mixed $object gets passed to the box callback function as first parameter
* @return int number of meta_boxes
*/
-function do_meta_boxes($page, $context, $object) {
+function do_meta_boxes( $screen, $context, $object ) {
global $wp_meta_boxes;
static $already_sorted = false;
- //do_action('do_meta_boxes', $page, $context, $object);
+ if ( empty( $screen ) )
+ $screen = get_current_screen();
+ elseif ( is_string( $screen ) )
+ $screen = convert_to_screen( $screen );
+
+ $page = $screen->id;
- $hidden = get_hidden_meta_boxes($page);
+ $hidden = get_hidden_meta_boxes( $screen );
- echo "