src/Controller/Widget/AbstractWidgetController.php line 110

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Widget;
  3. use App\Event\ModeEvent;
  4. use App\Manager\FavoritesManager;
  5. use App\Normalizer\DisruptionNormalizer;
  6. use App\Normalizer\LineNormalizer;
  7. use App\Normalizer\UserPreferencesNormalizer;
  8. use App\Service\Internal\DisruptionService;
  9. use App\Service\Internal\HomePageService;
  10. use App\Service\Internal\NetworkService;
  11. use App\Service\Internal\User\PreferenceService;
  12. use App\Service\Internal\WidgetService;
  13. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  14. use Symfony\Component\EventDispatcher\EventDispatcherInterface;
  15. use Symfony\Component\HttpFoundation\Request;
  16. use Symfony\Component\HttpFoundation\Response;
  17. use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
  18. use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
  19. class AbstractWidgetController extends AbstractController
  20. {
  21. public const WIDGET_CODE_JOURNEY_INTEGRATED = 'ITINERAIRE_INTEGRE';
  22. public const WIDGET_CODE_JOURNEY_REDIRECTION_SIM = 'ITINERAIRE_REDIRECTION_SIM';
  23. public const WIDGET_CODE_JOURNEY_REDIRECTION_SITE_SITE = 'ITINERAIRE_REDIRECTION_SITE_SITE';
  24. public const WIDGET_CODE_JOURNEY_REDIRECTION_PAGE_PAGE = 'ITINERAIRE_REDIRECTION_PAGE_PAGE';
  25. public const WIDGET_CODE_SCHEDULE_INTEGRATED = 'HORAIRE_INTEGRE';
  26. public const WIDGET_CODE_SCHEDULE_REDIRECTION_SIM = 'HORAIRE_REDIRECTION_SIM';
  27. public const WIDGET_CODE_SCHEDULE_REDIRECTION_SITE_SITE = 'HORAIRE_REDIRECTION_SITE_SITE';
  28. public const WIDGET_CODE_SCHEDULE_REDIRECTION_PAGE_PAGE = 'HORAIRE_REDIRECTION_PAGE_PAGE';
  29. public const WIDGET_CODE_TRAFFIC_INTEGRATED = 'TRAFIC_INTEGRE';
  30. public const WIDGET_CODE_FULL = 'FULL';
  31. public const WIDGET_CODE_FULL_EXCEPT_TRAFFIC = 'FULL_EXCEPT_TRAFFIC';
  32. public const WIDGET_CODE_FULL_EXCEPT_TRAFFIC_REDIRECTION_SIM = 'FULL_EXCEPT_TRAFFIC_REDIRECTION_SIM';
  33. public const WIDGET_CODE_LOGIN = 'LOGIN';
  34. public const WIDGET_CODE_JOURNEY_BOOKING = 'RESERVATION_TRAJET';
  35. public const WIDGET_CODE_BANNERS = 'BANNERS';
  36. public const WIDGET = 'WIDGET';
  37. public const WIDGET_BOOKING_SECUREBIKEPARK = 'RESERVATION_ABRI_VELO';
  38. public const WIDGET_WITHOUT_AUTHORIZATION = array(
  39. self::WIDGET_CODE_BANNERS,
  40. self::WIDGET_CODE_LOGIN,
  41. self::WIDGET_CODE_JOURNEY_BOOKING
  42. );
  43. protected NetworkService $networkService;
  44. protected PreferenceService $preferenceService;
  45. protected UserPreferencesNormalizer $userPreferencesNormalizer;
  46. protected string $baseUrl;
  47. protected string $locale;
  48. protected string$networkId;
  49. protected WidgetService $widgetService;
  50. protected EventDispatcherInterface $eventDispatcher;
  51. protected FavoritesManager $favoritesManager;
  52. protected DisruptionNormalizer $disruptionNormalizer;
  53. protected DisruptionService $disruptionService;
  54. protected HomePageService $homepageService;
  55. protected LineNormalizer$lineNormalizer;
  56. /**
  57. * WidgetController constructor.
  58. */
  59. public function __construct(
  60. NetworkService $networkService,
  61. PreferenceService $preferenceService,
  62. UserPreferencesNormalizer $userPreferencesNormalizer,
  63. WidgetService $widgetService,
  64. EventDispatcherInterface $eventDispatcher,
  65. FavoritesManager $favoritesManager,
  66. DisruptionNormalizer $disruptionNormalizer,
  67. DisruptionService $disruptionService,
  68. HomePageService $homepageService,
  69. LineNormalizer $lineNormalizer
  70. ) {
  71. $this->baseUrl = 'https://' . $_SERVER['SERVER_NAME'];
  72. $this->networkService = $networkService;
  73. $this->preferenceService = $preferenceService;
  74. $this->userPreferencesNormalizer = $userPreferencesNormalizer;
  75. $this->widgetService = $widgetService;
  76. $this->eventDispatcher = $eventDispatcher;
  77. $this->favoritesManager = $favoritesManager;
  78. $this->disruptionNormalizer = $disruptionNormalizer;
  79. $this->disruptionService = $disruptionService;
  80. $this->homepageService = $homepageService;
  81. $this->lineNormalizer = $lineNormalizer;
  82. }
  83. protected function initServices(Request $request)
  84. {
  85. $this->networkService->getNetwork();
  86. $this->networkId = $this->getParameter('network_id');
  87. $this->locale = $request->attributes->get('_locale');
  88. $layoutScheduleLine = $this->networkService->getLayoutScheduleLine();
  89. $session = $request->getSession();
  90. $session->set('layoutScheduleLine', $layoutScheduleLine);
  91. $isRedirection = $request->get('redirection');
  92. $isInternal = $request->get('internal');
  93. $target = $request->get('target');
  94. $isPartner = $request->get('partner');
  95. $widgetCode = $this->getWidgetCode($request, $isRedirection, $isInternal, $isPartner, $target);
  96. $domain = parse_url($request->headers->get('referer'), PHP_URL_HOST);
  97. if($domain &&
  98. $widgetCode &&
  99. !in_array($widgetCode,self::WIDGET_WITHOUT_AUTHORIZATION) &&
  100. $_SERVER['SERVER_NAME'] != $domain &&
  101. !$this->widgetService->isAuthorizedDomain($domain, $widgetCode)) {
  102. die('Unauthorized domain');
  103. }
  104. }
  105. /**
  106. * @param Request $request
  107. * @param bool $split
  108. *
  109. * @return array
  110. * @throws \Exception
  111. */
  112. protected function getFullWidgetsParameters(Request $request, bool $split = false)
  113. {
  114. $this->initServices($request);
  115. $isRedirection = $request->get('redirection');
  116. $isInternal = $request->get('internal');
  117. $target = $request->get('target');
  118. $isPartner = $request->get('partner');
  119. $islid = $request->get('islid');
  120. $isdir = $request->get('isdir');
  121. $issaid = $request->get('issaid');
  122. $issav = $request->get('issav');
  123. $islocid = $request->get('islocid');
  124. $except = $request->get('except');
  125. $isSubNetworks = $request->get('issubnetworks');
  126. $widgetCode = $this->getWidgetCode($request, $isRedirection, $isInternal, $isPartner, $target);
  127. $this->saveXHeaders($request, $widgetCode);
  128. if (empty($request->get('token'))) {
  129. throw new InvalidArgumentException("The token is missing");
  130. }
  131. $modeEvent = new ModeEvent();
  132. $this->eventDispatcher->dispatch($modeEvent, ModeEvent::NAME);
  133. $modes = $modeEvent->getDefaultModes();
  134. $modesLayout = $modeEvent->getLayoutModes();
  135. $nbDayFuture = $this->networkService->getNbDayFuture();
  136. $maxDate = new \DateTime('now');
  137. $maxDate = $maxDate->add(new \DateInterval('P'.$nbDayFuture.'D'));
  138. $itineraryOptions = $this->networkService->getItineraryOptions();
  139. $userPreferences = [];
  140. if ($this->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
  141. $userPreferences = $this->preferenceService->getUserPreferences();
  142. }
  143. $preferences = $this->userPreferencesNormalizer->normalize($userPreferences, ['itineraryOptions' => $itineraryOptions]);
  144. if ('traffic' !== $except) {
  145. $parameters = [];
  146. $parameters['issubnetworks'] = $isSubNetworks;
  147. $this->homepageService->getDisruption($parameters);
  148. }
  149. $scheduleFavorites = [];
  150. if ($this->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
  151. $scheduleFavorites = $this->favoritesManager->getSchedules([], true);
  152. }
  153. $parameters['scheduleFavorites'] = $scheduleFavorites ?? [];
  154. $parameters['lineFavorites'] = [];
  155. if ($this->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
  156. $parameters['lineFavorites'] = $this->favoritesManager->getLines([], true);
  157. }
  158. $parameters = array_merge($parameters, [
  159. 'isWidget' => true,
  160. 'requestReferer' => $request->headers->get('referer'),
  161. 'isSplit' => $split,
  162. 'default_latlon' => $this->networkService->getLatLon(),
  163. 'network_lat' => $this->networkService->getLat(),
  164. 'network_lon' => $this->networkService->getLon(),
  165. 'external' => $this->networkService->isExternalNetwork(),
  166. 'maxDate' => $maxDate->format('Y-d-m'),
  167. 'modes' => $modes,
  168. 'baseUrl' => $this->baseUrl,
  169. 'isRedirection' => !empty($isRedirection) && $isRedirection === 'true' ? true : false,
  170. 'isInternal' => !empty($isInternal) && $isInternal === 'true' ? true : false,
  171. 'widgetTarget' => !empty($target) ? $target : '',
  172. 'isPartner' => !empty($isPartner) && $isPartner === 'true' ? true : false,
  173. 'islid' => !empty($islid) ? $islid : '',
  174. 'isdir' => !empty($isdir) ? $isdir : '',
  175. 'issaid' => !empty($issaid) ? $issaid : '',
  176. 'issav' => !empty($issav) ? $issav : '',
  177. 'islocid' => !empty($islocid) ? $islocid : '',
  178. 'issubnetworks' => !empty($isSubNetworks) ? $isSubNetworks : '',
  179. 'preferences' => $preferences,
  180. ]);
  181. $parameters = array_merge($parameters, $this->getFullCustomMapParameters($request));
  182. $configTemplate = $this->render("includes/common/js-config.html.twig", $parameters )->getContent();
  183. $parameters = array_merge($parameters, [
  184. 'isWidget' => true,
  185. 'widgetCode' => $widgetCode,
  186. 'default_latlon' => $this->networkService->getLatLon(),
  187. 'isRedirection' => !empty($isRedirection) && $isRedirection === 'true' ? true : false,
  188. 'isInternal' => !empty($isInternal) && $isInternal === 'true' ? true : false,
  189. 'modes' => $modes,
  190. 'modesLayout' => $modesLayout,
  191. 'preferences' => $preferences,
  192. ]);
  193. $widgetScript = $this->getWidgetScript($request);
  194. $widgetCss = $this->getWidgetCss($request);
  195. $hasMap = $this->hasMap($request);
  196. return [
  197. 'baseUrl' => $this->baseUrl,
  198. 'newtorkId' => $this->networkId,
  199. 'config' => $configTemplate,
  200. 'widgetScript' => $widgetScript,
  201. 'widgetCss' => $widgetCss,
  202. 'hasMap' => $hasMap,
  203. 'parameters' => $parameters,
  204. ];
  205. }
  206. /**
  207. * Get name for the widget minified script
  208. */
  209. protected function getWidgetScript(Request $request): string
  210. {
  211. switch ($request->getPathInfo()) {
  212. case '/'. $this->locale .'/widget/place-journey':
  213. $widgetScript = 'place-journey-widget.min.js';
  214. break;
  215. case '/'. $this->locale .'/widget/place':
  216. $widgetScript = 'place-widget.min.js';
  217. break;
  218. case '/'. $this->locale .'/widget/schedule':
  219. $widgetScript = 'schedule-widget.min.js';
  220. break;
  221. case '/'. $this->locale .'/widget/place-journey-map':
  222. $widgetScript = 'place-journey-map-widget.min.js';
  223. break;
  224. case '/'. $this->locale .'/widget/schedule-map':
  225. $widgetScript = 'schedule-map-widget.min.js';
  226. break;
  227. case '/'. $this->locale .'/widget/traffic':
  228. $widgetScript = 'traffic-widget.min.js';
  229. break;
  230. case '/'.$this->locale . '/widget/full':
  231. case '/'.$this->locale . '/widget/full-split':
  232. case '/'.$this->locale . '/widget/banners':
  233. $widgetScript = 'search-widget.min.js';
  234. break;
  235. case '/'.$this->locale . '/widget/login':
  236. $widgetScript = 'login-widget.min.js';
  237. break;
  238. case '/'.$this->locale . '/widget/journey-booking':
  239. $widgetScript = 'journey-booking-widget.min.js';
  240. break;
  241. default:
  242. throw new NotFoundHttpException('Wrong widget');
  243. break;
  244. }
  245. return $widgetScript;
  246. }
  247. /**
  248. * Get name for the widget minified css
  249. */
  250. protected function getWidgetCss(Request $request): string
  251. {
  252. switch ($request->getPathInfo()) {
  253. case '/'. $this->locale .'/widget/place-journey':
  254. $widgetCss = 'widget-journey.min.css';
  255. break;
  256. case '/'. $this->locale .'/widget/place':
  257. $widgetCss = 'widget-journey.min.css';
  258. break;
  259. case '/'. $this->locale .'/widget/schedule':
  260. $widgetCss = 'widget-schedule.min.css';
  261. break;
  262. case '/'. $this->locale .'/widget/place-journey-map':
  263. $widgetCss = 'widget-journey.min.css';
  264. break;
  265. case '/'. $this->locale .'/widget/schedule-map':
  266. $widgetCss = 'widget-schedule.min.css';
  267. break;
  268. case '/'. $this->locale .'/widget/traffic':
  269. $widgetCss = 'widget-traffic.min.css';
  270. break;
  271. case '/'.$this->locale . '/widget/full':
  272. case '/'.$this->locale . '/widget/full-split':
  273. case '/'.$this->locale . '/widget/banners':
  274. case '/'.$this->locale . '/widget/login':
  275. case '/'.$this->locale . '/widget/journey-booking':
  276. $widgetCss = 'widget-full.min.css';
  277. break;
  278. default:
  279. throw new NotFoundHttpException('Wrong widget');
  280. break;
  281. }
  282. return $widgetCss;
  283. }
  284. /**
  285. * Get rtl css for the widget
  286. */
  287. protected function getRtlCss(): ?string
  288. {
  289. switch ($this->locale) {
  290. case 'ar':
  291. $rtlCss = 'sim-rtl.min.css';
  292. break;
  293. default:
  294. $rtlCss = null;
  295. break;
  296. }
  297. return $rtlCss;
  298. }
  299. /**
  300. * Check if the widget require the map
  301. */
  302. protected function hasMap(Request $request): bool
  303. {
  304. switch ($request->getPathInfo()) {
  305. case '/'. $this->locale .'/widget/place-journey':
  306. case '/'. $this->locale .'/widget/place':
  307. case '/'. $this->locale .'/widget/schedule':
  308. case '/'. $this->locale .'/widget/traffic':
  309. case '/'. $this->locale .'/widget/banners':
  310. case '/'. $this->locale .'/widget/login':
  311. case '/'. $this->locale .'/widget/journey-booking':
  312. return false;
  313. break;
  314. case '/'. $this->locale .'/widget/place-journey-map':
  315. case '/'. $this->locale .'/widget/schedule-map':
  316. case '/'. $this->locale .'/widget/full':
  317. return true;
  318. break;
  319. case '/'. $this->locale .'/widget/full-split':
  320. return true;
  321. break;
  322. default:
  323. throw new NotFoundHttpException('Wrong widget');
  324. break;
  325. }
  326. }
  327. /**
  328. * Build headers for tracking and security
  329. */
  330. protected function saveXHeaders(Request $request, string $widgetCode)
  331. {
  332. $token = $request->get('token');
  333. $session = $request->getSession();
  334. $request->attributes->set('widgetContext', 'true');
  335. $session->set('context', self::WIDGET);
  336. $session->set('xHeaders', []);
  337. $xHeaders = $session->get('xHeaders');
  338. if (!empty($request) && !empty($request->get('token') && get_class($request) === Request::class)
  339. ) {
  340. $token = 'IS_WIDGET:' . $this->networkId . ':'. $widgetCode . ':' . $token;
  341. $session->set('token', $token);
  342. if (!is_null($request->query->get('token'))) $xHeaders['x-widget-id'] = $token;
  343. if (!is_null($request->headers->get('referer'))) $xHeaders['x-referer'] = $request->headers->get('referer');
  344. if (!is_null($request->headers->get('referer'))) $xHeaders['x-origin'] = $request->headers->get('referer');
  345. $session->set('xHeaders', $xHeaders);
  346. }
  347. }
  348. /**
  349. * Get widget code for tracking and security
  350. */
  351. protected function getWidgetCode(Request $request, $isRedirection, $isInternal, $isPartner, $target): string
  352. {
  353. $isRedirection = $isRedirection === 'true'? true: false;
  354. $isInternal = $isInternal === 'true'? true: false;
  355. $locale = $request->getLocale();
  356. $params = $request->query->all();
  357. switch ($request->getPathInfo()) {
  358. case '/'. $locale .'/widget/place-journey':
  359. case '/'. $locale .'/widget/place-journey-map':
  360. if (!$isRedirection && $isInternal) {
  361. $widgetCode = self::WIDGET_CODE_JOURNEY_REDIRECTION_PAGE_PAGE;
  362. } else {
  363. $widgetCode = self::WIDGET_CODE_JOURNEY_INTEGRATED;
  364. }
  365. break;
  366. case '/'. $locale .'/widget/place':
  367. if ($isRedirection && !$isInternal && !$isPartner && !$target) {
  368. $widgetCode = self::WIDGET_CODE_JOURNEY_REDIRECTION_SIM;
  369. } elseif ($isRedirection && !$isInternal && $isPartner && $target ) {
  370. $widgetCode = self::WIDGET_CODE_JOURNEY_REDIRECTION_SITE_SITE;
  371. } elseif ($isRedirection && $isInternal && $target ) {
  372. $widgetCode = self::WIDGET_CODE_JOURNEY_REDIRECTION_PAGE_PAGE;
  373. } else {
  374. $widgetCode = self::WIDGET_CODE_JOURNEY_INTEGRATED;
  375. }
  376. break;
  377. case '/'. $locale .'/widget/schedule':
  378. case '/'. $locale .'/widget/schedule-map':
  379. if ($isRedirection && !$isInternal && !$isPartner && !$target) {
  380. $widgetCode = self::WIDGET_CODE_SCHEDULE_REDIRECTION_SIM;
  381. } elseif ($isRedirection && !$isInternal && $isPartner && $target ) {
  382. $widgetCode = self::WIDGET_CODE_SCHEDULE_REDIRECTION_SITE_SITE;
  383. } elseif ($isRedirection && $isInternal && $target ) {
  384. $widgetCode = self::WIDGET_CODE_SCHEDULE_REDIRECTION_PAGE_PAGE;
  385. } else {
  386. $widgetCode = self::WIDGET_CODE_SCHEDULE_INTEGRATED;
  387. }
  388. break;
  389. case '/'. $locale .'/widget/traffic':
  390. $widgetCode = self::WIDGET_CODE_TRAFFIC_INTEGRATED;
  391. break;
  392. case '/'. $locale .'/widget/full':
  393. $widgetCode = self::WIDGET_CODE_FULL;
  394. if (isset($params['except']) && 'traffic' === $params['except']) {
  395. $widgetCode = self::WIDGET_CODE_FULL_EXCEPT_TRAFFIC;
  396. } elseif (isset($params['except']) && 'traffic' === $params['except'] && $isRedirection && $isInternal) {
  397. $widgetCode = self::WIDGET_CODE_FULL_EXCEPT_TRAFFIC_REDIRECTION_SIM;
  398. }
  399. break;
  400. case '/'. $locale .'/widget/full-split':
  401. $widgetCode = self::WIDGET_CODE_FULL;
  402. break;
  403. case '/'. $locale .'/widget/banners':
  404. $widgetCode = self::WIDGET_CODE_BANNERS;
  405. break;
  406. case '/'. $locale .'/widget/login':
  407. $widgetCode = self::WIDGET_CODE_LOGIN;
  408. break;
  409. case '/'. $locale .'/widget/journey-booking':
  410. $widgetCode = self::WIDGET_CODE_JOURNEY_BOOKING;
  411. break;
  412. case '/' . $locale . '/widget/booking/securebikepark/create':
  413. $widgetCode = self::WIDGET_BOOKING_SECUREBIKEPARK;
  414. break;
  415. default:
  416. $widgetCode = '';
  417. break;
  418. }
  419. return $widgetCode;
  420. }
  421. /**
  422. * Get disruptions
  423. */
  424. protected function getDisruptions(Request $request)
  425. {
  426. $disruptionLayout = $this->networkService->getDisruptionLayout();
  427. $currentSubNetworksDisruptions = 0;
  428. $futureSubNetworksDisruptions = 0;
  429. $isSubNetworks = $request->get('issubnetworks');
  430. $linesDisruptions = $this->disruptionService->getLinesDisruptions($isSubNetworks);
  431. $parameters['linesDisruptions'] = isset($linesDisruptions) ? $this->disruptionNormalizer->normalize($linesDisruptions) : [];
  432. $disruptions = $this->disruptionService->getDisruptions($isSubNetworks);
  433. $parameters['disruptions'] = isset($disruptions) ? $this->disruptionNormalizer->normalize($disruptions) : [];
  434. $withDisruptionOnly = null;
  435. if (in_array("FAV_WITH_DISRUPTIONS_BOARDS_LINES", $disruptionLayout)) {
  436. $withDisruptionOnly = 0;
  437. } elseif (in_array("FAV_WITH_DISRUPTIONS_BOARDS_LINES_WITHDISRUPTIONSONLY", $disruptionLayout)) {
  438. $withDisruptionOnly = 1;
  439. }
  440. $this->homepageService->getDisruption($parameters);
  441. $parameters['disruptions'] = isset($boardsLinesDisruptions['disruptions']) ? $this->disruptionNormalizer->normalize($boardsLinesDisruptions['disruptions']) : [];
  442. $boardsLinesDisruptions['lines'] = isset($boardsLinesDisruptions['lines']) ? $this->lineNormalizer->normalize($boardsLinesDisruptions['lines'], ['lineDisruptions' => $boardsLinesDisruptions['disruptions'] ?? []]) : [];
  443. $parameters['boardsLinesDisruptions'] = $boardsLinesDisruptions;
  444. $parameters['trafficMini'] = $request->get('trafficMini');
  445. $parameters['currentSubNetworksDisruptions'] = $currentSubNetworksDisruptions;
  446. $parameters['futureSubNetworksDisruptions'] = $futureSubNetworksDisruptions;
  447. return $parameters;
  448. }
  449. /**
  450. * Entry point for some widget
  451. */
  452. public function init(Request $request): Response
  453. {
  454. $remove = $request->get('remove');
  455. $handledKeys = ['css'];
  456. $widgetParams = [];
  457. if($remove !== null){
  458. if(is_array($remove)){
  459. foreach ($remove as $key){
  460. if(in_array($key, $handledKeys)){
  461. $widgetParams[$key] = false;
  462. }
  463. }
  464. }
  465. else {
  466. if(in_array($remove, $handledKeys)){
  467. $widgetParams[$remove] = false;
  468. }
  469. }
  470. }
  471. $configTemplate = $this
  472. ->renderView('includes/common/js-config.html.twig', [
  473. 'baseUrl' => $this->baseUrl,
  474. 'widgetParams' => $widgetParams
  475. ]);
  476. $configTemplate = preg_replace("/[\n\r\t]+ [\s]{2,}/", '', $configTemplate);
  477. $jsContent = file_get_contents($this->getParameter('kernel.project_dir') . '/public/js/widget.min.js');
  478. return new Response($configTemplate . $jsContent, 200, ['Content-Type' => 'text/javascript']);
  479. }
  480. protected function getFullCustomMapParameters(Request $request): array
  481. {
  482. $customMapParameters = [];
  483. $iszoom = $request->get('iszoom');
  484. if(!empty($iszoom) && is_numeric($iszoom)) {
  485. $customMapParameters['customZoom'] = $iszoom;
  486. }
  487. $islat = $request->get('islat');
  488. $islon = $request->get('islon');
  489. if(!empty($islat) && is_numeric($islat) && !empty($islon) && is_numeric($islon)) {
  490. $customMapParameters['islat'] = $islat;
  491. $customMapParameters['islon'] = $islon;
  492. $customMapParameters['customLatLon'] = '[' . $islat . ', ' . $islon . ']';
  493. }
  494. return $customMapParameters;
  495. }
  496. }