本文整理汇总了PHP中Converter::detractSkeleton方法的典型用法代码示例。如果您正苦于以下问题:PHP Converter::detractSkeleton方法的具体用法?PHP Converter::detractSkeleton怎么用?PHP Converter::detractSkeleton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Converter
的用法示例。
在下文中一共展示了Converter::detractSkeleton方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_minify
function do_minify($content)
{
global $config;
$c = File::open(__DIR__ . DS . 'states' . DS . 'config.txt')->unserialize();
$url = $config->protocol . $config->host;
// Minify HTML
if (isset($c['html_minifier'])) {
$config->html_minifier = true;
Config::set('html_minifier', $config->html_minifier);
$content = Converter::detractSkeleton($content);
}
// Minify URL
if (isset($c['url_minifier']) && Text::check($content)->has('="' . $url)) {
$content = str_replace(array('="' . $url . '"', '="' . $url . '/', '="' . $url . '?', '="' . $url . '#'), array('="/"', '="/', '="?', '="#'), $content);
}
// Minify Embedded CSS
if (isset($c['css_minifier'])) {
$content = preg_replace_callback('#<style(>| .*?>)([\\s\\S]*?)<\\/style>#i', function ($matches) use($config, $c, $url) {
$css = Converter::detractShell($matches[2]);
if (isset($c['url_minifier'])) {
$css = preg_replace('#(?<=[\\s:])(src|url)\\(' . preg_quote($url, '/') . '#', '$1(', $css);
}
return '<style' . $matches[1] . $css . '</style>';
}, $content);
}
// Minify Embedded JavaScript
if (isset($c['js_minifier'])) {
$content = preg_replace_callback('#<script(>| .*?>)([\\s\\S]*?)<\\/script>#i', function ($matches) {
$js = Converter::detractSword($matches[2]);
return '<script' . $matches[1] . $js . '</script>';
}, $content);
}
return $content;
}
示例2: do_minify
function do_minify($content)
{
global $config;
$c_minify = $config->states->{'plugin_' . md5(File::B(__DIR__))};
$url = $config->protocol . $config->host;
// Minify HTML
if (isset($c_minify->html_minify)) {
Config::set('html_minify', true);
$content = Converter::detractSkeleton($content);
}
// Minify URL
if (isset($c_minify->url_minify) && Text::check($content)->has('="' . $url)) {
Config::set('url_minify', true);
$content = str_replace(array('="' . $url . '"', '="' . $url . '/', '="' . $url . '?', '="' . $url . '#'), array('="/"', '="/', '="?', '="#'), $content);
}
// Minify Embedded CSS
if (isset($c_minify->css_minify)) {
Config::set('css_minify', true);
$content = preg_replace_callback('#<style(>| .*?>)([\\s\\S]*?)<\\/style>#i', function ($matches) use($config, $c_minify, $url) {
$css = Converter::detractShell($matches[2]);
if (isset($c_minify->url_minify)) {
$css = preg_replace('#(?<=[\\s:])(src|url)\\(' . preg_quote($url, '/') . '#', '$1(', $css);
}
return '<style' . $matches[1] . $css . '</style>';
}, $content);
}
// Minify Embedded JavaScript
if (isset($c_minify->js_minify)) {
Config::set('js_minify', true);
$content = preg_replace_callback('#<script(>| .*?>)([\\s\\S]*?)<\\/script>#i', function ($matches) {
$js = Converter::detractSword($matches[2]);
return '<script' . $matches[1] . $js . '</script>';
}, $content);
}
return $content;
}
示例3: s_o
/**
* Minify HTML Output
* ------------------
*/
protected static function s_o($buffer)
{
$buffer = Filter::apply('sanitize:input', $buffer);
return Filter::apply('sanitize:output', Converter::detractSkeleton($buffer));
}