0001-Added-userguide-auto-loader-to-create-stub-classes-f.patch

Kyle Treubig, 07/07/2010 10:34 am

Download (1.7 kB)

 
b/classes/kohana/kodoc.php
16 16
	}
17 17

  
18 18
	/**
19
	 * If this auto-loader is activated, it means that a class in the
20
	 * current application cannot be defined (eg, extends a class not
21
	 * present in the current application).  Creates an empty/stub class
22
	 * so that the API browser can continue to function.
23
	 *
24
	 * @param   string   class name
25
	 * @return  boolean
26
	 */
27
	public static function auto_load($class)
28
	{
29
		Kohana::$log->add(Kohana::DEBUG, 'Creating stub class '.$class);
30
		$definition = sprintf('class %s {}', $class);
31
		eval($definition);
32
		return TRUE;
33
	}
34

  
35
	/**
19 36
	 * Creates an html list of all classes sorted by category (or package if no category)
20 37
	 *
21 38
	 * @return   string   the html for the menu
b/init.php
17 17
			'action'     => 'api',
18 18
			'class'      => NULL,
19 19
		));
20

  
21
	if (Request::instance()->route == Route::get('docs/api'))
22
	{
23
		// Userguide API class autoloader
24
		spl_autoload_register(array('Kodoc', 'auto_load'));
25
	}
20 26
}
21 27

  
22 28
// Translated user guide
23
-