「MediaWiki LocalSettings.php」修訂間的差異

出自ChevyneWiki
跳至導覽 跳至搜尋
行 39: 行 39:
 
* 移除 Logo
 
* 移除 Logo
 
$wgLogo = "";
 
$wgLogo = "";
  +
* Footer Icons
  +
$wgFooterIcons['hostingby']['doncloud'] = [
  +
"src" => "http://www.doncloud.vip/wp-content/uploads/2019/03/doncloud-01_2.png",
  +
"url" => "http://www.doncloud.vip",
  +
"alt" => "Hosting by DonCloud",
  +
// For HiDPI support, you can specify paths to larger versions of the icon.
  +
"srcset" =>
  +
"/path/to/1.5x_version.png 1.5x, " .
  +
"/path/to/2x_version.png 2x",
  +
// If you have a non-default sized icon you can specify the size yourself.
  +
"height" => "31",
  +
"width" => "88",
  +
];
 
== 上傳 ==
 
== 上傳 ==
 
## 開啟上傳功能,預設上傳路徑在images資料夾
 
## 開啟上傳功能,預設上傳路徑在images資料夾

於 2021年2月9日 (二) 02:09 的修訂

Logo & Icon

  • 設定 Logo 及 Icon
    icon => 最大 50 x 50 pixels
    1x => 最大 135 x 135 pixels
    1.5x => 最大 202 x 202 pixels
    2x => 最大 270 x 270 pixels
    svg => 需是方形
## The URL paths to the logo.  Make sure you change this from the default,
## or else you'll overwrite your logo when you upgrade!
## $wgLogos = [ '1x' => "$wgResourceBasePath/resources/assets/wiki.png" ];
$wgLogos = [
	'1x' => "path/to/1x_version.png",
	'1.5x' => "path/to/1.5x_version.png",
	'2x' => "path/to/2x_version.png",
	'svg' => "path/to/svg_version.svg",
	'icon' => "path/to/icon.png",  // A version of the logo without wordmark and tagline
	'wordmark' => [
		'src' => "path/to/wordmark_version.png",
		'1x' => "path/to/wordmark_version.svg", // optional if you want to support browsers with SVG support with an SVG logo.
		'width' => 135,
		'height' => 20,
	],
	'tagline' => [
		'src' => "path/to/tagline_version.png",
		'width' => 135,
		'height' => 15,
	],
];

$wgFavicon = "path/to/Favicon.ico";
$wgAppleTouchIcon = "path/to/AppleTouchIcon.ico";
  • 隨機 Logo
$logoNames[] = "Logo01.png";
$logoNames[] = "Logo02.png";
$logoNames[] = "Logo03.png";
$logoNames[] = "Logo04.png";
$logoNames[] = "Logo05.png";
$wgLogo = "/myWiki/skins/common/images/".$logoNames[array_rand($logoNames)];
  • 移除 Logo
$wgLogo = "";
  • Footer Icons
$wgFooterIcons['hostingby']['doncloud'] = [
	"src" => "http://www.doncloud.vip/wp-content/uploads/2019/03/doncloud-01_2.png",
	"url" => "http://www.doncloud.vip",
	"alt" => "Hosting by DonCloud",
	// For HiDPI support, you can specify paths to larger versions of the icon.
	"srcset" =>
		"/path/to/1.5x_version.png 1.5x, " .
		"/path/to/2x_version.png 2x",
	// If you have a non-default sized icon you can specify the size yourself.
	"height" => "31",
	"width" => "88",
];

上傳

## 開啟上傳功能,預設上傳路徑在images資料夾
$wgEnableUploads = true;
## 允許上傳的檔案類型,此選項請手動加入LocalSettings.php中,預設無此選項。
$wgFileExtensions = array('png', 'gif', 'jpg', 'jpeg','zip','doc','ppt','pdf','xls');
## 建議設為false,可給予使用多較的彈性。
$wgStrictFileExtensions = false;
## 上傳大小,以byte為單位,預設為150K,建議改為10 M。
$wgUploadSizeWarning = 10 * 1024 * 1024;

開啟外部圖片功能

MeiaWiki預設只能顯示上傳到本身網站的圖片連結,例如[ [ Image:Example.jpg ] ];但對於外部圖片是無法顯示的,此功能的選項如下,將其設為true即可開啟:

$wgAllowExternalImages = false;

然後就可以使用URL的方式來顯示圖片。

Subpages 子頁面

子頁面的功能,可以讓編輯者用子頁面的語法,來產生目前面頁的子頁面,然後在子頁面會建立與其父頁面的導覽連結;預設開啟的命名空間(namespace)為:

//預設開啟的子頁面功能
$wgNamespacesWithSubpages = array(
	NS_TALK           => true,
	NS_USER           => true,
	NS_USER_TALK      => true,
	NS_PROJECT_TALK   => true,
	NS_IMAGE_TALK     => true,
	NS_MEDIAWIKI_TALK => true,
	NS_TEMPLATE_TALK  => true,
	NS_HELP_TALK      => true,
	NS_CATEGORY_TALK  => true
);

預設MAIN這個命名空間是沒有開啟子頁面的功能;MAIN這個命名空間也就是在頁面前無任何命名空間前置詞(例如Image:Education.jpg)的頁面;若要開啟可更改如下:

//開啟MAIN命名空間的子頁面功能
$wgNamespacesWithSubpages = array(
	NS_MAIN           => true, //新加入的命名空間
	NS_TALK           => true,
	NS_USER           => true,
	NS_USER_TALK      => true,
	NS_PROJECT_TALK   => true,
	NS_IMAGE_TALK     => true,
	NS_MEDIAWIKI_TALK => true,
	NS_TEMPLATE_TALK  => true,
	NS_HELP_TALK      => true,
	NS_CATEGORY_TALK  => true
);

調整顯示時間

MediaWiki 預設顯示的時間為伺服器上的時間。

此處以臺灣的時間來做設定,詳細有哪些TimeZone可以參考 timeanddate.com 網站的資料。

#Set Default Timezone
$wgLocaltimezone = "Asia/Taipei";
date_default_timezone_set( $wgLocaltimezone );