/** * Constructor * @param string $pType * @throws \Exception */ public function __construct($pType = self::TYPE_JS) { $this->type = $pType; switch ($this->type) { case self::TYPE_JS: Header::content_type("application/javascript"); break; case self::TYPE_CSS: Header::content_type("text/css"); break; } /** * Load manifest */ if (!file_exists(self::MANIFEST)) { $this->output($this->log("Manifest file '" . self::MANIFEST . "' not found", "error")); } $this->manifest = SimpleJSON::import(self::MANIFEST); $this->configuration = isset($this->manifest["config"]) ? $this->manifest["config"] : array(); unset($this->manifest["config"]); /** * Cache */ $cacheDuration = Stack::get("cache.duration", $this->configuration); if (!empty($cacheDuration)) { $eTag = md5($_GET["need"]); Header::handleCache($eTag, $cacheDuration); } }
/** * Méthode de récupération d'un terme se trouvant dans le fichier de langue * Le paramètre attendu correspond à la concaténation des différents identifiants de niveau d'accès * @param string $pId * @return String */ public static function term($pId) { $i = self::getInstance(); $value = Stack::get($pId, $i->table_terms); while (preg_match("/\\{([a-z\\.]+)\\}/", $value, $matches)) { $value = preg_replace("/\\{[a-z\\.]+\\}/", self::term($matches[1]), $value); } if (empty($value)) { $value = self::UNDEFINED; } return $value; }