function csstidy::load_template in Advanced CSS/JS Aggregation 6
Loads a new template
@access public @version 1.1
Parameters
string $content either filename (if $from_file == true), content of a template file, "high_compression", "highest_compression", "low_compression", or "default":
bool $from_file uses $content as filename if true:
See also
http://csstidy.sourceforge.net/templates.php
1 call to csstidy::load_template()
- csstidy::_load_template in advagg_css_compress/
csstidy/ class.csstidy.inc - Load a template
File
- advagg_css_compress/
csstidy/ class.csstidy.inc, line 503
Class
- csstidy
- CSS Parser class
Code
function load_template($content, $from_file = true) {
$predefined_templates =& $GLOBALS['csstidy']['predefined_templates'];
if ($content === 'high_compression' || $content === 'default' || $content === 'highest_compression' || $content === 'low_compression') {
$this->template = $predefined_templates[$content];
return;
}
if ($from_file) {
$content = strip_tags(file_get_contents($content), '<span>');
}
$content = str_replace("\r\n", "\n", $content);
// Unify newlines (because the output also only uses \n)
$template = explode('|', $content);
for ($i = 0; $i < count($template); $i++) {
$this->template[$i] = $template[$i];
}
}