/** * List all of the QuickBooks actions the framework supports * * @param string $filter * @param boolean $return_keys * @return array */ public static function listActions($filter = null, $return_keys = false) { $startswith = array('QUICKBOOKS_QUERY_', 'QUICKBOOKS_ADD_', 'QUICKBOOKS_MOD_', 'QUICKBOOKS_DEL_'); $constants = array(); $inter_key = 'QUICKBOOKS_INTERACTIVE_MODE'; $inter_val = QUICKBOOKS_INTERACTIVE_MODE; if (is_null($filter)) { if ($return_keys) { $constants[] = $inter_key; } else { $constants[] = $inter_val; } } else { if ($return_keys and QuickBooks_Utilities::_fnmatch($filter, $inter_key)) { $constants[] = $inter_key; } else { if (!$return_keys and QuickBooks_Utilities::_fnmatch($filter, $inter_val)) { $constants[] = $inter_val; } } } foreach (get_defined_constants() as $constant => $value) { foreach ($startswith as $start) { if (substr($constant, 0, strlen($start)) == $start) { if (!$return_keys) { $constant = $value; } if (!is_null($filter)) { if (QuickBooks_Utilities::_fnmatch($filter, $constant)) { $constants[] = $constant; } } else { $constants[] = $constant; } } } } sort($constants); return $constants; }