当前位置: 首页>>代码示例>>PHP>>正文


PHP minify函数代码示例

本文整理汇总了PHP中minify函数的典型用法代码示例。如果您正苦于以下问题:PHP minify函数的具体用法?PHP minify怎么用?PHP minify使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了minify函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: optimizeJS

function optimizeJS($scripts)
{
    if (!isNitroEnabled() || !getNitroPersistence('Mini.Enabled')) {
        return $scripts;
    }
    global $registry;
    $oc_root = dirname(DIR_APPLICATION);
    $cache = NULL;
    $cachefile = NULL;
    $filename = NULL;
    //load NitroCache
    require_once DIR_SYSTEM . 'nitro/core/cdn.php';
    $nitroSettings = getNitroPersistence();
    $excludes = explodeTrim("\n", getNitroPersistence('Mini.JSExclude'));
    if (getNitroPersistence('Mini.JS')) {
        $scripts = minify('js', $scripts, $excludes);
    }
    if (getNitroPersistence('Mini.JSCombine')) {
        $scripts = combine('js', $scripts, $excludes);
    }
    return nitroCDNResolve($scripts);
}
开发者ID:artlabsdesign,项目名称:missbloom,代码行数:22,代码来源:minify_functions.php

示例2: pistachio_init

function pistachio_init()
{
    global $log;
    session_start();
    //Setup logger
    $log = new Logger('app');
    $log->pushHandler(new StreamHandler(ROOT . '/app.log', Logger::DEBUG));
    parse_input();
    minify();
    if (!insertView(PATH)) {
        err_404();
    }
}
开发者ID:payberah,项目名称:LinuxFestival,代码行数:13,代码来源:pistachio.php

示例3: begin

 public static function begin($include_banner = true, $no_padding = false)
 {
     global $onload;
     $body_tag = $onload ? "<body onload=\"{$onload}\">" : "<body>";
     if ($include_banner) {
         include_once $_SERVER["DOC_ROOT"] . "/scripts/php/html/banner.php";
     }
     $body_tag .= "<main";
     if ($no_padding) {
         $body_tag .= " class = \"reset_padding\"";
     }
     $body_tag .= ">";
     $body_tag .= "<div id=\"loader\"><span class=\"uk-icon-circle-o-notch uk-icon-spin\"></span></div>";
     echo minify($body_tag);
 }
开发者ID:Nickersoft,项目名称:eDart,代码行数:15,代码来源:body.php

示例4: process

function process($base, $array)
{
    $principal = function ($internalBase, $internalValue) {
        $pathBuffer = $internalBase . $internalValue . '/development/';
        $styleBuffer = minify($pathBuffer);
        echo $pathBuffer;
        $pathFile = $internalBase . $internalValue . '/output/import-' . $internalValue . '.min.css';
        writting($pathFile, $styleBuffer);
    };
    foreach ($array as $key => $value) {
        if (!is_array($value)) {
            $principal($base, $value);
        } else {
            $principal($base, $key);
            process($base . $key . '/', $value);
        }
    }
}
开发者ID:hevelmo,项目名称:compress,代码行数:18,代码来源:index.php

示例5: store_css

function store_css(theme_config $theme, $csspath, $cssfiles) {
    $css = $theme->post_process(minify($cssfiles));
    // note: cache reset might have purged our cache dir structure,
    //       make sure we do not use stale file stat cache in the next check_dir_exists()
    clearstatcache();
    check_dir_exists(dirname($csspath));
    $fp = fopen($csspath, 'w');
    fwrite($fp, $css);
    fclose($fp);
}
开发者ID:rolandovanegas,项目名称:moodle,代码行数:10,代码来源:styles.php

示例6: minify_nobreaks

 function minify_nobreaks($what)
 {
     return minify($what, ['/ *(<br *\\/*> *)+/' => ' ']);
 }
开发者ID:furey,项目名称:laravel-utils,代码行数:4,代码来源:helpers.php

示例7: foreach

