3.3.8 release
[phpmyadmin/tyronm.git] / libraries / transformations / global.inc.php
blob1e662ee6d5282504eea91ff386c86dfb8b044150
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * GLOBAL Plugin function (Garvin Hicking).
5 * ---------------
7 * THIS FILE PROVIDES BASIC FUNCTIONS TO USE IN OTHER PLUGINS!
9 * The basic filename usage for any plugin, residing in the libraries/transformations directory is:
11 * -- <mime_type>_<mime_subtype>__<transformation_name>.inc.php
13 * The function name has to be the like above filename:
15 * -- function PMA_transformation_<mime_type>_<mime_subtype>__<transformation_name>.inc.php
17 * Please use short and expressive names. For now, special characters which aren't allowed in
18 * filenames or functions should not be used.
20 * Please provide a comment for your function, what it does and what parameters are available.
22 * @version $Id$
23 * @package phpMyAdmin-Transformation
26 /**
29 function PMA_transformation_global_plain($buffer, $options = array(), $meta = '') {
30 return htmlspecialchars($buffer);
33 function PMA_transformation_global_html($buffer, $options = array(), $meta = '') {
34 return $buffer;
37 function PMA_transformation_global_html_replace($buffer, $options = array(), $meta = '') {
38 if (!isset($options['string'])) {
39 $options['string'] = '';
42 if (isset($options['regex']) && isset($options['regex_replace'])) {
43 $buffer = preg_replace('@' . str_replace('@', '\@', $options['regex']) . '@si', $options['regex_replace'], $buffer);
46 // Replace occurences of [__BUFFER__] with actual text
47 $return = str_replace("[__BUFFER__]", $buffer, $options['string']);
48 return $return;