2010-08-21 04:43:03 +00:00
|
|
|
<?php defined('SYSPATH') or die('No direct script access.');
|
|
|
|
|
|
|
|
// Static file serving (CSS, JS, images)
|
2012-11-09 12:18:50 +00:00
|
|
|
Route::set('docs/media', 'guide-media(/<file>)', array('file' => '.+'))
|
2010-08-21 04:43:03 +00:00
|
|
|
->defaults(array(
|
2012-11-09 12:18:50 +00:00
|
|
|
'controller' => 'Userguide',
|
2010-08-21 04:43:03 +00:00
|
|
|
'action' => 'media',
|
|
|
|
'file' => NULL,
|
|
|
|
));
|
|
|
|
|
2011-05-13 06:00:25 +00:00
|
|
|
// API Browser, if enabled
|
2012-11-09 12:18:50 +00:00
|
|
|
if (Kohana::$config->load('userguide.api_browser') === TRUE)
|
2010-08-21 04:43:03 +00:00
|
|
|
{
|
2012-11-09 12:18:50 +00:00
|
|
|
Route::set('docs/api', 'guide-api(/<class>)', array('class' => '[a-zA-Z0-9_]+'))
|
2010-08-21 04:43:03 +00:00
|
|
|
->defaults(array(
|
2012-11-09 12:18:50 +00:00
|
|
|
'controller' => 'Userguide',
|
2010-08-21 04:43:03 +00:00
|
|
|
'action' => 'api',
|
|
|
|
'class' => NULL,
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
2011-05-13 06:00:25 +00:00
|
|
|
// User guide pages, in modules
|
|
|
|
Route::set('docs/guide', 'guide(/<module>(/<page>))', array(
|
2010-08-21 04:43:03 +00:00
|
|
|
'page' => '.+',
|
|
|
|
))
|
|
|
|
->defaults(array(
|
2012-11-09 12:18:50 +00:00
|
|
|
'controller' => 'Userguide',
|
2010-08-21 04:43:03 +00:00
|
|
|
'action' => 'docs',
|
2011-05-13 06:00:25 +00:00
|
|
|
'module' => '',
|
2012-11-09 12:18:50 +00:00
|
|
|
));
|
|
|
|
|
|
|
|
// Simple autoloader used to encourage PHPUnit to behave itself.
|
|
|
|
class Markdown_Autoloader {
|
|
|
|
public static function autoload($class)
|
|
|
|
{
|
|
|
|
if ($class == 'Markdown_Parser' OR $class == 'MarkdownExtra_Parser')
|
|
|
|
{
|
|
|
|
include_once Kohana::find_file('vendor', 'markdown/markdown');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Register the autoloader
|
|
|
|
spl_autoload_register(array('Markdown_Autoloader', 'autoload'));
|