2023-06-02 17:29:56 +03:00
|
|
|
<?php
|
|
|
|
/**
|
2025-04-11 09:07:18 +08:00
|
|
|
* Plugin Name: WPMind
|
|
|
|
* Plugin URI: https://wenpai.org/plugins/wp-mind
|
|
|
|
* Description: AI Page Builder based on Anthropic , OpenAI and DeepSeek. Build, design, improve, rewrite your page sections and blocks.
|
2025-03-16 11:30:49 +03:00
|
|
|
* Requires at least: 6.5
|
2023-06-02 17:29:56 +03:00
|
|
|
* Requires PHP: 7.2
|
2025-04-11 09:07:18 +08:00
|
|
|
* Version: 0.6.0
|
|
|
|
* Author: WPMind
|
|
|
|
* Author URI: https://wpmind.com/
|
2023-06-02 17:29:56 +03:00
|
|
|
* License: GPLv2 or later
|
|
|
|
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
* Text Domain: mind
|
|
|
|
*
|
|
|
|
* @package mind
|
|
|
|
*/
|
|
|
|
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( ! defined( 'MIND_VERSION' ) ) {
|
2025-04-11 09:07:18 +08:00
|
|
|
define( 'MIND_VERSION', '0.6.0' );
|
2023-06-02 17:29:56 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Mind Class
|
|
|
|
*/
|
|
|
|
class Mind {
|
|
|
|
/**
|
|
|
|
* The single class instance.
|
|
|
|
*
|
|
|
|
* @var $instance
|
|
|
|
*/
|
|
|
|
private static $instance = null;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Main Instance
|
|
|
|
* Ensures only one instance of this class exists in memory at any one time.
|
|
|
|
*/
|
|
|
|
public static function instance() {
|
|
|
|
if ( is_null( self::$instance ) ) {
|
|
|
|
self::$instance = new self();
|
|
|
|
self::$instance->init();
|
|
|
|
}
|
|
|
|
return self::$instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Path to the plugin directory
|
|
|
|
*
|
|
|
|
* @var $plugin_path
|
|
|
|
*/
|
|
|
|
public $plugin_path;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* URL to the plugin directory
|
|
|
|
*
|
|
|
|
* @var $plugin_url
|
|
|
|
*/
|
|
|
|
public $plugin_url;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Mind constructor.
|
|
|
|
*/
|
|
|
|
public function __construct() {
|
|
|
|
/* We do nothing here! */
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Init options
|
|
|
|
*/
|
|
|
|
public function init() {
|
2024-11-27 21:02:18 +03:00
|
|
|
$this->plugin_path = plugin_dir_path( __FILE__ );
|
|
|
|
$this->plugin_url = plugin_dir_url( __FILE__ );
|
2023-06-02 17:29:56 +03:00
|
|
|
|
|
|
|
// include helper files.
|
|
|
|
$this->include_dependencies();
|
2024-11-27 21:02:18 +03:00
|
|
|
|
|
|
|
// hooks.
|
|
|
|
add_action( 'init', [ $this, 'init_hook' ] );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Include dependencies
|
|
|
|
*/
|
|
|
|
private function include_dependencies() {
|
2024-12-27 00:42:38 +03:00
|
|
|
require_once $this->plugin_path . 'classes/class-prompts.php';
|
2024-12-27 14:31:22 +03:00
|
|
|
require_once $this->plugin_path . 'classes/class-ai-api.php';
|
2024-11-27 21:02:18 +03:00
|
|
|
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' );
|
2023-06-02 17:29:56 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Activation Hook
|
|
|
|
*/
|
|
|
|
public function activation_hook() {
|
2023-08-05 17:09:32 +03:00
|
|
|
// Welcome Page Flag.
|
|
|
|
set_transient( '_mind_welcome_screen_activation_redirect', true, 30 );
|
2023-06-02 17:29:56 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Deactivation Hook
|
|
|
|
*/
|
|
|
|
public function deactivation_hook() {
|
|
|
|
// Nothing here yet.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function works with the Mind class instance
|
|
|
|
*
|
|
|
|
* @return object Mind
|
|
|
|
*/
|
|
|
|
function mind() {
|
|
|
|
return Mind::instance();
|
|
|
|
}
|
|
|
|
add_action( 'plugins_loaded', 'mind' );
|
|
|
|
|
2023-07-14 10:35:15 +03:00
|
|
|
register_activation_hook( __FILE__, [ mind(), 'activation_hook' ] );
|
|
|
|
register_deactivation_hook( __FILE__, [ mind(), 'deactivation_hook' ] );
|
2025-04-11 09:07:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Integrate UpdatePulse Server for updates using PUC v5.3
|
|
|
|
require_once plugin_dir_path(__FILE__) . 'lib/plugin-update-checker/plugin-update-checker.php';
|
|
|
|
use YahnisElsts\PluginUpdateChecker\v5p3\PucFactory;
|
|
|
|
|
|
|
|
$WpMindUpdateChecker = PucFactory::buildUpdateChecker(
|
|
|
|
'https://updates.weixiaoduo.com/wpmind.json',
|
|
|
|
__FILE__,
|
|
|
|
'wpmind'
|
|
|
|
);
|
|
|
|
|