-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCodebench.php
More file actions
executable file
·36 lines (31 loc) · 917 Bytes
/
Codebench.php
File metadata and controls
executable file
·36 lines (31 loc) · 917 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* Codebench — A benchmarking module.
*
* @package Kohana/Codebench
* @category Controllers
* @author Kohana Team
* @copyright (c) 2009 Kohana Team
* @license http://kohanaphp.com/license.html
*/
class Controller_Codebench extends Kohana_Controller_Template {
// The codebench view
public $template = 'codebench';
public function action_index()
{
$class = $this->request->param('class');
// Convert submitted class name to URI segment
if (isset($_POST['class']))
{
throw HTTP_Exception::factory(302)->location('codebench/'.trim($_POST['class']));
}
// Pass the class name on to the view
$this->template->class = (string) $class;
// Try to load the class, then run it
if (Kohana::auto_load($class) === TRUE)
{
$codebench = new $class;
$this->template->codebench = $codebench->run();
}
}
}