Jony/core/core.php
2021-02-16 20:26:00 +08:00

152 lines
4.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/* 继承方法函数 */
require_once('widget.php');
/* 公用函数 */
require_once('function.php');
/* 过滤内容函数 */
require_once('parse.php');
/* 主题内置开放API */
require_once('route.php');
/* 插件方法 */
require_once('factory.php');
/* 页面加载计时 */
_startCountTime();
/* 主题初始化 */
function themeInit($self)
{
/* 强奸用户关闭反垃圾保护 */
Helper::options()->commentsAntiSpam = false;
/* 强奸用户关闭检查来源URL */
Helper::options()->commentsCheckReferer = false;
/* 强奸用户要求填写邮箱 */
Helper::options()->commentsRequireMail = true;
/* 强奸用户要求无需填写url */
Helper::options()->commentsRequireURL = false;
/* 强制用户评论回复 */
Helper::options()->commentsThreaded = true;
/* 强制显示一页12篇文章 */
$self->parameter->pageSize = 12;
/* 主题开放API 路由规则 */
$path_info = $self->request->getPathinfo();
if ($path_info == "/joe/api") {
switch ($self->request->routeType) {
case 'aside_ranking':
_getRanking($self);
break;
case 'publish_list':
_getPost($self);
break;
case 'baidu_record':
_getRecord($self);
break;
case 'baidu_push':
_pushRecord($self);
break;
case 'handle_views':
_handleViews($self);
break;
case 'handle_agree':
_handleAgree($self);
break;
case 'wallpaper_type':
_getWallpaperType($self);
break;
case 'wallpaper_list':
_getWallpaperList($self);
break;
case 'maccms_list':
_getMaccmsList($self);
break;
case 'huya_list':
_getHuyaList($self);
break;
};
}
}
/* 增加自定义字段 */
function themeFields($layout)
{
$mode = new Typecho_Widget_Helper_Form_Element_Radio(
'mode',
array(
'default' => '默认模式',
'single' => '大图模式',
'multiple' => '三图模式',
'none' => '无图模式'
),
'default',
'文章显示方式',
'介绍:用于设置当前文章在首页和搜索页的显示方式 <br />
注意:独立页面该功能不会生效'
);
$layout->addItem($mode);
$aside = new Typecho_Widget_Helper_Form_Element_Radio(
'aside',
array(
'on' => '开启',
'off' => '关闭'
),
'on',
'是否开启当前页侧边栏',
'介绍:用于单独设置当前页侧边栏的开启状态 <br />
注意:只有在外观设置侧边栏开启状态下生效'
);
$layout->addItem($aside);
$keywords = new Typecho_Widget_Helper_Form_Element_Text(
'keywords',
NULL,
NULL,
'SEO关键词非常重要',
'介绍用于设置当前页SEO关键词 <br />
注意:多个关键词使用英文逗号进行隔开 <br />
例如Typecho,Typecho主题,Typecho模板'
);
$layout->addItem($keywords);
$description = new Typecho_Widget_Helper_Form_Element_Textarea(
'description',
NULL,
NULL,
'SEO描述语非常重要',
'介绍用于设置当前页SEO描述语 <br />
注意SEO描述语不应当过长也不应当过少'
);
$layout->addItem($description);
$abstract = new Typecho_Widget_Helper_Form_Element_Textarea(
'abstract',
NULL,
NULL,
'自定义摘要(非必填)',
'填写时:将会显示填写的摘要 <br>
不填写时:默认取文章里的内容'
);
$layout->addItem($abstract);
$thumb = new Typecho_Widget_Helper_Form_Element_Textarea(
'thumb',
NULL,
NULL,
'自定义缩略图(非必填)',
'填写时:将会显示填写的文章缩略图 <br>
不填写时:<br>
1、若文章有图片则取文章内图片 <br>
2、若文章无图片并且外观设置里未填写·自定义缩略图·选项则取模板自带图片 <br>
3、若文章无图片并且外观设置里填写了·自定义缩略图·选项则取自定义缩略图图片 <br>
注意:多个缩略图时换行填写,一行一个(仅在三图模式下生效)'
);
$layout->addItem($thumb);
}