Returns alternative uri used while updating seo

@param string $sObjectId object id
@param int    $iLang     language id

@return string
197796
protected function _getAltUri($sObjectId, $iLang)
    {
        $sSeoUrl = null;
        $oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
        $oArticle->setSkipAssign(true);
        if ($oArticle->loadInLang($iLang, $sObjectId)) {
            // choosing URI type to generate
            switch ($this->_getListType()) {
                case 'vendor':
                    $sSeoUrl = $this->getArticleVendorUri($oArticle, $iLang, true);
                    break;
                case 'manufacturer':
                    $sSeoUrl = $this->getArticleManufacturerUri($oArticle, $iLang, true);
                    break;
                default:
                    $sSeoUrl = $this->getArticleUri($oArticle, $iLang, true);
                    break;
            }
        }

        return $sSeoUrl;
    }
594764
public static function getUrl($lng, $object = NULL)
    {
        if (!self::exists($lng)) {
            return false;
        }

        // Default path
        $res = '/'. $lng .'/';

        $router = Router::getInstance();
        $current_page = $router->getPageData();
        $path = $router->getPath();

        // Try to find by same label
        $page_url_by_label = Structure::getPathByLabel($current_page['string_label'], $lng, false);
        if ($page_url_by_label) {
            $res = $page_url_by_label;
        } else {
            // No label page, compose path by location
            $p = [];
            foreach ($path as $v) {
                if (isset($v['location'])) {
                    $p[] = $v['location'];
                }
            }
            $p[0] = $lng;
            $p = '/' . implode('/', $p) . '/';

            // If have page in Structure
            if (Structure::getIdByPath($p)) {
                $res = $p;
            }
        }

        $skip_get_path = false;
        if ($object) {
            $object_slug = $object->getSlugUrl($lng);
            if ($object_slug) {
                $res .= $object_slug . '/';
            }
            $skip_get_path = true;
        }

        // $_GET in path
        $so = count($_GET);
        $path_gets = [];
        $param_get = $_GET;
        $skip = false;

        for ($i = 0; $i < $so; $i++) {
            // Skip next if non-next
            if ($skip) {
                continue;
            }

            if (isset($_GET[$i])) {
                if(!$skip_get_path)
                    $path_gets[] = $_GET[$i];
                unset($param_get[$i]);
            } else {
                $skip = true;
            }
        }

        // If have transparent get
        if ($path_gets) {
            $res .= implode('/', $path_gets) . '/';
        }

        // If have usual get params
        if ($param_get) {
            $res .= '?' . http_build_query($param_get);
        }

        return $res;
    }
201757
protected function _getAltUri($sObjectId, $iLang)
    {
        $sSeoUrl = null;
        $oManufacturer = oxNew(\OxidEsales\Eshop\Application\Model\Manufacturer::class);
        if ($oManufacturer->loadInLang($iLang, $sObjectId)) {
            $sSeoUrl = $this->getManufacturerUri($oManufacturer, $iLang, true);
        }

        return $sSeoUrl;
    }
231039
public function getInfo($sName, $iLang = null)
    {
        if (isset($this->_aModule[$sName])) {
            if ($iLang !== null && is_array($this->_aModule[$sName])) {
                $sValue = null;

                $sLang = \OxidEsales\Eshop\Core\Registry::getLang()->getLanguageAbbr($iLang);

                if (!empty($this->_aModule[$sName])) {
                    if (!empty($this->_aModule[$sName][$sLang])) {
                        $sValue = $this->_aModule[$sName][$sLang];
                    } elseif (!empty($this->_aModule['lang'])) {
                        // trying to get value according default language
                        $sValue = $this->_aModule[$sName][$this->_aModule['lang']];
                    } else {
                        // returning first array value
                        $sValue = reset($this->_aModule[$sName]);
                    }

                    return $sValue;
                }
            } else {
                return $this->_aModule[$sName];
            }
        }
    }
