7afd1b42b8f2be09cd1a304daaab5a0527765307
[civicrm-core.git] / CRM / Core / Config / Variables.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
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-2014
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 encoding of strings returned by gettext
233 * @var string
234 */
235 public $gettextCodeset = 'utf-8';
236
237 /**
238 * Default name for gettext domain.
239 * @var string
240 */
241 public $gettextDomain = 'civicrm';
242
243 /**
244 * Default location of gettext resource files.
245 */
246 public $gettextResourceDir = './l10n/';
247
248 /**
249 * Default user framework. This basically makes Drupal 7 the default
250 */
251 public $userFramework = 'Drupal';
252 public $userFrameworkVersion = 'Unknown';
253 public $userFrameworkUsersTableName = 'users';
254 public $userFrameworkClass = 'CRM_Utils_System_Drupal';
255 public $userHookClass = 'CRM_Utils_Hook_Drupal';
256 public $userPermissionClass = 'CRM_Core_Permission_Drupal';
257 public $userFrameworkURLVar = 'q';
258 public $userFrameworkDSN = NULL;
259 public $userFrameworkBaseURL = NULL;
260 public $userFrameworkResourceURL = NULL;
261 public $userFrameworkFrontend = FALSE;
262 public $userFrameworkLogging = FALSE;
263
264 /**
265 * the handle for import file size
266 * @var int
267 */
268 public $maxImportFileSize = 1048576;
269 public $maxFileSize = 2;
270
271 /**
272 * The custom locale strings. Note that these locale strings are stored
273 * in a separate column in civicrm_domain
274 * @var array
275 */
276 public $localeCustomStrings = NULL;
277
278 /**
279 * Map Provider
280 *
281 * @var string
282 */
283 public $mapProvider = NULL;
284
285 /**
286 * Map API Key
287 *
288 * @var string
289 */
290 public $mapAPIKey = NULL;
291
292 /**
293 * Geocoding Provider
294 *
295 * @var string
296 */
297 public $geoProvider = NULL;
298
299 /**
300 * Geocoding API Key
301 *
302 * @var string
303 */
304 public $geoAPIKey = NULL;
305
306 /**
307 * How should we get geo code information if google map support needed
308 *
309 * @var string
310 */
311 public $geocodeMethod = '';
312
313 /**
314 *
315 *
316 * @var boolean
317 */
318 public $mapGeoCoding = 1;
319
320
321 /**
322 * Whether database-level logging should be performed
323 * @var boolean
324 */
325 public $logging = FALSE;
326
327 /**
328 * Whether CiviCRM should check for newer versions
329 *
330 * @var boolean
331 */
332 public $versionCheck = TRUE;
333
334 /**
335 * Whether public pages should display "empowered by CiviCRM"
336 *
337 * @var boolean
338 */
339 public $empoweredBy = TRUE;
340
341 /**
342 * Array of enabled add-on components (e.g. CiviContribute, CiviMail...)
343 *
344 * @var array
345 */
346 public $enableComponents = array(
347 'CiviContribute', 'CiviPledge', 'CiviMember',
348 'CiviEvent', 'CiviMail', 'CiviReport',
349 );
350 public $enableComponentIDs = array(1, 6, 2, 3, 4, 8);
351
352 /**
353 * Should payments be accepted only via SSL?
354 *
355 * @var boolean
356 */
357 public $enableSSL = FALSE;
358
359 /**
360 * error template to use for fatal errors
361 *
362 * @var string
363 */
364 public $fatalErrorTemplate = 'CRM/common/fatal.tpl';
365
366 /**
367 * fatal error handler
368 *
369 * @var string
370 */
371 public $fatalErrorHandler = NULL;
372
373 /**
374 * legacy encoding for file encoding conversion
375 *
376 * @var string
377 */
378 public $legacyEncoding = 'Windows-1252';
379
380 /**
381 * field separator for import/export csv file
382 *
383 * @var string
384 */
385 public $fieldSeparator = ',';
386
387 /**
388 * max location blocks in address
389 *
390 * @var integer
391 */
392 public $maxLocationBlocks = 2;
393
394 /**
395 * the font path where captcha fonts are stored
396 *
397 * @var string
398 */
399 public $captchaFontPath = '/usr/X11R6/lib/X11/fonts/';
400
401 /**
402 * the font to use for captcha
403 *
404 * @var string
405 */
406 public $captchaFont = 'HelveticaBold.ttf';
407
408 /**
409 * Some search settings
410 */
411 public $includeWildCardInName = 1;
412 public $includeEmailInName = 1;
413 public $includeNickNameInName = 0;
414
415 public $smartGroupCacheTimeout = 5;
416
417 public $defaultSearchProfileID = NULL;
418
419 /**
420 * Dashboard timeout
421 */
422 public $dashboardCacheTimeout = 1440;
423
424 /**
425 * flag to indicate if acl cache is NOT to be reset
426 */
427 public $doNotResetCache = 0;
428
429 /**
430 * Optimization related variables
431 */
432 public $includeAlphabeticalPager = 1;
433 public $includeOrderByClause = 1;
434 public $oldInputStyle = 1;
435
436 /**
437 * should we disable key generation for forms
438 *
439 * @var boolean
440 */
441 public $formKeyDisable = FALSE;
442
443 /**
444 * to determine whether the call is from cms or civicrm
445 */
446 public $inCiviCRM = FALSE;
447
448 /**
449 * component registry object (of CRM_Core_Component type)
450 */
451 public $componentRegistry = NULL;
452
453 /**
454 * PDF receipt as attachment is disabled by default (CRM-8350)
455 */
456 public $doNotAttachPDFReceipt = FALSE;
457
458 /**
459 * Path to wkhtmltopdf if available
460 */
461 public $wkhtmltopdfPath = FALSE;
462
463 /**
464 * Allow second-degree relations permission to edit contacts
465 */
466 public $secondDegRelPermissions = FALSE;
467
468
469 /**
470 * Allow second-degree relations permission to edit contacts
471 */
472 public $wpBasePage = NULL;
473
474 /**
475 * Provide addressSequence
476 *
477 * @param
478 *
479 * @return string
480 */
481 public function addressSequence() {
482 $addressFormat = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
483 'address_format'
484 );
485
486 return CRM_Utils_Address::sequence($addressFormat);
487 }
488
489 /**
490 * Provide cached default currency symbol
491 *
492 * @param
493 *
494 * @return string
495 */
496 public function defaultCurrencySymbol($defaultCurrency = NULL) {
497 static $cachedSymbol = NULL;
498 if (!$cachedSymbol || $defaultCurrency) {
499 if ($this->defaultCurrency || $defaultCurrency) {
500 $this->currencySymbols = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'currency', array(
501 'labelColumn' => 'symbol',
502 'orderColumn' => TRUE,
503 ));
504 $currency = $defaultCurrency ? $defaultCurrency : $this->defaultCurrency;
505 $cachedSymbol = CRM_Utils_Array::value($currency, $this->currencySymbols, '');
506 }
507 else {
508 $cachedSymbol = '$';
509 }
510 }
511 return $cachedSymbol;
512 }
513
514 /**
515 * Provide cached default currency symbol
516 *
517 * @param
518 *
519 * @return string
520 */
521 public function defaultContactCountry() {
522 static $cachedContactCountry = NULL;
523
524 if (!empty($this->defaultContactCountry) &&
525 !$cachedContactCountry
526 ) {
527 $countryIsoCodes = CRM_Core_PseudoConstant::countryIsoCode();
528 $cachedContactCountry = CRM_Utils_Array::value($this->defaultContactCountry,
529 $countryIsoCodes
530 );
531 }
532 return $cachedContactCountry;
533 }
534
535 /**
536 * Provide cached default country name
537 *
538 * @param
539 *
540 * @return string
541 */
542 public function defaultContactCountryName() {
543 static $cachedContactCountryName = NULL;
544 if (!$cachedContactCountryName && $this->defaultContactCountry) {
545 $countryCodes = CRM_Core_PseudoConstant::country();
546 $cachedContactCountryName = $countryCodes[$this->defaultContactCountry];
547 }
548 return $cachedContactCountryName;
549 }
550
551 /**
552 * Provide cached country limit translated to names
553 *
554 * @param
555 *
556 * @return array
557 */
558 public function countryLimit() {
559 static $cachedCountryLimit = NULL;
560 if (!$cachedCountryLimit) {
561 $countryIsoCodes = CRM_Core_PseudoConstant::countryIsoCode();
562 $country = array();
563 if (is_array($this->countryLimit)) {
564 foreach ($this->countryLimit as $val) {
565 // CRM-12007
566 // some countries have disappeared and hence they might be in country limit
567 // but not in the country table
568 if (isset($countryIsoCodes[$val])) {
569 $country[] = $countryIsoCodes[$val];
570 }
571 }
572 }
573 else {
574 $country[] = $countryIsoCodes[$this->countryLimit];
575 }
576 $cachedCountryLimit = $country;
577 }
578 return $cachedCountryLimit;
579 }
580
581 /**
582 * Provide cached province limit translated to names
583 *
584 * @param
585 *
586 * @return array
587 */
588 public function provinceLimit() {
589 static $cachedProvinceLimit = NULL;
590 if (!$cachedProvinceLimit) {
591 $countryIsoCodes = CRM_Core_PseudoConstant::countryIsoCode();
592 $country = array();
593 if (is_array($this->provinceLimit)) {
594 foreach ($this->provinceLimit as $val) {
595 // CRM-12007
596 // some countries have disappeared and hence they might be in country limit
597 // but not in the country table
598 if (isset($countryIsoCodes[$val])) {
599 $country[] = $countryIsoCodes[$val];
600 }
601 }
602 }
603 else {
604 $country[] = $countryIsoCodes[$this->provinceLimit];
605 }
606 $cachedProvinceLimit = $country;
607 }
608 return $cachedProvinceLimit;
609 }
610 }
611 // end CRM_Core_Config
612