getOptions( $options, $cfg['DefaultTransformations']['External'] ); if (isset($allowed_programs[$options[0]])) { $program = $allowed_programs[$options[0]]; } else { $program = $allowed_programs[0]; } // needs PHP >= 4.3.0 $newstring = ''; $descriptorspec = array( 0 => array("pipe", "r"), 1 => array("pipe", "w"), ); $process = proc_open($program . ' ' . $options[1], $descriptorspec, $pipes); if (is_resource($process)) { fwrite($pipes[0], $buffer); fclose($pipes[0]); while (!feof($pipes[1])) { $newstring .= fgets($pipes[1], 1024); } fclose($pipes[1]); // we don't currently use the return value proc_close($process); } if ($options[2] == 1 || $options[2] == '2') { $retstring = htmlspecialchars($newstring); } else { $retstring = $newstring; } return $retstring; } /* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */ /** * Gets the transformation name of the specific plugin * * @return string */ public static function getName() { return "External"; } }