📄 clubpagetemplate.java
字号:
if(contentlist!=null){
ClubContentItem cci = (ClubContentItem)contentlist.get(i2);
content = cci.getContent();
contentUrl = cci.getContentUrl();
contentImg = cci.getContentImg();
}
//logger.info(topicID+":"+topic);
}catch(Exception e){
logger.error("提取主题表文章出错:"+e.toString());
}
}
try{
s = analysisTemplate_page(temp, null);
sb.append(s);
}catch(Exception e){
}
}
try{
template = template.replaceAll(temp1,sb.toString());
sb.delete(0,sb.length());
}catch(Exception e){
}
}
return template;
}
/**
* 分析模版帖子标签部分
* @param template
* @param cpi
* @return
* com.gamvan.club.file
*/
public String analysisTemplate_page(String template, ClubPageItem cpi)
{
if(template ==null || template .equals("")){
return "";
}
if(cpi!=null){
topicID_re = cpi.getTopicID_re();
topic_re = cpi.getTopic_re();
topicID_re = cpi.getTopicID_re();
topicAddTime_re = cpi.getTopicAddTime_re();
userID_re = cpi.getUserID_re();
userName_re = cpi.getUserName_re();
content_re = cpi.getContent_re();
contentUrl_re = cpi.getContentUrl_re();
contentImg_re = cpi.getContentImg_re();
topicID = cpi.getTopicID();
topic = cpi.getTopic();
topicAddTime = cpi.getTopicAddTime();
userID = cpi.getUserID();
userName = cpi.getUserName();
content = cpi.getContent();
contentUrl = cpi.getContentUrl();
contentImg = cpi.getContentImg();
}
pageHtmlEncoder();
topic = topic.replace("$","###@");
content = content.replace("$","###@");
topic_re = topic_re.replace("$","###@");
content_re = content_re.replace("$","###@");
template =
EncodeString.ubbPattern(template
, "<gv:out(\\p{Blank}*?)value=\"topicID\"(\\p{Blank}*?)\\/>",String.valueOf(topicID));
/*template =
EncodeString.ubbPattern(template
, "<gv:out(\\p{Blank}*?)value=\"topic\"(\\p{Blank}*?)\\/>",topic);
*/
List list = EncodeString.matcherList(template, "<gv:out(\\p{Blank}*?)value=\"topic\"(\\p{Blank}*?)\\/>");
for(int i=0; i<list.size(); i++){
String s = TypeChange.objOfString(list.get(i));
template = template.replace(s, topic);
}
list = EncodeString.matcherList(template, "<gv:out(\\p{Blank}*?)value=\"topic_re\"(\\p{Blank}*?)\\/>");
for(int i=0; i<list.size(); i++){
String s = TypeChange.objOfString(list.get(i));
//System.out.println(topic_re);
template = template.replaceAll(s, topic_re);
}
template =
EncodeString.ubbPattern(template
, "<gv:out(\\p{Blank}*?)value=\"URL_topic\"(\\p{Blank}*?)\\/>",URL_topic);
template = EncodeString.ubbPattern(template
, "<gv:out(\\p{Blank}*?)value=\"content\"(\\p{Blank}*?)\\/>",content);
template = EncodeString.ubbPattern(template
, "<gv:out(\\p{Blank}*?)value=\"userName\"(\\p{Blank}*?)\\/>",userName);
template = EncodeString.ubbPattern(template
, "<gv:out(\\p{Blank}*?)value=\"URL_userName\"(\\p{Blank}*?)\\/>",URL_userName);
template = EncodeString.ubbPattern(template
, "<gv:out(\\p{Blank}*?)value=\"topicAddTime\"(\\p{Blank}*?)\\/>",topicAddTime);
template =
EncodeString.ubbPattern(template
, "<gv:out(\\p{Blank}*?)value=\"topicID_re\"(\\p{Blank}*?)\\/>",String.valueOf(topicID_re));
//template = EncodeString.ubbPattern(template
//, "<gv:out(\\p{Blank}*?)value=\"topic_re\"(\\p{Blank}*?)\\/>",topic_re);
template = EncodeString.ubbPattern(template
, "<gv:out(\\p{Blank}*?)value=\"content_re\"(\\p{Blank}*?)\\/>",content_re);
template = EncodeString.ubbPattern(template
, "<gv:out(\\p{Blank}*?)value=\"userName_re\"(\\p{Blank}*?)\\/>",userName_re);
template = EncodeString.ubbPattern(template
, "<gv:out(\\p{Blank}*?)value=\"URL_userName_re\"(\\p{Blank}*?)\\/>",URL_userName_re);
template = EncodeString.ubbPattern(template
, "<gv:out(\\p{Blank}*?)value=\"topicAddTime_re\"(\\p{Blank}*?)\\/>",topicAddTime_re);
template = EncodeString.ubbPattern(template
, "<gv:out(\\p{Blank}*?)value=\"pageArea\"(\\p{Blank}*?)\\/>",pageArea);
template = EncodeString.ubbPattern(template
, "<gv:out(\\p{Blank}*?)value=\"ccName\"(\\p{Blank}*?)\\/>", ccName);
return template;
}
private String templatePublic(String template){
List list = EncodeString.matcherList(template
,"<gv:out(\\p{Blank}*?)value=\"pageJump_topic\"(\\p{Blank}*?)\\/>");
for(int i=0; i<list.size(); i++){
template = template.replaceAll(TypeChange.objOfString(list.get(i)),pageJump_topic);
}
list = EncodeString.matcherList(template
,"<gv:out(\\p{Blank}*?)value=\"pageArea\"(\\p{Blank}*?)\\/>");
for(int i=0; i<list.size(); i++){
template = template.replaceAll(TypeChange.objOfString(list.get(i)),pageArea);
}
list = EncodeString.matcherList(template
,"<gv:out(\\p{Blank}*?)value=\"pageJump_class\"(\\p{Blank}*?)\\/>");
for(int i=0; i<list.size(); i++){
template = template.replaceAll(TypeChange.objOfString(list.get(i)),pageJump_class);
}
list = EncodeString.matcherList(template
,"<gv:out(\\p{Blank}*?)value=\"ccID\"(\\p{Blank}*?)\\/>");
for(int i=0; i<list.size(); i++){
template = template.replaceAll(TypeChange.objOfString(list.get(i)),String.valueOf(ccID));
}
list = EncodeString.matcherList(template
,"<gv:out(\\p{Blank}*?)value=\"ccID1\"(\\p{Blank}*?)\\/>");
for(int i=0; i<list.size(); i++){
template = template.replaceAll(TypeChange.objOfString(list.get(i)),String.valueOf(ccID1));
}
list = EncodeString.matcherList(template
,"<gv:out(\\p{Blank}*?)value=\"ccID2\"(\\p{Blank}*?)\\/>");
for(int i=0; i<list.size(); i++){
template = template.replaceAll(TypeChange.objOfString(list.get(i)),String.valueOf(ccID2));
}
list = EncodeString.matcherList(template
,"<gv:out(\\p{Blank}*?)value=\"classSummary\"(\\p{Blank}*?)\\/>");
for(int i=0; i<list.size(); i++){
template = template.replaceAll(TypeChange.objOfString(list.get(i)),classSummary);
}
return template;
}
/**
*
*
* com.gamvan.club.file
*/
private void pageHtmlEncoder(){
this.topic = EncodeString.htmlEncoder(this.topic.trim());
this.topic_re = EncodeString.htmlEncoder(this.topic_re.trim());
sb.append("<a href=\"");
sb.append("/club/userInfo.jsp?userID=");
sb.append(userID);
sb.append("\" target=\"_blank\">");
sb.append(userName);
sb.append("</a>");
URL_userName = sb.toString();
sb.delete(0, sb.length());
sb.append("<a href=\"");
sb.append("/club/pages/");
sb.append(EncodeString.Gsubstring(topicAddTime,0,7,"UTF-8").replaceAll("-",""));
sb.append("/");
sb.append(topicID);
sb.append(".html");
sb.append("\" ");
sb.append(" title=\"");
sb.append(topic);
sb.append("\" target=\"_blank\">");
sb.append(this.topic);
sb.append("</a>");
URL_topic = sb.toString();
sb.delete(0, sb.length());
sb.append("<a href=\"");
sb.append("/club/userInfo.jsp?userID=");
sb.append(userID_re);
sb.append("\" target=\"_blank\">");
sb.append(userName_re);
sb.append("</a>");
URL_userName_re = sb.toString();
sb.delete(0, sb.length());
topicAddTime = topicAddTime.replace(".0","");
topicAddTime_re = topicAddTime_re.replace(".0","");
if(!this.content.equals("")){
content = EncodeString.htmlEncoder(content.trim());
es.setUbbImg(contentImg);
es.setUbbUrl(contentUrl);
this.content = es.ubbEncoder(content.trim());
/** 检测特殊类型的主题 */
if(topicType==4){
ctt.setTopicTypeNum(-1);
}else{
ctt.setTopicTypeNum(topicTypeNum);
}
ctt.setTopicType(topicType);
ctt.setUserTypeNum(0);
this.content = ctt.encoderType(this.content);
this.content = csrs.srContent(this.content,"");
}
if(!this.content_re.equals("")){
content_re = EncodeString.htmlEncoder(content_re.trim());
es.setUbbImg(contentImg_re);
es.setUbbUrl(contentUrl_re);
this.content_re = es.ubbEncoder(content_re.trim());
this.content_re = csrs.srContent(this.content_re,"");
}
/** 社区过滤字符 */
this.topic = csrs.srContent(this.topic,"");
this.topic_re = csrs.srContent(this.topic_re,"");
}
/* test
public static void main(String args[]){
ClubPageTemplate cpt = new ClubPageTemplate();
cpt.setTopic("++");
String str = "erter<gv:view>\n\r 234324 \n\r</gv:view>ert";
str=str.replaceAll("\r","");
str = str.replaceAll("\n","");
System.out.println(EncodeString.matcherStr(str, "<gv:view>(.*?)</gv:view>", "\n"));
}
*/
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -