public function __construct($file) { $this->_path = \PMVC\realpath($file); if (empty($this->_path)) { return trigger_error('[ImageFile] file not exists'); } }
/** * Set theme folder */ public function setThemeFolder($val) { $this['themeFolder'] = \PMVC\realpath($val); if (!$this['themeFolder']) { return !trigger_error('Template folder was not found: [' . $val . ']'); } }
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']); }
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.'); } }
/** * @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]; }