<?php

namespace Linksy\SearchAndReplace\Plugli\Standard\Core;

// Include WordPress bootstrap file
require_once ABSPATH . '/wp-admin/includes/plugin.php';
/**
 * The core plugin class.
 * Defines internationalization, admin-specific hooks, and public-facing site hooks.
 * @since      1.0.0
 * @author     Plugli Team
 */
abstract class Init
{
    /**
     * The loader that's responsible for maintaining and registering all hooks that power
     * the plugin.
     *
     * @var      Loader    $loader    Maintains and registers all hooks for the plugin.
     */
    protected $loader;
    /**
     * The unique identifier of this plugin.
     *
     * @since    1.0.0
     * @access   protected
     * @var      string    $plugin_base_name    The string used to uniquely identify this plugin.
     */
    protected $plugin_basename;
    /**
     * The current version of the plugin.
     *
     * @since    1.0.0
     * @access   protected
     * @var      string    $version    The current version of the plugin.
     */
    protected $version;
    /**
     * The name of the plugin.
     *
     * @since    1.0.0
     * @access   protected
     * @var      string    $plugin_name    The name of the plugin.
     */
    protected $plugin_name;
    /**
     * The text domain of the plugin.
     *
     * @since    1.0.0
     * @access   protected
     * @var      string    $version    The text domain of the plugin.
     */
    protected $plugin_text_domain;
    /**
     * Initialize and define the core functionality of the plugin.
     */
    public function __construct()
    {
        $this->loader = new Loader();
        $this->setup();
        $this->set_locale();
        $this->define_admin_hooks();
        $this->define_public_hooks();
        $this->loader->add_action("plugins_loaded", $this, 'handle_plugin_loaded');
        $this->loader->add_filter("plugin_action_links_{$this->plugin_basename}", $this, 'add_plugin_action_links', 10, 4);
    }
    /**
     * define the plugin properties
     */
    abstract protected function setup();
    /**
     * Check if plugin is loaded
     */
    public function handle_plugin_loaded()
    {
        $this->set_locale();
    }
    /**
     * Define the locale for this plugin for internationalization.
     *
     * Uses the I18n class in order to set the domain and to register the hook
     * with WordPress.
     *
     * @access    protected
     */
    protected function set_locale()
    {
        $plugin_i18n = new I18n($this->plugin_text_domain);
        $plugin_i18n->load_plugin_textdomain();
    }
    /**
     * Register all of the hooks related to the admin area functionality
     * of the plugin.
     *
     * @access    protected
     */
    protected function define_admin_hooks()
    {
    }
    /**
     * Register all of the hooks related to the public-facing functionality
     * of the plugin.
     *
     * @access    protected
     */
    protected function define_public_hooks()
    {
    }
    /**
     * Run the loader to execute all of the hooks with WordPress.
     */
    public function run()
    {
        $this->loader->run();
    }
    /**
     * The name of the plugin used to uniquely identify it within the context of
     * WordPress and to define internationalization functionality.
     */
    public function get_plugin_name()
    {
        return $this->plugin_name;
    }
    /**
     * The reference to the class that orchestrates the hooks with the plugin.
     *
     * @return    Loader    Orchestrates the hooks of the plugin.
     */
    public function get_loader()
    {
        return $this->loader;
    }
    /**
     * Retrieve the version number of the plugin.
     *
     * @since     1.0.0
     * @return    string    The version number of the plugin.
     */
    public function get_version()
    {
        return $this->version;
    }
    /**
     * Retrieve the text domain of the plugin.
     *
     * @since     1.0.0
     * @return    string    The text domain of the plugin.
     */
    public function get_plugin_text_domain()
    {
        return $this->plugin_text_domain;
    }
    /**
     * Adds items to the plugin's action links on the Plugins listing screen.
     *
     * @param array<string,string> $actions     Array of action links.
     * @param string               $plugin_file Path to the plugin file relative to the plugins directory.
     * @param mixed[]              $plugin_data An array of plugin data.
     * @param string               $context     The plugin context.
     * @return array<string,string> Array of action links.
     */
    public function add_plugin_action_links($actions, $plugin_file, $plugin_data, $context)
    {
        return $actions;
    }
}
