/** * It is routed as CLOVER_ROOT/CloverInfoTest * It displays request information */ function index() { $assignment = array('title' => 'INDEX', 'get' => Clover::getQuery(), 'post' => Clover::getData(), 'request' => Clover::getRequest(), 'server' => Clover::getServer(), 'controller_index' => Clover::getControllerIndex(), 'controller' => Clover::getController()); Clover::display('CloverInfoTest.htm', $assignment); }
public static function getController(&$sub_paths = array()) { global $argv; global $argc; $controller_name = ''; if (Clover::is_cli()) { $sub_paths = array(); for ($i = 1; $i < $argc; $i++) { if ($i == 1) { $controller_name = $argv[$i]; } else { $sub_paths[] = $argv[$i]; } } } else { $controllerIndex = Clover::getControllerIndex(); $pattern = '/^\\/([^\\?]*)(\\?|$)/'; $r = preg_match($pattern, $controllerIndex, $matches); $controller_array = explode('/', $matches[1]); if (count($controller_array) > 0) { $controller_name = $controller_array[0]; if (count($controller_array) > 1) { unset($controller_array[0]); $sub_paths = array_values($controller_array); } } } return $controller_name; }