Pushed MIME-transformation functionality by propagating the corresponding $meta value to plugins.
This commit is contained in:
@@ -2,23 +2,13 @@
|
||||
/* $Id$ */
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
/**
|
||||
* Plugin function TEMPLATE (Garvin Hicking).
|
||||
* -----------------------------------------
|
||||
*
|
||||
* For instructions, read the libraries/transformations/README file.
|
||||
*
|
||||
* The string ENTER_FILENAME_HERE shall be substituted with the filename without the '.inc.php3'
|
||||
* extension. For further information regarding naming conventions see the README file.
|
||||
*/
|
||||
|
||||
if (!defined('PMA_TRANSFORMATION_TEXT_PLAIN__EXTERNAL')){
|
||||
define('PMA_TRANSFORMATION_TEXT_PLAIN__EXTERNAL', 1);
|
||||
|
||||
function PMA_EscapeShellArg($string, $prepend = '\'') {
|
||||
return $prepend . ereg_replace("'", "'\\''", $string) . $prepend;
|
||||
|
||||
function PMA_EscapeShellArg($string, $prepend = '\'') {
|
||||
return $prepend . ereg_replace("'", "'\\''", $string) . $prepend;
|
||||
}
|
||||
|
||||
|
||||
function PMA_transformation_text_plain__external_nowrap($options = array()) {
|
||||
if (!isset($options[3]) || $options[3] == '') {
|
||||
$nowrap = true;
|
||||
@@ -27,16 +17,16 @@ if (!defined('PMA_TRANSFORMATION_TEXT_PLAIN__EXTERNAL')){
|
||||
} else {
|
||||
$nowrap = false;
|
||||
}
|
||||
|
||||
|
||||
return $nowrap;
|
||||
}
|
||||
|
||||
function PMA_transformation_text_plain__external($buffer, $options = array()) {
|
||||
function PMA_transformation_text_plain__external($buffer, $options = array(), $meta = '') {
|
||||
// possibly use a global transform and feed it with special options:
|
||||
// include('./libraries/transformations/global.inc.php3');
|
||||
|
||||
|
||||
// further operations on $buffer using the $options[] array.
|
||||
|
||||
|
||||
$allowed_programs = array();
|
||||
$allowed_programs[0] = '/usr/local/bin/tidy';
|
||||
$allowed_programs[1] = '/usr/local/bin/validate';
|
||||
@@ -46,13 +36,13 @@ if (!defined('PMA_TRANSFORMATION_TEXT_PLAIN__EXTERNAL')){
|
||||
} else {
|
||||
$program = $allowed_programs[$options[0]];
|
||||
}
|
||||
|
||||
|
||||
if (!isset($options[1]) || $options[1] == '') {
|
||||
$poptions = '-f /dev/null -i -wrap -q';
|
||||
} else {
|
||||
$poptions = $options[1];
|
||||
}
|
||||
|
||||
|
||||
if (!isset($options[2]) || $options[2] == '') {
|
||||
$options[2] = 1;
|
||||
}
|
||||
@@ -63,13 +53,13 @@ if (!defined('PMA_TRANSFORMATION_TEXT_PLAIN__EXTERNAL')){
|
||||
|
||||
$cmdline = 'echo ' . PMA_EscapeShellArg($buffer) . ' | ' . $program . ' ' . PMA_EscapeShellArg($poptions, '');
|
||||
$newstring = `$cmdline`;
|
||||
|
||||
|
||||
if ($options[2] == 1 || $options[2] == '2') {
|
||||
$retstring = htmlspecialchars($newstring);
|
||||
} else {
|
||||
$retstring = $newstring;
|
||||
}
|
||||
|
||||
|
||||
return $retstring;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user