![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/app/code/Kaliop/OutdatedBrowser/ViewModel/ |
<?php /** * Copyright (c) 2020 Kaliop Digital Commerce (https://digitalcommerce.kaliop.com) All Rights Reserved. * * @author Philippe Beauvais <[email protected]> * https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace Kaliop\OutdatedBrowser\ViewModel; use Magento\Store\Model\ScopeInterface; use Magento\Framework\App\Config\ScopeConfigInterface; use Kaliop\OutdatedBrowser\Model\Config; /** * Class Popin * * contain all functions to get popin datas */ class Popin implements \Magento\Framework\View\Element\Block\ArgumentInterface { /** * @var \Magento\Framework\App\Config\ScopeConfigInterface */ protected $scopeConfig; /** * Popin viewModel constructor. * * @param ScopeConfigInterface $scopeConfig */ public function __construct( ScopeConfigInterface $scopeConfig ) { $this->scopeConfig = $scopeConfig; } /** * Get navigator codes in array * * @return array */ public function getNavigatorCodes() { return Config::NAVIGATOR_CODE_LIST; } /** * Get navigator download url * * @param $navigatorCode * @param string $scopeType * @param null $scopeCode * @return mixed|null */ public function getNavigatorDownloadUrl($navigatorCode, $scopeType = ScopeInterface::SCOPE_STORE, $scopeCode = null) { try { $configPath = Config::XML_NAVIGATOR_DL_URL_PATH; $configPath = str_replace('{navigator}', $navigatorCode, $configPath); return $this->scopeConfig->getValue( $configPath, $scopeType, $scopeCode ); } catch (\Exception $e) { return null; } } /** * Get navigator text * * @param $navigatorCode * @param string $scopeType * @param null $scopeCode * @return mixed|null */ public function getNavigatorText($navigatorCode, $scopeType = ScopeInterface::SCOPE_STORE, $scopeCode = null) { try { $configPath = Config::XML_NAVIGATOR_TEXT_PATH; $configPath = str_replace('{navigator}', $navigatorCode, $configPath); return $this->scopeConfig->getValue( $configPath, $scopeType, $scopeCode ); } catch (\Exception $e) { return null; } } }