Open main menu

Extension:Ommswiki

MediaWiki extensions manual
OOjs UI icon advanced.svg

Release status: beta
Implementation Parser function
Description Gives validations for URL.
License No license specified
Download No link
Translate the Ommswiki extension if it is available at translatewiki.net
Check usage and version matrix.

Contents

What can this extension do?Edit

Gives validations for URL.

UsageEdit

#apURLEdit

Retrieves value in the input box and validate it.Returns the result true or false ,if valid or not.

     {{#apURL:‹value›}}

Parameters:

value
url which you want to validate.


Download instructionsEdit

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

InstallationEdit

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

#add configuration parameters here
#setup user rights here
require_once("$IP/extensions/ExtensionName/urldemo.php");

Configuration parametersEdit

User rightsEdit

CodeEdit

<?php



$wgURLfunction = 'wfurl';

$wgExtensionCredits['parserhook'][] = array(
	'name' => 'Ommswiki',
	'version' => '1.0',
	'url' => 'http://www.mediawiki.org/wiki/Extension:Ommswiki',
	'author' => 'yashashri',   
	'description' => 'Defines an validation for url.'
);
function wgURLfunction() {
	global $wgParser, $wgExtDynamicFunctions;
 
	$wgExtDynamicFunctions = new ExtURLfunction();
 
	$wgParser->setFunctionHook( 'URL', array( &$wgExtDynamicFunctions, 'URL' ) );
	
}
function wfURLfunctionLanguageGetMagic( &$magicWords, $langCode ) {
	switch ( $langCode ) {
	default:
		$magicWords['URL']    = array( 0, 'URL' );
		
	}
	return true;
}
class ExtDynamicFunctions {
 
	function arg( &$parser, $text = '', $value = '' ) {
		global $wgRequest;
		$parser->disableCache();
		return $wgRequest->getVal($text, $value);
	}
}
 
?>

See alsoEdit