예제 #1
0
파일: Base.php 프로젝트: heavenshell/gene
 /**
  * Setup application
  *
  * @param  mixed $appPath Path to application root
  * @param  array $options Options to setup application
  * @access public
  * @return Zend_Application Application
  */
 public static function app($appPath, array $options = array())
 {
     defined('GENE_APP_PATH') || define('GENE_APP_PATH', $appPath);
     defined('GENE_LIB_PATH') || define('GENE_LIB_PATH', dirname(__FILE__));
     self::$_appPath = GENE_APP_PATH;
     if (!isset($options['ini'])) {
         $options['ini'] = rtrim(GENE_APP_PATH, '\\/') . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.ini';
     }
     if (!isset($options['env'])) {
         $options['env'] = 'production';
     }
     self::$_env = $options['env'];
     require_once 'Zend/Application.php';
     $app = new Zend_Application($options['env'], $options['ini']);
     $autoloader = $app->getAutoloader();
     $autoloader->setFallbackAutoloader(true)->suppressNotFoundWarnings(false);
     $app->getBootstrap()->setAppPath($appPath);
     if (isset($options['config'])) {
         $app->setConfigPath($options['config']);
     }
     $resources = null;
     if (isset($options['resources'])) {
         $resources = $options['resources'];
     }
     $bootstrap = $app->getBootstrap()->bootstrap($resources);
     $params = $bootstrap->getParams();
     self::$_params = $params;
     return $app;
 }
예제 #2
0
 public function testPassingZfVersionAutoloaderInformationConfiguresAutoloader()
 {
     if (!constant('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_ENABLED')) {
         $this->markTestSkipped();
     }
     if (!constant('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_LATEST')) {
         $this->markTestSkipped();
     }
     $path = constant('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_PATH');
     $latest = constant('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_LATEST');
     $application = new Zend_Application('production', array('autoloaderZfPath' => $path, 'autoloaderZfVersion' => 'latest'));
     $autoloader = $application->getAutoloader();
     $actual = $autoloader->getZfPath();
     $this->assertContains($latest, $actual);
 }
예제 #3
0
파일: initenv.php 프로젝트: niieani/nandu
// We load main application configuration file, all sections (null) and we allow to further modify configuration values (true)
try {
	$config = new Zend_Config_Ini(APPLICATION_PATH . DS . 'configs' . DS . 'application.ini', null, true);
	$config->merge(new Zend_Config_Ini(APPLICATION_PATH . DS . 'configs' . DS . 'routing.ini'));
	if (is_file(APPLICATION_PATH . DS . 'configs' . DS . 'custom.ini')) {
		$config->merge(new Zend_Config_Ini(APPLICATION_PATH . DS . 'configs' . DS . 'custom.ini'));
	}
} catch (Zend_Config_Exception $e) {
	if (PHP_SAPI !== 'cli') header('Content-Type: text/plain; charset=UTF-8');
	exit('The application was unable to read one of the main configuration file (application.ini or routing.ini). It makes me a sad panda as well.' . PHP_EOL);
}

try {
	// Instantiate the application, bootstrap, and run
	$application = new Zend_Application(APPLICATION_ENV, $config->{APPLICATION_ENV});

	$autoloader = $application->getAutoloader();

	// We want the autoloader to load any namespace
	$autoloader->setFallbackAutoloader(false);
	// We want to be informed about missing classes in a clear way
	// There's a conflict with Doctrine trying to load non-existing (created at run-time) classes
	$autoloader->suppressNotFoundWarnings(true);

// Catch any uncaught exceptions
} catch (Exception $e) {
	if (PHP_SAPI !== 'cli') header('Content-Type: text/plain; charset=UTF-8');
	exit('Application error: ' . $e->getMessage() . PHP_EOL . $e->getTraceAsString() . PHP_EOL);
}
예제 #4
0
파일: index.php 프로젝트: hoaitn/bmw-site
<?php

require realpath('../application') . '/config.php';
/** Zend_Application */
require_once 'Zend/Application.php';
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . 'configs/application.ini');
Zend_Session::start();
/**
 * Thiết lập không hiển thị lỗi nếu là phiên bản production
 *
 */
if ('production' !== APPLICATION_ENV) {
    $application->getAutoloader()->suppressNotFoundWarnings(false);
}
$application->bootstrap()->run();
예제 #5
0
 * with loading,  using,  modifying and/or developing or reproducing the
 * software by the user in light of its specific status of free software,
 * that may mean  that it is complicated to manipulate,  and  that  also
 * therefore means  that it is reserved for developers  and  experienced
 * professionals having in-depth computer knowledge. Users are therefore
 * encouraged to load and test the software's suitability as regards their
 * requirements in conditions enabling the security of their systems and/or
 * data to be ensured and,  more generally, to use and operate it in the
 * same conditions as regards security.
 *
 * The fact that you are presently reading this means that you have had
 * knowledge of the CeCILL-C license and that you accept its terms.
 *
 * @author Copyright (c) PadCMS (http://www.padcms.net)
 * @version $DOXY_VERSION
 */
// Define path to application directory
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'application'));
//Define path to the public directory
define('SITE_PATH', realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'front'));
// Define application environment
define('APPLICATION_ENV', 'test');
define('APPLICATION_PREFIX', 'cli');
// Ensure include/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . DIRECTORY_SEPARATOR . 'include'), get_include_path())));
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$oApplication = new Zend_Application(APPLICATION_PREFIX . '_' . APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
$oApplication->getAutoloader()->setFallbackAutoloader(true);
$oApplication->bootstrap();