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); }
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(); } }
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); }
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); } } }
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); }
function minify_nobreaks($what) { return minify($what, ['/ *(<br *\\/*> *)+/' => ' ']); }
// 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">
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]);
} } } 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(); }
<?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); }
/** * 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; } }
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); }
$_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)));
<?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)));
<?php include "jsmin.php"; JSMin: minify($js);
function create_stl($_object, $_id_file, $file, $_output) { /** LOAD DB */ $db = new Database(); /** ADD TASK */ $_task_data['user'] = $_SESSION['user']['id']; $_task_data['controller'] = 'objectmanager'; $_task_data['type'] = 'meshlab'; $_task_data['status'] = 'running'; //$_task_data['attributes'] = json_encode(array('id_object'=>$_object, 'id_file' => $_id_file)); $_task_data['start_date'] = 'now()'; /** ADD TASK RECORD TO DB */ $id_task = $db->insert('sys_tasks', $_task_data); //call socket shell_exec('sudo php ' . SCRIPT_PATH . '/notifications.php &'); /** ADD RECORD FOR THE OUTPUT FILE */ $_id_new_file = $db->insert('sys_files', array()); $_new_output_name = str_replace(' ', '_', $_output); /** CREATING TASK FILES */ $_time = time(); $_destination_folder = TASKS_PATH . 'mesh_' . $id_task . '_' . $_time . '/'; //$_monitor_file = $_destination_folder.'mesh_'.$id_task.'_'.$_time.'.json'; //$_trace_file = $_destination_folder.'mesh_'.$id_task.'_'.$_time.'.trace'; $_monitor_file = TEMP_PATH . 'task_monitor.json'; $_trace_file = TEMP_PATH . 'task_trace'; $_debug_file = $_destination_folder . 'log.debug'; mkdir($_destination_folder, 0777); /** create print monitor file */ write_file($_monitor_file, '', 'w'); chmod($_monitor_file, 0777); /** create print trace file */ write_file($_trace_file, '', 'w'); chmod($_trace_file, 0777); /** START PROCESS */ $_command = 'sudo python ' . PYTHON_PATH . 'meshlab_wrapper.py -t' . $_trace_file . ' -l' . $_monitor_file . ' -i' . $file . ' -o' . $_destination_folder . $_new_output_name . ' -s/root/meshlab_script.mlx -k' . $id_task . ' 2>' . $_debug_file . ' > /dev/null & echo $!'; $_output_command = shell_exec($_command); $_mesh_pid = intval(trim(str_replace('\\n', '', $_output_command))) + 1; /** UPDATE TASKS ATTRIBUTES */ $_attributes_items['pid'] = $_mesh_pid; $_attributes_items['monitor'] = $_monitor_file; $_attributes_items['trace'] = $_trace_file; $_attributes_items['debug'] = $_debug_file; $_attributes_items['output'] = $_destination_folder . $_new_output_name; $_attributes_items['output_raw'] = $_output; $_attributes_items['folder'] = $_destination_folder; $_attributes_items['id_object'] = $_object; $_attributes_items['id_file'] = $_id_file; $_attributes_items['id_new_file'] = $_id_new_file; $_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(); $_json_monitor = file_get_contents($_monitor_file, FILE_USE_INCLUDE_PATH); $_monitor = json_encode($_json_monitor); while ($_json_monitor == '') { $_json_monitor = file_get_contents($_monitor_file, FILE_USE_INCLUDE_PATH); $_monitor = json_encode($_json_monitor); } $_response_items['monitor_json'] = $_monitor; $_response_items['pid'] = $_mesh_pid; $_response_items['monitor'] = $_monitor_file; $_response_items['trace'] = $_trace_file; $_response_items['command'] = $_command; $_response_items['monitor_uri'] = '/tasks/mesh_' . $id_task . '_' . $_time . '/mesh_' . $id_task . '_' . $_time . '.json'; $_response_items['trace_uri'] = '/tasks/mesh_' . $id_task . '_' . $_time . '/mesh_' . $id_task . '_' . $_time . '.trace'; $_response_items['id_new_file'] = $_id_new_file; $_response_items['object'] = $_object; $_response_items['id_file'] = $_id_file; $_response_items['file'] = $file; $_response_items['output'] = $_output; $_response_items['task_id'] = $id_task; sleep(1); /** RESPONSE */ header('Content-Type: application/json'); echo minify(json_encode($_response_items)); }
public static function begin($title, $use_prefix = true) { global $title_string; $title_string = $use_prefix ? $title . " | eDart" : $title; $head_tag = <<<HEAD \t\t\t\t<head> \t\t\t\t\t<title>{$title_string}</title> \t\t\t\t\t<link rel="SHORTCUT ICON" href="/favicon.ico" /> \t\t\t\t\t<meta http-equiv="X-UA-Compatible" content="IE=edge" /> \t\t\t\t\t<meta name="viewport" content="width=device-width, initial-scale=1.0" /> \t\t\t\t\t<meta name="description" content="eDart is a first-of-its-kind, completely web-based, universal trading application for WPI students." /> \t\t\t\t\t<meta name="keywords" content="edart,beta,bartering,tradegrouper,trade,trading,tradby,college,worcester,polytechnic,institute,wpi,2013,free,online,database" /> \t\t\t\t\t<meta name="robots" content="index, follow" /> \t\t\t\t\t<meta name="Headline" content="Welcome to eDart!"> \t\t\t\t\t<meta name="CPS_SITE_NAME" content="Welcome to eDart!"> \t\t\t\t\t<meta charset="UTF-8"> \t\t\t\t\t\t\t \t\t\t\t\t<meta property="og:title"content="eDart" /> \t\t\t\t\t<meta property="og:site_name" content="eDart"/> \t\t\t\t\t<meta property="og:url"content="https://wewanttotrade.com/" /> \t\t\t\t\t<meta property="og:description" content="eDart is a first-of-its-kind, completely web-based, universal trading application for WPI students." /> \t\t\t\t\t<meta property="og:image" content="/img/logo/logo1024.png" /> \t\t\t\t\t \t\t\t\t\t<meta property="fb:app_id" content="1410963979147478" /> \t\t\t\t\t<noscript> \t\t\t\t\t\t<meta http-equiv="refresh" content="0;URL=/noscript.php"> \t\t\t\t\t</noscript> \t\t\t\t\t<link rel="stylesheet" type="text/css" media="screen" href="/fonts/Vegur/stylesheet.css"> \t\t\t\t\t<link rel="stylesheet" type="text/css" media="screen" href="/lib/uikit-2.10.0/css/uikit.almost-flat.min.css"> \t\t\t\t\t<link rel="stylesheet" type="text/css" media="screen" href="/lib/uikit-2.10.0/css/addons/uikit.almost-flat.addons.min.css"> \t\t\t\t\t<link rel="stylesheet" type="text/css" media="screen" href="/fonts/Titillium/stylesheet.css"> \t\t\t\t\t<link rel="stylesheet" type="text/css" media="screen" href="/lib/chosen/chosen.min.css"> \t\t\t\t\t<link rel="stylesheet" type="text/css" media="screen" href="/lib/toastr/toastr.min.css"> \t\t\t\t\t<link rel="stylesheet" type="text/css" media="screen" href="/lib/datetimepicker/css/bootstrap-datetimepicker.css"> \t\t\t\t\t<link rel="stylesheet" type="text/css" media="screen" href="/lib/jquery-ui/css/south-street/jquery-ui-1.10.4.custom.min.css"> \t\t\t\t\t<link rel="stylesheet" type="text/css" media="screen" href="/lib/glyphicon/icon.css"> \t\t\t\t\t<link rel="stylesheet" type="text/css" media="screen" href="/lib/complete.me-1.0.0/css/complete.me.css">\t\t \t\t\t\t\t<link rel="stylesheet" type="text/css" media="screen" href="/lib/min/?g=css"> \t\t\t\t\t\t\t \t\t\t\t\t<!--[if gte IE 9]> \t\t\t\t\t <style type="text/css"> \t\t\t\t\t .gradient { \t\t\t\t\t filter: none; \t\t\t\t\t } \t\t\t\t\t </style> \t\t\t\t\t<![endif]--> \t\t\t\t\t\t\t \t\t\t\t\t<script> \t\t\t\t\t\tdocument.cookie=''; \t\t\t\t\t\t(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ \t\t\t\t\t\t(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), \t\t\t\t\t\tm=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) \t\t\t\t\t\t})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); \t\t\t\t\t\tga('create', 'UA-44057002-1', 'wewanttotrade.com'); \t\t\t\t\t\tga('send', 'pageview'); \t\t\t\t\t</script> HEAD; echo minify($head_tag); }
require_once $_SERVER['DOCUMENT_ROOT'] . '/lib/utilities.php'; $inserted = false; $tree = array(); $content = <<<EOT <div class="text-center"> <h1><span style="font-size: 50px;" class="icon-fab-usb"></span></h1> <h1>Please insert USB disk</h1> \t<a class="btn btn-info check-usb" href="javascript:void(0);">Reload</a> </div> EOT; /** LOAD FROM USB DISK */ if (file_exists('/dev/sda1')) { $inserted = true; $_destination = '/var/www/fabui/application/modules/objectmanager/temp/media.json'; $_command = 'sudo python ' . PYTHON_PATH . 'usb_browser.py --dest=' . $_destination; shell_exec($_command); $tree = json_decode(file_get_contents($_destination, FILE_USE_INCLUDE_PATH), TRUE); if (sizeof($tree) > 0) { $content = '<div class="tree smart-form"><ul>'; foreach ($tree as $folder) { $content .= '<li><span data-loaded="false" data-folder="' . $folder . '"><i class="fa fa-lg fa-folder-open"></i> ' . rtrim(str_replace("/media/", '', $folder), '/') . '</span><ul></ul></li>'; } $content .= '</ul></div>'; } } $data_response['inserted'] = $inserted; $data_response['treee'] = $tree; $data_response['content'] = $content; header('Content-Type: application/json'); echo minify(json_encode($data_response));
<?php header('Content-Type: text/css'); @mkdir('./css-min'); function minify($css, $file) { // We assume that no string contains characters, which we search for $css = preg_replace('/\\/\\*([^\\/]|([^\\*]\\/))*\\*\\//', '', $css); $css = preg_replace('/[\\n\\r\\t ]*([,{}:;])[\\n\\r\\t ]*/', '$1', $css); $css = trim($css); file_put_contents($file, $css); } minify(file_get_contents('./core.css') . file_get_contents('./skeleton.css') . file_get_contents('./layout-header.css') . file_get_contents('./layout-header-bar.css') . file_get_contents('./layout-content.css') . file_get_contents('./layout-menubox.css') . file_get_contents('./layout-dynamic.css') . file_get_contents('./layout-footer.css'), './css-min/layout.css'); minify(file_get_contents('./ie6.css'), './css-min/ie6.css'); minify(file_get_contents('./ie7.css'), './css-min/ie7.css'); minify(file_get_contents('./rtl.css'), './css-min/rtl.css'); ?> Done
function minifyCSS($arr) { minify($arr, 'http://cssminifier.com/raw'); }
function store_css(theme_config $theme, $csspath, $cssfiles) { $css = $theme->post_process(minify($cssfiles)); check_dir_exists(dirname($csspath)); $fp = fopen($csspath, 'w'); fwrite($fp, $css); fclose($fp); }
function minifyCSS($arr, $url_min, $option) { minify($arr, $url_min, $option, 'http://vnaz.vn/min/css.php'); }
foreach ($breakpoints as $name => $value) { // Breakpoint offset $barelyValue = intval(substr($value, 0, -2)); if (suffixed($value, 'em')) { $barelyValue = $barelyValue - 0.0625 . 'em'; } else { $barelyValue = $barelyValue - 1 . 'px'; } // String replacement in template $keys = array('{{name}}', '{{barelyWidth}}', '{{width}}'); $values = array($name, $barelyValue, $value); // Raw template $temp = ''; if ($previousName) { $temp = $templateConsecutive; $keys[] = '{{previousName}}'; $values[] = $previousName; } else { $temp = $template; } $output[] = str_replace($keys, $values, $temp); $previousName = $name; } // Output string header('Content-Type: text/css; charset=utf-8'); header('HTTP/1.1 200 OK'); $output = implode("\n\n", $output); // echo $prefix.$output; echo $prefix . minify($output); } die;
$_object_id = $_POST["id_object"]; $_printable = $_POST["printable"]; /** UTIL PARAMS */ $_printable_files[] = '.gc'; $_printable_files[] = '.gcode'; $_printable_files[] = '.nc'; /** LOAD DB */ $db = new Database(); /** LOAD OBJECE FROM DB */ $_object = $db->query("select * from sys_objects where id=" . $_object_id); //$_object = $_object[0]; $_object['date_insert'] = mysql_to_human($_object['date_insert']); $_object['date_updated'] = mysql_to_human($_object['date_updated']); /** LOAD OBJECT'S FILES FROM DB */ $_object_files = $db->query("select * from sys_obj_files where id_obj=" . $_object_id); if ($db->get_num_rows() == 1) { $temp = $_object_files; $_object_files = array(); $_object_files[] = $temp; } $_files = array(); foreach ($_object_files as $_obj) { $_temp = $db->query("select * from sys_files where id=" . $_obj['id_file']); if (isset($_temp)) { $_files[$_temp['id']] = $_temp; } } $db->close(); /** RESPONSE */ echo minify(json_encode(array('object' => $_object, 'files' => array('number' => count($_files), 'data' => $_files))));
define('NO_UPGRADE_CHECK', true); // Ignore upgrade check require("$CFG->dirroot/lib/setup.php"); // setup include path set_include_path($CFG->libdir . '/minify/lib' . PATH_SEPARATOR . get_include_path()); require_once('Minify.php'); $theme = theme_config::load($themename); if ($rev > -1) { // 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($candidate)); $fp = fopen($candidate, 'w'); fwrite($fp, minify($theme->javascript_files($type))); fclose($fp); send_cached_js($candidate); } else { send_uncached_js($theme->javascript_content($type)); } //================================================================================= //=== utility functions == // we are not using filelib because we need to fine tune all header // parameters to get the best performance. function send_cached_js($jspath) { $lifetime = 60*60*24*30; // 30 days header('Content-Disposition: inline; filename="javascript.php"');
if (isset($_POST['code'])) { header('Content-Type: text/plain;charset=UTF-8'); $convert = array('…' => '…', '×' => '×', '∞' => '∞', '±' => '±', '\\u03b1' => 'α', '\\u03b2' => 'β'); $output = rtrim(str_replace(array_keys($convert), array_values($convert), trim($_POST['code'], ';')), ';'); file_put_contents('../_js/benchmark.js', $output); $file = '/home/jsperf/public_html/_inc/version.txt'; $v = (int) file_get_contents($file) + 1; file_put_contents($file, $v); mail(ADMIN_EMAIL, '[jsPerf] Deployed Benchmark.js revision ' . $v, 'Deployed Benchmark.js revision ' . $v); echo $output; } else { header('Content-Type: text/html;charset=UTF-8'); $convert = array('gaId = \'\'' => 'gaId = \'UA-6065217-40\'', 'if (freeExports && !freeExports.nodeType)' => 'if (false)', '\'selector\': \'\'' => '\'selector\': \'#bs-results\'', 'archive = \'../../nano.jar\'' => 'archive = \'/_jar/nano.jar\'', 'var _ = runInContext();' => '_ = runInContext();return;', 'root.platform =' => 'platform =', 'var _ = context && context._ || req(\'lodash\') || root._;' => '', '\'platform\': context.platform' => '\'platform\': platform'); $_SESSION['admin'] = true; $files = array('lodash/lodash/1.3.1/dist/lodash.compat.js' => array('dest' => 'lodash.js', 'source' => ''), 'bestiejs/platform.js/master/platform.js' => array('dest' => 'platform.src.js', 'source' => ''), 'bestiejs/benchmark.js/master/benchmark.js' => array('dest' => 'benchmark.src.js', 'source' => ''), 'bestiejs/benchmark.js/master/example/jsperf/ui.js' => array('dest' => 'ui.src.js', 'source' => ''), 'bestiejs/benchmark.js/master/plugin/ui.browserscope.js' => array('dest' => 'ui.browserscope.src.js', 'source' => '')); $source = '(function(){var _,platform;'; foreach ($files as $file => $arr) { $files[$file]['source'] = str_replace(array_keys($convert), array_values($convert), preg_replace('/(if\\s*\\()(typeof define|freeDefine)\\b/', '$1false', file_get_contents('https://raw.github.com/' . $file))); file_put_contents('../_js/' . $arr['dest'], $files[$file]['source']); $source .= "\n\n" . $files[$file]['source']; } $source .= '}.call(this))'; $source = minify(trim($source)); //$source = trim($source); ?> <!DOCTYPE html><title>Deploy Benchmark.js</title><style>textarea{width:100%;height:40em;font-family:Consolas}</style><form method=post><textarea name=code autofocus><?php echo he($source); ?> </textarea><input type=submit value=deploy></form> <?php }
<?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'; $object_id = $_POST['object_id']; $name = $_POST["name"]; $description = $_POST['description']; $private = $_POST['private']; /** SAVE TO DB */ $db = new Database(); /** UPDATE DATA INFO */ $_data_update['obj_name'] = $name; $_data_update['obj_description'] = $description; $_data_update['private'] = $private; $_data_update['date_updated'] = 'now()'; $db->update('sys_objects', array('column' => 'id', 'value' => $object_id, 'sign' => '='), $_data_update); $db->close(); $_response_items['success'] = true; /** JSON RESPONSE */ header('Content-Type: application/json'); echo minify(json_encode($_response_items));
<?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'; /** SAVE POST PARAMETERS */ $_folder = str_replace("//", "/", str_replace('/media', '', $_POST["folder"])); /** LOAD FROM USB DISK */ $_destination = '/var/www/fabui/application/modules/objectmanager/temp/media.json'; $_command = 'sudo python /var/www/fabui/python/usb_browser.py --path="' . $_folder . '" --dest="' . $_destination . '" '; shell_exec($_command); $data['tree'] = json_decode(file_get_contents($_destination, FILE_USE_INCLUDE_PATH), TRUE); $data['command'] = $_command; /** RESPONSE */ header('Content-Type: application/json'); echo minify(json_encode($data));
if (strpos($jsfile, $CFG->dirroot . DIRECTORY_SEPARATOR) !== 0) { // hackers - not in dirroot continue; } } if (substr($jsfile, -3) !== '.js') { // hackers - not a JS file continue; } $jsfiles[] = $jsfile; } if (!$jsfiles) { // bad luck - no valid files die; } minify($jsfiles); function minify($files) { global $CFG; $cachedir = $CFG->cachedir . '/js'; // make sure the cache dir exist if (!file_exists($cachedir)) { @mkdir($cachedir, $CFG->directorypermissions, true); } if (0 === stripos(PHP_OS, 'win')) { Minify::setDocRoot(); // IIS may need help } Minify::setCache($cachedir, true); $options = array('maxAge' => 60 * 60 * 24 * 20, 'files' => $files); try {
/** * scripts transport * * @since 1.2.1 * @deprecated 2.0.0 * * @package Redaxscript * @category Loader * @author Henry Ruhs * * @param string|boolean $minify * @return string */ function scripts_transport($minify = '') { /* languages object */ $language = Redaxscript\Language::getInstance(); /* languages transport */ $output = 'var l = ' . json_encode($language->get()) . ';' . PHP_EOL; /* extend redaxscript object */ $public_constants = array('TOKEN', 'LOGGED_IN', 'FIRST_PARAMETER', 'FIRST_SUB_PARAMETER', 'SECOND_PARAMETER', 'SECOND_SUB_PARAMETER', 'THIRD_PARAMETER', 'THIRD_SUB_PARAMETER', 'ADMIN_PARAMETER', 'TABLE_PARAMETER', 'ID_PARAMETER', 'ALIAS_PARAMETER', 'LAST_PARAMETER', 'LAST_SUB_PARAMETER', 'FIRST_TABLE', 'SECOND_TABLE', 'THIRD_TABLE', 'LAST_TABLE', 'FULL_ROUTE', 'FULL_TOP_ROUTE', 'REWRITE_ROUTE', 'LANGUAGE_ROUTE', 'TEMPLATE_ROUTE', 'REFRESH_ROUTE', 'MY_IP', 'MY_BROWSER', 'MY_BROWSER_VERSION', 'MY_ENGINE', 'MY_DESKTOP', 'MY_MOBILE', 'MY_TABLET'); /* collect output */ $output .= 'if (typeof r === \'object\')' . PHP_EOL; $output .= '{' . PHP_EOL; /* add constants */ $output .= 'r.constants = {};'; foreach ($public_constants as $value) { $output .= 'r.constants.' . $value . ' = \'' . constant($value) . '\';' . PHP_EOL; } /* baseURL fallback */ $output .= 'if (r.baseURL === \'\')' . PHP_EOL; $output .= '{' . PHP_EOL; $output .= 'r.baseURL = \'' . ROOT . '\\/\';' . PHP_EOL; $output .= '}' . PHP_EOL; /* generator and version */ $output .= 'r.generator = \'' . l('name', '_package') . ' ' . l('version', '_package') . '\';' . PHP_EOL; $output .= 'r.version = \'' . l('version', '_package') . '\';' . PHP_EOL; $output .= '}' . PHP_EOL; /* minify */ if ($minify) { $output = minify('scripts', $output); } return $output; }