<?php
/**
* @package Lettr
* @subpackage Validation
* @access private
* @author Digineo GmbH
* @copyright Digineo GmbH, 2010
* @link http://www.digineo.de
* @link mailto:kontakt@digineo.de
*/
class Lettr_Validation {
// $one_attribute
public static function presence_of($array_name, $array, $attribute_list, $either_attributes = null){
if(!is_array($array)){
throw new Lettr_IllegalArgumentException('Argument ist kein Array');
}
foreach($attribute_list as $attr){
if(empty($array[$attr])){
throw new Lettr_IllegalArgumentException('$'.$array_name.'["'.$attr.'"] ist leer oder nicht definiert.');
}
}
// Optionale Attribute, von denen mindestens eins vorhanden sein muss. Mit RegExp!
if ($either_attributes) {
$found = false;
foreach ($either_attributes as $attr) {
if (!empty($array[$attr])) {
$found = true;
}
}
if (!$found) {
foreach ($array as $key => $val) {
foreach ($either_attributes as $attr) {
if (preg_match("/" .$attr . "/i", $key, $matches)) {
if (!empty($array[$matches[0]])){
$found = true;
}
}
}
}
}
if (!$found){ throw new Lettr_IllegalArgumentException('Es muss eines der folgenden Attribute vorhanden sein: ' . json_encode($either_attributes)); }
}
}
}
?>
| nama | waktu | ukuran | owner | perm | aksi |
|---|---|---|---|---|---|
| .. | |||||
| .htaccess | 2025-01-28 22:35 | 118 B | 76129f60960:kunden | -xw-x----- | |
| export.php | 2013-11-12 21:09 | 3.66 KB | 76129f60960:kunden | -xw-x----- | |
| lettr.class.php | 2013-11-12 21:09 | 4.72 KB | 76129f60960:kunden | -xw-x----- | |
| lettr_client.class.php | 2013-11-12 21:09 | 8.53 KB | 76129f60960:kunden | -xw-x----- | |
| lettr_delivery.class.php | 2013-11-12 21:09 | 2.52 KB | 76129f60960:kunden | -xw-x----- | |
| lettr_exceptions.class.php | 2013-11-12 21:09 | 1.64 KB | 76129f60960:kunden | -xw-x----- | |
| lettr_init.php | 2013-11-12 21:09 | 712 B | 76129f60960:kunden | -xw-x----- | |
| lettr_recipient.class.php | 2013-11-12 21:09 | 1.16 KB | 76129f60960:kunden | -xw-x----- | |
| lettr_resource.class.php | 2013-11-12 21:09 | 1.44 KB | 76129f60960:kunden | -xw-x----- | |
| lettr_validation.class.php | 2013-11-12 21:09 | 1.5 KB | 76129f60960:kunden | -xw-x----- | |