Encodes manufacturer category URLs into SEO format

@param \OxidEsales\Eshop\Application\Model\Manufacturer $oManufacturer Manufacturer object
@param int                                              $iLang         language

@return string
777072
public function getManufacturerUrl($oManufacturer, $iLang = null)
    {
        if (!isset($iLang)) {
            $iLang = $oManufacturer->getLanguage();
        }

        return $this->_getFullUrl($this->getManufacturerUri($oManufacturer, $iLang), $iLang);
    }
1283634
public function getStdLink($iLang = null, $aParams = [])
    {
        if ($iLang === null) {
            $iLang = $this->getLanguage();
        }

        if (!isset($this->_aStdUrls[$iLang])) {
            $this->_aStdUrls[$iLang] = $this->getBaseStdLink($iLang);
        }

        return \OxidEsales\Eshop\Core\Registry::getUtilsUrl()->processUrl($this->_aStdUrls[$iLang], true, $aParams, $iLang);
    }
144925
private function getProductSavedPositions(Category $category)
    {
        $productPositions = [];

        if ($category->getId()) {
            $productPositions = $this->productPositionResource->getProductPositionsByCategory($category);
        }

        return json_encode($productPositions, JSON_FORCE_OBJECT);
    }
759325
public function save(ManufacturerInterface $manufacturer): ManufacturerInterface
    {
        $data = $this->serializer()->serialize($manufacturer);

        if ($manufacturer->getId() !== 0) {
            $this->shopware()
                 ->put('/api/manufacturers/'.(string)$manufacturer->getId(), [], $data);
        } else {
            $response = $this->shopware()->post('/api/manufacturers', [], $data);
            $data     = json_decode((string)$response->getBody(), true);
            $manufacturer->setId((int)$data['data']['id']);
        }

        return $manufacturer;
    }
1030602
protected function _trimUrl($sUrl, $iLang = null)
    {
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
        $oStr = getStr();
        $sUrl = str_replace([$myConfig->getShopUrl($iLang, false), $myConfig->getSslShopUrl($iLang)], '', $sUrl);
        $sUrl = $oStr->preg_replace('/(\?|&(amp;)?)(force_)?(admin_)?sid=[a-z0-9\.]+&?(amp;)?/i', '\1', $sUrl);
        $sUrl = $oStr->preg_replace('/(\?|&(amp;)?)shp=[0-9]+&?(amp;)?/i', '\1', $sUrl);
        $sUrl = $oStr->preg_replace('/(\?|&(amp;)?)lang=[0-9]+&?(amp;)?/i', '\1', $sUrl);
        $sUrl = $oStr->preg_replace('/(\?|&(amp;)?)cur=[0-9]+&?(amp;)?/i', '\1', $sUrl);
        $sUrl = $oStr->preg_replace('/(\?|&(amp;)?)stoken=[a-z0-9]+&?(amp;)?/i', '\1', $sUrl);
        $sUrl = $oStr->preg_replace('/(\?|&(amp;)?)&(amp;)?/i', '\1', $sUrl);
        $sUrl = $oStr->preg_replace('/(\?|&(amp;)?)+$/i', '', $sUrl);
        $sUrl = trim($sUrl);

        // max length <= $this->_iMaxUrlLength
        $iLength = $this->_getMaxUrlLength();
        if ($oStr->strlen($sUrl) > $iLength) {
            $sUrl = $oStr->substr($sUrl, 0, $iLength);
        }

        return $sUrl;
    }
767555
protected function _loadManufacturerTree($sActManufacturer)
    {
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
        if ($myConfig->getConfigParam('bl_perfLoadManufacturerTree')) {
            $oManufacturerTree = $this->getManufacturerList();
            $shopHomeURL = $myConfig->getShopHomeUrl();
            $oManufacturerTree->buildManufacturerTree('manufacturerlist', $sActManufacturer, $shopHomeURL);

            $oParentView = $this->getParent();

            // setting active Manufacturer list
            $oParentView->setManufacturerTree($oManufacturerTree);
            $this->setManufacturerTree($oManufacturerTree);

            // setting active Manufacturer
            if (($oManufacturer = $oManufacturerTree->getClickManufacturer())) {
                $oParentView->setActManufacturer($oManufacturer);
            }
        }
    }
849361
public Manufacturer updateManufacturer(Long id, Manufacturer manufacturer) {
        manufacturer.setId(id);
        return manufacturerRepository.createOrUpdate(manufacturer);
    }