// Release each script
foreach ($releases as $name) {
    // Read source files
    $source = '';
    foreach (rglob_files($sourcePath . $name . '/') as $value) {
        $source .= file_get_contents($value);
    }
    // Author info
    $prefix = '/*
' . $title . ' ' . ($name === 'responsive' ? ' responsive adjustments' : '') . '
Released by Jerry Jäppinen under the MIT license
http://eiskis.net/layers
' . date('Y-m-d') . '
*/
';
    $minRelease = $prefix . minify($source);
    $release = $prefix . $source;
    // Save compilation file on localhost
    if ($save) {
        file_put_contents($releasePath . $name . '.css', $release);
        file_put_contents($releasePath . $name . '.min.css', $minRelease);
    }
}
unset($name);
// Print report
header('Content-Type: text/html; charset=utf-8');
echo '
<html>
	<head>
		<title>Compiled layers.css</title>
		<style type="text/css">
开发者ID:Klaudit,项目名称:layers-css,代码行数:31,代码来源:index.php

示例8: mkdir

echo "{$B1} BLENC {$B0} file to encode: " . $argv[1] . "\n";
if (file_exists($argv[1])) {
    if (!is_dir('backup')) {
        mkdir('backup');
    }
    if (!file_exists('backup/' . basename($argv[1]))) {
        $backup_file = 'backup/' . basename($argv[1]);
    } else {
        $backup_file = 'backup/' . basename($argv[1]) . '.' . date('Y_m_d_H_i_s', time());
    }
    copy($argv[1], $backup_file);
    echo "{$B1} BLENC {$B0} backup file : {$backup_file}\n";
    $contents = php_strip_whitespace($argv[1]);
    $contents = convert_html($contents);
    file_put_contents('/tmp/blencode-txt', $contents);
    $contents = minify('/tmp/blencode-txt');
    $aS = array('<?php', '?>', '<?');
    $aR = array('', '', '');
    $contents = trim(str_replace($aS, $aR, $contents));
    echo "{$B1} BLENC {$B0} size of content: " . strlen($contents) . "\n";
    echo "{$B1} BLENC {$B0} MD5: " . md5($contents) . "\n";
    file_put_contents('/tmp/blencode-log', "---\nFILE: {$argv['1']}\nSIZE: " . strlen($contents) . "\nMD5: " . md5($contents) . "\n", FILE_APPEND);
    if ($key != '') {
        $key = blenc_encrypt($contents, $argv[1] . 'enc', $key);
    } else {
        $key = blenc_encrypt($contents, $argv[1] . 'enc');
    }
    echo "{$B1} BLENC {$B0} redistributable key: {$key}\n";
    file_put_contents('key_file.blenc', $key . "\n", FILE_APPEND);
    unlink($argv[1]);
    symlink($argv[1] . 'enc', $argv[1]);
开发者ID:illuusio,项目名称:pecl-php-blenc,代码行数:31,代码来源:blencode.php

示例9: dirname

                }
            }
        } else {
            if (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . "themes" . DIRECTORY_SEPARATOR . $theme . DIRECTORY_SEPARATOR . "css" . DIRECTORY_SEPARATOR . "cometchat.css")) {
                include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "themes" . DIRECTORY_SEPARATOR . $theme . DIRECTORY_SEPARATOR . "css" . DIRECTORY_SEPARATOR . "cometchat.css";
            } else {
                include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "themes" . DIRECTORY_SEPARATOR . "standard" . DIRECTORY_SEPARATOR . "css" . DIRECTORY_SEPARATOR . "cometchat.css";
            }
            if (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . "themes" . DIRECTORY_SEPARATOR . 'mobile' . DIRECTORY_SEPARATOR . 'config.php')) {
                include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "themes" . DIRECTORY_SEPARATOR . 'mobile' . DIRECTORY_SEPARATOR . 'config.php';
                if ($enableMobileTab && file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . "themes" . DIRECTORY_SEPARATOR . 'mobile' . DIRECTORY_SEPARATOR . "css" . DIRECTORY_SEPARATOR . "cometchat.css")) {
                    include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "themes" . DIRECTORY_SEPARATOR . 'mobile' . DIRECTORY_SEPARATOR . "css" . DIRECTORY_SEPARATOR . "cometchat.css";
                }
            }
        }
        $css = minify(ob_get_clean());
        $fp = @fopen(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'writable' . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . $theme . $type . $name . $cbfn . $color . '.css', 'w');
        @fwrite($fp, $css);
        @fclose($fp);
    }
    $lastModified = filemtime(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'writable' . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . $theme . $type . $name . $cbfn . $color . '.css');
}
if (phpversion() >= '4.0.4pl1' && (strstr($useragent, 'compatible') || strstr($useragent, 'Gecko'))) {
    if (extension_loaded('zlib') && GZIP_ENABLED == 1) {
        ob_start('ob_gzhandler');
    } else {
        ob_start();
    }
} else {
    ob_start();
}
开发者ID:albertoneto,项目名称:localhost,代码行数:31,代码来源:css.php

