[pmwiki-users] Explanation wanted on LinkIMap(), $FmtV and makeUploadName()

Patrick R. Michaud pmichaud at pobox.com
Mon Apr 4 11:50:37 CDT 2005


On Mon, Apr 04, 2005 at 09:13:42AM +0200, chr at home.se wrote:
> Now that I'm trying to figure out where too attach my code, I started by
> looking at LinkUpload() - what I want should be similar to that function.
> 
> Anyway, this is why I'd like an explanation of LinkIMap(), $FmtV and
> makeUploadName(). (I could probably figure out makeUploadName() and I
> think it would be useful if there was a hook here for replacing it, but it
> seems easier to ask).

LinkIMap() is the generic function for taking anything of the form
"prefix:path" and converting it to a link.  This includes InterMap
links, as well as the standard links such as 'http:', 'ftp:', etc.
In general it uses the values of the $IMap[] array to determine
where to place the 'path' component in the context of a larger link.
However, LinkIMap also handles url-encoding non-ASCII characters
in the resulting link as needed, and appropriate quoting for alt
attributes.

$FmtV[] is an array of $-substitutions to be performed by the 
FmtPageName() function -- it's another way of getting $-values into
FmtPageName without having to use global variables.  It primarily
exists for $-substitutions that may change over time; substitutions
stored here do not require rebuilding FmtPageName's global variable
cache, which is a little expensive.  (In PmWiki 1 we often had to do 
$GCount=0; when a global variable used by FmtPageName was changed, 
$FmtV eliminates this.)

MakeUploadName() simply takes a string (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.

Pm




More information about the pmwiki-users mailing list