|W:|s' into an array [ 'T' => '', 'W' => '', 's' => '' ]. * Checks if a parameter is double defined. * * @param string $str * @return array * @throws UserReportException */ public static function explodeTokenString($str) { $tokenGiven = array(); $control = array(); $param = explode(PARAM_DELIMITER, $str); foreach ($param as $item) { // Skip empty entries if ($item === '') { continue; } // u:www.example.com $arr = explode(":", $item, 2); $key = isset($arr[0]) ? $arr[0] : ''; $value = isset($arr[1]) ? $arr[1] : ''; // Bookkeeping defined parameter. if (isset($tokenGiven[$key])) { throw new UserReportException ("Multiple definitions for key '$key'", ERROR_MULTIPLE_DEFINITION); } $tokenGiven[$key] = true; $control[$key] = self::checkForEmptyValue($key, $value); } return $control; } /** * Converts a string of the form '[width]x[height]' to '[-w ][ -h 1) { $width = '-w ' . $arr[0]; $height = ' -h ' . $arr[1]; } else { $width = '-w ' . $dimension; } } return $width . $height; } /** * Executes the Command in $cmd * RC: if RC==0 Returns Output, else 'RC - Output' * * @param string $cmd : command to start * * @param int $rc * @return string The content that is displayed on the website */ public static function qfqExec($cmd, &$rc = 0) { exec($cmd, $arr, $rc); $output = implode('
', $arr); if ($rc != 0) { $output = $rc . " - " . $output; } return ($output); } }