employees.php
3 days ago
index.html
3 days ago
locations.php
3 days ago
locwdays.php
3 days ago
options.php
3 days ago
packages.php
3 days ago
payments.php
3 days ago
services.php
3 days ago
subscriptions.php
3 days ago
syspack.php
3 days ago
syssubscr.php
3 days ago
system.php
3 days ago
taxes.php
3 days ago
system.php
127 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package VikAppointments |
| 4 | * @subpackage core |
| 5 | * @author E4J s.r.l. |
| 6 | * @copyright Copyright (C) 2021 E4J s.r.l. All Rights Reserved. |
| 7 | * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL |
| 8 | * @link https://vikwp.com |
| 9 | */ |
| 10 | |
| 11 | // No direct access |
| 12 | defined('ABSPATH') or die('No script kiddies please!'); |
| 13 | |
| 14 | /** |
| 15 | * Implement the wizard step used to setup the basic |
| 16 | * settings of the global configuration. |
| 17 | * |
| 18 | * @since 1.7.1 |
| 19 | */ |
| 20 | class VAPWizardStepSystem extends VAPWizardStep |
| 21 | { |
| 22 | /** |
| 23 | * Returns the step title. |
| 24 | * Used as a very-short description. |
| 25 | * |
| 26 | * @return string The step title. |
| 27 | */ |
| 28 | public function getTitle() |
| 29 | { |
| 30 | return JText::translate('VAPMENUCONFIG'); |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Returns an optional step icon. |
| 35 | * |
| 36 | * @return string The step icon. |
| 37 | */ |
| 38 | public function getIcon() |
| 39 | { |
| 40 | return '<i class="fas fa-cog"></i>'; |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Return the group to which the step belongs. |
| 45 | * |
| 46 | * @return string The group name. |
| 47 | */ |
| 48 | public function getGroup() |
| 49 | { |
| 50 | // belongs to GLOBAL group |
| 51 | return JText::translate('VAPMENUTITLEHEADER3'); |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Implements the step execution. |
| 56 | * |
| 57 | * @param JRegistry $data The request data. |
| 58 | * |
| 59 | * @return boolean |
| 60 | */ |
| 61 | protected function doExecute($data) |
| 62 | { |
| 63 | $config = VAPFactory::getConfig(); |
| 64 | |
| 65 | if ($currency = $data->get('currency')) |
| 66 | { |
| 67 | // get supported currencies |
| 68 | $map = $this->getCurrencies(); |
| 69 | |
| 70 | // make sure the currency exists |
| 71 | if (!isset($map[$currency])) |
| 72 | { |
| 73 | return false; |
| 74 | } |
| 75 | |
| 76 | $format = $map[$currency]; |
| 77 | |
| 78 | // set currency parameters |
| 79 | $config->set('currencyname', $currency); |
| 80 | $config->set('currencysymb', $format['symbol']); |
| 81 | $config->set('currsymbpos', $format['position']); |
| 82 | $config->set('currdecimaldig', (int) $format['decimals']); |
| 83 | $config->set('currthousandssep', $format['separator'] == '.' ? ',' : '.'); |
| 84 | $config->set('currdecimalsep', $format['separator']); |
| 85 | } |
| 86 | else |
| 87 | { |
| 88 | // set specified custom currency |
| 89 | $config->set('currencyname', $data->get('currencyname')); |
| 90 | $config->set('currencysymb', $data->get('currencysymb')); |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * Prevented XSS attack by sanitizing the company name and e-mail. |
| 95 | * |
| 96 | * @since 1.7.8 |
| 97 | */ |
| 98 | $config->set('agencyname', JComponentHelper::filterText($data->get('agencyname', ''))); |
| 99 | $config->set('adminemail', JComponentHelper::filterText($data->get('adminemail', ''))); |
| 100 | |
| 101 | if (!$config->get('senderemail')) |
| 102 | { |
| 103 | // set sender equals to admin e-mail if empty |
| 104 | $config->set('senderemail', $config->get('adminemail')); |
| 105 | } |
| 106 | |
| 107 | // set date/time format |
| 108 | $config->set('dateformat', $data->get('dateformat')); |
| 109 | $config->set('timeformat', $data->get('timeformat') ? 'H:i' : 'h:i A'); |
| 110 | |
| 111 | return true; |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * Returns an associative array containing the most common currencies |
| 116 | * and the related formatting information. |
| 117 | * |
| 118 | * @return array |
| 119 | * |
| 120 | * @deprecated 1.9 Use VAPCurrencyHelperEnum::getCurrencies() instead. |
| 121 | */ |
| 122 | public function getCurrencies() |
| 123 | { |
| 124 | return VAPCurrencyHelperEnum::getCurrencies(); |
| 125 | } |
| 126 | } |
| 127 |