HEX
Server: Apache
System: Linux www 6.18.4-i1-ampere #899 SMP Thu Jan 8 10:39:05 CET 2026 aarch64
User: sws1073755998 (1073755998)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: /home/www/public/wp-content/plugins/countdown-block/includes/helpers.php
<?php

/**
 * Load google fonts.
 */

// Exit if accessed directly.
if (!defined('ABSPATH')) {
    exit;
}

class Countdown_Helper
{
    private static $instance;

    /**
     * Construct Method
     */
    public function __construct()
    {
        add_action('admin_enqueue_scripts', array($this, 'enqueues'));
    }

    /**
     * Register the plugin
     */
    public static function register()
    {
        if (null === self::$instance) {
            self::$instance = new self;
        }

        return self::$instance;
    }

    /**
     * Enqueue function
     */
    public function enqueues()
    {
        global $pagenow;

        /**
         * Only for admin add/edit pages/posts
         */
        if ($pagenow == 'post-new.php' || $pagenow == 'post.php' || $pagenow == 'site-editor.php' || ($pagenow == 'themes.php' && !empty($_SERVER['QUERY_STRING']) && str_contains($_SERVER['QUERY_STRING'], 'gutenberg-edit-site'))) {

            $controls_dependencies = include_once COUNTDOWN_ADMIN_PATH . '/dist/modules.asset.php';

            wp_register_script(
                "countdown-controls-util",
                COUNTDOWN_ADMIN_URL . '/dist/modules.js',
                array_merge($controls_dependencies['dependencies']),
                $controls_dependencies['version'],
                true
            );

            wp_localize_script('countdown-controls-util', 'EssentialBlocksLocalize', array(
                'eb_wp_version' => (float) get_bloginfo('version'),
                'rest_rootURL' => get_rest_url(),
            ));

            if ($pagenow == 'post-new.php' || $pagenow == 'post.php') {
                wp_localize_script('countdown-controls-util', 'eb_conditional_localize', array(
                    'editor_type' => 'edit-post'
                ));
            } else if ($pagenow == 'site-editor.php' || $pagenow == 'themes.php') {
                wp_localize_script('countdown-controls-util', 'eb_conditional_localize', array(
                    'editor_type' => 'edit-site'
                ));
            }

            wp_enqueue_style(
                'countdown-editor-css',
                COUNTDOWN_ADMIN_URL . 'dist/modules.css',
                array(),
                $controls_dependencies['version'],
                'all'
            );
        }
    }

    /**
     * Block Register Function
     */
    public static function get_block_register_path($blockname, $blockPath)
    {
        if ((float) get_bloginfo('version') <= 5.6) {
            return $blockname;
        } else {
            return $blockPath;
        }
    }
}

Countdown_Helper::register();