Boblog热门日志、随机日志、热门Tags插件源代码

在网络上发现有这个资料,觉得挺不错,收藏下来了。里面对于截取字符串的处理竟然和自己以前的不谋而合,呵呵,挺高兴的。

热门日志插件

Z2xvYmFsICRibG9nLCAkZGJfcHJlZml4LCAkbWJjb247DQokaG90dmlldz0kYmxvZy0+Z2V0Z3JvdXBieXF1ZXJ5KCJTRUxFQ1QgKiBGUk9NIGB7JGRiX3ByZWZpeH1ibG9nc2AgV0hFUkUgYHByb3BlcnR5YCA9MCBPUkRFUiBCWSBgdmlld3NgIERFU0MgTElNSVQgMCAsIHskbWJjb25bJ2VudHJ5bnVtJ119Iik7DQppZiAoaXNfYXJyYXkoJGhvdHZpZXcpKSB7DQokdmlld2hvd3M9Jzx1bD4nOw0KZm9yZWFjaCAoJGhvdHZpZXcgYXMgJG9uZWhvdHZpZXcpIHsNCiRmY3V0PShzdHJsZW4oJG9uZWhvdHZpZXdbJ3RpdGxlJ10pPnN0cmxlbigkc3RyX2N1dD1tc3Vic3RyKCRvbmVob3R2aWV3Wyd0aXRsZSddLDAsJG1iY29uWydlbnRyeWxlbmd0aCddLXN0cmxlbigkb25laG90dmlld1sndmlld3MnXSkpKSk7DQokc2hvcnRfdGl0bGU9JHN0cl9jdXQuKCRmY3V0PyIuLi4iOiIiKTsNCiR2aWV3aG93cy49IjxsaT5beyRvbmVob3R2aWV3Wyd2aWV3cyddfV08YSBocmVmPVwiIi5nZXRsaW5rX2VudHJ5KCRvbmVob3R2aWV3WydibG9naWQnXSwgJG9uZWhvdHZpZXdbJ2Jsb2dhbGlhcyddKS4iXCIgdGl0bGU9XCJ7JG9uZWhvdHZpZXdbJ3RpdGxlJ119XCI+eyRzaG9ydF90aXRsZX08L2E+PC9saT4iOw0KfQ0KJHZpZXdob3dzLj0nPC91bD4nOw0KfSBlbHNlIHsNCiR2aWV3aG93cz0nTm8gdmlldyEnOw0KfQ0KJHBocHJldHVybj0kdmlld2hvd3M7

 

随机日志插件

Z2xvYmFsICRibG9nLCAkZ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VbJ2Jsb2dpZCddLCAkdGl0bGVbJ2Jsb2dhbGlhcyddKS4iXCIgdGl0bGU9XCJ7JHRpdGxlWyd0aXRsZSddfVwiPiRzaG9ydF90aXRsZTwvYT48L2xpPiI7DQokaSsrOw0KfQ0KJHJldF9zdHIuPSc8L3VsPic7DQokcGhwcmV0dXJuPSRyZXRfc3RyOw==

热门Tags

Z2xvYmFsICRibG9nLCAkZGJfcHJlZml4LCAkbWJjb247DQokYWxsdGFncz0kYmxvZy0+Z2V0Z3JvdXBieXF1ZXJ5KCJTRUxFQ1QgdGFnbmFtZSx0YWdjb3VudGVyIEZST00gYHskZGJfcHJlZml4fXRhZ3NgIE9SREVSIEJZIHRhZ2NvdW50ZXIgREVTQyBMSU1JVCAwLCB7JG1iY29uWydyZXBseW51bSddfSIpOw0KaWYgKGlzX2FycmF5KCRhbGx0YWdzKSkgew0KJHRhZ3Nob3dzPSc8dWw+JzsNCmZvcmVhY2ggKCRhbGx0YWdzIGFzICRvbmV0YWcpIHsNCiR0YWdzaG93cy49IjxsaT48YSBocmVmPVwiIi5nZXRsaW5rX3RhZ3ModXJsZW5jb2RlKCRvbmV0YWdbJ3RhZ25hbWUnXSkpLiJcIj57JG9uZXRhZ1sndGFnbmFtZSddfTwvYT4gW3skb25ldGFnWyd0YWdjb3VudGVyJ119XTwvbGk+IjsNCn0NCiR0YWdzaG93cy49JzwvdWw+JzsNCn0gZWxzZSB7DQokdGFnc2hvd3M9J05vIHRhZ3MhJzsNCn0NCiRwaHByZXR1cm49JHRhZ3Nob3dzOw==

