PluginProbe
Amedea – Unique Design Elements for Elementor / trunk
Amedea – Unique Design Elements for Elementor vtrunk
trunk 0.0.4.7
amedea / amedea.php

amedea.php in Amedea – Unique Design Elements for Elementor trunk, at amedea.php

371 lines 10.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Amedea
4 * Description: Unique Collection of Elementor Elements
5 * Plugin URI: https://amedeapro.com/limited-version/
6 * Author: Amedea
7 * Version: 0.0.4.8
8 * Author URI: https://amedeapro.com/go/?p=amedea
9 * License: GNU General Public License v2 or later
10 * License URI: http://www.gnu.org/licenses/gpl-2.0.html
11 *
12 * Text Domain: amedea
13 * Elementor tested up to: 4.0.3
14 */
15
16 /**
17 * Copyright (c) 2024 Moskva Yigit | Krasota Iskusstva
18 * moskvayigit.com | krasotaiskusstva.com
19 * All rights reserved.
20 *
21 * Released under the GPL license
22 * http://www.opensource.org/licenses/gpl-license.php
23 *
24 * This is an add-on for WordPress
25 * http://wordpress.org/
26 *
27 * **********************************************************************
28 * This program is free software; you can redistribute it and/or modify
29 * it under the terms of the GNU General Public License as published by
30 * the Free Software Foundation; either version 2 of the License, or
31 * (at your option) any later version.
32 *
33 * This program is distributed in the hope that it will be useful,
34 * but WITHOUT ANY WARRANTY; without even the implied warranty of
35 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36 * GNU General Public License for more details.
37 *
38 * You should have received a copy of the GNU General Public License
39 * along with this program; if not, write to the Free Software
40 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
41 * **********************************************************************
42 */
43
44 if ( ! defined( 'ABSPATH' ) ) {
45 exit; // Exit if accessed directly.
46 }
47
48 define( 'AMEDEA__FILE', __FILE__ );
49 define( 'AMEDEA__PATH', plugin_dir_path( AMEDEA__FILE ) );
50 define( 'AMEDEA__VERSION', '0.0.4.9' );
51
52 /**
53 * Main venus wp Class
54 *
55 * The init class that runs the Hello World plugin.
56 * Intended To make sure that the plugin's minimum requirements are met.
57 *
58 * You should only modify the constants to match your plugin's needs.
59 *
60 * Any custom code should go inside Plugin Class in the plugin.php file.
61 */
62
63 final class AMEDEA {
64
65 /**
66 * Minimum Elementor Version
67 *
68 * @since 1.0.0
69 * @var string Minimum Elementor version required to run the plugin.
70 */
71 const MINIMUM_ELEMENTOR_VERSION = '3.9.0';
72
73 /**
74 * Minimum Amedea:Core Version
75 *
76 * @since 1.0.0
77 * @var string Amedea:Core version required to run the plugin.
78 */
79 const MINIMUM_AMEDEACORE_VERSION = '0.0.4.7';
80
81 /**
82 * Minimum PHP Version
83 *
84 * @since 1.0.0
85 * @var string Minimum PHP version required to run the plugin.
86 */
87 const MINIMUM_PHP_VERSION = '8.2';
88
89 /**
90 * Constructor
91 *
92 * @since 1.0.0
93 * @access public
94 */
95 public function __construct() {
96
97 // Load translation
98 add_action( 'init', array( $this, 'amedea__i18n' ) );
99
100 // Init Plugin
101 add_action( 'plugins_loaded', array( $this, 'amedea__init' ) );
102
103 //Init Admin Menu
104 add_action( 'admin_menu', array( $this, 'amedea__admin_menu' ) );
105
106 }
107
108 /**
109 * Load Textdomain
110 *
111 * Load plugin localization files.
112 * Fired by `init` action hook.
113 *
114 * @since 1.2.0
115 * @access public
116 */
117 public function amedea__i18n() {
118 load_plugin_textdomain( 'amedea', false, dirname( __FILE__ ) . '/languages' );
119 }
120
121 /**
122 * Initialize the plugin
123 *
124 * Validates that Elementor is already loaded.
125 * Checks for basic plugin requirements, if one check fail don't continue,
126 * if all check have passed include the plugin class.
127 *
128 * Fired by `plugins_loaded` action hook.
129 *
130 * @since 1.2.0
131 * @access public
132 */
133 public function amedea__init() {
134
135 // Check if Elementor installed and activated
136 if ( ! did_action( 'elementor/loaded' ) ) {
137 add_action( 'admin_notices', array( $this, 'amedea__admin_notice' ) );
138 return;
139 }
140
141 // Check for required Elementor version
142 if ( ! version_compare( ELEMENTOR_VERSION, self::MINIMUM_ELEMENTOR_VERSION, '>=' ) ) {
143 add_action( 'admin_notices', array( $this, 'amedea__minimum_elementor_version' ) );
144 return;
145 }
146
147 // Check for required PHP version
148 if ( version_compare( PHP_VERSION, self::MINIMUM_PHP_VERSION, '<' ) ) {
149 add_action( 'admin_notices', array( $this, 'amedea__minimum_php_version' ) );
150 return;
151 }
152
153 // Check verify
154 if (null==get_option('__amedea__isactivated')) {
155 add_action( 'admin_notices', array( $this, 'amedea__verify' ) );
156 }
157
158 //Multinetwork
159 if ( is_multisite() ) {
160 add_action( 'admin_notices', array( $this, 'amedea__multinetwork' ) );
161 }
162
163 add_action( 'admin_notices', array( $this, 'amedea__gsap' ) );
164
165 // Require configuration file
166 require_once( 'config.php' );
167
168 }
169
170 /**
171 * Admin notice
172 *
173 * @since 1.0.0
174 * @access public
175 */
176 public function amedea__admin_notice() {
177 if ( isset( $_GET['activate'] ) ) {
178 unset( $_GET['activate'] );
179 }
180
181 $message = sprintf(
182 /* translators: 1: Plugin name 2: Elementor */
183 esc_html__( '"%1$s" requires "%2$s" to be installed and activated.', 'amedea' ),
184 '<strong>' . esc_html__( 'Amedea', 'amedea' ) . '</strong>',
185 '<strong>' . esc_html__( 'Elementor', 'amedea' ) . '</strong>'
186 );
187
188 $html_message = sprintf( '<div class="notice notice-warning"><p>%1$s</p></div>', $message );
189 echo wp_kses_post( $html_message );
190 }
191
192 /**
193 * Admin notice
194 *
195 * @since 1.0.0
196 * @access public
197 */
198 public function amedea__minimum_elementor_version() {
199 if ( isset( $_GET['activate'] ) ) {
200 unset( $_GET['activate'] );
201 }
202
203 $message = sprintf(
204 /* translators: 1: Plugin name 2: Elementor 3: Required Elementor version */
205 esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'amedea' ),
206 '<strong>' . esc_html__( 'Amedea', 'amedea' ) . '</strong>',
207 '<strong>' . esc_html__( 'Elementor', 'amedea' ) . '</strong>',
208 self::MINIMUM_ELEMENTOR_VERSION
209 );
210
211 $html_message = sprintf( '<div class="notice notice-warning"><p>%1$s</p></div>', $message );
212 echo wp_kses_post( $html_message );
213 }
214
215 /**
216 * Admin notice
217 *
218 * @since 1.0.0
219 * @access public
220 */
221 public function amedea__minimum_php_version() {
222 if ( isset( $_GET['activate'] ) ) {
223 unset( $_GET['activate'] );
224 }
225
226 $message = sprintf(
227 /* translators: 1: Plugin name 2: PHP 3: Required PHP version */
228 esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'amedea' ),
229 '<strong>' . esc_html__( 'Amedea', 'amedea' ) . '</strong>',
230 '<strong>' . esc_html__( 'PHP', 'amedea' ) . '</strong>',
231 self::MINIMUM_PHP_VERSION
232 );
233
234 $html_message = sprintf( '<div class="notice notice-warning"><p>%1$s</p></div>', $message );
235 echo wp_kses_post( $html_message );
236 }
237
238 /**
239 * Admin notice
240 *
241 * @since 1.0.0
242 * @access public
243 */
244 public function amedea__verify() {
245 if ( isset( $_GET['activate'] ) ) {
246 unset( $_GET['activate'] );
247 }
248
249 $message = sprintf(
250 /* translators: 1: Plugin name 2: Elementor */
251 esc_html__( 'If you enjoy using "%1$s", you can consider to "%2$s" with 200+ widgets, updates and rapid support', 'amedea' ),
252 '<strong>' . esc_html__( 'Amedea', 'amedea' ) . '</strong>',
253 '<strong><a href="https://amedeapro.com/go/?p=pro" target="_blank">' . esc_html__( 'GO PRO', 'amedea' ) . '</a></strong>'
254 );
255
256 $html_message = sprintf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message );
257 echo wp_kses_post( $html_message );
258
259 }
260
261 /**
262 * Admin notice
263 *
264 * @since 1.0.0
265 * @access public
266 */
267 public function amedea__gsap() {
268 if ( isset( $_GET['activate'] ) ) {
269 unset( $_GET['activate'] );
270 }
271
272 $message = sprintf(
273 /* translators: 1: Plugin name 2: Elementor */
274 esc_html__( 'Even though GSAP is free to use, due to WordPress license conflict, "%1$s" would require to manual update from "%2$s", some of the features may not work with this version properly.', 'amedea' ),
275 '<strong>' . esc_html__( 'Amedea', 'amedea' ) . '</strong>',
276 '<strong><a href="https://amedeapro.com/limited-version" target="_blank">' . esc_html__( 'Limited version page', 'amedea' ) . '</a></strong>'
277 );
278
279 $html_message = sprintf( '<div class="notice notice-error is-dismissible"><p>%1$s</p></div>', $message );
280 echo wp_kses_post( $html_message );
281
282 }
283
284 /**
285 * Admin notice
286 *
287 * Warning when the site doesn't have a minimum required PHP version.
288 *
289 * @since 1.0.0
290 * @access public
291 */
292 public function amedea__multinetwork() {
293 if ( isset( $_GET['activate'] ) ) {
294 unset( $_GET['activate'] );
295 }
296
297 $message = sprintf(
298 /* translators: 1: Plugin name 2: Elementor */
299 esc_html__( '"%1$s" cannot run under WordPress Network due to %2$s. Please, disable the feature if you would like to use the plugin.', 'amedea' ),
300 '<strong>' . esc_html__( 'Amedea', 'amedea' ) . '</strong>',
301 '<strong><a href="https://amedeapro.com/licenses/" target="_blank">' . esc_html__( 'license issue', 'amedea' ) . '</a></strong>'
302 );
303
304 $html_message = sprintf( '<div class="notice notice-error"><p>%1$s</p></div>', $message );
305 echo wp_kses_post( $html_message );
306
307 }
308
309
310 /**
311 * Settings
312 *
313 * Registers a new settings page under Settings.
314 *
315 * @since 1.0.0
316 * @access public
317 */
318 public function amedea__admin_menu() {
319 add_submenu_page(
320 'options.php',
321 esc_html__( 'Settings', 'amedea' ),
322 esc_html__( 'Settings', 'amedea' ),
323 'manage_options',
324 'amedea',
325 array(
326 $this,
327 'settings_page'
328 )
329 );
330 }
331
332 /**
333 * Callback
334 *
335 * Settings page display callback.
336 *
337 * @since 1.0.0
338 * @access public
339 */
340 public function settings_page() {
341
342 // Require configuration file
343 require_once( 'welcome.php' );
344 new amedea__welcome();
345
346 }
347
348 }
349
350 /**
351 * Plugin settings
352 *
353 * Creates a link to the plugin details page
354 *
355 * @since 1.0.0
356 * @access public
357 */
358 function amedea__settings( $links ) {
359
360 if (null==get_option('__amedea__isactivated')) {
361 $getPro = esc_html__( 'Limited Version', 'amedea' );
362 $links[] = '' . $getPro . '';
363 }
364 return $links;
365 }
366
367 //Init Settings
368 add_filter('plugin_action_links_'.plugin_basename(__FILE__), 'amedea__settings');
369
370 new AMEDEA();
371