Created
April 30, 2011 16:32
-
-
Save chrismeller/949786 to your computer and use it in GitHub Desktop.
Problematic Rewrite Rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function filter_rewrite_rules ( $rules ) { | |
$rule = new RewriteRule( array( | |
'name' => 'cwm_display_archives', | |
'parse_regex' => '#^archives(?:/page/(?P<page>\d+))?/?$#i', | |
'build_str' => 'archives(/page/{$page})', | |
'handler' => 'UserThemeHandler', | |
'action' => 'display_archives', | |
'rule_class' => RewriteRule::RULE_THEME, | |
'is_active' => true, | |
'description' => 'Display custom archives' | |
) ); | |
$rules[] = $rule; | |
$rule = new RewriteRule( array( | |
'name' => 'cwm_display_flickr_thumbnail', | |
'parse_regex' => '#^flickr_thumbnail/(?P<guid>\w+)?/?$#i', | |
'build_str' => 'flickr_thumbnail/{$guid}', | |
'handler' => 'UserThemeHandler', | |
'action' => 'display_flickr_thumbnail', | |
'rule_class' => RewriteRule::RULE_THEME, | |
'is_active' => true, | |
'description' => 'Display Flickr thumbnail from local cache', | |
) ); | |
$rule = new RewriteRule( array( | |
'name' => 'cwm_display_header', | |
'parse_regex' => '#^header.json?/?$#i', | |
'build_str' => 'header.json', | |
'handler' => 'UserThemeHandler', | |
'action' => 'display_header', | |
'rule_class' => RewriteRule::RULE_THEME, | |
'is_active' => true, | |
'description' => 'Display header image', | |
) ); | |
$rules[] = $rule; | |
return $rules; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
insert into habari__rewrite_rules ( name, parse_regex, build_str, handler, action, priority, is_active, rule_class ) values ( 'display_flickr_thumbnail', '#^flickr/(?P<guid>\\w+)?/?$#i', 'flickr/{$guid}', 'UserThemeHandler', 'display_flickr_thumbnail', 1, 1, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment