public static function dispatch() { // Include the routes require CONFIG_PATH . 'routes.php'; // Grab the controller/action stack for request $request = self::request(); try { // Make an instance of the controller's class $class = new ReflectionClass(camel_case($request['controller'])); $controller = $class->newInstance(); // Try and include the global helper file require_if_exists(APPLICATION_PATH . 'helpers/global.php'); // Require the helper files for the controller $helpers = explode('>', $request['controller']); $helper_string = ''; foreach ($helpers as $helper) { $helper_string .= "/{$helper}"; $helper_file = HELPERS_PATH . $helper_string . '.php'; require_if_exists($helper_file); } // Execute the action $method = $class->getMethod($request['action']); $result = $method->invokeArgs($controller, $request['arguments']); } catch (ReflectionException $e) { // ob_end_clean(); die('<pre>' . $e . '</pre>'); } }
public static function analyzable($path){ $type = self::getType($path); $analyzerName = "{$type}Analyzer"; if(!$type) return false; require_once "Library/Analyzers/Analyzer.php"; return require_if_exists("Library/Analyzers/$analyzerName.php"); }
<?php function require_if_exists($str) { $file = dirname(__FILE__) . $str; if (file_exists($file)) { require_once $file; } } //https://51degrees.com/support/documentation/php require_if_exists('/51Degrees/core/51Degrees.php'); //http://raveren.github.io/kint/ require_if_exists('/kint/Kint.class.php'); //http://popeen.com/docs/PHPMailer/ require_if_exists('/PHPMailer/PHPMailerAutoload.php'); //https://github.com/php-curl-class/php-curl-class/tree/master/examples require_if_exists('/php-curl-class/src/Curl/CaseInsensitiveArray.php'); require_if_exists('/php-curl-class/src/Curl/Curl.php'); require_if_exists('/php-curl-class/src/Curl/MultiCurl.php'); //http://popeen.com/docs/Kakadua%20PHP%20Snippets/ require_if_exists('/PHP-Snippets/include_functions.php');
public static function module($name) { $path = MODULES_PATH . $name; self::$paths[] = $path; require_if_exists($path . '/init.php'); }