コード例 #1
0
ファイル: Class.php プロジェクト: OPL/Open-Power-Template
 /**
  * Performs the main initialization of OPT. If the optional argument `$config` is
  * specified, it is transparently sent to Opt_Class::loadConfig(). Before using this
  * method, we are obligated to configure the library and load the necessary extensions.
  *
  * @param mixed $config = null The optional configuration to be loaded
  */
 public function setup($config = null)
 {
     if (is_array($config)) {
         $this->loadConfig($config);
     }
     if ($this->pluginDir !== null) {
         $this->loadPlugins();
     }
     if ($this->cdfDir === null) {
         $this->cdfDir = $this->sourceDir;
     }
     if (Opl_Registry::exists('opl_translate')) {
         $this->setTranslationInterface(Opl_Registry::get('opl_translate'));
     }
     if (Opl_Registry::getState('opl_debug_console') || $this->debugConsole) {
         $this->debugConsole = true;
         Opt_Support::initDebugConsole($this);
     }
     // Register a default inflector, if the programmer didn't set any.
     if (!$this->_inflector instanceof Opt_Inflector_Interface) {
         $this->_inflector = new Opt_Inflector_Standard($this);
     }
     $this->_securePath($this->compileDir);
     $this->_init = true;
     return true;
 }