├── screenshot.png ├── vendors └── Upgrade │ ├── Version.php │ └── Upgrade.php ├── core ├── version.php ├── func.php ├── shortcode.php ├── backup.php ├── upgrade.php ├── commentsec.php ├── general.php └── editor.php ├── README.md ├── LICENSE ├── modules └── sticky.php ├── 404.php ├── header.php ├── comments.php ├── page.php ├── index.php ├── post.php ├── archive.php ├── functions.php └── footer.php /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whitebearcode/typecho-bearcool/HEAD/screenshot.png -------------------------------------------------------------------------------- /vendors/Upgrade/Version.php: -------------------------------------------------------------------------------- 1 | addItem($cover); 16 | } 17 | 18 | /* 主题初始化 */ 19 | function themeInit($self) 20 | { 21 | Helper::options()->commentsRequireMail = true; 22 | Helper::options()->commentsRequireURL = false; 23 | Helper::options()->commentsThreaded = true; 24 | Helper::options()->commentsMaxNestingLevels = 999; 25 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # typecho-bearcool 2 | Typecho摄影类瀑布流主题 3 | QQ交流群:561848356
4 | 若主题目录名为typecho-bearcool-master,则需改为bearcool,否则部分功能无法显示。
5 | 特别声明:本主题仅适用于单纯的摄影类博客日志,请勿用于违法站点,在遵守国家法律法规的前提下合理使用,谢谢~
6 | 使用说明 7 | 最新版本[v1.0.4]下载 8 | 问题反馈 9 | 演示站 10 | 我的博客
11 | ///// 12 | 欢迎Star和Fork~
13 |

来说说该主题的优点

14 |
  • 瀑布流
  • 15 |
  • 滚动加载
  • 16 |
  • 图片懒加载
  • 17 |
  • 可自定义性强
  • 18 |
  • 风格样式全部托管于jsdelivr,所以主题的体积非常小
  • 19 |
  • 长期维护更新
  • 20 |
  • 还有很多这里不再一一列举
  • 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 WhiteBearCode 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /modules/sticky.php: -------------------------------------------------------------------------------- 1 | options->sticky_cid; 4 | if($sticky && $this->is('index') || $this->is('front')|| $this->is('archive')){ 5 | $sticky_cids = explode(',', strtr($sticky, ' ', ',')); 6 | $sticky_html = "
    置顶
    "; 7 | $db = Typecho_Db::get(); 8 | $pageSize = $this->options->pageSize; 9 | $select1 = $this->select()->where('type = ?', 'post'); 10 | $select2 = $this->select()->where('type = ? && status = ? && created < ?', 'post','publish',time()); 11 | //清空原有文章的列队 12 | $this->row = []; 13 | $this->stack = []; 14 | $this->length = 0; 15 | $order = ''; 16 | foreach($sticky_cids as $i => $cid) { 17 | if($i == 0) $select1->where('cid = ?', $cid); 18 | else $select1->orWhere('cid = ?', $cid); 19 | $order .= " when $cid then $i"; 20 | $select2->where('table.contents.cid != ?', $cid); //避免重复 21 | } 22 | if ($order) $select1->order(null,"(case cid$order end)"); //置顶文章的顺序 按 $sticky 中 文章ID顺序 23 | if ($this->_currentPage == 1) foreach($db->fetchAll($select1) as $sticky_post){ //首页第一页才显示 24 | $sticky_post['sticky'] = $sticky_html; 25 | $this->push($sticky_post); //压入列队 26 | } 27 | $uid = $this->user->uid; //登录时,显示用户各自的私密文章 28 | if($uid) $select2->orWhere('authorId = ? && status = ?',$uid,'private'); 29 | $sticky_posts = $db->fetchAll($select2->order('table.contents.created', Typecho_Db::SORT_DESC)->page($this->_currentPage, $this->parameter->pageSize)); 30 | foreach($sticky_posts as $sticky_post) $this->push($sticky_post); //压入列队 31 | $this->setTotal($this->getTotal()-count($sticky_cids)); //置顶文章不计算在所有文章内 32 | } -------------------------------------------------------------------------------- /404.php: -------------------------------------------------------------------------------- 1 | 2 | need('header.php'); ?> 3 |
    options->bcool_animate)): ?>animate__animated animate__options->bcool_animate() ?>"> 4 |
    5 |
    6 |
    7 |

    页面不存在!

    8 |
    9 |

    10 | 抱歉,您访问的页面似乎自己走丢了~ 11 |

    12 |

    13 | 您可以直接返回首页 14 |

    15 |
    16 |
    17 |
    18 |
    19 |
    20 | 36 | need('footer.php'); ?> 37 | -------------------------------------------------------------------------------- /core/shortcode.php: -------------------------------------------------------------------------------- 1 | fetchAll($db->select()->from('table.comments')->where('cid = ?', $t->cid)->where('mail = ?', $t->remember('mail', true))->limit(1)); 9 | 10 | if ($hasComment||$login) { 11 | $content = preg_replace("/\{bcool-hide\}(.*?)\{\/bcool-hide\}/sm",'

    $1

    ',$post); 12 | } else { 13 | $content = preg_replace("/\{bcool-hide\}(.*?)\{\/bcool-hide\}/sm",'

    此处内容需要评论回复后方可阅读。

    ',$post); 14 | } 15 | } 16 | //Todolist 17 | if (strpos($content, '{bcool-todo') !== false) { 18 | if (strpos($content, '{bcool-todo type=true') !== false) { 19 | $content = preg_replace('/\{bcool-todo type=true\}(.*?)\{\/bcool-todo\}/sm', '', $content); 20 | } 21 | if (strpos($content, '{bcool-todo type=false') !== false) { 22 | $content = preg_replace('/\{bcool-todo type=false\}(.*?)\{\/bcool-todo\}/sm', '', $content); 23 | } 24 | } 25 | //手风琴折叠 26 | if (strpos($content, '{bcool-accordion') !== false) { 27 | if (strpos($content, '{bcool-accordion type=stand') !== false) { 28 | $content = preg_replace('/\{bcool-accordion type=stand title=(.*?)\}(.*?)\{\/bcool-accordion\}/sm', '
    $1

    $2

    ', $content); 29 | } 30 | if (strpos($content, '{bcool-accordion type=line') !== false) { 31 | $content = preg_replace('/\{bcool-accordion type=line title=(.*?)\}(.*?)\{\/bcool-accordion\}/sm', '
    $1

    $2

    ', $content); 32 | } 33 | } 34 | $pattern = '/\]*>/i'; 35 | $replacement = ' 36 | '.$t->title.''; 37 | $content = preg_replace($pattern, $replacement, "
    ".$content."
    "); 38 | echo $content; 39 | } -------------------------------------------------------------------------------- /vendors/Upgrade/Upgrade.php: -------------------------------------------------------------------------------- 1 | open(str_replace('bearcool/vendors/Upgrade','',dirname(__FILE__)).'Bearcool.zip')===TRUE){ 42 | $zip->extractTo(str_replace('bearcool/vendors/Upgrade','',dirname(__FILE__))); 43 | $zip->close(); 44 | 45 | 46 | $data['status'] = 200; 47 | $data['code'] = 1; 48 | $data['message'] = '已成功升级至最新版本!'; 49 | echo json_encode($data, JSON_UNESCAPED_UNICODE); 50 | } 51 | } 52 | } 53 | //验证Referer 54 | if (strpos( $_SERVER['HTTP_REFERER'],'options-theme.php') == false) 55 | { 56 | echo ' 57 | 403 Forbidden 58 | 59 |

    403 Forbidden

    60 |
    BearCool
    61 | 62 | '; 63 | exit; 64 | } 65 | //验证传过来的值 66 | $file_path = dirname(__FILE__).'/Upgrade'.$_POST['upgradekey'].'.Key'; 67 | if(file_exists($file_path)){ 68 | $str = file_get_contents($file_path); 69 | $str = str_replace("\r\n","
    ",$str); 70 | if ( $_POST['upgradekey'] !== $str){ 71 | echo ' 72 | 403 Forbidden 73 | 74 |

    403 Forbidden

    75 |
    BearCool
    76 | 77 | '; 78 | exit; 79 | } 80 | } 81 | Upgrade(); 82 | -------------------------------------------------------------------------------- /core/backup.php: -------------------------------------------------------------------------------- 1 | fetchRow($db->select()->from('table.options')->where('name = ?', 'theme:' . $name))['value']; 6 | if ($db->fetchRow($db->select()->from('table.options')->where('name = ?', 'theme:' . $name . '_backup'))) { 7 | $db->query($db->update('table.options')->rows(array('value' => $value))->where('name = ?', 'theme:' . $name . '_backup')); ?> 8 | 12 | 13 | query($db->insert('table.options')->rows(array('name' => 'theme:' . $name . '_backup', 'user' => '0', 'value' => $value))); 16 | ?> 17 | 21 | fetchRow($db->select()->from('table.options')->where('name = ?', 'theme:' . $name . '_backup'))) { 26 | $_value = $db->fetchRow($db->select()->from('table.options')->where('name = ?', 'theme:' . $name . '_backup'))['value']; 27 | $db->query($db->update('table.options')->rows(array('value' => $_value))->where('name = ?', 'theme:' . $name)); ?> 28 | 32 | 33 | 37 | 38 | 39 | fetchRow($db->select()->from('table.options')->where('name = ?', 'theme:' . $name . '_backup'))) { 41 | $db->query($db->delete('table.options')->where('name = ?', 'theme:' . $name . '_backup')); ?> 42 | 46 | 47 | 51 | 52 | 53 | 54 |
    57 | 58 | 59 |
    '; 60 | -------------------------------------------------------------------------------- /core/upgrade.php: -------------------------------------------------------------------------------- 1 | setAttribute('class', 'bearui_content bearui_upgrade'); 6 | $form->addInput($UpgradePassword); 7 | 8 | $UpgradePasswords = base64_encode($options->UpgradePassword); 9 | if (!empty($options->UpgradePassword)){ 10 | $filedir = str_replace('core','',dirname(__FILE__)); 11 | $file = $filedir.'/vendors/Upgrade/Upgrade'.$UpgradePasswords.'.Key'; 12 | $files = $options->siteUrl.'/usr/themes/bearcool/vendors/Upgrade/Upgrade.php'; 13 | if(false!==fopen($file,'w+')){ 14 | file_put_contents($file,$UpgradePasswords); 15 | } 16 | $themeversion = themeVersion(); 17 | if($Versions['version'] > $themeversion){ 18 | $message = "
    19 |
    20 | 检测到当前最新版本V{$Versions['version']},您的版本为{$themeversion},建议您立即完成升级! 21 |
    22 |

    养成按时升级更新的好习惯是非常有必要的!

    23 | 24 |
    立即升级
    25 | 26 |
    27 | "; 28 | } 29 | else if($Versions['version'] <= $themeversion){ 30 | $message = "
    31 |
    32 | 您当前为最新版本V{$themeversion},不需要升级! 33 |
    34 |

    有新版本就更新是一种好习惯,继续保持!

    35 |
    36 | "; 37 | } 38 | else{ 39 | $message = "
    40 |
    41 | 您的版本为{$themeversion},当前未检测到最新版本,请稍后再试! 42 |
    43 |

    养成按时升级更新的好习惯是非常有必要的!

    44 |
    45 | "; 46 | } 47 | 48 | $Htmls = << 50 |

    51 | 52 |
    53 | 在线升级 54 |
    您可以通过本功能将主题升级至最新版本
    55 |
    56 |

    57 | 58 | 59 | 60 |
    61 |
    62 | 升级相关事项 63 |
    64 |

    考虑到各种玄学因素,升级前务必先备份数据,切记!

    65 |
    66 |
    67 | 检测新版本 68 |
    69 | 70 | 79 | 80 | {$message} 81 | 82 |
    83 | 84 | 85 | 182 | HTML; 183 | 184 | 185 | $layouts = new Typecho_Widget_Helper_Layout(); 186 | $layouts->html(_t($Htmls)); 187 | $layouts->setAttribute('class', 'bearui_content bearui_upgrade'); 188 | $form->addItem($layouts); 189 | } -------------------------------------------------------------------------------- /core/commentsec.php: -------------------------------------------------------------------------------- 1 | comment = array('BearcoolSpam', 'filter'); 3 | class BearcoolSpam{ 4 | public static function xsscheck($text) 5 | { 6 | $xsscheck = false; 7 | $list = array( 8 | '/onabort/is', 9 | '/onblur/is', 10 | '/onchange/is', 11 | '/onclick/is', 12 | '/ondblclick/is', 13 | '/onerror/is', 14 | '/onfocus/is', 15 | '/onkeydown/is', 16 | '/onkeypress/is', 17 | '/onkeyup/is', 18 | '/onload/is', 19 | '/onmousedown/is', 20 | '/onmousemove/is', 21 | '/onmouseout/is', 22 | '/onmouseover/is', 23 | '/onmouseup/is', 24 | '/onreset/is', 25 | '/onresize/is', 26 | '/onselect/is', 27 | '/onsubmit/is', 28 | '/onunload/is', 29 | '/eval/is', 30 | '/ascript:/is', 31 | '/style=/is', 32 | '/width=/is', 33 | '/width:/is', 34 | '/height=/is', 35 | '/height:/is', 36 | '/src=/is', 37 | ); 38 | if (strip_tags($text)) { 39 | for ($i = 0; $i < count($list); $i++) { 40 | if (preg_match($list[$i], $text) > 0) { 41 | $xsscheck = true; 42 | break; 43 | } 44 | } 45 | } else { 46 | $xsscheck = true; 47 | }; 48 | return $xsscheck; 49 | } 50 | 51 | /** 52 | * PHP获取字符串中英文混合长度 53 | */ 54 | public static function strLength($str){ 55 | preg_match_all('/./us', $str, $match); 56 | return count($match[0]); // 输出9 57 | } 58 | 59 | 60 | /** 61 | * 检查$str中是否含有$words_str中的词汇 62 | * 63 | */ 64 | public static function check_in($words_str, $str) 65 | { 66 | $words = explode("\n", $words_str); 67 | if (empty($words)) { 68 | return false; 69 | } 70 | foreach ($words as $word) { 71 | if (false !== strpos($str, trim($word))) { 72 | return true; 73 | } 74 | } 75 | return false; 76 | } 77 | 78 | /** 79 | * 检查$ip中是否在$words_ip的IP段中 80 | * 81 | */ 82 | public static function check_ip($words_ip, $ip) 83 | { 84 | $words = explode("\n", $words_ip); 85 | if (empty($words)) { 86 | return false; 87 | } 88 | foreach ($words as $word) { 89 | $word = trim($word); 90 | if (false !== strpos($word, '*')) { 91 | $word = "/^".str_replace('*', '\d{1,3}', $word)."$/"; 92 | if (preg_match($word, $ip)) { 93 | return true; 94 | } 95 | } else { 96 | if (false !== strpos($ip, $word)) { 97 | return true; 98 | } 99 | } 100 | } 101 | return false; 102 | } 103 | 104 | public static function filter($comment,$post){ 105 | $options = Typecho_Widget::widget('Widget_Options'); 106 | if (strlen(trim(preg_replace('/\xc2\xa0/',' ',$comment['text']))) == 0) { 107 | Typecho_Cookie::set('__typecho_remember_text', $comment['text']); 108 | throw new Typecho_Widget_Exception("抱歉,系统检测到您的评论内容只有空格,请返回修改后再试。"); 109 | } 110 | 111 | if(BearcoolSpam::xsscheck($comment['text'])) { 112 | Typecho_Cookie::set('__typecho_remember_text', $comment['text']); 113 | throw new Typecho_Widget_Exception("抱歉,系统检测到您的评论包含危险内容,请返回修改后再试。"); 114 | } 115 | 116 | if (!empty($options->BearSpam_IP)) { 117 | if (BearcoolSpam::check_ip($options->BearSpam_IP, $comment['ip'])) { 118 | throw new Typecho_Widget_Exception("抱歉,系统检测到您的IP处于屏蔽范围内,已拦截本条评论。"); 119 | Typecho_Cookie::set('__typecho_remember_text', $comment['text']); 120 | } 121 | 122 | 123 | } 124 | if (!empty($options->BearSpam_EMAIL)) { 125 | if (BearcoolSpam::check_in($options->BearSpam_EMAIL, $comment['mail'])) { 126 | throw new Typecho_Widget_Exception("抱歉,系统检测到您的邮箱处于屏蔽范围内,已拦截本条评论。"); 127 | Typecho_Cookie::set('__typecho_remember_text', $comment['text']); 128 | } 129 | } 130 | 131 | if (!empty($options->BearSpam_NAME)) { 132 | if (BearcoolSpam::check_in($options->BearSpam_NAME, $comment['author'])) { 133 | throw new Typecho_Widget_Exception("抱歉,系统检测到您的昵称存在敏感禁止词汇,已拦截本条评论。"); 134 | Typecho_Cookie::set('__typecho_remember_text', $comment['text']); 135 | } 136 | } 137 | 138 | if (!empty($options->BearSpam_URL)) { 139 | if (BearcoolSpam::check_in($options->BearSpam_URL, $comment['url'])) { 140 | throw new Typecho_Widget_Exception("抱歉,系统检测到您的网址处于屏蔽范围内,已拦截本条评论。"); 141 | Typecho_Cookie::set('__typecho_remember_text', $comment['text']); 142 | } 143 | } 144 | 145 | if (!empty($options->BearSpam_ArticleTitle)&& $options->BearSpam_ArticleTitle == "1") { 146 | $db = Typecho_Db::get(); 147 | // 获取评论所在文章 148 | $pot = $db->fetchRow($db->select('title')->from('table.contents')->where('cid = ?', $comment['cid'])); 149 | if(strstr($comment['text'], $pot['title'])){ 150 | throw new Typecho_Widget_Exception("抱歉,系统检测到您的评论内容疑似存在灌水内容,已自动拦截。"); 151 | Typecho_Cookie::set('__typecho_remember_text', $comment['text']); 152 | } 153 | } 154 | 155 | if (!empty($options->BearSpam_NAMEMIN)) { 156 | if(BearcoolSpam::strLength($comment['author']) < $options->BearSpam_NAMEMIN){ 157 | 158 | throw new Typecho_Widget_Exception("抱歉,系统检测到您的评论昵称过短,已自动拦截。"); 159 | Typecho_Cookie::set('__typecho_remember_text', $comment['text']); 160 | } 161 | } 162 | 163 | if (!empty($options->BearSpam_NAMEMAX)) { 164 | if (BearcoolSpam::strLength($comment['author'] > $options->BearSpam_NAMEMAX)) { 165 | throw new Typecho_Widget_Exception("抱歉,系统检测到您的评论昵称过长,已自动拦截。"); 166 | Typecho_Cookie::set('__typecho_remember_text', $comment['text']); 167 | }} 168 | 169 | if (!empty($options->BearSpam_NAMEURL)&& $options->BearSpam_NAMEURL == "1") { 170 | if (preg_match(" /^((https?|ftp|news):\/\/)?([a-z]([a-z0-9\-]*[\.。])+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)|(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&]*)?)?(#[a-z][a-z0-9_]*)?$/ ", $comment['author']) > 0) { 171 | throw new Typecho_Widget_Exception("抱歉,系统检测到您的评论昵称异常,已自动拦截。"); 172 | Typecho_Cookie::set('__typecho_remember_text', $comment['text']); 173 | }} 174 | 175 | if (!empty($options->BearSpam_Chinese)&& $options->BearSpam_Chinese == "1") { 176 | if (preg_match("/[\x{4e00}-\x{9fa5}]/u", $comment['text']) == 0) { 177 | throw new Typecho_Widget_Exception("抱歉,系统检测到您的评论内容不包含中文,已自动拦截。"); 178 | Typecho_Cookie::set('__typecho_remember_text', $comment['text']); 179 | }} 180 | 181 | if (!empty($options->BearSpam_MIN)) { 182 | if(BearcoolSpam::strLength($comment['text']) < $options->BearSpam_MIN){ 183 | throw new Typecho_Widget_Exception("抱歉,系统检测到您的评论内容字数过少,已自动拦截。"); 184 | Typecho_Cookie::set('__typecho_remember_text', $comment['text']); 185 | }} 186 | 187 | if (!empty($options->BearSpam_MAX)) { 188 | if(BearcoolSpam::strLength($comment['text']) > $options->BearSpam_MAX){ 189 | throw new Typecho_Widget_Exception("抱歉,系统检测到您的评论内容字数过多,已自动拦截。"); 190 | Typecho_Cookie::set('__typecho_remember_text', $comment['text']); 191 | }} 192 | 193 | if (!empty($options->BearSpam_Words)) { 194 | if (BearcoolSpam::check_in($options->BearSpam_Words, $comment['text'])) { 195 | throw new Typecho_Widget_Exception("抱歉,系统检测到您的评论内容包含敏感禁止词汇,已自动拦截。"); 196 | Typecho_Cookie::set('__typecho_remember_text', $comment['text']); 197 | } 198 | 199 | } 200 | Typecho_Cookie::delete('__typecho_remember_text'); 201 | return $comment; 202 | } 203 | 204 | } -------------------------------------------------------------------------------- /core/general.php: -------------------------------------------------------------------------------- 1 | cid; 5 | $db = Typecho_Db::get(); 6 | $prefix = $db->getPrefix(); 7 | if (!array_key_exists('views', $db->fetchRow($db->select()->from('table.contents')))) { 8 | $db->query('ALTER TABLE `' . $prefix . 'contents` ADD `views` INT(10) DEFAULT 0;'); 9 | echo 0; 10 | return; 11 | } 12 | $row = $db->fetchRow($db->select('views')->from('table.contents')->where('cid = ?', $cid)); 13 | if ($archive->is('single')) { 14 | $views = Typecho_Cookie::get('extend_contents_views'); 15 | if(empty($views)){ 16 | $views = array(); 17 | }else{ 18 | $views = explode(',', $views); 19 | } 20 | if(!in_array($cid,$views)){ 21 | $db->query($db->update('table.contents')->rows(array('views' => (int) $row['views'] + 1))->where('cid = ?', $cid)); 22 | array_push($views, $cid); 23 | $views = implode(',', $views); 24 | Typecho_Cookie::set('extend_contents_views', $views); //记录查看cookie 25 | } 26 | } 27 | echo $row['views']; 28 | } 29 | //Gravatar头像 30 | function Gravatar($email) 31 | 32 | { 33 | 34 | $options = Helper::options(); 35 | 36 | $b=str_replace('@qq.com','',$email); 37 | if(stristr($email,'@qq.com')&&is_numeric($b)&&strlen($b)<11&&strlen($b)>4){ 38 | $nk = 'https://s.p.qq.com/pub/get_face?img_type=3&uin='.$b; 39 | $c = get_headers($nk, true); 40 | $d = $c['Location']; 41 | $q = json_encode($d); 42 | $k = explode("&k=",$q)[1]; 43 | echo 'https://q.qlogo.cn/g?b=qq&k='.$k.'&s=100'; 44 | }else{ 45 | $email = md5($email); 46 | if($options->bcool_Gravatar == '1'){ 47 | echo "//cn.gravatar.com/gravatar/" . $email . "?"; 48 | } 49 | else if($options->bcool_Gravatar == '2'){ 50 | echo "//gravatar.loli.top/avatar/" . $email . "?"; 51 | } 52 | else if($options->bcool_Gravatar == '3'){ 53 | echo "//cdn.v2ex.com/gravatar/" . $email . "?"; 54 | } 55 | else if($options->bcool_Gravatar == '4'){ 56 | echo "//gravatar.loli.net/avatar/" . $email . "?"; 57 | } 58 | else if($options->bcool_Gravatar == '5'){ 59 | echo "//sdn.geekzu.org/avatar/" . $email . "?"; 60 | } 61 | else if($options->bcool_Gravatar == '6'){ 62 | echo "//dn-qiniu-avatar.qbox.me/avatar/" . $email . "?"; 63 | } 64 | else{ 65 | echo "//gravatar.loli.top/avatar/" . $email . "?"; 66 | } 67 | } 68 | } 69 | // 简介图文获取图片 70 | function thumb($obj) { 71 | //获取附件首张图片 72 | $attach = $obj->attachments(1)->attachment; 73 | //获取文章首张图片 74 | preg_match_all("/\]*>/i", $obj->content, $thumbUrl); 75 | $img_src = $thumbUrl[1][0]; 76 | // 获取自定义随机图片 77 | $options = Typecho_Widget::widget('Widget_Options'); 78 | $thumbs = explode("|",$options->bcool_cover); 79 | // 获取文章封面 80 | $cover = $obj->fields->cover; 81 | //---------------> 82 | if($cover){ 83 | $thumb = $cover; 84 | }elseif(isset($attach->isImage) && $attach->isImage == 1){ 85 | $thumb = $attach->url; 86 | }else if($img_src){ 87 | $thumb = $img_src; 88 | }else if($options->bcool_cover && count($thumbs)>0){ 89 | $thumb = $thumbs[rand(0,count($thumbs)-1)]; 90 | } 91 | else{ 92 | 93 | $rand = '700?t='.rand(1,1000); 94 | $thumb = 'https://picapi.bear-studio.net/1000/'.$rand; 95 | } 96 | return $thumb; 97 | } 98 | function sticky(){ 99 | $options = Typecho_Widget::widget('Widget_Options'); 100 | $sticky = explode(",",$options->sticky_cid); 101 | return $sticky; 102 | } 103 | 104 | 105 | 106 | function pic_show(){ 107 | $options = Typecho_Widget::widget('Widget_Options'); 108 | $picshows = explode("|",$options->bcool_pic); 109 | $picnum = count($picshows); 110 | $picshow = []; 111 | if($picnum !== 7){ 112 | $rand = '400?t='.rand(1,1000); 113 | $picshow = 'https://picapi.bear-studio.net/200/'.$rand; 114 | } 115 | else{ 116 | 117 | $picshow['type'] = 'no_auto'; 118 | $picshow['url'] = $picshows; 119 | $picshow = json_encode($picshow); 120 | } 121 | return $picshow; 122 | } 123 | 124 | 125 | /** 126 | * 显示上一篇 127 | * 128 | * 如果没有下一篇,返回null 129 | */ 130 | function thePrevCid($widget, $default = NULL) { 131 | $db = Typecho_Db::get(); 132 | $sql = $db->select()->from('table.contents') 133 | ->where('table.contents.created < ?', $widget->created) 134 | ->where('table.contents.status = ?', 'publish') 135 | ->where('table.contents.type = ?', $widget->type) 136 | ->where('table.contents.password IS NULL') 137 | ->order('table.contents.created', Typecho_Db::SORT_DESC) 138 | ->limit(1); 139 | $content = $db->fetchRow($sql); 140 | 141 | if ($content) { 142 | return $content["cid"]; 143 | } else { 144 | return $default; 145 | } 146 | }; 147 | 148 | /** 149 | * 获取下一篇文章mid 150 | * 151 | * 如果没有下一篇,返回null 152 | */ 153 | function theNextCid($widget, $default = NULL) { 154 | $db = Typecho_Db::get(); 155 | $sql = $db->select()->from('table.contents') 156 | ->where('table.contents.created > ?', $widget->created) 157 | ->where('table.contents.status = ?', 'publish') 158 | ->where('table.contents.type = ?', $widget->type) 159 | ->where('table.contents.password IS NULL') 160 | ->order('table.contents.created', Typecho_Db::SORT_ASC) 161 | ->limit(1); 162 | $content = $db->fetchRow($sql); 163 | 164 | if ($content) { 165 | return $content["cid"]; 166 | } else { 167 | return $default; 168 | } 169 | }; 170 | 171 | function RandomPosts($random=5){ 172 | $db = Typecho_Db::get(); 173 | $adapterName = $db->getAdapterName();//兼容非MySQL数据库 174 | if($adapterName == 'pgsql' || $adapterName == 'Pdo_Pgsql' || $adapterName == 'Pdo_SQLite' || $adapterName == 'SQLite'){ 175 | $order_by = 'RANDOM()'; 176 | }else{ 177 | $order_by = 'RAND()'; 178 | } 179 | $sql = $db->select()->from('table.contents') 180 | ->where('status = ?','publish') 181 | ->where('table.contents.created <= ?', time()) 182 | ->where('type = ?', 'post') 183 | ->limit($random) 184 | ->order($order_by); 185 | 186 | $result = $db->fetchAll($sql); 187 | if($result){ 188 | foreach($result as $val){ 189 | $obj = Typecho_Widget::widget('Widget_Abstract_Contents'); 190 | $val = $obj->push($val); 191 | $post_title = htmlspecialchars($val['title']); 192 | $permalink = $val['permalink']; 193 | 194 | echo ' 195 | 196 | 204 | 205 | '; 206 | } 207 | } 208 | } 209 | 210 | 211 | 212 | 213 | // 留言加@ 214 | function getPermalinkFromCoid($coid) { 215 | $db = Typecho_Db::get(); 216 | $row = $db->fetchRow($db->select('author')->from('table.comments')->where('coid = ? AND status = ?', $coid, 'approved')); 217 | if (empty($row)) return ''; 218 | return '@'.$row['author'].''; 219 | } 220 | 221 | //第三方分享 222 | function share($t,$type){ 223 | if($type == 'qq'){ 224 | echo 'http://connect.qq.com/widget/shareqq/index.html?url='.$t->permalink.'&sharesource=qzone&title='.$t->title.'&pics='.thumb($t).'&summary='.$t->title.'&desc='.$t->title; 225 | } 226 | else if($type == 'weibo'){ 227 | echo 'https://service.weibo.com/share/share.php?url='.$t->permalink.'&title='.$t->title.'&pic='.thumb($t); 228 | } 229 | else{ 230 | echo 'https://www.facebook.com/sharer/sharer.php?u='.$t->permalink; 231 | } 232 | } -------------------------------------------------------------------------------- /header.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | <?php $this->archiveTitle(array( 10 | 'category' => _t('分类 %s 下的文章'), 11 | 'search' => _t('包含关键字 %s 的文章'), 12 | 'tag' => _t('标签 %s 下的文章'), 13 | 'author' => _t('%s 发布的文章') 14 | ), '', ' - '); ?><?php $this->options->bcool_title(); ?><?php if(!empty($this->options->bcool_titleb)) :?> - <?php $this->options->bcool_titleb(); ?><?php endif; ?> 15 | 16 | 17 | 18 | options->bcool_favicon)) :?> 19 | 20 | 21 | options->bcool_gray == '2') :?> 22 | 25 | 26 | 30 | 31 | 32 | header(); ?> 33 | 34 | 35 | 36 | 39 | 40 |
    41 |
    42 |
    43 |
    44 |
    45 | 46 | 47 |
    48 |
    49 |
    50 |
    51 |
    52 |
    53 |
    54 |
    55 |
    56 | 74 |
    75 |
    76 |
    77 |
    78 |
    79 |
    80 | 81 | 82 |
    83 |
    84 | 92 | 140 |
    141 | 142 |
    143 | 144 |
    145 |
    -------------------------------------------------------------------------------- /comments.php: -------------------------------------------------------------------------------- 1 | 2 | comments()->to($comments); ?> 3 | authorId) { 7 | if ($comments->authorId == $comments->ownerId) { 8 | $commentClass .= ' comment-by-author'; //如果是文章作者的评论添加 .comment-by-author 样式 9 | } else { 10 | $commentClass .= ' comment-by-user'; //如果是评论作者的添加 .comment-by-user 样式 11 | } 12 | } 13 | $commentLevelClass = $comments->_levels > 0 ? ' comment-child' : ' comment-parent'; //评论层数大于0为子级,否则是父级 14 | 15 | ?> 16 | 17 |
    27 | parent)):?> 28 |
    29 | 30 |
    31 | 32 |
    33 | 34 |
    35 |
    36 | author(); ?> (authorId == $comments->ownerId) { 38 | echo '作者'; 39 | }else if ($comments->authorId !== $comments->ownerId){ 40 | echo '读者'; 41 | } 42 | 43 | ?>) 44 |
    45 |
    date('Y-m-d H:i'); ?>
    46 |
    parent); ?>
    47 |
    48 | content(); ?> 49 |
    50 | 51 |
    52 | 53 | children) { ?> 54 |
    55 | threadedComments($options); ?> 56 |
    57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 |
    65 |
    66 |
    67 | 68 |

    评论区 commentsNum(_t('0'), _t('1'), _t('%d')); ?>allow('comment')): ?>已关闭评论 69 | user->hasLogin()): ?> 70 | 71 | 72 |

    73 | allow('comment')): ?> 74 |
    75 | 76 | cancelReply(''); ?> 79 |
    80 | user->hasLogin()): ?> 81 | 82 | 83 | 84 |
    85 | 86 |
    87 |
    88 | 89 |
    90 | 91 | 94 |
    95 |
    96 | 97 |
    98 | 99 |
    100 |
    101 | 102 |
    103 |
    104 | 105 |
    106 | 109 | 110 | 113 |
    114 |
    115 | 116 |
    117 | 118 | 119 |
    120 | 121 | 122 | 123 |
    124 | 125 |
    126 |
    127 | listComments(); ?> 128 |
    129 |
    130 | pageNav('«','»', 1, ''); 133 | $content = ob_get_contents(); 134 | ob_end_clean(); 135 | $content = preg_replace("/
      /sm", '', $content); 143 | echo $content; 144 | 145 | ?> 146 |
    147 | 148 |
    149 |
    150 |
    151 | -------------------------------------------------------------------------------- /core/editor.php: -------------------------------------------------------------------------------- 1 | bottom = array('editor', 'button'); 3 | Typecho_Plugin::factory('admin/write-page.php')->bottom = array('editor', 'button'); 4 | class editor 5 | { 6 | public static function button(){ 7 | ?> 10 | 56 | 101 | 146 | 147 | 189 | 231 | 2 | need('header.php'); ?> 3 | 4 |
    options->bcool_animate)): ?>animate__animated animate__options->bcool_animate() ?>"> 5 | 6 |
    7 |
    8 | 11 | 12 |

    13 | title() ?> 14 |

    15 | 30 | 31 |
    32 |
    33 |
    34 |
    35 |
    36 |
    37 | 75 |
    76 |
    77 |
    78 |

    79 | content,$this,$this->user->hasLogin()); ?> 80 |

    81 |
    82 |
    83 |
    84 |
    85 | 86 | 87 | need('comments.php'); ?> 88 | 104 | 105 | need('footer.php'); ?> 106 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 13 | 14 | need('header.php'); 15 | $this->need('modules/sticky.php'); 16 | ?> 17 | 18 |
    options->bcool_animate)): ?>animate__animated animate__options->bcool_animate() ?>"> 19 |
    20 |
    21 |
    22 | have()): ?> 23 | next()): ?> 24 | 25 | 26 | 27 | 31 |

    32 | title('20', '...') ?> 33 |

    34 | 35 | 49 |
    50 | 51 | 52 |
    53 | 54 | Not Found 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 |

    啊哦~这里空空如也

    162 | 163 |
    164 | 165 | 166 |
    167 | 168 |
    169 | 170 | 171 | 172 | 173 | 174 |
    175 |

    到底啦~ 176 | 177 | 178 |

    179 |

    加载错误

    180 |
    181 | 182 | 183 | 186 | 187 | 188 | 189 |
    190 |
    191 |
    192 | 193 | 194 | 195 | need('footer.php'); ?> 196 | -------------------------------------------------------------------------------- /post.php: -------------------------------------------------------------------------------- 1 | 2 | need('header.php'); ?> 3 | 4 |
    options->bcool_animate)): ?>animate__animated animate__options->bcool_animate() ?>"> 5 | 6 |
    7 |
    8 | 11 | 15 |

    16 | title() ?> 17 |

    18 | 32 | 33 |
    34 |
    35 |
    36 |
    37 |
    38 |
    39 | 74 |
    75 |
    76 |
    77 | 78 | content,$this,$this->user->hasLogin()); ?> 79 | 80 |
    81 |
    82 |
    83 |
    84 | 85 | 87 |
    88 | 89 | widget('Widget_Archive@recommend'.$prevId, 'pageSize=1&type=post', 'cid='.$prevId)->to($prev);?> 90 | 98 | 99 | 100 | widget('Widget_Archive@recommend'.$nextId, 'pageSize=1&type=post', 'cid='.$nextId)->to($next);?> 101 | 109 | 110 |
    111 | need('comments.php'); ?> 112 | 128 | 129 | need('footer.php'); ?> 130 | -------------------------------------------------------------------------------- /archive.php: -------------------------------------------------------------------------------- 1 | 2 | need('header.php'); 3 | ?> 4 |
    options->bcool_animate)): ?>animate__animated animate__options->bcool_animate() ?>"> 5 | 22 |
    23 |
    24 |
    25 |
    26 |

    archiveTitle(array( 27 | 'category' => _t('分类 %s 下的文章'), 28 | 'search' => _t('包含关键字 %s 的文章'), 29 | 'tag' => _t('标签 %s 下的文章'), 30 | 'author' => _t('%s 发布的文章') 31 | ), '', ''); ?>

    32 | 33 |
    34 | is('category')): ?> 35 |
    36 | getDescription(); ?> 37 |
    38 | 39 |
    40 |
    41 |
    42 | 43 |
    44 |
    45 |
    46 |
    47 | 48 | have()): ?> 49 | next()): ?> 50 | 51 | 52 | 53 | 54 | 55 | 58 | 59 |

    60 | title('20', '...') ?> 61 |

    62 | 63 | 77 |
    78 | 79 | 80 |
    81 | 82 | Not Found 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 |

    啊哦~这里空空如也

    190 | 191 |
    192 |
    193 | 194 |
    195 | 196 | 197 | 198 | 199 | 200 |
    201 |

    到底啦~ 202 | 203 | 204 |

    205 |

    加载错误

    206 |
    207 | 208 | 211 | 212 | 213 | 214 |
    215 |
    216 |
    217 | 218 | need('footer.php'); ?> 219 | -------------------------------------------------------------------------------- /functions.php: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
    29 |
    30 |
    31 | 32 |
      33 |
    • 使用说明
    • 34 |
    • 基础设置
    • 35 |
    • 高级设置
    • 36 |
    • 文章设置
    • 37 |
    • 其他设置
    • 38 |
    • 在线升级
    • 39 | 40 |
    41 | 42 | 43 |
    44 |
    45 |
    46 | 47 |
    48 |
    49 | 欢迎使用BearCool主题,以下是使用须知~ 50 |
    51 |
      52 |
    • 本主题设置项请勿添加emoji表情,否则可能导致其他配置项被清空的情况。
    • 53 |
    • 主题用户交流QQ群:561848356
    • 54 |
    • 主题讨论微社区:戳这里访问
    • 55 |
    56 |
    57 |
    58 | 本主题为瀑布流式摄影类博客主题,适合喜欢瀑布流的摄影类博客站长使用
    59 | 不懂的问题或本主题存在的问题可加群或在微社区中进行反馈
    60 | 最后,祝您使用愉快:) 61 |
    62 |
    63 | 64 |
    65 | 66 |
    67 | 当前版本/最新版本 68 |
    69 | 70 | V/V 79 | 80 |
    81 | themeVersion()){ 83 | echo '
    84 | 本主题最新版本为V'.$Versions['version'].',您的版本为V'.themeVersion().',请及时完成更新! 85 | 86 |
    '; 87 | } 88 | 89 | ?> 90 | 91 |
    92 | 93 | 94 | 95 | 96 |
    97 | 101 |

    102 |
    103 | 头部设置 104 |
    设置头部信息,站点标题、SEO相关等
    105 |
    106 |

    107 |
    108 | 109 | HTML; 110 | 111 | $layout = new Typecho_Widget_Helper_Layout(); 112 | $layout->html(_t($Html)); 113 | $layout->setAttribute('class', 'bearui_content bearui_global'); 114 | $form->addItem($layout); 115 | 116 | $bcool_title = new Typecho_Widget_Helper_Form_Element_Text('bcool_title',null,$options->title, '站点标题', '请填入站点标题,不要太长'); 117 | $bcool_title->setAttribute('class', 'bearui_content bearui_global'); 118 | $form->addInput($bcool_title); 119 | $bcool_titleb = new Typecho_Widget_Helper_Form_Element_Text('bcool_titleb',null,'', '站点副标题', '请填入站点副标题,不要太长,将显示在站点标题的后面,不填则不显示'); 120 | $bcool_titleb->setAttribute('class', 'bearui_content bearui_global'); 121 | $form->addInput($bcool_titleb); 122 | $bcool_keywords = new Typecho_Widget_Helper_Form_Element_Text('bcool_keywords',null,$options->keywords, '站点SEO关键词', '请填入站点SEO关键词,请以半角逗号 "," 分割多个关键字.'); 123 | $bcool_keywords->setAttribute('class', 'bearui_content bearui_global'); 124 | $form->addInput($bcool_keywords); 125 | $bcool_description = new Typecho_Widget_Helper_Form_Element_Text('bcool_description',null,$options->description, '站点SEO描述', '请填入站点SEO描述,不要太长.'); 126 | $bcool_description->setAttribute('class', 'bearui_content bearui_global'); 127 | $form->addInput($bcool_description); 128 | 129 | $bcool_logo = new Typecho_Widget_Helper_Form_Element_Text('bcool_logo',null,'', '站点LOGO图片地址', '请填入站点LOGO图片地址,,当该项为空时默认显示站点标题作为文字LOGO'); 130 | $bcool_logo->setAttribute('class', 'bearui_content bearui_global'); 131 | $form->addInput($bcool_logo); 132 | 133 | $bcool_favicon = new Typecho_Widget_Helper_Form_Element_Text('bcool_favicon',null,'', '站点Favicon', '请填入站点Favicon图标地址'); 134 | $bcool_favicon->setAttribute('class', 'bearui_content bearui_global'); 135 | $form->addInput($bcool_favicon); 136 | 137 | $bcool_menu = new Typecho_Widget_Helper_Form_Element_Select('bcool_menu', array('1' => '集合为下拉列表', '2' => '形成单独导航'), '2', '独立页面在导航菜单的表现形式', '默认为集合下拉列表,若有需要形成单独导航则选择第二个即可'); 138 | $bcool_menu->setAttribute('class', 'bearui_content bearui_global'); 139 | $form->addInput($bcool_menu->multiMode()); 140 | 141 | $Html = << 143 |

    144 |
    145 | 底部设置 146 |
    设置ICP备案号、自定义代码等信息
    147 |
    148 |

    149 |
    150 | 151 | HTML; 152 | 153 | $layout = new Typecho_Widget_Helper_Layout(); 154 | $layout->html(_t($Html)); 155 | $layout->setAttribute('class', 'bearui_content bearui_global'); 156 | $form->addItem($layout); 157 | 158 | $bcool_icp = new Typecho_Widget_Helper_Form_Element_Text('bcool_icp',null,'', 'ICP备案号', '请在这里填入站点ICP备案号'); 159 | $bcool_icp->setAttribute('class', 'bearui_content bearui_global'); 160 | $form->addInput($bcool_icp); 161 | 162 | $bcool_police = new Typecho_Widget_Helper_Form_Element_Text('bcool_police',null,'', '公安备案号', '请在这里填入站点公安备案号'); 163 | $bcool_police->setAttribute('class', 'bearui_content bearui_global'); 164 | $form->addInput($bcool_police); 165 | 166 | $bcool_myqq = new Typecho_Widget_Helper_Form_Element_Text('bcool_myqq',null,'', '我的QQ二维码', '请在这里填入QQ二维码图片直链,不填则不显示'); 167 | $bcool_myqq->setAttribute('class', 'bearui_content bearui_global'); 168 | $form->addInput($bcool_myqq); 169 | 170 | $bcool_mywechat = new Typecho_Widget_Helper_Form_Element_Text('bcool_mywechat',null,'', '我的微信二维码', '请在这里填入微信二维码图片直链,不填则不显示'); 171 | $bcool_mywechat->setAttribute('class', 'bearui_content bearui_global'); 172 | $form->addInput($bcool_mywechat); 173 | 174 | $bcool_myweibo = new Typecho_Widget_Helper_Form_Element_Text('bcool_myweibo',null,'', '我的微博链接', '请在这里填入微博链接,不填则不显示'); 175 | $bcool_myweibo->setAttribute('class', 'bearui_content bearui_global'); 176 | $form->addInput($bcool_myweibo); 177 | 178 | $bcool_mygithub = new Typecho_Widget_Helper_Form_Element_Text('bcool_mygithub',null,'', '我的Github链接', '请在这里填入Github链接,不填则不显示'); 179 | $bcool_mygithub->setAttribute('class', 'bearui_content bearui_global'); 180 | $form->addInput($bcool_mygithub); 181 | 182 | $bcool_mytg = new Typecho_Widget_Helper_Form_Element_Text('bcool_mytg',null,'', '我的小飞机链接', '请在这里填入小飞机链接,不填则不显示'); 183 | $bcool_mytg->setAttribute('class', 'bearui_content bearui_global'); 184 | $form->addInput($bcool_mytg); 185 | 186 | $bcool_cover = new Typecho_Widget_Helper_Form_Element_Textarea('bcool_cover',null,'', '文章自定义封面图片', '请填入首页、分类等页面输出文章时的文章自定义封面图片
    优先级:文章封面->附件首图->文章首图->自定义随机图片,无图片时将随机显示
    自定义图片链接可固定一张,多张随机使用|分割
    例如:https://www.xxx.com/xxx.png|https://www.xxx.com/xxxx.png'); 187 | $bcool_cover->setAttribute('class', 'bearui_content bearui_high'); 188 | $form->addInput($bcool_cover); 189 | 190 | $bcool_pic = new Typecho_Widget_Helper_Form_Element_Textarea('bcool_pic',null,'', '页面底部图片集', '请填入七张不同的图片直链,我绝对不会说是用来填充底部不显得单调的QAQ
    使用|分割
    例如:https://www.xxx.com/xxx.png|https://www.xxx.com/xxxx.png,当本项为空或者图片数量少于7张时默认调用随机风景图'); 191 | $bcool_pic->setAttribute('class', 'bearui_content bearui_high'); 192 | $form->addInput($bcool_pic); 193 | 194 | $bcool_Gravatar = new Typecho_Widget_Helper_Form_Element_Select('bcool_Gravatar', array('1' => 'Gravatar官方源','2' => 'LOLI.TOP*Gravatar镜像源', '3' => 'V2EX*Gravatar镜像源','4' => 'LOLI.NET*Gravatar镜像源','5' => '极客族*Gravatar镜像源','6' => '七牛*Gravatar镜像源'), '2', 'Gravatar源选择', '因Gravatar官方在中国大陆地区被Q,导致在中国大陆访问使用Gravatar的站点时头像不显示,这里支持您自主选择合适的源
    本功能适配QQ,当填写的邮箱为QQ邮箱时则显示QQ头像'); 195 | $bcool_Gravatar->setAttribute('class', 'bearui_content bearui_high'); 196 | $form->addInput($bcool_Gravatar->multiMode()); 197 | 198 | //评论设置 199 | $Html = << 201 |

    202 | 203 |
    204 | 文章置顶 205 |
    设置文章置顶功能
    206 |
    207 |

    208 |
    209 | 210 | HTML; 211 | 212 | $layout = new Typecho_Widget_Helper_Layout(); 213 | $layout->html(_t($Html)); 214 | $layout->setAttribute('class', 'bearui_content bearui_article'); 215 | $form->addItem($layout); 216 | 217 | $Sticky = new Typecho_Widget_Helper_Form_Element_Textarea('sticky_cid',null,'', '置顶文章CID', '多篇文章使用英文逗号或空格进行分隔'); 218 | $Sticky->setAttribute('class', 'bearui_content bearui_article'); 219 | $form->addInput($Sticky); 220 | 221 | $Html = << 223 |

    224 | 225 |
    226 | 评论过滤 227 |
    默认强制性过滤全空格评论、包含XSS危险内容评论,其余需过滤内容您可以通过以下项进行设置。
    228 |
    229 |

    230 |
    231 | 232 | HTML; 233 | 234 | $layout = new Typecho_Widget_Helper_Layout(); 235 | $layout->html(_t($Html)); 236 | $layout->setAttribute('class', 'bearui_content bearui_article'); 237 | $form->addItem($layout); 238 | 239 | $BearSpam_IP = new Typecho_Widget_Helper_Form_Element_Textarea('BearSpam_IP',null,'', '过滤IP', '多条IP请用换行符隔开
    支持用*号匹配IP段,如:192.168.*.*'); 240 | $BearSpam_IP->setAttribute('class', 'bearui_content bearui_article'); 241 | $form->addInput($BearSpam_IP); 242 | // 243 | $BearSpam_EMAIL = new Typecho_Widget_Helper_Form_Element_Textarea('BearSpam_EMAIL',null,'', '过滤邮箱', '多个邮箱请用换行符隔开
    可以是邮箱的全部,或者邮箱部分关键词'); 244 | $BearSpam_EMAIL->setAttribute('class', 'bearui_content bearui_article'); 245 | $form->addInput($BearSpam_EMAIL); 246 | // 247 | $BearSpam_URL = new Typecho_Widget_Helper_Form_Element_Textarea('BearSpam_URL',null,'', '过滤网址', '多个网址请用换行符隔开
    可以是网址的全部,或者网址部分关键词。如果网址为空,该项不会起作用。'); 248 | $BearSpam_URL->setAttribute('class', 'bearui_content bearui_article'); 249 | $form->addInput($BearSpam_URL); 250 | // 251 | $BearSpam_ArticleTitle = new Typecho_Widget_Helper_Form_Element_Select('BearSpam_ArticleTitle',array('1' => '是', '2' => '否'),'', '过滤含有文章标题的评论 252 | ', '根据研究表明机器人发表的内容可能含有评论文章的标题'); 253 | $BearSpam_ArticleTitle->setAttribute('class', 'bearui_content bearui_article'); 254 | $form->addInput($BearSpam_ArticleTitle); 255 | // 256 | $BearSpam_NAME = new Typecho_Widget_Helper_Form_Element_Textarea('BearSpam_NAME',null,'', '过滤昵称', '如果评论发布者的昵称含有该关键词,将执行该操作,多个请直接换行'); 257 | $BearSpam_NAME->setAttribute('class', 'bearui_content bearui_article'); 258 | $form->addInput($BearSpam_NAME); 259 | // 260 | $BearSpam_NAMEMIN = new Typecho_Widget_Helper_Form_Element_Text('BearSpam_NAMEMIN',null,'', '昵称允许的最短长度', '如果评论发布者的昵称小于该最短长度将拦截'); 261 | $BearSpam_NAMEMIN->setAttribute('class', 'bearui_content bearui_article'); 262 | $form->addInput($BearSpam_NAMEMIN); 263 | // 264 | $BearSpam_NAMEMAX = new Typecho_Widget_Helper_Form_Element_Text('BearSpam_NAMEMAX',null,'', '昵称允许的最长长度', '如果评论发布者的昵称大于该最长长度将拦截'); 265 | $BearSpam_NAMEMAX->setAttribute('class', 'bearui_content bearui_article'); 266 | $form->addInput($BearSpam_NAMEMAX); 267 | // 268 | $BearSpam_NAMEURL = new Typecho_Widget_Helper_Form_Element_Select('BearSpam_NAMEURL',array('1' => '是', '2' => '否'),'', '过滤昵称为网址的评论', '根据研究表明机器人发表的评论,昵称很有可能为网址'); 269 | $BearSpam_NAMEURL->setAttribute('class', 'bearui_content bearui_article'); 270 | $form->addInput($BearSpam_NAMEURL); 271 | // 272 | $BearSpam_Chinese = new Typecho_Widget_Helper_Form_Element_Select('BearSpam_Chinese',array('1' => '是', '2' => '否'),'', '过滤不包含中文的评论', '当评论内容中没有中文时进行拦截'); 273 | $BearSpam_Chinese->setAttribute('class', 'bearui_content bearui_article'); 274 | $form->addInput($BearSpam_Chinese); 275 | // 276 | $BearSpam_MIN = new Typecho_Widget_Helper_Form_Element_Text('BearSpam_MIN',null,'', '评论内容允许的最短长度', '如果评论发布者的评论内容小于该最短长度将拦截'); 277 | $BearSpam_MIN->setAttribute('class', 'bearui_content bearui_article'); 278 | $form->addInput($BearSpam_MIN); 279 | // 280 | $BearSpam_MAX = new Typecho_Widget_Helper_Form_Element_Text('BearSpam_MAX',null,'', '评论内容允许的最大长度', '如果评论发布者的评论内容长度大于该最大长度将拦截'); 281 | $BearSpam_MAX->setAttribute('class', 'bearui_content bearui_article'); 282 | $form->addInput($BearSpam_MAX); 283 | // 284 | $BearSpam_Words = new Typecho_Widget_Helper_Form_Element_Textarea('BearSpam_Words',null,'', '过滤敏感词', '多个词汇请用换行符隔开'); 285 | $BearSpam_Words->setAttribute('class', 'bearui_content bearui_article'); 286 | $form->addInput($BearSpam_Words); 287 | 288 | $Html = << 290 |

    291 | 292 |
    293 | 文章图片水印 294 |
    设置图片水印功能
    295 |
    296 |

    297 |
    298 | 299 | HTML; 300 | 301 | $layout = new Typecho_Widget_Helper_Layout(); 302 | $layout->html(_t($Html)); 303 | $layout->setAttribute('class', 'bearui_content bearui_article'); 304 | $form->addItem($layout); 305 | 306 | //水印设置 307 | $Watermark = new Typecho_Widget_Helper_Form_Element_Select('Watermark', array('1' => '否', '2' => '是'), '2', '是否开启文章图片水印功能', '开启后可对本功能进行详细设置,前台输出图片时自动打上水印'); 308 | $Watermark->setAttribute('class', 'bearui_content bearui_article'); 309 | $form->addInput($Watermark->multiMode()); 310 | 311 | $WatermarkType = new Typecho_Widget_Helper_Form_Element_Select('WatermarkType', array('1' => '文字', '2' => '图片'), '1', '水印类型', '选择要打上什么样式的水印,若选择图片方式的话在非当前域名下可能存在跨域方面的问题,需自行根据服务器情况设置'); 312 | $WatermarkType->setAttribute('class', 'bearui_content bearui_article'); 313 | $form->addInput($WatermarkType->multiMode()); 314 | 315 | $waterMarkName = new Typecho_Widget_Helper_Form_Element_Text('waterMarkName', NULL, '', _t('水印文字/图片地址'),'若水印类型选择的是文本,则填写文字,若选择的是图片,则请填写图片直链'); 316 | $waterMarkName->setAttribute('class', 'bearui_content bearui_article'); 317 | $form->addInput($waterMarkName); 318 | 319 | $waterMarkKd = new Typecho_Widget_Helper_Form_Element_Text('waterMarkKd', NULL, '130', _t('水印宽度'),'填写水印宽度,单位px,填写数字即可,默认则为130'); 320 | $waterMarkKd->setAttribute('class', 'bearui_content bearui_article'); 321 | $form->addInput($waterMarkKd); 322 | 323 | $waterMarkTextSize = new Typecho_Widget_Helper_Form_Element_Text('waterMarkTextSize', NULL, '12', _t('水印文字大小'),'[仅当水印类型为文字的时候本项有效]
    填写水印文字大小,单位是px,填写数字即可,默认则为12'); 324 | $waterMarkTextSize->setAttribute('class', 'bearui_content bearui_article'); 325 | $form->addInput($waterMarkTextSize); 326 | 327 | $waterMarkTextColor = new Typecho_Widget_Helper_Form_Element_Text('waterMarkTextColor', NULL, 'white', _t('水印文字颜色'),'[仅当水印类型为文字的时候本项有效]
    填写水印文字颜色,可以是HEX或者RGBA 颜色代码,举个最简单的例子,比如填white,则为白色,black则为黑色'); 328 | $waterMarkTextColor->setAttribute('class', 'bearui_content bearui_article'); 329 | $form->addInput($waterMarkTextColor); 330 | 331 | $waterMarkTextBackground = new Typecho_Widget_Helper_Form_Element_Text('waterMarkTextBackground', NULL, 'black', _t('水印文字背景颜色'),'[仅当水印类型为文字的时候本项有效]
    填写水印文字背景颜色,可以是HEX或者RGBA 颜色代码,举个最简单的例子,比如填white,则为白色,black则为黑色'); 332 | $waterMarkTextBackground->setAttribute('class', 'bearui_content bearui_article'); 333 | $form->addInput($waterMarkTextBackground); 334 | 335 | $waterMarkLocation = new Typecho_Widget_Helper_Form_Element_Select('waterMarkLocation', array('nw' => '左上角', 'n' => '正上方', 'ne' => '右上角','w' => '正左边','e' => '正右边','sw' => '左下角','s' => '正下方','se' => '右下角','c' => '正中间'), 'c', _t('水印位置'),'选择水印位置'); 336 | $waterMarkLocation->setAttribute('class', 'bearui_content bearui_article'); 337 | $form->addInput($waterMarkLocation); 338 | 339 | $waterMarkOpacity = new Typecho_Widget_Helper_Form_Element_Text('waterMarkOpacity', NULL, '0.7', _t('水印透明度'),'填写水印透明度,在0-1之间填写一个数字,默认0.7'); 340 | $waterMarkOpacity->setAttribute('class', 'bearui_content bearui_article'); 341 | $form->addInput($waterMarkOpacity); 342 | 343 | $waterMarkMargin = new Typecho_Widget_Helper_Form_Element_Text('waterMarkMargin', NULL, '10', _t('水印到图片边缘的距离'),'填写水印到图片边缘的距离,填写数字即可,默认10'); 344 | $waterMarkMargin->setAttribute('class', 'bearui_content bearui_article'); 345 | $form->addInput($waterMarkMargin); 346 | 347 | $waterMarkOutput = new Typecho_Widget_Helper_Form_Element_Select('waterMarkOutput', array('null'=>'使用原图格式','jpeg'=>'jpeg','png'=>'png','webp'=>'webp'), '', _t('打上水印后的图片格式'),'选择打上水印后的图片格式,默认情况下原图啥格式,输出就啥格式'); 348 | $waterMarkOutput->setAttribute('class', 'bearui_content bearui_article'); 349 | $form->addInput($waterMarkOutput); 350 | 351 | $bcool_gray = new Typecho_Widget_Helper_Form_Element_Select('bcool_gray', array('1' => '关闭','2' => '开启'), '1', '是否开启哀悼模式', '开启后全站变灰。'); 352 | $bcool_gray->setAttribute('class', 'bearui_content bearui_other'); 353 | $form->addInput($bcool_gray->multiMode()); 354 | 355 | $bcool_animate = new Typecho_Widget_Helper_Form_Element_Select( 356 | 'bcool_animate', 357 | array( 358 | 'close' => '关闭', 359 | 'bounce' => 'bounce', 360 | 'flash' => 'flash', 361 | 'pulse' => 'pulse', 362 | 'rubberBand' => 'rubberBand', 363 | 'headShake' => 'headShake', 364 | 'swing' => 'swing', 365 | 'tada' => 'tada', 366 | 'wobble' => 'wobble', 367 | 'jello' => 'jello', 368 | 'heartBeat' => 'heartBeat', 369 | 'bounceIn' => 'bounceIn', 370 | 'bounceInDown' => 'bounceInDown', 371 | 'bounceInLeft' => 'bounceInLeft', 372 | 'bounceInRight' => 'bounceInRight', 373 | 'bounceInUp' => 'bounceInUp', 374 | 'bounceOut' => 'bounceOut', 375 | 'bounceOutDown' => 'bounceOutDown', 376 | 'bounceOutLeft' => 'bounceOutLeft', 377 | 'bounceOutRight' => 'bounceOutRight', 378 | 'bounceOutUp' => 'bounceOutUp', 379 | 'fadeIn' => 'fadeIn', 380 | 'fadeInDown' => 'fadeInDown', 381 | 'fadeInDownBig' => 'fadeInDownBig', 382 | 'fadeInLeft' => 'fadeInLeft', 383 | 'fadeInLeftBig' => 'fadeInLeftBig', 384 | 'fadeInRight' => 'fadeInRight', 385 | 'fadeInRightBig' => 'fadeInRightBig', 386 | 'fadeInUp' => 'fadeInUp', 387 | 'fadeInUpBig' => 'fadeInUpBig', 388 | 'fadeOut' => 'fadeOut', 389 | 'fadeOutDown' => 'fadeOutDown', 390 | 'fadeOutDownBig' => 'fadeOutDownBig', 391 | 'fadeOutLeft' => 'fadeOutLeft', 392 | 'fadeOutLeftBig' => 'fadeOutLeftBig', 393 | 'fadeOutRight' => 'fadeOutRight', 394 | 'fadeOutRightBig' => 'fadeOutRightBig', 395 | 'fadeOutUp' => 'fadeOutUp', 396 | 'fadeOutUpBig' => 'fadeOutUpBig', 397 | 'flip' => 'flip', 398 | 'flipInX' => 'flipInX', 399 | 'flipInY' => 'flipInY', 400 | 'flipOutX' => 'flipOutX', 401 | 'flipOutY' => 'flipOutY', 402 | 'rotateIn' => 'rotateIn', 403 | 'rotateInDownLeft' => 'rotateInDownLeft', 404 | 'rotateInDownRight' => 'rotateInDownRight', 405 | 'rotateInUpLeft' => 'rotateInUpLeft', 406 | 'rotateInUpRight' => 'rotateInUpRight', 407 | 'rotateOut' => 'rotateOut', 408 | 'rotateOutDownLeft' => 'rotateOutDownLeft', 409 | 'rotateOutDownRight' => 'rotateOutDownRight', 410 | 'rotateOutUpLeft' => 'rotateOutUpLeft', 411 | 'rotateOutUpRight' => 'rotateOutUpRight', 412 | 'hinge' => 'hinge', 413 | 'jackInTheBox' => 'jackInTheBox', 414 | 'rollIn' => 'rollIn', 415 | 'rollOut' => 'rollOut', 416 | 'zoomIn' => 'zoomIn', 417 | 'zoomInDown' => 'zoomInDown', 418 | 'zoomInLeft' => 'zoomInLeft', 419 | 'zoomInRight' => 'zoomInRight', 420 | 'zoomInUp' => 'zoomInUp', 421 | 'zoomOut' => 'zoomOut', 422 | 'zoomOutDown' => 'zoomOutDown', 423 | 'zoomOutLeft' => 'zoomOutLeft', 424 | 'zoomOutRight' => 'zoomOutRight', 425 | 'zoomOutUp' => 'zoomOutUp', 426 | 'slideInDown' => 'slideInDown', 427 | 'slideInLeft' => 'slideInLeft', 428 | 'slideInRight' => 'slideInRight', 429 | 'slideInUp' => 'slideInUp', 430 | 'slideOutDown' => 'slideOutDown', 431 | 'slideOutLeft' => 'slideOutLeft', 432 | 'slideOutRight' => 'slideOutRight', 433 | 'slideOutUp' => 'slideOutUp', 434 | ), 435 | 'off', 436 | '选择一款显示动画', 437 | '开启后,首页等位置都将显示此动画' 438 | ); 439 | $bcool_animate->setAttribute('class', 'bearui_content bearui_other'); 440 | $form->addInput($bcool_animate->multiMode()); 441 | 442 | require_once('core/upgrade.php'); 443 | } 444 | 445 | -------------------------------------------------------------------------------- /footer.php: -------------------------------------------------------------------------------- 1 | 2 |
    3 |
    4 |
    5 | 8 | 9 |
    10 | 11 |
    12 |
    13 | 14 |
    15 | 16 |
    17 | 18 |
    19 |
    20 | 21 |
    22 |
    23 | 24 |
    25 |
    26 | 27 |
    28 |
    29 | 30 |
    31 | 32 | $img): ?> 33 |
    34 | 35 |
    36 | 37 | 38 |
    39 |
    40 |
    41 | 42 | 43 | 103 |
    104 |
    105 |
    106 | 107 | 108 | 109 | 110 | 111 |
    112 | 134 | 135 |
    136 | 146 |
    147 | 148 |
    149 | 157 | 158 |
    159 |
    160 | 161 |
    162 | 170 | 171 |
    172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 189 | options->Watermark == '2') :?> 190 | 191 | 192 | 214 | 215 | 216 | 217 | 236 | is('post') || $this->is('page')): ?> 237 | 249 | 250 | is('post') || $this->is('page'))): ?> 251 | 252 | 267 | 268 | 269 | footer(); ?> 270 | 271 | 274 | 275 | 276 | --------------------------------------------------------------------------------