X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2FConstant.php;h=f9c96b894c3237c81c44d29f4d2815d4c8265d2e;hb=6f2500ee7589360102875df4367568fe87485df6;hp=93fcfcb68f9a054f739aec73c1c41f301945956e;hpb=bb7a7fe21a8a8a01296978aabe03e6a6e86fc649;p=civicrm-core.git
diff --git a/api/v3/Constant.php b/api/v3/Constant.php
index 93fcfcb68f..f9c96b894c 100644
--- a/api/v3/Constant.php
+++ b/api/v3/Constant.php
@@ -2,7 +2,7 @@
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
@@ -36,11 +36,19 @@
* @version $Id: Constant.php 30171 2010-10-14 09:11:27Z mover $
*/
+/**
+ * @deprecated api notice
+ * @return string to indicate this entire api entity is deprecated
+ */
+function _civicrm_api3_constant_deprecation() {
+ return 'The constant api is deprecated as of CiviCRM 4.4. Please use the getoptions api action instead.';
+}
+
/**
* @deprecated as of CiviCRM 4.4.
* It's recommended to use the api getoptions action instead
*
- * @param string Name of a public static method of
+ * @param string Name of a public static method of
* CRM_Core_PseudoConstant: one of
*
* - activityStatus
@@ -85,7 +93,7 @@
* - wysiwygEditor
*
* @return array
- * @example ConstantGet.php
+ * @example ConstantGet.php
* {@getfields constant_get}
*/
function civicrm_api3_constant_get($params) {
@@ -95,7 +103,6 @@ function civicrm_api3_constant_get($params) {
//ie $values = call_user_func(array('CRM_Utils_PseudoConstant', 'getConstant'), $name);
// once tests are 100% can try removing the first block & a similar block from Generic:getoptions
-
// Whitelist approach is safer
$allowedClasses = array(
'CRM_Core_PseudoConstant',
@@ -117,69 +124,70 @@ function civicrm_api3_constant_get($params) {
//@TODO XAV take out the param the COOKIE, Entity, Action and so there are only the "real param" in it
//$values = call_user_func_array( array( $className, $name ), $params );
}
- return civicrm_api3_create_success($values, $params);
+ return civicrm_api3_create_success($values, $params, 'constant');
}
- else{
+ else {
$values = call_user_func(array('CRM_Utils_PseudoConstant', 'getConstant'), $name);
- if(!empty($values)){
- return civicrm_api3_create_success($values, $params);
+ if (!empty($values)) {
+ return civicrm_api3_create_success($values, $params, 'constant');
}
}
return civicrm_api3_create_error('Unknown civicrm constant or method not callable');
}
/**
- * @param $params
+ * @param array $params
*/
function _civicrm_api3_constant_get_spec(&$params) {
-
- $params = (array
- ('name' => array(
+ $options = array(
+ 'activityStatus',
+ 'activityType',
+ 'addressee',
+ 'allGroup',
+ 'country',
+ 'countryIsoCode',
+ 'county',
+ 'currencyCode',
+ 'currencySymbols',
+ 'customGroup',
+ 'emailGreeting',
+ 'fromEmailAddress',
+ 'gender',
+ 'group',
+ 'groupIterator',
+ 'honor',
+ 'IMProvider',
+ 'individualPrefix',
+ 'individualSuffix',
+ 'locationType',
+ 'locationVcardName',
+ 'mailProtocol',
+ 'mappingTypes',
+ 'paymentInstrument',
+ 'paymentProcessor',
+ 'paymentProcessorType',
+ 'pcm',
+ 'phoneType',
+ 'postalGreeting',
+ 'priority',
+ 'relationshipType',
+ 'stateProvince',
+ 'stateProvinceAbbreviation',
+ 'stateProvinceForCountry',
+ 'staticGroup',
+ 'tag',
+ 'tasks',
+ 'ufGroup',
+ 'visibility',
+ 'worldRegion',
+ 'wysiwygEditor',
+ );
+ $params = (array(
+ 'name' => array(
'title' => 'Constant Name',
+ 'name' => 'name',
'api.required' => 1,
- 'options' =>
- 'activityStatus',
- 'activityType',
- 'addressee',
- 'allGroup',
- 'country',
- 'countryIsoCode',
- 'county',
- 'currencyCode',
- 'currencySymbols',
- 'customGroup',
- 'emailGreeting',
- 'fromEmailAddress',
- 'gender',
- 'group',
- 'groupIterator',
- 'honor',
- 'IMProvider',
- 'individualPrefix',
- 'individualSuffix',
- 'locationType',
- 'locationVcardName',
- 'mailProtocol',
- 'mappingTypes',
- 'paymentInstrument',
- 'paymentProcessor',
- 'paymentProcessorType',
- 'pcm',
- 'phoneType',
- 'postalGreeting',
- 'priority',
- 'relationshipType',
- 'stateProvince',
- 'stateProvinceAbbreviation',
- 'stateProvinceForCountry',
- 'staticGroup',
- 'tag',
- 'tasks',
- 'ufGroup',
- 'visibility',
- 'worldRegion',
- 'wysiwygEditor',
+ 'options' => array_combine($options, $options),
))
);
}
-