public function __construct($request) { $this->_router = Core_Application::getInstance()->getRouter(); $this->view = Core_Resource_View::getInstance(); $this->_request = $this->view->request = $request; $this->init(); }
public function loginBeforeContinue() { if (!s()->user->id) { Core_Application::getInstance()->breakDispacher(); $this->getView()->disableLayout(); r('/'); } }
public static function getInstance($environment = null, $options = null) { if (self::$_application == null) { self::$_application = new Core_Application(); include_once LIBRARY_PATH . '/Core/Loader.php'; // Registry auto loader spl_autoload_register(array(new Core_Loader($options), 'autoload')); self::$_application->_environment = $environment; self::$_application->_setOptions($options); self::$_application->_setExceptionHandler(); } return self::$_application; }
/** * @param array $options * @param boolean $merge * @throws Core_Application_Exception */ public static function setDefaultFrontendBackendOptions(array $options, $merge = false) { if (!$merge) { if (!isset($options['frontend'])) { require_once 'Core/Application/Exception.php'; throw new Core_Application_Exception("Está faltando a opção 'frontend' que é requerida."); } if (!isset($options['backend'])) { require_once 'Core/Application/Exception.php'; throw new Core_Application_Exception("Está faltando a opção 'backend' que é requerida."); } if (!isset($options['frontendOptions'])) { $options['frontendOptions'] = array(); } if (!isset($options['backendOptions'])) { $options['backendOptions'] = array(); } self::$_defaultFrontendBackendOptions = $options; } else { if (isset($options['frontend'])) { self::$_defaultFrontendBackendOptions['frontend'] = $options['frontend']; } if (isset($options['backend'])) { self::$_defaultFrontendBackendOptions['backend'] = $options['backend']; } if (isset($options['frontendOptions'])) { foreach ((array) $options['frontendOptions'] as $key => $option) { self::$_defaultFrontendBackendOptions['frontendOptions'][$key] = $option; } } if (isset($options['backendOptions'])) { foreach ((array) $options['backendOptions'] as $key => $option) { self::$_defaultFrontendBackendOptions['backendOptions'][$key] = $option; } } } }
<?php define('IS_DEBUG', 1); define('PUBLIC_PATH', dirname(__FILE__)); define('APPLICATION_PATH', dirname(PUBLIC_PATH)); require APPLICATION_PATH . '/Core/runtime.php'; Core_Application::run();
<?php include_once 'constant.php'; // Core_Application require_once LIBRARY_PATH . '/Core/Application.php'; set_include_path(LIBRARY_PATH); Core_Application::getInstance(APPLICATION_ENV, include_once APPLICATION_PATH . '/config/app.php')->run();
function Core_View_Helper_Url($routeName, $params = null) { return Core_Application::getInstance()->getRouter()->generate($routeName, $params); }
if (NULL !== $libPath) { if (!$libVersion) { $libVersion = 'latest'; } $autoloader->setZfPath($libPath, $libVersion); $lib = $autoloader->getZfPath(); } define('LIB_PATH', $lib); /** END::SGDOCE stuff * */ $main = \Robot\Main::getInstance(); try { register_shutdown_function(array($main, 'shutdown')); $main->argsManipulator(); /** BEGIN::SGDOCE stuff * */ require_once 'Core/Application.php'; // Create application, bootstrap, and run $application = new Core_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); $application->bootstrap(); /** END::SGDOCE stuff * */ $main->bootstrap()->run(); } catch (Exception $exception) { if ($main instanceof Robot\Main) { $main->setExpection($exception); exit(1); } if ($exception instanceof Zend_Console_Getopt_Exception) { exit($exception->getMessage() . PHP_EOL . $exception->getUsageMessage()); } exit($exception->getMessage()); } exit(0);
/** * @param null $reason * @param null $type */ function p404($reason = null, $type = null) { Core_Application::p404($reason, $type); }
<?php require_once 'Core/Application.php'; // Create application, bootstrap, and run $application = new Core_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); // initialize configs $options = $application->getOptions(); unset($options['config']); Zend_Registry::getInstance()->set('configs', $options);
$libPath = getenv('LIB_PATH') ? getenv('LIB_PATH') : NULL; $libVersion = getenv('LIB_VERSION') ? getenv('LIB_VERSION') : NULL; require_once 'Zend/Loader/Autoloader.php'; $autoloader = Zend_Loader_Autoloader::getInstance(); $lib = APPLICATION_PATH . '/../library'; if (NULL !== $libPath) { if (!$libVersion) { $libVersion = 'latest'; } $autoloader->setZfPath($libPath, $libVersion); $lib = $autoloader->getZfPath(); } define('LIB_PATH', $lib); require_once 'Core/Application.php'; // Create application, bootstrap, and run $application = new Core_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); $application->bootstrap()->run(); function dump($obj, $exit = TRUE, $outputRaw = TRUE) { $trace = array(); $backtrace = debug_backtrace(); $totalCall = sizeof($backtrace); for ($i = 0; $i < $totalCall; $i++) { if (!$i) { $trace[$i] = ' +'; } elseif ($i + 1 == $totalCall) { $trace[$i] = ' \\'; } else { $trace[$i] = ' |'; } $trace[$i] .= str_repeat('-', $totalCall - $i);