From 8d6cb67233ab26b17546e6d68fcab6bc0cde802f Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Sat, 9 May 2009 07:27:22 +0000 Subject: [PATCH] esc_js(). Shorter, follows new escaping naming convention. git-svn-id: https://develop.svn.wordpress.org/trunk@11245 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/edit-attachment-rows.php | 2 +- wp-admin/edit-form-advanced.php | 2 +- wp-admin/edit-form-comment.php | 2 +- wp-admin/edit-link-form.php | 2 +- wp-admin/edit-page-form.php | 2 +- wp-admin/import/blogger.php | 18 +++++++++--------- wp-admin/includes/template.php | 4 ++-- wp-admin/link-manager.php | 2 +- wp-admin/press-this.php | 2 +- wp-admin/themes.php | 2 +- wp-admin/update-core.php | 4 ++-- wp-admin/upload.php | 2 +- wp-content/themes/default/functions.php | 12 ++++++------ wp-includes/bookmark.php | 2 +- wp-includes/class.wp-scripts.php | 2 +- wp-includes/formatting.php | 21 +++++++++++++++++++-- wp-includes/js/tinymce/langs/wp-langs.php | 2 +- wp-includes/post.php | 2 +- wp-includes/taxonomy.php | 2 +- 19 files changed, 52 insertions(+), 35 deletions(-) diff --git a/wp-admin/edit-attachment-rows.php b/wp-admin/edit-attachment-rows.php index 84a4f8cfe0..c0297ed4ff 100644 --- a/wp-admin/edit-attachment-rows.php +++ b/wp-admin/edit-attachment-rows.php @@ -82,7 +82,7 @@ foreach ($posts_columns as $column_name => $column_display_name ) { if ( current_user_can('edit_post', $post->ID) ) $actions['edit'] = '' . __('Edit') . ''; if ( current_user_can('delete_post', $post->ID) ) - $actions['delete'] = "ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this attachment '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this attachment '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . ""; + $actions['delete'] = "ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this attachment '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this attachment '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . ""; $actions['view'] = '' . __('View') . ''; $action_count = count($actions); $i = 0; diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index ea016dd449..2c3a82334f 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -229,7 +229,7 @@ if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
ID) ) { ?> -ID", 'delete-post_' . $post->ID); ?>" onclick="if ( confirm('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;"> +ID", 'delete-post_' . $post->ID); ?>" onclick="if ( confirm('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;">
diff --git a/wp-admin/edit-form-comment.php b/wp-admin/edit-form-comment.php index 6ab134e1ba..1713fbe1fd 100644 --- a/wp-admin/edit-form-comment.php +++ b/wp-admin/edit-form-comment.php @@ -69,7 +69,7 @@ $date = date_i18n( $datef, strtotime( $comment->comment_date ) );
-comment_ID&_wp_original_http_referer=" . urlencode(wp_get_referer()), 'delete-comment_' . $comment->comment_ID) . "' onclick=\"if ( confirm('" . js_escape(__("You are about to delete this comment. \n 'Cancel' to stop, 'OK' to delete.")) . "') ){return true;}return false;\">" . __('Delete') . "\n"; ?> +comment_ID&_wp_original_http_referer=" . urlencode(wp_get_referer()), 'delete-comment_' . $comment->comment_ID) . "' onclick=\"if ( confirm('" . esc_js(__("You are about to delete this comment. \n 'Cancel' to stop, 'OK' to delete.")) . "') ){return true;}return false;\">" . __('Delete') . "\n"; ?>
diff --git a/wp-admin/edit-link-form.php b/wp-admin/edit-link-form.php index 6522a5bf10..c29eb8bdde 100644 --- a/wp-admin/edit-link-form.php +++ b/wp-admin/edit-link-form.php @@ -85,7 +85,7 @@ function link_submit_meta_box($link) { diff --git a/wp-admin/edit-page-form.php b/wp-admin/edit-page-form.php index 02b74dadf2..d13a7c95a6 100644 --- a/wp-admin/edit-page-form.php +++ b/wp-admin/edit-page-form.php @@ -216,7 +216,7 @@ endif; ?> diff --git a/wp-admin/import/blogger.php b/wp-admin/import/blogger.php index 2642c2714c..57fc06657e 100644 --- a/wp-admin/import/blogger.php +++ b/wp-admin/import/blogger.php @@ -190,13 +190,13 @@ class Blogger_Import { } } //echo '
'.print_r($this,1).'
'; - $start = js_escape( __('Import') ); - $continue = js_escape( __('Continue') ); - $stop = js_escape( __('Importing...') ); - $authors = js_escape( __('Set Authors') ); - $loadauth = js_escape( __('Preparing author mapping form...') ); - $authhead = js_escape( __('Final Step: Author Mapping') ); - $nothing = js_escape( __('Nothing was imported. Had you already imported this blog?') ); + $start = esc_js( __('Import') ); + $continue = esc_js( __('Continue') ); + $stop = esc_js( __('Importing...') ); + $authors = esc_js( __('Set Authors') ); + $loadauth = esc_js( __('Preparing author mapping form...') ); + $authhead = esc_js( __('Final Step: Author Mapping') ); + $nothing = esc_js( __('Nothing was imported. Had you already imported this blog?') ); $title = __('Blogger Blogs'); $name = __('Blog Name'); $url = __('Blog URL'); @@ -215,7 +215,7 @@ class Blogger_Import { else $value = $authors; $value = esc_attr($value); - $blogtitle = js_escape( $blog['title'] ); + $blogtitle = esc_js( $blog['title'] ); $pdone = isset($blog['posts_done']) ? (int) $blog['posts_done'] : 0; $cdone = isset($blog['comments_done']) ? (int) $blog['comments_done'] : 0; $init .= "blogs[$i]=new blog($i,'$blogtitle','{$blog['mode']}'," . $this->get_js_status($i) . ');'; @@ -658,7 +658,7 @@ class Blogger_Import { $blogtitle = "{$blog['title']} ({$blog['host']})"; $mapthis = __('Blogger username'); $tothis = __('WordPress login'); - $submit = js_escape( __('Save Changes') ); + $submit = esc_js( __('Save Changes') ); foreach ( $blog['authors'] as $i => $author ) $rows .= ""; diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 708ae6e002..510b48d5bc 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -1446,7 +1446,7 @@ function _post_row($a_post, $pending_comments, $mode) { if ( current_user_can('edit_post', $post->ID) ) { $actions['edit'] = '' . __('Edit') . ''; $actions['inline hide-if-no-js'] = '' . __('Quick Edit') . ''; - $actions['delete'] = "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') . ""; + $actions['delete'] = "ID) . "' onclick=\"if ( confirm('" . esc_js(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') . ""; } if ( in_array($post->post_status, array('pending', 'draft')) ) { if ( current_user_can('edit_post', $post->ID) ) @@ -1659,7 +1659,7 @@ foreach ($posts_columns as $column_name=>$column_display_name) { if ( current_user_can('edit_page', $page->ID) ) { $actions['edit'] = '' . __('Edit') . ''; $actions['inline'] = '' . __('Quick Edit') . ''; - $actions['delete'] = "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') . ""; + $actions['delete'] = "ID) . "' onclick=\"if ( confirm('" . esc_js(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') . ""; } if ( in_array($post->post_status, array('pending', 'draft')) ) { if ( current_user_can('edit_page', $page->ID) ) diff --git a/wp-admin/link-manager.php b/wp-admin/link-manager.php index 8de1b3afa2..7ba4326dc0 100644 --- a/wp-admin/link-manager.php +++ b/wp-admin/link-manager.php @@ -197,7 +197,7 @@ if ( $links ) { echo "link_name)) . "'>$link->link_name
"; $actions = array(); $actions['edit'] = '' . __('Edit') . ''; - $actions['delete'] = "link_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf( __("You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete."), $link->link_name )) . "') ) { return true;}return false;\">" . __('Delete') . ""; + $actions['delete'] = "link_id) . "' onclick=\"if ( confirm('" . esc_js(sprintf( __("You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete."), $link->link_name )) . "') ) { return true;}return false;\">" . __('Delete') . ""; $action_count = count($actions); $i = 0; echo '
'; diff --git a/wp-admin/press-this.php b/wp-admin/press-this.php index d1260eed3e..8e88cb2f63 100644 --- a/wp-admin/press-this.php +++ b/wp-admin/press-this.php @@ -402,7 +402,7 @@ var ajaxurl = ''; return false; break; case 'photo' : - jQuery('#extra_fields').before('