示例10: header

<?php

header("Content-type: text/css");
$files = array();
$files[] = 'style.css';
foreach ($files as $file) {
    $content = @file_get_contents($file);
    echo minify($content);
}
function minify($code)
{
    $code = preg_replace('#\\s+#', ' ', $code);
    $code = preg_replace('#/\\*.*?\\*/#s', '', $code);
    $code = str_replace('; ', ';', $code);
    $code = str_replace(': ', ':', $code);
    $code = str_replace(' {', '{', $code);
    $code = str_replace('{ ', '{', $code);
    $code = str_replace(', ', ',', $code);
    $code = str_replace('} ', '}', $code);
    $code = str_replace(';}', '}', $code);
    return trim($code);
}
开发者ID:minnehaha,项目名称:margots-blog-ver2,代码行数:22,代码来源:style.php

示例11: write_css_file

/**
* Attempts to create a new css file for this style
*
* @param	string	CSS filename
* @param	string	CSS contents
*
* @return	boolean	Success
*/
function write_css_file($filename, $contents)
{
	// attempt to write new css file - store in database if unable to write file
	if ($fp = @fopen(DIR . "/$filename", 'wb') AND !is_demo_mode())
	{
		fwrite($fp, minify($contents));
		@fclose($fp);
		return true;
	}
	else
	{
		@fclose($fp);
		return false;
	}
}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:23,代码来源:adminfunctions_template.php

示例12: foreach

foreach (glob('src/vx.*.js') as $fn) {
    $data = file_get_contents($fn);
    $metadata = parsemeta($data);
    $fn = explode('/', $fn, 2);
    $prepared = minify($data);
    if ($prepared != @file_get_contents('lib/' . $fn[1])) {
        file_put_contents('lib/' . $fn[1], $prepared);
    }
    $content .= "\n" . $data;
    $modname = substr($fn[1], 3, strlen($fn[1]) - 6);
    $lib[$modname] = array('name' => @$metadata['name'][0] ? $metadata['name'][0] : $modname, 'desc' => @$metadata['desc'] ? implode('. ', $metadata['desc']) : '', 'note' => @$metadata['note'] ? implode('. ', $metadata['note']) : '', 'fn' => @$metadata['fn'] ? implode('. ', $metadata['fn']) : '', 'dep' => @$metadata['dep'] ? explode(',', implode(',', $metadata['dep'])) : array());
    $title = trim(@$metadata['name'][0] ? $metadata['name'][0] : $modname) . ': ' . trim(@$metadata['desc'] ? implode("\n", $metadata['desc']) : '');
    $dochead .= '  * [#' . str_replace(" ", '_', $title) . ' ' . $title . ']' . "\n";
    $doc .= '== ' . $title . ' ==' . "\n" . trim(@$metadata['summary'] ? implode("\n", $metadata['summary']) : '') . "\n" . '=== Usage ===' . "\n" . trim(@$metadata['usage'] ? implode("\n", $metadata['usage']) : '') . "\n" . '=== Example ===' . "\n" . trim(@$metadata['example'] ? implode("\n", $metadata['example']) : '') . "\n\n";
}
$prepared = minify(@file_get_contents('src/vx.js'));
if ($prepared != @file_get_contents('lib/vx.js')) {
    file_put_contents('lib/vx.js', $prepared);
}
$prepared = trim($header . minify($prepared . $content));
if ($prepared != @file_get_contents('lib/vx.all.js')) {
    file_put_contents('lib/vx.all.js', $prepared);
}
$prepared = json_encode($lib);
if ($prepared != @file_get_contents('modules.json')) {
    file_put_contents('modules.json', $prepared);
}
$prepared = trim($dochead . "\n" . $doc);
if ($prepared != @file_get_contents('doc.wiki')) {
    file_put_contents('doc.wiki', $prepared);
}
开发者ID:n-qwed,项目名称:vxjs,代码行数:31,代码来源:packscript.php

