A_NextGen_Basic_Album_Routes

Class A_NextGen_Basic_Album_Routes.

Defined (1)

The class is defined in the following location(s).

/products/photocrati_nextgen/modules/nextgen_basic_album/package.module.nextgen_basic_album.php  
  1. class A_NextGen_Basic_Album_Routes extends Mixin 
  2. public function render($displayed_gallery, $return = FALSE, $mode = NULL) 
  3. $do_rewrites = FALSE; 
  4. $app = NULL; 
  5. // Get display types 
  6. $original_display_type = isset($displayed_gallery->display_settings['original_display_type']) ? $displayed_gallery->display_settings['original_display_type'] : ''; 
  7. $display_type = $displayed_gallery->display_type; 
  8. // If we're viewing an album, rewrite the urls 
  9. $regex = '/photocrati-nextgen_basic_\\w+_album/'; 
  10. if (preg_match($regex, $display_type)) { 
  11. $do_rewrites = TRUE; 
  12. // Get router 
  13. $router = C_Router::get_instance(); 
  14. $app = $router->get_routed_app(); 
  15. $slug = '/' . C_NextGen_Settings::get_instance()->router_param_slug; 
  16. $app->rewrite("{*}{$slug}/page/{\\d}{*}", "{1}{$slug}/nggpage--{2}{3}", FALSE, TRUE); 
  17. $app->rewrite("{*}{$slug}/pid--{*}", "{1}{$slug}/pid--{2}", FALSE, TRUE); 
  18. // avoid conflicts with imagebrowser 
  19. $app->rewrite("{*}{$slug}/{\\w}/{\\w}/{\\w}{*}", "{1}{$slug}/album--{2}/gallery--{3}/{4}{5}", FALSE, TRUE); 
  20. $app->rewrite("{*}{$slug}/{\\w}/{\\w}", "{1}{$slug}/album--{2}/gallery--{3}", FALSE, TRUE); 
  21. } elseif (preg_match($regex, $original_display_type)) { 
  22. $do_rewrites = TRUE; 
  23. // Get router 
  24. $router = C_Router::get_instance(); 
  25. $app = $router->get_routed_app(); 
  26. $slug = '/' . C_NextGen_Settings::get_instance()->router_param_slug; 
  27. $app->rewrite("{*}{$slug}/album--{\\w}", "{1}{$slug}/{2}"); 
  28. $app->rewrite("{*}{$slug}/album--{\\w}/gallery--{\\w}", "{1}{$slug}/{2}/{3}"); 
  29. $app->rewrite("{*}{$slug}/album--{\\w}/gallery--{\\w}/{*}", "{1}{$slug}/{2}/{3}/{4}"); 
  30. // Perform rewrites 
  31. if ($do_rewrites && $app) { 
  32. $app->do_rewrites(); 
  33. return $this->call_parent('render', $displayed_gallery, $return, $mode);