Merge pull request #353 from eileenmcnaughton/trunk-kill-eval
[civicrm-core.git] / api / v2 / Constant.php
CommitLineData
6a488035
TO
1<?php
2// $Id: Constant.php 45502 2013-02-08 13:32:55Z kurund $
3
4
5/*
6 +--------------------------------------------------------------------+
7 | CiviCRM version 4.3 |
8 +--------------------------------------------------------------------+
9 | Copyright CiviCRM LLC (c) 2004-2013 |
10 +--------------------------------------------------------------------+
11 | This file is a part of CiviCRM. |
12 | |
13 | CiviCRM is free software; you can copy, modify, and distribute it |
14 | under the terms of the GNU Affero General Public License |
15 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
16 | |
17 | CiviCRM is distributed in the hope that it will be useful, but |
18 | WITHOUT ANY WARRANTY; without even the implied warranty of |
19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
20 | See the GNU Affero General Public License for more details. |
21 | |
22 | You should have received a copy of the GNU Affero General Public |
23 | License and the CiviCRM Licensing Exception along |
24 | with this program; if not, contact CiviCRM LLC |
25 | at info[AT]civicrm[DOT]org. If you have questions about the |
26 | GNU Affero General Public License or the licensing of CiviCRM, |
27 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
28 +--------------------------------------------------------------------+
29*/
30
31/**
32 * File for CiviCRM APIv2 pseudoconstants
33 *
34 * @package CiviCRM_APIv2
35 * @subpackage API_Constant
36 * @copyright CiviCRM LLC (c) 2004-2013
37 * @version $Id: Constant.php 45502 2013-02-08 13:32:55Z kurund $
38 *
39 */
40
41/**
42 * Include utility functions
43 */
44require_once 'api/v2/utils.php';
45
46/**
47 * Generic file to retrieve all the constants and
48 * pseudo constants used in CiviCRM
49 *
50 * @param string Name of a public static method of
51 * CRM_Core_PseudoContant: one of
52 * <ul>
53 * <li>activityStatus</li>
54 * <li>activityType</li>
55 * <li>addressee</li>
56 * <li>allGroup</li>
57 * <li>country</li>
58 * <li>countryIsoCode</li>
59 * <li>county</li>
60 * <li>currencyCode</li>
61 * <li>currencySymbols</li>
62 * <li>customGroup</li>
63 * <li>emailGreeting</li>
64 * <li>fromEmailAddress</li>
65 * <li>gender</li>
66 * <li>group</li>
67 * <li>groupIterator</li>
68 * <li>honor</li>
69 * <li>IMProvider</li>
70 * <li>individualPrefix</li>
71 * <li>individualSuffix</li>
72 * <li>locationType</li>
73 * <li>locationVcardName</li>
74 * <li>mailProtocol</li>
75 * <li>mappingTypes</li>
76 * <li>paymentProcessor</li>
77 * <li>paymentProcessorType</li>
78 * <li>pcm</li>
79 * <li>phoneType</li>
80 * <li>postalGreeting</li>
81 * <li>priority</li>
82 * <li>relationshipType</li>
83 * <li>stateProvince</li>
84 * <li>stateProvinceAbbreviation</li>
85 * <li>stateProvinceForCountry</li>
86 * <li>staticGroup</li>
87 * <li>tag</li>
88 * <li>tasks</li>
89 * <li>ufGroup</li>
90 * <li>visibility</li>
91 * <li>worldRegion</li>
92 * <li>wysiwygEditor</li>
93 * </ul>
94 */
95function civicrm_constant_get($name, $params = array(
96 )) {
97 require_once 'CRM/Core/PseudoConstant.php';
98 $className = 'CRM_Core_PseudoConstant';
99 $callable = "$className::$name";
100
101 if (is_callable($callable)) {
102 if (empty($params)) {
103 $values = call_user_func(array($className, $name));
104 }
105 else {
106 $values = call_user_func_array(array($className, $name), $params);
107 }
108 return $values;
109 }
110
111 return civicrm_create_error(ts('Unknown civicrm constant or method not callable'));
112}
113