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

Commit

Permalink
修改网站标题在配置中统一设置
Browse files Browse the repository at this point in the history
  • Loading branch information
bajins committed Aug 7, 2019
1 parent 67de302 commit 0fab9ea
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
35 changes: 23 additions & 12 deletions resources/DirectoryLister.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function zipDirectory($directory) {
$filename_no_ext = basename($directory);

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

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

// Generate breadcrumbs
Expand Down Expand Up @@ -257,9 +257,9 @@ public function containsIndex($dirPath) {


/**
* Get path of the listed directory
* 获取列出的目录的路径
*
* @return string Path of the listed directory
* @return string 列出目录的路径
* @access public
*/
public function getListedPath() {
Expand All @@ -277,7 +277,7 @@ public function getListedPath() {


/**
* Returns the theme name.
* 返回主题名称。
*
* @return string Theme name
* @access public
Expand All @@ -289,9 +289,9 @@ public function getThemeName() {


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

/**
* 获取配置
*
* @param string $text 配置名称
* @return string config 配置值
* @access public
*/
public function getConfig($text) {
return $this->_config[$text];
}


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

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

}

}
}
3 changes: 2 additions & 1 deletion resources/config.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php

return array(

// 网站标题
'web_title' => 'Woytu Soft',
// 基本设置
'hide_dot_files' => true,
'list_folders_first' => true,
Expand Down
4 changes: 3 additions & 1 deletion resources/themes/bootstrap/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<?php
header("Content-type: text/html; charset=utf-8");
$md_path_all = $lister->getListedPath();
$config = $lister->getConfig('web_title');
$suffix_array = explode('.', $_SERVER['HTTP_HOST']);
$suffix = end($suffix_array);
$md_path = explode($suffix, $md_path_all);
Expand All @@ -22,7 +23,8 @@
<html lang="zh-CN">

<head>
<title>woytu Soft
<title>
<?php echo $config; ?>
<?php echo $md_path_all; ?>
</title>
<!-- 网站LOGO -->
Expand Down

0 comments on commit 0fab9ea

Please sign in to comment.