Extension:Redirect302/ko
Appearance
This extension stores its source code on a editable wiki page rather than in a code repository. As a result, this code may be maliciously altered. It may contain security vulnerabilities, and will not receive localisation updates from translatewiki.net. Developers are strongly encouraged to host their code in a code repository rather than a wiki page so that the extension can be properly maintained, reviewed, and kept secure. |
This extension is currently not actively maintained! Although it may still work, any bug reports or feature requests will more than likely be ignored. |
출시 상태: 관리되지 않음 |
|
|---|---|
| 구현 | 훅 |
| 설명 | Adds a hook to create 302 style redirects |
| 만든 이 | Joshua Gay (Joshuagay토론) |
| 최신 버전 | 0.2 (2012-11-07) |
| MediaWiki | 1.17+ |
| 데이터베이스 변경 | 아니오 |
| Licence | GNU General Public License 2.0 or later |
| 다운로드 | see below |
| 예시 | The Free Software Directory |
The Redirect302 extension changes the redirect hook so that an http 302 error is issued and the redirect is done on the client side.
설치
- 파일을 Copy the code into files하고
Redirect302폴더를extensions/디렉토리에 넣어 주세요. - 아래의 코드를 LocalSettings.php 코드의 마지막에 추가합니다.
require_once "$IP/extensions/Redirect302/Redirect302.php";
완료 – 위키의 ‘Special:Version’에 이동해서, 확장기능이 올바르게 설치된 것을 확인합니다.
Code
Redirect302.php
<?php
/**
* This extension changes the redirect hook so that an http 302 error is issued and the redirect is done on the client side.
*
* @file
* @ingroup Extensions
* license: GPL-2.0-or-later
*/
if ( !defined( 'MEDIAWIKI' ) ) die();
// credits
define('Redirect302_VERSION', '0.2' );
$wgExtensionCredits['other'][] = array(
'path' => __FILE__,
'name' => 'Redirect302',
'version' => Redirect302_VERSION,
'author' => array( 'Joshua Gay' ),
'url' => 'https://www.mediawiki.org/wiki/Extension:Redirect302',
'descriptionmsg' => 'redirect302-desc',
);
// messages i18n
$dir = dirname(__FILE__) . '/';
$wgExtensionMessagesFiles['Redirect302'] = $dir . 'Redirect302.i18n.php';
// Register hook
$wgHooks['InitializeArticleMaybeRedirect'][] = 'redirect302_hook';
// Redirect with 302
function redirect302_hook($title, $request, &$ignoreRedirect, &$target, &$article) {
if (!$ignoreRedirect && $article->isRedirect()) {
if(($target = $article->followRedirect()) instanceof Title) {
$target = $target->getFullURL();
}
}
return true;
}
Redirect302.i18n.php
<?php
/**
* Internationalisation file for extension Redirect302.
*
* @file
* @ingroup Extensions
*/
$messages = array();
/** English
* @author Joshua Gay
*/
$messages['en'] = array(
'redirect302-desc' => 'Adds a hook to create 302 style redirects',
);
/** German (Deutsch)
* @author Kghbln
*/
$messages['de'] = array(
'redirect302-desc' => 'Ermöglicht Umleitungen mit HTTP-Statuscode 302',
);
On-wiki translation
/** Korean (한국어)
* @author ?
*/
$messages['ko'] = array(
'redirect302-desc' => 'Adds a hook to create 302 style redirects',
);
