private function prepareReservedVariable($name) { $output = ''; $cache_buster = Config::getInstance()->get('template.cache_buster'); if ($cache_buster == '') { $cache_buster = \ORC\Util\Util::getNow(); } switch ($name) { case 'js': //first get the template js $existing_jses = array(); $jses = array_merge($this->_jses, $this->getViewModel()->getAllJs()); //pre($jses, $this->_jses); foreach ($jses as $path) { if (in_array($path, $existing_jses)) { continue; } $existing_jses[] = $path; $path = Url::getFullHttpPath($path); $output .= sprintf('<script type="text/javascript" src="%s?%s"></script>', $path, $cache_buster); } break; case 'css': $existing_csses = array(); $csses = array_merge($this->_csses, $this->getViewModel()->getAllCss()); foreach ($csses as $css) { if (!isset($existing_csses[$css['media']])) { $existing_csses[$css['media']] = array(); } if (in_array($css['path'], $existing_csses[$css['media']])) { continue; } $existing_csses[$css['media']][] = $css['path']; $css['path'] = Url::getFullHttpPath($css['path']); $output .= sprintf('<link type="text/css" rel="stylesheet" href="%s?%s" media="%s" />', $css['path'], $cache_buster, $css['media']); } break; case 'raw_js': $output .= implode("\n", $this->_viewModel->getRawJs()); break; case 'raw_css': $output .= implode("\n", $this->_viewModel->getRawCss()); break; case 'title': $output .= $this->getViewModel()->getTitle(); break; } return $output; }