 |
The page is generated with the help PHP - creating pattern MaxReplace
Files used at generation: replace.txt, en.txt, main.htm, top.htm, blue.htm, menu.txt, lang.txt, blue_baners.htm, baners.txt, gray.htm, plugins.htm, plugins_en.txt, buttom.htm
Time of generation: 0.0619881153107 msec
|
|
|
 |
Plug-ins |
 |
|
In addition connected modules
"...Builder of patterns is PHP a code, which processes the specified pattern or file of a pattern, and according to markers, inserts the data..."
But in most cases it not enough, there is a necessity of an insert PHP of a code in pattern, and by that the idea of division HTML and PHP of a code is lost.
To avoid "heap" from a mix PHP and HTML of a code, in MaxReplace the opportunity connection of so-called files плагинов is realized, in which there are specially marked user functions
Example plug-in:
|
|
|
<?php
/***Plugin for MaxReplace*** /
Name = calc;
Params Count = 0;
When Replace = afterall;
Description = Calculation of the sum, difference and product in succession going, divided(shared) by a point, figures.
Example: [calc:-1,5,6,*8 ]
Result: 80
/ ****End of Plugin Tools****/
function calc()
{
$j=0;
for ($i=0; $i<func_num_args(); $i++)
{
$s=func_get_arg($i);
if ((string)strrpos($s,"*")=="")
$j=$j+(int)$s;
else
$j=$j*((int)str_replace("*","",$s));
}
return $j;
}
?>
|
|
|
|
|
The functions connected plug-in work by a principle of "markers - methods", they can be caused in any place of a pattern, and in them also it is possible to transfer parameters.
As function plug-in it is possible to nominate any your function, for this purpose it is necessary to bear(take out) function in a separate file and before the announcement of function to place in the comments " parameters of function ", and behind that to connect the given file as plug-in.
** ATTENTION!!! of the name of functions and used in them variable should not coincide with define names of functions and variable Max Replace , as it is not recommended to address to global variable of plug-in.
Obligatory parameters:
Plugin for MaxReplace - for definition of a beginning "of parameters of function" (the register) is taken into account;
End of Plugin Tools - for definition of the end " of parameters of function ";
Name = calc; - the name of function.
Desirable parameters:
Params Count = 0; - for definition of quantity(amount) of transmitted parameters.
If 0 that all parameters (by default) are transferred,
If -1, means without parameters (parameters the text going after the name of function and up to "]" is considered, for the given example parameter (0) will be ":-1")
If > 0, are transferred the fixed number of parameters.
When Replace = afterall; - for definition of the moment of replacement.
If beforerall, the replacement will take place right at the beginning, even before process of builder of patterns.
If before, the replacement will occur after line replacement.
If after - the replacement will occur after each cycle process of builder of patterns (by default),
If afterall, the replacement will take place right at the end, before the conclusion of the data.
** ATTENTION!!! at inclusion of function of caching, function connected plug-in announced as before and after, will not work.
Unessential:
Description = Calculation … figures. - the description of function.
Example: [calc:-1,5,6,*8] - example of a call.
Result: 80 - result of a call.
Alters of textual blocks
Alters of textual blocks - functions capable to process the large textual blocks. To announce function плагина as "Alters of textual blocks", it is necessary in "parameters of function" to announce parameter TextArea;
Example plug-in:
|
|
|
<?php
/***Plugin for MaxReplace*** /
Name = strlower;
When Replace = afterall;
TextArea;
Description = Переводит строку в нижний регистр.
Example: [strlower SmALL tEXt strlower ]
Result: small text
/ ****End of Plugin Tools****/
function strlower($text)
{
return strtolower($text);
}
?>
|
|
|
|
|
As as parameter is transferred text between [ strlower and strlower ], then Params Count it is possible to remove.
|
|
|
 |
|
 |
|
|
|
|