[wp-hackers] wp_remote_request not telling me the 301'd URL

Edward de Leau e at leau.net
Fri Mar 11 21:06:55 UTC 2011


Thanks for the comments, need to do work on it :)

1)     .....  I DO prefix: see line 1: namespace leau\co\wp_favicons; (!)
  that is why namespaces have been created :)

  (makes it easy to create the plugins)

Many of the functionality blocks are dynamically namespaced :

              foreach ($all_plugins as $module_key => $module_value)
 {
foreach ($module_value as $plugin_key => $plugin_value)
{
 $class_name = 'leau\\co\\wp_favicons\\' .
$module_key . "_" . $plugin_key;

$this->pluginObjects[$n] = new $class_name;
$this->pluginObjects[$n]->Activate($module_key,$plugin_key);
 add_action(Config::GetPluginSlug() . $module_key .
'_plugins', array($this->pluginObjects[$n],
 'AddAdminOption'), 1, 10);
$n++;
}
 }

:)

2) extending the HTTP Class : i don't know yet where this plugin will lead
me in terms of functionality.
    my request-chain does not stop at a 200.


On Fri, Mar 11, 2011 at 9:29 PM, Otto <otto at ottodestruct.com> wrote:

> Two things:
>
> 1. Don't use "Http" as a class name. Seriously, prefix *everything*:
> http://andrewnacin.com/2010/05/11/in-wordpress-prefix-everything/
>
> 2. Why not just extend the WP_Http class instead to support what you
> want it to support? Seems like you went the super-long-way-around
> here.
>
> -Otto
>
>
>
> On Fri, Mar 11, 2011 at 2:09 PM, Edward de Leau <e at leau.net> wrote:
> > I have implemented manual redirection for the wp-favicons plugin here:
> >
> http://plugins.trac.wordpress.org/browser/wp-favicons/trunk/includes/class-http.php
> >
> > (part of next version 0.5.1 where a mouseover over a redirect/tiny url
> shows
> > the url it redirects to)
> > I redirect 5 times max.
> >
> > e.g. (1) nu.nl (301) ---> (2) www.nu.nl (200) --> (3)
> > www.nu.nl/images/favicon.ico (200)
> >
> > I needed the manual redirection because I needed the base_href when no
> > base_href is given in the HTML source.
> > I then need the redirected URI to use that as base_href
> >
> > Code is not completely done since a use case like:
> >
> > e.g. (1) newscred.com (301) --> (2) http://platform.newscred.com (200)
> (look
> > in page) --> (3) http://newscred.com/favicon.ico (301) (wtf? redirect of
> > content in page) -->
> > (4) http://newspapers.newscred.com/favicon.ico (200) --> (5)
> > http://newspapers.newscred.com//media/img/favicon.ico (200)
> >
> > does not work yet since this site gives 4 as redirect url while (4) is
> > actually a page. So i need to add another check for binary content in the
> > beginning.
> >
> > But for all none favicon self-redirection this should work.
> >
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list