From 2401baf560f9a85b4f124d2484b78405a74178ab Mon Sep 17 00:00:00 2001 From: Nikita Date: Wed, 27 Nov 2024 21:02:18 +0300 Subject: [PATCH] fixed loading text domain remove some unused variables from main class --- classes/class-rest.php | 2 +- mind.php | 52 ++++++++++++++++++------------------------ readme.txt | 2 +- 3 files changed, 24 insertions(+), 32 deletions(-) diff --git a/classes/class-rest.php b/classes/class-rest.php index e927615..530fb3f 100644 --- a/classes/class-rest.php +++ b/classes/class-rest.php @@ -2,7 +2,7 @@ /** * Rest API functions * - * @package @@plugin_name + * @package mind */ if ( ! defined( 'ABSPATH' ) ) { diff --git a/mind.php b/mind.php index 5643dac..a34715f 100644 --- a/mind.php +++ b/mind.php @@ -45,20 +45,6 @@ class Mind { return self::$instance; } - /** - * Name of the plugin - * - * @var $plugin_name - */ - public $plugin_name; - - /** - * Basename of plugin main file - * - * @var $plugin_basename - */ - public $plugin_basename; - /** * Path to the plugin directory * @@ -84,16 +70,31 @@ class Mind { * Init options */ public function init() { - $this->plugin_name = esc_html__( 'Mind', 'mind' ); - $this->plugin_basename = plugin_basename( __FILE__ ); - $this->plugin_path = plugin_dir_path( __FILE__ ); - $this->plugin_url = plugin_dir_url( __FILE__ ); - - // load textdomain. - load_plugin_textdomain( 'mind', false, basename( dirname( __FILE__ ) ) . '/languages' ); + $this->plugin_path = plugin_dir_path( __FILE__ ); + $this->plugin_url = plugin_dir_url( __FILE__ ); // include helper files. $this->include_dependencies(); + + // hooks. + add_action( 'init', [ $this, 'init_hook' ] ); + } + + /** + * Include dependencies + */ + private function include_dependencies() { + require_once $this->plugin_path . 'classes/class-admin.php'; + require_once $this->plugin_path . 'classes/class-assets.php'; + require_once $this->plugin_path . 'classes/class-rest.php'; + } + + /** + * Init Hook + */ + public function init_hook() { + // load textdomain. + load_plugin_textdomain( 'mind', false, basename( dirname( __FILE__ ) ) . '/languages' ); } /** @@ -110,15 +111,6 @@ class Mind { public function deactivation_hook() { // Nothing here yet. } - - /** - * Include dependencies - */ - private function include_dependencies() { - require_once $this->plugin_path . 'classes/class-admin.php'; - require_once $this->plugin_path . 'classes/class-assets.php'; - require_once $this->plugin_path . 'classes/class-rest.php'; - } } /** diff --git a/readme.txt b/readme.txt index 5576610..39ee345 100644 --- a/readme.txt +++ b/readme.txt @@ -2,7 +2,7 @@ Contributors: nko Tags: ai, openai, gpt, copywriting, assistant Requires at least: 6.2 -Tested up to: 6.4 +Tested up to: 6.7 Requires PHP: 7.2 Stable tag: 0.1.1 License: GPL-2.0-or-later