getOptions( $options, $cfg['DefaultTransformations']['External'] ); if (isset($allowed_programs[$options[0]])) { $program = $allowed_programs[$options[0]]; } else { $program = $allowed_programs[0]; } if (isset($options[1]) && strlen((string) $options[1]) > 0) { trigger_error(sprintf( __( 'You are using the external transformation command line options field, which has been deprecated for security reasons. ' . 'Add all command line options directly to the definition in %s.' ), '[code]libraries/classes/Plugins/Transformations/Abs/ExternalTransformationsPlugin.php[/code]' ), E_USER_DEPRECATED); } // 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"; } }