Contao\PageModel::applyLegacyLogic PHP Method

applyLegacyLogic() private method

Modifies a URL from the URL generator.
private applyLegacyLogic ( string $strUrl, string $strParams ) : string
$strUrl string
$strParams string
return string
    private function applyLegacyLogic($strUrl, $strParams)
    {
        // Decode sprintf placeholders
        if (strpos($strParams, '%') !== false) {
            @trigger_error('Using sprintf placeholders in URLs has been deprecated and will no longer work in Contao 5.0.', E_USER_DEPRECATED);
            $arrMatches = array();
            preg_match_all('/%([sducoxXbgGeEfF])/', $strParams, $arrMatches);
            foreach (array_unique($arrMatches[1]) as $v) {
                $strUrl = str_replace('%25' . $v, '%' . $v, $strUrl);
            }
        }
        // HOOK: add custom logic
        if (isset($GLOBALS['TL_HOOKS']['generateFrontendUrl']) && is_array($GLOBALS['TL_HOOKS']['generateFrontendUrl'])) {
            @trigger_error('Using the "generateFrontendUrl" hook has been deprecated and will no longer work in Contao 5.0.', E_USER_DEPRECATED);
            foreach ($GLOBALS['TL_HOOKS']['generateFrontendUrl'] as $callback) {
                $strUrl = \System::importStatic($callback[0])->{$callback[1]}($this->row(), $strParams, $strUrl);
            }
            return $strUrl;
        }
        return $strUrl;
    }