PluginProbe ʕ •ᴥ•ʔ
Royal Addons for Elementor – Addons and Templates Kit for Elementor / 1.3.984
Royal Addons for Elementor – Addons and Templates Kit for Elementor v1.3.984
1.7.1062 1.7.1061 1.7.1060 1.7.1059 1.7.1058 trunk 1.0.0 1.1.0 1.2 1.3 1.3.1 1.3.2 1.3.21 1.3.22 1.3.23 1.3.24 1.3.25 1.3.26 1.3.27 1.3.28 1.3.29 1.3.30 1.3.31 1.3.32 1.3.33 1.3.34 1.3.35 1.3.36 1.3.37 1.3.38 1.3.39 1.3.40 1.3.41 1.3.42 1.3.43 1.3.44 1.3.45 1.3.46 1.3.47 1.3.48 1.3.49 1.3.50 1.3.51 1.3.52 1.3.53 1.3.54 1.3.55 1.3.56 1.3.57 1.3.58 1.3.59 1.3.60 1.3.61 1.3.62 1.3.63 1.3.64 1.3.65 1.3.66 1.3.67 1.3.68 1.3.69 1.3.70 1.3.71 1.3.72 1.3.73 1.3.74 1.3.75 1.3.76 1.3.77 1.3.78 1.3.79 1.3.80 1.3.81 1.3.82 1.3.83 1.3.84 1.3.85 1.3.86 1.3.87 1.3.88 1.3.89 1.3.90 1.3.91 1.3.92 1.3.93 1.3.94 1.3.95 1.3.96 1.3.97 1.3.971 1.3.972 1.3.973 1.3.974 1.3.975 1.3.976 1.3.977 1.3.978 1.3.979 1.3.980 1.3.981 1.3.982 1.3.983 1.3.984 1.3.985 1.3.986 1.3.987 1.7.1 1.7.1001 1.7.1002 1.7.1003 1.7.1004 1.7.1005 1.7.1006 1.7.1007 1.7.1008 1.7.1009 1.7.1010 1.7.1011 1.7.1012 1.7.1013 1.7.1014 1.7.1015 1.7.1016 1.7.1017 1.7.1018 1.7.1019 1.7.1020 1.7.1021 1.7.1022 1.7.1023 1.7.1024 1.7.1025 1.7.1026 1.7.1027 1.7.1028 1.7.1029 1.7.1030 1.7.1031 1.7.1032 1.7.1033 1.7.1034 1.7.1035 1.7.1036 1.7.1037 1.7.1038 1.7.1039 1.7.1040 1.7.1041 1.7.1042 1.7.1043 1.7.1044 1.7.1045 1.7.1046 1.7.1047 1.7.1048 1.7.1049 1.7.1050 1.7.1051 1.7.1052 1.7.1053 1.7.1054 1.7.1055 1.7.1056 1.7.1057
royal-elementor-addons / wpr-addons.php
royal-elementor-addons Last commit date
admin 1 year ago assets 1 year ago base 1 year ago classes 1 year ago extensions 1 year ago freemius 1 year ago includes 1 year ago languages 1 year ago modules 1 year ago plugin.php 1 year ago readme.txt 1 year ago wpml-config.xml 1 year ago wpr-addons.php 1 year ago
wpr-addons.php
278 lines
1 <?php
2 /*
3 * Plugin Name: Royal Elementor Addons
4 * Description: The only plugin you need for Elementor page builder.
5 * Plugin URI: https://royal-elementor-addons.com/
6 * Author: WP Royal
7 * Version: 1.3.984
8 * License: GPLv3
9 * Author URI: https://royal-elementor-addons.com/
10 * Elementor tested up to: 5.0
11 * Elementor Pro tested up to: 5.0
12 *
13 * Text Domain: wpr-addons
14 */
15
16 if ( ! defined( 'ABSPATH' ) ) {
17 exit; // Exit if accessed directly.
18 }
19
20 define( 'WPR_ADDONS_VERSION', '1.3.984' );
21
22 define( 'WPR_ADDONS__FILE__', __FILE__ );
23 define( 'WPR_ADDONS_PLUGIN_BASE', plugin_basename( WPR_ADDONS__FILE__ ) );
24 define( 'WPR_ADDONS_PATH', plugin_dir_path( WPR_ADDONS__FILE__ ) );
25 define( 'WPR_ADDONS_MODULES_PATH', WPR_ADDONS_PATH . 'modules/' );
26 define( 'WPR_ADDONS_URL', plugins_url( '/', WPR_ADDONS__FILE__ ) );
27 define( 'WPR_ADDONS_ASSETS_URL', WPR_ADDONS_URL . 'assets/' );
28 define( 'WPR_ADDONS_MODULES_URL', WPR_ADDONS_URL . 'modules/' );
29
30 /**
31 * Feemius Integration
32 */
33 if ( function_exists( 'wpr_fs' ) ) {
34 wpr_fs()->set_basename( false, __FILE__ );
35 } else {
36 $register_freemius = true;
37
38 if ( get_option('royal_elementor_addons_pro_activation_time') ) {
39 $register_freemius = false;
40 }
41
42 if ( $register_freemius ) {
43 // Create a helper function for easy SDK access.
44 function wpr_fs() {
45 global $wpr_fs;
46
47 if ( ! isset( $wpr_fs ) ) {
48 // Include Freemius SDK.
49 require_once dirname(__FILE__) . '/freemius/start.php';
50
51 $wpr_fs = fs_dynamic_init( array(
52 'id' => '8416',
53 'slug' => 'wpr-addons',
54 'premium_slug' => 'wpr-addons-pro',
55 'type' => 'plugin',
56 'public_key' => 'pk_a0b21b234a7c9581a555b9ee9f28a',
57 'is_premium' => false,
58 'has_premium_version' => true,
59 'has_paid_plans' => false,
60 'has_addons' => false,
61 'has_affiliation' => 'selected',
62 'menu' => array(
63 'slug' => 'wpr-addons',
64 'first-path' => 'admin.php?page=wpr-templates-kit',
65 'support' => false,
66 'affiliation' => true,
67 'pricing' => false,
68 ),
69 ) );
70 }
71
72 return $wpr_fs;
73 }
74
75 // Init Freemius.
76 wpr_fs();
77 // Signal that SDK was initiated.
78 do_action( 'wpr_fs_loaded' );
79
80 wpr_fs()->add_filter( 'show_deactivation_subscription_cancellation', '__return_false' );
81 wpr_fs()->add_filter( 'deactivate_on_activation', '__return_false' );
82
83 function disable_contact_for_free_users( $is_visible, $menu_id ) {
84
85 if ( 'contact' != $menu_id ) {
86 return $is_visible;
87 }
88
89 return wpr_fs()->can_use_premium_code();
90 }
91
92 wpr_fs()->add_filter( 'is_submenu_visible', 'disable_contact_for_free_users', 10, 2 );
93
94 }
95 }
96
97 /**
98 * Load gettext translate for our text domain.
99 *
100 * @since 1.0.0
101 *
102 * @return void
103 */
104 function wpr_addons_load_plugin() {
105 load_plugin_textdomain('wpr-addons', false, dirname(plugin_basename(__FILE__)) . '/languages/');
106
107 if ( ! did_action( 'elementor/loaded' ) ) {
108 add_action( 'admin_notices', 'wpr_addons_fail_load' );
109 return;
110 }
111
112 $elementor_version_required = '2.0.0';
113 if ( ! version_compare( ELEMENTOR_VERSION, $elementor_version_required, '>=' ) ) {
114 add_action( 'admin_notices', 'wpr_addons_fail_load_out_of_date' );
115 return;
116 }
117
118 require( WPR_ADDONS_PATH . 'plugin.php' );
119 }
120 add_action( 'plugins_loaded', 'wpr_addons_load_plugin' );
121
122 /**
123 * Show in WP Dashboard notice about the plugin is not activated.
124 *
125 * @since 1.0.0
126 *
127 * @return void
128 */
129 function wpr_addons_fail_load() {
130 $screen = get_current_screen();
131 if ( isset( $screen->parent_file ) && 'plugins.php' === $screen->parent_file && 'update' === $screen->id ) {
132 return;
133 }
134
135 $plugin = 'elementor/elementor.php';
136
137 if ( _is_elementor_installed() ) {
138 if ( ! current_user_can( 'activate_plugins' ) ) {
139 return;
140 }
141
142 $activation_url = wp_nonce_url( 'plugins.php?action=activate&amp;plugin='. $plugin .'&amp;plugin_status=all&amp;paged=1&amp;s', 'activate-plugin_'. $plugin );
143
144 $message = '<p>' . esc_html__( 'Royal Elementor Addons is not working because you need to activate the Elementor plugin.', 'wpr-addons' ) . '</p>';
145 $message .= '<p>' . sprintf( '<a href="%s" class="button-primary">%s</a>', $activation_url, esc_html__( 'Activate Elementor Now', 'wpr-addons' ) ) . '</p>';
146 } else {
147 if ( ! current_user_can( 'install_plugins' ) ) {
148 return;
149 }
150
151 $install_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=elementor' ), 'install-plugin_elementor' );
152
153 $message = '<p>' . esc_html__( 'Royal Elementor Addons is not working because you need to install the Elemenor plugin', 'wpr-addons' ) . '</p>';
154 $message .= '<p>' . sprintf( '<a href="%s" class="button-primary">%s</a>', $install_url, esc_html__( 'Install Elementor Now', 'wpr-addons' ) ) . '</p>';
155 }
156
157 echo '<div class="error"><p>'. wp_kses_post($message) .'</p></div>';
158 }
159
160 function wpr_addons_fail_load_out_of_date() {
161 if ( ! current_user_can( 'update_plugins' ) ) {
162 return;
163 }
164
165 $file_path = 'elementor/elementor.php';
166
167 $upgrade_link = wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $file_path, 'upgrade-plugin_'. $file_path );
168 $message = '<p>' . esc_html__( 'Royal Elementor Addons is not working because you are using an old version of Elementor.', 'wpr-addons' ) . '</p>';
169 $message .= '<p>' . sprintf( '<a href="%s" class="button-primary">%s</a>', $upgrade_link, esc_html__( 'Update Elementor Now', 'wpr-addons' ) ) . '</p>';
170
171 echo '<div class="error">'. wp_kses_post($message) .'</div>';
172 }
173
174 if ( ! function_exists( '_is_elementor_installed' ) ) {
175
176 function _is_elementor_installed() {
177 $file_path = 'elementor/elementor.php';
178 $installed_plugins = get_plugins();
179
180 return isset( $installed_plugins[ $file_path ] );
181 }
182 }
183
184
185 /**
186 * Redirect to Options Page
187 *
188 * @since 1.0.0
189 *
190 */
191
192 function wpr_plugin_activate() {
193 set_transient('wpr_plugin_do_activation_redirect', true, 60);
194 }
195
196 function wpr_plugin_redirect() {
197 if (get_transient('wpr_plugin_do_activation_redirect')) {
198 delete_transient('wpr_plugin_do_activation_redirect');
199
200 if ( !isset($_GET['activate-multi']) ) {
201 wp_redirect('admin.php?page=wpr-addons');
202 }
203 }
204 }
205
206 if ( did_action( 'elementor/loaded' ) ) {
207
208 register_activation_hook(__FILE__, 'wpr_plugin_activate');
209 add_action('admin_init', 'wpr_plugin_redirect');
210 }
211
212 // Set Plugin Activation Time
213 function royal_elementor_addons_activation_time() {//TODO: Try to locate this in rating-notice.php later if possible
214 if ( false === get_option( 'royal_elementor_addons_activation_time' ) ) {
215 add_option( 'royal_elementor_addons_activation_time', absint(intval(strtotime('now'))) );
216 }
217
218 if ( false === get_option( 'royal_elementor_addons_activation_time_for_sale' ) ) {
219 add_option( 'royal_elementor_addons_activation_time_for_sale', absint(intval(strtotime('now'))) );
220 }
221
222 if ( get_option('wpr_plugin_update_dismiss_notice_' . get_plugin_data(WPR_ADDONS__FILE__)['Version']) ) {
223 delete_option('wpr_plugin_update_dismiss_notice_' . get_plugin_data(WPR_ADDONS__FILE__)['Version']);
224 }
225 }
226
227 register_activation_hook( __FILE__, 'royal_elementor_addons_activation_time' );
228
229 // Delete Plugin Update Notice
230 function royal_elementor_addons_deactivate() {
231 if ( get_option('wpr_plugin_update_dismiss_notice_' . get_plugin_data(WPR_ADDONS__FILE__)['Version']) ) {
232 delete_option('wpr_plugin_update_dismiss_notice_' . get_plugin_data(WPR_ADDONS__FILE__)['Version']);
233 }
234
235 if ( get_option('wpr_pro_features_dismiss_notice_' . get_plugin_data(WPR_ADDONS__FILE__)['Version']) ) {
236 delete_option('wpr_pro_features_dismiss_notice_' . get_plugin_data(WPR_ADDONS__FILE__)['Version']);
237 }
238 }
239
240 // hook already exists with template kits notice
241 register_deactivation_hook( __FILE__, 'royal_elementor_addons_deactivate' );
242
243 function wpr_script_loader_tag( $tag, $handle ) {
244 if ( 'jquery-core' !== $handle && 'jquery-migrate' !== $handle && 'wpr-addons-js' !== $handle && 'wpr-isotope' !== $handle ) {
245 return $tag;
246 }
247
248
249 // Modern implementations may employ WP_HTML_Tag_Processor here.
250 // return str_replace( ' src=', ' defer src=', $tag );
251 return str_replace( ' src', ' data-cfasync="false" src', $tag );
252 }
253
254 function exclude_wpr_scripts_from_wp_optimize( $excluded_handles ) {
255 // Replace 'my-script-handle' with the handle of the script you want to exclude.
256 $excluded_handles[] = 'wpr-addons-js';
257
258 return $excluded_handles;
259 }
260
261 function exclude_wpr_styles_from_wp_optimize( $excluded_handles ) {
262 // Replace 'my-style-handle' with the handle of the style you want to exclude.
263 $excluded_handles[] = 'wpr-addons-css';
264
265 return $excluded_handles;
266 }
267
268 if ( 'on' === get_option('wpr_ignore_wp_rocket_js', 'on') ) {
269 add_filter( 'script_loader_tag', 'wpr_script_loader_tag', 10, 2 );
270 }
271
272 if ( 'on' === get_option('wpr_ignore_wp_optimize_js', 'on') ) {
273 add_filter( 'wpo_minify_excluded_js_handles', 'exclude_wpr_scripts_from_wp_optimize' );
274 }
275
276 if ( 'on' === get_option('wpr_ignore_wp_optimize_css', 'on') ) {
277 add_filter( 'wpo_minify_excluded_css_handles', 'exclude_wpr_styles_from_wp_optimize' );
278 }