' . "\n";
$content .= wp_kses_post(
str_replace('{suggest_title_text}', __('Here are some other great pages', '404-solution'),
$rSuggestTitle )) . "\n";
$currentSlug = '';
if (isset($_SERVER['REQUEST_URI']) && is_string($_SERVER['REQUEST_URI'])) {
$currentSlug = $abj404logic->removeHomeDirectory(
$f->regexReplace('\?.*', '', $f->normalizeUrlString($_SERVER['REQUEST_URI'])));
}
$displayed = 0;
$commentPartAndQueryPart = $abj404logic->getCommentPartAndQueryPartOfRequest();
// Check if minimum score filtering is enabled
$minScoreEnabled = isset($options['suggest_minscore_enabled']) && $options['suggest_minscore_enabled'] == '1';
$rMinscoreRaw = isset($options['suggest_minscore']) && is_scalar($options['suggest_minscore']) ? $options['suggest_minscore'] : 25;
$minScore = $minScoreEnabled ? intval($rMinscoreRaw) : 0;
foreach ($permalinkSuggestions as $idAndType => $linkScore) {
$rIdAndTypeStr = is_string($idAndType) ? $idAndType : (string)$idAndType;
$rLinkScoreFloat = is_scalar($linkScore) ? (float)$linkScore : 0.0;
$rRowTypeStr = is_string($rowType) ? $rowType : null;
$permalink = ABJ_404_Solution_Functions::permalinkInfoToArray($rIdAndTypeStr, $rLinkScoreFloat,
$rRowTypeStr, $options);
$rPermLink = isset($permalink['link']) && is_string($permalink['link']) ? $permalink['link'] : '';
$rPermTitle = isset($permalink['title']) && is_string($permalink['title']) ? $permalink['title'] : '';
$rPermScore = isset($permalink['score']) && is_numeric($permalink['score']) ? (float)$permalink['score'] : 0.0;
// Skip if we're currently on the page we're about to suggest
if ($currentSlug !== '' && basename($rPermLink) == $currentSlug) {
continue;
}
// Skip if minimum score filtering is enabled and score is below threshold
if ($minScoreEnabled && $rPermScore < $minScore) {
continue;
}
if ($displayed == 0) {
//
$content .= wp_kses_post($rSuggestBefore);
}
// -
$content .= wp_kses_post($rSuggestEntryBefore);
$content .= "" .
esc_attr($rPermTitle) . "";
// Display the score after the page link (admin only)
if ($showExtraAdminData) {
$content .= ' (' . number_format($rPermScore, 4) . ')';
}
//
$content .= wp_kses_post($rSuggestEntryAfter) . "\n";
$displayed++;
$rSuggestMaxOpt = isset($options['suggest_max']) && is_scalar($options['suggest_max']) ? (int)$options['suggest_max'] : 5;
if ($displayed >= $rSuggestMaxOpt) {
break;
}
}
if ($displayed >= 1) {
//
$content .= wp_kses_post($rSuggestAfter) . "\n";
} else {
$content .= wp_kses_post(
str_replace('{suggest_noresults_text}', __('No suggestions. :/ ', '404-solution'),
$rSuggestNoresults ));
}
$content .= "\n
";
return $content;
}
/**
* Render a loading placeholder for async suggestions.
* Shows skeleton loading animation while suggestions are being computed.
*
* @param string $requestedURL The 404 URL being looked up
* @param array