It's not that obvious that urls rewriting could be fully hook based. Because when you consider SEO globally, you need to perform more than just url rewriting, reducing duplicate for example involves url buidling, checking and redirecting.
Also, when it comes to repeated task, hooks are not necessarily efficient. I have tested to use an append_sid hook (when it was first introduced) and the result where quite disappointing in terms of performances. The hook system was involving a lot of extra IF statement in the critical loop (where all the rewriting actually occurs) and this resulted in quite some performances loss, hence the comment in the append_sid function :
- Code: Select all
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
// We bypass the hook function here, the same effect as a standalone hook, which we want, but faster ;-)
global $phpbb_seo;
if (!empty($phpbb_seo->seo_opt['url_rewrite'])) {
return $phpbb_seo->url_rewrite($url, $params, $is_amp, $session_id);
} else
// www.phpBB-SEO.com SEO TOOLKIT END
Now talking about data collecting, hook may look like a better option, and the main two one we could think do already have an RFC (
forumrow hook RFC and
topicrow hook RFC), but again, I'm not sure that we'd necessarily go for it. I mean, it's of course nice to save a code change, but as you must know, proper url rewriting, and even more when talking about full SEO, both viewforum.php and viewtopic.php do need quite more code change than the one required for data (here we are speaking about titles and ids) collection, so it's likely that the
small gain in code manipulation would not be relevant, especially if we consider the fact that hooks will always be heavier to handle.
Hooks are way more interesting when it comes to task that are performed once per page load, like adding links in the header or adding some features such as a portal, but url rewriting stands too close to core operation, at least IMHO, for a hook method to be fully desirable.
Though, we will as well do some major improvement to our code for 3.1, all methods will be turned static so that we will not need any global again, and few other thing that should save even a bit more code upon install.
++