Merge pull request #6523 from eileenmcnaughton/CRM-16955
[civicrm-core.git] / CRM / Core / Config / Variables.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26 */
27
28 /**
29 * Variables class contains definitions of all the core config settings that are allowed on
30 * CRM_Core_Config. If you want a config variable to be present in run time config object,
31 * it need to be defined here first.
32 *
33 * @package CRM
34 * @copyright CiviCRM LLC (c) 2004-2015
35 * $Id$
36 *
37 */
38 class CRM_Core_Config_Variables extends CRM_Core_Config_Defaults {
39
40 /**
41 * The debug level for civicrm.
42 * @var int
43 */
44 public $debug = 0;
45 public $backtrace = 0;
46
47 /**
48 * The directory where Smarty and plugins are installed.
49 * @var string
50 */
51 public $smartyDir = NULL;
52 public $pluginsDir = NULL;
53
54 /**
55 * The root directory of our template tree.
56 * @var string
57 */
58 public $templateDir = NULL;
59
60 /**
61 * The resourceBase of our application. Used when we want to compose
62 * url's for things like js/images/css
63 * @var string
64 */
65 public $resourceBase = NULL;
66
67 /**
68 * The directory to store uploaded files
69 */
70 public $uploadDir = NULL;
71
72 /**
73 * The directory to store uploaded image files
74 */
75 public $imageUploadDir = NULL;
76
77 /**
78 * The directory to store uploaded files in custom data
79 */
80 public $customFileUploadDir = NULL;
81
82 /**
83 * The url that we can use to display the uploaded images
84 */
85 public $imageUploadURL = NULL;
86
87 /**
88 * The local path to the default extension container
89 */
90 public $extensionsDir;
91
92 /**
93 * The url for resources defined by extensions
94 */
95 public $extensionsURL = NULL;
96
97 /**
98 * Are we generating clean url's and using mod_rewrite
99 * @var string
100 */
101 public $cleanURL = FALSE;
102
103 /**
104 * List of country codes limiting the country list.
105 * 1228 is an id for United States.
106 * @var string
107 */
108 public $countryLimit = array('1228');
109
110 /**
111 * Id of default state/province for contact.
112 * 1046 is an id for Washington(country:United States).
113 * @var int
114 */
115 public $defaultContactStateProvince;
116
117 /**
118 * List of country codes limiting the province list.
119 * 1228 is an id for United States.
120 * @var string
121 */
122 public $provinceLimit = array('1228');
123
124 /**
125 * ISO code of default country for contact.
126 * 1228 is an id for United States.
127 * @var int
128 */
129 public $defaultContactCountry = '1228';
130
131 /**
132 * ISO code of default currency.
133 * @var int
134 */
135 public $defaultCurrency = 'USD';
136
137 /**
138 * Locale for the application to run with.
139 * @var string
140 */
141 public $lcMessages = 'en_US';
142
143 /**
144 * String format for date+time
145 * @var string
146 */
147 public $dateformatDatetime = '%B %E%f, %Y %l:%M %P';
148
149 /**
150 * String format for a full date (one with day, month and year)
151 * @var string
152 */
153 public $dateformatFull = '%B %E%f, %Y';
154
155 /**
156 * String format for a partial date (one with month and year)
157 * @var string
158 */
159 public $dateformatPartial = '%B %Y';
160
161 /**
162 * String format for a year-only date
163 * @var string
164 */
165 public $dateformatYear = '%Y';
166
167 /**
168 * Display format for time
169 * @var string
170 */
171 public $dateformatTime = '%l:%M %P';
172
173 /**
174 * Input format for time
175 * @var string
176 */
177 public $timeInputFormat = 1;
178
179 /**
180 * Input format for date plugin
181 * @var string
182 */
183 public $dateInputFormat = 'mm/dd/yy';
184
185 /**
186 * Month and day on which fiscal year starts.
187 *
188 * @var array
189 */
190 public $fiscalYearStart = array(
191 'M' => 01,
192 'd' => 01,
193 );
194
195 /**
196 * String format for monetary amounts
197 * @var string
198 */
199 public $moneyformat = '%c %a';
200
201 /**
202 * String format for monetary values
203 * @var string
204 */
205 public $moneyvalueformat = '%!i';
206
207 /**
208 * Format for monetary amounts
209 * @var string
210 */
211 public $currencySymbols = '';
212
213 /**
214 * Format for monetary amounts
215 * @var string
216 */
217 public $defaultCurrencySymbol = '$';
218
219 /**
220 * Monetary decimal point character
221 * @var string
222 */
223 public $monetaryDecimalPoint = '.';
224
225 /**
226 * Monetary thousands separator
227 * @var string
228 */
229 public $monetaryThousandSeparator = ',';
230
231 /**
232 * Default user framework. This basically makes Drupal 7 the default
233 */
234 public $userFramework = 'Drupal';
235 public $userFrameworkVersion = 'Unknown';
236 public $userFrameworkUsersTableName = 'users';
237 public $userFrameworkClass = 'CRM_Utils_System_Drupal';
238 public $userHookClass = 'CRM_Utils_Hook_Drupal';
239
240 /**
241 * @var string|CRM_Core_Permission_Base
242 */
243 public $userPermissionClass = 'CRM_Core_Permission_Drupal';
244
245 /**
246 * @var NULL|CRM_Core_Permission_Temp
247 */
248 public $userPermissionTemp = NULL;
249
250 public $userFrameworkURLVar = 'q';
251 public $userFrameworkDSN = NULL;
252 public $userFrameworkBaseURL = NULL;
253 public $userFrameworkResourceURL = NULL;
254 public $userFrameworkFrontend = FALSE;
255 public $userFrameworkLogging = FALSE;
256
257 public $maxFileSize = 2;
258
259 /**
260 * The custom locale strings. Note that these locale strings are stored
261 * in a separate column in civicrm_domain
262 * @var array
263 */
264 public $localeCustomStrings = NULL;
265
266 /**
267 * Map Provider
268 *
269 * @var string
270 */
271 public $mapProvider = NULL;
272
273 /**
274 * Map API Key
275 *
276 * @var string
277 */
278 public $mapAPIKey = NULL;
279
280 /**
281 * Geocoding Provider
282 *
283 * @var string
284 */
285 public $geoProvider = NULL;
286
287 /**
288 * Geocoding API Key
289 *
290 * @var string
291 */
292 public $geoAPIKey = NULL;
293
294 /**
295 * How should we get geo code information if google map support needed
296 *
297 * @var string
298 */
299 public $geocodeMethod = '';
300
301 /**
302 * Whether database-level logging should be performed
303 * @var boolean
304 */
305 public $logging = FALSE;
306
307 /**
308 * Whether public pages should display "empowered by CiviCRM"
309 *
310 * @var boolean
311 */
312 public $empoweredBy = TRUE;
313
314 /**
315 * Array of enabled add-on components (e.g. CiviContribute, CiviMail...)
316 *
317 * @var array
318 */
319 public $enableComponents = array(
320 'CiviContribute',
321 'CiviPledge',
322 'CiviMember',
323 'CiviEvent',
324 'CiviMail',
325 'CiviReport',
326 );
327 public $enableComponentIDs = array(1, 6, 2, 3, 4, 8);
328
329 /**
330 * Should payments be accepted only via SSL?
331 *
332 * @var boolean
333 */
334 public $enableSSL = FALSE;
335
336 /**
337 * Fatal error handler
338 *
339 * @var string
340 */
341 public $fatalErrorHandler = NULL;
342
343 /**
344 * Legacy encoding for file encoding conversion
345 *
346 * @var string
347 */
348 public $legacyEncoding = 'Windows-1252';
349
350 /**
351 * Field separator for import/export csv file
352 *
353 * @var string
354 */
355 public $fieldSeparator = ',';
356
357 /**
358 * Some search settings
359 */
360 public $includeWildCardInName = 1;
361 public $includeEmailInName = 1;
362 public $includeNickNameInName = 0;
363
364 public $smartGroupCacheTimeout = 5;
365
366 public $defaultSearchProfileID = NULL;
367
368 /**
369 * Dashboard timeout
370 */
371 public $dashboardCacheTimeout = 1440;
372
373 /**
374 * Flag to indicate if acl cache is NOT to be reset
375 */
376 public $doNotResetCache = 0;
377
378 /**
379 * Optimization related variables
380 */
381 public $includeAlphabeticalPager = 1;
382 public $includeOrderByClause = 1;
383
384 /**
385 * determine whether the call is from cms or civicrm
386 */
387 public $inCiviCRM = FALSE;
388
389 /**
390 * Component registry object (of CRM_Core_Component type)
391 */
392 public $componentRegistry = NULL;
393
394 /**
395 * PDF receipt as attachment is disabled by default (CRM-8350)
396 */
397 public $doNotAttachPDFReceipt = FALSE;
398
399 /**
400 * Path to wkhtmltopdf if available
401 */
402 public $wkhtmltopdfPath = FALSE;
403
404 /**
405 * Allow second-degree relations permission to edit contacts
406 */
407 public $secondDegRelPermissions = FALSE;
408
409
410 /**
411 * Allow second-degree relations permission to edit contacts
412 */
413 public $wpBasePage = NULL;
414
415 /**
416 * Provide addressSequence.
417 *
418 * @param
419 *
420 * @return string
421 */
422 public function addressSequence() {
423 $addressFormat = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
424 'address_format'
425 );
426
427 return CRM_Utils_Address::sequence($addressFormat);
428 }
429
430 /**
431 * Provide cached default currency symbol.
432 *
433 * @param
434 *
435 * @return string
436 */
437 public function defaultCurrencySymbol($defaultCurrency = NULL) {
438 static $cachedSymbol = NULL;
439 if (!$cachedSymbol || $defaultCurrency) {
440 if ($this->defaultCurrency || $defaultCurrency) {
441 $this->currencySymbols = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'currency', array(
442 'labelColumn' => 'symbol',
443 'orderColumn' => TRUE,
444 ));
445 $currency = $defaultCurrency ? $defaultCurrency : $this->defaultCurrency;
446 $cachedSymbol = CRM_Utils_Array::value($currency, $this->currencySymbols, '');
447 }
448 else {
449 $cachedSymbol = '$';
450 }
451 }
452 return $cachedSymbol;
453 }
454
455 /**
456 * Provide cached default currency symbol.
457 *
458 * @param
459 *
460 * @return string
461 */
462 public function defaultContactCountry() {
463 static $cachedContactCountry = NULL;
464
465 if (!empty($this->defaultContactCountry) &&
466 !$cachedContactCountry
467 ) {
468 $countryIsoCodes = CRM_Core_PseudoConstant::countryIsoCode();
469 $cachedContactCountry = CRM_Utils_Array::value($this->defaultContactCountry,
470 $countryIsoCodes
471 );
472 }
473 return $cachedContactCountry;
474 }
475
476 /**
477 * Provide cached default country name.
478 *
479 * @param
480 *
481 * @return string
482 */
483 public function defaultContactCountryName() {
484 static $cachedContactCountryName = NULL;
485 if (!$cachedContactCountryName && $this->defaultContactCountry) {
486 $countryCodes = CRM_Core_PseudoConstant::country();
487 $cachedContactCountryName = $countryCodes[$this->defaultContactCountry];
488 }
489 return $cachedContactCountryName;
490 }
491
492 /**
493 * Provide cached country limit translated to names.
494 *
495 * @param
496 *
497 * @return array
498 */
499 public function countryLimit() {
500 static $cachedCountryLimit = NULL;
501 if (!$cachedCountryLimit) {
502 $countryIsoCodes = CRM_Core_PseudoConstant::countryIsoCode();
503 $country = array();
504 if (is_array($this->countryLimit)) {
505 foreach ($this->countryLimit as $val) {
506 // CRM-12007
507 // some countries have disappeared and hence they might be in country limit
508 // but not in the country table
509 if (isset($countryIsoCodes[$val])) {
510 $country[] = $countryIsoCodes[$val];
511 }
512 }
513 }
514 else {
515 $country[] = $countryIsoCodes[$this->countryLimit];
516 }
517 $cachedCountryLimit = $country;
518 }
519 return $cachedCountryLimit;
520 }
521
522 /**
523 * Provide cached province limit translated to names.
524 *
525 * @param
526 *
527 * @return array
528 */
529 public function provinceLimit() {
530 static $cachedProvinceLimit = NULL;
531 if (!$cachedProvinceLimit) {
532 $countryIsoCodes = CRM_Core_PseudoConstant::countryIsoCode();
533 $country = array();
534 if (is_array($this->provinceLimit)) {
535 foreach ($this->provinceLimit as $val) {
536 // CRM-12007
537 // some countries have disappeared and hence they might be in country limit
538 // but not in the country table
539 if (isset($countryIsoCodes[$val])) {
540 $country[] = $countryIsoCodes[$val];
541 }
542 }
543 }
544 else {
545 $country[] = $countryIsoCodes[$this->provinceLimit];
546 }
547 $cachedProvinceLimit = $country;
548 }
549 return $cachedProvinceLimit;
550 }
551
552 }
553 // end CRM_Core_Config