Extension:Ommswiki

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png

Release status: beta

Implementation Parser function
Description Gives validations for URL.
License No license specified
Download No link
Check usage and version matrix

Contents

What can this extension do? [edit]

Gives validations for URL.

Usage [edit]

#apURL [edit]

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 instructions [edit]

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.

Installation [edit]

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 parameters [edit]

User rights [edit]

Code [edit]

<?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 also [edit]