RegisterPlugin("newlypublished","ActivePlugin_newlypublished");
function ActivePlugin_newlypublished() {
Add_Filter_Plugin('Filter_Plugin_Zbp_Load','BuildModule_newlypublished');
}
function BuildModule_newlypublished() {
global $zbp;
global $host;
$zbp->RegBuildModule('previous','BuildModule_newlypublished');
$i = $zbp->modulesbyfilename['previous']->MaxLi;
if ($i == 0) $i = 10;
$articles = $zbp->GetArticleList('*', array(array('=', 'log_Type', 0), array('=', 'log_Status', 0)), array('log_PostTime' => 'DESC'), $i, null,false);
$s = '';
foreach ($articles as $article) {
$clsjtp=rand(1,4);$pattern="/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg|\.png]))[\'|\"].*?[\/]?>/";
$content = $article->Content;
preg_match_all($pattern,$content,$matchContent);
if(isset($matchContent[1][0]))
$clsjtp=$matchContent[1][0];
else
$clsjtp=$zbp->host."zb_users/theme/".$zbp->theme."/style/img/rand-min/$clsjtp.jpg";
$s .= '<li><a href="'.$article->Url.'" class="picbox" rel="bookmark" title="'.$article->Title.'"><img src="'.$clsjtp.'" class="thumb" width="60" height="60" title="'.$article->Title.'" alt="'.$article->Title.'" /></a><h4 class="title"><a href="'.$article->Url.'" title="'.$article->Title.'">'.$article->Title.'</a></h4><p class="postmeta"><span class="time">'.$article->Time('Y-m-d').'</span><span class="eye">阅读('.$article->ViewNums.')</span></p></li>';
}
return $s;
}
function InstallPlugin_newlypublished(){
global $zbp;
}
function UninstallPlugin_newlypublished(){
global $zbp;
$zbp->RegBuildModule('previous','BuildModule_newlypublished');
$zbp->AddBuildModule('previous');
}制成插件后需要进入模块管理--系统模块--最新发表提交以下。就可以了。
这篇文章是昨晚上写的,忙于写插件,没有发布,现在和插件一块发布出来。插件已经在zblog应用中心发布地址为:
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请通知我们,一经查实,本站将立刻删除。


微信扫一扫 



