Merge pull request #14928 from lcdservices/dev-core-1158
[civicrm-core.git] / CRM / Core / Smarty / plugins / function.crmVersion.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
10 */
11
12 /**
13 *
14 * @package CRM
15 * @copyright TTTP
16 * $Id$
17 *
18 */
19
20 /**
21 * Display the CiviCRM version
22 *
23 * @code
24 * The version is {crmVersion}.
25 *
26 * {crmVersion redact=auto assign=ver}The version is {$ver}.
27 * @endcode
28 *
29 * @param $params
30 * @param $smarty
31 *
32 * @return string
33 */
34 function smarty_function_crmVersion($params, &$smarty) {
35 $version = CRM_Utils_System::version();
36
37 if (!CRM_Core_Permission::check('access CiviCRM')) {
38 $version = CRM_Utils_System::majorVersion();
39 }
40
41 if (isset($params['assign'])) {
42 $smarty->assign($params['assign'], $version);
43 }
44 else {
45 return $version;
46 }
47 }