Rev Author Line No. Line
250 kaklik 1 <?php
2 /* $Id: global.inc.php,v 2.3 2003/11/26 22:52:24 rabus Exp $ */
3 // vim: expandtab sw=4 ts=4 sts=4:
4  
5 /**
6 * GLOBAL Plugin function (Garvin Hicking).
7 * ---------------
8 *
9 * THIS FILE PROVIDES BASIC FUNCTIONS TO USE IN OTHER PLUGINS!
10 *
11 * The basic filename usage for any plugin, residing in the libraries/transformations directory is:
12 *
13 * -- <mime_type>_<mime_subtype>__<transformation_name>.inc.php
14 *
15 * The function name has to be the like above filename:
16 *
17 * -- function PMA_transformation_<mime_type>_<mime_subtype>__<transformation_name>.inc.php
18 *
19 * Please use short and expressive names. For now, special characters which aren't allowed in
20 * filenames or functions should not be used.
21 *
22 * Please provide a comment for your function, what it does and what parameters are available.
23 *
24 */
25  
26 function PMA_transformation_global_plain($buffer, $options = array(), $meta = '') {
27 return htmlspecialchars($buffer);
28 }
29  
30 function PMA_transformation_global_html($buffer, $options = array(), $meta = '') {
31 return $buffer;
32 }
33  
34 function PMA_transformation_global_html_replace($buffer, $options = array(), $meta = '') {
35 if (!isset($options['string'])) {
36 $options['string'] = '';
37 }
38  
39 if (isset($options['regex']) && isset($options['regex_replace'])) {
40 $buffer = preg_replace('@' . str_replace('@', '\@', $options['regex']) . '@si', $options['regex_replace'], $buffer);
41 }
42  
43 // Replace occurences of [__BUFFER__] with actual text
44 $return = str_replace("[__BUFFER__]", $buffer, $options['string']);
45 return $return;
46 }
47  
48 ?>