mambax7 /
adslight
| 1 | <?php declare(strict_types=1); |
||
| 2 | |||
| 3 | namespace XoopsModules\Adslight\Form; |
||
| 4 | |||
| 5 | /* |
||
| 6 | You may not change or alter any portion of this comment or credits |
||
| 7 | of supporting developers from this source code or any supporting source code |
||
| 8 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 9 | |||
| 10 | This program is distributed in the hope that it will be useful, |
||
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 13 | */ |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @author XOOPS Development Team <https://xoops.org> |
||
| 17 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||
| 18 | * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
||
| 19 | */ |
||
| 20 | |||
| 21 | use Xmf\Module\Helper\Permission; |
||
| 22 | use XoopsModules\Adslight\{ |
||
| 23 | Helper |
||
| 24 | }; |
||
| 25 | |||
| 26 | class GoogleMapForm extends \XoopsFormElementTray |
||
| 27 | { |
||
| 28 | private $apiKey; |
||
| 29 | private $latitude; |
||
| 30 | private $longitude; |
||
| 31 | private $zoom; |
||
| 32 | |||
| 33 | public function __construct($name, $apiKey, $latitude, $longitude, $zoom) |
||
| 34 | { |
||
| 35 | parent::__construct($name, '<br>'); |
||
| 36 | $this->apiKey = $apiKey; |
||
| 37 | $this->latitude = $latitude; |
||
| 38 | $this->longitude = $longitude; |
||
| 39 | $this->zoom = $zoom; |
||
| 40 | } |
||
| 41 | |||
| 42 | public function render() |
||
| 43 | { |
||
| 44 | if (empty($this->apiKey)) { |
||
| 45 | echo 'API Key is missing'; |
||
| 46 | exit(); |
||
|
0 ignored issues
–
show
|
|||
| 47 | } |
||
| 48 | |||
| 49 | $xoopsTpl = new \XoopsTpl(); |
||
| 50 | $xoopsTpl->assign('google_maps_api_key', $this->apiKey); |
||
| 51 | $xoopsTpl->assign('google_maps_latitude', $this->latitude); |
||
| 52 | $xoopsTpl->assign('google_maps_longitude', $this->longitude); |
||
| 53 | $xoopsTpl->assign('google_maps_zoom', $this->zoom); |
||
| 54 | $xoopsTpl->display('db:form_google_map.tpl'); |
||
| 55 | } |
||
| 56 | } |
||
| 57 |
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.