541667
public function getLink($iLang = null, $blMain = false)
    {
        if (!\OxidEsales\Eshop\Core\Registry::getUtils()->seoIsActive()) {
            return $this->getStdLink($iLang);
        }

        if ($iLang === null) {
            $iLang = $this->getLanguage();
        }

        $iLinkType = $this->getLinkType();
        if (!isset($this->_aSeoUrls[$iLang][$iLinkType])) {
            $this->_aSeoUrls[$iLang][$iLinkType] = $this->getBaseSeoLink($iLang, $blMain);
        }

        $sUrl = $this->_aSeoUrls[$iLang][$iLinkType];
        if (isset($this->_aSeoAddParams[$iLang])) {
            $sUrl .= ((strpos($sUrl . $this->_aSeoAddParams[$iLang], '?') === false) ? '?' : '&amp;') . $this->_aSeoAddParams[$iLang];
        }

        return $sUrl;
    }
1042525
public function getUpdatedByUserId(): \Psr\Http\Message\UriInterface
    {
        if (!$this->updatedByUserId) {
            return new Uri();
        }

        return $this->updatedByUserId;
    }
747916
public function setTplLanguage($iLang = null)
    {
        $this->_iTplLanguageId = isset($iLang) ? (int) $iLang : $this->getBaseLanguage();
        if ($this->isAdmin()) {
            $aLanguages = $this->getAdminTplLanguageArray();
            if (!isset($aLanguages[$this->_iTplLanguageId])) {
                $this->_iTplLanguageId = key($aLanguages);
            }
        }

        \OxidEsales\Eshop\Core\Registry::getSession()->setVariable('tpllanguage', $this->_iTplLanguageId);

        return $this->_iTplLanguageId;
    }
676891
public function getBaseStdLink($iLang, $blAddId = true, $blFull = true)
    {
        $sUrl = '';
        if ($blFull) {
            //always returns shop url, not admin
            $sUrl = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopUrl($iLang, false);
        }

        if ($this->oxcontents__oxloadid->value === 'oxcredits') {
            $sUrl .= "index.php?cl=credits";
        } else {
            $sUrl .= "index.php?cl=content";
        }
        $sUrl .= '&amp;oxloadid=' . $this->getLoadId();

        if ($blAddId) {
            $sUrl .= "&amp;oxcid=" . $this->getId();
            // adding parent category if if available
            if ($this->_sParentCatId !== false && $this->oxcontents__oxcatid->value && $this->oxcontents__oxcatid->value != 'oxrootid') {
                if ($this->_sParentCatId === null) {
                    $this->_sParentCatId = false;
                    $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
                    $sParentId = $oDb->getOne("select oxparentid from oxcategories where oxid = " . $oDb->quote($this->oxcontents__oxcatid->value));
                    if ($sParentId && 'oxrootid' != $sParentId) {
                        $this->_sParentCatId = $sParentId;
                    }
                }

                if ($this->_sParentCatId) {
                    $sUrl .= "&amp;cnid=" . $this->_sParentCatId;
                }
            }
        }

        //always returns shop url, not admin
        return $sUrl;
    }
1008903
protected function _getManufacturer($oArticle, $iLang)
    {
        $oManufacturer = null;
        if ($sActManufacturerId = $oArticle->oxarticles__oxmanufacturerid->value) {
            $oView = \OxidEsales\Eshop\Core\Registry::getConfig()->getActiveView();

            if ($oView instanceof \OxidEsales\Eshop\Application\Controller\FrontendController && ($oActManufacturer = $oView->getActManufacturer())) {
                $oManufacturer = $oActManufacturer;
            } else {
                $oManufacturer = oxNew(\OxidEsales\Eshop\Application\Model\Manufacturer::class);
            }

            if ($oManufacturer->getId() !== $sActManufacturerId || $oManufacturer->getLanguage() != $iLang) {
                $oManufacturer = oxNew(\OxidEsales\Eshop\Application\Model\Manufacturer::class);
                if (!$oManufacturer->loadInLang($iLang, $sActManufacturerId)) {
                    $oManufacturer = null;
                }
            }
        }

        return $oManufacturer;
    }
