<< Upload Variables | PmWiki.Variables | PmWiki.PageVariables >>
This page describes some of the internal workings of PmWiki 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.
$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 PmWiki, 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 PmWiki.CustomMarkup.
This function is used to insert translation rules into the PmWiki's
translation engine. The arguments to
Markup() are all strings, where:
- The string names the rule that is inserted. If a rule of the same name already exists, then this rule is ignored.
- 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.
- This string is a regular expression that is used by the translation engine to look for occurences of this rule in the markup source.
- This string will replace the matched text when a match occurs.
Also see: PmWiki.CustomMarkup and Cookbook:Functions#Markup
Converts the string
$str containing PmWiki markup into the corresponding HTML code, assuming the current page is
Also see: Cookbook:Functions#MarkupToHTML
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 PmWiki 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
mkdirp() aborts with an error message telling the
administrator the steps to take to either create $dir manually or give
PmWiki sufficient permissions to be able to do it.
MakeLink($pagename, $target, $txt, $suffix, $fmt)
MakeLink($pagename, $target, $txt, $suffix, $fmt) returns a ???. It's arguments are as follows:
$pagename is the source page
$target is where the link should go
$txt is the value to use for '$LinkText' in the output
$suffix is any suffix string to be added to $txt
$fmt is a format string to use
If $txt is NULL or not specified, then it is automatically computed from $target.
If $fmt is NULL or not specified, then MakeLink uses the default
format as specified by the type of link. For page links this
for intermap-style links it comes from either the
array or from
$UrlLinkFmt. Inside of the formatting strings,
$LinkUrl is replaced by the resolved url for the link, $LinkText
is replaced with the appropriate text, and $LinkAlt is replaced
by any "title" (alternate text) information associated with the
Also see: PmWiki:MakeLink and Cookbook:Functions#MakeLink
MakeUploadName() simply takes a string
$x (representing an attachment's
name) and converts it to a valid name by removing any unwanted characters.
It also requires the name to begin and end with an alphanumeric character,
and as of 2.0.beta28 it forces any file extensions to lowercase.
This function is defined in
scripts/upload.php and only used when uploads
<< Variables | Documentation Index | Page file format >>