Manual:$wgUrlProtocols

From MediaWiki.org
Jump to: navigation, search
This page is a translated version of the page Manual:$wgUrlProtocols and the translation is 44% complete.

Other languages:
English • ‎français • ‎日本語 • ‎한국어 • ‎polski • ‎中文
Site customization: $wgUrlProtocols
mediawikiパーサーが対応してHTMLに変換するプロトコルを定義する。
導入されたバージョン: 1.5.0 (r10229)
除去されたバージョン: 使用中
可能な値: 文字列の配列
string containing a regular expression before 1.6.0
既定値: 下記参照
他の設定: アルファベット順 | 機能順


詳細[edit]

MediaWiki が wfParseUrl() で有効と認識する URL プロトコルを定義します。 これは多くの箇所で使用されています。 The most visible effect is it determines what protocols are allowed for external links: unrecognized protocols are ignored, no link is generated. However, it's used in many other places too, including the code for Special:LinkSearch, and utility functions like wfParseUrl() that are used in a wide variety of different places.

機能しないいくつかの例 ("test://" は有効なプロトコルとして定義されていないため):

  • test://www.example.com
  • [test://www.example.com]
  • [test://www.example.com リンク テキスト]
Some browsers, like Mozilla Firefox, will not follow file URLs on pages that have been loaded via HTTP. This is a security measure. See this mozillaZine article for more information, including some hints on how to overcome this restriction.
Most browsers do not support "remote file" URLs like file://host/share (only Internet Explorer handles these per default. For Firefox, a plugin is required or use exactly 5 slashes like file://///host/share, see [1])
警告 警告: In MediaWiki 1.20.2+, adding "file:" without trailing slashes to $wgUrlProtocols will break image embedding using the [[File:Image.jpg]] syntax. This is a known bug related to a change that made URL protocol matching case-insensitive. As a workaround, use "file://" instead of "file:" as shown below.

ローカルファイルへのリンク(これはイントラネットの状況で意味があるかも知れません)を許可するには, LocalSettings.php にこれを入れてください:

$wgUrlProtocols[] = "file://";

Usually you only want to add protocols to this array.

既定値[edit]

MediaWiki バージョン: 1.24
$wgUrlProtocols = array(
   'bitcoin:', 'ftp://', 'ftps://', 'geo:', 'git://', 'gopher://', 'http://',
   'https://', 'irc://', 'ircs://', 'magnet:', 'mailto:', 'mms://', 'news:',
   'nntp://', 'redis://', 'sftp://', 'sip:', 'sips:', 'sms:', 'ssh://',
   'svn://', 'tel:', 'telnet://', 'urn:', 'worldwind://', 'xmpp:', '//'
);


MediaWiki バージョン: 1.22 – 1.23
$wgUrlProtocols = array(
	'http://',
	'https://',
	'ftp://',
	'ftps://', // If we allow ftp:// we should allow the secure version.
	'ssh://',
	'sftp://', // SFTP > FTP
	'irc://',
	'ircs://', // @bug 28503
	'xmpp:', // Another open communication protocol
	'sip:',
	'sips:',
	'gopher://',
	'telnet://', // Well if we're going to support the above.. -ævar
	'nntp://', // @bug 3808 RFC 1738
	'worldwind://',
	'mailto:',
	'tel:', // If we can make emails linkable, why not phone numbers?
	'sms:', // Likewise this is standardized too
	'news:',
	'svn://',
	'git://',
	'mms://',
	'bitcoin:', // Even registerProtocolHandler whitelists this along with mailto:
	'magnet:', // No reason to reject torrents over magnet: when they're allowed over http://
	'urn:', // Allow URNs to be used in Microdata/RDFa <link ... href="urn:...">s
	'geo:', // urls define geo locations, they're useful in Microdata/RDFa and for coordinates
	'//', // for protocol-relative URLs
);


MediaWiki バージョン: 1.18 – 1.21
$wgUrlProtocols = array(
  'http://',
  'https://',
  'ftp://',
  'irc://',
  'ircs://', // @bug 28503
  'gopher://',
  'telnet://', // Well if we're going to support the above.. -ævar
  'nntp://', // @bug 3808 RFC 1738
  'worldwind://',
  'mailto:',
  'news:',
  'svn://',
  'git://',
  'mms://',
  '//', // for protocol-relative URLs
);

Advanced modification[edit]

The default protocols should all be safe to click on (no evil side effects), and removing a protocol from the list will cause URLs using those protocols to become unrecognized in many places throughout the software. In particular, removing 'http://' or other common protocols will probably break huge amounts of stuff. Nevertheless, if you need to do so (for example, you already have a News: namespace), you can do something like this:

$wgUrlProtocols = array_diff($wgUrlProtocols, array('news:'));

関連項目[edit]