594950
public static function GetActiveManufacturer()
    {
        static $oActiveManufacturer = 'x';
        if ('x' === $oActiveManufacturer) {
            $oActiveManufacturer = null;
            $oGlobal = TGlobal::instance();
            $iManufacturerId = $oGlobal->GetUserData(MTShopManufacturerArticleCatalogCore::URL_MANUFACTURER_ID);
            if (empty($iManufacturerId)) {
                $oItem = self::getShopService()->getActiveProduct();
                if (null !== $oItem) {
                    $oActiveManufacturer = $oItem->GetFieldShopManufacturer();
                }
            } else {
                $oActiveManufacturer = TdbShopManufacturer::GetNewInstance();
                if (!$oActiveManufacturer->Load($iManufacturerId)) {
                    $oActiveManufacturer = null;
                }
            }
        }

        return $oActiveManufacturer;
    }
288218
public function getStdLink($iLang = null, $aParams = [])
    {
        if ($iLang === null) {
            $iLang = \OxidEsales\Eshop\Core\Registry::getLang()->getBaseLanguage();
        }

        return \OxidEsales\Eshop\Core\Registry::getUtilsUrl()->processUrl($this->getBaseStdLink($iLang), true, $aParams, $iLang);
    }
1171751
public function getBaseSeoLink($iLang)
    {
        return \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\SeoEncoderArticle::class)->getArticleUrl($this, $iLang, $iLinkType);
    }
1058387
public function getBaseStdLink($iLang, $blAddId = true, $blFull = true)
    {
        if (!isset($this->_aBaseStdUrls[$iLang][$iLinkType])) {
            $oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
            $oArticle->setId($this->getId());
            $oArticle->setLinkType($iLinkType);
            $this->_aBaseStdUrls[$iLang][$iLinkType] = $oArticle->getBaseStdLink($iLang, $blAddId, $blFull);
        }

        return $this->_aBaseStdUrls[$iLang][$iLinkType];
    }
739193
public function encodeStaticUrls($aStaticUrl, $iShopId, $iLang)
    {
        $db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $sValues = '';
        $sOldObjectId = null;

        // standard url
        $sStdUrl = $this->_trimUrl(trim($aStaticUrl['oxseo__oxstdurl']));
        $sObjectId = $aStaticUrl['oxseo__oxobjectid'];

        if (!$sObjectId || $sObjectId == '-1') {
            $sObjectId = $this->_getStaticObjectId($iShopId, $sStdUrl);
        } else {
            // marking entry as needs to move to history
            $sOldObjectId = $sObjectId;

            // if std url does not match old
            if ($this->_getStaticObjectId($iShopId, $sStdUrl) != $sObjectId) {
                $sObjectId = $this->_getStaticObjectId($iShopId, $sStdUrl);
            }
        }

        foreach ($aStaticUrl['oxseo__oxseourl'] as $iLang => $sSeoUrl) {
            $iLang = (int) $iLang;

            // generating seo url
            $sSeoUrl = $this->_trimUrl($sSeoUrl);
            if ($sSeoUrl) {
                $sSeoUrl = $this->_processSeoUrl($sSeoUrl, $sObjectId, $iLang);
            }

            if ($sOldObjectId) {
                // Transaction picks master automatically (see ESDEV-3804 and ESDEV-3822).
                $db->startTransaction();
                try {
                    // move changed records to history
                    if (!$db->getOne("select (" . $db->quote($sSeoUrl) . " like oxseourl) & (" . $db->quote($sStdUrl) . " like oxstdurl) from oxseo where oxobjectid = " . $db->quote($sOldObjectId) . " and oxshopid = '{$iShopId}' and oxlang = '{$iLang}' ")) {
                        $this->_copyToHistory($sOldObjectId, $iShopId, $iLang, 'static', $sObjectId);
                    }

                    $db->commitTransaction();
                } catch (Exception $exception) {
                    $db->rollbackTransaction();

                    throw $exception;
                }
            }

            if (!$sSeoUrl || !$sStdUrl) {
                continue;
            }

            $sIdent = $this->_getSeoIdent($sSeoUrl);

            if ($sValues) {
                $sValues .= ', ';
            }

            $sValues .= "( " . $db->quote($sObjectId) . ", " . $db->quote($sIdent) . ", " . $db->quote($iShopId) . ", '{$iLang}', " . $db->quote($sStdUrl) . ", " . $db->quote($sSeoUrl) . ", 'static' )";
        }

        // must delete old before insert/update
        if ($sOldObjectId) {
            $this->executeDatabaseQuery("delete from oxseo where oxobjectid in ( " . $db->quote($sOldObjectId) . ", " . $db->quote($sObjectId) . " )");
        }

        // (re)inserting
        if ($sValues) {
            $sql = "insert into oxseo ( oxobjectid, oxident, oxshopid, oxlang, oxstdurl, oxseourl, oxtype ) values {$sValues} ";
            $this->executeDatabaseQuery($sql);
        }

        return $sObjectId;
    }