源代码如下:

热门日志

global $blog, $db_prefix, $mbcon;
$hotview=$blog->getgroupbyquery("SELECT * FROM `{$db_prefix}blogs` WHERE `property` =0 ORDER BY `views` DESC LIMIT 0 , {$mbcon['entrynum']}");
if (is_array($hotview)) {
$viewhows='
<ul>';
foreach ($hotview as $onehotview) {
$fcut=(strlen($onehotview['title'])&gt;strlen($str_cut=msubstr($onehotview['title'],0,$mbcon['entrylength']-strlen($onehotview['views']))));
$short_title=$str_cut.($fcut?"...":"");
$viewhows.="
	<li>[{$onehotview['views']}]<a title="/&quot;{$onehotview['title']}/&quot;" href="/">{$short_title}</a>
 
";
}
$viewhows.='</li>
</ul>
';
} else {
$viewhows='No view!';
}
$phpreturn=$viewhows;

随机日志

global $blog, $db_prefix, $permission,$mbcon;
$permissionlimit=($permission['SeeHiddenEntry']!=1) ? 2 : 3;
$id_arr=$blog-&gt;getgroupbyquery("SELECT blogid,title FROM `{$db_prefix}blogs` WHERE `property`&lt;{$permissionlimit}");        $rand_id_arr=Array();        $title_max=count($id_arr)&gt;$mbcon['entrynum']?$mbcon['entrynum']:count($id_arr);
for($i=0;$i&lt;$title_max;$i++)
while($rand_id=$id_arr[rand(0,count($id_arr)-1)])
if(array_search($rand_id,$rand_id_arr)===FALSE) {
array_push($rand_id_arr,$rand_id);
break;
} else
continue;
$ret_str='
<ul>';
$i=0;
foreach($rand_id_arr as $title) {
$fcut=(strlen($title['title'])&gt;strlen($str_cut=msubstr($title['title'],0,$mbcon['entrylength'])));
$short_title=$str_cut.($fcut?"...":"");
$ret_str.="
	<li class="/&quot;&quot;.($i%2?'rowodd':'rowcouple').&quot;/&quot;"><a title="/&quot;{$title['title']}/&quot;" href="/">$short_title</a>
 
";
$i++;
}
$ret_str.='</li>
</ul>
';
$phpreturn=$ret_str;

热门Tags

global $blog, $db_prefix, $mbcon;
$alltags=$blog-&gt;getgroupbyquery("SELECT tagname,tagcounter FROM `{$db_prefix}tags` ORDER BY tagcounter DESC LIMIT 0, {$mbcon['replynum']}");
if (is_array($alltags)) {
$tagshows='
<ul>';
foreach ($alltags as $onetag) {
$tagshows.="
	<li><a href="/">{$onetag['tagname']}</a> [{$onetag['tagcounter']}]
 
";
}
$tagshows.='</li>
</ul>
';
} else {
$tagshows='No tags!';
}
$phpreturn=$tagshows;

超越C++原创文章,转载请注明来源并保留原文链接

本文链接:http://www.beyondc.cn/boblog-popular-log-random-log-popular-tags-plug-in-source-code.html

你可能感兴趣的:(网络,Blog,search,Class,tags,Blogs)