/** * Compress inline CSS code found in a HTML file. * Only por internal usage. * @access private */ public static function _compress_inline_css($css) { if (self::_has_mark($css)) { return $css; } else { return Tinyfier_CSS_Tool::process($css, self::$_settings['css'] + array('less' => false, 'external_services' => self::$_settings['external_services'])); } }
$source[] = "\n\n\n/* {$url_path} */\n\n\n"; } $source[] = file_get_contents($absolute_path) . "\n"; } //Compress $source = implode(';', $source); $source = Tinyfier_JS_Tool::process($source, array('pretty' => $debug, 'gclosure' => strlen($source) > 750 && !$debug)); } elseif ($type == 'css' || $type == 'less') { //Process and compress, then combine //Process and compress $source = array(); foreach ($files as $url_path => $absolute_path) { if ($debug) { $source[] = "\n\n\n/* {$url_path} */\n\n\n"; } $source[] = Tinyfier_CSS_Tool::process_file($absolute_path, array('url_path' => $url_path, 'cache_path' => $cache_dir, 'compress' => !$debug, 'data' => $vars, 'optimize_images' => !$debug && $optimize_images)); } //Combine $source = implode("\n", $source); } else { header('HTTP/1.0 400 Bad Request'); die('Invalid source type'); } } catch (Exception $err) { header('HTTP/1.1 500 Internal Server Error'); die($err->getMessage()); } if ($debug) { echo $source; return; }
function optimize($css, $settings, &$errors = null) { $result = Tinyfier_CSS_Tool::process($css, $settings); return $result; }