Exemplo n.º 1
0
 /**
  * 构造函数
  */
 public function __construct($re)
 {
     if (!is_file(Wind::getRealPath('DATA:install.lock', true))) {
         Wind::getComponent('response')->sendRedirect("install.php");
     }
     parent::__construct($re);
     //云应用监听sql执行
     WindFactory::_getInstance()->loadClassDefinitions(array('sqlStatement' => array('proxy' => 'WIND:filter.proxy.WindEnhancedClassProxy', 'listeners' => array('LIB:compile.acloud.PwAcloudDbListener'))));
     $this->charset = Wind::getComponent('response')->getCharset();
 }
Exemplo n.º 2
0
 public function onCreate()
 {
     if (in_array(Wind::getAppName(), array('phpwind', 'pwadmin'))) {
         //云应用监听sql执行
         WindFactory::_getInstance()->loadClassDefinitions(array('sqlStatement' => array('proxy' => 'WIND:filter.proxy.WindEnhancedClassProxy', 'listeners' => array('LIB:compile.acloud.PwAcloudDbListener'))));
     }
     if (!is_file(Wind::getRealPath('DATA:install.lock', true))) {
         Wind::getApp()->getResponse()->sendRedirect("install.php");
     }
     Wekit::createapp(Wind::getAppName());
     $_debug = Wekit::C('site', 'debug');
     if ($_debug == !Wind::$isDebug) {
         Wind::$isDebug = $_debug;
     }
     if ('phpwind' == Wind::getAppName()) {
         error_reporting($_debug ? E_ALL ^ E_NOTICE ^ E_DEPRECATED : E_ERROR | E_PARSE);
         set_error_handler(array($this->front, '_errorHandle'), error_reporting());
     }
     $this->_convertCharsetForAjax();
     if ($components = Wekit::C('components')) {
         Wind::getApp()->getFactory()->loadClassDefinitions($components);
     }
 }
 /**
  * 创建并执行当前应用,单应用访问入口
  */
 public function run()
 {
     $this->_app = $this->createApplication($this->_config['web-apps'][$this->_appName], WindFactory::_getInstance());
     set_error_handler(array($this, '_errorHandle'), error_reporting());
     set_exception_handler(array($this, '_exceptionHandle'));
     if ($this->_config['isclosed']) {
         throw new Exception('Sorry, Site has been closed!');
     }
     if ($this->_chain !== null) {
         $this->_chain->getHandler()->handle('onCreate');
     }
     /* @var $router WindRouter */
     $router = $this->_app->getFactory()->getInstance('router');
     $router->route($this->_app->getRequest());
     if ($this->_chain !== null) {
         $this->_chain->getHandler()->handle('onStart');
     }
     $this->_app->run($router);
     if ($this->_chain !== null) {
         $this->_chain->getHandler()->handle('onResponse');
     }
     $this->_app->getResponse()->sendResponse();
     $this->_app->getFactory()->executeDestroyMethod();
     restore_error_handler();
     restore_exception_handler();
 }
Exemplo n.º 4
0
 public function __construct($re)
 {
     parent::__construct($re);
     //云应用监听sql执行
     WindFactory::_getInstance()->loadClassDefinitions(array('sqlStatement' => array('proxy' => 'WIND:filter.proxy.WindEnhancedClassProxy', 'listeners' => array('LIB:compile.acloud.PwAcloudDbListener'))));
 }
Exemplo n.º 5
0
 /**
  * 注册系统组建
  * <code>
  * 对象方式注册:
  * $converter = new WindGeneralConverter();
  * Wind::registeComponent($converter,'windConverter',singleton);
  * 定义方式注册:
  * Wind::registeComponent(array('path' =>
  * 'WIND:convert.WindGeneralConverter', 'scope' => 'singleton'),
  * 'windConverter');</code>
  * 
  * @param object|array $componentInstance        
  * @param string $componentName        
  * @param string $scope        
  * @return boolean
  */
 public static function registeComponent($componentInstance, $componentName, $scope = 'application')
 {
     if (is_array($componentInstance)) {
         isset($componentInstance['scope']) || ($componentInstance['scope'] = $scope);
         WindFactory::_getInstance()->loadClassDefinitions(array($componentName => $componentInstance));
     } elseif (is_object($componentInstance)) {
         WindFactory::_getInstance()->registInstance($componentInstance, $componentName, $scope);
     } else {
         throw new WindException('[Wind.registeComponent] registe component fail, array or object is required', WindException::ERROR_PARAMETER_TYPE_ERROR);
     }
 }