2021-01-19 07:41:08 +00:00
|
|
|
<?php
|
|
|
|
|
2021-01-26 13:41:01 +00:00
|
|
|
/* 继承方法函数 */
|
|
|
|
require_once('widget.php');
|
|
|
|
|
|
|
|
/* 公用函数 */
|
|
|
|
require_once('function.php');
|
|
|
|
|
|
|
|
/* 过滤内容函数 */
|
|
|
|
require_once('parse.php');
|
|
|
|
|
|
|
|
/* 主题内置开放API */
|
|
|
|
require_once('api.php');
|
|
|
|
|
2021-01-28 11:30:39 +00:00
|
|
|
/* 插件方法 */
|
|
|
|
require_once('factory.php');
|
|
|
|
|
2021-01-25 03:29:51 +00:00
|
|
|
/* 页面加载计时 */
|
|
|
|
_startCountTime();
|
|
|
|
|
2021-01-21 10:41:21 +00:00
|
|
|
|
2021-01-22 10:37:16 +00:00
|
|
|
/* 主题初始化 */
|
2021-01-20 10:28:15 +00:00
|
|
|
function themeInit($self)
|
|
|
|
{
|
2021-01-26 13:41:01 +00:00
|
|
|
/* 强奸用户关闭反垃圾保护 */
|
|
|
|
Helper::options()->commentsAntiSpam = false;
|
|
|
|
/* 强奸用户关闭检查来源URL */
|
|
|
|
Helper::options()->commentsCheckReferer = false;
|
|
|
|
/* 强奸用户强制要求填写邮箱 */
|
|
|
|
Helper::options()->commentsRequireMail = true;
|
|
|
|
/* 强奸用户强制要求无需填写url */
|
|
|
|
Helper::options()->commentsRequireURL = false;
|
|
|
|
/* 强制用户开启评论回复 */
|
2021-01-25 10:36:43 +00:00
|
|
|
Helper::options()->commentsThreaded = true;
|
2021-01-26 13:41:01 +00:00
|
|
|
/* 强制显示一页12篇文章 */
|
2021-01-25 13:26:58 +00:00
|
|
|
$self->parameter->pageSize = 12;
|
2021-01-25 03:29:51 +00:00
|
|
|
|
2021-01-22 10:37:16 +00:00
|
|
|
/* 主题开放API 路由规则 */
|
2021-01-20 10:28:15 +00:00
|
|
|
$path_info = $self->request->getPathinfo();
|
2021-01-21 10:41:21 +00:00
|
|
|
if ($path_info === "/joe/api") {
|
|
|
|
switch ($self->request->routeType) {
|
2021-01-23 10:30:17 +00:00
|
|
|
case 'aside_ranking':
|
2021-01-21 10:41:21 +00:00
|
|
|
_getRanking($self);
|
|
|
|
break;
|
2021-01-23 10:30:17 +00:00
|
|
|
case 'publish_list':
|
2021-01-21 10:41:21 +00:00
|
|
|
_getPost($self);
|
|
|
|
break;
|
2021-01-23 10:30:17 +00:00
|
|
|
case 'baidu_record':
|
2021-01-22 10:37:16 +00:00
|
|
|
_getRecord($self);
|
|
|
|
break;
|
2021-01-26 13:41:01 +00:00
|
|
|
case 'baidu_push':
|
|
|
|
_pushRecord($self);
|
|
|
|
break;
|
2021-01-23 10:30:17 +00:00
|
|
|
case 'handle_views':
|
2021-01-23 08:15:02 +00:00
|
|
|
_handleViews($self);
|
|
|
|
break;
|
2021-01-23 10:30:17 +00:00
|
|
|
case 'handle_agree':
|
2021-01-23 08:15:02 +00:00
|
|
|
_handleAgree($self);
|
|
|
|
break;
|
2021-01-28 11:30:39 +00:00
|
|
|
case 'wallpaper_type':
|
|
|
|
_getWallpaperType($self);
|
|
|
|
break;
|
|
|
|
case 'wallpaper_list':
|
|
|
|
_getWallpaperList($self);
|
|
|
|
break;
|
2021-01-29 10:54:33 +00:00
|
|
|
case 'maccms_list':
|
|
|
|
_getMaccmsList($self);
|
|
|
|
break;
|
2021-01-21 10:41:21 +00:00
|
|
|
};
|
2021-01-20 10:28:15 +00:00
|
|
|
}
|
|
|
|
}
|
2021-01-20 06:15:32 +00:00
|
|
|
|
2021-01-26 13:41:01 +00:00
|
|
|
/* 增加自定义字段 */
|
2021-01-20 04:39:49 +00:00
|
|
|
function themeFields($layout)
|
|
|
|
{
|
|
|
|
$aside = new Typecho_Widget_Helper_Form_Element_Radio(
|
|
|
|
'aside',
|
|
|
|
array(
|
|
|
|
'on' => '开启',
|
|
|
|
'off' => '关闭'
|
|
|
|
),
|
|
|
|
'on',
|
|
|
|
'是否开启当前页面的侧边栏',
|
|
|
|
'介绍:用于单独设置当前页侧边栏的开启状态 <br />
|
|
|
|
注意:只有在外观设置侧边栏开启状态下生效'
|
|
|
|
);
|
|
|
|
$layout->addItem($aside);
|
2021-01-20 08:06:51 +00:00
|
|
|
|
|
|
|
$thumb = new Typecho_Widget_Helper_Form_Element_Textarea(
|
|
|
|
'thumb',
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
'自定义文章缩略图',
|
|
|
|
'填写时:将会显示填写的文章缩略图 <br>
|
|
|
|
不填写时:<br>
|
|
|
|
1、若文章有图片则取文章内图片 <br>
|
|
|
|
2、若文章无图片,并且外观设置里未填写·自定义缩略图·选项,则取模板自带图片 <br>
|
|
|
|
3、若文章无图片,并且外观设置里填写了·自定义缩略图·选项,则取自定义缩略图图片'
|
|
|
|
);
|
|
|
|
$layout->addItem($thumb);
|
2021-01-21 10:41:21 +00:00
|
|
|
|
|
|
|
$abstract = new Typecho_Widget_Helper_Form_Element_Textarea(
|
|
|
|
'abstract',
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
'自定义文章摘要',
|
|
|
|
'填写时:将会显示填写的摘要 <br>
|
|
|
|
不填写时:默认取文章里的内容'
|
|
|
|
);
|
|
|
|
$layout->addItem($abstract);
|
2021-01-20 08:06:51 +00:00
|
|
|
}
|