| 1 |
<?php |
| 2 |
/* |
| 3 |
* Plugin Name: Ultimate Cursor Addons for Elementor |
| 4 |
* Plugin URI: https://wordpress.org/plugins/ultimate-cursor |
| 5 |
* Description: Ultimate Cursor plugin is the one stop solution for Elementor users who might want to add a bit of sparkle and fun to their experience might be seeking a way to customize their cursor. This cool extension boasts an ample cursor database and some customization options |
| 6 |
* Version: 1.2.0 |
| 7 |
* Author: WPXERO |
| 8 |
* Author URI: https://wpxero.com |
| 9 |
* Text Domain: ultimate-cursor |
| 10 |
* License: GPL3 |
| 11 |
* Domain Path: /languages/ |
| 12 |
* Elementor requires at least: 3.0.0 |
| 13 |
* Elementor tested up to: 3.19.0 |
| 14 |
*/ |
| 15 |
|
| 16 |
namespace UltimateCursor; |
| 17 |
|
| 18 |
|
| 19 |
if (!defined('ABSPATH')) { |
| 20 |
die(__('Direct Access is not allowed', 'ultimate-cursor')); |
| 21 |
} |
| 22 |
|
| 23 |
|
| 24 |
// Some pre define value for easy use |
| 25 |
define('UCA_VERSION', '1.2.0'); |
| 26 |
define('UCA_FILE_', __FILE__); |
| 27 |
define('UCA_URL', plugins_url('/', UCA_FILE_)); |
| 28 |
define('UCA_ASSETS_URL', UCA_URL . 'assets/'); |
| 29 |
|
| 30 |
final class UltimateCursorLoader { |
| 31 |
const VERSION = UCA_VERSION; |
| 32 |
const MINIMUM_ELEMENTOR_VERSION = '3.0.0'; |
| 33 |
const MINIMUM_PHP_VERSION = '7.0'; |
| 34 |
|
| 35 |
private static $_instance = null; |
| 36 |
|
| 37 |
public static function instance() { |
| 38 |
if (is_null(self::$_instance)) { |
| 39 |
self::$_instance = new self(); |
| 40 |
} |
| 41 |
return self::$_instance; |
| 42 |
} |
| 43 |
|
| 44 |
public function __construct() { |
| 45 |
add_action('plugins_loaded', array($this, 'init')); |
| 46 |
} |
| 47 |
|
| 48 |
public function admin_notice_minimum_php_version() { |
| 49 |
if (isset($_GET['activate'])) { |
| 50 |
unset($_GET['activate']); |
| 51 |
} |
| 52 |
|
| 53 |
$message = sprintf( |
| 54 |
/* translators: 1: Plugin name 2: PHP 3: Required PHP version */ |
| 55 |
esc_html__('"%1$s" requires "%2$s" version %3$s or greater.', 'ultimate-cursor'), |
| 56 |
'<strong>' . esc_html__('Ultimate Cursor', 'ultimate-cursor') . '</strong>', |
| 57 |
'<strong>' . esc_html__('PHP', 'ultimate-cursor') . '</strong>', |
| 58 |
self::MINIMUM_PHP_VERSION |
| 59 |
); |
| 60 |
printf('<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message); |
| 61 |
} |
| 62 |
|
| 63 |
public function admin_notice_minimum_elementor_version() { |
| 64 |
if (isset($_GET['activate'])) { |
| 65 |
unset($_GET['activate']); |
| 66 |
} |
| 67 |
|
| 68 |
$message = sprintf( |
| 69 |
/* translators: 1: Plugin name 2: Elementor 3: Required Elementor version */ |
| 70 |
esc_html__('"%1$s" requires "%2$s" version %3$s or greater.', 'ultimate-cursor'), |
| 71 |
'<strong>' . esc_html__('Ultimate Cursor', 'ultimate-cursor') . '</strong>', |
| 72 |
'<strong>' . esc_html__('Elementor', 'ultimate-cursor') . '</strong>', |
| 73 |
self::MINIMUM_ELEMENTOR_VERSION |
| 74 |
); |
| 75 |
printf('<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message); |
| 76 |
} |
| 77 |
|
| 78 |
public function admin_notice_missing_main_plugin() { |
| 79 |
if (isset($_GET['activate'])) { |
| 80 |
unset($_GET['activate']); |
| 81 |
} |
| 82 |
|
| 83 |
$message = sprintf( |
| 84 |
/* translators: 1: Plugin name 2: Elementor */ |
| 85 |
esc_html__('"%1$s" requires "%2$s" to be installed and activated.', 'ultimate-cursor'), |
| 86 |
'<strong>' . esc_html__('Ultimate Cursor', 'ultimate-cursor') . '</strong>', |
| 87 |
'<strong>' . esc_html__('Elementor', 'ultimate-cursor') . '</strong>' |
| 88 |
); |
| 89 |
printf('<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message); |
| 90 |
} |
| 91 |
public function init() { |
| 92 |
load_plugin_textdomain('ultimate-cursor', false, plugin_dir_path(__FILE__) . '/languages'); |
| 93 |
// load extension |
| 94 |
require(dirname(__FILE__) . '/extension/cursor.php'); |
| 95 |
// Check if Elementor installed and activated |
| 96 |
if (!did_action('elementor/loaded')) { |
| 97 |
add_action('admin_notices', array($this, 'admin_notice_missing_main_plugin')); |
| 98 |
return; |
| 99 |
} |
| 100 |
|
| 101 |
// Check for required Elementor version |
| 102 |
if (!version_compare(ELEMENTOR_VERSION, self::MINIMUM_ELEMENTOR_VERSION, '>=')) { |
| 103 |
add_action('admin_notices', array($this, 'admin_notice_minimum_elementor_version')); |
| 104 |
return; |
| 105 |
} |
| 106 |
|
| 107 |
// Check for required PHP version |
| 108 |
if (version_compare(PHP_VERSION, self::MINIMUM_PHP_VERSION, '<')) { |
| 109 |
add_action('admin_notices', array($this, 'admin_notice_minimum_php_version')); |
| 110 |
return; |
| 111 |
} |
| 112 |
} |
| 113 |
} |
| 114 |
UltimateCursorLoader::instance(); |
| 115 |
|