1.5版
This commit is contained in:
22
.gitattributes
vendored
Normal file
22
.gitattributes
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
|
||||
# Custom for Visual Studio
|
||||
*.cs diff=csharp
|
||||
*.sln merge=union
|
||||
*.csproj merge=union
|
||||
*.vbproj merge=union
|
||||
*.fsproj merge=union
|
||||
*.dbproj merge=union
|
||||
|
||||
# Standard to msysgit
|
||||
*.doc diff=astextplain
|
||||
*.DOC diff=astextplain
|
||||
*.docx diff=astextplain
|
||||
*.DOCX diff=astextplain
|
||||
*.dot diff=astextplain
|
||||
*.DOT diff=astextplain
|
||||
*.pdf diff=astextplain
|
||||
*.PDF diff=astextplain
|
||||
*.rtf diff=astextplain
|
||||
*.RTF diff=astextplain
|
||||
163
.gitignore
vendored
Normal file
163
.gitignore
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
#################
|
||||
## Eclipse
|
||||
#################
|
||||
|
||||
*.pydevproject
|
||||
.project
|
||||
.metadata
|
||||
bin/
|
||||
tmp/
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
.classpath
|
||||
.settings/
|
||||
.loadpath
|
||||
|
||||
# External tool builders
|
||||
.externalToolBuilders/
|
||||
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
*.launch
|
||||
|
||||
# CDT-specific
|
||||
.cproject
|
||||
|
||||
# PDT-specific
|
||||
.buildpath
|
||||
|
||||
|
||||
#################
|
||||
## Visual Studio
|
||||
#################
|
||||
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Rr]elease/
|
||||
*_i.c
|
||||
*_p.c
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.vspscc
|
||||
.builds
|
||||
*.dotCover
|
||||
|
||||
## TODO: If you have NuGet Package Restore enabled, uncomment this
|
||||
#packages/
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish
|
||||
|
||||
# Others
|
||||
[Bb]in
|
||||
[Oo]bj
|
||||
sql
|
||||
TestResults
|
||||
*.Cache
|
||||
ClientBin
|
||||
stylecop.*
|
||||
~$*
|
||||
*.dbmdl
|
||||
Generated_Code #added for RIA/Silverlight projects
|
||||
|
||||
# Backup & report files from converting an old project file to a newer
|
||||
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
|
||||
|
||||
|
||||
############
|
||||
## Windows
|
||||
############
|
||||
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
|
||||
#############
|
||||
## Python
|
||||
#############
|
||||
|
||||
*.py[co]
|
||||
|
||||
# Packages
|
||||
*.egg
|
||||
*.egg-info
|
||||
dist
|
||||
build
|
||||
eggs
|
||||
parts
|
||||
bin
|
||||
var
|
||||
sdist
|
||||
develop-eggs
|
||||
.installed.cfg
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
.coverage
|
||||
.tox
|
||||
|
||||
#Translations
|
||||
*.mo
|
||||
|
||||
#Mr Developer
|
||||
.mr.developer.cfg
|
||||
|
||||
# Mac crap
|
||||
.DS_Store
|
||||
6
README.md
Normal file
6
README.md
Normal file
@@ -0,0 +1,6 @@
|
||||
emlog 日志归档插件
|
||||
====================
|
||||
|
||||
为你的博客添加一个归档页面,展示全部的文章,访客可选择按时间或者分类显示。与博客内置的归档相比,这个就多了一个统计功能,用户可自行选择。
|
||||
|
||||
[插件主页](http://xiaosong.org/share/emlog-log-archiving-plug-in-released)
|
||||
65
archiver.php
Normal file
65
archiver.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/*
|
||||
Plugin Name: 日志归档
|
||||
Version: 1.5
|
||||
Plugin URL: http://xiaosong.org/share/emlog-log-archiving-plug-in-released
|
||||
Description: 将所有日志按照日期或分类归档显示
|
||||
ForEmlog:5.0.0
|
||||
Author: 小松
|
||||
Author Email: sahala_2007@126.com
|
||||
Author URL: http://xiaosong.org/
|
||||
*/
|
||||
!defined('EMLOG_ROOT') && exit('access deined!');
|
||||
|
||||
function displayRecord(){
|
||||
global $CACHE;
|
||||
$record_cache = $CACHE->readCache('record');
|
||||
$output = '';
|
||||
foreach($record_cache as $value){
|
||||
$output .= '<li>'.$value['record'].'('.$value['lognum'].')'.displayRecordItem($value['date']).'</li>';
|
||||
}
|
||||
$output = '<ul class="archiver">'.$output.'</ul>';
|
||||
return $output;
|
||||
}
|
||||
function displayRecordItem($record){
|
||||
if (preg_match("/^([\d]{4})([\d]{2})$/", $record, $match)) {
|
||||
$days = getMonthDayNum($match[2], $match[1]);
|
||||
$record_stime = emStrtotime($record . '01');
|
||||
$record_etime = $record_stime + 3600 * 24 * $days;
|
||||
} else {
|
||||
$record_stime = emStrtotime($record);
|
||||
$record_etime = $record_stime + 3600 * 24;
|
||||
}
|
||||
$sql = "and date>=$record_stime and date<$record_etime order by top desc ,date desc";
|
||||
$result = archiver_db($sql);
|
||||
return $result;
|
||||
}
|
||||
function displaySort(){
|
||||
global $CACHE;
|
||||
$sort_cache = $CACHE->readCache('sort');
|
||||
$output = '';
|
||||
foreach($sort_cache as $value){
|
||||
$output .= '<li>'.$value['sortname'].'('.$value['lognum'].')'.displaySortItem($value['sid']).'</li>';
|
||||
}
|
||||
$output = '<ul class="archiver">'.$output.'</ul>';
|
||||
return $output;
|
||||
}
|
||||
function displaySortItem($sortid){
|
||||
$sql = "and sortid=$sortid order by date desc";
|
||||
$result = archiver_db($sql);
|
||||
return $result;
|
||||
}
|
||||
function archiver_db($condition = ''){
|
||||
$DB = MySql::getInstance();
|
||||
$sql = "SELECT gid, title, comnum, views FROM " . DB_PREFIX . "blog WHERE type='blog' and hide='n' $condition";
|
||||
$result = $DB->query($sql);
|
||||
$output = '';
|
||||
while ($row = $DB->fetch_array($result)) {
|
||||
$log_url = Url::log($row['gid']);
|
||||
$output .= '<li><a href="'.$log_url.'">'.$row['title'].'</a> <span>('.$row['comnum'].'/'.$row['views'].')</span></li>';
|
||||
}
|
||||
$output = empty($output) ? '<li>暂无日志</li>' : $output;
|
||||
$output = '<ol class="archiver_item">'.$output.'</ol>';
|
||||
return $output;
|
||||
}
|
||||
?>
|
||||
21
archiver_callback.php
Normal file
21
archiver_callback.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
function callback_init(){
|
||||
global $CACHE;
|
||||
$DB = MySql::getInstance();
|
||||
$inDB = $DB->query("SELECT 1 FROM ".DB_PREFIX."navi WHERE url='".BLOG_URL."?plugin=archiver'");
|
||||
if (!$DB->num_rows($inDB)) {
|
||||
$DB->query("INSERT INTO ".DB_PREFIX."navi (naviname, url, newtab, hide, taxis, isdefault) VALUES('归档', '".BLOG_URL."?plugin=archiver', 'n', 'n', 1, 'n')");
|
||||
} else {
|
||||
$DB->query("UPDATE ".DB_PREFIX."navi SET hide='n' WHERE url='".BLOG_URL."?plugin=archiver'");
|
||||
}
|
||||
$CACHE->updateCache('navi');
|
||||
}
|
||||
|
||||
function callback_rm(){
|
||||
global $CACHE;
|
||||
$DB = MySql::getInstance();
|
||||
$DB->query("UPDATE ".DB_PREFIX."navi SET hide='y' WHERE url='".BLOG_URL."?plugin=archiver'");
|
||||
$CACHE->updateCache('navi');
|
||||
}
|
||||
|
||||
?>
|
||||
45
archiver_show.php
Normal file
45
archiver_show.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
!defined('EMLOG_ROOT') && exit('access deined!');
|
||||
$show_type = isset($_GET['show_type']) ? addslashes($_GET['show_type']) : 'record';
|
||||
global $CACHE;
|
||||
$options_cache = $CACHE->readCache('options');
|
||||
$DB = MySql::getInstance();
|
||||
$res = $DB->once_fetch_array("SELECT naviname, hide FROM ".DB_PREFIX."navi WHERE url='".BLOG_URL."?plugin=archiver'");
|
||||
$site_title = $res['naviname'].' - '.Option::get('blogname');
|
||||
$log_title = $res['naviname'];
|
||||
$blogname = Option::get('blogname');
|
||||
$site_description = $bloginfo = Option::get('bloginfo');
|
||||
$site_key = Option::get('site_key');
|
||||
$istwitter = Option::get('istwitter');
|
||||
$comments = array("commentStacks" => array());
|
||||
$ckname = $ckmail = $ckurl = $verifyCode = false;
|
||||
$icp = Option::get('icp');
|
||||
$footer_info = Option::get('footer_info');
|
||||
if($res['hide'] == 'y' || !function_exists('displaySort') || !function_exists('displayRecord')) emMsg('不存在的页面!');
|
||||
include View::getView('header');
|
||||
|
||||
$log_content = '<h3><input type="radio" name="show_type" onclick="switchtype(this.value)" value="record" ';
|
||||
if($show_type != 'sort'){
|
||||
$log_content .= 'checked="checked" ';
|
||||
}
|
||||
$log_content .= '/> 按日期显示 <input type="radio" name="show_type" onclick="switchtype(this.value)" value="sort" ';
|
||||
if($show_type == 'sort'){
|
||||
$log_content .= 'checked="checked" ';
|
||||
}
|
||||
$log_content .= '/> 按分类显示</h3>';
|
||||
$show_type == 'sort' ? $log_content .= displaySort() : $log_content .= displayRecord();
|
||||
|
||||
?>
|
||||
<style type="text/css">
|
||||
.archiver li {margin-left:1em;padding:2px;font-size:14px;}
|
||||
.archiver li span {font-size:12px;}
|
||||
ol.archiver_item li {margin-left:1em;}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
function switchtype(type){
|
||||
window.location = '<?php echo BLOG_URL; ?>?plugin=archiver&show_type=' + type;
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
include View::getView('page');
|
||||
?>
|
||||
Reference in New Issue
Block a user