Esempio n. 1
0
 protected function __construct(Miao_Office_DataHelper_Url $dhUrl, $dstFolder)
 {
     $this->_dataHelperUrl = $dhUrl;
     $this->_dstFolder = $dstFolder;
     $this->_buildTimestamp = Miao_Config::Main()->get('timestamp');
     $this->_init();
 }
Esempio n. 2
0
 public function __construct()
 {
     $config = Miao_Config::Libs(__CLASS__);
     $this->_host = $config->get('host');
     $this->_port = $config->get('port');
     $this->init();
 }
Esempio n. 3
0
 public function getList()
 {
     $result = array();
     $libsDir = Miao_Config::Main()->get('paths.libs');
     $list = $this->_rglob('*Office/classes', GLOB_ONLYDIR, $libsDir);
     foreach ($list as $key => $value) {
         if (false !== strpos($value, 'tests/sources')) {
             unset($list[$key]);
         }
         if (false !== strpos($value, 'miao/')) {
             unset($list[$key]);
         }
     }
     $classesList = array();
     foreach ($list as $path) {
         $tmp = $this->_rglob('*', 0, $path);
         foreach ($tmp as $item) {
             $isControl = false !== strpos($item, '/View/') || false !== strpos($item, '/ViewBlock/') || false !== strpos($item, '/Action/');
             if (is_file($item) && $isControl) {
                 $className = $this->_extractClassName($item);
                 $classesList[] = $className;
             }
         }
     }
     $result = array_unique($classesList);
     return $result;
 }
Esempio n. 4
0
 public static function get($className, $paramSection = '__construct')
 {
     $configObj = Miao_Config::Libs($className);
     $params = $configObj->get($paramSection);
     $rc = new ReflectionClass($className);
     $result = $rc->newInstanceArgs($params);
     return $result;
 }
Esempio n. 5
0
 public function getLog()
 {
     if (empty($this->_log)) {
         $logFilename = Miao_Config::Main()->get('paths.logs') . '/pdo_log';
         $this->_log = Miao_Log::easyFactory($logFilename);
     }
     return $this->_log;
 }
Esempio n. 6
0
 public static function defaultRegister()
 {
     $configDefault = array('error_level' => '30711', 'default_timezone' => 'Europe/Moscow', 'unregister_globals' => '1', 'strip_global_slashes' => '1', 'umask' => '0', 'upload_tmp_dir' => '/tmp');
     if (Miao_Config::checkConfig(__CLASS__)) {
         $config = Miao_Config::Libs(__CLASS__);
     } else {
         $config = new Miao_Config_Base($configDefault);
     }
     $initialazer = new Miao_Env_Initializer($config);
     $initialazer->run();
 }
Esempio n. 7
0
 protected function _makeLinks(array $fileList)
 {
     $result = array();
     $search = $this->_dstFolder . DIRECTORY_SEPARATOR;
     $replace = '';
     foreach ($fileList as $value) {
         $query = 't=' . Miao_Config::Main()->get('timestamp');
         $result[] = $this->_dataHelperUrl->src(str_replace($search, $replace, $value), $query);
     }
     return $result;
 }
Esempio n. 8
0
 /**
  *
  * @return Miao_Session_Handler
  */
 public static function factory()
 {
     $className = 'none';
     if (Miao_Config::checkConfig(__CLASS__)) {
         $config = Miao_Config::Libs(__CLASS__, false);
         $className = $config->get('type', $className);
     }
     $className = 'Miao_Session_Handler_' . ucfirst($className);
     $result = new $className();
     return $result;
 }
Esempio n. 9
0
 public function testHandler()
 {
     $session = Miao_Session::getInstance();
     $sessionNamespace = Miao_Session::getNamespace('Test');
     $sessionNamespace->habr = 'habr';
     $this->assertTrue(!empty($_SESSION));
     $handlerClassNameActual = get_class($session->getHandler());
     $config = Miao_Config::Libs('Miao_Session');
     $handlerConfig = $config->get('Handler');
     $handlerClassNameExpected = 'Miao_Session_Handler_' . key($handlerConfig);
     $this->assertEquals($handlerClassNameExpected, $handlerClassNameActual);
 }
