/**
  * テンプレートファイル名をセットする
  * @access public
  * @param string $directory テンプレートディレクトリ
  */
 public function setTemplate($template)
 {
     if (Toolkit::isPathAbsolute($template)) {
         $this->directory = dirname($template);
         $this->template = basename($template);
     } else {
         $this->template = $template;
     }
 }
Esempio n. 2
0
 /**
  * Replace a relative filesystem path with an absolute one.
  *
  * @param string A relative filesystem path.
  *
  * @return string The new path.
  *
  * @author Sean Kerr (skerr@mojavi.org)
  * @since  3.0.0
  */
 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;
 }
Esempio n. 3
0
 /**
  * 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.
  *
  * @author Sean Kerr (skerr@mojavi.org)
  * @since  3.0.0
  */
 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;
 }