HEX
Server: nginx/1.27.1
System: Linux in-4 5.15.0-131-generic #141-Ubuntu SMP Fri Jan 10 21:18:28 UTC 2025 x86_64
User: ilikadirect (1186)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source
Upload Files
File: /storage/v6964/testingff/public_html/fdfctr/wp-content/plugins/site-reviews/plugin/Addons/Hooks.php
<?php

namespace GeminiLabs\SiteReviews\Addons;

abstract class Hooks
{
    protected $addon;
    protected $basename;
    protected $controller;

    public function __construct()
    {
        $this->addon = $this->addon();
        $this->basename = plugin_basename($this->addon->file);
        $this->controller = $this->controller();
    }

    /**
     * @return void
     */
    public function run()
    {
        $this->runIntegrations();
        add_action('admin_enqueue_scripts', [$this->controller, 'enqueueAdminAssets']);
        add_action('enqueue_block_editor_assets', [$this->controller, 'enqueueBlockAssets']);
        add_action('wp_enqueue_scripts', [$this->controller, 'enqueuePublicAssets']);
        add_filter('plugin_action_links_'.$this->basename, [$this->controller, 'filterActionLinks']);
        add_filter('site-reviews/capabilities', [$this->controller, 'filterCapabilities']);
        add_filter('site-reviews/config', [$this->controller, 'filterConfigPath']);
        add_filter('site-reviews/addon/documentation', [$this->controller, 'filterDocumentation']);
        add_filter('gettext_'.$this->addon->id, [$this->controller, 'filterGettext'], 10, 2);
        add_filter('gettext_with_context_'.$this->addon->id, [$this->controller, 'filterGettextWithContext'], 10, 3);
        add_filter('ngettext_'.$this->addon->id, [$this->controller, 'filterNgettext'], 10, 4);
        add_filter('ngettext_with_context_'.$this->addon->id, [$this->controller, 'filterNgettextWithContext'], 10, 5);
        add_filter('site-reviews/path', [$this->controller, 'filterFilePaths'], 10, 2);
        add_filter($this->addon->id.'/render/view', [$this->controller, 'filterRenderView']);
        add_filter('site-reviews/roles', [$this->controller, 'filterRoles']);
        add_filter('site-reviews/defer-scripts', [$this->controller, 'filterScriptsDefer']);
        add_filter('site-reviews/addon/settings', [$this->controller, 'filterSettings']);
        add_filter('site-reviews/addon/subsubsub', [$this->controller, 'filterSubsubsub']);
        add_filter('site-reviews/translation/entries', [$this->controller, 'filterTranslationEntries']);
        add_filter('site-reviews/translator/domains', [$this->controller, 'filterTranslatorDomains']);
        add_filter($this->addon->id.'/activate', [$this->controller, 'install']);
        add_action('admin_init', [$this->controller, 'onActivation']);
        add_action('init', [$this->controller, 'registerBlocks'], 9);
        add_action('init', [$this->controller, 'registerLanguages'], -10);
        add_action('init', [$this->controller, 'registerShortcodes']);
        add_action('init', [$this->controller, 'registerTinymcePopups']);
        add_action('widgets_init', [$this->controller, 'registerWidgets']);
        add_action('site-reviews/addon/settings/'.$this->addon->slug, [$this->controller, 'renderSettings']);
    }

    /**
     * @return void
     */
    public function runIntegrations()
    {
        $dir = $this->addon->path('plugin/Integrations');
        if (!is_dir($dir)) {
            return;
        }
        $iterator = new \DirectoryIterator($dir);
        $namespace = (new \ReflectionClass($this->addon))->getNamespaceName();
        foreach ($iterator as $fileinfo) {
            if (!$fileinfo->isDir() || $fileinfo->isDot()) {
                continue;
            }
            $basename = $namespace.'\Integrations\\'.$fileinfo->getBasename();
            $controller = $basename.'\Controller';
            $hooks = $basename.'\Hooks';
            if (class_exists($controller) && class_exists($hooks)) {
                glsr()->singleton($controller);
                glsr()->singleton($hooks);
                glsr($hooks)->run();
            }
        }
    }

    /**
     * @return mixed
     */
    abstract protected function addon();

    /**
     * @return mixed
     */
    abstract protected function controller();
}