1271494
public function getBaseSeoLink($iLang, $blMain = false)
    {
        /** @var \OxidEsales\Eshop\Application\Model\SeoEncoderArticle $oEncoder */
        $oEncoder = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\SeoEncoderArticle::class);
        if (!$blMain) {
            return $oEncoder->getArticleUrl($this, $iLang, $this->getLinkType());
        }

        return $oEncoder->getArticleMainUrl($this, $iLang);
    }
760991
public function url($id = null, $additionalEndpoint = null)
    {
        $endpoint = $this->endpoint();

        if (! is_null($id)) {
            $endpoint .= '/' . $id;
        }
        if (! is_null($additionalEndpoint)) {
            $endpoint .= '/' . $additionalEndpoint;
        }

        return $endpoint;
    }
1315790
public function getParentUrl($categoryKey, $idLocale)
    {
        if ($this->categoryUrls->count() === 0) {
            $this->loadCategoryUrls();
        }

        if (!$this->categoryUrls->offsetExists($categoryKey)) {
            throw new CategoryByKeyNotFoundException(sprintf(
                'Category url key "%s" not found. Maybe you have a typo in the category key.',
                $categoryKey
            ));
        }

        foreach ($this->categoryUrls[$categoryKey] as $categoryUrl) {
            if ($categoryUrl[static::ID_LOCALE] === $idLocale) {
                return $categoryUrl[static::URL];
            }
        }

        throw new CategoryByKeyNotFoundException(sprintf(
            'Category url key "%s" and idLocale "%s" not found.',
            $categoryKey,
            $idLocale
        ));
    }
301506
protected function _getViewJoinLang($sTable, $iLang)
    {
        $sJoin = ' ';
        $sLangTable = getLangTableName($sTable, $iLang);
        if ($sLangTable && $sLangTable !== $sTable) {
            $sJoin .= "LEFT JOIN {$sLangTable} USING (OXID) ";
        }

        return $sJoin;
    }
1166140
public function matchUrl(RequestInterface $request, array $maps)
    {
        $matched = [];

        $uri = (string)$request->getUri();

        /** @var RequestMap $map */
        foreach ($maps as $map) {
            if ((string)$map->getRequest()->getUri() === $uri) {
                $matched[] = $map;
            }
        }

        return $matched;
    }
422551
public function validateLanguage($iLang = null)
    {
        // checking if this language is valid
        $aLanguages = $this->getLanguageArray(null, !$this->isAdmin());
        if (!isset($aLanguages[$iLang]) && is_array($aLanguages)) {
            $oLang = current($aLanguages);
            if (isset($oLang->id)) {
                $iLang = $oLang->id;
            }
        }

        return (int) $iLang;
    }
8785
private String getUrl(final IRI identifier) {
        return getServices().getResourceService().toExternal(identifier, getBaseUrl()).getIRIString();
    }
1137805
public function getArticleMainUri($oArticle, $iLang)
    {
        startProfile(__FUNCTION__);

        $oMainCat = $this->_getMainCategory($oArticle);
        $sMainCatId = $oMainCat ? $oMainCat->getId() : '';

        //load default article url from DB
        if (!($sSeoUri = $this->_loadFromDb('oxarticle', $oArticle->getId(), $iLang, null, $sMainCatId, true))) {
            // save for main category
            if ($oMainCat) {
                $sSeoUri = $this->_createArticleCategoryUri($oArticle, $oMainCat, $iLang);
            } else {
                // get default article url
                $oArticle = $this->_getProductForLang($oArticle, $iLang);
                $sSeoUri = $this->_processSeoUrl($this->_prepareArticleTitle($oArticle), $oArticle->getId(), $iLang);

                // save default article url
                $this->_saveToDb(
                    'oxarticle',
                    $oArticle->getId(),
                    $oArticle->getBaseStdLink($iLang),
                    $sSeoUri,
                    $iLang,
                    null,
                    0,
                    ''
                );
            }
        }

        stopProfile(__FUNCTION__);

        return $sSeoUri;
    }