/*
* YUI Compressor
* http://developer.yahoo.com/yui/compressor/
* Author: Julien Lecomte - http://www.julienlecomte.net/
* Author: Isaac Schlueter - http://foohack.com/
* Author: Stoyan Stefanov - http://phpied.com/
* Copyright (c) 2011 Yahoo! Inc. All rights reserved.
* The copyrights embodied in the content of this file are licensed
* by Yahoo! Inc. under the BSD (revised) open source license.
*/
package com.yahoo.platform.yui.compressor;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import java.util.ArrayList;
public class CssCompressor {
private StringBuffer srcsb = new StringBuffer();
public CssCompressor(Reader in) throws IOException {
// Read the stream...
int c;
while ((c = in.read()) != -1) {
srcsb.append((char) c);
}
}
// Leave data urls alone to increase parse performance.
protected String extractDataUrls(String css, ArrayList preservedTokens) {
int maxIndex = css.length() - 1;
int appendIndex = 0;
StringBuffer sb = new StringBuffer();
Pattern p = Pattern.compile("url\\(\\s*([\"']?)data\\:");
Matcher m = p.matcher(css);
/*
* Since we need to account for non-base64 data urls, we need to handle
* ' and ) being part of the data string. Hence switching to indexOf,
* to determine whether or not we have matching string terminators and
* handling sb appends directly, instead of using matcher.append* methods.
*/
while (m.find()) {
int startIndex = m.start() + 4; // "url(".length()
String terminator = m.group(1); // ', " or empty (not quoted)
if (terminator.length() == 0) {
terminator = ")";
}
boolean foundTerminator = false;
int endIndex = m.end() - 1;
while(foundTerminator == false && endIndex+1 <= maxIndex) {
endIndex = css.indexOf(terminator, endIndex+1);
if ((endIndex > 0) && (css.charAt(endIndex-1) != '\\')) {
foundTerminator = true;
if (!")".equals(terminator)) {
endIndex = css.indexOf(")", endIndex);
}
}
}
// Enough searching, start moving stuff over to the buffer
sb.append(css.substring(appendIndex, m.start()));
if (foundTerminator) {
String token = css.substring(startIndex, endIndex);
token = token.replaceAll("\\s+", "");
preservedTokens.add(token);
String preserver = "url(___YUICSSMIN_PRESERVED_TOKEN_" + (preservedTokens.size() - 1) + "___)";
sb.append(preserver);
appendIndex = endIndex + 1;
} else {
// No end terminator found, re-add the whole match. Should we throw/warn here?
sb.append(css.substring(m.start(), m.end()));
appendIndex = m.end();
}
}
sb.append(css.substring(appendIndex));
return sb.toString();
}
public void compress(Writer out, int linebreakpos)
throws IOException {
Pattern p;
Matcher m;
String css = srcsb.toString();
int startIndex = 0;
int endIndex = 0;
int i = 0;
int max = 0;
ArrayList preservedTokens = new ArrayList(0);
ArrayList comments = new ArrayList(0);
String token;
int totallen = css.length();
String placeholder;
css = this.extractDataUrls(css, preservedTokens);
StringBuffer sb = new StringBuffer(css);
// collect all comment blocks...
while ((startIndex = sb.indexOf("/*", startIndex)) >= 0) {
endIndex = sb.indexOf("*/", startIndex + 2);
if (endIndex < 0) {
endIndex = totallen;
}
token = sb.substring(startIndex + 2, endIndex);
comments.add(token);
sb.replace(startIndex + 2, endIndex, "___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_" + (comments.size() - 1) + "___");
startIndex += 2;
}
css = sb.toString();
// preserve strings so their content doesn't get accidentally minified
sb = new StringBuffer();
p = Pattern.compile("(\"([^\\\\\"]|\\\\.|\\\\)*\")|(\'([^\\\\\']|\\\\.|\\\\)*\')");
m = p.matcher(css);
while (m.find()) {
token = m.group();
char quote = token.charAt(0);
token = token.substring(1, token.length() - 1);
// maybe the string contains a comment-like substring?
// one, maybe more? put'em back then
if (token.indexOf("___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_") >= 0) {
for (i = 0, max = comments.size(); i < max; i += 1) {
token = token.replace("___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_" + i + "___", comments.get(i).toString());
}
}
// minify alpha opacity in filter strings
token = token.replaceAll("(?i)progid:DXImageTransform.Microsoft.Alpha\\(Opacity=", "alpha(opacity=");
preservedTokens.add(token);
String preserver = quote + "___YUICSSMIN_PRESERVED_TOKEN_" + (preservedTokens.size() - 1) + "___" + quote;
m.appendReplacement(sb, preserver);
}
m.appendTail(sb);
css = sb.toString();
// strings are safe, now wrestle the comments
for (i = 0, max = comments.size(); i < max; i += 1) {
token = comments.get(i).toString();
placeholder = "___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_" + i + "___";
// ! in the first position of the comment means preserve
// so push to the preserved tokens while stripping the !
if (token.startsWith("!")) {
preservedTokens.add(token);
css = css.replace(placeholder, "___YUICSSMIN_PRESERVED_TOKEN_" + (preservedTokens.size() - 1) + "___");
continue;
}
// \ in the last position looks like hack for Mac/IE5
// shorten that to /*\*/ and the next one to /**/
if (token.endsWith("\\")) {
preservedTokens.add("\\");
css = css.replace(placeholder, "___YUICSSMIN_PRESERVED_TOKEN_" + (preservedTokens.size() - 1) + "___");
i = i + 1; // attn: advancing the loop
preservedTokens.add("");
css = css.replace("___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_" + i + "___", "___YUICSSMIN_PRESERVED_TOKEN_" + (preservedTokens.size() - 1) + "___");
continue;
}
// keep empty comments after child selectors (IE7 hack)
// e.g. html >/**/ body
if (token.length() == 0) {
startIndex = css.indexOf(placeholder);
if (startIndex > 2) {
if (css.charAt(startIndex - 3) == '>') {
preservedTokens.add("");
css = css.replace(placeholder, "___YUICSSMIN_PRESERVED_TOKEN_" + (preservedTokens.size() - 1) + "___");
}
}
}
// in all other cases kill the comment
css = css.replace("/*" + placeholder + "*/", "");
}
// Normalize all whitespace strings to single spaces. Easier to work with that way.
css = css.replaceAll("\\s+", " ");
// Remove the spaces before the things that should not have spaces before them.
// But, be careful not to turn "p :link {...}" into "p:link{...}"
// Swap out any pseudo-class colons with the token, and then swap back.
sb = new StringBuffer();
p = Pattern.compile("(^|\\})(([^\\{:])+:)+([^\\{]*\\{)");
m = p.matcher(css);
while (m.find()) {
String s = m.group();
s = s.replaceAll(":", "___YUICSSMIN_PSEUDOCLASSCOLON___");
s = s.replaceAll( "\\\\", "\\\\\\\\" ).replaceAll( "\\$", "\\\\\
没有合适的资源?快使用搜索试试~ 我知道了~
PHP仿猪八戒威客网整站源码下载
共2000个文件
php:1173个
htm:507个
jpg:267个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 3 下载量 192 浏览量
2022-04-09
09:59:03
上传
评论
收藏 19.73MB ZIP 举报
温馨提示
PHP仿猪八戒威客网整站源码下载,php mysql环境。威客开源建站系统,其主要交易对象是以用户为主的技能、经验、时间和智慧型商品。经过多年发展,解决方案成熟,站长用户群稳步增长。产品成为同类开源建站产品的领导者,是搭建在线服务交易平台的首选产品。 安装说明 1、运行http://您的域名/install 进行安装。 2、首页分类设置 后台-全局配置-行业管理- 试用任务- 打钩首页的任务分类就显示不打勾就不示 注意:客客族分类是无限循环的,分类调节合适显示即可,不要超过分类的高度以免 挡住下面的任务列表。根据自己的网站自行调合适分类即可 3、其他设置自己参照客客族官网的操作说明,
资源推荐
资源详情
资源评论
收起资源包目录
PHP仿猪八戒威客网整站源码下载 (2000个子文件)
states.amap 5B
style1.css 295KB
style.css 295KB
style.css 295KB
home.css 225KB
home.css 225KB
user.css 218KB
user.css 218KB
store.css 202KB
store.css 202KB
home.css 149KB
animate.css 71KB
ie7.css 44KB
ueditor.css 43KB
ueditor.min.css 33KB
admin_management.css 28KB
font-awesome-ie7.min.css 26KB
video-js.css 21KB
image.css 19KB
video.css 15KB
attachment.css 15KB
sweet-alert.css 15KB
fotorama.css 14KB
ie8.css 13KB
video-js.min.css 11KB
css3buttons.css 9KB
shCoreDefault.css 7KB
style.css 7KB
style.css 6KB
default.css 6KB
setup.css 5KB
jquery.fancybox.css 5KB
aero.css 4KB
gray.css 4KB
chrome.css 4KB
simple.css 4KB
scrawl.css 4KB
jquery.fancybox.min.css 4KB
webuploader.css 3KB
webuploader.css 3KB
codemirror.css 3KB
charts.css 3KB
background.css 2KB
visualize.css 2KB
jquery.fancybox-buttons.css 2KB
uploadify.css 2KB
emotion.css 2KB
dialogbase.css 2KB
music.css 2KB
tip-yellowsimple.css 2KB
tip-darkgray.css 2KB
tip-yellow.css 2KB
tip-violet.css 2KB
tip-twitter.css 2KB
tip-skyblue.css 1KB
tip-green.css 1KB
edittable.css 1KB
template.css 1KB
jquery.tagsinput.css 858B
jquery.rating.css 836B
jquery.fancybox-thumbs.css 735B
quick-test.css 549B
webuploader.css 473B
help.css 395B
iframe.css 42B
fontawesome-webfont.eot 71KB
glyphicons-halflings-regular.eot 14KB
vjs.eot 3KB
UEditorSnapscreen.exe 508KB
caveman.gdf 157KB
bubblebath.gdf 66KB
automatic.gdf 60KB
crass.gdf 39KB
upload1.gif 52KB
wface.gif 49KB
jxface2.gif 40KB
2805054bf43a688305.gif 34KB
yface.gif 28KB
bface.gif 27KB
icons.gif 20KB
file-icons.gif 20KB
file-icons.gif 20KB
tface.gif 19KB
paypal.gif 19KB
fface.gif 18KB
fancybox_loading@2x.gif 14KB
SQl15bg.gif 12KB
loading.gif 11KB
alipayjs.gif 10KB
chinabank.gif 9KB
cface.gif 8KB
tipsicon.gif 8KB
yeepay.gif 8KB
fancybox_loading.gif 6KB
wxpay.gif 5KB
loading_close.gif 5KB
loading_close.gif 5KB
tenpay.gif 4KB
logo.gif 4KB
icons-all.gif 4KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
- m0_690218892023-12-13发现一个宝藏资源,赶紧冲冲冲!支持大佬~
- m0_674260152022-05-12用户下载后在一定时间内未进行评价,系统默认好评。
- art20222023-08-05非常有用的资源,有一定的参考价值,受益匪浅,值得下载。
智慧浩海
- 粉丝: 1w+
- 资源: 5121
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功