首页
留言反馈
网站导航
推荐
毒鸡汤
Search
1
非插件为typecho 文章生成微海报分享
18,938 阅读
2
主题移动端,样式下添加二级分类
15,460 阅读
3
主题 添加author page
14,770 阅读
4
主题添加移动端下边栏
12,779 阅读
5
EMlog添加评论者邮箱等级
9,122 阅读
typecho
dynamic
SuiYu
Emlog
xiuno
登录
/
注册
Search
标签搜索
代码
xiuno
php
css
typecho
评论
模板
say
js
修改教程
标签
珍惜
努力
recommend
善良
样式
调用
微笑
颜色
插件
Vincent
累计撰写
151
篇文章
累计收到
184
条评论
首页
栏目
typecho
dynamic
SuiYu
Emlog
xiuno
页面
留言反馈
网站导航
推荐
毒鸡汤
搜索到
24
篇与
的结果
2021-07-04
xiunoBBS后台插件排序方法--启用的排前面
xiunoBBS后台插件默认是按照插件路径排序,也可以理解为按照插件作者(英文缩写)排序但是后台看起来就有点乱,找自己启用的插件要翻老半天先上排序后的效果,有没有变清爽:排序方法这个效果功能懒得开发成插件,而且几乎为必备修改,直接改源码将文件/model/plugin.func.php第53行的plugin_init()函数修改为以下代码,同时增加函数array_sort()即可,完整代码如下:// 在安装、卸载插件的时候,需要先初始化 function plugin_init() { global $plugin_srcfiles, $plugin_paths, $plugins, $official_plugins; $plugin_paths = glob(APP_PATH.'plugin/*', GLOB_ONLYDIR); if(is_array($plugin_paths)) { foreach($plugin_paths as $path) { $dir = file_name($path); $conffile = $path."/conf.json"; if(!is_file($conffile)) continue; $arr = xn_json_decode(file_get_contents($conffile)); if(empty($arr)) continue; $plugins[$dir] = $arr; // 额外的信息 $plugins[$dir]['hooks'] = array(); $hookpaths = glob(APP_PATH."plugin/$dir/hook/*.*"); // path if(is_array($hookpaths)) { foreach($hookpaths as $hookpath) { $hookname = file_name($hookpath); $plugins[$dir]['hooks'][$hookname] = $hookpath; } } // 本地 + 线上数据 $plugins[$dir] = plugin_read_by_dir($dir); } //插件排序,依赖于自定义函数array_sort() $plugins = array_sort($plugins,'installed','desc'); $plugins = array_sort($plugins,'enable','desc'); } } //二维数组排序 function array_sort($arr,$keys,$type='asc'){ $keysvalue = $new_array = array(); foreach ($arr as $k=>$v){ $keysvalue[$k] = $v[$keys]; } if($type == 'asc'){ asort($keysvalue); }else{ arsort($keysvalue); } reset($keysvalue); foreach ($keysvalue as $k=>$v){ $new_array[$k] = $arr[$k]; } return $new_array; }
2021年07月04日
802 阅读
0 评论
4 点赞
2021-07-03
Xiuno BBS 4.0 修改时间显示
##修罗开源轻论坛程序 - Xiuno BBS 4.0Xiuno BBS 4.0 是一款轻论坛产品,前端基于 BootStrap 4.0、JQuery 3,后端基于 PHP/7 MySQL XCache/Yac/Redis/Memcached...,自适应手机、平板、PC,有着非常方便的插件机制,不仅仅是一个轻论坛,还是一个良好的二次开发平台。这个程序默认是人类友好的时间显示的,例如:1天前 1月前有时候需要精确时间显示 2019-10-10 11:11:11但是又没有提供选项只能修改代码xiunophp/misc.func.php469行function humandate($timestamp, $lan = array()) {直接返回时间return date('Y-m-d H:i:s',$timestamp);exit;xiunophp.min.php 里面也有一个同样的函数 也要同样处理保存文件就可以了
2021年07月03日
891 阅读
0 评论
4 点赞
2021-07-01
为xiuno增加附件下载位置详细信息
要实现附件信息功能,要增加下面三个hook文件。1. attach_output_before.php attach_downloads($aid);2. model_attach_start.php // downloads + 1function attach_downloads($aid, $n = 1) { global $conf; $sqladd = strpos($conf['db']['type'], 'mysql') === FALSE ? '' : ' LOW_PRIORITY'; $r = db_exec("UPDATE$sqladd `bbs_attach` SET downloads=downloads+$n WHERE aid='$aid'"); return $r; }3. model_post_file_list_html_delete_before.php$s .= '<br><div style="color:#999;"> 上传时间:'.date('Y-m-d', $attach['create_date'])."\r\n"; $s .= ' | 下载次数:'.intval($attach['downloads'])."\r\n"; $s .= '次 | 文件大小:'.humansize($attach['filesize'])."\r\n"; $s .= '</div>'."\r\n";
2021年07月01日
784 阅读
0 评论
3 点赞
2021-05-19
伪3D文本
HTML<div class="loading">Loading</div>CSS@import url("https://fonts.googleapis.com/css?family=Baloo+Bhaijaan&display=swap"); @function float-text-3d($shadow-color: #bbb, $depth: 10, $floating: false) { $shadows: (); // When dropped, it will shrink like a spring. When floating, it grows into its shape. @for $i from 1 to $depth { @if ($floating == false and $i > $depth / 2) { $shadow-color: transparent; } $shadows: append($shadows, 0 ($i * 1px) $shadow-color, comma); } // When dropped, the shadow reveals. When floating, the shadow fades. @if ($floating == false) { $shadows: append($shadows, 0 10px 10px rgba(0, 0, 0, 0.4), comma); } @else { $shadows: append($shadows, 0 50px 25px rgba(0, 0, 0, 0.2), comma); } @return $shadows; } body { display: flex; height: 100vh; justify-content: center; align-items: center; text-align: center; background: #2980b9; } .loading { display: flex; color: white; font-size: 5em; font-family: "Baloo Bhaijaan", cursive; text-transform: uppercase; span { text-shadow: float-text-3d($floating: false); transform: translateY(20px); animation: bounce 0.3s ease infinite alternate; } } @keyframes bounce { to { text-shadow: float-text-3d($floating: true); transform: translateY(-20px); } }JSlet loading = document.querySelector(".loading"); let letters = loading.textContent.split(""); loading.textContent = ""; letters.forEach((letter, i) => { let span = document.createElement("span"); span.textContent = letter; span.style.animationDelay = `${i / 10}s`; loading.append(span); });
2021年05月19日
853 阅读
0 评论
4 点赞
2021-01-26
给emlog主题添加统计栏目代码及教程
给emlog主题添加统计栏目代码及教程最近很多大佬都在问,那个统计代码怎么放,我怎么放了没有用呀,听到这些,我也不想说了,下面直接给你们丢代码,喜欢花里胡哨的站长你们要的东西它来了。……首页调用代码,这里我用的是fee主题,那么直接丢到log_list.php文件里头,当然也有人会问具体丢哪里,因为有很多那种刚玩网站的”大佬”不知道加哪里,然而加了把网站也打不开的那种,只要记住代码丢<?php }?>后面基本会没错,具体放入位置,个人喜欢吧<!--统计栏目--> <div class="tpt-wp cl"> <ul> <li class="tpt-md-4"><div class="tpt-cm"> <i class="layui-icon fa fa-folder-open-o" style="font-size: 20px; color: #e4ad85;vertical-align: middle; margin: 0px 3px;"></i>文章资源 <font color="#03f"><?php echo $sta_cache['lognum']; ?></font> 篇</div> </li> <li class="tpt-md-4"><div class="tpt-cm"> <i class="layui-icon fa fa-commenting-o" style="font-size: 20px; color: #27c24c;vertical-align: middle; margin: 0px 3px;"></i>评论回复 <font color="#03f"><?php echo $sta_cache['comnum_all']; ?></font> 次</div> </li> <li class="tpt-md-4"><div class="tpt-cm"> <i class="layui-icon fa fa-user-o" style="font-size: 20px; color: #23b7e5;vertical-align: middle; margin: 0px 3px;"></i>网站用户 <font color="#03f"><?php echo count_user_all();?> </font>位</div> </li> <li class="tpt-md-4"><div class="tpt-cm"> <i class="layui-icon fa fa-history" style="font-size: 20px; color: #7266ba;vertical-align: middle; margin: 0px 3px;"></i>最后更新 <font color="#ff0000"><?php echo last_post_log();?></font></a ></div> </li> </ul> </div>module.php文件添加以下代码,前台调用,具体你想调用哪些还是个人喜欢。<?php //统计文章总数 function count_log_all(){ $db = MySql::getInstance(); $data = $db->once_fetch_array("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "blog WHERE type = 'blog'"); return $data['total']; } //置顶文章数 function count_log_top(){ $db = MySql::getInstance(); $data = $db->once_fetch_array("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "blog WHERE top = 'y' or sortop = 'y' AND type = 'blog'"); return $data['total']; } //隐藏文章数 function count_log_hide(){ $db = MySql::getInstance(); $data = $db->once_fetch_array("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "blog WHERE hide = 'y' AND type = 'blog'"); return $data['total']; } //未审核文章数 function count_log_check(){ $db = MySql::getInstance(); $data = $db->once_fetch_array("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "blog WHERE checked = 'n' AND type = 'blog'"); return $data['total']; } //加密文章数 function count_log_pass(){ $db = MySql::getInstance(); $data = $db->once_fetch_array("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "blog WHERE password !='' AND type = 'blog'"); return $data['total']; } //统计页面总数 function count_page_all(){ $db = MySql::getInstance(); $data = $db->once_fetch_array("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "blog WHERE type = 'page'"); return $data['total']; } //统计评论总数 function count_com_all(){ $db = MySql::getInstance(); $data = $db->once_fetch_array("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "comment"); return $data['total']; } //统计友链总数 function count_link_all(){ $db = MySql::getInstance(); $data = $db->once_fetch_array("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "link"); return $data['total']; } //统计微语评论总数 function count_treply_all(){ $db = MySql::getInstance(); $data = $db->once_fetch_array("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "reply"); return $data['total']; } //统计分类总数 function count_sort_all(){ $db = MySql::getInstance(); $data = $db->once_fetch_array("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "sort"); return $data['total']; } //统计子分类数 function count_sort_mod(){ $db = MySql::getInstance(); $data = $db->once_fetch_array("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "sort WHERE pid != 0"); return $data['total']; } //统计标签总数 function count_tag_all(){ $db = MySql::getInstance(); $data = $db->once_fetch_array("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "tag"); return $data['total']; } //统计微语总数 function count_tw_all(){ $db = MySql::getInstance(); $data = $db->once_fetch_array("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "twitter"); return $data['total']; } //统计用户总数 function count_user_all(){ $db = MySql::getInstance(); $data = $db->once_fetch_array("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "user"); return $data['total']; } //统计管理员总数 function count_user_admin(){ $db = MySql::getInstance(); $data = $db->once_fetch_array("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "user WHERE role = 'admin'"); return $data['total']; } //统计作者总数 function count_user_writer(){ $db = MySql::getInstance(); $data = $db->once_fetch_array("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "user WHERE role = 'writer'"); return $data['total']; } //统计附件总数 function count_att_all(){ $db = MySql::getInstance(); $data = $db->once_fetch_array("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "attachment"); return $data['total']; } //最后发表文章时间 function last_post_log(){ $db = MySql::getInstance(); $sql = "SELECT * FROM " . DB_PREFIX . "blog WHERE type='blog' ORDER BY date DESC LIMIT 0,1"; $res = $db->query($sql); $row = $db->fetch_array($res); $date = date('Y-n-j H:i',$row['date']); return $date; }; ?>CSS部分/*统计栏目*/ .new-content {margin-top: 5px;} .tpt-wp{margin:0 auto;width:100%}.tpt-cm{color: #333;text-align: center;background: #FFF;height: 60px;line-height: 60px; border: 1px solid #eaeaea;}.tpt-md-4{float:left}.tpt-md-3{float:left}.tpt-md-2{float:left}.tpt-md-1{width:100%} @media only screen and (max-width:767px){.tpt-md-4{width:50%}.tpt-md-3{width:100%}.tpt-md-2{width:100%}.tpt-ml-3{display:none}.tpt-mr-3{display:none}.tpt-ml-7{width:100%}.tpt-mr-7{width:100%}} @media only screen and (min-width:768px) and (max-width:1023px){.tpt-md-4{width:50%}.tpt-md-3{width:50%}.tpt-md-2{width:50%}.tpt-ml-3{display:none}.tpt-mr-3{display:none}.tpt-ml-7{width:100%}.tpt-mr-7{width:100%}} @media only screen and (min-width:1024px) and (max-width:1199px){.tpt-md-4{width:33.33333333%}.tpt-md-3{width:33.33333333%}.tpt-md-2{width:50%}.tpt-ml-3{float:left;width:30%}.tpt-mr-3{float:right;width:30%}.tpt-ml-7{float:left;width:70%}.tpt-mr-7{float:right;width:70%}} @media only screen and (min-width:1200px){.tpt-md-4{width:25%}.tpt-md-3{width:33.33333333%}.tpt-md-2{width:50%}.tpt-ml-3{float:left;width:30%}.tpt-mr-3{float:right;width:30%}.tpt-ml-7{float:left;width:70%}.tpt-mr-7{float:right;width:70%}.tpt-wp{width:100%;margin:0 auto;}}
2021年01月26日
4,396 阅读
0 评论
9 点赞
2021-01-25
EMlog鼠标点击爱心特效
代码 <script> !function(e, t, a) { function r() { for (var e = 0; e < s.length; e++) s[e].alpha <= 0 ? (t.body.removeChild(s[e].el), s.splice(e, 1)) : (s[e].y--, s[e].scale += .004, s[e].alpha -= .013, s[e].el.style.cssText = "left:" + s[e].x + "px;top:" + s[e].y + "px;opacity:" + s[e].alpha + ";transform:scale(" + s[e].scale + "," + s[e].scale + ") rotate(45deg);background:" + s[e].color + ";z-index:99999"); requestAnimationFrame(r) } function n() { var t = "function" == typeof e.onclick && e.onclick; e.onclick = function(e) { t && t(), o(e) } } function o(e) { var a = t.createElement("div"); a.className = "heart", s.push({ el: a, x: e.clientX - 5, y: e.clientY - 5, scale: 1, alpha: 1, color: c() }), t.body.appendChild(a) } function i(e) { var a = t.createElement("style"); a.type = "text/css"; try { a.appendChild(t.createTextNode(e)) } catch(t) { a.styleSheet.cssText = e } t.getElementsByTagName("head")[0].appendChild(a) } function c() { return "rgb(" + ~~ (255 * Math.random()) + "," + ~~ (255 * Math.random()) + "," + ~~ (255 * Math.random()) + ")" } var s = []; e.requestAnimationFrame = e.requestAnimationFrame || e.webkitRequestAnimationFrame || e.mozRequestAnimationFrame || e.oRequestAnimationFrame || e.msRequestAnimationFrame || function(e) { setTimeout(e, 1e3 / 60) }, i(".heart{width: 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: '';width: inherit;height: inherit;background: inherit;border-radius: 50%;-webkit-border-radius: 50%;-moz-border-radius: 50%;position: fixed;}.heart:after{top: -5px;}.heart:before{left: -5px;}"), n(), r() } (window, document); </script>
2021年01月25日
1,300 阅读
0 评论
6 点赞
2021-01-25
EMlog增加复制提醒弹窗代码
教程说明给EMlog主题增加复制弹窗 试试复制试试哦~ 很简单教程 别看了 动手吧header.php文件前调用以下代码 <link rel="stylesheet" href="<?php echo TEMPLATE_URL; ?>css/sweetalert.css" type='text/css' /> <script src="<?php echo TEMPLATE_URL; ?>js/sweetalert.min.js"></script>header.php文件底部添加以下代码 <script>document.body.oncopy = function() {swal("复制成功!", "若要转载请务必保留原文链接,申明来源,谢谢合作!","success");};</script>
2021年01月25日
1,277 阅读
0 评论
3 点赞
2021-01-24
Emlog6.0.1主题增加文章版权原创或转载判断
<!-- 版权开始 --> <div class="post-copyright panel panel-sort sbclass" data-aos="<?php echo $Tconfig["aosxg"];?>"> <p class="sidetags"><i class="fa fa-tags"></i> 本文标签:<?php blog_tag($logid);?></p> <?php if($copy=="1"){ ?> <p><i class="fa fa-bullhorn"></i> 版权声明:若无特殊注明,本文皆为《<?php blog_author($author); ?>》原创,转载请保留文章出处.</p> <p><i class="fa fa-share-alt-square"></i> 本文链接:<?php echo $log_title; ?> - <?php echo Url::log($logid); ?></p> <?php }else{ ?> <p><i class="fa fa-bullhorn"></i> 版权声明:本文为转载文章,源自互联网,由《<?php blog_author($author); ?>》整编;若有侵权,请联系站长.</p> <p><i class="fa fa-share-alt-square"></i> 原文链接:<a href="<?php echo $copyurl ?>" target="_blank"> <?php echo $copyurl ?></a></p> <?php } ?> </div> <!-- 版权结束 -->
2021年01月24日
1,091 阅读
0 评论
5 点赞
2021-01-06
Typecho基于浏览量的文章等级
代码:[hide]/*文章访问量等级*/ function listdeng($archive){ $db = Typecho_Db::get(); $cid = $archive->cid; if (!array_key_exists('views', $db->fetchRow($db->select()->from('table.contents')))) { $db->query('ALTER TABLE `'.$db->getPrefix().'contents` ADD `views` INT(10) DEFAULT 0;'); } $exist = $db->fetchRow($db->select('views')->from('table.contents')->where('cid = ?', $cid))['views']; if($exist<200){ // echo '<span class="badge arc_v1">测试</span>'; }elseif ($exist<500 && $exist>200) { echo '<span class="badge arc_v2">新秀</span>'; }elseif ($exist<1000 && $exist>=500) { echo '<span class="badge arc_v3">推荐</span>'; }elseif ($exist<5000 && $exist>=1000) { echo '<span class="badge arc_v4">热文</span>'; }elseif ($exist<10000 && $exist>=5000) { echo '<span class="badge arc_v5">头条</span>'; }elseif ($exist<30000 && $exist>=10000) { echo '<span class="badge arc_v6">火爆</span>'; }elseif ($exist>=30000) { echo '<span class="badge arc_v7">神贴</span>'; } }[/hide]复制以上代码放到functions.php文件里面调用:<?php listdeng($this); ?>样式自己发挥
2021年01月06日
2,046 阅读
1 评论
9 点赞
1
2
3