Open main menu

Extension:MikFunctions

MediaWiki extensions manual
OOjs UI icon advanced.svg
MikFunctions
Release status: stable
Implementation Tag
Description Defines an additional set of parser functions that provide dynamic functionality and cannot be cached.
Author(s) Michele Fella <michele.fella@gmail.com> (Michele.Fellatalk)
Latest version 0.1.5 (2016-05-10)
MediaWiki 1.26+
Database changes No
License Apache License
Download
<MikFunctions>
Translate the MikFunctions extension if it is available at translatewiki.net
Check usage and version matrix.

The MikFunctions extension defines an additional set of parser functions that provide dynamic functionality and cannot be cached.

Note Note: This extension currently works only on *NIX servers

Contents

InstallEdit

  • Download and place the file(s) in a directory called MikFunctions in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/MikFunctions/MikFunctions.php";
    
  • Create a directory named "seqences" in the extension's directory, e.g.
    mkdir ../extensions/MikFunctions/sequences;
    
  • Grant write permissions to this folder, e.g.
chown apache:apache ../extensions/MikFunctions/sequences; // CentOS?
chown www-data:www-data ../extensions/MikFunctions/sequences; // Debian
  •   Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

UsageEdit

This module defines four functions: seqnext. All of these functions operate in constant time.

#seqnext:Edit

The #seqnext function returns the value of next integer int the defined sequence. The syntax is:

{{#seqnext:seqname|valpattern|fillchar}}

The first time the function is used a sequence with the specified seqname will be created returning 1.

Every time the function is called an incremental value of seqname will be returned.

When valpattern and fillchar values are set: if the length of the incremental value of seqname is smaller than valpattern string length, the returned value will match valpattern length replacing with fillchar the missing values.

Example

{{#seqnext:test|9999|X}} will return XX45 when called the fourtyfifth time.

#uml:Edit

The #uml function has been removed from this extension as no more compatible with plantuml version 0.6.

A new extension MikUML has been created to replace this funcion and assure compatibility with PlantUML 0.6.

#parsenl:Edit

Processes and returns the input text duplicating new lines and return carriages (usefull to show user input text exaclty as inserted)

Example

{{#parsenl:text to parse}}

#mikecho:Edit

echo raw text

Example

{{#mikecho:text to echo}}

#ckusergroup:Edit

checks if user belongs to a group (usage example: you can use it with ifexpr within an article or a template in order decide wether or not to perform actions or show content)

Example

{{#ifexpr:{{#ckusergroup:administrators}}| ..do something |..else }}

#makebutton:Edit

makes html button

Example

{{#makebutton:{{fullurl:{{FULLPAGENAME}}|action=delete}}|Delete this page|disabled}} --> Buddon disabled

{{#makebutton:{{fullurl:{{FULLPAGENAME}}|action=delete}}|Delete this page}} --> Buddon enabled

#mikreplace:Edit

replace raw text

Example

{{#mikreplace:text|search|replacement}}

See alsoEdit