3task Glossary: '; echo esc_html__( 'Please deactivate the old "Simple SEO Glossary" plugin. Both plugins cannot run simultaneously.', '3task-glossary' ); echo '
'; } ); return; } // Plugin constants (with defined checks for safety). if ( ! defined( 'AZGL_VERSION' ) ) { define( 'AZGL_VERSION', '2.4.2' ); } if ( ! defined( 'AZGL_PLUGIN_FILE' ) ) { define( 'AZGL_PLUGIN_FILE', __FILE__ ); } if ( ! defined( 'AZGL_PLUGIN_DIR' ) ) { define( 'AZGL_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); } require_once AZGL_PLUGIN_DIR . 'includes/class-content.php'; require_once AZGL_PLUGIN_DIR . 'includes/class-kb.php'; if ( ! defined( 'AZGL_PLUGIN_URL' ) ) { define( 'AZGL_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); } if ( ! defined( 'AZGL_PLUGIN_BASENAME' ) ) { define( 'AZGL_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); } // Limits for Lite version (no functional limits for WordPress.org compliance). if ( ! defined( 'AZGL_MAX_GLOSSARIES' ) ) { define( 'AZGL_MAX_GLOSSARIES', 999 ); } if ( ! defined( 'AZGL_MAX_ENTRIES' ) ) { define( 'AZGL_MAX_ENTRIES', 999999 ); } if ( ! defined( 'AZGL_SUPPORTER_MAX_GLOSSARIES' ) ) { define( 'AZGL_SUPPORTER_MAX_GLOSSARIES', 999 ); } if ( ! defined( 'AZGL_SUPPORTER_MAX_ENTRIES' ) ) { define( 'AZGL_SUPPORTER_MAX_ENTRIES', 999999 ); } /** * Main Plugin Class * * @since 2.0.0 */ final class AZ_Glossary_Lite { /** * Plugin instance. * * @var AZ_Glossary_Lite */ private static $instance = null; /** * Options handler. * * @var AZ_Glossary_Options */ public $options; /** * Admin handler. * * @var AZ_Glossary_Admin */ public $admin; /** * Frontend handler. * * @var AZ_Glossary_Frontend */ public $frontend; /** * Linker handler. * * @var AZ_Glossary_Linker */ public $linker; /** * Get plugin instance (Singleton). * * @return AZ_Glossary_Lite */ public static function get_instance() { if ( null === self::$instance ) { self::$instance = new self(); } return self::$instance; } /** * Constructor - private for Singleton. */ private function __construct() { $this->init(); } /** * Initialize plugin. */ private function init() { // Load classes. $this->load_classes(); // Load text domain early. add_action( 'init', array( $this, 'load_textdomain' ), 1 ); // Initialize components after plugins loaded. add_action( 'plugins_loaded', array( $this, 'init_components' ) ); // Activation/deactivation hooks. register_activation_hook( AZGL_PLUGIN_FILE, array( $this, 'activate' ) ); register_deactivation_hook( AZGL_PLUGIN_FILE, array( $this, 'deactivate' ) ); } /** * Load plugin text domain for translations. */ public function load_textdomain() { $options = get_option( 'azgl_options', array() ); $language = isset( $options['plugin_language'] ) ? $options['plugin_language'] : 'auto'; // If English is explicitly selected, don't load any translation (use source strings). if ( 'en_US' === $language ) { // Unload any existing translations. unload_textdomain( '3task-glossary' ); return; } // If specific non-English language is set, load that language file if it exists locally. // Otherwise WordPress.org handles translations automatically since 4.6+. if ( 'auto' !== $language && ! empty( $language ) ) { $mofile = AZGL_PLUGIN_DIR . 'languages/simple-seo-glossary-' . $language . '.mo'; if ( file_exists( $mofile ) ) { load_textdomain( '3task-glossary', $mofile ); } } } /** * Load required classes. */ private function load_classes() { $classes = array( 'includes/class-options.php', 'includes/class-admin.php', 'includes/class-frontend.php', 'includes/class-linker.php', 'includes/class-widget.php', 'includes/class-thanks.php', ); foreach ( $classes as $class ) { $file = AZGL_PLUGIN_DIR . $class; if ( file_exists( $file ) ) { require_once $file; } } } /** * Initialize components. */ public function init_components() { // Pro replaces Free completely: never run both frontends (double schema and navigation). if ( defined( 'AZGL_PRO_VERSION' ) || class_exists( 'AZ_Glossary_Pro', false ) ) { return; } // Initialize options first. $this->options = new AZ_Glossary_Options(); // Thank-you card with a review request on the plugin's own page. AZGL_Thanks::init(); // Initialize admin. if ( is_admin() ) { $this->admin = new AZ_Glossary_Admin( $this->options ); } // Initialize frontend. $this->frontend = new AZ_Glossary_Frontend( $this->options ); // Initialize linker. $this->linker = new AZ_Glossary_Linker( $this->options ); } /** * Notice shown while 3task Glossary Pro is active at the same time. */ public static function pro_active_notice() { if ( ! current_user_can( 'activate_plugins' ) ) { return; } echo ''; esc_html_e( '3task Glossary Pro is active, so the free 3task Glossary plugin is paused. You can safely deactivate and delete the free plugin; your glossaries and settings are kept.', '3task-glossary' ); echo '