ZenphotoCMS 1.6.2

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:

  1. "class" => macro class, see below.
  2. "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.
  3. "value" => This is a function, procedure, expression or content as defined by the macro class.
  4. "owner" => This should be your plugin name.
  5. "desc" => Text that describes the macro usage.

Macro classes:

  1. procedure calls a script function that produces output. The output is captured and inserted in place of the macro instance.
  2. function calls a script function that returns a result. The result is inserted in place of the macro instance.
  3. constant replaces the macro instances with the constant provided.
  4. 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:

  1. [CODEBLOCK 3] (Places codeblock number 3 in your content)
  2. [PAGE] (Prints the current page number)
  3. [ZENPHOTO_VERSION] (Prints the version of the Zenphoto installation)
  4. [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
author

Stephen Billard (sbillard)

Table of Contents

Functions

macro_admin_tabs()  : mixed
macroList_show()  : mixed

Functions

macro_admin_tabs()

macro_admin_tabs(mixed $tabs) : mixed
Parameters
$tabs : mixed

macroList_show()

macroList_show(mixed $macro, mixed $detail) : mixed
Parameters
$macro : mixed
$detail : mixed

        
On this page

Search results