예제 #1
0
 public function __construct($file)
 {
     $this->_path = \PMVC\realpath($file);
     if (empty($this->_path)) {
         return trigger_error('[ImageFile] file not exists');
     }
 }
예제 #2
0
 /**
  * Set theme folder
  */
 public function setThemeFolder($val)
 {
     $this['themeFolder'] = \PMVC\realpath($val);
     if (!$this['themeFolder']) {
         return !trigger_error('Template folder was not found: [' . $val . ']');
     }
 }
예제 #3
0
파일: test.php 프로젝트: pmvc-plugin/view
 function testGetGetThemeDir()
 {
     $view = \PMVC\plug('view_fake', array(_CLASS => 'FakeTemplate'));
     $path = './test/fakeTpl';
     $view->setThemeFolder($path);
     $view->initTemplateHelper();
     $tpl = $view->getTpl();
     $this->assertTrue(!empty($tpl));
     $this->assertEquals(\PMVC\realpath($path), $view['themeFolder']);
 }
예제 #4
0
 public function getDb($key)
 {
     $path = \PMVC\lastSlash($this['dbs']) . $key . '.php';
     if (\PMVC\realpath($path)) {
         \PMVC\l($path);
         $class = __NAMESPACE__ . '\\' . $key;
         if (class_exists($class)) {
             return new $class();
         } else {
             trigger_error($class . ' not exists.');
         }
     } else {
         trigger_error($path . ' not exists.');
     }
 }
예제 #5
0
파일: GetDb.php 프로젝트: pmvc-plugin/guid
 /**
  * @param int    $id  group guid
  * @param string $key group key
  */
 public function getDb($id, $key = null)
 {
     if (!$this->_connected) {
         return !trigger_error('Server is not connected.');
     }
     if (empty($this->dbs[$id])) {
         $path = $this->getDir() . '/src/dbs/' . $key . '.php';
         if (\PMVC\realpath($path)) {
             \PMVC\l($path);
             $nameSpace = $this->getNameSpace();
             $class = $nameSpace . '\\dbs\\' . $key;
             if (class_exists($class)) {
                 $this->dbs[$id] = new $class($this['this'], $id);
             } else {
                 return !trigger_error($class . ' not exists.');
             }
         } else {
             $baseDb = $this->getBaseDb();
             $this->dbs[$id] = new $baseDb($this['this'], $id);
         }
     }
     return $this->dbs[$id];
 }