fogcontroller.class.php (fogproject-1.5.7) | : | fogcontroller.class.php (fogproject-1.5.8) | ||
---|---|---|---|---|
skipping to change at line 310 | skipping to change at line 310 | |||
$this->loadItem($key); | $this->loadItem($key); | |||
} | } | |||
$msg = sprintf( | $msg = sprintf( | |||
'%s: %s, %s: %s', | '%s: %s, %s: %s', | |||
_('Adding Key'), | _('Adding Key'), | |||
$key, | $key, | |||
_('Value'), | _('Value'), | |||
print_r($value, 1) | print_r($value, 1) | |||
); | ); | |||
self::info($msg); | self::info($msg); | |||
if (!is_array($this->data[$key])) { | if (isset($this->data[$key]) && !is_array($this->data[$key])) { | |||
$this->data[$key] = array($this->data[$key]); | $this->data[$key] = array($this->data[$key]); | |||
} | } | |||
$this->data[$key][] = $value; | $this->data[$key][] = $value; | |||
} catch (Exception $e) { | } catch (Exception $e) { | |||
$str = sprintf( | $str = sprintf( | |||
'%s: %s: %s, %s: %s', | '%s: %s: %s, %s: %s', | |||
_('Add failed'), | _('Add failed'), | |||
_('Key'), | _('Key'), | |||
$key, | $key, | |||
_('Error'), | _('Error'), | |||
skipping to change at line 838 | skipping to change at line 838 | |||
} | } | |||
$test = $this->_testFields($key); | $test = $this->_testFields($key); | |||
if (!$test) { | if (!$test) { | |||
throw new Exception(_('Invalid key being requested')); | throw new Exception(_('Invalid key being requested')); | |||
} | } | |||
if (!in_array($array_type, array('merge', 'diff'))) { | if (!in_array($array_type, array('merge', 'diff'))) { | |||
throw new Exception( | throw new Exception( | |||
_('Invalid type, merge to add, diff to remove') | _('Invalid type, merge to add, diff to remove') | |||
); | ); | |||
} | } | |||
$array = array_filter($array); | ||||
if (count($array) < 1) { | ||||
return $this; | ||||
} | ||||
switch ($array_type) { | switch ($array_type) { | |||
case 'merge': | case 'merge': | |||
foreach ((array)$array as &$a) { | foreach ((array)$array as &$a) { | |||
$this->add($key, $a); | $this->add($key, $a); | |||
unset($a); | unset($a); | |||
} | } | |||
break; | break; | |||
case 'diff': | case 'diff': | |||
foreach ((array)$array as &$a) { | foreach ((array)$array as &$a) { | |||
$this->remove($key, $a); | $this->remove($key, $a); | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 5 lines changed or added |