설치한 확장기능

From XFwiki
Jump to: navigation, search

Contents

엑파위키에 설치한 확장기능 모음

# PageAfterAndBefore 페이지 리스트 기능

wikipedia:Extension:PageAfterAndBefore

wikipedia:Extension:StubManager 설치해야 작동함

Features

{{#pagebefore: [context]|[namespace]|[title]|[category] }}
{{#pageafter: [context]|[namespace]|[title]|[category] }}
{{#firstpage: [context]|[namespace]| [category]|[filtercurrent] }}
{{#lastpage: [context]|[namespace]| [category]|[filtercurrent] }}

Where:

  • 'context' is reserved for future use
  • 'namespace' denotes the canonical name of the namespace one wishes to act on
  • 'title' denotes the 'prefixedDBkey' (i.e. title name with underscores)
  • 'category' denotes the category name used for filtering titles
  • 'filtercurrent' if the current title == last/first page, filter if 'yes'
    • i.e. if the page where the parser function is used also happens to be the last AND/OR first of the set, then it will be filtered OUT (not returned). If one wishes to have for return value the title in question anyways, then one must set filtercurrent to no.
{{PreviousNext}}
{{Prev}} ** {{Next}}


# 모바일 스킨 MobileDetect

wikipedia:Extension:MobileDetect

# MobileSkin
require_once("$IP/extensions/MobileDetect/MobileDetect.php");
$mobile = mobiledetect();
if ($mobile == false) $wgDefaultSkin = "vector"; # If not Mobile
if ($mobile == true) $wgDefaultSkin = "chick"; # If is Mobile


# 스팸방지 ConfirmEdit (웹사이트 주소가 있는 수정을 하면 사용자에게 더하기 빼기를 물어본다)

http://www.mediawiki.org/wiki/Extension:ConfirmEdit

  • The ConfirmEdit extension requires MediaWiki 1.11.0 or higher and PHP5

기본으로

Defaults from ConfirmEdit.php:
$wgGroupPermissions['*'            ]['skipcaptcha'] = false;
$wgGroupPermissions['user'         ]['skipcaptcha'] = false;
$wgGroupPermissions['autoconfirmed']['skipcaptcha'] = false;
$wgGroupPermissions['bot'          ]['skipcaptcha'] = true; // registered bots
$wgGroupPermissions['sysop'        ]['skipcaptcha'] = true;
$wgCaptchaTriggers['edit']          = false; // 페이지 고칠 때 안 물어 본다
$wgCaptchaTriggers['create']        = false; // 페이지 새로 만들 때 안 물어 본다
$wgCaptchaTriggers['addurl']        = true; // 링크가 들어가면 고칠 때 물어 본다 
$wgCaptchaTriggers['createaccount'] = true; // 아이디를 만들 때 물어 본다
$wgCaptchaTriggers['badlogin']      = true;
  • 주의사항: 때로 '스팸입니다'라는 메시지가 나오며 수정이 안되는 경우 호스팅의 문제일 수 있다.


# 오늘의 명언 (문장이 무작위로 나옴)

http://www.mediawiki.org/wiki/Extension:RandomSelection


<choose>
<option>"차는 미안해요." - 멀더 ([[XFeature02|극장판 2]])</option>
<option>핸드폰은 필요할 때면 안 터진다.</option>
<option>세기말이란 또다른 쓰레기같은 천년이 시작하는 것. - 호세 청([[mlm209]])</option>
<option>배우는 한 역을 하고 나면 다른 역을 위해 자신을 비워야 한다. - 서혜정</option>
<option>도겟: 키는 180 정도... (다들: 정말?)</option>
<option>우리는 우리가 아니다. ([[1X07]])</option>
<option>우선은 가장 많이 찍을 장소를 결정합니다. - 우린 이걸 이물(船首, 뱃머리)과 고물(船尾, 뱃꼬리)라고 부르는데 - 주 촬영장소를 발견하고 나서 꼬리 부분을 마저 결정하는 거죠. - 일트 존스 (장소섭외자)</option>
<option>"멀더는 나의 등대에요." - 스컬리 ([[7X04]])</option>
</choose>

Code

The code in this page will only work in MediaWiki 1.7 and above. (Alternate version for 1.5 and above)

<?php
/**
* RandomSelection -- randomly displays one of the given options.
* Usage: <choose><option>A</option><option>B</option></choose>
* Optional parameter: <option weight="3"> == 3x weight given
*
* @file
* @ingroup Extensions
* @version 2.1.4
* @date 30 September 2009
* @author Ross McClure <http://www.mediawiki.org/wiki/User:Algorithm>
* @link http://www.mediawiki.org/wiki/Extension:RandomSelection Documentation
*/

if( !defined( 'MEDIAWIKI' ) ) {
die( "This is not a valid entry point to MediaWiki.\n" );
}

// Avoid unstubbing $wgParser on setHook() too early on modern (1.12+) MW versions, as per r35980
if( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) {
$wgHooks['ParserFirstCallInit'][] = 'wfRandomSelection';
} else {
$wgExtensionFunctions[] = 'wfRandomSelection';
}

$wgExtensionCredits['parserhook'][] = array(
'name' => 'RandomSelection',
'version' => '2.1.4',
'author' => 'Ross McClure',
'description' => 'Displays a random option from the given set.',
'url' => 'http://www.mediawiki.org/wiki/Extension:RandomSelection',
);

function wfRandomSelection() {
global $wgParser;
$wgParser->setHook( 'choose', 'renderChosen' );
return true;
}

function renderChosen( $input, $argv, &$parser ) {
# Prevent caching
$parser->disableCache();

# Parse the options and calculate total weight
$len = preg_match_all( "/<option(?:(?:\\s[^>]*?)?\\sweight=[\"']?([^\\s>]+))?"
. "(?:\\s[^>]*)?>([\\s\\S]*?)<\\/option>/", $input, $out );
$r = 0;
for( $i = 0; $i < $len; $i++ ) {
if( strlen( $out[1][$i] ) == 0 )
$out[1][$i] = 1;
else
$out[1][$i] = intval( $out[1][$i] );
$r += $out[1][$i];
}

# Choose an option at random
if( $r <= 0 )
return '';
$r = mt_rand( 1, $r );
for( $i = 0; $i < $len; $i++ ) {
$r -= $out[1][$i];
if( $r <= 0 ) {
$input = $out[2][$i];
break;
}
}

# If running new parser, take the easy way out
if( defined( 'Parser::VERSION' ) && version_compare( Parser::VERSION, '1.6.1', '>' ) ) {
return $parser->recursiveTagParse( $input );
}

# Otherwise, create new parser to handle rendering
$localParser = new Parser();

# Initialize defaults, then copy info from parent parser
$localParser->clearState();
$localParser->mTagHooks         = $parser->mTagHooks;
$localParser->mTemplates        = $parser->mTemplates;
$localParser->mTemplatePath     = $parser->mTemplatePath;
$localParser->mFunctionHooks    = $parser->mFunctionHooks;
$localParser->mFunctionSynonyms = $parser->mFunctionSynonyms;

# Render the chosen option
$output = $localParser->parse( $input, $parser->mTitle,
$parser->mOptions, false, false );
return $output->getText();
}



# ShowHide (글 접었다 펴기)

http://www.mediawiki.org/wiki/Extension:ShowHide

Syntax

Syntax is a bit more advanced than what is usual for an extension:


<showhide>
Some text (usually title) which will not be hidden __HIDER__
<hide>Text which will be hidden</hide>
</showhide>

__HIDER__ is the place where link will be put which will show or hide the text between <hide></hide> tags. In the above example, it will be the string "Text which will be hidden".

If <show></show> tags are used, the text will be shown by default, and could be hidden by clicking on hider.



Source

Helpful hint: the copyright symbol and the script tags are messing up the display. Edit this page to copy the code! --Bytesmiths 03:14, 20 December 2005 (UTC)

v 0.1.1

PHP5 version with corrections according to Smerf's comments.

Note the following version does not work correctly for me on MediaWiki 1.5. The following will work correctly on the first load, but after loading from cache, the one-time Javascript code inserted by $wgOut->addHtml does not get added leading to problems. v.0.1 above works fine for me.


<?php
# MediaWiki ShowHide extension v0.1.1
#
# Based on example code from
# http://meta.wikimedia.org/wiki/Write_your_own_MediaWiki_extension
# Contains code from MediaWiki's Skin.php and wikibits.js
#
# All other code is copyright © 2005 Nikola Smolenski <smolensk@eunet.yu>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# To install, copy the extension to your extensions directory and add line
# include("extensions/ShowHide.php");
# to the bottom of your LocalSettings.php
#
# Example syntax:
#
# <showhide>
# Some text (usually title) which will not be hidden __HIDER__
# <hide>Text which will be hidden</hide>
# </showhide>
#
# If <show></show> tags are used instead of <hide></hide>, the text will be
# shown by default
#
# For more information see its page at
# http://www.mediawiki.org/wiki/Extension:ShowHide

$wgExtensionFunctions[]="wfShowHideExtension";

function wfShowHideExtension()
{
$GLOBALS['wgParser']->setHook("showhide","ShowHideExtension");
}

function ShowHideExtension($in)
{
global $wgOut;
static $numrun=0;

$out=$wgOut->parse($in);
if(
strpos($out,"__HIDER__")!==FALSE &&
((
($s=strpos($out,htmlentities("<show>")))!==FALSE &&
strpos($out,htmlentities("</show>"))>$s
) || (
($h=strpos($out,htmlentities("<hide>")))!==FALSE &&
strpos($out,htmlentities("</hide>"))>$h
))
) {
if($numrun==0) {
$wgOut->addHTML(
"<script type=\"text/javascript\"><!--
shWas=new Array();
function showSHToggle(show,hide,num) {
if(document.getElementById) {
document.writeln('<span class=\'toctoggle\'>[<a href=\"javascript:toggleSH('+num+')\" class=\"internal\">' +
'<span id=\"showlink'+num+'\" style=\"display:none;\">' + show + '</span>' +
'<span id=\"hidelink'+num+'\">' + hide + '</span>' +
'</a>]</span>');
}
}
function toggleSH(num) {
var shmain = document.getElementById('showhide'+num);
var sh = document.getElementById('shinside'+num);
var showlink=document.getElementById('showlink'+num);
var hidelink=document.getElementById('hidelink'+num);
if(sh.style.display == 'none') {
sh.style.display = shWas[num];
hidelink.style.display='';
showlink.style.display='none';
shmain.className = '';
} else {
shWas[num] = sh.style.display;
sh.style.display = 'none';
hidelink.style.display='none';
showlink.style.display='';
shmain.className = 'tochidden';
}
} // --></script>
");
}
$numrun++;

if($s!==FALSE)
$act="show";
else
$act="hide";

$hideline = ' <script type="text/javascript">showSHToggle("' . addslashes( wfMsg('showtoc') ) . '","' . addslashes( wfMsg('hidetoc') ) . '",' . $numrun . ')</script>';

$out=str_replace("__HIDER__","$hideline",$out);
$out=str_replace(
array(htmlentities("<$act>"),                htmlentities("</$act>")),
array("<div id=\"shinside$numrun\">","</div>"),
$out
);
$out="<span id=\"showhide$numrun\">$out</span>";
if($act=="hide")
$out.="<script type=\"text/javascript\">toggleSH($numrun)</script>";
}
return $out;
}



# 주석달기 (Cite)

http://www.mediawiki.org/wiki/Extension:Cite

(레퍼런스 태그가 자꾸 먹어서 한글자씩 떼어서 썼음 ;; 쓸 때는 당연히 붙여서 써야 함)

< r e f e r e n c e s / > 태그는 문서 중 < r e f > 와 < / r e f > 사이에 들어가는 것을 주석으로 표시한다. 주석 표시는 보통 문서 아래쪽에 주석 칸을 만들고 < r e f e r e n c e s / > 를 쓰면 자동으로 뜬다.

동에 번쩍, 서에 번쩍하는 법. < r e f > 컴패니언 pp. 86∼88, 2002. < / r e f > 

=== 주석 ===
< r e f e r e n c e s / >
첫 문장 끝에 ref 태그 이름을 설정.<ref name="multiple">주석에는 이 문구만 표시됨.</ref>

두 번째 문장도 같은 ref 태그 이름으로 설정.<ref name="multiple">이 문구는 표시되지 않음.</ref>

세 번째 문장도 역시 같은 ref 태그 이름으로 설정.<ref name="multiple" />

<references />

# 인터위키 (SpecialInterwiki)

http://www.mediawiki.org/wiki/Extension:SpecialInterwiki

3. Add this to your LocalSettings.php, somewhere near the bottom:

require_once("$IP/extensions/Interwiki/SpecialInterwiki.php");

4. Under that line, you have to add who can use Special:Interwiki.

If you want that sysops can use it:

$wgGroupPermissions['*']['interwiki'] = false;
$wgGroupPermissions['sysop']['interwiki'] = true;

If you want an additional user group: (those with the 'userrights' permission can assign this group - bureaucrats by default)

$wgGroupPermissions['*']['interwiki'] = false;
$wgGroupPermissions['interwiki']['interwiki'] = true;

인터위키 페이지로 가서 프리픽스를 등록하여 쓴다 http://xfwiki.com/XFwiki/index.php/Special:Interwiki

프리픽스는 일종의 말머리로, 연동한 위키끼리 앞의 위키 주소를 빼고 각 페이지끼리 연결한다. 예로

kowiki:인터위키 - 한국 위키피디아의 '인터위키' 항목에 걸린다

super:Dean_Winchester - 수퍼위키의 Dean Winchester 항목으로 간다


여기서 등록한 프리픽스는

[[kowiki:한국위키피디아]]
[[kowikipedia:한국위키피디아]] (kowiki, kowikipedia 모두 같은 한국위키피디아로 간다)
[[super:수퍼위키]] 수퍼위키로 간다
[[jandi:잔디밭]]

# 태그구름

http://www.mediawiki.org/wiki/Extension:WikiCategoryTagCloud

require_once( 'extensions/SelectCategoryTagCloud/SelectCategoryTagCloud.php' );
<tagcloud>

</tagcloud>


# 단축주소

위키주소.com/제목

http://www.mediawiki.org/wiki/Manual:Short_URL/Page_title_--_PHP_as_a_CGI_module,_no_root_access

정확히 확장기능은 아니고 .htaccess 생성과 LocalSettings.php 수정임


현재(2010/04/13) 두 개를 모두 수정할 경우 스킨이 작동하지 않아서 .htaccess 만 생성했음. 따라서 단축주소를 넣어도 이동하지만 다른 곳으로 이동할 때는 본래 주소로 작동한다.


LocalSettings.php 수정

Remove or comment out (with a # or / at the beginning of the line) any existing definition of $wgArticlePath, for example: (php에 있는 $wgArticlePath 정의를 모두 지운다. 예를 들면)
#$wgArticlePath      = "$wgScript/$1";
#$wgArticlePath      = "$wgScript?title=$1";

Instead, add the following line, best somewhere near the definition of $wgScriptPath:
(그것을 지우고 새로운 정의를 써 준다)

$wgArticlePath      = "/$1";
$wgUsePathInfo     = false;

It's for Add the following line so edit, logout, etc. links work
(두 번째 false 는 글 편집, 로그아웃 등등에 쓴다)


아래와 같이 .htaccess 생성, 미디어위키를 설치한 폴더가 아니라 루트에 넣는다.

RewriteEngine On
# anything line which contains a dot (.) without a colon (:) should be left alone
RewriteRule ^[^:]*\. - [L]
# anything line which contains a slash (/\) without a colon (:) should be left alone
RewriteRule ^[^:]*\/ - [L]
# redirect to main page
RewriteRule ^/*$ /wiki/index.php?title=Main_Page [L,QSA]
# anything else is to be treated as a title
RewriteRule ^(.+)$ /wiki/index.php?title=$1 [L,QSA]


엑파위키는 다음과 같은 .htaccess 를 넣었다

RewriteEngine On
# anything line which contains a dot (.) without a colon (:) should be left alone
RewriteRule ^[^:]*\. - [L]
# anything line which contains a slash (/\) without a colon (:) should be left alone
RewriteRule ^[^:]*\/ - [L]
# redirect to main page
RewriteRule ^/*$ /XFwiki/index.php?title=Main_Page [L,QSA]
# anything else is to be treated as a title
RewriteRule ^(.+)$ /XFwiki/index.php?title=$1 [L,QSA]


# StubManager

http://www.mediawiki.org/wiki/Extension:StubManager

로딩이 느릴 때 속도를 올려주는 기능. 더 이상 업데이트 없음. "This extension lowers loading times which speeds up MediaWiki sites. This is done by addressing 'rare events' handling through class object 'stubs'. For infrequent events (of course this is relative!), use this extension to create a 'stub object' for the required hooks."


#UserMerge

http://www.mediawiki.org/wiki/Extension:UserMerge

사용자를 합치는 확장기능. Special 페이지에서 합칠 수 있다.


#Nuke

http://www.mediawiki.org/wiki/Nuke

미디어위키 1.18 번들설치 확장기능. 여러 글을 한꺼번에 지울 수 있다. Special 페이지에서 지울 수 있다.



확장기능 설치방법

  1. 확장기능 소스(코드)를 php로 만든다
    1. php 코드를 utf-8로 만들때 BOM이 들어가지 않도록 한다. AcroEdit 상위버전에 없애는 옵션 있음
  1. 만든 php를 같은 이름의 폴더로 만들어 확장폴더에 넣는다
    1. extentions/만든확장기능/만든확장기능.php
  1. LocalSettings.php 의 맨 아랫줄에 추가한다
    1. php 코드를 utf-8로 만들때 BOM이 들어가지 않도록 한다. AcroEdit 상위버전에 없애는 옵션 있음

#오늘의 명언
require_once( "$IP/extensions/RandomSelection/RandomSelection.php" );

Personal tools
Namespaces

Variants
Actions
원전
팬활동
1013 Production
기타
그리고
Toolbox