Skip to content

Instantly share code, notes, and snippets.

@chrismeller
Created April 30, 2011 16:32
Show Gist options
  • Save chrismeller/949786 to your computer and use it in GitHub Desktop.
Save chrismeller/949786 to your computer and use it in GitHub Desktop.
Problematic Rewrite Rules
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;
}
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