[wp-hackers] Improving rewrite flexibility

Jamie Talbot wphackers at jamietalbot.com
Fri Jan 13 02:20:24 GMT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jamie Talbot wrote:

Small alteration to what I wrote - you wouldn't need any reference to
%language% in core code, obviously.

>Maybe instead of:
>
>$date_rewrite =
>$this->generate_rewrite_rules($this->get_date_permastruct());
>$date_rewrite = apply_filters('date_rewrite_rules', $date_rewrite);

>We could have:

$number_of_tokens = preg_match_all('/%.+?%/',
$this->get_date_permastruct(), $tokens);
$tokens = $tokens[0];
$date_rewrite = array();
while ($number_of_tokens--)
{
$permalink_structure = '/';
for ($i = 0; $i <= $number_of_tokens; $i++) $permalink_structure .=
$tokens[$i] . '/';
$date_rewrite += $this->generate_rewrite_rules($permalink_structure,
true, true, false, false);
}
$date_rewrite = apply_filters('date_rewrite_rules', $date_rewrite);

Jamie.

- --
http://jamietalbot.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDxw5orovxfShShFARAjevAJ92yPSX02W709qB8TpxDu8sShcW/QCdG+Zs
EpcvTXCsqCdZ9kvlWSSTeps=
=rGyk
-----END PGP SIGNATURE-----


More information about the wp-hackers mailing list