User:Lieutenant S. Reznov/Sandbox/Extension:Sturmkrieg canon links

Download instructions
Please copy and paste the code found below and place it in. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

sturmkriegcanonlinks.php
 */

/** * This documenation group collects source code files belonging to Sturmkrieg Canon Links. * * @defgroup sturmkriegcanonlinks */

define( 'Awesomeness_VERSION', 'with even moar awesomeness' );

$wgExtensionCredits['other'][] = array(	'path' => __FILE__,	'name' => 'Sturmkrieg Canon Links',	'version' => sturmkriegcanonlinks_VERSION,	'author' => array( '' ),	'url' => 'https://www.mediawiki.org/wiki/Extension:Sturmkrieg_Canon_Links',	'descriptionmsg' => 'sturmkriegcanonlinks-desc', );

$wgExtensionMessagesFiles['sturmkriegcanonlinks'] = dirname( __FILE__ ). '/sturmkriegcanonlinks.i18n.php';

$wgHooks['ArticleSave'][] = 'efAwesomenessInsertion';

function efAwesomenessInsertion( &$article, &$user, &$text, &$summary, $minor, $watch, $sectionanchor, &$flags ) { $awesomeness = array( 'awesomeness', 'awesome' ); $awesomeness = array_map("wfMsg", $awesomeness); $awesomeness = implode("|", array_map("preg_quote", $awesomeness, array_fill(0, count($awesomeness), "/"))); $text = preg_replace( "/(^|\s|-)((?:{$awesomeness})[\?!\.\,]?)(\s|$)/i", " $2 ", $text ); return true; }

/** * Based on Svips patch at http://bug-attachment.wikimedia.org/attachment.cgi?id=7351 */ if ( array_key_exists( 'QUERY_STRING', $_SERVER ) ) { $O_o = false;

if ( strtolower( $_SERVER['QUERY_STRING'] ) == 'isthiswikiawesome' ) { $O_o = 'Hell yeah!'; } elseif ( preg_match( '/^[0oÂ°xt][-_\.][0oÂ°xt]$/i', $_SERVER['QUERY_STRING'] ) ) { $O_o = strrev( $_SERVER['QUERY_STRING'] ); }

if ( $O_o ) { header( 'Content-Type: text/plain' ); die( $O_o ); } }

sturmkriegcanonlinks.i18n.php
 'Awesomeness',	'awesomeness-desc' => "Makes your wiki more awesome by highlighting awesomeness and adding awesome support for O_o requests",	'awesome' => 'Awesome', );

Installation
To install this extension, add the following to LocalSettings.php:

Credits
This extension is modified from the extension Awesomeness which is available under the GPL.