Changeset 11204 for trunk/wp-admin/includes/template.php
- Timestamp:
- 05/05/2009 07:43:53 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/template.php
r11203 r11204 126 126 $edit_link = "categories.php?action=edit&cat_ID=$category->term_id"; 127 127 if ( current_user_can( 'manage_categories' ) ) { 128 $edit = "<a class='row-title' href='$edit_link' title='" . attr(sprintf(__('Edit “%s”'), $category->name)) . "'>" .attr( $name ) . '</a><br />';128 $edit = "<a class='row-title' href='$edit_link' title='" . esc_attr(sprintf(__('Edit “%s”'), $category->name)) . "'>" . esc_attr( $name ) . '</a><br />'; 129 129 $actions = array(); 130 130 $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; … … 265 265 <a accesskey="c" href="#inline-edit" title="<?php _e('Cancel'); ?>" class="cancel button-secondary alignleft"><?php _e('Cancel'); ?></a> 266 266 <?php $update_text = ( $is_tag ) ? __( 'Update Tag' ) : __( 'Update Category' ); ?> 267 <a accesskey="s" href="#inline-edit" title="<?php echo attr( $update_text ); ?>" class="save button-primary alignright"><?php echo $update_text; ?></a>267 <a accesskey="s" href="#inline-edit" title="<?php echo esc_attr( $update_text ); ?>" class="save button-primary alignright"><?php echo $update_text; ?></a> 268 268 <img class="waiting" style="display:none;" src="images/wpspin_light.gif" alt="" /> 269 269 <span class="error" style="display:none;"></span> … … 297 297 $edit_link = "link-category.php?action=edit&cat_ID=$category->term_id"; 298 298 if ( current_user_can( 'manage_categories' ) ) { 299 $edit = "<a class='row-title' href='$edit_link' title='" . attr(sprintf(__('Edit “%s”'), $category->name)) . "'>$name</a><br />";299 $edit = "<a class='row-title' href='$edit_link' title='" . esc_attr(sprintf(__('Edit “%s”'), $category->name)) . "'>$name</a><br />"; 300 300 $actions = array(); 301 301 $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; … … 659 659 break; 660 660 case 'name': 661 $out .= '<td ' . $attributes . '><strong><a class="row-title" href="' . $edit_link . '" title="' . attr(sprintf(__('Edit “%s”'), $name)) . '">' . $name . '</a></strong><br />';661 $out .= '<td ' . $attributes . '><strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr(sprintf(__('Edit “%s”'), $name)) . '">' . $name . '</a></strong><br />'; 662 662 $actions = array(); 663 663 $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; … … 1258 1258 $update_text = ( $is_page ) ? __( 'Update Page' ) : __( 'Update Post' ); 1259 1259 ?> 1260 <a accesskey="s" href="#inline-edit" title="<?php _e('Update'); ?>" class="button-primary save alignright"><?php echo attr( $update_text ); ?></a>1260 <a accesskey="s" href="#inline-edit" title="<?php _e('Update'); ?>" class="button-primary save alignright"><?php echo esc_attr( $update_text ); ?></a> 1261 1261 <img class="waiting" style="display:none;" src="images/wpspin_light.gif" alt="" /> 1262 1262 <?php } else { 1263 1263 $update_text = ( $is_page ) ? __( 'Update Pages' ) : __( 'Update Posts' ); 1264 1264 ?> 1265 <input accesskey="s" class="button-primary alignright" type="submit" name="bulk_edit" value="<?php echo attr( $update_text ); ?>" />1265 <input accesskey="s" class="button-primary alignright" type="submit" name="bulk_edit" value="<?php echo esc_attr( $update_text ); ?>" /> 1266 1266 <?php } ?> 1267 1267 <input type="hidden" name="post_view" value="<?php echo $m; ?>" /> … … 1289 1289 return; 1290 1290 1291 $title = attr($post->post_title);1291 $title = esc_attr($post->post_title); 1292 1292 1293 1293 echo ' … … 1438 1438 $attributes = 'class="post-title column-title"' . $style; 1439 1439 ?> 1440 <td <?php echo $attributes ?>><strong><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo attr(sprintf(__('Edit “%s”'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; }; _post_states($post); ?></strong>1440 <td <?php echo $attributes ?>><strong><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit “%s”'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; }; _post_states($post); ?></strong> 1441 1441 <?php 1442 1442 if ( 'excerpt' == $mode ) … … 1445 1445 $actions = array(); 1446 1446 if ( current_user_can('edit_post', $post->ID) ) { 1447 $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . attr(__('Edit this post')) . '">' . __('Edit') . '</a>';1448 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . attr(__('Edit this post inline')) . '">' . __('Quick Edit') . '</a>';1449 $actions['delete'] = "<a class='submitdelete' title='" . attr(__('Delete this post')) . "' href='" . wp_nonce_url("post.php?action=delete&post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";1447 $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this post')) . '">' . __('Edit') . '</a>'; 1448 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this post inline')) . '">' . __('Quick Edit') . '</a>'; 1449 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this post')) . "' href='" . wp_nonce_url("post.php?action=delete&post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; 1450 1450 } 1451 1451 if ( in_array($post->post_status, array('pending', 'draft')) ) { 1452 1452 if ( current_user_can('edit_post', $post->ID) ) 1453 $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';1453 $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">' . __('Preview') . '</a>'; 1454 1454 } else { 1455 $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . attr(sprintf(__('View “%s”'), $title)) . '" rel="permalink">' . __('View') . '</a>';1455 $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View “%s”'), $title)) . '" rel="permalink">' . __('View') . '</a>'; 1456 1456 } 1457 1457 $actions = apply_filters('post_row_actions', $actions, $post); … … 1654 1654 $edit_link = get_edit_post_link( $page->ID ); 1655 1655 ?> 1656 <td <?php echo $attributes ?>><strong><?php if ( current_user_can( 'edit_post', $page->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo attr(sprintf(__('Edit “%s”'), $title)); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states($page); echo isset($parent_name) ? ' | ' . __('Parent Page: ') . wp_specialchars($parent_name) : ''; ?></strong>1656 <td <?php echo $attributes ?>><strong><?php if ( current_user_can( 'edit_post', $page->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit “%s”'), $title)); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states($page); echo isset($parent_name) ? ' | ' . __('Parent Page: ') . wp_specialchars($parent_name) : ''; ?></strong> 1657 1657 <?php 1658 1658 $actions = array(); 1659 1659 if ( current_user_can('edit_page', $page->ID) ) { 1660 $actions['edit'] = '<a href="' . $edit_link . '" title="' . attr(__('Edit this page')) . '">' . __('Edit') . '</a>';1660 $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr(__('Edit this page')) . '">' . __('Edit') . '</a>'; 1661 1661 $actions['inline'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>'; 1662 $actions['delete'] = "<a class='submitdelete' title='" . attr(__('Delete this page')) . "' href='" . wp_nonce_url("page.php?action=delete&post=$page->ID", 'delete-page_' . $page->ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $page->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this page '%s'\n 'Cancel' to stop, 'OK' to delete."), $page->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";1662 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this page')) . "' href='" . wp_nonce_url("page.php?action=delete&post=$page->ID", 'delete-page_' . $page->ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $page->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this page '%s'\n 'Cancel' to stop, 'OK' to delete."), $page->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; 1663 1663 } 1664 1664 if ( in_array($post->post_status, array('pending', 'draft')) ) { 1665 1665 if ( current_user_can('edit_page', $page->ID) ) 1666 $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';1666 $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">' . __('Preview') . '</a>'; 1667 1667 } else { 1668 $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . attr(sprintf(__('View “%s”'), $title)) . '" rel="permalink">' . __('View') . '</a>';1668 $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('View “%s”'), $title)) . '" rel="permalink">' . __('View') . '</a>'; 1669 1669 } 1670 1670 $actions = apply_filters('page_row_actions', $actions, $page); … … 2125 2125 <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden"> 2126 2126 <textarea class="comment" rows="3" cols="10"><?php echo $comment->comment_content; ?></textarea> 2127 <div class="author-email"><?php if ( $user_can ) echo attr( $comment->comment_author_email ); ?></div>2128 <div class="author"><?php if ( $user_can ) echo attr( $comment->comment_author ); ?></div>2129 <div class="author-url"><?php echo attr( $comment->comment_author_url ); ?></div>2127 <div class="author-email"><?php if ( $user_can ) echo esc_attr( $comment->comment_author_email ); ?></div> 2128 <div class="author"><?php if ( $user_can ) echo esc_attr( $comment->comment_author ); ?></div> 2129 <div class="author-url"><?php echo esc_attr( $comment->comment_author_url ); ?></div> 2130 2130 <div class="comment_status"><?php echo $comment->comment_approved; ?></div> 2131 2131 </div> … … 2306 2306 <input type="hidden" name="position" id="position" value="<?php echo $position; ?>" /> 2307 2307 <input type="hidden" name="checkbox" id="checkbox" value="<?php echo $checkbox ? 1 : 0; ?>" /> 2308 <input type="hidden" name="mode" id="mode" value="<?php echo attr($mode); ?>" />2308 <input type="hidden" name="mode" id="mode" value="<?php echo esc_attr($mode); ?>" /> 2309 2309 <?php wp_nonce_field( 'replyto-comment', '_ajax_nonce', false ); ?> 2310 2310 <?php wp_comment_form_unfiltered_html_nonce(); ?> … … 2428 2428 } 2429 2429 2430 $entry['meta_key'] = attr($entry['meta_key']);2430 $entry['meta_key'] = esc_attr($entry['meta_key']); 2431 2431 $entry['meta_value'] = htmlspecialchars($entry['meta_value']); // using a <textarea /> 2432 2432 $entry['meta_id'] = (int) $entry['meta_id']; … … 2438 2438 2439 2439 $r .= "\n\t\t<div class='submit'><input name='deletemeta[{$entry['meta_id']}]' type='submit' "; 2440 $r .= "class='delete:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$delete_nonce deletemeta' tabindex='6' value='". _a( 'Delete' ) ."' />";2441 $r .= "\n\t\t<input name='updatemeta' type='submit' tabindex='6' value='". _a( 'Update' ) ."' class='add:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$update_nonce updatemeta' /></div>";2440 $r .= "class='delete:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$delete_nonce deletemeta' tabindex='6' value='". esc_attr__( 'Delete' ) ."' />"; 2441 $r .= "\n\t\t<input name='updatemeta' type='submit' tabindex='6' value='". esc_attr__( 'Update' ) ."' class='add:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$update_nonce updatemeta' /></div>"; 2442 2442 $r .= wp_nonce_field( 'change-meta', '_ajax_nonce', false, false ); 2443 2443 $r .= "</td>"; … … 2483 2483 2484 2484 foreach ( $keys as $key ) { 2485 $key = attr( $key );2486 echo "\n<option value='" . attr($key) . "'>$key</option>";2485 $key = esc_attr( $key ); 2486 echo "\n<option value='" . esc_attr($key) . "'>$key</option>"; 2487 2487 } 2488 2488 ?> … … 2500 2500 2501 2501 <tr><td colspan="2" class="submit"> 2502 <input type="submit" id="addmetasub" name="addmeta" class="add:the-list:newmeta" tabindex="9" value="<?php _ea( 'Add Custom Field' ) ?>" />2502 <input type="submit" id="addmetasub" name="addmeta" class="add:the-list:newmeta" tabindex="9" value="<?php esc_attr_e( 'Add Custom Field' ) ?>" /> 2503 2503 <?php wp_nonce_field( 'add-meta', '_ajax_nonce', false ); ?> 2504 2504 </td></tr> … … 2720 2720 $name = translate_user_role($details['name'] ); 2721 2721 if ( $selected == $role ) // Make default first in list 2722 $p = "\n\t<option selected='selected' value='" . attr($role) . "'>$name</option>";2722 $p = "\n\t<option selected='selected' value='" . esc_attr($role) . "'>$name</option>"; 2723 2723 else 2724 $r .= "\n\t<option value='" . attr($role) . "'>$name</option>";2724 $r .= "\n\t<option value='" . esc_attr($role) . "'>$name</option>"; 2725 2725 } 2726 2726 echo $p . $r; … … 2793 2793 else : 2794 2794 ?> 2795 <form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo attr($action) ?>">2795 <form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo esc_attr($action) ?>"> 2796 2796 <p> 2797 2797 <?php wp_nonce_field('import-upload'); ?> … … 2802 2802 </p> 2803 2803 <p class="submit"> 2804 <input type="submit" class="button" value="<?php _ea( 'Upload file and import' ); ?>" />2804 <input type="submit" class="button" value="<?php esc_attr_e( 'Upload file and import' ); ?>" /> 2805 2805 </p> 2806 2806 </form> … … 2816 2816 function wp_remember_old_slug() { 2817 2817 global $post; 2818 $name = attr($post->post_name); // just in case2818 $name = esc_attr($post->post_name); // just in case 2819 2819 if ( strlen($name) ) 2820 2820 echo '<input type="hidden" id="wp-old-slug" name="wp-old-slug" value="' . $name . '" />'; … … 3155 3155 <div class="find-box-search"> 3156 3156 <?php if ( $found_action ) { ?> 3157 <input type="hidden" name="found_action" value="<?php echo attr($found_action); ?>" />3157 <input type="hidden" name="found_action" value="<?php echo esc_attr($found_action); ?>" /> 3158 3158 <?php } ?> 3159 3159 … … 3162 3162 <label class="invisible" for="find-posts-input"><?php _e( 'Search' ); ?></label> 3163 3163 <input type="text" id="find-posts-input" name="ps" value="" /> 3164 <input type="button" onclick="findPosts.send();" value="<?php _ea( 'Search' ); ?>" class="button" /><br />3164 <input type="button" onclick="findPosts.send();" value="<?php esc_attr_e( 'Search' ); ?>" class="button" /><br /> 3165 3165 3166 3166 <input type="radio" name="find-posts-what" id="find-posts-posts" checked="checked" value="posts" /> … … 3172 3172 </div> 3173 3173 <div class="find-box-buttons"> 3174 <input type="button" class="button alignleft" onclick="findPosts.close();" value="<?php _ea('Close'); ?>" />3175 <input id="find-posts-submit" type="submit" class="button-primary alignright" value="<?php _ea('Select'); ?>" />3174 <input type="button" class="button alignleft" onclick="findPosts.close();" value="<?php esc_attr_e('Close'); ?>" /> 3175 <input id="find-posts-submit" type="submit" class="button-primary alignright" value="<?php esc_attr_e('Select'); ?>" /> 3176 3176 </div> 3177 3177 </div> … … 3182 3182 * Display the post password. 3183 3183 * 3184 * The password is passed through {@link attr()} to ensure that it3184 * The password is passed through {@link esc_attr()} to ensure that it 3185 3185 * is safe for placing in an html attribute. 3186 3186 * … … 3190 3190 function the_post_password() { 3191 3191 global $post; 3192 if ( isset( $post->post_password ) ) echo attr( $post->post_password );3192 if ( isset( $post->post_password ) ) echo esc_attr( $post->post_password ); 3193 3193 } 3194 3194 … … 3313 3313 */ 3314 3314 function _admin_search_query() { 3315 echo isset($_GET['s']) ? attr( stripslashes( $_GET['s'] ) ) : '';3315 echo isset($_GET['s']) ? esc_attr( stripslashes( $_GET['s'] ) ) : ''; 3316 3316 } 3317 3317 … … 3644 3644 if ( !empty($per_page_label) ) 3645 3645 $return .= "<label for='$option'>$per_page_label</label> <input type='text' class='screen-per-page' name='wp_screen_options[value]' id='$option' maxlength='3' value='$per_page' />\n"; 3646 $return .= "<input type='submit' class='button' value='" . _a('Apply') . "' />";3647 $return .= "<input type='hidden' name='wp_screen_options[option]' value='" . attr($option) . "' />";3646 $return .= "<input type='submit' class='button' value='" . esc_attr__('Apply') . "' />"; 3647 $return .= "<input type='hidden' name='wp_screen_options[option]' value='" . esc_attr($option) . "' />"; 3648 3648 $return .= "</div>\n"; 3649 3649 return $return;
Note: See TracChangeset
for help on using the changeset viewer.