[wp-hackers] Cleaning up small validation errors in the admin interface

Dion Hulse (dd32) wordpress at dd32.id.au
Sun Apr 11 12:31:57 UTC 2010


I'd be looking in the direction of esc_url();

It should be used when the url is to be printed to screen.

for example:

echo '<A href="' . esc_url(get_some_link()) . '>';

It'll produce a link such as:
http://test.com/?a=b&#038;test=test3

(&#038; being the numeric representation of &amp;)

On Sun, 11 Apr 2010 21:12:40 +1000, Harish Narayanan  
<harish.mlists at gmail.com> wrote:

> Hello all,
>
> I receive a few validation errors due to small things like using &
> instead of &amp; in the WordPress admin interface. In order to work
> around this, I've been tracking down individual offending files and
> doing silly things like the following:
>
> Index: wp-admin/includes/media.php
> ===================================================================
> --- wp-admin/includes/media.php	(revision 14070)
> +++ wp-admin/includes/media.php	(working copy)
> @@ -388,10 +388,10 @@
>  	$upload_iframe_src = add_query_arg('post_id', $uploading_iframe_ID,
> 'media-upload.php');
>
>  	if ( 'media' != $type )
> -		$upload_iframe_src = add_query_arg('type', $type, $upload_iframe_src);
> +		$upload_iframe_src = add_query_arg('amp;type', $type,
> $upload_iframe_src);
>  	$upload_iframe_src = apply_filters($type . '_upload_iframe_src',
> $upload_iframe_src);
>
> -	return add_query_arg('TB_iframe', true, $upload_iframe_src);
> +	return add_query_arg('amp;TB_iframe', true, $upload_iframe_src);
>  }
>
>  /**
>
> While this sort of thing works, it is not very elegant. Could someone
> tell me what I should be touching (even lower than add_query_arg(), if
> possible) to perform such transformations uniformly across the admin
> (not frontend theme) interface?
>
> Thanks,
> Harish
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


-- 
Dion Hulse / dd32
Contact:
  e: contact at dd32.id.au
  Web: http://dd32.id.au/


More information about the wp-hackers mailing list