示例13: json_encode

$_attributes_items['pid'] = $_print_pid;
$_attributes_items['monitor'] = $_monitor_file;
$_attributes_items['data'] = $_data_file;
$_attributes_items['trace'] = $_trace_file;
$_attributes_items['debug'] = $_debug_file;
$_attributes_items['id_object'] = $_object_id;
$_attributes_items['id_file'] = $_file_id;
$_attributes_items['uri_monitor'] = $_uri_monitor;
$_attributes_items['uri_trace'] = $_uri_trace;
$_attributes_items['folder'] = $_destination_folder;
$_attributes_items['stats'] = $_stats_file;
$_attributes_items['speed'] = 100;
$_attributes_items['print_type'] = $_print_type;
$_data_update['attributes'] = json_encode($_attributes_items);
/** UPDATE TASK INFO TO DB */
$db->update('sys_tasks', array('column' => 'id', 'value' => $id_task, 'sign' => '='), $_data_update);
$db->close();
sleep(2);
$_json_status = file_get_contents($_monitor_file, FILE_USE_INCLUDE_PATH);
$status = json_encode($_json_status);
while ($_json_status == '') {
    $_json_status = file_get_contents($_monitor_file, FILE_USE_INCLUDE_PATH);
    $status = json_encode($_json_status);
}
/** DELETE TEMPORARY FILES */
//unlink($_macro_trace);
//unlink($_start_print_macro_response);
//unlink($_macro_response);
header('Content-Type: application/json');
echo minify(json_encode(array('response' => true, 'status' => $status, 'id_task' => $id_task, 'monitor_file' => $_monitor_file, 'data_file' => $_data_file, 'trace_file' => $_trace_file, 'command' => $_command, 'uri_monitor' => $_uri_monitor, 'uri_trace' => $_uri_trace, "stats" => $_stats_file, "folder" => $_destination_folder)));
开发者ID:fbatogo,项目名称:PCBMill,代码行数:30,代码来源:create.php

示例14: Database

<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/lib/config.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/lib/database.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/lib/utilities.php';
/** LOAD DATABASE */
$db = new Database();
$query = 'select * from eeprom_configs order by name';
$configs = $db->query($query);
$db->close();
$rows = array();
foreach ($configs as $config) {
    $rows[] = array($config['id'], $config['values'], '<a><i class="fa fa-chevron-right fa-lg" data-toggle="row-detail" title="Show Details"></i> </a>', $config['active'], $config['name'], $config['description']);
}
header('Content-Type: application/json; charset=utf-8');
echo minify(json_encode(array('aaData' => $rows)));
开发者ID:tjankovic,项目名称:FAB-UI,代码行数:16,代码来源:eeprom_configs.php

示例15: minify

<?php

include "jsmin.php";
JSMin:
minify($js);
开发者ID:rzel,项目名称:ajaxanimator,代码行数:5,代码来源:testcompress.php


注:本文中的minify函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。