Beispiel #1
0
 /**
  * xapp option shortcut xapp_get_options full option getter gets all options as part of the xapp option functionality.
  * the first parameter can be:
  * 1) array = returning $mixed simply
  * 2) object = object instance implementing xapp option handling or not
  * 3) string = object class name as string to handle static classes/options
  * 4) null = null when called inside class for xapp option handling for auto caller determination
  *
  * @param null|object|string|array $mixed expects value according to explanation above
  * @param array|mixed $default expects default if options array is not found
  * @return array|mixed|null returns options array
  */
 function xapp_get_options(&$mixed = null, $default = array())
 {
     if (is_array($mixed)) {
         return $mixed;
     } else {
         if (xapped()) {
             return (array) Xapp::getOptions($mixed);
         } else {
             if (is_object($mixed) && xapp_can_options($mixed)) {
                 return (array) $mixed->options;
             } else {
                 if (is_string($mixed) && xapp_can_options($mixed)) {
                     return (array) $mixed::$options;
                 } else {
                     return xapp_default($default);
                 }
             }
         }
     }
 }