PageRenderTime 55ms CodeModel.GetById 26ms RepoModel.GetById 1ms app.codeStats 0ms

/drupal/sites/all/modules/civicrm/CRM/Core/Config/Variables.php

https://github.com/michaelmcandrew/th
PHP | 545 lines | 159 code | 75 blank | 311 comment | 13 complexity | bc81ba8e5bccc28126a08d1f34dec2c1 MD5 | raw file
  1. <?php
  2. /*
  3. +--------------------------------------------------------------------+
  4. | CiviCRM version 4.0 |
  5. +--------------------------------------------------------------------+
  6. | Copyright CiviCRM LLC (c) 2004-2011 |
  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. * Variables class contains definitions of all the core config settings that are allowed on
  29. * CRM_Core_Config. If you want a config variable to be present in run time config object,
  30. * it need to be defined here first.
  31. *
  32. * @package CRM
  33. * @copyright CiviCRM LLC (c) 2004-2011
  34. * $Id$
  35. *
  36. */
  37. require_once 'CRM/Core/Config/Defaults.php';
  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. * the directory where Smarty and plugins are installed
  48. * @var string
  49. */
  50. public $smartyDir = null;
  51. public $pluginsDir = null;
  52. /**
  53. * the root directory of our template tree
  54. * @var string
  55. */
  56. public $templateDir = null;
  57. /**
  58. * The resourceBase of our application. Used when we want to compose
  59. * url's for things like js/images/css
  60. * @var string
  61. */
  62. public $resourceBase = null;
  63. /**
  64. * The directory to store uploaded files
  65. */
  66. public $uploadDir = null;
  67. /**
  68. * The directory to store uploaded image files
  69. */
  70. public $imageUploadDir = null;
  71. /**
  72. * The directory to store uploaded files in custom data
  73. */
  74. public $customFileUploadDir = null;
  75. /**
  76. * The url that we can use to display the uploaded images
  77. */
  78. public $imageUploadURL = null;
  79. /**
  80. * Are we generating clean url's and using mod_rewrite
  81. * @var string
  82. */
  83. public $cleanURL = false;
  84. /**
  85. * List of country codes limiting the country list.
  86. * 1228 is an id for United States.
  87. * @var string
  88. */
  89. public $countryLimit = array( '1228' );
  90. /**
  91. * List of country codes limiting the province list.
  92. * 1228 is an id for United States.
  93. * @var string
  94. */
  95. public $provinceLimit = array( '1228' );
  96. /**
  97. * ISO code of default country for contact.
  98. * 1228 is an id for United States.
  99. * @var int
  100. */
  101. public $defaultContactCountry = '1228';
  102. /**
  103. * ISO code of default currency.
  104. * @var int
  105. */
  106. public $defaultCurrency = 'USD';
  107. /**
  108. * Locale for the application to run with.
  109. * @var string
  110. */
  111. public $lcMessages = 'en_US';
  112. /**
  113. * String format for date+time
  114. * @var string
  115. */
  116. public $dateformatDatetime = '%B %E%f, %Y %l:%M %P';
  117. /**
  118. * String format for a full date (one with day, month and year)
  119. * @var string
  120. */
  121. public $dateformatFull = '%B %E%f, %Y';
  122. /**
  123. * String format for a partial date (one with month and year)
  124. * @var string
  125. */
  126. public $dateformatPartial = '%B %Y';
  127. /**
  128. * String format for a year-only date
  129. * @var string
  130. */
  131. public $dateformatYear = '%Y';
  132. /**
  133. * Display format for time
  134. * @var string
  135. */
  136. public $dateformatTime = '%l:%M %P';
  137. /**
  138. * Input format for time
  139. * @var string
  140. */
  141. public $timeInputFormat = 1;
  142. /**
  143. * Input format for date plugin
  144. * @var string
  145. */
  146. public $dateInputFormat = 'mm/dd/yy';
  147. /**
  148. * Month and day on which fiscal year starts.
  149. *
  150. * @var array
  151. */
  152. public $fiscalYearStart = array(
  153. 'M' => 01,
  154. 'd' => 01
  155. );
  156. /**
  157. * String format for monetary amounts
  158. * @var string
  159. */
  160. public $moneyformat = '%c %a';
  161. /**
  162. * String format for monetary values
  163. * @var string
  164. */
  165. public $moneyvalueformat = '%!i';
  166. /**
  167. * Format for monetary amounts
  168. * @var string
  169. */
  170. public $currencySymbols = '';
  171. /**
  172. * Format for monetary amounts
  173. * @var string
  174. */
  175. public $defaultCurrencySymbol = '$';
  176. /**
  177. * Monetary decimal point character
  178. * @var string
  179. */
  180. public $monetaryDecimalPoint = '.';
  181. /**
  182. * Monetary thousands separator
  183. * @var string
  184. */
  185. public $monetaryThousandSeparator = ',';
  186. /**
  187. * Default encoding of strings returned by gettext
  188. * @var string
  189. */
  190. public $gettextCodeset = 'utf-8';
  191. /**
  192. * Default name for gettext domain.
  193. * @var string
  194. */
  195. public $gettextDomain = 'civicrm';
  196. /**
  197. * Default location of gettext resource files.
  198. */
  199. public $gettextResourceDir = './l10n/';
  200. /**
  201. * Default user framework
  202. */
  203. public $userFramework = 'Drupal';
  204. public $userFrameworkVersion = 'Unknown';
  205. public $userFrameworkUsersTableName = 'users';
  206. public $userFrameworkClass = 'CRM_Utils_System_Drupal';
  207. public $userHookClass = 'CRM_Utils_Hook_Drupal';
  208. public $userPermissionClass = 'CRM_Core_Permission_Drupal';
  209. public $userFrameworkURLVar = 'q';
  210. public $userFrameworkDSN = null;
  211. public $userFrameworkBaseURL = null;
  212. public $userFrameworkResourceURL = null;
  213. public $userFrameworkFrontend = false;
  214. public $userFrameworkLogging = false;
  215. /**
  216. * the handle for import file size
  217. * @var int
  218. */
  219. public $maxImportFileSize = 1048576;
  220. public $maxAttachments = 3;
  221. public $maxFileSize = 2;
  222. /**
  223. * The custom locale strings. Note that these locale strings are stored
  224. * in a separate column in civicrm_domain
  225. * @var array
  226. */
  227. public $localeCustomStrings = null;
  228. /**
  229. * Map Provider
  230. *
  231. * @var boolean
  232. */
  233. public $mapProvider = null;
  234. /**
  235. * Map API Key
  236. *
  237. * @var boolean
  238. */
  239. public $mapAPIKey = null;
  240. /**
  241. * How should we get geo code information if google map support needed
  242. *
  243. * @var boolean
  244. */
  245. public $geocodeMethod = '';
  246. /**
  247. *
  248. *
  249. * @var boolean
  250. */
  251. public $mapGeoCoding = 1;
  252. /**
  253. * Whether deleted contacts should be moved to trash instead
  254. * @var boolean
  255. */
  256. public $contactUndelete = true;
  257. /**
  258. * Whether database-level logging should be performed
  259. * @var boolean
  260. */
  261. public $logging = false;
  262. /**
  263. * Whether CiviCRM should check for newer versions
  264. *
  265. * @var boolean
  266. */
  267. public $versionCheck = true;
  268. /**
  269. * Array of enabled add-on components (e.g. CiviContribute, CiviMail...)
  270. *
  271. * @var array
  272. */
  273. public $enableComponents = array( 'CiviContribute','CiviPledge','CiviMember',
  274. 'CiviEvent', 'CiviMail', 'CiviReport' );
  275. public $enableComponentIDs = array( 1, 6, 2, 3, 4, 8 );
  276. /**
  277. * Should payments be accepted only via SSL?
  278. *
  279. * @var boolean
  280. */
  281. public $enableSSL = false;
  282. /**
  283. * error template to use for fatal errors
  284. *
  285. * @var string
  286. */
  287. public $fatalErrorTemplate = 'CRM/common/fatal.tpl';
  288. /**
  289. * fatal error handler
  290. *
  291. * @var string
  292. */
  293. public $fatalErrorHandler = null;
  294. /**
  295. * legacy encoding for file encoding conversion
  296. *
  297. * @var string
  298. */
  299. public $legacyEncoding = 'Windows-1252';
  300. /**
  301. * field separator for import/export csv file
  302. *
  303. * @var string
  304. */
  305. public $fieldSeparator = ',';
  306. /**
  307. * max location blocks in address
  308. *
  309. * @var integer
  310. */
  311. public $maxLocationBlocks = 2;
  312. /**
  313. * the font path where captcha fonts are stored
  314. *
  315. * @var string
  316. */
  317. public $captchaFontPath = '/usr/X11R6/lib/X11/fonts/';
  318. /**
  319. * the font to use for captcha
  320. *
  321. * @var string
  322. */
  323. public $captchaFont = 'HelveticaBold.ttf';
  324. /**
  325. * Some search settings
  326. */
  327. public $includeWildCardInName = 1;
  328. public $includeEmailInName = 1;
  329. public $includeNickNameInName = 0;
  330. public $smartGroupCacheTimeout = 0;
  331. public $defaultSearchProfileID = null;
  332. /**
  333. * Dashboard timeout
  334. */
  335. public $dashboardCacheTimeout = 1440;
  336. /**
  337. * flag to indicate if acl cache is NOT to be reset
  338. */
  339. public $doNotResetCache = 0;
  340. /**
  341. * Optimization related variables
  342. */
  343. public $includeAlphabeticalPager = 1;
  344. public $includeOrderByClause = 1;
  345. public $oldInputStyle = 1;
  346. /**
  347. * should we disbable key generation for forms
  348. *
  349. * @var boolean
  350. */
  351. public $formKeyDisable = false;
  352. /**
  353. * to determine wether the call is from cms or civicrm
  354. */
  355. public $inCiviCRM = false;
  356. /**
  357. * component registry object (of CRM_Core_Component type)
  358. */
  359. public $componentRegistry = null;
  360. /**
  361. * PDF reciept as attachment is disabled by default (CRM-8350)
  362. */
  363. public $doNotAttachPDFReceipt = false;
  364. /**
  365. * Provide addressSequence
  366. *
  367. * @param
  368. * @return string
  369. */
  370. public function addressSequence( ) {
  371. require_once 'CRM/Core/BAO/Preferences.php';
  372. return CRM_Core_BAO_Preferences::value( 'address_sequence' );
  373. }
  374. /**
  375. * Provide cached default currency symbol
  376. *
  377. * @param
  378. * @return string
  379. */
  380. public function defaultCurrencySymbol( $defaultCurrency = null ) {
  381. static $cachedSymbol = null;
  382. if ( ! $cachedSymbol || $defaultCurrency ) {
  383. if ( $this->defaultCurrency || $defaultCurrency ) {
  384. require_once "CRM/Core/PseudoConstant.php";
  385. $currencySymbolName = CRM_Core_PseudoConstant::currencySymbols( 'name' );
  386. $currencySymbol = CRM_Core_PseudoConstant::currencySymbols( );
  387. $this->currencySymbols = array_combine( $currencySymbolName, $currencySymbol );
  388. $currency = $defaultCurrency ? $defaultCurrency : $this->defaultCurrency;
  389. $cachedSymbol = CRM_Utils_Array::value( $currency, $this->currencySymbols, '');
  390. } else {
  391. $cachedSymbol = '$';
  392. }
  393. }
  394. return $cachedSymbol;
  395. }
  396. /**
  397. * Provide cached default currency symbol
  398. *
  399. * @param
  400. * @return string
  401. */
  402. public function defaultContactCountry( ) {
  403. static $cachedContactCountry = null;
  404. if ( ! empty ($this->defaultContactCountry) &&
  405. ! $cachedContactCountry ) {
  406. $countryIsoCodes = CRM_Core_PseudoConstant::countryIsoCode( );
  407. $cachedContactCountry = CRM_Utils_Array::value( $this->defaultContactCountry,
  408. $countryIsoCodes );
  409. }
  410. return $cachedContactCountry;
  411. }
  412. /**
  413. * Provide cached default country name
  414. *
  415. * @param
  416. * @return string
  417. */
  418. public function defaultContactCountryName( ) {
  419. static $cachedContactCountryName = null;
  420. if ( ! $cachedContactCountryName ) {
  421. $countryCodes = CRM_Core_PseudoConstant::country( );
  422. $cachedContactCountryName = $countryCodes[$this->defaultContactCountry];
  423. }
  424. return $cachedContactCountryName;
  425. }
  426. /**
  427. * Provide cached country limit translated to names
  428. *
  429. * @param
  430. * @return array
  431. */
  432. public function countryLimit( ) {
  433. static $cachedCountryLimit = null;
  434. if ( ! $cachedCountryLimit ) {
  435. $countryIsoCodes = CRM_Core_PseudoConstant::countryIsoCode( );
  436. $country = array();
  437. if ( is_array( $this->countryLimit ) ) {
  438. foreach( $this->countryLimit as $val ) {
  439. $country[] = $countryIsoCodes[$val];
  440. }
  441. } else {
  442. $country[] = $countryIsoCodes[$this->countryLimit];
  443. }
  444. $cachedCountryLimit = $country;
  445. }
  446. return $cachedCountryLimit;
  447. }
  448. /**
  449. * Provide cached province limit translated to names
  450. *
  451. * @param
  452. * @return array
  453. */
  454. public function provinceLimit( ) {
  455. static $cachedProvinceLimit = null;
  456. if ( ! $cachedProvinceLimit ) {
  457. $countryIsoCodes = CRM_Core_PseudoConstant::countryIsoCode( );
  458. $country = array();
  459. if ( is_array( $this->provinceLimit ) ) {
  460. foreach( $this->provinceLimit as $val ) {
  461. $country[] = $countryIsoCodes[$val];
  462. }
  463. } else {
  464. $country[] = $countryIsoCodes[$this->provinceLimit];
  465. }
  466. $cachedProvinceLimit = $country;
  467. }
  468. return $cachedProvinceLimit;
  469. }
  470. } // end CRM_Core_Config