[wp-hackers] wp_enqueue_script() and URLs with 2+ parameters
Matt Martz
mdmartz at sivel.net
Fri Feb 27 20:22:10 GMT 2009
On Fri, Feb 27, 2009 at 3:10 PM, Glenn Ansley <glenn at glennansley.com> wrote:
>>> So I'm not sure I understand what the problem with having the & replaced with & is.
>
> I think this is a fairly limited use and may not be necessary for
> core. The reason its necessary here is because the JS script being
> called is a .php script and he's going to want to use $_GET to do
> something with the query string vars... I'm guessing that's why he
> needs the & intact. That's why I did.
>
> Glenn Ansley
> WordPress Pluign Development
> http://fullthrottledevelopment.com
>
>
> On Fri, Feb 27, 2009 at 3:01 PM, Matt Martz <mdmartz at sivel.net> wrote:
>> On Fri, Feb 27, 2009 at 2:50 PM, Glenn Ansley <glenn at glennansley.com> wrote:
>>>>wp_enqueue_script('my-custom-js',"$template_url/ js/ my-custom-js .js.php?p1=A&p2=B&p3=C",array('jquery'),'1.0');
>>>
>>> Oh yeah... depending on where these query vars are coming from, it
>>> might be wise to add some form of cleaning back to them in your filter
>>> since you're now bypassing clean_url()
>>>
>>> Glenn Ansley
>>> WordPress Pluign Development
>>> http://fullthrottledevelopment.com
>>>
>>> On Fri, Feb 27, 2009 at 2:44 PM, Austin Matzko <if.website at gmail.com> wrote:
>>>> On Fri, Feb 27, 2009 at 1:41 PM, Glenn Ansley <glenn at glennansley.com> wrote:
>>>>>>To fix this in current WordPress, filter 'script_loader_src'
>>>>> I believe this is too early. Whatever you output from
>>>>> script_loader_src will still be cleaned by clean_url(). Correct? (i'm
>>>>> not testing as i respond)
>>>>
>>>> You are correct. My mistake.
>>>> _______________________________________________
>>>> wp-hackers mailing list
>>>> wp-hackers at lists.automattic.com
>>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>>
>>> _______________________________________________
>>> wp-hackers mailing list
>>> wp-hackers at lists.automattic.com
>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>
>>
>> So I'm not sure I understand what the problem with having the &
>> replaced with & is.
>>
>> The reason it is done is because & signs on their own do not validate
>> as XHTML. I don't see any reason why having & wouldn't work.
>> Generally & signs are replaced with & but & is the same
>> thing.
>>
>> --
>> Matt Martz
>> matt at sivel.net
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
When the client browser makes the call it will convert the entity to
the correct character before making the request.
You can test by creating an php script with the following code:
<a href="?id=9&app=this">Link</a>
<?php echo "<br />\nID: {$_GET['id']}<br />\nAPP: {$_GET['app']}"; ?>
When you click the you will see the following:
Link
ID: 9
APP: this
There is nothing technically wrong with using the html entitiy in
place of & in a url.
--
Matt Martz
matt at sivel.net
More information about the wp-hackers
mailing list