macroList.php
Macros are "delcared" by filters registered to the <var>content_macro</var> filter. The filter should add its macros to the array passed and return the result. A macro is defined by an array element. The index of the array element is the macro identifier.
Note: the plugin should be active both on THEMES to provide the function and on the ADMIN pages to provide the macro documentation.
The content of the array is as follows:
- "class" => macro class, see below.
- "params" => An array of parameter types. Append an * if the parameter may be omitted. The types allowed are:
- "string": may be enclosed in quotation marks when the macro is invoked. The quotes are stripped before the macro is processed.
- "int": a number
- "bool": true or false
- "array": will process assignment type parameter (x = y) lists. If the assignment is left out, the value will be inserted with its position in the list as the array index. Since an array parameter will consume all remaining elements it must be the last item in the parameter list.
- "value" => This is a function, procedure, expression or content as defined by the macro class.
- "owner" => This should be your plugin name.
- "desc" => Text that describes the macro usage.
Macro classes:
- procedure calls a script function that produces output. The output is captured and inserted in place of the macro instance.
- function calls a script function that returns a result. The result is inserted in place of the macro instance.
- constant replaces the macro instances with the constant provided.
- expression evaluates the expression provided and replaces the instance with the result of the evaluation. If a regex is supplied for an expression. The values provided will replace placeholders in the expression. The first parameter replaces $1, the second $2, etc.
Useage examples:
- [CODEBLOCK 3] (Places codeblock number 3 in your content)
- [PAGE] (Prints the current page number)
- [ZENPHOTO_VERSION] (Prints the version of the Zenphoto installation)
- [PAGELINK mylinktext customscriptpage] (Provides text for a link to a "custom" script page)
Note the spaces after the [ and before the ] square brackets. They are used in these examples to prevent the code from actually executing. They should not be present in your real code.
Tags
Table of Contents
- macro_admin_tabs() : mixed
- macroList_show() : mixed
Functions
macro_admin_tabs()
macro_admin_tabs(mixed $tabs) : mixed
Parameters
- $tabs : mixed
Return values
mixed —macroList_show()
macroList_show(mixed $macro, mixed $detail) : mixed
Parameters
- $macro : mixed
- $detail : mixed