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 */
|
2021-02-03 09:58:16 +00:00
|
|
|
|
require_once('route.php');
|
2021-01-26 13:41:01 +00:00
|
|
|
|
|
2021-01-28 11:30:39 +00:00
|
|
|
|
/* 插件方法 */
|
|
|
|
|
require_once('factory.php');
|
|
|
|
|
|
2021-01-25 03:29:51 +00:00
|
|
|
|
/* 页面加载计时 */
|
|
|
|
|
_startCountTime();
|
|
|
|
|
|
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;
|
2021-02-16 12:26:00 +00:00
|
|
|
|
/* 强奸用户要求填写邮箱 */
|
2021-01-26 13:41:01 +00:00
|
|
|
|
Helper::options()->commentsRequireMail = true;
|
2021-02-16 12:26:00 +00:00
|
|
|
|
/* 强奸用户要求无需填写url */
|
2021-01-26 13:41:01 +00:00
|
|
|
|
Helper::options()->commentsRequireURL = false;
|
2021-02-16 12:26:00 +00:00
|
|
|
|
/* 强制用户评论回复 */
|
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-02-03 09:58:16 +00:00
|
|
|
|
|
|
|
|
|
if ($path_info == "/joe/api") {
|
2021-01-21 10:41:21 +00:00
|
|
|
|
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-02-02 10:25:32 +00:00
|
|
|
|
case 'huya_list':
|
|
|
|
|
_getHuyaList($self);
|
|
|
|
|
break;
|
2021-01-21 10:41:21 +00:00
|
|
|
|
};
|
2021-01-20 10:28:15 +00:00
|
|
|
|
}
|
2021-02-19 07:30:59 +00:00
|
|
|
|
|
|
|
|
|
/* 增加自定义sitemap功能 */
|
|
|
|
|
if ($self->request->getRequestUri() == "/sitemap.xml" || $self->request->getRequestUri() == "/index.php/sitemap.xml") {
|
|
|
|
|
$self->setThemeFile("library/sitemap.php");
|
|
|
|
|
$self->response->setStatus(200);
|
|
|
|
|
}
|
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)
|
|
|
|
|
{
|
2021-02-11 04:46:01 +00:00
|
|
|
|
$mode = new Typecho_Widget_Helper_Form_Element_Radio(
|
|
|
|
|
'mode',
|
|
|
|
|
array(
|
|
|
|
|
'default' => '默认模式',
|
|
|
|
|
'single' => '大图模式',
|
|
|
|
|
'multiple' => '三图模式',
|
|
|
|
|
'none' => '无图模式'
|
|
|
|
|
),
|
|
|
|
|
'default',
|
|
|
|
|
'文章显示方式',
|
|
|
|
|
'介绍:用于设置当前文章在首页和搜索页的显示方式 <br />
|
|
|
|
|
注意:独立页面该功能不会生效'
|
|
|
|
|
);
|
|
|
|
|
$layout->addItem($mode);
|
|
|
|
|
|
2021-01-20 04:39:49 +00:00
|
|
|
|
$aside = new Typecho_Widget_Helper_Form_Element_Radio(
|
|
|
|
|
'aside',
|
|
|
|
|
array(
|
|
|
|
|
'on' => '开启',
|
|
|
|
|
'off' => '关闭'
|
|
|
|
|
),
|
|
|
|
|
'on',
|
2021-02-05 10:27:44 +00:00
|
|
|
|
'是否开启当前页侧边栏',
|
2021-01-20 04:39:49 +00:00
|
|
|
|
'介绍:用于单独设置当前页侧边栏的开启状态 <br />
|
|
|
|
|
注意:只有在外观设置侧边栏开启状态下生效'
|
|
|
|
|
);
|
|
|
|
|
$layout->addItem($aside);
|
2021-01-20 08:06:51 +00:00
|
|
|
|
|
2021-02-05 10:27:44 +00:00
|
|
|
|
$keywords = new Typecho_Widget_Helper_Form_Element_Text(
|
|
|
|
|
'keywords',
|
2021-01-20 08:06:51 +00:00
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
2021-02-05 10:27:44 +00:00
|
|
|
|
'SEO关键词(非常重要!)',
|
|
|
|
|
'介绍:用于设置当前页SEO关键词 <br />
|
|
|
|
|
注意:多个关键词使用英文逗号进行隔开 <br />
|
|
|
|
|
例如:Typecho,Typecho主题,Typecho模板'
|
2021-01-20 08:06:51 +00:00
|
|
|
|
);
|
2021-02-05 10:27:44 +00:00
|
|
|
|
$layout->addItem($keywords);
|
|
|
|
|
|
|
|
|
|
$description = new Typecho_Widget_Helper_Form_Element_Textarea(
|
|
|
|
|
'description',
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
'SEO描述语(非常重要!)',
|
|
|
|
|
'介绍:用于设置当前页SEO描述语 <br />
|
|
|
|
|
注意:SEO描述语不应当过长也不应当过少'
|
|
|
|
|
);
|
|
|
|
|
$layout->addItem($description);
|
2021-01-21 10:41:21 +00:00
|
|
|
|
|
|
|
|
|
$abstract = new Typecho_Widget_Helper_Form_Element_Textarea(
|
|
|
|
|
'abstract',
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
2021-02-05 10:27:44 +00:00
|
|
|
|
'自定义摘要(非必填)',
|
2021-01-21 10:41:21 +00:00
|
|
|
|
'填写时:将会显示填写的摘要 <br>
|
|
|
|
|
不填写时:默认取文章里的内容'
|
|
|
|
|
);
|
|
|
|
|
$layout->addItem($abstract);
|
2021-02-05 10:27:44 +00:00
|
|
|
|
|
|
|
|
|
$thumb = new Typecho_Widget_Helper_Form_Element_Textarea(
|
|
|
|
|
'thumb',
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
'自定义缩略图(非必填)',
|
|
|
|
|
'填写时:将会显示填写的文章缩略图 <br>
|
|
|
|
|
不填写时:<br>
|
|
|
|
|
1、若文章有图片则取文章内图片 <br>
|
|
|
|
|
2、若文章无图片,并且外观设置里未填写·自定义缩略图·选项,则取模板自带图片 <br>
|
2021-02-11 04:46:01 +00:00
|
|
|
|
3、若文章无图片,并且外观设置里填写了·自定义缩略图·选项,则取自定义缩略图图片 <br>
|
|
|
|
|
注意:多个缩略图时换行填写,一行一个(仅在三图模式下生效)'
|
2021-02-05 10:27:44 +00:00
|
|
|
|
);
|
|
|
|
|
$layout->addItem($thumb);
|
2021-02-18 05:06:37 +00:00
|
|
|
|
|
|
|
|
|
$video = new Typecho_Widget_Helper_Form_Element_Textarea(
|
|
|
|
|
'video',
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
'M3U8或MP4地址(非必填)',
|
|
|
|
|
'填写后,文章会插入一个视频模板 <br>
|
|
|
|
|
格式:视频名称&视频地址。如果有多个,换行写即可 <br>
|
|
|
|
|
例如:<br>
|
|
|
|
|
第01集$https://iqiyi.cdn9-okzy.com/20201104/17638_8f3022ce/index.m3u8 <br>
|
|
|
|
|
第02集$https://iqiyi.cdn9-okzy.com/20201104/17639_5dcb8a3b/index.m3u8
|
|
|
|
|
'
|
|
|
|
|
);
|
|
|
|
|
$layout->addItem($video);
|
2021-01-20 08:06:51 +00:00
|
|
|
|
}
|