表情包(包括蛆音娘,B站表情包,贴吧表情包,微博表情包,paopao等)
点击下载
参考文章:
https://blog.fddmao.com/14.html
我使用的json和ctx.php
直接下载这个参考乔治博客里面的文件位置替换对应文件就可以了 注意:仅适用于cutten4 最新版本 emoji.json下载地址: https://cdn.jsdelivr.net/gh/LR787/image/usr/uploads/2021/02/3630647554.json ctx.php下载地址 https://cdn.jsdelivr.net/gh/LR787/cdn/php/ctx.php
表情包json(包括Bilibili表情包 蛆音娘)----主题默认已经替换data内容,建议下载上方的json替换或者对照修改
代码语言:javascript复制{
"阿鲁": {
"type": "image",
"container": [
{
"icon": "emoji/aru/E9AB98E585B4_2x.png",
"data": "",
"text": "高兴"
},
{
"icon": "emoji/aru/E5B08FE68092_2x.png",
"data": "",
"text": "小怒"
},
{
"icon": "emoji/aru/E884B8E7BAA2_2x.png",
"data": "",
"text": "脸红"
},
{
"icon": "emoji/aru/E58685E4BCA4_2x.png",
"data": "",
"text": "内伤"
},
{
"icon": "emoji/aru/E8A385E5A4A7E6ACBE_2x.png",
"data": "",
"text": "装大款"
},
{
"icon": "emoji/aru/E8B59EE4B880E4B8AA_2x.png",
"data": "",
"text": "赞一个"
},
{
"icon": "emoji/aru/E5AEB3E7BE9E_2x.png",
"data": "",
"text": "害羞"
},
{
"icon": "emoji/aru/E6B197_2x.png",
"data": "",
"text": "汗"
},
{
"icon": "emoji/aru/E59090E8A180E58092E59CB0_2x.png",
"data": "",
"text": "吐血倒地"
},
{
"icon": "emoji/aru/E6B7B1E6809D_2x.png",
"data": "",
"text": "深思"
},
{
"icon": "emoji/aru/E4B88DE9AB98E585B4_2x.png",
"data": "",
"text": "不高兴"
},
{
"icon": "emoji/aru/E697A0E8AFAD_2x.png",
"data": "",
"text": "无语"
},
{
"icon": "emoji/aru/E4BAB2E4BAB2_2x.png",
"data": "",
"text": "亲亲"
},
{
"icon": "emoji/aru/E58FA3E6B0B4_2x.png",
"data": "",
"text": "口水"
},
{
"icon": "emoji/aru/E5B0B4E5B0AC_2x.png",
"data": "",
"text": "尴尬"
},
{
"icon": "emoji/aru/E4B8ADE68C87_2x.png",
"data": "",
"text": "中指"
},
{
"icon": "emoji/aru/E683B3E4B880E683B3_2x.png",
"data": "",
"text": "想一想"
},
{
"icon": "emoji/aru/E593ADE6B3A3_2x.png",
"data": "",
"text": "哭泣"
},
{
"icon": "emoji/aru/E4BEBFE4BEBF_2x.png",
"data": "",
"text": "便便"
},
{
"icon": "emoji/aru/E78CAEE88AB1_2x.png",
"data": "",
"text": "献花"
},
{
"icon": "emoji/aru/E79AB1E79C89_2x.png",
"data": "",
"text": "皱眉"
},
{
"icon": "emoji/aru/E582BBE7AC91_2x.png",
"data": "",
"text": "傻笑"
},
{
"icon": "emoji/aru/E78B82E6B197_2x.png",
"data": "",
"text": "狂汗"
},
{
"icon": "emoji/aru/E59090_2x.png",
"data": "",
"text": "吐"
},
{
"icon": "emoji/aru/E596B7E6B0B4_2x.png",
"data": "",
"text": "喷水"
},
{
"icon": "emoji/aru/E79C8BE4B88DE8A781_2x.png",
"data": "",
"text": "看不见"
},
{
"icon": "emoji/aru/E9BC93E68E8C_2x.png",
"data": "",
"text": "鼓掌"
},
{
"icon": "emoji/aru/E998B4E69A97_2x.png",
"data": "",
"text": "阴暗"
},
{
"icon": "emoji/aru/E995BFE88D89_2x.png",
"data": "",
"text": "长草"
},
{
"icon": "emoji/aru/E78CAEE9BB84E7939C_2x.png",
"data": "",
"text": "献黄瓜"
},
{
"icon": "emoji/aru/E982AAE681B6_2x.png",
"data": "",
"text": "邪恶"
},
{
"icon": "emoji/aru/E69C9FE5BE85_2x.png",
"data": "",
"text": "期待"
},
{
"icon": "emoji/aru/E5BE97E6848F_2x.png",
"data": "",
"text": "得意"
},
{
"icon": "emoji/aru/E59090E8888C_2x.png",
"data": "",
"text": "吐舌"
},
{
"icon": "emoji/aru/E596B7E8A180_2x.png",
"data": "",
"text": "喷血"
},
{
"icon": "emoji/aru/E697A0E68980E8B093_2x.png",
"data": "",
"text": "无所谓"
},
{
"icon": "emoji/aru/E8A782E5AF9F_2x.png",
"data": "",
"text": "观察"
},
{
"icon": "emoji/aru/E69A97E59CB0E8A782E5AF9F_2x.png",
"data": "",
"text": "暗地观察"
},
{
"icon": "emoji/aru/E882BFE58C85_2x.png",
"data": "",
"text": "肿包"
},
{
"icon": "emoji/aru/E4B8ADE69EAA_2x.png",
"data": "",
"text": "中枪"
},
{
"icon": "emoji/aru/E5A4A7E59BA7_2x.png",
"data": "",
"text": "大囧"
},
{
"icon": "emoji/aru/E591B2E78999_2x.png",
"data": "",
"text": "呲牙"
},
{
"icon": "emoji/aru/E68AA0E9BCBB_2x.png",
"data": "",
"text": "抠鼻"
},
{
"icon": "emoji/aru/E4B88DE8AFB4E8AF9D_2x.png",
"data": "",
"text": "不说话"
},
{
"icon": "emoji/aru/E592BDE6B094_2x.png",
"data": "",
"text": "咽气"
},
{
"icon": "emoji/aru/E6ACA2E591BC_2x.png",
"data": "",
"text": "欢呼"
},
{
"icon": "emoji/aru/E99481E79C89_2x.png",
"data": "",
"text": "锁眉"
},
{
"icon": "emoji/aru/E89CA1E7839B_2x.png",
"data": "",
"text": "蜡烛"
},
{
"icon": "emoji/aru/E59D90E7AD89_2x.png",
"data": "",
"text": "坐等"
},
{
"icon": "emoji/aru/E587BBE68E8C_2x.png",
"data": "",
"text": "击掌"
},
{
"icon": "emoji/aru/E6838AE5969C_2x.png",
"data": "",
"text": "惊喜"
},
{
"icon": "emoji/aru/E5969CE69E81E8808CE6B3A3_2x.png",
"data": "",
"text": "喜极而泣"
},
{
"icon": "emoji/aru/E68ABDE7839F_2x.png",
"data": "",
"text": "抽烟"
},
{
"icon": "emoji/aru/E4B88DE587BAE68980E69699_2x.png",
"data": "",
"text": "不出所料"
},
{
"icon": "emoji/aru/E684A4E68092_2x.png",
"data": "",
"text": "愤怒"
},
{
"icon": "emoji/aru/E697A0E5A588_2x.png",
"data": "",
"text": "无奈"
},
{
"icon": "emoji/aru/E9BB91E7BABF_2x.png",
"data": "",
"text": "黑线"
},
{
"icon": "emoji/aru/E68A95E9998D_2x.png",
"data": "",
"text": "投降"
},
{
"icon": "emoji/aru/E79C8BE783ADE997B9_2x.png",
"data": "",
"text": "看热闹"
},
{
"icon": "emoji/aru/E68987E880B3E58589_2x.png",
"data": "",
"text": "扇耳光"
},
{
"icon": "emoji/aru/E5B08FE79CBCE79D9B_2x.png",
"data": "",
"text": "小眼睛"
},
{
"icon": "emoji/aru/E4B8ADE58880_2x.png",
"data": "",
"text": "中刀"
}
]
},
"泡泡": {
"type": "image",
"container": [
{
"icon": "emoji/paopao/E591B5E591B5_2x.png",
"data": "",
"text": "呵呵"
},
{
"icon": "emoji/paopao/E59388E59388_2x.png",
"data": "",
"text": "哈哈"
},
{
"icon": "emoji/paopao/E59090E8888C_2x.png",
"data": "",
"text": "吐舌"
},
{
"icon": "emoji/paopao/E5A4AAE5BC80E5BF83_2x.png",
"data": "",
"text": "太开心"
},
{
"icon": "emoji/paopao/E7AC91E79CBC_2x.png",
"data": "",
"text": "笑眼"
},
{
"icon": "emoji/paopao/E88AB1E5BF83_2x.png",
"data": "",
"text": "花心"
},
{
"icon": "emoji/paopao/E5B08FE4B996_2x.png",
"data": "",
"text": "小乖"
},
{
"icon": "emoji/paopao/E4B996_2x.png",
"data": "",
"text": "乖"
},
{
"icon": "emoji/paopao/E68D82E598B4E7AC91_2x.png",
"data": "",
"text": "捂嘴笑"
},
{
"icon": "emoji/paopao/E6BB91E7A8BD_2x.png",
"data": "",
"text": "滑稽"
},
{
"icon": "emoji/paopao/E4BDA0E68782E79A84_2x.png",
"data": "",
"text": "你懂的"
},
{
"icon": "emoji/paopao/E4B88DE9AB98E585B4_2x.png",
"data": "",
"text": "不高兴"
},
{
"icon": "emoji/paopao/E68092_2x.png",
"data": "",
"text": "怒"
},
{
"icon": "emoji/paopao/E6B197_2x.png",
"data": "",
"text": "汗"
},
{
"icon": "emoji/paopao/E9BB91E7BABF_2x.png",
"data": "",
"text": "黑线"
},
{
"icon": "emoji/paopao/E6B3AA_2x.png",
"data": "",
"text": "泪"
},
{
"icon": "emoji/paopao/E79C9FE6A392_2x.png",
"data": "",
"text": "真棒"
},
{
"icon": "emoji/paopao/E596B7_2x.png",
"data": "",
"text": "喷"
},
{
"icon": "emoji/paopao/E6838AE593AD_2x.png",
"data": "",
"text": "惊哭"
},
{
"icon": "emoji/paopao/E998B4E999A9_2x.png",
"data": "",
"text": "阴险"
},
{
"icon": "emoji/paopao/E98499E8A786_2x.png",
"data": "",
"text": "鄙视"
},
{
"icon": "emoji/paopao/E985B7_2x.png",
"data": "",
"text": "酷"
},
{
"icon": "emoji/paopao/E5958A_2x.png",
"data": "",
"text": "啊"
},
{
"icon": "emoji/paopao/E78B82E6B197_2x.png",
"data": "",
"text": "狂汗"
},
{
"icon": "emoji/paopao/what_2x.png",
"data": "",
"text": "what"
},
{
"icon": "emoji/paopao/E79691E997AE_2x.png",
"data": "",
"text": "疑问"
},
{
"icon": "emoji/paopao/E985B8E788BD_2x.png",
"data": "",
"text": "酸爽"
},
{
"icon": "emoji/paopao/E59180E592A9E788B9_2x.png",
"data": "",
"text": "呀咩爹"
},
{
"icon": "emoji/paopao/E5A794E5B188_2x.png",
"data": "",
"text": "委屈"
},
{
"icon": "emoji/paopao/E6838AE8AEB6_2x.png",
"data": "",
"text": "惊讶"
},
{
"icon": "emoji/paopao/E79DA1E8A789_2x.png",
"data": "",
"text": "睡觉"
},
{
"icon": "emoji/paopao/E7AC91E5B0BF_2x.png",
"data": "",
"text": "笑尿"
},
{
"icon": "emoji/paopao/E68C96E9BCBB_2x.png",
"data": "",
"text": "挖鼻"
},
{
"icon": "emoji/paopao/E59090_2x.png",
"data": "",
"text": "吐"
},
{
"icon": "emoji/paopao/E78A80E588A9_2x.png",
"data": "",
"text": "犀利"
},
{
"icon": "emoji/paopao/E5B08FE7BAA2E884B8_2x.png",
"data": "",
"text": "小红脸"
},
{
"icon": "emoji/paopao/E68792E5BE97E79086_2x.png",
"data": "",
"text": "懒得理"
},
{
"icon": "emoji/paopao/E58B89E5BCBA_2x.png",
"data": "",
"text": "勉强"
},
{
"icon": "emoji/paopao/E788B1E5BF83_2x.png",
"data": "",
"text": "爱心"
},
{
"icon": "emoji/paopao/E5BF83E7A28E_2x.png",
"data": "",
"text": "心碎"
},
{
"icon": "emoji/paopao/E78EABE791B0_2x.png",
"data": "",
"text": "玫瑰"
},
{
"icon": "emoji/paopao/E7A4BCE789A9_2x.png",
"data": "",
"text": "礼物"
},
{
"icon": "emoji/paopao/E5BDA9E899B9_2x.png",
"data": "",
"text": "彩虹"
},
{
"icon": "emoji/paopao/E5A4AAE998B3_2x.png",
"data": "",
"text": "太阳"
},
{
"icon": "emoji/paopao/E6989FE6989FE69C88E4BAAE_2x.png",
"data": "",
"text": "星星月亮"
},
{
"icon": "emoji/paopao/E992B1E5B881_2x.png",
"data": "",
"text": "钱币"
},
{
"icon": "emoji/paopao/E88CB6E69DAF_2x.png",
"data": "",
"text": "茶杯"
},
{
"icon": "emoji/paopao/E89B8BE7B395_2x.png",
"data": "",
"text": "蛋糕"
},
{
"icon": "emoji/paopao/E5A4A7E68B87E68C87_2x.png",
"data": "",
"text": "大拇指"
},
{
"icon": "emoji/paopao/E8839CE588A9_2x.png",
"data": "",
"text": "胜利"
},
{
"icon": "emoji/paopao/haha_2x.png",
"data": "",
"text": "haha"
},
{
"icon": "emoji/paopao/OK_2x.png",
"data": "",
"text": "OK"
},
{
"icon": "emoji/paopao/E6B299E58F91_2x.png",
"data": "",
"text": "沙发"
},
{
"icon": "emoji/paopao/E6898BE7BAB8_2x.png",
"data": "",
"text": "手纸"
},
{
"icon": "emoji/paopao/E9A699E89589_2x.png",
"data": "",
"text": "香蕉"
},
{
"icon": "emoji/paopao/E4BEBFE4BEBF_2x.png",
"data": "",
"text": "便便"
},
{
"icon": "emoji/paopao/E88DAFE4B8B8_2x.png",
"data": "",
"text": "药丸"
},
{
"icon": "emoji/paopao/E7BAA2E9A286E5B7BE_2x.png",
"data": "",
"text": "红领巾"
},
{
"icon": "emoji/paopao/E89CA1E7839B_2x.png",
"data": "",
"text": "蜡烛"
},
{
"icon": "emoji/paopao/E99FB3E4B990_2x.png",
"data": "",
"text": "音乐"
},
{
"icon": "emoji/paopao/E781AFE6B3A1_2x.png",
"data": "",
"text": "灯泡"
},
{
"icon": "emoji/paopao/E5BC80E5BF83_2x.png",
"data": "",
"text": "开心"
},
{
"icon": "emoji/paopao/E992B1_2x.png",
"data": "",
"text": "钱"
},
{
"icon": "emoji/paopao/E592A6_2x.png",
"data": "",
"text": "咦"
},
{
"icon": "emoji/paopao/E591BC_2x.png",
"data": "",
"text": "呼"
},
{
"icon": "emoji/paopao/E586B7_2x.png",
"data": "",
"text": "冷"
},
{
"icon": "emoji/paopao/E7949FE6B094_2x.png",
"data": "",
"text": "生气"
},
{
"icon": "emoji/paopao/E5BCB1_2x.png",
"data": "",
"text": "弱"
}
]
},
"卡哇伊": {
"type": "image",
"container": [
{
"icon": "emoji/kawayi/可爱1.png",
"data": "",
"text": "可爱1"
},
{
"icon": "emoji/kawayi/含棍棍.png",
"data": "",
"text": "含棍棍"
},
{
"icon": "emoji/kawayi/喝水水.png",
"data": "",
"text": "喝水水"
},
{
"icon": "emoji/kawayi/发呆.png",
"data": "",
"text": "发呆"
},
{
"icon": "emoji/kawayi/无辜.png",
"data": "",
"text": "无辜"
},
{
"icon": "emoji/kawayi/装B.png",
"data": "",
"text": "装B"
}
]
},
"蛆音娘": {
"type": "image",
"container": [
{
"icon": "emoji/quyin/hematemesis.png",
"data": "",
"text": "hematemesis"
},
{
"icon": "emoji/quyin/1huaji.png",
"data": "",
"text": "1huaji"
},
{
"icon": "emoji/quyin/amazing.png",
"data": "",
"text": "amazing"
},
{
"icon": "emoji/quyin/angry.png",
"data": "",
"text": "angry"
},
{
"icon": "emoji/quyin/cry.png",
"data": "",
"text": "cry"
},
{
"icon": "emoji/quyin/die.png",
"data": "",
"text": "die"
},
{
"icon": "emoji/quyin/doubt.png",
"data": "",
"text": "doubt"
},
{
"icon": "emoji/quyin/feizao.png",
"data": "",
"text": "feizao"
},
{
"icon": "emoji/quyin/fue.png",
"data": "",
"text": "fue"
},
{
"icon": "emoji/quyin/heng.png",
"data": "",
"text": "heng"
},
{
"icon": "emoji/quyin/laughing.png",
"data": "",
"text": "laughing"
},
{
"icon": "emoji/quyin/look.png",
"data": "",
"text": "look"
},
{
"icon": "emoji/quyin/maimeng.png",
"data": "",
"text": "maimeng"
},
{
"icon": "emoji/quyin/OK.png",
"data": "",
"text": "OK"
},
{
"icon": "emoji/quyin/scare.png",
"data": "",
"text": "scare"
},
{
"icon": "emoji/quyin/shakinghead.png",
"data": "",
"text": "shakinghead"
},
{
"icon": "emoji/quyin/sleep.png",
"data": "",
"text": "sleep"
},
{
"icon": "emoji/quyin/speechless.png",
"data": "",
"text": "speechless"
},
{
"icon": "emoji/quyin/watermaleon.png",
"data": "",
"text": "watermaleon"
},
{
"icon": "emoji/quyin/witty.png",
"data": "",
"text": "witty"
}
]
},
"B站":{
"type": "image",
"container":[
{
"icon": "emoji/BZ/33_yiwen.png",
"data": "",
"text": "33_yiwen"
},{
"icon": "emoji/BZ/22_yiwen.png",
"data": "",
"text": "22_yiwen"
},{
"icon": "emoji/BZ/22_daxiao.png",
"data": "",
"text": "22_daxiao"
},{
"icon": "emoji/BZ/33_han.png",
"data": "",
"text": "33_han"
},{
"icon": "emoji/BZ/22_daku.png",
"data": "",
"text": "22_daku"
},{
"icon": "emoji/BZ/33_hecha.png",
"data": "",
"text": "33_hecha"
},{
"icon": "emoji/BZ/33_no1.png",
"data": "",
"text": "33_no1"
},{
"icon": "emoji/BZ/22_yumen.png",
"data": "",
"text": "22_yumen"
},{
"icon": "emoji/BZ/22_weiqu.png",
"data": "",
"text": "22_weiqu"
},{
"icon": "emoji/BZ/22_chijing.png",
"data": "",
"text": "22_chijing"
},{
"icon": "emoji/BZ/33_maimeng.png",
"data": "",
"text": "33_maimeng"
},{
"icon": "emoji/BZ/33_yeah.png",
"data": "",
"text": "33_yeah"
},{
"icon": "emoji/BZ/33_tuhun.png",
"data": "",
"text": "33_tuhun"
},{
"icon": "emoji/BZ/22_nu.png",
"data": "",
"text": "22_nu"
},{
"icon": "emoji/BZ/33_wuyan.png",
"data": "",
"text": "33_wuyan"
},{
"icon": "emoji/BZ/ds_xiao.png",
"data": "",
"text": "ds_xiao"
},{
"icon": "emoji/BZ/ds_han.png",
"data": "",
"text": "ds_han"
},{
"icon": "emoji/BZ/ds_fachou.png",
"data": "",
"text": "ds_fachou"
},{
"icon": "emoji/BZ/ds_duzui.png",
"data": "",
"text": "ds_duzui"
},{
"icon": "emoji/BZ/ds_haonua.png",
"data": "",
"text": "ds_haonua"
},{
"icon": "emoji/BZ/ds_zan.png",
"data": "",
"text": "ds_zan"
},{
"icon": "emoji/BZ/ds_kuqi.png",
"data": "",
"text": "ds_kuqi"
},{
"icon": "emoji/BZ/ds_chaping.png",
"data": "",
"text": "ds_chaping"
},{
"icon": "emoji/BZ/ds_chijing.png",
"data": "",
"text": "ds_chijing"
},{
"icon": "emoji/BZ/ds_kunhuo.png",
"data": "",
"text": "ds_kunhuo"
},{
"icon": "emoji/BZ/ds_xf.png",
"data": "",
"text": "ds_xf"
},{
"icon": "emoji/BZ/ds_haixiu.png",
"data": "",
"text": "ds_haixiu"
},{
"icon": "emoji/BZ/ds_ttlike.png",
"data": "",
"text": "ds_ttlike"
},{
"icon": "emoji/BZ/ds_sisuo.png",
"data": "",
"text": "ds_sisuo"
},{
"icon": "emoji/BZ/re_miao.png",
"data": "",
"text": "re_miao"
},{
"icon": "emoji/BZ/re_hai.png",
"data": "",
"text": "re_hai"
},{
"icon": "emoji/BZ/re_ynwl.png",
"data": "::(re_ynwl)",
"text": "re_ynwl"
},{
"icon": "emoji/BZ/re_gaochan.png",
"data": "",
"text": "re_gaochan"
},{
"icon": "emoji/BZ/re_wkl.png",
"data": "",
"text": "re_wkl"
},{
"icon": "emoji/BZ/re_bksn.png",
"data": "",
"text": "re_bksn"
},{
"icon": "emoji/BZ/re_chui.png",
"data": "",
"text": "re_chui"
},{
"icon": "emoji/BZ/re_xiu.png",
"data": "",
"text": "re_xiu"
},{
"icon": "emoji/BZ/re_nxp.png",
"data": "",
"text": "re_nxp"
},{
"icon": "emoji/BZ/re_daka.png",
"data": "",
"text": "re_daka"
},{
"icon": "emoji/BZ/re_suan.png",
"data": "",
"text": "re_suan"
},{
"icon": "emoji/BZ/re_qgzs.png",
"data": "",
"text": "re_qgzs"
},{
"icon": "emoji/BZ/re_wtnl.png",
"data": "",
"text": "re_wtnl"
},{
"icon": "emoji/BZ/re_cb.png",
"data": "",
"text": "re_cb"
},{
"icon": "emoji/BZ/re_keyi.png",
"data": "",
"text": "re_keyi"
},{
"icon": "emoji/BZ/re_olg.png",
"data": "",
"text": "re_olg"
},{
"icon": "emoji/BZ/re_awsl.png",
"data": "",
"text": "re_awsl"
},{
"icon": "emoji/BZ/re_zxa.png",
"data": "::(re_zxa)",
"text": "re_zxa"
},{
"icon": "emoji/BZ/re_zsmq.png",
"data": "::(re_zsmq)",
"text": "re_zsmq"
},{
"icon": "emoji/BZ/re_mnbk.png",
"data": "",
"text": "re_mnbk"
}
]
}
}
ctx.php修改
代码语言:javascript复制<?php
/**
* Author: Veen Zhao
* CreateTime: 2020/9/7 22:20
* 内容渲染类
*/
class Ctx
{
//完备标题输出
public static function EchoTitle(Widget_Archive $archive)
{
if ($archive->is('index') && Helper::options()->站点副标题) {
return Helper::options()->title . ' - ' . Helper::options()->站点副标题;
} else {
$archive->archiveTitle(array(
'category' => '分类 %s 下的文章',
'search' => '包含关键字 %s 的文章',
'tag' => '标签 %s 下的文章',
'author' => '%s 发布的文章'
), '', ' - ');
return Helper::options()->title;
}
}
//favicon输出
public static function EchoFavicon()
{
$icon = Helper::options()->站点图标;
if ($icon) {
$res = '<link rel="icon" type="image/png" href="' . $icon . '">';
$res .= '<link rel="apple-touch-icon-precomposed" href="' . $icon . '">';
} else {
$res = '<link rel="icon" type="image/png" href="' . App::HomeUrl('favicon.ico') . '">';
$res .= '<link rel="apple-touch-icon-precomposed" href="' . App::HomeUrl('favicon.ico') . '">';
}
return $res;
}
//DNS预解析
public static function DnsPrefetch()
{
$dns = '<link rel="dns-prefetch" href="//fonts.googleapis.com"><link rel="dns-prefetch" href="//cdn.jsdelivr.net">';
if (Helper::options()->Dns预解析) {
$dns .= Helper::options()->Dns预解析;
}
return $dns;
}
//logo输出
public static function EchoLogo()
{
if (Helper::options()->logoUrl) {
$logo = '<img src="' . Helper::options()->logoUrl . '" class="d-inline-block siteLogo" alt="">';
} else {
$logo = Helper::options()->title;
}
return $logo;
}
//分类输出
private static function ArchiverSort($var)
{
$sort = null;
$i = 0;
while ($var->next()) {
if ($var->levels === 0) {
$children = $var->getAllChildren($var->mid);
if (empty($children)) {
$sort .= '<li class="nav-item"><a class="nav-link" href="' . $var->permalink . '">' . self::IconArray()[0][$i] . $var->name . '</a></li>';
} else {
$sort .= '<li class="nav-item dropdown">';
$sort .= '<a class="nav-link dropdown-toggle" id="sort' . $i . '" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">' . self::IconArray()[0][$i] . $var->name . '</a>';
$sort .= '<div class="dropdown-menu" aria-labelledby="sort' . $i . '">';
foreach ($children as $mid) {
$child = $var->getCategory($mid);
$sort .= ' <a class="dropdown-item" href="' . $child['permalink'] . '"><span>' . $child['name'] . '</span></a>';
$i--;
}
$sort .= '</div></li>';
}
}
$i ;
}
return $sort;
}
//页面输出
private static function EchoPages($var)
{
$page = null;
$i = 0;
if (empty(Helper::options()->合并独立页面)) {
while ($var->next()) {
$page .= '<li class="nav-item"><a class="nav-link" href="' . $var->permalink . '">' . self::IconArray()[1][$i] . $var->title . '</a></li>';
$i ;
}
} else {
$pagesTitle = Helper::options()->合并独立页面导航名称 ? Helper::options()->合并独立页面导航名称 : '页面';
$page .= '<li class="nav-item dropdown">';
$page .= '<a class="nav-link dropdown-toggle" id="PagesAll" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">' . self::IconArray()[1][$i] . $pagesTitle . '</a>';
$page .= '<div class="dropdown-menu" aria-labelledby="PagesAll">';
while ($var->next()) {
$page .= ' <a class="dropdown-item" href="' . $var->permalink . '"><span>' . $var->title . '</span></a>';
}
$page .= '</div></li>';
}
return $page . self::MyPageUrl();
}
//分类和独立页面顺序设置
public static function OrderSet($p, $c)
{
if (Helper::options()->分独顺序 == '独前分后') {
return self::EchoPages($p) . self::ArchiverSort($c);
} elseif (Helper::options()->分独顺序 == '分前独后') {
return self::ArchiverSort($c) . self::EchoPages($p);
} else {
return self::EchoPages($p) . self::ArchiverSort($c);
}
}
//提取图标数组
private static function IconArray()
{
$cat = explode("n", Helper::options()->分类图标);
$pag = explode("n", Helper::options()->页面图标);
return array($cat, $pag);
}
//自定义导航链接
private static function MyPageUrl()
{
$page = null;
if (!empty(Helper::options()->自定义页面链接)) {
$text = explode("n", Helper::options()->自定义页面链接);
foreach ($text as $url) {
$c = substr_replace($url, ' class="nav-link" ', 2, 0);
$page .= '<li class="nav-item">' . $c . '</li>';
}
}
return $page;
}
//解析歌单url
public static function ParseMusic($url)
{
$media = null;
$id = null;
$type = null;
if (empty($url)) {
return array('media' => 'media', 'id' => 'id', 'type' => 'type');
}
if (strpos($url, '163.com') !== false) {
$media = 'netease';
if (preg_match('/playlist?id=(d )/i', $url, $id)) list($id, $type) = array($id[1], 'playlist');
elseif (preg_match('/toplist?id=(d )/i', $url, $id)) list($id, $type) = array($id[1], 'playlist');
elseif (preg_match('/album?id=(d )/i', $url, $id)) list($id, $type) = array($id[1], 'album');
elseif (preg_match('/song?id=(d )/i', $url, $id)) list($id, $type) = array($id[1], 'song');
elseif (preg_match('/artist?id=(d )/i', $url, $id)) list($id, $type) = array($id[1], 'artist');
} elseif (strpos($url, 'qq.com') !== false) {
$media = 'tencent';
if (preg_match('/playlist/([^.]*)/i', $url, $id)) list($id, $type) = array($id[1], 'playlist');
elseif (preg_match('/album/([^.]*)/i', $url, $id)) list($id, $type) = array($id[1], 'album');
elseif (preg_match('/song/([^.]*)/i', $url, $id)) list($id, $type) = array($id[1], 'song');
elseif (preg_match('/singer/([^.]*)/i', $url, $id)) list($id, $type) = array($id[1], 'artist');
}
return array('media' => $media, 'id' => $id, 'type' => $type);
}
//移动自定义导航链接
private static function MobileMyPageUrl()
{
$page = null;
if (!empty(Helper::options()->自定义页面链接)) {
$text = explode("n", Helper::options()->自定义页面链接);
foreach ($text as $url) {
$c = substr_replace($url, ' ', 2, 0);
$page .= '<li>' . $c . '</li>';
}
}
return $page;
}
//移动端页面输出
private static function MobileEchoPages($var)
{
$page = null;
$i = 0;
$page .= '<hr><ul class="aside-pages px-3 list-unstyled small"><li class="d-inline-flex align-items-center"><svg class="icon mr-2" aria-hidden="true"><use xlink:href="#paperclip"></use></svg>独立页面</li>';
while ($var->next()) {
$page .= '<li><a onclick="Cuteen.bodyClose();" href="' . $var->permalink . '">' . self::IconArray()[1][$i] . $var->title . '</a></li>';
$i ;
}
$page .= self::MobileMyPageUrl() . '</ul>';
return $page;
}
//移动端分类列表输出
private static function MobileArchiverSort($var)
{
$sort = null;
$i = 0;
$sort .= '<hr><ul class="aside-sort list-unstyled small"><li class="px-3 d-inline-flex align-items-center"><svg class="icon mr-2" aria-hidden="true"><use xlink:href="#paperclip"></use></svg>分类页面</li>';
while ($var->next()) {
if ($var->levels === 0) {
$children = $var->getAllChildren($var->mid);
if (empty($children)) {
$sort .= '<li><a href="' . $var->permalink . '">' . self::IconArray()[0][$i] . $var->name . '</a></li>';
} else {
$sort .= '<li class="d-flex align-items-center justify-content-between" data-toggle="collapse" data-target="#sort' . $i . '" aria-expanded="false" aria-controls="collapseExample"><span>' . self::IconArray()[0][$i] . $var->name . '</span><svg class="icon" aria-hidden="true"><use xlink:href="#chevron-right"></use></svg></li>';
$sort .= '<div class="collapse aside-children" id="sort' . $i . '">';
foreach ($children as $mid) {
$child = $var->getCategory($mid);
$sort .= '<div><a href="' . $child['permalink'] . '">' . $child['name'] . '</a></div>';
$i--;
}
$sort .= '</div>';
}
}
$i ;
}
$sort .= '</ul>';
return $sort;
}
//移动端分类和独立页面顺序设置
public static function MobileOrderSet($p, $c)
{
if (Helper::options()->分独顺序 == '独前分后') {
return self::MobileEchoPages($p) . self::MobileArchiverSort($c);
} elseif (Helper::options()->分独顺序 == '分前独后') {
return self::MobileArchiverSort($c) . self::MobileEchoPages($p);
} else {
return self::MobileEchoPages($p) . self::MobileArchiverSort($c);
}
}
//状态栏状态
public static function NavBarInitial()
{
if (Helper::options()->顶部大图) {
return 'bg-transparent has-img';
} else {
return 'bg-blur no-img';
}
}
//大图高度
public static function ImgHeight()
{
if (Helper::options()->大图高度) {
return 'style="height : ' . Helper::options()->大图高度 . '";';
} else {
return '';
}
}
//大图大标题
public static function HeroTitle($ctx)
{
$big = null;
$small = null;
if ($ctx->is('index')) {
if (Helper::options()->首页大标题) {
$big = Helper::options()->首页大标题;
} else {
$big = Helper::options()->title;
}
if (Helper::options()->首页小标题) {
$small = Helper::options()->首页小标题;
} else {
$small = Helper::options()->description;
}
} elseif ($ctx->is('post')) {
$big = $ctx->title;
$small = '
<span class="post-info"><svg class="icon mr-1" aria-hidden="true"><use xlink:href="#shijian"></use></svg>' . date("Y年m月d日", $ctx->date->timeStamp) . '</span>
<span class="post-info"><svg class="icon mr-1" aria-hidden="true"><use xlink:href="#huo"></use></svg>' . App::getPostViews($ctx) . '阅读</span>
<span class="post-info"><svg class="icon mr-1" aria-hidden="true"><use xlink:href="#bidianliang"></use></svg>' . App::getWordCount($ctx->cid) . ' 字</span>
<span class="post-info"><svg class="icon mr-1" aria-hidden="true"><use xlink:href="#pinglun1"></use></svg>' . $ctx->commentsNum . ' 条评论</span>';
} else {
$big = $ctx->title;
$small = $ctx->fields->excerpt ?? '';
}
return array($big, $small);
}
//无图大标题输出
public static function HeroTitleNoImg($ctx)
{
$str = null;
if (!Helper::options()->顶部大图) {
$str = '<h2>' . $ctx->title . '</h2>';
$str .= '<div class="post-noimg-nav">';
$str .= Ctx::HeroTitle($ctx)[1];
$str .= '</div><hr>';
}
return $str;
}
//文章摘要输出
private static function Excerpt($content, $limit, $ctx)
{
if ($ctx->fields->excerpt) {
return $ctx->fields->excerpt;
} else {
$content = self::ExceptShortCodeContent($content);
return Typecho_Common::subStr(strip_tags($content), 0, $limit, "...");
}
}
//短代码排除
private static function ExceptShortCodeContent($content)
{
$v = array(
'BlurText', 'DarkBText', 'RainBowText', 'photos', 'hide', 'tabs', 'card', 'button', 'quote', 'acc',
'progress', 'video', 'audio', 'link', 'friends', 'BiliVideo'
);
foreach ($v as $l) {
if (strpos($content, '[' . $l) !== false) {
$pattern = get_shortcode_regex(array($l));
$content = preg_replace("/$pattern/", '', $content);
}
}
$content = preg_replace('/$$[sS]*$$/sm', '', $content);
return $content;
}
//列表图片输出
public static function ImageEcho($options)
{
if ($options->fields->imgst) {
return $options->fields->imgst;
} else {
if (Helper::options()->随机图) {
$text = Helper::options()->随机图;
$img_arr = explode("n", $text);
$rand_num = rand(1, count($img_arr));
return $img_arr[$rand_num - 1];
} else {
return 'https://tvax1.sinaimg.cn/large/0084aYsLly1gj5l4cjjkij31uo11igu2.jpg';
}
}
}
//顶部大图输出
public static function HeroImage($ctx)
{
$img = null;
if ($ctx->is('post') || $ctx->is('page')) {
$img = self::ImageEcho($ctx);
} else {
$img = Helper::options()->顶部大图链接;
}
return trim($img);
}
//经典列表输出
private static function ListArray($ctx)
{
$a = null;
$b = null;
$c = null;
$img = self::ImageEcho($ctx);
if (Helper::options()->列表背景设置 == '毛玻璃背景') {
$a = '<div class="blur-img"><img class="lazy" data-src="' . $img . '" alt="' . $ctx->title . '"></div>';
$b = 'article';
} else {
$a = '';
$b = 'article no-bg-img';
}
if (Helper::options()->列表图片效果 == '右斜切') {
$c = 'img-right';
} elseif (Helper::options()->列表图片效果 == '左斜切') {
$c = 'img-left';
} else {
$c = '';
}
return array($a, $b, $img, $c);
}
private static function HaveImageArchives($ctx)
{
$section = null;
$img = null;
while ($ctx->next()) {
$what = self::ListArray($ctx);
if (Helper::options()->列表设置 == '图片居左') {
$section .= '<article class="' . $what[1] . ' have-img d-flex">';
} elseif (Helper::options()->列表设置 == '图片居右') {
$section .= '<article class="' . $what[1] . ' have-img d-flex flex-row-reverse">';
} elseif (Helper::options()->列表设置 == '图片左右交叉') {
if ($ctx->sequence % 2 == 0) {
$section .= '<article class="' . $what[1] . ' have-img d-flex flex-row-reverse">';
} else {
$section .= '<article class="' . $what[1] . ' have-img d-flex">';
}
} else {
$section .= '<article class="' . $what[1] . ' have-img d-flex">';
}
$section .= $what[0];
$section .= '<a class="article-img ' . $what[3] . '" href="' . $ctx->permalink . '"><img class="lazy" data-src="' . $what[2] . '" alt="' . $ctx->title . '"></a>';
$section .= '<div class="article-ctx">';
$section .= '<header class="article-info">';
$section .= '<div class="article-time"><svg class="icon mr-1" aria-hidden="true"><use xlink:href="#shijian"></use></svg>' . date("Y-m-d", $ctx->date->timeStamp) . '</div>';
$section .= '<div class="article-vs">';
$section .= '<span class="article-views"><svg class="icon mr-1" aria-hidden="true"><use xlink:href="#huo"></use></svg>' . App::getPostViews($ctx) . '<div class="readText">阅读</div></span>';
$section .= '<a href="' . $ctx->categories[0]['permalink'] . '" class="article-sort a-none"><svg class="icon mx-1" aria-hidden="true"><use xlink:href="#biaoqian"></use></svg>' . $ctx->categories[0]['name'] . '</a>';
$section .= '</div></header>';
$section .= '<a class="article-title a-none" href="' . $ctx->permalink . '">' . $ctx->title . '</a>';
$section .= '<a class="article-description a-none" href="' . $ctx->permalink . '">' . self::Excerpt($ctx->excerpt, 100, $ctx) . '</a>';
$section .= '</div></article>';
}
return $section;
}
private static function NoImageArchives($ctx)
{
$section = null;
while ($ctx->next()) {
$section .= '<article class="article no-img d-flex">';
$section .= '<div class="article-ctx">';
$section .= '<header class="article-info">';
$section .= '<div class="article-time"><svg class="icon mr-1" aria-hidden="true"><use xlink:href="#shijian"></use></svg>' . date("Y-m-d", $ctx->date->timeStamp) . '</div>';
$section .= '<div class="article-vs">';
$section .= '<span class="article-views"><svg class="icon mr-1" aria-hidden="true"><use xlink:href="#huo"></use></svg>' . App::getPostViews($ctx) . '阅读</span>';
$section .= '<a href="' . $ctx->categories[0]['permalink'] . '" class="article-sort a-none"><svg class="icon mx-1" aria-hidden="true"><use xlink:href="#biaoqian"></use></svg>' . $ctx->categories[0]['name'] . '</a>';
$section .= '</div></header>';
$section .= '<a class="article-title a-none" href="' . $ctx->permalink . '">' . $ctx->title . '</a>';
$section .= '<a class="article-description a-none" href="' . $ctx->permalink . '">' . self::Excerpt($ctx->excerpt, 100, $ctx) . '</a>';
$section .= '</div></article>';
}
return $section;
}
//经典卡片输出
public static function ColumnSize()
{
if (Helper::options()->首页风格 == '卡片风格') {
if (Helper::options()->侧边栏 && in_array('外页', Helper::options()->侧边栏显示位置)) {
$size = array('col-lg-4', 'col-lg-9 cardMode');
} else {
$size = array('col-lg-3', 'col-lg-12 cardMode');
}
} else {
$size = array('col-lg-3', 'col-lg-9');
}
return $size;
}
private static function CardStyleArchives($ctx)
{
$section = '<div class="row">';
while ($ctx->next()) {
$section .= '<div class="article card-style col-6 col-sm-6 col-md-4 ' . self::ColumnSize()[0] . '">';
$section .= '<div class="card card-style-box h-100">';
$section .= '<img data-src="' . self::ImageEcho($ctx) . '" class="card-style-img lazy">';
$section .= '<div class="card-body card-style-body">';
$section .= '<div class="card-style-tags">';
$section .= '<a class="card-style-tags-link a-none" href="' . $ctx->categories[0]['permalink'] . '">' . $ctx->categories[0]['name'] . '</a></div>';
$section .= '<a href="' . $ctx->permalink . '" class="card-style-title a-none">' . $ctx->title . '</a></div>';
$section .= '<div class="card-style-footer">';
$section .= '<div class="meta-date">
<time>
<svg class="icon mr-1" aria-hidden="true">
<use xlink:href="#shijian"></use>
</svg>
' . date("Y-m-d", $ctx->date->timeStamp) . '
</time>
</div>';
$section .= '<div class="meta-views">
<div>
<svg class="icon mr-1" aria-hidden="true">
<use xlink:href="#huo"></use>
</svg>
' . App::getPostViews($ctx) . '
</div>
</div>';
$section .= '</div>
</div></div>
';
}
$section .= '</div>';
return $section;
}
public static function Article($var)
{
if (Helper::options()->首页风格 == '列表风格') {
return self::HaveImageArchives($var);
} elseif (Helper::options()->首页风格 == '卡片风格') {
return self::CardStyleArchives($var);
} elseif (Helper::options()->首页风格 == '无图风格') {
return self::NoImageArchives($var);
} else {
return self::NoImageArchives($var);
}
}
//侧边栏渲染
public static function Sidebar($var)
{
if (Helper::options()->侧边栏) {
if (in_array('外页', Helper::options()->侧边栏显示位置)) {
if ($var->is('index') || $var->is('archive')) {
$var->need('base/sidebar.php');
}
}
if (in_array('内页', Helper::options()->侧边栏显示位置)) {
if ($var->is('page') || $var->is('post')) {
$var->need('base/sidebar.php');
}
}
} else {
return '';
}
return false;
}
//侧边栏信息
public static function SidebarArray()
{
$a = null;
$b = null;
$c = null;
if (Helper::options()->侧边栏左右 == '左') {
$a = '';
} elseif (Helper::options()->侧边栏左右 == '右') {
$a = 'flex-row-reverse';
} else {
$a = '';
}
return array($a);
}
//文章输出
public static function Post($ctx, $login)
{
return self::parseHeader(self::parseShortCode(self::ParseEmoji(self::ParseImage(self::Hide($ctx, $login)))));
}
//评论输出
public static function Comment($ctx)
{
return self::parseShortCode(self::ParseEmoji(self::ParseImage($ctx)));
}
//回复可见功能
public static function Hide($ctx, $login)
{
$db = Typecho_Db::get();
$sql = $db->select()->from('table.comments')
->where('cid = ?', $ctx->cid)
->where('mail = ?', $ctx->remember('mail', true))
->where('status = ?', 'approved')
->limit(1);
$result = $db->fetchAll($sql);
if ($login || $result) {
$content = preg_replace("/[hide](.*?)[/hide]/sm", '$1', $ctx->content);
} else {
$content = preg_replace("/[hide](.*?)[/hide]/sm", '<div class="reply2view">此处内容需要评论<a onclick="document.getElementById(`comments`).scrollIntoView({behavior: `smooth`});">回复</a>后方可阅读</div>', $ctx->content);
}
return $content;
}
//解析短代码
private static function parseShortCode($content)
{
$content = do_shortcode($content);
return $content;
}
//解析文章内图片
private static function ParseImage($content)
{
$reg = '/<img(.*?)src="(.*?)"(.*?)>/s';
$rp = '<a class="lightbox" href="${2}"><img${1} class="lazy" data-src="${2}"${3}></a>';
return preg_replace($reg, $rp, $content);
}
//解析表情
static public function ParseEmoji($content)
{
$content = preg_replace_callback(
'/::(s*(呵呵|哈哈|吐舌|太开心|笑眼|花心|小乖|乖|捂嘴笑|滑稽|你懂的|不高兴|怒|汗|黑线|泪|真棒|喷|惊哭|阴险|鄙视|酷|啊|狂汗|what|疑问|酸爽|呀咩爹|委屈|惊讶|睡觉|笑尿|挖鼻|吐|犀利|小红脸|懒得理|勉强|爱心|心碎|玫瑰|礼物|彩虹|太阳|星星月亮|钱币|茶杯|蛋糕|大拇指|胜利|haha|OK|沙发|手纸|香蕉|便便|药丸|红领巾|蜡烛|音乐|灯泡|开心|钱|咦|呼|冷|生气|弱|吐血)s*)/is',
array('Ctx', 'ParsePaoPao'),
$content
);
$content = preg_replace_callback(
'/:@(s*(高兴|小怒|脸红|内伤|装大款|赞一个|害羞|汗|吐血倒地|深思|不高兴|无语|亲亲|口水|尴尬|中指|想一想|哭泣|便便|献花|皱眉|傻笑|狂汗|吐|喷水|看不见|鼓掌|阴暗|长草|献黄瓜|邪恶|期待|得意|吐舌|喷血|无所谓|观察|暗地观察|肿包|中枪|大囧|呲牙|抠鼻|不说话|咽气|欢呼|锁眉|蜡烛|坐等|击掌|惊喜|喜极而泣|抽烟|不出所料|愤怒|无奈|黑线|投降|看热闹|扇耳光|小眼睛|中刀)s*)/is',
array('Ctx', 'ParseAru'),
$content
);
$content = preg_replace_callback(
'/::(s*(可爱1|含棍棍|喝水水|发呆|无辜|装B)s*)/is',
array('Ctx','ParseAc'),
$content
);
$content = preg_replace_callback(
'/::(s*(1huaji|amazing|angry|cry|die|doubt|feizao|fue|hematemesis|heng|laughing|look|maimeng|OK|scare|shakinghead|sleep|speechless|watermaleon|witty)s*)/is',
array('Ctx', 'ParseQuYin'),
$content
);
$content = preg_replace_callback(
'/::(s*(22_chijing|22_daku|22_daxiao|22_nu|22_weiqu|22_yiwen|22_yumen|33_han|33_hecha|33_maimeng|33_no1|33_tuhun|33_wuyan|33_yeah|33_yiwen|ds_chaping|ds_chijing|ds_duzui|ds_fachou|ds_haixiu|ds_han|ds_haonua|ds_kunhuo|ds_kuqi|ds_sisuo|ds_ttlike|ds_wuyu|ds_xf|ds_xiao|ds_zan|re_awsl|re_bksn|re_cb|re_chui|re_daka|re_gaochan|re_hai|re_keyi|re_miao|re_mnbk|re_nxp|re_olg|re_qgzs|re_suan|re_wkl|re_wtnl|re_xiu|re_ynwl
)s*)/is',
array('Ctx', 'ParseBilibili'),
$content
);
return $content;
}
//泡泡表情回调函数
private static function ParsePaoPao($match)
{
return '<img class="emoji lazy" data-src="' . StaticPath . '/emoji/paopao/' . str_replace('%', '', urlencode($match[1])) . '_2x.png">';
}
//阿鲁表情回调函数
private static function ParseAru($match)
{
return '<img class="emoji" src="' . StaticPath . '/emoji/aru/' . str_replace('%', '', urlencode($match[1])) . '_2x.png">';
}
//kawayi娘表情回调函数
private static function ParseAc($match)
{
return '<img class="emoji" src="' . StaticPath . '/emoji/kawayi/' . str_replace('%', '',urldecode($match[1])) . '.png">';
}
//蛆音娘表情回调函数
private static function ParseQuYin($match)
{
return '<img class="emoji" src="' . StaticPath . '/emoji/quyin/' . str_replace('%', '',urldecode($match[1])) . '.png">';
}
//Bilibili表情回调函数
private static function ParseBilibili($match)
{
return '<img class="emoji" src="' . StaticPath . '/emoji/BZ/' . str_replace('%', '',urldecode($match[1])) . '.png">';
}
//解析文章内 h2 ~ h5 元素
static public function parseHeader($content)
{
$reg = '/<h([1-6])(.*?)>(.*?)</h.*?>/s';
$new = preg_replace_callback($reg, array('Ctx', 'parseHeaderCallback'), $content);
return $new;
}
//为内容中的 h2-h6 元素编号
static private $CurrentTocID = 0;
static public function parseHeaderCallback($matchs)
{
// 增加单独标记,否则冲突
$id = 'toc_' . (self::$CurrentTocID );
return '<h' . $matchs[1] . $matchs[2] . ' id="' . $id . '">' . $matchs[3] . '</h' . $matchs[1] . '>';
}
//评论新标签
static public function CommentAuthor($obj, $autoLink = NULL, $noFollow = NULL)
{
$options = Helper::options();
$autoLink = $autoLink ? $autoLink : $options->commentsShowUrl;
$noFollow = $noFollow ? $noFollow : $options->commentsUrlNofollow;
if ($obj->url && $autoLink) {
return '<a class="a-none" href="' . $obj->url . '"' . ($noFollow ? ' rel="external nofollow"' : NULL) . (strstr($obj->url, $options->index) == $obj->url ? NULL : ' target="_blank"') . '>' . $obj->author . '</a>';
} else {
return $obj->author;
}
}
//评论信息
static public function CommentInfo($comments)
{
$info = null;
if ($comments->authorId == $comments->ownerId) {
$info .= '<span class="badge rounded-pill bg-primary font-weight-normal">站长</span>'; //如果是文章作者
} else {
$info .= '<span class="badge rounded-pill bg-secondary font-weight-normal">访客</span>'; //如果是评论作者
}
$info .= '<span class="comment-system">' . self::getBrowser($comments->agent) . '</span>';
$info .= '<span class="comment-system">' . self::getOs($comments->agent) . '</span>';
return $info;
}
//获取评论状态
static public function CommentStatus($comments){
if ('waiting' == $comments->status){
return '评论审核中……';
}else if ('approved' == $comments->status) {
return '';
}else{
return '';
}
}
//获取评论浏览器
private static function getBrowser($agent)
{
if (preg_match('/MSIEs([^s|;] )/i', $agent)) {
$getAgent = '<svg class="icon" aria-hidden="true"><use xlink:href="#ie"></use></svg><span>IE</span>';
} else if (preg_match('/FireFox/([^s] )/i', $agent)) {
$getAgent = '<svg class="icon" aria-hidden="true"><use xlink:href="#firefox"></use></svg><span>FireFox</span>';
} else if (preg_match('/Chrome([d]*)/([^s] )/i', $agent, $matches)) {
$getAgent = '<svg class="icon" aria-hidden="true"><use xlink:href="#chrome"></use></svg><span>Chrome</span>';
} else if (preg_match('/QQBrowser/([^s] )/i', $agent)) {
$getAgent = '<svg class="icon" aria-hidden="true"><use xlink:href="#QQliulanqilogo"></use></svg><span>QQ</span>';
} else if (preg_match('/UC/i', $agent)) {
$getAgent = '<svg class="icon" aria-hidden="true"><use xlink:href="#uc"></use></svg><span>UC</span>';
} else if (preg_match('/safari/([^s] )/i', $agent)) {
$getAgent = '<svg class="icon" aria-hidden="true"><use xlink:href="#safari"></use></svg><span>Safari</span>';
} elseif (preg_match('#SE 2([a-zA-Z0-9.] )#i', $agent)) {
$getAgent = '<svg class="icon" aria-hidden="true"><use xlink:href="#sougou"></use></svg><span>Sogou</span>';
} elseif (preg_match('#360([a-zA-Z0-9.] )#i', $agent)) {
$getAgent = '<svg class="icon" aria-hidden="true"><use xlink:href="#liulanqi"></use></svg><span>360</span>';
} elseif (preg_match('#Edge ([a-zA-Z0-9.] )#i', $agent)) {
$getAgent = '<svg class="icon" aria-hidden="true"><use xlink:href="#edge"></use></svg><span>Edge</span>';
} else {
$getAgent = '<svg class="icon" aria-hidden="true"><use xlink:href="#ie"></use></svg><span>Browser</span>';
}
return $getAgent;
}
//获取评论操作系统
private static function getOs($agent)
{
if (preg_match('/win/i', $agent)) {
$os = '<svg class="icon" aria-hidden="true"><use xlink:href="#win10"></use></svg><span>Windows</span>';
} else if (preg_match('/android/i', $agent)) {
$os = '<svg class="icon" aria-hidden="true"><use xlink:href="#anzhuo"></use></svg><span>Android</span>';
} else if (preg_match('/linux/i', $agent)) {
$os = '<svg class="icon" aria-hidden="true"><use xlink:href="#linux"></use></svg><span>Linux</span>';
} else if (preg_match('/mac/i', $agent)) {
$os = '<svg class="icon" aria-hidden="true"><use xlink:href="#pingguo"></use></svg><span>Mac</span>';
} else {
$os = '<svg class="icon" aria-hidden="true"><use xlink:href="#diannao"></use></svg><span>System</span>';
}
return $os;
}
//翻页
public static function pagination($index)
{
echo '<div class="All_Pagination">';
$index->pageNav(
'«',
'»',
1,
'...',
array(
'wrapTag' => 'ul',
'wrapClass' => 'prev',
'itemTag' => 'li',
'textTag' => 'a',
'currentClass' => 'active1',
'prevClass' => '',
'nextClass' => ''
)
);
echo '</div>';
}
//获取前10标签统计
public static function topTags($ctx)
{
$name = array();
$count = array();
$ctx->widget('Widget_Metas_Tag_Cloud', array('sort' => 'count', 'ignoreZeroCount' => true, 'desc' => true, 'limit' => 10))->to($tags);
while ($tags->next()) {
$name[] = $tags->name;
$count[] = $tags->count;
}
return array($name, $count);
}
//获取前6分类统计
public static function topSort($ctx)
{
$ctx->widget('Widget_Metas_Category_List')->to($sort);
while ($sort->next()) {
$name[] = [$sort->name, $sort->count];
}
foreach ($name as $k => $v) {
$count[] = $v[1];
}
array_multisort($count, SORT_DESC, $name);
$name = array_slice($name, 0, 6);
foreach ($name as $f => $g) {
$arr1[] = array('name' => $g[0], 'max' => $name[0][2] 2);
$arr2[] = $g[1];
}
return array($arr1, $arr2);
}
//获取前10个月文章发布数量
public static function postCount($widget)
{
$db = Typecho_Db::get();
$rows = $db->fetchAll($db->select()
->from('table.contents')
->order('table.contents.created', Typecho_Db::SORT_DESC)
->where('table.contents.type = ?', 'post')
->where('table.contents.status = ?', 'publish'));
$stat = array();
$data = array();
$a = array();
$b = array();
foreach ($rows as $row) {
$row = $widget->filter($row);
$stat[] = date('Y-m', $row['created']);
}
$arr = array_count_values($stat);
for ($i = 1; $i <= 10; $i ) {
$months[] = date("Y-m", strtotime(date('Y-m-01') . " -$i months"));
if (array_key_exists($months[$i - 1], $arr)) {
$data[$months[$i - 1]] = $arr[$months[$i - 1]];
} else {
$data[$months[$i - 1]] = 0;
}
}
foreach (array_reverse($data) as $key => $l) {
$a[] = $key;
$b[] = $l;
}
return array($a, $b);
}
//归档文章列表输出
public static function archives($widget)
{
$db = Typecho_Db::get();
$rows = $db->fetchAll($db->select()
->from('table.contents')
->order('table.contents.created', Typecho_Db::SORT_DESC)
->where('table.contents.type = ?', 'post')
->where('table.contents.status = ?', 'publish'));
$stat = array();
foreach ($rows as $row) {
$row = $widget->filter($row);
$arr = array(
'title' => $row['title'],
'permalink' => $row['permalink']
);
$stat[date('Y年 m月', $row['created'])][$row['created']] = $arr;
}
return $stat;
}
//已发布文章数量
public static function getPostNum()
{
$db = Typecho_Db::get();
return $db->fetchObject($db->select(array('COUNT(cid)' => 'num'))
->from('table.contents')
->where('table.contents.type = ?', 'post')
->where('table.contents.status = ?', 'publish'))->num;
}
//评论总数量,排除自己评论
public static function getCommentsNum()
{
$db = Typecho_Db::get();
return $db->fetchObject($db->select(array('COUNT(authorId)' => 'num'))
->from('table.comments')
->where('table.comments.authorId = ?', null)->where('table.comments.type=?', 'comment'))->num;
}
//标签数量
public static function getTagNum()
{
$db = Typecho_Db::get();
return $db->fetchObject($db->select(array('COUNT(mid)' => 'num'))
->from('table.metas')
->where('table.metas.type = ?', 'tag'))->num;
}
//文章置顶轮播
public static function PostTop($ctx)
{
$str = null;
$arr = null;
$i = 0;
$a = null;
$b = null;
if (Helper::options()->文章置顶) {
$CardTOP_CID = Helper::options()->文章置顶;
$ctx->widget('Widget_Post_CardTOP@CardTOP', 'CardTOP=' . $CardTOP_CID)->to($CardTOPSel);
while ($CardTOPSel->next()) {
if ($i == 0) {
$a .= '<li data-target="#postTop" data-slide-to="0" class="active"></li>';
$b .= '<div class="carousel-item active" data-interval="3000">';
} else {
$a .= '<li data-target="#postTop" data-slide-to="' . $i . '"></li>';
$b .= '<div class="carousel-item" data-interval="3000">';
}
$b .= '<img data-src="' . self::ImageEcho($CardTOPSel) . '" class="d-block w-100 lazy">';
$b .= '<a href="' . $CardTOPSel->permalink . '" class="carousel-caption a-none">';
$b .= '<h4>' . $CardTOPSel->title . '</h4>';
$b .= '<div class="top-post-info"><span class="post-info"><svg class="icon mr-1" aria-hidden="true"><use xlink:href="#shijian"></use></svg>' . date("Y年m月d日", $CardTOPSel->date->timeStamp) . '</span>
<span class="post-info"><svg class="icon mr-1" aria-hidden="true"><use xlink:href="#huo"></use></svg>' . App::getPostViews($CardTOPSel) . '阅读</span>
<span class="post-info"><svg class="icon mr-1" aria-hidden="true"><use xlink:href="#bidianliang"></use></svg>' . App::getWordCount($CardTOPSel->cid) . ' 字</span>
<span class="post-info"><svg class="icon mr-1" aria-hidden="true"><use xlink:href="#pinglun1"></use></svg>' . $CardTOPSel->commentsNum . ' 条评论</span></div>';
$b .= '</a></div>';
$i ;
}
$arr = array($a, $b);
$str = '<div id="postTop" class="carousel slide carousel-fade" data-ride="carousel">';
$str .= '<ol class="carousel-indicators">';
$str .= $arr[0];
$str .= '</ol>';
$str .= '<div class="carousel-inner">';
$str .= $arr[1];
$str .= '</div>';
$str .= '<a class="carousel-control-prev" href="#postTop" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
</a>';
$str .= '<a class="carousel-control-next" href="#postTop" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
</a>';
$str .= '</div>';
}
return $str;
}
//思源宋体渲染
public static function FontSet()
{
if (Helper::options()->思源宋体 && !App::isMobile()) {
return '<link href="https://fonts.googleapis.com/css2?family=Noto Serif SC:wght@400;700;900&display=swap" rel="stylesheet">';
}
return false;
}
//页面预加载脚本
public static function readyLoad()
{
if (Helper::options()->页面预加载 && !Helper::options()->Pjax无刷新) {
echo '<script src="https://cdn.jsdelivr.net/npm/instant.page@5.1.0/instantpage.min.js"></script>';
}
}
//大波浪
public static function waveHeader()
{
if (Helper::options()->头图大波浪) {
return '<section class="main-hero-waves-area waves-area">
<svg class="waves-svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 24 150 28" preserveAspectRatio="none" shape-rendering="auto">
<defs>
<path id="gentle-wave" d="M -160 44 c 30 0 58 -18 88 -18 s 58 18 88 18 s 58 -18 88 -18 s 58 18 88 18 v 44 h -352 Z"></path>
</defs>
<g class="parallax">
<use xlink:href="#gentle-wave" x="48" y="0"></use>
<use xlink:href="#gentle-wave" x="48" y="3"></use>
<use xlink:href="#gentle-wave" x="48" y="5"></use>
<use xlink:href="#gentle-wave" x="48" y="7"></use>
</g>
</svg>
</section>';
} else {
return false;
}
}
public static function pluginJudge(){
if (!self::isPluginAvailable('Cuteen')) {
exit('<h3>插件未启用!!!如有疑问请联系QQ2013143650</h3>');
}
}
public static function isPluginAvailable($name)
{
$plugins = Typecho_Plugin::export();
$plugins = $plugins['activated'];
return is_array($plugins) && array_key_exists($name, $plugins);
}
}
//后台标签文本
class EchoHtml extends Typecho_Widget_Helper_Layout
{
public function __construct($html)
{
$this->html($html);
$this->start();
$this->end();
}
public function start()
{
}
public function end()
{
}
}