539304
public function getManufacturerList()
    {
        $oManufacturerList = oxNew(\OxidEsales\Eshop\Application\Model\ManufacturerList::class);
        $oManufacturerList->loadManufacturerList();

        return $oManufacturerList;
    }
947332
private function getManufacturerList(TdbShopManufacturerList $oManufacturerList)
    {
        $navigationKeyList = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0-9');
        $manufacturerList = array();

        foreach ($navigationKeyList as $sNavigationItem) {
            $manufacturerList[$sNavigationItem] = array(
                'sTitle' => $sNavigationItem,
                'bShowMinimizer' => true,
                'aItemList' => array(),
            );
        }

        while ($manufacturer = $oManufacturerList->Next()) {
            $manufacturerName = $manufacturer->GetName();
            $normalizedManufacturerName = $this->urlNormalizationUtil->normalizeUrl($manufacturerName);
            $firstLetter = strtoupper(mb_substr($normalizedManufacturerName, 0, 1));

            $aItem = array();
            $aItem['sLink'] = $manufacturer->GetLinkProducts();
            $aItem['sTitle'] = $manufacturerName;

            $key = $firstLetter;
            if (is_numeric($firstLetter)) {
                $key = '0-9';
            }

            $manufacturerList[$key]['aItemList'][] = $aItem;
        }

        $oManufacturerList->GoToStart();

        return $manufacturerList;
    }
674421
private function getCompany(LoggerInterface $logger, array $data, string $useragent, string $field): CompanyInterface
    {
        $companyLoader = $this->companyLoader;
        $manufacturer  = $companyLoader->load('unknown', $useragent);

        if (!array_key_exists($field, $data)) {
            return $manufacturer;
        }

        try {
            $manufacturer = $companyLoader->load($data[$field], $useragent);
        } catch (NotFoundException $e) {
            $logger->info($e);
        }

        return $manufacturer;
    }
1285500
public static function &GetListForShopKeywords($iShopId, $aKeywordList, $iLanguageId = null)
    {
        if (null === $iLanguageId) {
            $iLanguageId = self::getMyLanguageService()->getActiveLanguageId();
        }
        $aKeywordList = TTools::MysqlRealEscapeArray($aKeywordList);
        $query = self::GetDefaultQuery($iLanguageId, "`shop_search_keyword_article`.`shop_id`= '".MySqlLegacySupport::getInstance()->real_escape_string($iShopId)."' AND `shop_search_keyword_article`.`name` IN ('".implode("','", $aKeywordList)."') AND (`shop_search_keyword_article`.`cms_language_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($iLanguageId)."' OR `shop_search_keyword_article`.`cms_language_id` = '') ");

        return TdbShopSearchKeywordArticleList::GetList($query, $iLanguageId);
    }
851032
protected function _getLangFilesPathArray($iLang)
    {
        $oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
        $aLangFiles = [];

        $sAppDir = $oConfig->getAppDir();
        $sLang = \OxidEsales\Eshop\Core\Registry::getLang()->getLanguageAbbr($iLang);
        $sTheme = $oConfig->getConfigParam("sTheme");
        $aModulePaths = $this->_getActiveModuleInfo();

        //get generic lang files
        $sGenericPath = $sAppDir . 'translations/' . $sLang;
        if ($sGenericPath) {
            $aLangFiles[] = $sGenericPath . "/lang.php";
            $aLangFiles = $this->_appendLangFile($aLangFiles, $sGenericPath);
        }

        //get theme lang files
        if ($sTheme) {
            $sThemePath = $sAppDir . 'views/' . $sTheme . '/' . $sLang;
            $aLangFiles[] = $sThemePath . "/lang.php";
            $aLangFiles = $this->_appendLangFile($aLangFiles, $sThemePath);
        }

        $aLangFiles = array_merge($aLangFiles, $this->getCustomThemeLanguageFiles($iLang));

        // modules language files
        $aLangFiles = $this->_appendModuleLangFiles($aLangFiles, $aModulePaths, $sLang);

        // custom language files
        $aLangFiles = $this->_appendCustomLangFiles($aLangFiles, $sLang);

        return count($aLangFiles) ? $aLangFiles : false;
    }