代码拉取完成,页面将自动刷新
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/* 后台设置 */
function themeConfig($form) {
//站点logo地址
$logoUrl = new Typecho_Widget_Helper_Form_Element_Text('logoUrl', NULL, NULL, _t('站点LOGO地址'), _t('在这里填入一个图片URL地址, 以在网站标题前加上一个LOGO'));
$form->addInput($logoUrl->addRule('xssCheck', _t('请不要在图片链接中使用特殊字符')));
//首页博客的介绍
$blogMesg = new Typecho_Widget_Helper_Form_Element_Text('blogMesg', NULL, NULL, _t('首页博客的介绍'), _t('在这里填入首页博客的介绍, 以在网站首页显示'));
$form->addInput($blogMesg->addRule('xssCheck', _t('请不要在图片链接中使用特殊字符')));
//侧边栏
$sidebarBlock = new Typecho_Widget_Helper_Form_Element_Checkbox('sidebarBlock',
array(
'ShowBlogmiao' => _t('站点描述'),
'ShowCategory' => _t('文章分类'),
'ShowRecentPosts' => _t('最新文章'),
'ShowRecentComments' => _t('最新评论'),
'ShowAdmin' => _t('系统设置')),
array('ShowBlogmiao', 'ShowCategory', 'ShowRecentPosts', 'ShowAdmin'), _t('侧边栏显示'));
$form->addInput($sidebarBlock->multiMode());
//统计代码
$GoogleAnalytics = new Typecho_Widget_Helper_Form_Element_Textarea('GoogleAnalytics', NULL, NULL, _t('统计代码'), _t('填写你的各种跟踪统计代码,相当于页尾代码'));
$form->addInput($GoogleAnalytics);
}
/*文章阅读次数统计*/
function get_post_view($archive) {
$cid = $archive->cid;
$db = Typecho_Db::get();
$prefix = $db->getPrefix();
if (!array_key_exists('views', $db->fetchRow($db->select()->from('table.contents')))) {
$db->query('ALTER TABLE `' . $prefix . 'contents` ADD `views` INT(10) DEFAULT 0;');
echo 0;
return;
}
$row = $db->fetchRow($db->select('views')->from('table.contents')->where('cid = ?', $cid));
if ($archive->is('single')) {
$views = Typecho_Cookie::get('extend_contents_views');
if (empty($views)) {
$views = array();
} else {
$views = explode(',', $views);
}
if (!in_array($cid, $views)) {
$db->query($db->update('table.contents')->rows(array('views' => (int)$row['views'] + 1))->where('cid = ?', $cid));
array_push($views, $cid);
$views = implode(',', $views);
Typecho_Cookie::set('extend_contents_views', $views); //记录查看cookie
}
}
echo $row['views'];
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。