docs update on callbacks to the register_*-functions

This commit is contained in:
messju
2003-08-07 09:23:21 +00:00
parent 5224b83caa
commit 7028e8da55

View File

@@ -1121,16 +1121,16 @@ $smarty->load_filter('output', 'compress'); // load output filter named 'compres
</para> </para>
<para> <para>
The php-function callback <parameter>impl</parameter> can be either (a) a string The php-function callback <parameter>impl</parameter> can be either (a) a string
containing the function name or (b) an array of the form containing the function name or (b) an array of the form
<literal>array(&$object, $method)</literal> with <literal>array(&$object, $method)</literal> with
<literal>&$object</literal> being a reference to an <literal>&$object</literal> being a reference to an
object and <literal>$method</literal> being a string object and <literal>$method</literal> being a string
containing the mehod-name or (c) an array of the form containing the mehod-name or (c) an array of the form
<literal>array(&$class, $method)</literal> with <literal>array(&$class, $method)</literal> with
<literal>$class</literal> being a classname and <literal>$class</literal> being a classname and
<literal>$method</literal> being a class method of that <literal>$method</literal> being a class method of that
class. class.
</para> </para>
@@ -1160,7 +1160,7 @@ function do_translation ($params, $content, &$smarty, &amp;$repeat) {
<funcprototype> <funcprototype>
<funcdef>void <function>register_compiler_function</function></funcdef> <funcdef>void <function>register_compiler_function</function></funcdef>
<paramdef>string <parameter>name</parameter></paramdef> <paramdef>string <parameter>name</parameter></paramdef>
<paramdef>string <parameter>impl</parameter></paramdef> <paramdef>mixed <parameter>impl</parameter></paramdef>
</funcprototype> </funcprototype>
</funcsynopsis> </funcsynopsis>
<para> <para>
@@ -1168,6 +1168,18 @@ function do_translation ($params, $content, &$smarty, &amp;$repeat) {
Pass in the compiler function name, followed by the PHP Pass in the compiler function name, followed by the PHP
function that implements it. function that implements it.
</para> </para>
<para>
The php-function callback <parameter>impl</parameter> can be either (a) a string
containing the function name or (b) an array of the form
<literal>array(&$object, $method)</literal> with
<literal>&$object</literal> being a reference to an
object and <literal>$method</literal> being a string
containing the mehod-name or (c) an array of the form
<literal>array(&$class, $method)</literal> with
<literal>$class</literal> being a classname and
<literal>$method</literal> being a class method of that
class.
</para>
</sect1> </sect1>
<sect1 id="api.register.function"> <sect1 id="api.register.function">
<title>register_function</title> <title>register_function</title>
@@ -1175,7 +1187,7 @@ function do_translation ($params, $content, &$smarty, &amp;$repeat) {
<funcprototype> <funcprototype>
<funcdef>void <function>register_function</function></funcdef> <funcdef>void <function>register_function</function></funcdef>
<paramdef>string <parameter>name</parameter></paramdef> <paramdef>string <parameter>name</parameter></paramdef>
<paramdef>string <parameter>impl</parameter></paramdef> <paramdef>mixed <parameter>impl</parameter></paramdef>
</funcprototype> </funcprototype>
</funcsynopsis> </funcsynopsis>
<para> <para>
@@ -1183,6 +1195,18 @@ function do_translation ($params, $content, &$smarty, &amp;$repeat) {
Pass in the template function name, followed by the PHP Pass in the template function name, followed by the PHP
function name that implements it. function name that implements it.
</para> </para>
<para>
The php-function callback <parameter>impl</parameter> can be either (a) a string
containing the function name or (b) an array of the form
<literal>array(&$object, $method)</literal> with
<literal>&$object</literal> being a reference to an
object and <literal>$method</literal> being a string
containing the mehod-name or (c) an array of the form
<literal>array(&$class, $method)</literal> with
<literal>$class</literal> being a classname and
<literal>$method</literal> being a class method of that
class.
</para>
<example> <example>
<title>register_function</title> <title>register_function</title>
<programlisting> <programlisting>
@@ -1205,7 +1229,7 @@ function print_current_date ($params) {
<funcprototype> <funcprototype>
<funcdef>void <function>register_modifier</function></funcdef> <funcdef>void <function>register_modifier</function></funcdef>
<paramdef>string <parameter>name</parameter></paramdef> <paramdef>string <parameter>name</parameter></paramdef>
<paramdef>string <parameter>impl</parameter></paramdef> <paramdef>mixed <parameter>impl</parameter></paramdef>
</funcprototype> </funcprototype>
</funcsynopsis> </funcsynopsis>
<para> <para>
@@ -1213,6 +1237,19 @@ function print_current_date ($params) {
template modifier name, followed by the PHP function that it template modifier name, followed by the PHP function that it
implements it. implements it.
</para> </para>
<para>
The php-function callback <parameter>impl</parameter> can be either (a) a string
containing the function name or (b) an array of the form
<literal>array(&$object, $method)</literal> with
<literal>&$object</literal> being a reference to an
object and <literal>$method</literal> being a string
containing the mehod-name or (c) an array of the form
<literal>array(&$class, $method)</literal> with
<literal>$class</literal> being a classname and
<literal>$method</literal> being a class method of that
class.
</para>
<example> <example>
<title>register_modifier</title> <title>register_modifier</title>
<programlisting> <programlisting>
@@ -1245,23 +1282,35 @@ $smarty->register_modifier("sslash","stripslashes");
<funcsynopsis> <funcsynopsis>
<funcprototype> <funcprototype>
<funcdef>void <function>register_outputfilter</function></funcdef> <funcdef>void <function>register_outputfilter</function></funcdef>
<paramdef>string <parameter>function_name</parameter></paramdef> <paramdef>mixed <parameter>function</parameter></paramdef>
</funcprototype> </funcprototype>
</funcsynopsis> </funcsynopsis>
<para> <para>
Use this to dynamically register outputfilters to operate on Use this to dynamically register outputfilters to operate on
a template's output before it is displayed. See a template's output before it is displayed. See
<link linkend="advanced.features.outputfilters">template output <link linkend="advanced.features.outputfilters">template output
filters</link> filters</link>
for more information on how to set up an output filter function. for more information on how to set up an output filter function.
</para> </para>
<para>
The php-function callback <parameter>function</parameter> can be either (a) a string
containing the function name or (b) an array of the form
<literal>array(&$object, $method)</literal> with
<literal>&$object</literal> being a reference to an
object and <literal>$method</literal> being a string
containing the mehod-name or (c) an array of the form
<literal>array(&$class, $method)</literal> with
<literal>$class</literal> being a classname and
<literal>$method</literal> being a class method of that
class.
</para>
</sect1> </sect1>
<sect1 id="api.register.postfilter"> <sect1 id="api.register.postfilter">
<title>register_postfilter</title> <title>register_postfilter</title>
<funcsynopsis> <funcsynopsis>
<funcprototype> <funcprototype>
<funcdef>void <function>register_postfilter</function></funcdef> <funcdef>void <function>register_postfilter</function></funcdef>
<paramdef>string <parameter>function_name</parameter></paramdef> <paramdef>mixed <parameter>function</parameter></paramdef>
</funcprototype> </funcprototype>
</funcsynopsis> </funcsynopsis>
<para> <para>
@@ -1270,13 +1319,25 @@ $smarty->register_modifier("sslash","stripslashes");
linkend="advanced.features.postfilters">template postfilters</link> for linkend="advanced.features.postfilters">template postfilters</link> for
more information on how to setup a postfiltering function. more information on how to setup a postfiltering function.
</para> </para>
<para>
The php-function callback <parameter>function</parameter> can be either (a) a string
containing the function name or (b) an array of the form
<literal>array(&$object, $method)</literal> with
<literal>&$object</literal> being a reference to an
object and <literal>$method</literal> being a string
containing the mehod-name or (c) an array of the form
<literal>array(&$class, $method)</literal> with
<literal>$class</literal> being a classname and
<literal>$method</literal> being a class method of that
class.
</para>
</sect1> </sect1>
<sect1 id="api.register.prefilter"> <sect1 id="api.register.prefilter">
<title>register_prefilter</title> <title>register_prefilter</title>
<funcsynopsis> <funcsynopsis>
<funcprototype> <funcprototype>
<funcdef>void <function>register_prefilter</function></funcdef> <funcdef>void <function>register_prefilter</function></funcdef>
<paramdef>string <parameter>function_name</parameter></paramdef> <paramdef>mixed <parameter>function</parameter></paramdef>
</funcprototype> </funcprototype>
</funcsynopsis> </funcsynopsis>
<para> <para>
@@ -1285,6 +1346,18 @@ $smarty->register_modifier("sslash","stripslashes");
linkend="advanced.features.prefilters">template prefilters</link> for linkend="advanced.features.prefilters">template prefilters</link> for
more information on how to setup a prefiltering function. more information on how to setup a prefiltering function.
</para> </para>
<para>
The php-function callback <parameter>function</parameter> can be either (a) a string
containing the function name or (b) an array of the form
<literal>array(&$object, $method)</literal> with
<literal>&$object</literal> being a reference to an
object and <literal>$method</literal> being a string
containing the mehod-name or (c) an array of the form
<literal>array(&$class, $method)</literal> with
<literal>$class</literal> being a classname and
<literal>$method</literal> being a class method of that
class.
</para>
</sect1> </sect1>
<sect1 id="api.register.resource"> <sect1 id="api.register.resource">
<title>register_resource</title> <title>register_resource</title>
@@ -1303,6 +1376,17 @@ $smarty->register_modifier("sslash","stripslashes");
for more information on how to setup a function for fetching for more information on how to setup a function for fetching
templates. templates.
</para> </para>
<para>
The php-function-array <parameter>resource_funcs</parameter>
must have 4 or 5 elements. With 4 elements the elements are
the functions-callbacks for the respective "source",
"timestamp", "secure" and "trusted" functions of the
resource. With 5 elements the first element has to be an
object reference or a class name of the object or class
implementing the resource and the 4 following elements have
to be the method names implementing "source", "timestamp",
"secure" and "trusted".
</para>
<example> <example>
<title>register_resource</title> <title>register_resource</title>
<programlisting> <programlisting>