PluginProbe
Elementor Website Builder – more than just a page builder / 3.18.3
Elementor Website Builder – more than just a page builder v3.18.3
4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 All 457 releases
← All changes | modules/apps/admin-apps-page.php +361 -97 4.2.0-dev2 → 3.18.3 View file →
@@ -1,11 +1,7 @@
1 1 <?php
2 2 namespace Elementor\Modules\Apps;
3 3
4 -use Elementor\Core\Isolation\Wordpress_Adapter;
5 -use Elementor\Core\Isolation\Plugin_Status_Adapter;
6 -use Elementor\Includes\EditorAssetsAPI;
7 -
8 4 if ( ! defined( 'ABSPATH' ) ) {
9 5 exit; // Exit if accessed directly.
10 6 }
11 7
@@ -10,21 +6,15 @@
10 6 }
11 7
12 8 class Admin_Apps_Page {
13 9
14 - const APPS_URL = 'https://assets.elementor.com/apps/v1/apps.json';
15 -
16 - private static ?Wordpress_Adapter $wordpress_adapter = null;
17 -
18 - private static ?Plugin_Status_Adapter $plugin_status_adapter = null;
19 -
20 10 public static function render() {
21 11 ?>
22 12 <div class="wrap e-a-apps">
23 13
24 14 <div class="e-a-page-title">
25 - <h2><?php echo esc_html__( 'Popular Add-ons, New Possibilities.', 'elementor' ); ?></h2>
26 - <p><?php echo esc_html__( 'Boost your web-creation process with add-ons, plugins, and more tools specially selected to unleash your creativity, increase productivity, and enhance your Elementor-powered website.', 'elementor' ); ?>*<br>
15 + <h2><?php echo esc_html__( 'Popular Apps, New Possibilities.', 'elementor' ); ?></h2>
16 + <p><?php echo esc_html__( 'Boost your web-creation process with add-ons, plugins, and more tools specially selected to unleash your creativity, increase productivity, and enhance your Elementor-powered website.', 'elementor' ); ?><br>
27 17 <a href="https://go.elementor.com/wp-dash-apps-about-apps-page/" target="_blank"><?php echo esc_html__( 'Learn more about this page.', 'elementor' ); ?></a>
28 18 </p>
29 19 </div>
30 20
@@ -31,9 +21,9 @@
31 21 <div class="e-a-list">
32 22 <?php self::render_plugins_list(); ?>
33 23 </div>
34 24 <div class="e-a-page-footer">
35 - <p>*<?php echo esc_html__( 'Please note that certain tools and services on this page are developed by third-party companies and are not part of Elementor\'s suite of products or support. Before using them, we recommend independently evaluating them. Additionally, when clicking on their action buttons, you may be redirected to an external website.', 'elementor' ); ?></p>
25 + <p><?php echo esc_html__( 'Please note that certain services on this page are developed by third-party companies. When you click on the their action button, you may be redirected to an external website.', 'elementor' ); ?></p>
36 26 </div>
37 27 </div>
38 28 <?php
39 29 }
@@ -45,119 +35,393 @@
45 35 self::render_plugin_item( $plugin );
46 36 }
47 37 }
48 38
49 - private static function get_plugins(): array {
50 - if ( ! self::$wordpress_adapter ) {
51 - self::$wordpress_adapter = new Wordpress_Adapter();
52 - }
39 + private static function get_plugins() : array {
40 + $images_url = static::get_images_url();
53 41
54 - if ( ! self::$plugin_status_adapter ) {
55 - self::$plugin_status_adapter = new Plugin_Status_Adapter( self::$wordpress_adapter );
56 - }
42 + $plugins = [
43 + [
44 + 'name' => 'Elementor AI',
45 + 'author' => 'Elementor',
46 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-elementor-ai/',
47 + 'badge' => 'Premium',
48 + 'description' => 'Boost creativity with Elementor AI. Craft & enhance copy, create custom CSS & Code, and generate images to elevate your website.',
49 + 'action_label' => 'Let\'s Go',
50 + 'action_url' => 'https://go.elementor.com/wp-dash-apps-go-to-elementor-ai/',
51 + 'image' => $images_url . 'elementor.svg',
52 + ],
53 + [
54 + 'name' => 'JetPlugins Add-ons',
55 + 'author' => 'Crocoblock',
56 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-crocoblock/',
57 + 'badge' => '10% Off',
58 + 'description' => 'Unlock dynamic widgets, e-commerce features, and a powerful filtering system for enhanced website capabilities.',
59 + 'offering' => 'Use coupon code: onlyforelementor',
60 + 'action_label' => 'Let\'s Go',
61 + 'action_url' => 'https://go.elementor.com/wp-dash-apps-go-to-crocoblock/',
62 + 'image' => $images_url . 'crocoblock.png',
63 + ],
64 + [
65 + 'name' => 'Unlimited Elements',
66 + 'author' => 'Unlimited Group',
67 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-unlimited-elements/',
68 + 'badge' => '20% Off',
69 + 'description' => 'An all-in-one plugin that instantly gives you the most advanced tools to make better Elementor websites faster.',
70 + 'offering' => 'Use coupon code: elementor20',
71 + 'action_label' => 'Let\'s Go',
72 + 'action_url' => 'https://go.elementor.com/wp-dash-apps-go-to-unlimited-elements/',
73 + 'image' => $images_url . 'unlimited-elements.gif',
74 + ],
75 + [
76 + 'name' => 'Essential Addons',
77 + 'author' => 'WPDeveloper',
78 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-wpdeveloper/',
79 + 'badge' => '20% Off',
80 + 'description' => 'Essential Addons is the ultimate library for Elementor, with 1 Million+ users and 100+ widgets & extensions to enhance web-building & design experiences.',
81 + 'offering' => 'Use coupon code: elementor20',
82 + 'action_label' => 'Let\'s Go',
83 + 'action_url' => 'https://go.elementor.com/wp-dash-apps-go-to-wpdeveloper/',
84 + 'image' => $images_url . 'essential-addons.svg',
85 + ],
86 + [
87 + 'name' => 'Element Pack Pro',
88 + 'author' => 'BdThemes Ltd',
89 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-element-pack-pro/',
90 + 'description' => 'Revolutionize your web design experience with 250+ powerful features, tailored for designers of all skill levels. Create websites without breaking a sweat!',
91 + 'badge' => '10% Off',
92 + 'offering' => 'Discount is automatically applied',
93 + 'action_label' => 'Let\'s Go',
94 + 'action_url' => 'https://go.elementor.com/wp-dash-apps-go-to-element-pack-pro/',
95 + 'image' => $images_url . 'element-pack.gif',
96 + ],
97 + [
98 + 'name' => 'Ultimate Addons',
99 + 'author' => 'Brainstorm Force',
100 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-ultimate-elementor/',
101 + 'description' => 'Ultimate Addons for Elementor is a powerful plugin with advanced widgets, templates, and features for designing stunning websites using Elementor.',
102 + 'badge' => '25% Off',
103 + 'offering' => 'Discount is automatically applied',
104 + 'action_label' => 'Let\'s Go',
105 + 'action_url' => 'https://go.elementor.com/wp-dash-apps-go-to-ultimate-elementor/',
106 + 'image' => $images_url . 'uae.svg',
107 + ],
108 + [
109 + 'name' => 'Fiverr Logo Maker',
110 + 'author' => 'Fiverr',
111 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-fiverr/',
112 + 'description' => 'Craft your brand\'s identity on Fiverr Logo Maker. Upload logo, choose typography & colors for versatile variations. Elevate your brand effortlessly.',
113 + 'badge' => 'Premium',
114 + 'action_label' => 'Let\'s Go',
115 + 'action_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-fiverr/',
116 + 'image' => $images_url . 'fiverr.svg',
117 + ],
118 + [
119 + 'name' => 'Hover Custom Domains',
120 + 'author' => 'Tucows',
121 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-hover/',
122 + 'description' => 'Elevate your website with a custom domain for maximum online impact. Enjoy exclusive Elementor user discounts through our Hover partnership.',
123 + 'badge' => '10% Off',
124 + 'offering' => 'Discount is automatically applied',
125 + 'action_label' => 'Let\'s Go',
126 + 'action_url' => 'https://go.elementor.com/wp-dash-apps-go-to-hover/',
127 + 'image' => $images_url . 'hover.svg',
128 + ],
129 + [
130 + 'name' => 'Gravity Forms',
131 + 'author' => 'Gravity Forms',
132 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-gravityforms/',
133 + 'description' => 'Millions trust Gravity Forms for versatile forms—boost email lists, create quizzes, accept payments, and more!',
134 + 'badge' => '30% Off',
135 + 'offering' => 'Discount is automatically applied',
136 + 'action_label' => 'Let\'s Go',
137 + 'action_url' => 'https://go.elementor.com/wp-dash-apps-go-to-gravityforms/',
138 + 'image' => $images_url . 'gravity-forms.svg',
139 + ],
140 + [
141 + 'name' => 'TranslatePress',
142 + 'author' => 'Reflection Media SRL',
143 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-translatepress/',
144 + 'description' => 'TranslatePress is the easiest way to translate your WordPress site and go multilingual. It\'s a proven way to grow multilingual traffic and reach more people.',
145 + 'badge' => '15% Off',
146 + 'offering' => 'Discount is automatically applied',
147 + 'action_label' => 'Let\'s Go',
148 + 'action_url' => 'https://go.elementor.com/wp-dash-apps-go-to-translatepress/',
149 + 'image' => $images_url . 'translate-press.png',
150 + ],
151 + [
152 + 'name' => 'Profile Builder',
153 + 'author' => 'Cozmoslabs',
154 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-cozmoslabs-wordpress-profile-builder/',
155 + 'description' => 'Create beautiful user registration forms, user profiles and member directories with the #1 user management tool for modern websites.',
156 + 'badge' => '15% Off',
157 + 'offering' => 'Discount is automatically applied',
158 + 'action_label' => 'Let\'s Go',
159 + 'action_url' => 'https://go.elementor.com/wp-dash-apps-go-to-cozmoslabs-wordpress-profile-builder/',
160 + 'image' => $images_url . 'profile-builder.svg',
161 + ],
162 + [
163 + 'name' => 'Paid Member Subscriptions',
164 + 'author' => 'Cozmoslabs',
165 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-cozmoslabs-wordpress-paid-member-subscriptions/',
166 + 'description' => 'Launch your membership site, online course or paid community, increase conversions and generate subscription revenue with one flexible and seamless solution.',
167 + 'badge' => '15% Off',
168 + 'offering' => 'Discount is automatically applied',
169 + 'action_label' => 'Let\'s Go',
170 + 'action_url' => 'https://go.elementor.com/wp-dash-apps-go-to-cozmoslabs-wordpress-paid-member-subscriptions/',
171 + 'image' => $images_url . 'paid-member-subscriptions.svg',
172 + ],
173 + [
174 + 'name' => 'BetterDocs',
175 + 'author' => 'WPDeveloper',
176 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-wpdeveloper-betterdocs/',
177 + 'description' => 'BetterDocs is the ultimate WordPress knowledge base tool to create powerful documentation, multiple or internal knowledge bases, FAQ sections, and more.',
178 + 'badge' => '20% Off',
179 + 'offering' => 'Use coupon code: Elementor20',
180 + 'action_label' => 'Let\'s Go',
181 + 'action_url' => 'https://go.elementor.com/wp-dash-apps-go-to-wpdeveloper-betterdocs/',
182 + 'image' => $images_url . 'better-docs.svg',
183 + ],
184 + [
185 + 'name' => 'SchedulePress',
186 + 'author' => 'WPDeveloper',
187 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-wpdeveloper-wp-scheduled-posts/',
188 + 'description' => 'SchedulePress is the advanced WordPress content management solution for effortlessly scheduling site content & sharing on multiple social media platforms.',
189 + 'badge' => '20% Off',
190 + 'offering' => 'Use coupon code: Elementor20',
191 + 'action_label' => 'Let\'s Go',
192 + 'action_url' => 'https://go.elementor.com/wp-dash-apps-go-to-wpdeveloper-wp-scheduled-posts/',
193 + 'image' => $images_url . 'schedule-press.svg',
194 + ],
195 + [
196 + 'name' => 'BetterPayments',
197 + 'author' => 'WPDeveloper',
198 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-better-payment/',
199 + 'description' => 'Better Payment is an advanced plugin to integrate payment gateways, like PayPal & Stripe, into your WordPress website to accept, manage & track payments.',
200 + 'badge' => '20% Off',
201 + 'offering' => 'Use coupon code: Elementor20',
202 + 'action_label' => 'Let\'s Go',
203 + 'action_url' => 'https://go.elementor.com/wp-dash-apps-go-to-better-payment/',
204 + 'image' => $images_url . 'better-payment.svg',
205 + ],
206 + [
207 + 'name' => 'EmbedPress',
208 + 'author' => 'WPDeveloper',
209 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-embedpress/',
210 + 'description' => 'EmbedPress is the ultimate WordPress plugin to easily embed multimedia content from 150+ sources and to boost website engagement & interaction.',
211 + 'badge' => '20% Off',
212 + 'offering' => 'Use coupon code: Elementor20',
213 + 'action_label' => 'Let\'s Go',
214 + 'action_url' => 'https://go.elementor.com/wp-dash-apps-go-to-embedpress/',
215 + 'image' => $images_url . 'embed-press.svg',
216 + ],
217 + [
218 + 'name' => 'NotificationX',
219 + 'author' => 'WPDeveloper',
220 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-notificationx/',
221 + 'description' => 'NotificationX is a leading WordPress FOMO & social proof marketing tool to create powerful notification alerts that boost site credibility and conversion.',
222 + 'badge' => '20% Off',
223 + 'offering' => 'Use coupon code: Elementor20',
224 + 'action_label' => 'Let\'s Go',
225 + 'action_url' => 'https://go.elementor.com/wp-dash-apps-go-to-notificationx/',
226 + 'image' => $images_url . 'notification-x.svg',
227 + ],
228 + [
229 + 'name' => 'BetterLinks',
230 + 'author' => 'WPDeveloper',
231 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-betterlinks/',
232 + 'description' => 'BetterLinks is the finest WordPress link management tool to easily create, shorten, manage, track, and analyze any website URLs and marketing campaigns.',
233 + 'badge' => '20% Off',
234 + 'offering' => 'Use coupon code: Elementor20',
235 + 'action_label' => 'Let\'s Go',
236 + 'action_url' => 'https://go.elementor.com/wp-dash-apps-go-to-betterlinks/',
237 + 'image' => $images_url . 'better-links.svg',
238 + ],
239 + [
240 + 'name' => 'ShortPixel',
241 + 'author' => 'ShortPixel',
242 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-shortpixel/',
243 + 'description' => 'Optimize images, PDFs and create WebP/AVIF version of all your website\'s images with an easy-to-use and lightweight plugin with great support.',
244 + 'action_label' => 'Let\'s Go',
245 + 'action_url' => 'https://go.elementor.com/wp-dash-apps-go-to-shortpixel/',
246 + 'image' => $images_url . 'shortpixel.png',
247 + ],
248 + [
249 + 'name' => 'Solid WP',
250 + 'author' => 'Stellar WP',
251 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-solid-wp/',
252 + 'description' => 'SolidWP provides best-in-case security, backups, and site maintenance plugins – the backbone of high-performing websites.',
253 + 'action_label' => 'Let\'s Go',
254 + 'action_url' => 'https://go.elementor.com/wp-dash-apps-go-to-solid-wp/',
255 + 'image' => $images_url . 'solidwp.png',
256 + ],
257 + [
258 + 'name' => 'The Events Calendar',
259 + 'author' => 'Stellar WP',
260 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-the-events-calendar/',
261 + 'description' => 'The Events Calendar is an essential plugin for seamless event management. Perfect for businesses, organizations & individuals hosting events of any scale.',
262 + 'action_label' => 'Let\'s Go',
263 + 'action_url' => 'https://go.elementor.com/wp-dash-apps-go-to-the-events-calendar/',
264 + 'image' => $images_url . 'tec.png',
265 + ],
266 + [
267 + 'name' => 'GiveWP',
268 + 'author' => 'Stellar WP',
269 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-give-wp/',
270 + 'description' => 'GiveWP is a WordPress plugin for nonprofit fundraising. Tailored for charities and organizations, simplifying online donations and boosting impact.',
271 + 'action_label' => 'Let\'s Go',
272 + 'action_url' => 'https://go.elementor.com/wp-dash-apps-go-to-give-wp/',
273 + 'image' => $images_url . 'give.svg',
274 + ],
275 + [
276 + 'name' => 'LearnDash',
277 + 'author' => 'Stellar WP',
278 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-learndash/',
279 + 'description' => 'LearnDash is a best-in-class LMS platform empowering educators, trainers, and businesses to create engaging online learning courses on WordPress.',
280 + 'action_label' => 'Let\'s Go',
281 + 'action_url' => 'https://go.elementor.com/wp-dash-apps-go-to-learndash/',
282 + 'image' => $images_url . 'learndash.svg',
283 + ],
284 + [
285 + 'name' => 'Restrict Content Pro',
286 + 'author' => 'Stellar WP',
287 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-restrict-content-pro/',
288 + 'description' => 'RCP is a WordPress plugin for effortless membership management and monetization, ideal for businesses & content creators seeking subscription-based models.',
289 + 'action_label' => 'Let\'s Go',
290 + 'action_url' => 'https://go.elementor.com/wp-dash-apps-go-to-restrict-content-pro/',
291 + 'image' => $images_url . 'rcp.svg',
292 + ],
293 + [
294 + 'name' => 'Weglot',
295 + 'author' => 'Weglot',
296 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-weglot/',
297 + 'description' => 'Weglot is one of the best WordPress multilingual plugins to translate and display your website in multiple languages.',
298 + 'action_label' => 'Let\'s Go',
299 + 'action_url' => 'https://go.elementor.com/wp-dash-apps-go-to-weglot/',
300 + 'image' => $images_url . 'weglot.svg',
301 + ],
302 + [
303 + 'name' => 'Draw Attention',
304 + 'author' => 'N Squared',
305 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-draw-attention/',
306 + 'description' => 'Easy to use drawing tool for creating interactive images (fully responsive image maps). Highlight sections of your images with clickable hotspots!',
307 + 'action_label' => 'Let\'s Go',
308 + 'action_url' => 'https://go.elementor.com/wp-dash-apps-go-to-draw-attention/',
309 + 'image' => $images_url . 'draw-attention.png',
310 + ],
311 + [
312 + 'name' => 'Simply Schedule Appointments',
313 + 'author' => 'N Squared',
314 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-simply-schedule-appointments/',
315 + 'description' => 'Meet the powerful WordPress booking plugin with built-in Elementor widgets, easy custom styling, unlimited booking calendars, and tons of integrations!',
316 + 'action_label' => 'Let\'s Go',
317 + 'action_url' => 'https://go.elementor.com/wp-dash-apps-go-to-simply-schedule-appointments/',
318 + 'image' => $images_url . 'ssa.png',
319 + ],
320 + ];
57 321
58 - $apps = static::get_remote_apps();
322 + $wporg_plugins = [
323 + [
324 + 'file_path' => 'aryo-activity-log/aryo-activity-log.php',
325 + 'name' => 'Activity Log',
326 + 'author' => 'Activity Log Team',
327 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-activity-log/',
328 + 'badge' => 'Free',
329 + 'description' => 'Track user activity easily. Discover who does what on your website and perform a comprehensive security audit for peace of mind.',
330 + 'learn_more_url' => 'https://go.elementor.com/wp-dash-apps-learn-more-activity-log/',
331 + 'action_label' => 'Install',
332 + 'action_url' => '#',
333 + 'image' => $images_url . 'activity-log.png',
334 + 'target' => '_self',
335 + ],
336 + [
337 + 'file_path' => 'pojo-accessibility/pojo-accessibility.php',
338 + 'name' => 'One Click Accessibility',
339 + 'author' => 'Accessibility Team',
340 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-wpaccessibility/',
341 + 'badge' => 'Free',
342 + 'description' => 'The fastest plugin to enhance WordPress website accessibility. Empower your website to be user-friendly for all visitors.',
343 + 'learn_more_url' => 'https://go.elementor.com/wp-dash-apps-learn-more-wpaccessibility/',
344 + 'action_label' => 'Install',
345 + 'action_url' => '#',
346 + 'image' => $images_url . 'one-click-accessibility.png',
347 + 'target' => '_self',
348 + ],
349 + ];
59 350
60 - return static::filter_apps( $apps );
61 - }
62 -
63 - private static function get_remote_apps() {
64 - $editor_assets_api = new EditorAssetsAPI( [
65 - EditorAssetsAPI::ASSETS_DATA_URL => static::APPS_URL,
66 - EditorAssetsAPI::ASSETS_DATA_TRANSIENT_KEY => '_elementor_apps_data',
67 - EditorAssetsAPI::ASSETS_DATA_KEY => 'apps',
68 - ] );
69 -
70 - return $editor_assets_api->get_assets_data();
71 - }
72 -
73 - private static function filter_apps( $apps ) {
74 - $filtered_apps = [];
75 -
76 - foreach ( $apps as $app ) {
77 - if ( static::is_wporg_app( $app ) ) {
78 - $app = static::filter_wporg_app( $app );
351 + foreach ( $wporg_plugins as $wporg_plugin_data ) {
352 + if ( static::is_plugin_activated( $wporg_plugin_data['file_path'] ) ) {
353 + continue;
79 354 }
80 355
81 - if ( static::is_ecom_app( $app ) ) {
82 - $app = static::filter_ecom_app( $app );
356 + if ( static::is_plugin_installed( $wporg_plugin_data['file_path'] ) ) {
357 + if ( current_user_can( 'activate_plugins' ) ) {
358 + $wporg_plugin_data['action_label'] = 'Activate';
359 + $wporg_plugin_data['action_url'] = static::get_activate_plugin_url( $wporg_plugin_data['file_path'] );
360 + } else {
361 + $wporg_plugin_data['action_label'] = 'Cannot Activate';
362 + $wporg_plugin_data['action_url'] = '#';
363 + }
364 + } else {
365 + if ( current_user_can( 'install_plugins' ) ) {
366 + $wporg_plugin_data['action_label'] = 'Install';
367 + $wporg_plugin_data['action_url'] = static::get_install_plugin_url( $wporg_plugin_data['file_path'] );
368 + } else {
369 + $wporg_plugin_data['action_label'] = 'Cannot Install';
370 + $wporg_plugin_data['action_url'] = '#';
371 + }
83 372 }
84 373
85 - if ( empty( $app ) ) {
86 - continue;
87 - }
374 + array_unshift( $plugins, $wporg_plugin_data );
375 + }
88 376
89 - $filtered_apps[] = $app;
377 + if ( ! static::is_elementor_pro_installed() ) {
378 + array_unshift( $plugins, [
379 + 'name' => 'Elementor Pro',
380 + 'author' => 'Elementor',
381 + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-elementor-pro/',
382 + 'badge' => 'Premium',
383 + 'description' => 'Unlock Elementor Pro and build any website with advanced design capabilities, marketing tools, WooCommerce features, Dynamic Content, and more.',
384 + 'action_label' => 'Let\'s Go',
385 + 'action_url' => 'https://go.elementor.com/wp-dash-apps-go-to-elementor-pro/',
386 + 'image' => $images_url . 'elementor.svg',
387 + ] );
90 388 }
91 389
92 - return $filtered_apps;
390 + return $plugins;
93 391 }
94 392
95 - private static function is_wporg_app( $app ) {
96 - return isset( $app['type'] ) && 'wporg' === $app['type'];
393 + private static function get_images_url() {
394 + return ELEMENTOR_URL . 'modules/apps/images/';
97 395 }
98 396
99 - private static function filter_wporg_app( $app ) {
100 - if ( self::$wordpress_adapter->is_plugin_active( $app['file_path'] ) ) {
101 - return null;
102 - }
397 + private static function is_elementor_pro_installed() {
398 + return defined( 'ELEMENTOR_PRO_VERSION' );
399 + }
103 400
104 - if ( self::$plugin_status_adapter->is_plugin_installed( $app['file_path'] ) ) {
105 - if ( current_user_can( 'activate_plugins' ) ) {
106 - $app['action_label'] = esc_html__( 'Activate', 'elementor' );
107 - $app['action_url'] = self::$plugin_status_adapter->get_activate_plugin_url( $app['file_path'] );
108 - } else {
109 - $app['action_label'] = esc_html__( 'Cannot Activate', 'elementor' );
110 - $app['action_url'] = '#';
111 - }
112 - } elseif ( current_user_can( 'install_plugins' ) ) {
113 - $app['action_label'] = esc_html__( 'Install', 'elementor' );
114 - $app['action_url'] = self::$plugin_status_adapter->get_install_plugin_url( $app['file_path'] );
115 - } else {
116 - $app['action_label'] = esc_html__( 'Cannot Install', 'elementor' );
117 - $app['action_url'] = '#';
118 - }
401 + private static function is_plugin_installed( $file_path ) {
402 + $installed_plugins = get_plugins();
119 403
120 - return $app;
404 + return isset( $installed_plugins[ $file_path ] );
121 405 }
122 406
123 - private static function is_ecom_app( $app ) {
124 - return isset( $app['type'] ) && 'ecom' === $app['type'];
407 + private static function is_plugin_activated( $file_path ) {
408 + return is_plugin_active( $file_path );
125 409 }
126 410
127 - private static function filter_ecom_app( $app ) {
128 - if ( self::$wordpress_adapter->is_plugin_active( $app['file_path'] ) ) {
129 - return null;
130 - }
131 -
132 - if ( ! self::$plugin_status_adapter->is_plugin_installed( $app['file_path'] ) ) {
133 - return $app;
134 - }
135 -
136 - if ( current_user_can( 'activate_plugins' ) ) {
137 - $app['action_label'] = esc_html__( 'Activate', 'elementor' );
138 - $app['action_url'] = self::$plugin_status_adapter->get_activate_plugin_url( $app['file_path'] );
139 - } else {
140 - $app['action_label'] = esc_html__( 'Cannot Activate', 'elementor' );
141 - $app['action_url'] = '#';
142 - }
143 -
144 - $app['target'] = '_self';
145 -
146 - return $app;
411 + private static function get_activate_plugin_url( $file_path ) {
412 + return wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . $file_path . '&amp;plugin_status=all&amp;paged=1&amp;s', 'activate-plugin_' . $file_path );
147 413 }
148 414
149 - private static function get_images_url() {
150 - return ELEMENTOR_URL . 'modules/apps/images/';
151 - }
415 + private static function get_install_plugin_url( $file_path ) {
416 + $slug = dirname( $file_path );
152 417
153 - private static function is_elementor_pro_installed() {
154 - return defined( 'ELEMENTOR_PRO_VERSION' );
418 + return wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $slug ), 'install-plugin_' . $slug );
155 419 }
156 420
157 421 private static function render_plugin_item( $plugin ) {
158 422 ?>
159 - <div class="e-a-item"<?php echo ! empty( $plugin['file_path'] ) ? ' data-plugin="' . esc_attr( $plugin['file_path'] ) . '"' : ''; ?>>
423 + <div class="e-a-item">
160 424 <div class="e-a-heading">
161 425 <img class="e-a-img" src="<?php echo esc_url( $plugin['image'] ); ?>" alt="<?php echo esc_attr( $plugin['name'] ); ?>">
162 426 <?php if ( ! empty( $plugin['badge'] ) ) : ?>
163 427 <span class="e-a-badge"><?php echo esc_html( $plugin['badge'] ); ?></span>