From fc03d8c0302171f294f7671315139baab89606b9 Mon Sep 17 00:00:00 2001 From: dd32 Date: Sat, 19 Jun 2010 05:32:01 +0000 Subject: [PATCH] Coding standards clean-up of admin template.php. No logic changes. Removal of multiple spaces, addition of whitespace, addition of ;, s/"/'/g where appropriate, case changes of constants, removal of $output = '..'; echo $output. git-svn-id: http://svn.automattic.com/wordpress/trunk@15278 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/template.php | 268 +++++++++++++++++---------------- 1 file changed, 135 insertions(+), 133 deletions(-) diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index e3981f221c..95e608247a 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -102,7 +102,7 @@ function link_cat_row( $category, $name_override = false ) { $actions['edit'] = '' . __('Edit') . ''; $actions['inline hide-if-no-js'] = '' . __('Quick Edit') . ''; if ( $default_cat_id != $category->term_id ) - $actions['delete'] = "term_id) . "'>" . __('Delete') . ""; + $actions['delete'] = "term_id) . "'>" . __('Delete') . ''; $actions = apply_filters('link_cat_row_actions', $actions, $category); $action_count = count($actions); $i = 0; @@ -155,7 +155,7 @@ function link_cat_row( $category, $name_override = false ) { $output .= "$category->description"; break; case 'slug': - $output .= "" . apply_filters('editable_slug', $category->slug) . ""; + $output .= "" . apply_filters('editable_slug', $category->slug) . ''; break; case 'links': $attributes = 'class="links column-links num"' . $style; @@ -233,7 +233,7 @@ function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $select 'popular_cats' => $popular_cats, 'walker' => $walker, 'checked_ontop' => $checked_ontop - )); + )); } /** @@ -288,7 +288,7 @@ function wp_terms_checklist($post_id = 0, $args = array()) { $checked_categories = array(); $keys = array_keys( $categories ); - foreach( $keys as $k ) { + foreach ( $keys as $k ) { if ( in_array( $categories[$k]->term_id, $args['selected_cats'] ) ) { $checked_categories[] = $categories[$k]; unset( $categories[$k] ); @@ -340,7 +340,7 @@ function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $ech @@ -449,7 +449,7 @@ function _tag_row( $tag, $level, $taxonomy = 'post_tag' ) { $actions['inline hide-if-no-js'] = '' . __('Quick Edit') . ''; } if ( current_user_can($tax->cap->delete_terms) && $tag->term_id != $default_term ) - $actions['delete'] = "term_id) . "'>" . __('Delete') . ""; + $actions['delete'] = "term_id) . "'>" . __('Delete') . ''; $actions = apply_filters('tag_row_actions', $actions, $tag); $actions = apply_filters("${taxonomy}_row_actions", $actions, $tag); @@ -472,7 +472,7 @@ function _tag_row( $tag, $level, $taxonomy = 'post_tag' ) { $out .= "$tag->description"; break; case 'slug': - $out .= "" . apply_filters('editable_slug', $tag->slug) . ""; + $out .= "" . apply_filters('editable_slug', $tag->slug) . ''; break; case 'posts': $attributes = 'class="posts column-posts num"' . $style; @@ -530,7 +530,7 @@ function tag_rows( $page = 1, $pagesize = 20, $searchterms = '', $taxonomy = 'po $out .= _term_rows($taxonomy, $terms, $children, $page, $pagesize, $count); } else { $terms = get_terms( $taxonomy, $args ); - foreach( $terms as $term ) + foreach ( $terms as $term ) $out .= _tag_row( $term, 0, $taxonomy ); $count = $pagesize; // Only displaying a single page. } @@ -569,7 +569,7 @@ function _term_rows( $taxonomy, $terms, &$children, $page = 1, $per_page = 20, & $num_parents = count($my_parents); while ( $my_parent = array_pop($my_parents) ) { - $output .= "\t" . _tag_row( $my_parent, $level - $num_parents, $taxonomy ); + $output .= "\t" . _tag_row( $my_parent, $level - $num_parents, $taxonomy ); $num_parents--; } } @@ -803,11 +803,11 @@ function print_column_headers( $screen, $id = true ) { } /** - * Register column headers for a particular screen. The header names will be listed in the Screen Options. + * Register column headers for a particular screen. The header names will be listed in the Screen Options. * * @since 2.7.0 * - * @param string $screen The handle for the screen to add help to. This is usually the hook name returned by the add_*_page() functions. + * @param string $screen The handle for the screen to add help to. This is usually the hook name returned by the add_*_page() functions. * @param array $columns An array of columns with column IDs as the keys and translated column names as the values * @see get_column_headers(), print_column_headers(), get_hidden_columns() */ @@ -940,10 +940,9 @@ endif; // post_type_supports title ?> $authors_dropdown .= ''; endif; // authors -?> - - @@ -976,13 +975,13 @@ if ( !$bulk ) : - labels->name) ?> + labels->name); ?> @@ -1005,7 +1004,7 @@ if ( !$bulk ) : $post_type_object->name, 'selected' => $post->post_parent, 'name' => 'post_parent', 'show_option_none' => __('Main Page (no parent)'), 'option_none_value' => 0, 'sort_column'=> 'menu_order, post_title'); if ( $bulk ) - $dropdown_args['show_option_no_change'] = __('— No Change —'); + $dropdown_args['show_option_no_change'] = __('— No Change —'); $dropdown_args = apply_filters('quick_edit_dropdown_pages_args', $dropdown_args); wp_dropdown_pages($dropdown_args); ?> @@ -1016,7 +1015,7 @@ if ( !$bulk ) : @@ -1028,7 +1027,7 @@ if ( !$bulk ) : - + @@ -1041,13 +1040,13 @@ endif; // $post_type_object->hierarchical ?> - + post_type, 'comments' ) || post_type_supports( $screen->post_type, 'trackbacks' ) ) : if ( $bulk ) : ?> @@ -1104,7 +1103,7 @@ endif; // post_type_supports comments or pings ?> - + @@ -1342,7 +1341,7 @@ function _post_row($a_post, $pending_comments, $mode) { case 'title': $attributes = 'class="post-title column-title"' . $style; ?> - >cap->edit_post, $post->ID) && $post->post_status != 'trash' ) { ?> + >cap->edit_post, $post->ID) && $post->post_status != 'trash' ) { ?> cap->delete_post, $post->ID) ) { if ( 'trash' == $post->post_status ) - $actions['untrash'] = "ID) ), 'untrash-' . $post->post_type . '_' . $post->ID ) . "'>" . __('Restore') . ""; + $actions['untrash'] = "ID) ), 'untrash-' . $post->post_type . '_' . $post->ID ) . "'>" . __('Restore') . ''; elseif ( EMPTY_TRASH_DAYS ) - $actions['trash'] = "" . __('Trash') . ""; + $actions['trash'] = "" . __('Trash') . ''; if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS ) - $actions['delete'] = "" . __('Delete Permanently') . ""; + $actions['delete'] = "" . __('Delete Permanently') . ''; } if ( in_array($post->post_status, array('pending', 'draft')) ) { if ( current_user_can($post_type_object->cap->edit_post, $post->ID) ) @@ -1385,12 +1384,12 @@ function _post_row($a_post, $pending_comments, $mode) { case 'categories': ?> - >>slug'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'category', 'display')) . ""; + $out[] = " " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'category', 'display')) . ''; echo join( ', ', $out ); } else { _e('Uncategorized'); @@ -1401,12 +1400,12 @@ function _post_row($a_post, $pending_comments, $mode) { case 'tags': ?> - >>ID); if ( !empty( $tags ) ) { $out = array(); foreach ( $tags as $c ) - $out[] = " " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'post_tag', 'display')) . ""; + $out[] = " " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'post_tag', 'display')) . ''; echo join( ', ', $out ); } else { _e('No Tags'); @@ -1417,7 +1416,7 @@ function _post_row($a_post, $pending_comments, $mode) { case 'comments': ?> - >
+ >
- > + > - cap->edit_post, $post->ID) ) { echo "" . __('Edit') . ""; } ?> + cap->edit_post, $post->ID) ) { echo "" . __('Edit') . ''; } ?> - cap->delete_post, $post->ID) ) { echo "ID) . "' class='delete'>" . __('Delete') . ""; } ?> + cap->delete_post, $post->ID) ) { echo "ID) . "' class='delete'>" . __('Delete') . ''; } ?> - >ID); ?> + >ID); ?> ID; $rowclass = 'alternate' == $rowclass ? '' : 'alternate'; $posts_columns = get_column_headers( $current_screen ); - $hidden = get_hidden_columns( $current_screen ); + $hidden = get_hidden_columns( $current_screen ); $title = _draft_or_post_title(); $post_type = $page->post_type; $post_type_object = get_post_type_object($post_type); @@ -1567,7 +1566,7 @@ foreach ( $posts_columns as $column_name => $column_display_name ) { $attributes = 'class="post-title page-title column-title"' . $style; $edit_link = get_edit_post_link( $page->ID ); ?> - >cap->edit_post, $page->ID) && $post->post_status != 'trash' ) { ?>labels->parent_item_colon . ' ' . esc_html($parent_name) : ''; ?> + >cap->edit_post, $page->ID) && $post->post_status != 'trash' ) { ?>labels->parent_item_colon . ' ' . esc_html($parent_name) : ''; ?> cap->edit_post, $page->ID) && $post->post_status != 'trash' ) { @@ -1576,11 +1575,11 @@ foreach ( $posts_columns as $column_name => $column_display_name ) { } if ( current_user_can($post_type_object->cap->delete_post, $page->ID) ) { if ( $post->post_status == 'trash' ) - $actions['untrash'] = "post_type . '_' . $page->ID) . "'>" . __('Restore') . ""; + $actions['untrash'] = "post_type . '_' . $page->ID) . "'>" . __('Restore') . ''; elseif ( EMPTY_TRASH_DAYS ) - $actions['trash'] = "" . __('Trash') . ""; + $actions['trash'] = "" . __('Trash') . ''; if ( $post->post_status == 'trash' || !EMPTY_TRASH_DAYS ) - $actions['delete'] = "post_type . '_' . $page->ID) . "'>" . __('Delete Permanently') . ""; + $actions['delete'] = "post_type . '_' . $page->ID) . "'>" . __('Delete Permanently') . ''; } if ( in_array($post->post_status, array('pending', 'draft')) ) { if ( current_user_can($post_type_object->cap->edit_post, $page->ID) ) @@ -1606,7 +1605,7 @@ foreach ( $posts_columns as $column_name => $column_display_name ) { case 'comments': ?> - >
+ >
ID ); $pending_phrase = sprintf( __('%s pending'), number_format( $left ) ); @@ -1622,13 +1621,13 @@ foreach ( $posts_columns as $column_name => $column_display_name ) { case 'author': ?> - > + > - > + > = $end ) break; @@ -1764,7 +1763,7 @@ function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_ $my_parent = $my_parent->post_parent; } $num_parents = count($my_parents); - while( $my_parent = array_pop($my_parents) ) { + while ( $my_parent = array_pop($my_parents) ) { echo "\t" . display_page_row( $my_parent, $level - $num_parents ); $num_parents--; } @@ -1787,9 +1786,9 @@ function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_ * @since 2.1.0 * * @param object $user_object - * @param string $style Optional. Attributes added to the TR element. Must be sanitized. + * @param string $style Optional. Attributes added to the TR element. Must be sanitized. * @param string $role Key for the $wp_roles array. - * @param int $numposts Optional. Post count to display for this user. Defaults to zero, as in, a new user has made zero posts. + * @param int $numposts Optional. Post count to display for this user. Defaults to zero, as in, a new user has made zero posts. * @return string */ function user_row( $user_object, $style = '', $role = '', $numposts = 0 ) { @@ -1823,7 +1822,7 @@ function user_row( $user_object, $style = '', $role = '', $numposts = 0 ) { // Set up the hover actions for this user $actions = array(); - if ( current_user_can('edit_user', $user_object->ID) ) { + if ( current_user_can('edit_user', $user_object->ID) ) { $edit = "$user_object->user_login
"; $actions['edit'] = '' . __('Edit') . ''; } else { @@ -1831,9 +1830,9 @@ function user_row( $user_object, $style = '', $role = '', $numposts = 0 ) { } if ( !is_multisite() && $current_user->ID != $user_object->ID && current_user_can('delete_user', $user_object->ID) ) - $actions['delete'] = "" . __('Delete') . ""; + $actions['delete'] = "" . __('Delete') . ''; if ( is_multisite() && $current_user->ID != $user_object->ID && current_user_can('remove_user', $user_object->ID) ) - $actions['remove'] = "" . __('Remove') . ""; + $actions['remove'] = "" . __('Remove') . ''; $actions = apply_filters('user_row_actions', $actions, $user_object); $action_count = count($actions); $i = 0; @@ -2250,17 +2249,17 @@ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single', "; + echo '
'; return $i; @@ -3154,7 +3153,7 @@ function add_settings_error( $setting, $code, $message, $type = 'error' ) { * @param boolean $sanitize Whether to re-sanitize the setting value before returning errors. * @return array Array of settings errors */ -function get_settings_errors( $setting = '', $sanitize = FALSE ) { +function get_settings_errors( $setting = '', $sanitize = false ) { global $wp_settings_errors; // If $sanitize is true, manually re-run the sanitizisation for this option @@ -3205,23 +3204,23 @@ function get_settings_errors( $setting = '', $sanitize = FALSE ) { * @param boolean $hide_on_update If set to true errors will not be shown if the settings page has already been submitted. * @return */ -function settings_errors ( $setting = '', $sanitize = FALSE, $hide_on_update = FALSE ) { +function settings_errors( $setting = '', $sanitize = false, $hide_on_update = false ) { - if ($hide_on_update AND $_GET['updated']) return; + if ( $hide_on_update && !empty($_GET['updated']) ) + return; $settings_errors = get_settings_errors( $setting, $sanitize ); - if ( !is_array($settings_errors) ) return; + if ( !is_array($settings_errors) ) + return; - $output = ''; foreach ( $settings_errors as $key => $details ) { $css_id = 'setting-error-' . $details['code']; $css_class = $details['type'] . ' settings-error'; - $output .= "
\n"; - $output .= "

{$details['message']}

"; - $output .= "
\n"; + echo "
\n"; + echo "

{$details['message']}

"; + echo "
\n"; } - echo $output; } /** @@ -3273,7 +3272,7 @@ function find_posts_div($found_action = '') { -
+
true), 'objects' ); @@ -3281,7 +3280,7 @@ function find_posts_div($found_action = '') { if ( 'attachment' == $post->name ) continue; ?> - name, 'post'); ?> /> + name, 'post'); ?> /> @@ -3289,7 +3288,7 @@ function find_posts_div($found_action = '') {
- +
@@ -3307,7 +3306,8 @@ function find_posts_div($found_action = '') { */ function the_post_password() { global $post; - if ( isset( $post->post_password ) ) echo esc_attr( $post->post_password ); + if ( isset( $post->post_password ) ) + echo esc_attr( $post->post_password ); } /** @@ -3400,7 +3400,7 @@ function favorite_actions( $screen = null ) { array_shift($allowed_actions); - foreach ( $allowed_actions as $action => $label) { + foreach ( $allowed_actions as $action => $label ) { echo "\n"; @@ -3436,7 +3436,8 @@ function _draft_or_post_title($post_id = 0) { * */ function _admin_search_query() { - echo isset($_GET['s']) ? esc_attr( stripslashes( $_GET['s'] ) ) : ''; + if ( isset($_GET['s']) ) + echo esc_attr( stripslashes( $_GET['s'] ) ); } /** @@ -3448,17 +3449,18 @@ function _admin_search_query() { * */ function iframe_header( $title = '', $limit_styles = false ) { -global $hook_suffix; -?> + global $hook_suffix; +?> + > -<?php bloginfo('name') ?> › <?php echo $title ?> — <?php _e('WordPress'); ?> +<?php bloginfo('name'); ?> › <?php echo $title; ?> — <?php _e('WordPress'); ?> - class="no-js "> + class="no-js ">