updateIfNecessary(); } /** * @param array $atts * @return string */ static function shortcodePageSuggestions( array $atts ): string { $localeScope = self::localeScope(); $didSwitchLocale = $localeScope->switchToFrontendLocale(); try { $abj404logic = abj_service('plugin_logic'); $abj404spellChecker = abj_service('spell_checker'); $f = abj_service('functions'); // Attributes $atts = shortcode_atts( array( ), $atts ); $options = abj_service('options_repository')->getOptions(); $content = "\n\n"; $urlResult = self::requestedUrlResolver()->resolve($f); $content .= $urlResult['cookieScripts']; $urlRequest = $urlResult['url']; if ($urlRequest == '') { // if no 404 was detected then we don't offer any suggestions return "\n"; } // Check for cached suggestion computation (transient-based). // Normalize at the boundary: see ABJ_404_Solution_SuggestionTransient. $urlForCacheKey = ABJ_404_Solution_SuggestionTransient::normalizedUrl($urlRequest); $transientKey = ABJ_404_Solution_SuggestionTransient::transientKeyForNormalizedUrl($urlForCacheKey); $cached = ABJ_404_Solution_SuggestionTransient::fromRaw(get_transient($transientKey)); if ($cached !== null && $cached->isComplete()) { // Suggestions ready, use cached data $content .= self::suggestionsPresenter()->renderSuggestionsHTML( $cached->getSuggestionsPacket(), $urlRequest, $options, true ); $content .= "\n\n"; return $content; } // A no-JS reader who clicked the placeholder's