/** * 运行HD框架产品 */ public static function run() { if (self::$is_run) { return; } self::$is_run = true; self::$compile = defined("COMPILE") ? COMPILE : true; self::Definition(); //配置系统常量 self::$boot = PATH_TEMP . '/boot.php'; //核心编译文件 if (self::$compile && is_file(self::$boot)) { require self::$boot; //如果编译文件存在加载核心编译文件boot.php application::run(); //运行应用目录下的项目 return; } self::compileCoreFile(); //编译生成核心文件boot.php application::run(); //运行应用目录下的项目 }
} elseif (file_exists(DIR_TEMPLATES . $fake_doc . ".html")) { $app->action = $fake_doc; } else { //$tmp1=SQLSelectOne("SELECT ID FROM cms_docs WHERE NAME='404'"); $tmp1 = array(); if ($tmp1['ID']) { $app->action = "docs"; $app->doc = $tmp1['ID']; } else { header("HTTP/1.0 404 Not Found"); echo "The page cannot be found. Please use <a href='/'>this link</a> to continue browsing."; exit; } } } $result = $app->run(); $result = str_replace("nf.php", "index.php", $result); } else { // show cached result $result = $cached_result; } // BEGIN: begincut endcut placecut if (preg_match_all('/<!-- placecut (\\w+?) -->/is', $result, $matches)) { for ($i = 0; $i < count($matches[1]); $i++) { $block = $matches[1][$i]; if (preg_match('/<!-- begincut ' . $block . ' -->(.*?)<!-- endcut ' . $block . ' -->/is', $result, $matches2)) { $result = str_replace($matches[0][$i], $matches2[1], $result); $result = str_replace($matches2[0], '', $result); } } }
<?php defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application')); // Define application environment defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'); // Ensure library/ is on include_path set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . '/../library'), get_include_path()))); require_once 'application.php'; $application = new application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); $application->run();
// benchmark $benchmark = microtime(true); // parameters $type = $argv[1]; $mode = $argv[2]; chdir('public_html'); // autoloading composer first if (file_exists('../libraries/vendor/autoload.php')) { require '../libraries/vendor/autoload.php'; } // automatic class loading require '../libraries/vendor/numbers/framework/application.php'; spl_autoload_register(array('application', 'autoloader')); // running application application::run(['__run_only_bootstrap' => 1]); // increase in memory and unlimited execution time ini_set('memory_limit', '2048M'); set_time_limit(0); // wrapping everything into try-catch block for system exceptions try { // running proper class switch ($type) { case 'deploy': $result = system_deployments::deploy(['mode' => $mode]); break; case 'schema': $result = system_dependencies::process_models(['mode' => $mode]); // we need to reset all caches if ($mode == 'commit') { $cache = factory::get(['cache']);
public static function run($applicationClass) { application::run($applicationClass); }
<?php define('IN_ADMIN', true); define('ROOT_PATH', dirname($_SERVER['SCRIPT_FILENAME']) . '/'); $basename = basename($_SERVER['SCRIPT_FILENAME']); $basename = explode('.', $basename); define('CURSCRIPT', reset($basename)); include ROOT_PATH . 'inc/class/application.class.php'; application::init(); application::run();