/** * * Check the allowed using of input elements in a function * @param array $inputArray Input Array with search elements * @param string $function Currently function * @return ErrorException */ public static function isPossibleInputElementOfFunction($inputArray, $function) { $possibleElements = GR4PHP_Template::possibleInputValuesByFunction($function); try { foreach ((array) $inputArray as $element => $value) { if (!in_array($element, $possibleElements)) { throw new GR4PHP_Exception("The element -" . $element . "- is not allowed in function: " . $function . ". Please check the manual!"); } } } catch (GR4PHP_Exception $e) { echo "<b>Error: " . $e->getMessage() . "</b>"; exit; } }
echo $str; echo "<br /><br />"; ?> Keys of array: <input name="array1" size="50" type="text" value="<?php echo $array1; ?> "/> Values of array: <input name="array2" size="50" type="text" value="<?php echo $array2; ?> "/> <br /> <i>Possible keys: <?php echo getArray2String(GR4PHP_Template::possibleInputValuesByFunction($function)); ?> </i> <br /> <br /> Which elements would you like to see?: <input name="array3" size="50" type="text" value="<?php echo $array3; ?> "/> <br /> <i>Possible SELECT-elements are: <?php echo str_replace("?", "", getArray2String(array_merge((array) GR4PHP_Template::getSelectPartsByFunction("general"), (array) GR4PHP_Template::getSelectPartsByFunction($function)))); ?> </i> <br />