Skip to content
This repository was archived by the owner on Nov 11, 2021. It is now read-only.

Commit 0fab9ea

Browse files
author
bajins
committed
修改网站标题在配置中统一设置
1 parent 67de302 commit 0fab9ea

File tree

3 files changed

+28
-14
lines changed

3 files changed

+28
-14
lines changed

resources/DirectoryLister.php

+23-12
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function zipDirectory($directory) {
9898
$filename_no_ext = basename($directory);
9999

100100
if ($directory == '.') {
101-
$filename_no_ext = 'woytu Soft';
101+
$filename_no_ext = $this->_config['web_title'];
102102
}
103103

104104
// We deliver a zip file
@@ -194,7 +194,7 @@ public function listBreadcrumbs($directory = null) {
194194
// 静态设置主页路径
195195
$breadcrumbsArray[] = array(
196196
'link' => $this->_appURL,
197-
'text' => 'woytu Soft'
197+
'text' => $this->_config['web_title']
198198
);
199199

200200
// Generate breadcrumbs
@@ -257,9 +257,9 @@ public function containsIndex($dirPath) {
257257

258258

259259
/**
260-
* Get path of the listed directory
260+
* 获取列出的目录的路径
261261
*
262-
* @return string Path of the listed directory
262+
* @return string 列出目录的路径
263263
* @access public
264264
*/
265265
public function getListedPath() {
@@ -277,7 +277,7 @@ public function getListedPath() {
277277

278278

279279
/**
280-
* Returns the theme name.
280+
* 返回主题名称。
281281
*
282282
* @return string Theme name
283283
* @access public
@@ -289,9 +289,9 @@ public function getThemeName() {
289289

290290

291291
/**
292-
* Returns open links in another window
292+
* 返回另一个窗口中的打开链接
293293
*
294-
* @return boolean Returns true if in config is enabled open links in another window, false if not
294+
* @return boolean 如果在启用配置中打开另一个窗口中的链接,则返回true,否则返回false
295295
* @access public
296296
*/
297297
public function externalLinksNewWindow() {
@@ -438,18 +438,29 @@ public function getDirectoryPath() {
438438
return $this->_directory;
439439
}
440440

441+
/**
442+
* 获取配置
443+
*
444+
* @param string $text 配置名称
445+
* @return string config 配置值
446+
* @access public
447+
*/
448+
public function getConfig($text) {
449+
return $this->_config[$text];
450+
}
451+
441452

442453
/**
443-
* Add a message to the system message array
454+
* 将消息添加到系统消息数组
444455
*
445-
* @param string $type The type of message (ie - error, success, notice, etc.)
446-
* @param string $message The message to be displayed to the user
456+
* @param string $type 消息的类型 (ie - error, success, notice, etc.)
457+
* @param string $message 要显示给用户的消息
447458
* @return bool true on success
448459
* @access public
449460
*/
450461
public function setSystemMessage($type, $text) {
451462

452-
// Create empty message array if it doesn't already exist
463+
// 创建空消息数组(如果它尚不存在)
453464
if (isset($this->_systemMessage) && !is_array($this->_systemMessage)) {
454465
$this->_systemMessage = array();
455466
}
@@ -916,4 +927,4 @@ protected function _getRelativePath($fromPath, $toPath) {
916927

917928
}
918929

919-
}
930+
}

resources/config.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?php
22

33
return array(
4-
4+
// 网站标题
5+
'web_title' => 'Woytu Soft',
56
// 基本设置
67
'hide_dot_files' => true,
78
'list_folders_first' => true,

resources/themes/bootstrap/index.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<?php
33
header("Content-type: text/html; charset=utf-8");
44
$md_path_all = $lister->getListedPath();
5+
$config = $lister->getConfig('web_title');
56
$suffix_array = explode('.', $_SERVER['HTTP_HOST']);
67
$suffix = end($suffix_array);
78
$md_path = explode($suffix, $md_path_all);
@@ -22,7 +23,8 @@
2223
<html lang="zh-CN">
2324

2425
<head>
25-
<title>woytu Soft
26+
<title>
27+
<?php echo $config; ?>
2628
<?php echo $md_path_all; ?>
2729
</title>
2830
<!-- 网站LOGO -->

0 commit comments

Comments
 (0)