| @@ -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,268 @@ | ||
| 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 | + ]; | |
| 57 | 196 | |
| 58 | - $apps = static::get_remote_apps(); | |
| 197 | + $wporg_plugins = [ | |
| 198 | + [ | |
| 199 | + 'file_path' => 'aryo-activity-log/aryo-activity-log.php', | |
| 200 | + 'name' => 'Activity Log', | |
| 201 | + 'author' => 'Activity Log Team', | |
| 202 | + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-activity-log/', | |
| 203 | + 'badge' => 'Free', | |
| 204 | + 'description' => 'Track user activity easily. Discover who does what on your website and perform a comprehensive security audit for peace of mind.', | |
| 205 | + 'learn_more_url' => 'https://go.elementor.com/wp-dash-apps-learn-more-activity-log/', | |
| 206 | + 'action_label' => 'Install', | |
| 207 | + 'action_url' => '#', | |
| 208 | + 'image' => $images_url . 'activity-log.png', | |
| 209 | + 'target' => '_self', | |
| 210 | + ], | |
| 211 | + [ | |
| 212 | + 'file_path' => 'pojo-accessibility/pojo-accessibility.php', | |
| 213 | + 'name' => 'One Click Accessibility', | |
| 214 | + 'author' => 'Accessibility Team', | |
| 215 | + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-wpaccessibility/', | |
| 216 | + 'badge' => 'Free', | |
| 217 | + 'description' => 'The fastest plugin to enhance WordPress website accessibility. Empower your website to be user-friendly for all visitors.', | |
| 218 | + 'learn_more_url' => 'https://go.elementor.com/wp-dash-apps-learn-more-wpaccessibility/', | |
| 219 | + 'action_label' => 'Install', | |
| 220 | + 'action_url' => '#', | |
| 221 | + 'image' => $images_url . 'one-click-accessibility.png', | |
| 222 | + 'target' => '_self', | |
| 223 | + ], | |
| 224 | + ]; | |
| 59 | 225 | |
| 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 ); | |
| 226 | + foreach ( $wporg_plugins as $wporg_plugin_data ) { | |
| 227 | + if ( static::is_plugin_activated( $wporg_plugin_data['file_path'] ) ) { | |
| 228 | + continue; | |
| 79 | 229 | } |
| 80 | 230 | |
| 81 | - if ( static::is_ecom_app( $app ) ) { | |
| 82 | - $app = static::filter_ecom_app( $app ); | |
| 231 | + if ( static::is_plugin_installed( $wporg_plugin_data['file_path'] ) ) { | |
| 232 | + if ( current_user_can( 'activate_plugins' ) ) { | |
| 233 | + $wporg_plugin_data['action_label'] = 'Activate'; | |
| 234 | + $wporg_plugin_data['action_url'] = static::get_activate_plugin_url( $wporg_plugin_data['file_path'] ); | |
| 235 | + } else { | |
| 236 | + $wporg_plugin_data['action_label'] = 'Cannot Activate'; | |
| 237 | + $wporg_plugin_data['action_url'] = '#'; | |
| 238 | + } | |
| 239 | + } else { | |
| 240 | + if ( current_user_can( 'install_plugins' ) ) { | |
| 241 | + $wporg_plugin_data['action_label'] = 'Install'; | |
| 242 | + $wporg_plugin_data['action_url'] = static::get_install_plugin_url( $wporg_plugin_data['file_path'] ); | |
| 243 | + } else { | |
| 244 | + $wporg_plugin_data['action_label'] = 'Cannot Install'; | |
| 245 | + $wporg_plugin_data['action_url'] = '#'; | |
| 246 | + } | |
| 83 | 247 | } |
| 84 | 248 | |
| 85 | - if ( empty( $app ) ) { | |
| 86 | - continue; | |
| 87 | - } | |
| 249 | + array_unshift( $plugins, $wporg_plugin_data ); | |
| 250 | + } | |
| 88 | 251 | |
| 89 | - $filtered_apps[] = $app; | |
| 252 | + if ( ! static::is_elementor_pro_installed() ) { | |
| 253 | + array_unshift( $plugins, [ | |
| 254 | + 'name' => 'Elementor Pro', | |
| 255 | + 'author' => 'Elementor', | |
| 256 | + 'author_url' => 'https://go.elementor.com/wp-dash-apps-author-uri-elementor-pro/', | |
| 257 | + 'badge' => 'Premium', | |
| 258 | + 'description' => 'Unlock Elementor Pro and build any website with advanced design capabilities, marketing tools, WooCommerce features, Dynamic Content, and more.', | |
| 259 | + 'action_label' => 'Let\'s Go', | |
| 260 | + 'action_url' => 'https://go.elementor.com/wp-dash-apps-go-to-elementor-pro/', | |
| 261 | + 'image' => $images_url . 'elementor.svg', | |
| 262 | + ] ); | |
| 90 | 263 | } |
| 91 | 264 | |
| 92 | - return $filtered_apps; | |
| 265 | + return $plugins; | |
| 93 | 266 | } |
| 94 | 267 | |
| 95 | - private static function is_wporg_app( $app ) { | |
| 96 | - return isset( $app['type'] ) && 'wporg' === $app['type']; | |
| 268 | + private static function get_images_url() { | |
| 269 | + return ELEMENTOR_URL . 'modules/apps/images/'; | |
| 97 | 270 | } |
| 98 | 271 | |
| 99 | - private static function filter_wporg_app( $app ) { | |
| 100 | - if ( self::$wordpress_adapter->is_plugin_active( $app['file_path'] ) ) { | |
| 101 | - return null; | |
| 102 | - } | |
| 272 | + private static function is_elementor_pro_installed() { | |
| 273 | + return defined( 'ELEMENTOR_PRO_VERSION' ); | |
| 274 | + } | |
| 103 | 275 | |
| 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 | - } | |
| 276 | + private static function is_plugin_installed( $file_path ) { | |
| 277 | + $installed_plugins = get_plugins(); | |
| 119 | 278 | |
| 120 | - return $app; | |
| 279 | + return isset( $installed_plugins[ $file_path ] ); | |
| 121 | 280 | } |
| 122 | 281 | |
| 123 | - private static function is_ecom_app( $app ) { | |
| 124 | - return isset( $app['type'] ) && 'ecom' === $app['type']; | |
| 282 | + private static function is_plugin_activated( $file_path ) { | |
| 283 | + return is_plugin_active( $file_path ); | |
| 125 | 284 | } |
| 126 | 285 | |
| 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; | |
| 286 | + private static function get_activate_plugin_url( $file_path ) { | |
| 287 | + return wp_nonce_url( 'plugins.php?action=activate&plugin=' . $file_path . '&plugin_status=all&paged=1&s', 'activate-plugin_' . $file_path ); | |
| 147 | 288 | } |
| 148 | 289 | |
| 149 | - private static function get_images_url() { | |
| 150 | - return ELEMENTOR_URL . 'modules/apps/images/'; | |
| 151 | - } | |
| 290 | + private static function get_install_plugin_url( $file_path ) { | |
| 291 | + $slug = dirname( $file_path ); | |
| 152 | 292 | |
| 153 | - private static function is_elementor_pro_installed() { | |
| 154 | - return defined( 'ELEMENTOR_PRO_VERSION' ); | |
| 293 | + return wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $slug ), 'install-plugin_' . $slug ); | |
| 155 | 294 | } |
| 156 | 295 | |
| 157 | 296 | private static function render_plugin_item( $plugin ) { |
| 158 | 297 | ?> |
| 159 | - <div class="e-a-item"<?php echo ! empty( $plugin['file_path'] ) ? ' data-plugin="' . esc_attr( $plugin['file_path'] ) . '"' : ''; ?>> | |
| 298 | + <div class="e-a-item"> | |
| 160 | 299 | <div class="e-a-heading"> |
| 161 | 300 | <img class="e-a-img" src="<?php echo esc_url( $plugin['image'] ); ?>" alt="<?php echo esc_attr( $plugin['name'] ); ?>"> |
| 162 | 301 | <?php if ( ! empty( $plugin['badge'] ) ) : ?> |
| 163 | 302 | <span class="e-a-badge"><?php echo esc_html( $plugin['badge'] ); ?></span> |