<?php
/*
Plugin Name: sitemap
Version: 1.0
Plugin URL: http://www.qiyuuu.com/for-emlog/emlog-plugin-sitemap
Description: 生成sitemap,供搜索引擎抓取
Author: 奇遇
Author Email: qiyuuu@gmail.com
Author URL: http://www.qiyuuu.com
*/
!defined('EMLOG_ROOT') && exit('access deined!');
function plugin_setting_view()
{
extract(sitemap_config());
$ex1 = $ex2 = '';
if($sitemap_show_footer) $ex1 = 'checked="checked" ';
if($sitemap_comment_time) $ex2 = 'checked="checked" ';
?>
<div class=containertitle><b>SiteMap</b>
<?php if(isset($_GET['setting'])):?><span class="actived">插件设置完成</span><?php endif;?>
<?php if(isset($_GET['error'])):?><span class="error">插件设置失败</span><?php endif;?>
</div>
<div class=line></div>
<form action="plugin.php?plugin=sitemap&action=setting" method="post">
<div>
<p>sitemap文件名:
<input size="12" name="sitemap_name" type="text" value="<?php echo $sitemap_name; ?>" /></p>
<p>在网站底部显示:
<input size="12" name="sitemap_show_footer" type="checkbox" value="1" <?php echo $ex1;?>/></p>
<p>最新评论时间作为最后更新时间:
<input size="12" name="sitemap_comment_time" type="checkbox" value="1" <?php echo $ex2;?>/></p>
<p>注:对以下选项不了解者请保持默认,参考资料<a href="http://www.sitemaps.org/zh_CN/protocol.php">sitemaps.org</a></p>
<table width="500">
<tbody>
<tr align="center">
<td widtd="14%"></td>
<td widtd="14%">日志</td>
<td widtd="14%">页面</td>
<td widtd="14%">分类</td>
<td widtd="14%">标签</td>
<td widtd="14%">碎语</td>
<td widtd="14%">归档</td>
</tr>
<tr align="center">
<td align="right">更新周期</td>
<?php foreach($sitemap_changefreq as $value): ?>
<td><input size="5" name="sitemap_changefreq[]" type="text" value="<?php echo $value; ?>" /></td>
<?php endforeach; ?>
</tr>
<tr align="center">
<td align="right">权重</td>
<?php foreach($sitemap_priority as $value): ?>
<td><input size="5" name="sitemap_priority[]" type="text" value="<?php echo $value; ?>" /></td>
<?php endforeach; ?>
</tr>
</tbody>
</table>
<p><input type="submit" value="保 存" class="submit" /></p>
</div>
</form>
<div class=line></div>
<form action="plugin.php?plugin=sitemap&action=setting" method="post">
<input type="hidden" name="update" value="1" />
<p><input type="submit" value="更新sitemap" class="submit" /></p>
</div>
</form>
<script>
$("#sitemap").addClass('sidebarsubmenu1');
setTimeout(hideActived,2600);
</script>
<?php
}
function plugin_setting()
{
extract(sitemap_config());
if(!isset($_POST['update'])) {
$changefreq2 = isset($_POST['sitemap_changefreq']) ? $_POST['sitemap_changefreq'] : array();
$priority2 = isset($_POST['sitemap_priority']) ? $_POST['sitemap_priority'] : array();
$sitemap_name2 = isset($_POST['sitemap_name']) ? strval($_POST['sitemap_name']) : '';
foreach($changefreq2 as $key=>$value) {
if(!in_array($value,array('always','hourly','daily','weekly','monthly','yearly','never'))){
$sitemap_changefreq[$key] = 'daily';
} else {
$sitemap_changefreq[$key] = $value;
}
}
foreach($priority2 as $key=>$value) {
if(floatval($value) > 1.0 || floatval($value) <= 0){
$sitemap_priority[$key] = '0.8';
} else {
$sitemap_priority[$key] = $value;
}
}
if($sitemap_name2 != '' && $sitemap_name != $sitemap_name2) {
if(!@rename(EMLOG_ROOT . '/' . $sitemap_name, EMLOG_ROOT . '/' . $sitemap_name2)) {
emMsg("重命名文件{$sitemap_name}失败,请设置根目录下{$sitemap_name}权限为777(LINUX)/everyone可写(windows)",'./plugin.php?plugin=sitemap');
}
$sitemap_name = $sitemap_name2;
}
$sitemap_show_footer = isset($_POST['sitemap_show_footer']) ? addslashes($_POST['sitemap_show_footer']) : 0;
$sitemap_comment_time = isset($_POST['sitemap_comment_time']) ? addslashes($_POST['sitemap_comment_time']) : 0;
if(!@file_put_contents(EMLOG_ROOT . '/content/plugins/sitemap/config',serialize(compact('sitemap_name','sitemap_changefreq','sitemap_priority','sitemap_show_footer','sitemap_comment_time')))) {
emMsg("更新配置失败,请设置文件content/plugins/sitemap/config权限为777(LINUX)/everyone可写(windows)",'./plugin.php?plugin=sitemap');
}
}
if(!sitemap_update()) {
emMsg("更新sitemap失败,请设置根目录下{$sitemap_name}权限为777(LINUX)/everyone可写(windows)",'./plugin.php?plugin=sitemap');
}
return true;
}
基于PHP的Emlog Sitemap 插件修改版(支持百度提交.zip
版权申诉
45 浏览量
2023-07-20
07:48:22
上传
评论
收藏 6KB ZIP 举报
助力毕业
- 粉丝: 2173
- 资源: 5122
最新资源
- 历届(第1-21届)希望杯数学竞赛初一试题及答案(最新整理).doc全国数学邀请赛(264页资料)
- 水滴.psd
- TokenPocket_V2.1.2_release.apk
- Apache-druid-kafka-rce.yaml
- 基于C#的ASP.NET数据库原理及应用技术课程指导平台的开发
- 基于ROS的智能车轨迹跟踪算法的仿真与设计源码运用PID跟踪算法.zip.zip
- Bug Bounty Tip - i春秋Self-XSS变废为宝的奇思妙想
- 1991-2015年全国初中化学竞赛复赛试题汇编(212页)(24年竞赛复赛真题).docx天原杯
- Apache Flink 未授权访问+远程代码执行.pdf
- hadoop-基于hive的聊天数据分析报表可视化案例数据源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