init.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. // Static file serving (CSS, JS, images)
  3. Route::set('docs/media', 'guide-media(/<file>)', ['file' => '.+'])
  4. ->defaults([
  5. 'controller' => 'Userguide',
  6. 'action' => 'media',
  7. 'file' => NULL,
  8. ]);
  9. // API Browser, if enabled
  10. if (Kohana::$config->load('userguide.api_browser') === TRUE)
  11. {
  12. Route::set('docs/api', 'guide-api(/<class>)', ['class' => '[a-zA-Z0-9_]+'])
  13. ->defaults([
  14. 'controller' => 'Userguide',
  15. 'action' => 'api',
  16. 'class' => NULL,
  17. ]);
  18. }
  19. // User guide pages, in modules
  20. Route::set('docs/guide', 'guide(/<module>(/<page>))', [
  21. 'page' => '.+',
  22. ])
  23. ->defaults([
  24. 'controller' => 'Userguide',
  25. 'action' => 'docs',
  26. 'module' => '',
  27. ]);
  28. // Simple autoloader used to encourage PHPUnit to behave itself.
  29. class Markdown_Autoloader {
  30. public static function autoload($class)
  31. {
  32. if ($class == 'Markdown_Parser' OR $class == 'MarkdownExtra_Parser')
  33. {
  34. include_once Kohana::find_file('vendor', 'markdown/markdown');
  35. }
  36. }
  37. }
  38. // Register the autoloader
  39. spl_autoload_register(['Markdown_Autoloader', 'autoload']);