Jony/functions.php

144 lines
6.1 KiB
PHP
Raw Normal View History

2021-01-19 07:41:08 +00:00
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
require_once("core/core.php");
function themeConfig($form)
{
$_db = Typecho_Db::get();
$_prefix = $_db->getPrefix();
try {
if (!array_key_exists('view', $_db->fetchRow($_db->select()->from('table.contents')->page(1, 1)))) {
$_db->query('ALTER TABLE `' . $_prefix . 'contents` ADD `view` INT DEFAULT 0;');
}
if (!array_key_exists('agree', $_db->fetchRow($_db->select()->from('table.contents')->page(1, 1)))) {
$_db->query('ALTER TABLE `' . $_prefix . 'contents` ADD `agree` INT DEFAULT 0;');
}
} catch (Exception $e) {
}
?>
<link rel="stylesheet" href="<?php Helper::options()->themeUrl('assets/css/joe.config.css') ?>">
<script src="<?php Helper::options()->themeUrl('assets/js/joe.config.js') ?>"></script>
<div class="joe_config">
<div>
<div class="joe_config__aside">
<div class="logo">Joe <?php echo _getVersion() ?></div>
<ul class="tabs">
<li class="item" data-current="joe_notice">最新公告</li>
<li class="item" data-current="joe_global">全局设置</li>
<li class="item" data-current="joe_image">图片设置</li>
<li class="item" data-current="joe_post">文章设置</li>
<li class="item" data-current="joe_aside">侧栏设置</li>
<li class="item" data-current="joe_index">首页设置</li>
<li class="item" data-current="joe_other">其他设置</li>
</ul>
<?php require_once('core/backup.php'); ?>
</div>
</div>
<div class="joe_config__notice">请求数据中...</div>
<?php
$JFavicon = new Typecho_Widget_Helper_Form_Element_Textarea(
'JFavicon',
NULL,
2021-01-20 04:48:41 +00:00
'https://cdn.jsdelivr.net/gh/HaoOuBa/Joe@master/favicon.ico',
2021-01-20 06:15:32 +00:00
'网站 Favicon 设置',
2021-01-19 07:41:08 +00:00
'介绍:用于设置网站 Favicon一个好的 Favicon 可以给用户一种很专业的观感 <br />
格式:图片 URL地址 Base64 地址 <br />
其他:免费转换 Favicon 网站 <a target="_blank" href="//tool.lu/favicon">tool.lu/favicon</a>'
);
$JFavicon->setAttribute('class', 'joe_content joe_image');
$form->addInput($JFavicon);
2021-01-19 09:56:21 +00:00
$JLogo = new Typecho_Widget_Helper_Form_Element_Textarea(
'JLogo',
NULL,
'https://cdn.jsdelivr.net/gh/HaoOuBa/Joe@master/assets/img/logo.png',
2021-01-20 06:15:32 +00:00
'网站 Logo 设置',
2021-01-19 09:56:21 +00:00
'介绍:用于设置网站 Logo一个好的 Logo 能为网站带来有效的流量 <br />
格式:图片 URL地址 Base64 地址 <br />
其他:免费制作 logo 网站 <a target="_blank" href="//www.uugai.com">www.uugai.com</a>'
);
$JLogo->setAttribute('class', 'joe_content joe_image');
$form->addInput($JLogo);
2021-01-19 10:45:14 +00:00
$JNavMaxNum = new Typecho_Widget_Helper_Form_Element_Select(
'JNavMaxNum',
array(
'3' => '3个默认',
'4' => '4个',
'5' => '5个',
'6' => '6个',
'7' => '7个',
),
'3',
'选择导航栏最大显示的个数',
'介绍:用于设置最大多少个后,以更多下拉框显示'
);
$JNavMaxNum->setAttribute('class', 'joe_content joe_global');
$form->addInput($JNavMaxNum->multiMode());
2021-01-20 04:39:49 +00:00
$JAside = new Typecho_Widget_Helper_Form_Element_Checkbox(
'JAside',
array(
'author' => '作者栏',
2021-01-20 06:15:32 +00:00
'timelife' => '计时栏',
2021-01-20 04:39:49 +00:00
),
null,
2021-01-20 06:15:32 +00:00
'选择首页需要显示的侧边栏栏目',
2021-01-20 04:39:49 +00:00
'介绍:用于控制首页侧边栏的栏目显示规则 <br>
注意:如果全部未选,则表示不开启侧边栏'
);
$JAside->setAttribute('class', 'joe_content joe_aside');
$form->addInput($JAside->multiMode());
2021-01-20 04:47:04 +00:00
$JAside_Author_Image = new Typecho_Widget_Helper_Form_Element_Textarea(
'JAside_Author_Image',
NULL,
2021-01-20 04:48:41 +00:00
"https://cdn.jsdelivr.net/gh/HaoOuBa/Joe@master/assets/img/aside_author_image.jpg",
2021-01-20 06:15:32 +00:00
'作者栏 —— 背景',
2021-01-20 04:47:04 +00:00
'介绍:用于修改作者栏的背景图片 <br/>
格式:图片地址 <br />
注意:不填写时,则显示默认背景'
);
$JAside_Author_Image->setAttribute('class', 'joe_content joe_aside');
$form->addInput($JAside_Author_Image);
2021-01-20 06:15:32 +00:00
$JAside_Author_Link = new Typecho_Widget_Helper_Form_Element_Textarea(
'JAside_Author_Link',
NULL,
"https://ae.js.cn",
'作者栏 —— 跳转链接',
'介绍:用于修改作者栏的跳转链接'
);
$JAside_Author_Link->setAttribute('class', 'joe_content joe_aside');
$form->addInput($JAside_Author_Link);
$JAside_Author_Motto = new Typecho_Widget_Helper_Form_Element_Textarea(
'JAside_Author_Motto',
NULL,
"有钱终成眷属,没钱亲眼目睹",
'作者栏 —— 座右铭',
'介绍:用于显示在侧边栏作者信息的座右铭。<br />
格式:可以填写多行也可以填写一行,填写多行时,每次随机显示其中的某一条'
);
$JAside_Author_Motto->setAttribute('class', 'joe_content joe_aside');
$form->addInput($JAside_Author_Motto);
$JAside_Author_Nav = new Typecho_Widget_Helper_Form_Element_Select(
'JAside_Author_Nav',
array(
'off' => '关闭(默认)',
'3' => '开启并显示3条最新文章',
'4' => '开启并显示4条最新文章',
'5' => '开启并显示5条最新文章',
'6' => '开启并显示6条最新文章',
'7' => '开启并显示7条最新文章',
'8' => '开启并显示8条最新文章',
'9' => '开启并显示9条最新文章',
'10' => '开启并显示10条最新文章'
),
'off',
'作者栏 —— 随机文章数目',
'介绍:用于控制作者栏的随机文章条数'
);
$JAside_Author_Nav->setAttribute('class', 'joe_content joe_aside');
$form->addInput($JAside_Author_Nav->multiMode());
2021-01-19 07:41:08 +00:00
} ?>