Extension:Redirect302/de

This page is a translated version of the page Extension:Redirect302 and the translation is 11% complete.
Other languages:
MediaWiki-Erweiterungen
OOjs UI icon advanced-invert.svg
Redirect302
Freigabestatus: ohne Wartung
Einbindung Hook
Beschreibung Adds a hook to create 302 style redirects
Autor(en) Joshua Gay (JoshuagayDiskussion)
Letzte Version 0.2 (2012-11-07)
MediaWiki 1.17+
Datenbankänderungen Nein
Lizenz GPL
Herunterladen see below
Beispiel The Free Software Directory

Prüfe die Benutzungs- und Versionsmatrix.

The Redirect302 extension changes the redirect hook so that an http 302 error is issued and the redirect is done on the client side.

Installation

  • Die Copy the code into files und die Datei(en) in ein Verzeichnis namens Redirect302 im Ordner extensions/ ablegen.
  • Folgenden Code am Ende der LocalSettings.php hinzufügen:
    require_once "$IP/extensions/Redirect302/Redirect302.php";
    
  •   Erledigt – Zu Special:Version in dem Wiki (bei Einstellung auf deutsch nach Spezial:Version) navigieren, um die erfolgreiche Installierung der Erweiterung zu überprüfen.

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
 */

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

/** German (Deutsch)
 * @author ?
 */
$messages['de'] = array(
         'redirect302-desc' => 'Adds a hook to create 302 style redirects',
);