Ejemplo n.º 1
0
 public static function getInstance($sContainer = null)
 {
     if (is_null(self::$factory)) {
         self::$factory = new self($sContainer);
     }
     return self::$factory;
 }
Ejemplo n.º 2
0
/**
 * Include Picowa Autoload
 */
if (!(include PICOWA_LIB_PATH . 'PreLoad.php')) {
    trigger_error("Picowa library could not be found " . PICOWA_LIB_PATH . 'PreLoad.php' . ".", E_USER_ERROR);
}
if (!(include PICOWA_LIB_PATH . 'AutoLoad.php')) {
    trigger_error("Picowa library could not be found " . PICOWA_LIB_PATH . 'AutoLoad.php' . ".", E_USER_ERROR);
}
/**
 * Environment Constants
 */
$oCfg = Pw_Component_Factory::set('Pw_Component_Builder')->build('Pw_Config', array('production' => array('server' => '', 'admin_email' => '', 'session_name' => 'picowa_session', 'cookie_lifetime' => 0, 'use_debug_mail' => 1, 'use_debug_log' => 1, 'use_error_handler' => 1, 'builder' => 'Pw_Component_Builder'), 'development' => array('server' => '127.0.0.1', 'admin_email' => '', 'session_name' => 'picowa_session', 'cookie_lifetime' => 0, 'use_debug_mail' => 0, 'use_debug_log' => 0, 'use_error_handler' => 0, 'builder' => 'Pw_Component_Builder')), 'picowa_config');
// define debug mode
if (!defined('PICOWA_DEBUG_MODE')) {
    $devServer = $oCfg->development('server');
    $prdServer = $oCfg->production('server');
    $debugMode = 0;
    if ($devServer !== '' && ($_SERVER['SERVER_ADDR'] === $devServer || $_SERVER['SERVER_NAME'] === $devServer)) {
        $debugMode = 1;
    } else {
        if ($prdServer !== '' && ($_SERVER['SERVER_ADDR'] === $prdServer || $_SERVER['SERVER_NAME'] === $prdServer)) {
            $debugMode = 0;
        }
    }
    define('PICOWA_DEBUG_MODE', $debugMode);
}
$configKey = PICOWA_DEBUG_MODE ? 'development' : 'production';
Pw_Component_Factory::set($oCfg->{$configKey}('builder'));
Pico::cfg(Pw_Component_Factory::get('Pw_Wrapper_Array', $oCfg->{$configKey}));
define('PICOWA_BOOTSTRAP', true);
Ejemplo n.º 3
0
 public function initPico($aComponents = array())
 {
     $this->factory = Pw_Component_Factory::getInstance();
     $this->initializeComponents($aComponents);
 }