Esempio n. 1
0
 public static function getInstance($sContainer = null)
 {
     if (is_null(self::$factory)) {
         self::$factory = new self($sContainer);
     }
     return self::$factory;
 }
Esempio n. 2
0
    define('PICOWA_MOUNT_POINT', substr($reqUrl, 0, -strlen($url) - 1));
    define('PICOWA_REQUEST_URL', '/' . $url);
}
/**
 * Include Picowa Autoload
 */
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 = PwComponentFactory::set('PwComponentBuilder')->build('PwConfig', 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' => 'PwComponentBuilder'), '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' => 'PwComponentBuilder')), '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';
PwComponentFactory::set($oCfg->{$configKey}('builder'));
Pico::cfg(PwComponentFactory::get('PwArrayWrapper', $oCfg->{$configKey}));
Esempio n. 3
0
File: Pico.php Progetto: no22/Picowa
 public function initPico()
 {
     $this->factory = PwComponentFactory::getInstance();
     $this->initializeComponents();
 }