/** * Fungsi untuk menampilkan file CSS */ public function css() { if (func_num_args() != 1) { return; } $arg = func_get_arg(0); $path = APPPATH . 'static/css/' . $arg; $file = basename($path); if (!file_exists($path)) { log_message('error', 'URI passed seems invalid and manually typed'); show_404($arg); } header('Content-Type: text/css'); header('Charset: UTF-8'); header(date(DATE_COOKIE, time() + 18144000)); if (!class_exists('jsloc')) { include APPPATH . 'libraries/jsloc.php'; } // Minify CSS $minify = jsloc::minCSS(@file_get_contents($path)); echo $minify; }
protected function formatNode($node, &$output) { $nodeName = $node->nodeName; $has_child = $node->hasChildNodes(); switch ($nodeName) { case '#cdata-section': case '#text': case '#comment': break; default: $output .= '<' . $nodeName; } // get tag attribute if (!is_null($node->attributes)) { $attr = $this->listAttr($node); if (!empty($attr)) { $output .= ' ' . join($attr, ' '); } } switch ($nodeName) { // non tag element case '#cdata-section': case '#text': $parent = $node->parentNode->nodeName; if ($parent == 'style') { $output .= jsloc::minCSS($node->nodeValue); } else { if ($parent == 'script') { $output .= trim(jsloc::minJS($node->nodeValue)); } else { $text = $this->isWhiteSpace($node); if (!is_bool($text)) { $output .= htmlentities($text, ENT_QUOTES, "UTF-8"); } } } break; case '#comment': $output .= '<!--' . $node->nodeValue . '-->'; break; default: $output .= '>'; } if (!$has_child) { switch ($nodeName) { case '#text': case '#comment': case '#cdata-section': case 'base': case 'br': case 'dl': case 'hr': case 'img': case 'input': case 'link': case 'meta': case 'param': break; default: $output .= '</' . $nodeName . '>'; } } if (is_null($node->nextSibling)) { if (!$has_child) { $parent = $node->parentNode; $output .= '</' . $parent->nodeName . '>'; } } }