'); + jQuery('#extra_fields').before('

'); jQuery.ajax({ type: "GET", cache : false, diff --git a/wp-admin/themes.php b/wp-admin/themes.php index 4e7b77914b..2644b8b2f0 100644 --- a/wp-admin/themes.php +++ b/wp-admin/themes.php @@ -197,7 +197,7 @@ foreach ( $cols as $col => $theme_name ) { $actions[] = '' . __('Activate') . ''; $actions[] = '' . __('Preview') . ''; if ( current_user_can('update_themes') ) - $actions[] = '' . __('Delete') . ''; + $actions[] = '' . __('Delete') . ''; $actions = apply_filters('theme_action_links', $actions, $themes[$theme_name]); $actions = implode ( ' | ', $actions ); diff --git a/wp-admin/update-core.php b/wp-admin/update-core.php index 2da47ecab4..31bda9140e 100644 --- a/wp-admin/update-core.php +++ b/wp-admin/update-core.php @@ -58,8 +58,8 @@ function dismissed_updates() { $dismissed = get_core_updates( array( 'dismissed' => true, 'available' => false ) ); if ( $dismissed ) { - $show_text = js_escape(__('Show hidden updates')); - $hide_text = js_escape(__('Hide hidden updates')); + $show_text = esc_js(__('Show hidden updates')); + $hide_text = esc_js(__('Hide hidden updates')); ?>