function ark_event() { call_user_func_array(array(Ark::app()->event, 'attach'), func_get_args()); }
<?php require dirname(__FILE__) . '/../../src/ark.php'; $env = $_SERVER['REMOTE_ADDR'] === '127.0.0.1' ? 'dev' : 'prod'; $debug = $_SERVER['REMOTE_ADDR'] === '127.0.0.1'; Ark::createWebApp(dirname(__FILE__) . '/app', $env, $debug)->run();
/** * {@inheritdoc} */ public function run() { $q = _ark_parse_query_path($this->config->get('route.route_var', 'r')); $q['https'] = $this->request->isSecure(); $q['method'] = $this->request->getMethod(); //Request method validation if (!in_array($q['method'], array('GET', 'POST', 'PUT', 'DELETE', 'HEAD', 'OPTIONS'))) { $response = Ark::getHttpErrorResponse(405); $this->respond($resonse); } else { $this->dispatchResponseEvent('app.dispatch', $this, $q); } }
public function __construct() { $this->request = Ark::app()->getRequest(); $this->init(); }
foreach (self::$dirs as $dir => $hasChild) { if ($hasChild) { $file = $dir . '/' . $name_path . '.php'; } else { $file = $dir . '/' . $name . '.php'; } if (file_exists($file)) { require $file; return true; } } return false; } public static function registerPrefix($prefix, $path) { self::$prefixes[$prefix] = $path; } public static function loadPrefix($name) { foreach (self::$prefixes as $prefix => $path) { $prefix_length = strlen($prefix); if (substr($name, 0, $prefix_length + 1) === $prefix . '_') { $file = $path . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $name) . '.php'; require $file; return true; } } } } Ark::autoloadFramework();