示例#1
0
 /**
  * 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_IMPORT_', 'QUICKBOOKS_QUERY_', 'QUICKBOOKS_ADD_', 'QUICKBOOKS_MOD_', 'QUICKBOOKS_DEL_', 'QUICKBOOKS_VOID_');
     $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;
 }
示例#2
0
 /**
  * Do some fancy string matching
  * 
  * @param string $pattern
  * @param string $str
  * @return boolean
  */
 protected function _fnmatch($pattern, $str)
 {
     return QuickBooks_Utilities::fnmatch($pattern, $str);
 }