Skip to content

Commit

Permalink
Don't use deprecated functions. see #11388
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.automattic.com/wordpress/trunk@13106 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
nacin committed Feb 13, 2010
1 parent b4c55aa commit b4f3622
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion wp-admin/includes/bookmark.php
Expand Up @@ -246,7 +246,7 @@ function wp_set_link_cats( $link_id = 0, $link_categories = array() ) {
function wp_update_link( $linkdata ) {
$link_id = (int) $linkdata['link_id'];

$link = get_link( $link_id, ARRAY_A );
$link = get_bookmark( $link_id, ARRAY_A );

// Escape data pulled from DB.
$link = add_magic_quotes( $link );
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/includes/media.php
Expand Up @@ -1146,7 +1146,7 @@ function get_media_items( $post_id, $errors ) {
function get_media_item( $attachment_id, $args = null ) {
global $redir_tab;

if ( ( $attachment_id = intval( $attachment_id ) ) && $thumb_url = get_attachment_icon_src( $attachment_id ) )
if ( ( $attachment_id = intval( $attachment_id ) ) && $thumb_url = wp_get_attachment_image_src( $attachment_id ) )
$thumb_url = $thumb_url[0];
else
return false;
Expand Down
4 changes: 2 additions & 2 deletions wp-admin/includes/ms.php
Expand Up @@ -212,7 +212,7 @@ function wpmu_get_blog_allowedthemes( $blog_id = 0 ) {

if ( is_array( $blog_allowed_themes ) ) {
foreach( (array) $themes as $key => $theme ) {
$theme_key = wp_specialchars( $theme[ 'Stylesheet' ] );
$theme_key = esc_html( $theme[ 'Stylesheet' ] );
if ( isset( $blog_allowed_themes[ $key ] ) == true ) {
$blog_allowedthemes[ $theme_key ] = 1;
}
Expand Down Expand Up @@ -335,7 +335,7 @@ function get_site_allowed_themes() {
$allowed_themes = array();
} else {
foreach( (array) $themes as $key => $theme ) {
$theme_key = wp_specialchars( $theme[ 'Stylesheet' ] );
$theme_key = esc_html( $theme[ 'Stylesheet' ] );
if ( isset( $allowed_themes[ $key ] ) == true ) {
$allowedthemes[ $theme_key ] = 1;
}
Expand Down
6 changes: 3 additions & 3 deletions wp-admin/includes/theme.php
Expand Up @@ -142,12 +142,12 @@ function get_allowed_themes() {
if ( is_array( $blog_allowed_themes ) )
$allowed_themes = array_merge( $allowed_themes, $blog_allowed_themes );

if ( isset( $allowed_themes[ wp_specialchars( $ct->stylesheet ) ] ) == false )
$allowed_themes[ wp_specialchars( $ct->stylesheet ) ] = true;
if ( isset( $allowed_themes[ esc_html( $ct->stylesheet ) ] ) == false )
$allowed_themes[ esc_html( $ct->stylesheet ) ] = true;

reset( $themes );
foreach ( $themes as $key => $theme ) {
if ( isset( $allowed_themes[ wp_specialchars( $theme[ 'Stylesheet' ] ) ] ) == false )
if ( isset( $allowed_themes[ esc_html( $theme[ 'Stylesheet' ] ) ] ) == false )
unset( $themes[ $key ] );
}
reset( $themes );
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/includes/user.php
Expand Up @@ -92,7 +92,7 @@ function edit_user( $user_id = 0 ) {
if ( empty ( $_POST['url'] ) || $_POST['url'] == 'http://' ) {
$user->user_url = '';
} else {
$user->user_url = sanitize_url( $_POST['url'] );
$user->user_url = esc_url_raw( $_POST['url'] );
$user->user_url = preg_match('/^(https?|ftps?|mailto|news|irc|gopher|nntp|feed|telnet):/is', $user->user_url) ? $user->user_url : 'http://'.$user->user_url;
}
}
Expand Down
14 changes: 7 additions & 7 deletions wp-admin/ms-edit.php
Expand Up @@ -385,8 +385,8 @@
$themes = get_themes();
reset( $themes );
foreach ( (array) $themes as $key => $theme ) {
if ( $_POST['theme'][ wp_specialchars( $theme['Stylesheet'] ) ] == 'enabled' )
$allowed_themes[ wp_specialchars( $theme['Stylesheet'] ) ] = true;
if ( $_POST['theme'][ esc_html( $theme['Stylesheet'] ) ] == 'enabled' )
$allowed_themes[ esc_html( $theme['Stylesheet'] ) ] = true;
}
update_site_option( 'allowedthemes', $allowed_themes );
}
Expand All @@ -413,12 +413,12 @@
</head>
<body id="error-page">
<h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
<form action='ms-edit.php?action=<?php echo wp_specialchars( $_GET[ 'action2' ] ) ?>' method='post'>
<input type='hidden' name='action' value='<?php echo wp_specialchars( $_GET['action2'] ) ?>' />
<input type='hidden' name='id' value='<?php echo wp_specialchars( $id ); ?>' />
<form action='ms-edit.php?action=<?php echo esc_attr( $_GET[ 'action2' ] ) ?>' method='post'>
<input type='hidden' name='action' value='<?php echo esc_attr( $_GET['action2'] ) ?>' />
<input type='hidden' name='id' value='<?php echo esc_attr( $id ); ?>' />
<input type='hidden' name='ref' value='<?php echo $referrer; ?>' />
<?php wp_nonce_field( $_GET['action2'] ) ?>
<p><?php echo wp_specialchars( stripslashes($_GET['msg']) ); ?></p>
<p><?php echo esc_html( stripslashes($_GET['msg']) ); ?></p>
<p class="submit"><input class="button" type='submit' value='<?php _e("Confirm"); ?>' /></p>
</form>
</body>
Expand Down Expand Up @@ -499,7 +499,7 @@
wp_die( __('Missing email.') );

$password = wp_generate_password();
$user_id = wpmu_create_user(wp_specialchars( strtolower( $user['username'] ) ), $password, wp_specialchars( $user['email'] ) );
$user_id = wpmu_create_user(wp_specialchars( strtolower( $user['username'] ) ), $password, esc_html( $user['email'] ) );

if ( false == $user_id )
wp_die( __('Duplicated username or email address.') );
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/ms-options.php
Expand Up @@ -280,7 +280,7 @@
$menu_perms = get_site_option( 'menu_items' );
$menu_items = apply_filters( 'mu_menu_items', array('plugins' => __('Plugins')) );
foreach ( (array) $menu_items as $key => $val ) {
echo "<tr><th scope='row'>" . wp_specialchars($val) . "</th><td><input type='checkbox' name='menu_items[" . $key . "]' value='1'" . checked($menu_perms[$key], '1', false) . " /></td></tr>";
echo "<tr><th scope='row'>" . esc_html($val) . "</th><td><input type='checkbox' name='menu_items[" . $key . "]' value='1'" . checked($menu_perms[$key], '1', false) . " /></td></tr>";
}
?>
</table>
Expand Down
6 changes: 3 additions & 3 deletions wp-admin/ms-sites.php
Expand Up @@ -168,7 +168,7 @@
$disabled = '';
if ( is_serialized($option->option_value) ) {
if ( is_serialized_string($option->option_value) ) {
$option->option_value = wp_specialchars(maybe_unserialize($option->option_value), 'single');
$option->option_value = esc_html(maybe_unserialize($option->option_value), 'single');
} else {
$option->option_value = "SERIALIZED DATA";
$disabled = ' disabled="disabled"';
Expand Down Expand Up @@ -210,7 +210,7 @@
$allowed_themes = array_keys( $themes );
$out = '';
foreach ( $themes as $key => $theme ) {
$theme_key = wp_specialchars( $theme['Stylesheet'] );
$theme_key = esc_html( $theme['Stylesheet'] );
if ( ! isset($allowed_themes[$theme_key] ) ) {
$checked = ( isset($blog_allowed_themes[ $theme_key ]) ) ? 'checked="checked"' : '';
$out .= '<tr class="form-field form-required">
Expand Down Expand Up @@ -253,7 +253,7 @@
<td>
<select name="role[<?php echo $val->user_id ?>]" id="new_role"><?php
foreach ( $editblog_roles as $role => $role_assoc ){
$name = translate_with_context($role_assoc['name']);
$name = translate_user_role($role_assoc['name']);
$selected = ( $role == $existing_role ) ? 'selected="selected"' : '';
echo "<option {$selected} value=\"" . esc_attr($role) . "\">{$name}</option>";
}
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/ms-themes.php
Expand Up @@ -37,7 +37,7 @@
$class = '';
foreach ( (array) $themes as $key => $theme ) {
$total_theme_count++;
$theme_key = wp_specialchars($theme['Stylesheet']);
$theme_key = esc_html($theme['Stylesheet']);
$class = ('alt' == $class) ? '' : 'alt';
$class1 = $enabled = $disabled = '';

Expand Down
2 changes: 1 addition & 1 deletion wp-admin/user-edit.php
Expand Up @@ -70,7 +70,7 @@ function use_ssl_preference($user) {
$new_email = get_option( $current_user->ID . '_new_email' );
if ( $new_email[ 'hash' ] == $_GET[ 'newuseremail' ] ) {
$user->ID = $current_user->ID;
$user->user_email = wp_specialchars( trim( $new_email[ 'newemail' ] ) );
$user->user_email = esc_html( trim( $new_email[ 'newemail' ] ) );
if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $current_user->user_login ) ) )
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $user->user_email, $current_user->user_login ) );
wp_update_user( get_object_vars( $user ) );
Expand Down
4 changes: 2 additions & 2 deletions wp-admin/user-new.php
Expand Up @@ -27,7 +27,7 @@ function admin_created_user_email( $text ) {
this email. This invitation will expire in a few days.
Please click the following link to activate your user account:
%%s" ), get_bloginfo('name'), site_url(), wp_specialchars( $_REQUEST[ 'role' ] ) );
%%s" ), get_bloginfo('name'), site_url(), esc_html( $_REQUEST[ 'role' ] ) );
}
add_filter( 'wpmu_signup_user_notification_email', 'admin_created_user_email' );

Expand Down Expand Up @@ -55,7 +55,7 @@ function admin_created_user_subject( $text ) {
$user_details = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->users} WHERE user_login = %s AND user_email = %s", $user_login, $_REQUEST[ 'email' ] ) );
if ( $user_details ) {
// Adding an existing user to this blog
$new_user_email = wp_specialchars(trim($_REQUEST['email']));
$new_user_email = esc_html(trim($_REQUEST['email']));
$redirect = 'user-new.php';
$username = $user_details->user_login;
$user_id = $user_details->ID;
Expand Down
10 changes: 5 additions & 5 deletions wp-includes/ms-functions.php
Expand Up @@ -867,7 +867,7 @@ function wpmu_admin_do_redirect( $url = '' ) {
$url = wpmu_admin_redirect_add_updated_param( $url );
if ( isset( $_GET['redirect'] ) ) {
if ( substr( $_GET['redirect'], 0, 2 ) == 's_' )
$url .= "&action=blogs&s=". wp_specialchars( substr( $_GET['redirect'], 2 ) );
$url .= "&action=blogs&s=". esc_html( substr( $_GET['redirect'], 2 ) );
} elseif ( isset( $_POST['redirect'] ) ) {
$url = wpmu_admin_redirect_add_updated_param( $_POST['redirect'] );
}
Expand Down Expand Up @@ -1155,7 +1155,7 @@ function wpmu_signup_blog_notification($domain, $path, $title, $user, $user_emai
$admin_email = get_site_option( "admin_email" );
if ( $admin_email == '' )
$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
$from_name = get_site_option( "site_name" ) == '' ? 'WordPress' : wp_specialchars( get_site_option( "site_name" ) );
$from_name = get_site_option( "site_name" ) == '' ? 'WordPress' : esc_html( get_site_option( "site_name" ) );
$message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
$message = sprintf( apply_filters( 'wpmu_signup_blog_notification_email', __( "To activate your blog, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login.\n\nAfter you activate, you can visit your blog here:\n\n%s" ) ), $activate_url, esc_url( "http://{$domain}{$path}" ), $key );
// TODO: Don't hard code activation link.
Expand All @@ -1174,7 +1174,7 @@ function wpmu_signup_user_notification($user, $user_email, $key, $meta = '') {
$admin_email = get_site_option( "admin_email" );
if ( $admin_email == '' )
$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
$from_name = get_site_option( "site_name" ) == '' ? 'WordPress' : wp_specialchars( get_site_option( "site_name" ) );
$from_name = get_site_option( "site_name" ) == '' ? 'WordPress' : esc_html( get_site_option( "site_name" ) );
$message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
$message = sprintf( apply_filters( 'wpmu_signup_user_notification_email', __( "To activate your user, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login.\n\n" ) ), site_url( "wp-activate.php?key=$key" ), $key );
// TODO: Don't hard code activation link.
Expand Down Expand Up @@ -1478,7 +1478,7 @@ function wpmu_welcome_notification($blog_id, $user_id, $password, $title, $meta
if ( $admin_email == '' )
$admin_email = 'support@' . $_SERVER['SERVER_NAME'];

$from_name = get_site_option( "site_name" ) == '' ? 'WordPress' : wp_specialchars( get_site_option( "site_name" ) );
$from_name = get_site_option( "site_name" ) == '' ? 'WordPress' : esc_html( get_site_option( "site_name" ) );
$message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
$message = $welcome_email;

Expand Down Expand Up @@ -1511,7 +1511,7 @@ function wpmu_welcome_user_notification($user_id, $password, $meta = '') {
if ( $admin_email == '' )
$admin_email = 'support@' . $_SERVER['SERVER_NAME'];

$from_name = get_site_option( "site_name" ) == '' ? 'WordPress' : wp_specialchars( get_site_option( "site_name" ) );
$from_name = get_site_option( "site_name" ) == '' ? 'WordPress' : esc_html( get_site_option( "site_name" ) );
$message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
$message = $welcome_email;

Expand Down
2 changes: 1 addition & 1 deletion wp-signup.php
Expand Up @@ -230,7 +230,7 @@ function signup_user($user_name = '', $user_email = '', $errors = '') {
if ( !is_wp_error($errors) )
$errors = new WP_Error();
if ( isset( $_POST[ 'signup_for' ] ) )
$signup[ wp_specialchars( $_POST[ 'signup_for' ] ) ] = 'checked="checked"';
$signup[ esc_html( $_POST[ 'signup_for' ] ) ] = 'checked="checked"';
else
$signup[ 'blog' ] = 'checked="checked"';

Expand Down

0 comments on commit b4f3622

Please sign in to comment.