| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Plugin Name: Ultimate Cursor – Best Cursor Animation Plugin for WordPress |
| 5 |
* Plugin URI: https://wordpress.org/plugins/ultimate-cursor |
| 6 |
* Description: Make Your Website Stand Out with Unique Cursor Effects and Smooth Animations!🚀 |
| 7 |
* Version: 1.3.5 |
| 8 |
* Author: WPXERO |
| 9 |
* Author URI: https://wpxero.com/ultimate-cursor |
| 10 |
* Requires at least: 6.0 |
| 11 |
* Requires PHP: 7.4 |
| 12 |
* License: GPL v2 or later |
| 13 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 14 |
* Text Domain: ultimate-cursor |
| 15 |
* Elementor requires at least: 3.0.0 |
| 16 |
* Elementor tested up to: 3.28.3 |
| 17 |
*/ |
| 18 |
|
| 19 |
|
| 20 |
if (! defined('ABSPATH')) { |
| 21 |
exit; |
| 22 |
} |
| 23 |
|
| 24 |
if (! defined('UCA_VERSION')) { |
| 25 |
define('UCA_VERSION', '1.3.5'); |
| 26 |
} |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
/** |
| 31 |
* UltimateCursor Class |
| 32 |
*/ |
| 33 |
class UltimateCursor { |
| 34 |
/** |
| 35 |
* The single class instance. |
| 36 |
* |
| 37 |
* @var $instance |
| 38 |
*/ |
| 39 |
private static $instance = null; |
| 40 |
const VERSION = UCA_VERSION; |
| 41 |
const MINIMUM_ELEMENTOR_VERSION = '3.0.0'; |
| 42 |
const MINIMUM_PHP_VERSION = '7.0'; |
| 43 |
/** |
| 44 |
* Main Instance |
| 45 |
* Ensures only one instance of this class exists in memory at any one time. |
| 46 |
*/ |
| 47 |
public static function instance() { |
| 48 |
if (is_null(self::$instance)) { |
| 49 |
self::$instance = new self(); |
| 50 |
self::$instance->init(); |
| 51 |
} |
| 52 |
return self::$instance; |
| 53 |
} |
| 54 |
|
| 55 |
/** |
| 56 |
* Path to the plugin directory |
| 57 |
* |
| 58 |
* @var $plugin_path |
| 59 |
*/ |
| 60 |
public $plugin_path; |
| 61 |
|
| 62 |
/** |
| 63 |
* URL to the plugin directory |
| 64 |
* |
| 65 |
* @var $plugin_url |
| 66 |
*/ |
| 67 |
public $plugin_url; |
| 68 |
public $minimum_elementor_version; |
| 69 |
public $minimum_php_version; |
| 70 |
|
| 71 |
/** |
| 72 |
* Ultimate Cursor constructor. |
| 73 |
*/ |
| 74 |
public function __construct() { |
| 75 |
/* We do nothing here! */ |
| 76 |
} |
| 77 |
|
| 78 |
/** |
| 79 |
* Init options |
| 80 |
*/ |
| 81 |
public function init() { |
| 82 |
$this->plugin_path = plugin_dir_path(__FILE__); |
| 83 |
$this->plugin_url = plugin_dir_url(__FILE__); |
| 84 |
$this->minimum_elementor_version = self::MINIMUM_ELEMENTOR_VERSION; |
| 85 |
$this->minimum_php_version = self::MINIMUM_PHP_VERSION; |
| 86 |
|
| 87 |
|
| 88 |
// include helper files. |
| 89 |
$this->include_dependencies(); |
| 90 |
|
| 91 |
// hooks. |
| 92 |
add_action('init', [$this, 'init_hook']); |
| 93 |
add_filter('user_has_cap', [$this, 'user_has_cap'], 10, 4); |
| 94 |
} |
| 95 |
|
| 96 |
|
| 97 |
public function user_has_cap($allcaps, $caps, $args, $user) { |
| 98 |
if (is_user_logged_in() && in_array('upload_files', $caps)) { |
| 99 |
$allcaps['upload_files'] = true; |
| 100 |
} |
| 101 |
return $allcaps; |
| 102 |
} |
| 103 |
|
| 104 |
/** |
| 105 |
* Include dependencies |
| 106 |
*/ |
| 107 |
private function include_dependencies() { |
| 108 |
require_once $this->plugin_path . 'classes/class-admin.php'; |
| 109 |
require_once $this->plugin_path . 'classes/class-assets.php'; |
| 110 |
require_once $this->plugin_path . 'classes/class-rest.php'; |
| 111 |
if (did_action('elementor/loaded')) { |
| 112 |
require_once $this->plugin_path . 'classes/class-elementor.php'; |
| 113 |
} |
| 114 |
} |
| 115 |
|
| 116 |
/** |
| 117 |
* Init Hook |
| 118 |
*/ |
| 119 |
public function init_hook() { |
| 120 |
// load textdomain. |
| 121 |
load_plugin_textdomain('ultimate-cursor', false, basename(dirname(__FILE__)) . '/languages'); |
| 122 |
|
| 123 |
|
| 124 |
} |
| 125 |
|
| 126 |
|
| 127 |
/** |
| 128 |
* Activation Hook |
| 129 |
*/ |
| 130 |
public function activation_hook() { |
| 131 |
// Welcome Page Flag. |
| 132 |
set_transient('_ultimate_cursor_welcome_screen_activation_redirect', true, 30); |
| 133 |
} |
| 134 |
|
| 135 |
/** |
| 136 |
* Deactivation Hook |
| 137 |
*/ |
| 138 |
public function deactivation_hook() { |
| 139 |
// Nothing here yet. |
| 140 |
} |
| 141 |
} |
| 142 |
|
| 143 |
/** |
| 144 |
* Function works with the Loader class instance |
| 145 |
* |
| 146 |
* @return object UltimateCursor |
| 147 |
*/ |
| 148 |
function ultimate_cursor() { |
| 149 |
return UltimateCursor::instance(); |
| 150 |
} |
| 151 |
add_action('plugins_loaded', 'ultimate_cursor'); |
| 152 |
|
| 153 |
register_activation_hook(__FILE__, [ultimate_cursor(), 'activation_hook']); |
| 154 |
register_deactivation_hook(__FILE__, [ultimate_cursor(), 'deactivation_hook']); |
| 155 |
|