Skip to main content.
Navigation: Home | Edit | HistoryLoginBackLinkIndex
Breadcrumbs : index » homepage » buglist » 1 » 36 » homepage » api
Table of contents
API for Plug-In writing...
    Debug functions
        DumpGlobals()
        DumpRules()
    Rules Based function
        ProcessRules(Array)
                In/Out
                Example
        AddGroup(, =null)
                In/Out
                Example
        AddRule(, , , , = null)
                In/Out
                Example
        DelRule(, )
                In/Out
                Example
    Msg related
        Msg(, ...)
                In/Out
                Example
        MsgLang()
        MsgDir()
        MsgFile()
    Other
        GrabTime()
        FormatPagename( = "", = FALSE)
        Action(, , , = false)
        LoadXMLFile()
        LoadFile()
        MkDir()
        file_put_contents(, )
        SafeHTML()
        LinkTemplateField(, &)
        SetTemplateField(, = null)
        GetTemplateField()
        PlugIn()
        Is_PlugIn()
        GetPageAttr()
        CheckAccess()
        ShowHTML()
        GetPageText(, =0)
        StripMagic()
        ValidateInternalLink()
        ValidateExternalLink()
        url_encode()
        url_decode()
        Redirect(=NULL, =TRUE)
        numeric_entify_utf8()
        Stack(, , = null)
        KeepText(, = null, =null)
        ExpandNameSpace()
        UnKeepText()
        dummy()
                In/Out
                Example

API for Plug-In writing...

The engine for WikiDX is quite small (around 90k), and on its own, cannot constitute a working wiki. Plug-Ins allow additional functionality to be added to this core in a flexible way.

 

The API1) is a set of functions that can be used to assist with writing plug-ins. Not only are they time saving, but they provide a consistent programming method.

 

Even the most basic plug-ins, like browsing this page, rely on this API.

 

 

Debug functions

These functions dont add anything to the functionality of the wiki. They are for the plugin author to get the internal contents. For example, if you are adding a new rule, you can see where it should fit etc...

DumpGlobals()

Dump the contents of the php $GLOBALS aray to the browser

DumpRules()

Dump the complete Rules array. This controls ALL formatting on a page

 

 

Rules Based function

ProcessRules(Array)

Passes the supplied text through the Rules Engine, and returns the formatted results.
In/Out
in
$text : Can be a string or array. If string passed it is internally transformed into array, split on '\n'.
out
String
Example
$ltext = API::ProcessRules(<page text>); 

AddGroup(, =null)

Add a RuleGroup
In/Out
in
$name : name of the Rule
in
$order : optional positioning. By default will be added as last group
Example
API::AddGroup("inline"); //  
API::AddGroup("link", ">inline"); // slot in before 'inline' 

AddRule(, , , , = null)

Adds a Rule to a RuleGroup
In/Out
in
$id : Name of the Rule
in
$grp : name of the RuleGroup
in
$exp : regexp
in
$act : action
in
$order : optinal positioning. By default will be added as last rule in group
Example
API::AddRule("italic","inline","/''(.*?)''/","<em>\\1</em>"); 
API::AddRule("bold","inline","/'''(.*?)'''/","<strong>\\1</strong>","<italic"); 

DelRule(, )

Delete a Rule from a RuleGroup
In/Out
in
$id : name of the Rule
in
$grp : name of the RuleGroup
Example
API::DelRule("italic","inline"); 
 

Msg related

Msg(, ...)

Display a msg
In/Out
in
$MsgID : Message number
in
... : Multiple variables. Upto 5 additional input strings can be passed. These are then substituted into the output message.
out
If the Msg is not an error, then the msg string will be returned.
Example
$ltext = API::Msg('msg001'); //return a msg sting 
API::Msg('msg002'); // If calling an 'error' msg that will stop the program. 

MsgLang()

MsgDir()

MsgFile()

 

 

Other

GrabTime()

FormatPagename( = "", = FALSE)

Action(, , , = false)

API::Action("browse", 100, "API::CheckAccess(_Access_Read)");  
API::Action("browse", 200, "br_load_page"); // local function 
API::Action("browse", 300, "API::ShowHTML");  

LoadXMLFile()

LoadFile()

MkDir()

file_put_contents(, )

SafeHTML()

LinkTemplateField(, &)

SetTemplateField(, = null)

GetTemplateField()

PlugIn()

Is_PlugIn()

GetPageAttr()

CheckAccess()

ShowHTML()

GetPageText(, =0)

StripMagic()

ValidateInternalLink()

ValidateExternalLink()

url_encode()

url_decode()

Redirect(=NULL, =TRUE)

numeric_entify_utf8()

Stack(, , = null)

KeepText(, = null, =null)

ExpandNameSpace()

UnKeepText()

 

dummy()

desc of function
In/Out
in
$var : desc of var:out:String
Example
$ltext = API::dummy(<var>); 
 

1) Application Programming Interface