Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: ef889f719b
Fetching contributors…

Cannot retrieve contributors at this time

50 lines (43 sloc) 1.173 kB
<?php
/**
* Parser hook extension adds a <sort> tag to wiki markup
*
* @file
* @ingroup Extensions
* @author Rob Church <robchur@gmail.com>
* @copyright © 2006 Rob Church
* @licence GNU General Public Licence 2.0
*/
if( !defined( 'MEDIAWIKI' ) ) {
echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" );
exit( 1 );
}
$wgAutoloadClasses['Sorter'] = dirname( __FILE__ ) . '/Sort.class.php';
$wgExtensionFunctions[] = 'efSort';
$wgExtensionCredits['parserhook'][] = array(
'path' => __FILE__,
'name' => 'Sort',
'author' => 'Rob Church',
'description' => 'Create simple sorted lists using <tt>&lt;sort&gt;</tt>',
'url' => 'http://www.mediawiki.org/wiki/Extension:Sort',
);
/**
* Register hook function
*/
function efSort() {
global $wgParser;
$wgParser->setHook( 'sort', 'efRenderSort' );
}
/**
* Hook callback for <sort>
*
* @param string $input Input text
* @param array $args Tag arguments
* @param Parser $parser Parent parser
* @return string
*/
function efRenderSort( $input, $args, &$parser ) {
$sorter = new Sorter( $parser );
$sorter->loadSettings( $args );
return $sorter->sort( $input );
}
Jump to Line
Something went wrong with that request. Please try again.