[pmwiki-devel] Developing extensions questions

Simon nzskiwi at gmail.com
Thu Apr 25 20:27:35 PDT 2024


I'm working on converting one of my simpler recipes to an Extension
<https://www.pmwiki.org/wiki/Cookbook/ExtensionDesign>
(and would like to convert them all).

I've got a few questions.

My recipes tend to have the following layout
#----------------------------------------------------------
// executable code run when the recipe file is included from config.pgp,
consisting of:
// this includes, but may not be limited to
# initialisation, including:
## setting the recipe version
## calling the markup function to register the page markup and the recipe's
markup processing function

return; # having finished the setup

// callable (non-executable) code, for example:
# recipe's markup code processing function
# ancillary functions supporting the recipe's markup processing function
#-------------------------------------------------------

In the Extension Design
<https://www.pmwiki.org/wiki/Cookbook/ExtensionDesign> an example is given
of
function MyExtensionInit($pagename) {...}
 MyExtensionInit($pagename);

What is special about this and how does it differ from the executable code
described in the recipe layout above?



In one of the new extensions there is the line:
$EnableBootstrapIcons = 1;

Is this special in some way, e.g. generic and used for
extension management, or is it specific to the recipe?




It's not clear to me where in the distribution an extension distributes or
obtains initial values or configuration, e.g.

SDVA($MyExtDefaultConf, [
  'var1' => 'value1',
  'var2' => 5,
]);

or

SDV($MyExtDefaultConfVal, 'DefaultVal');

I surmise that there are two possibilities:
1) from a form exposed via the Extension Hub Page,

2) from somewhere else.

What I am looking for is the equivalent of a file of key value pairs.
One use case is to provide an API key that I do not want exposed or visible
to the world.
This might have a format per line of (for SDV)
key=ka val=vb
or
key=ka val=[vb,"v c"]
or some other syntax: ka=va, ka=[vb,"v c"]

and for SDVA
key=[ka,kb] val=vb
or
key=[ka,kb] val=[vb,"v c"]
or some other syntax: [ka,kb]=[vb,"v c"]



Lastly, I assume that the values of the directory and the extension php
file name are case sensitive.
I ask this because I use windows, and also because directive names
themselves are not case sensitive, and I observe that (almost all) recipe
filenames are fully lower case.
Yet for some reason it seems better to have a directory name (as shown in
the example "MyCoolExtension") that is TitleCased.

thanks in advance

Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-devel/attachments/20240426/728b4717/attachment.html>


More information about the pmwiki-devel mailing list