[pmwiki-users] Explanation wanted on LinkIMap(), $FmtV and makeUploadName()
christian.ridderstrom at gmail.com
christian.ridderstrom at gmail.com
Sun May 28 15:15:27 CDT 2006
On Mon, 4 Apr 2005, Patrick R. Michaud wrote:
> 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).
Hi Patrick
This was a long time ago (> 1 year!), but I'm catching up on old sins in
my mail box...
> 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.
This is now documented here
http://www.pmwiki.org/wiki/PmWiki/LinkIMap
maybe you want to look it over.
> $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.)
$FmtV seem documented well enough in
http://www.pmwiki.org/wiki/PmWiki/OtherVariables#FmtV
I made a minor change by adding from it's description to
http://www.pmwiki.org/wiki/PmWiki/FmtPageName
> 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.
I added your text almost verbatim to
http://www.pmwiki.org/wiki/PmWiki/Functions#MakeUploadName
/Christian
--
Christian Ridderström, +46-8-768 39 44 http://www.md.kth.se/~chr
More information about the pmwiki-users
mailing list