<< Mail Posts | PmWiki.Variables | >>

This page describes some of the internal workings of Pm Wiki by explaining how some of the functions in pmwiki.php work. For a more brief list/overview on functions useful to for instance cookbook writers, see Cookbook:Functions.

Put Pm Wiki standard functions here with brief explanations (per Pm email). Overly-documented functions get their own page (where possible). BenWilson August 02, 2005, at 02:15 PM

FmtPageName($fmt, $pagename)

Returns $fmt, with $variable and internationalisation substitutions performed, under the assumption that the current page is pagename. See PmWiki.Variables for an (incomplete) list of available variables, PmWiki.Internationalizations for internationalisation.

This is one of the major functions in Pm Wiki, see PmWiki.FmtPageName for lots of details.

Markup($name, $when, $pattern, $replace)

Adds a new markup to the conversion table. Described in greater detail at Pm Wiki.Custom Markup.

This function is used to insert translation rules into the Pm Wiki's translation engine. The arguments to Markup() are all strings, where:

$name
The string names the rule that is inserted. If a rule of the same name already exists, then this rule is ignored.
$when
This string is used to control when a rule is to be applied relative to other rules. A specification of "<xyz" says to apply this rule prior to the rule named "xyz", while ">xyz" says to apply this rule after the rule "xyz". See CustomMarkup for more details on the order of rules.
$pattern
This string is a regular expression that is used by the translation engine to look for occurences of this rule in the markup source.
$replace
This string will replace the matched text when a match occurs.

Also see: PmWiki.CustomMarkup and Cookbook:Functions#Markup

MarkupToHTML($pagename, $str)

Converts the string $str containing Pm Wiki markup into the corresponding HTML code, assuming the current page is $pagename.

Also see: Cookbook:Functions#MarkupToHTML

mkdirp($dir)

The function mkdirp($dir) creates a directory, $dir, if it doesn't already exist, including any parent directories that might be needed. For each directory created, it checks that the permissions on the directory are sufficient to allow Pm Wiki scripts to read and write files in that directory. This includes checking for restrictions imposed by PHP's safe_mode setting. If mkdirp() is unable to successfully create a read/write directory, mkdirp() aborts with an error message telling the administrator the steps to take to either create $dir manually or give Pm Wiki sufficient permissions to be able to do it.


comments powered by Disqus