PopeHelpers

Provides helper methods for Pope objects.

Defined (1)

The class is defined in the following location(s).

/pope/lib/class.extensibleobject.php  
  1. class PopeHelpers 
  2. /** 
  3. * Merges two associative arrays 
  4. * @param array $a1 
  5. * @param array $a2 
  6. * @return array 
  7. */ 
  8. function array_merge_assoc($a1, $a2, $skip_empty=FALSE) 
  9. if ($a2) { 
  10. foreach ($a2 as $key => $value) { 
  11. if ($skip_empty && $value === '' OR is_null($value)) continue; 
  12. if (isset($a1[$key])) { 
  13.  
  14. if (is_array($value)) { 
  15. $a1[$key] = $this->array_merge_assoc($a1[$key], $value); 
  16.  
  17. else { 
  18. $a1[$key] = $value; 
  19.  
  20. else $a1[$key] = $value; 
  21. return $a1; 
  22.  
  23.  
  24. /** 
  25. * Returns TRUE if a property is empty 
  26. * @param string $var 
  27. * @return boolean 
  28. */ 
  29. function is_empty($var, $element=FALSE) 
  30. if (is_array($var) && $element) { 
  31. if (isset($var[$element])) $var = $var[$element]; 
  32. else $var = FALSE; 
  33.  
  34. return (is_null($var) OR (is_string($var) AND strlen($var) == 0) OR $var === FALSE);