_variables[$name] = $value; } /** * render a template * * @access public * @param string $template * @throws Exception */ public function draw($template) { $file = substr($template, 0, 10) === 'bootstrap-' ? 'bootstrap' : $template; $path = PATH . 'tpl' . DIRECTORY_SEPARATOR . $file . '.php'; if (!file_exists($path)) { throw new Exception('Template ' . $template . ' not found!', 80); } extract($this->_variables); include $path; } /** * echo script tag incl. SRI hash for given script file * * @access private * @param string $file * @param string $attributes additional attributes to add into the script tag */ private function _scriptTag($file, $attributes = '') { $sri = array_key_exists($file, $this->_variables['SRI']) ? ' integrity="' . $this->_variables['SRI'][$file] . '"' : ''; // if the file isn't versioned (ends in a digit), add our own version $cacheBuster = ctype_digit(substr($file, -4, 1)) ? '' : '?' . rawurlencode($this->_variables['VERSION']); echo '', PHP_EOL; } }