/** * Used by <% include Identifier %> statements to get the full * unparsed content of a template file. * * @uses getTemplateFile() * @param string $identifier A template name without '.ss' extension or path. * @return string content of template */ public static function getTemplateContent($identifier) { return file_get_contents(SSViewer::getTemplateFile($identifier)); }
/** * Used by <% include Identifier %> statements to get the full * unparsed content of a template file. * * @uses getTemplateFile() * @param string $identifier A template name without '.ss' extension or path. * @return string content of template */ public static function getTemplateContent($identifier) { if (!SSViewer::getTemplateFile($identifier)) { return null; } $content = file_get_contents(SSViewer::getTemplateFile($identifier)); // $content = "<!-- getTemplateContent() :: identifier: $identifier -->". $content; // Adds an i18n namespace to all <% _t(...) %> calls without an existing one // to avoid confusion when using the include in different contexts. // Entities without a namespace are deprecated, but widely used. $content = ereg_replace('<' . '% +_t\\((\'([^\\.\']*)\'|"([^\\."]*)")(([^)]|\\)[^ ]|\\) +[^% ])*)\\) +%' . '>', '<?= _t(\'' . $identifier . '.ss' . '.\\2\\3\'\\4) ?>', $content); // Remove UTF-8 byte order mark // This is only necessary if you don't have zend-multibyte enabled. if (substr($content, 0, 3) == pack("CCC", 0xef, 0xbb, 0xbf)) { $content = substr($content, 3); } return $content; }