Esempio n. 10
0
 public static function defaultRegister()
 {
     $configDefault = array('error_level' => '30711', 'default_timezone' => 'Europe/Moscow', 'unregister_globals' => '1', 'strip_global_slashes' => '1', 'umask' => '0', 'upload_tmp_dir' => '/tmp');
     $config = Miao_Config::Libs(__CLASS__, false);
     if ($config) {
         $config = Miao_Config::Libs(__CLASS__);
     } else {
         $config = new Miao_Config_Base($configDefault);
     }
     $result = self::_run($config);
     return $result;
 }
Esempio n. 11
0
 public function __construct(array $config = array())
 {
     $this->_initDefault();
     if (empty($config)) {
         $config = Miao_Config::Libs(__CLASS__);
         $config = $config->toArray();
     }
     if (!empty($config)) {
         foreach ($config as $property => $value) {
             if (property_exists($this, $property)) {
                 //TODO: needs setter function and check
                 $this->{$property} = $value;
             }
         }
     }
     $this->_initFonts();
 }
Esempio n. 12
0
 /**
  *
  * @param $options array
  * @param $handler unknown_type
  * @return Miao_Session
  */
 public static function getInstance(array $options = array(), $handler = null)
 {
     if (is_null(self::$_instance)) {
         if (empty($options)) {
             $config = Miao_Config::Libs('Miao_Session');
             $options = $config->get('options', false);
             if (!$options) {
                 $options = array();
             }
         }
         if (is_null($handler)) {
             $config = Miao_Config::Libs('Miao_Session');
             $handlerConfig = $config->get('Handler', false);
             if (empty($handlerConfig)) {
                 $handler = new Miao_Session_Handler_None();
             } else {
                 $handlerClassName = 'Miao_Session_Handler_' . key($handlerConfig);
                 $handler = Miao_Config_Instance::get($handlerClassName);
             }
         }
         self::$_instance = new self($options, $handler);
     }
     return self::$_instance;
 }
Esempio n. 13
0
 public static function getTempPath()
 {
     $result = Miao_Config::Main()->get('/build/paths/tmp');
     return $result;
 }
Esempio n. 14
0
 public function testLibs()
 {
     $config = Miao_Config::Libs('Miao');
     $this->assertInstanceOf('Miao_Config_Base', $config);
     $this->assertTrue(is_array($config->get('deploy')));
 }
Esempio n. 15
0
 /**
  * Includes template with given filename, relative from DocumentRoot
  * directory,
  * and returns parsed content.
  * MUST be used inside templates in protected scope of TemplatesEngine
  * class.
  *
  * @param string $relativePath
  * @return string
  */
 protected function _ssiVirtualInternal($relativePath)
 {
     $project_root = Miao_Config::Main()->get('paths.shared');
     $absolutePath = $project_root . $relativePath;
     return $this->_returnParsedTemplate($absolutePath);
 }
Esempio n. 16
0
 /**
  * Soft apply config param
  * @param bool $debugMode
  */
 protected function _initByConfig($debugMode)
 {
     $cDebugMode = null;
     $cLogFilename = "";
     $config = Miao_Config::Libs(__CLASS__, false);
     if ($config) {
         $cDebugMode = $config->get('debug', null);
         $cLogFilename = $config->get('logFilename', "");
     }
     $debugMode = is_null($debugMode) ? is_null($cDebugMode) ? false : $cDebugMode : $debugMode;
     $this->setDebugMode($debugMode);
     $this->_logFilename = empty($this->_logFilename) ? $cLogFilename : $this->_logFilename;
 }
Esempio n. 17
0
 public function getDefaultConfig()
 {
     $dir = dirname(__FILE__);
     $dir = Miao_Config::Main()->get('paths.shared') . '/acs';
     $dbFilename = $dir . '/db.sqlite';
     $logFilename = Miao_Config::Main()->get('paths.logs') . '/acs_log';
     $result = array('adapterClassName' => 'Miaox_Acs_Adapter_Db', 'log' => array('enabled' => true, 'filename' => $logFilename, 'verbose' => false), 'pdo' => array('dsn' => 'sqlite:' . $dbFilename, 'username' => '', 'password' => '', 'options' => array()));
     return $result;
 }