/** * Set the template for this view. * * If the template path is relative, it will be based on the currently * executing module's template sub-directory. * * @param string An absolute or relative filesystem path to a template. * * @return void */ public function setTemplate($template) { if (Toolkit::isPathAbsolute($template)) { $this->directory = dirname($template); $this->template = basename($template); } else { $this->template = $template; } }
/** * Replace a relative filesystem path with an absolute one. * * @param string A relative filesystem path. * * @return string The new path. */ public static function &replacePath($path) { if (!Toolkit::isPathAbsolute($path)) { // not an absolute path so we'll prepend to it $path = MO_WEBAPP_DIR . '/' . $path; } return $path; }
/** * Check to see if a configuration file has been modified and if so * recompile the cache file associated with it. * * If the configuration file path is relative, the path itself is relative * to the Mojavi MO_WEBAPP_DIR application setting. * * @param string A filesystem path to a configuration file. * * @return string An absolute filesystem path to the cache filename * associated with this specified configuration file. * * @throws <b>ConfigurationException</b> If a requested configuration file * does not exist. */ public static function checkConfig($config) { // the full filename path to the config $filename = $config; if (!Toolkit::isPathAbsolute($filename)) { $filename = MO_WEBAPP_DIR . '/' . $filename; } if (!is_readable($filename)) { // configuration file does not exist $error = 'Configuration file "%s" does not exist or is unreadable'; $error = sprintf($error, $filename); throw new ConfigurationException($error); } // the cache filename we'll be using $cache = self::getCacheName($config); if (!is_readable($cache) || filemtime($filename) > filemtime($cache)) { // configuration file has changed so we need to reparse it self::callHandler($config, $filename, $cache); } return $cache; }