| 1 |
<?php |
| 2 |
namespace Elementor\Modules\Apps; |
| 3 |
|
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; // Exit if accessed directly. |
| 6 |
} |
| 7 |
|
| 8 |
class Admin_Apps_Page { |
| 9 |
|
| 10 |
public static function render() { |
| 11 |
?> |
| 12 |
<div class="wrap e-a-apps"> |
| 13 |
|
| 14 |
<div class="e-a-page-title"> |
| 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> |
| 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> |
| 18 |
</p> |
| 19 |
</div> |
| 20 |
|
| 21 |
<div class="e-a-list"> |
| 22 |
<?php self::render_plugins_list(); ?> |
| 23 |
</div> |
| 24 |
<div class="e-a-page-footer"> |
| 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> |
| 26 |
</div> |
| 27 |
</div> |
| 28 |
<?php |
| 29 |
} |
| 30 |
|
| 31 |
private static function render_plugins_list() { |
| 32 |
$plugins = self::get_plugins(); |
| 33 |
|
| 34 |
foreach ( $plugins as $plugin ) { |
| 35 |
self::render_plugin_item( $plugin ); |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
private static function get_plugins() : array { |
| 40 |
$images_url = static::get_images_url(); |
| 41 |
|
| 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 |
|
| 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 |
]; |
| 225 |
|
| 226 |
foreach ( $wporg_plugins as $wporg_plugin_data ) { |
| 227 |
if ( static::is_plugin_activated( $wporg_plugin_data['file_path'] ) ) { |
| 228 |
continue; |
| 229 |
} |
| 230 |
|
| 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 |
} |
| 247 |
} |
| 248 |
|
| 249 |
array_unshift( $plugins, $wporg_plugin_data ); |
| 250 |
} |
| 251 |
|
| 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 |
] ); |
| 263 |
} |
| 264 |
|
| 265 |
return $plugins; |
| 266 |
} |
| 267 |
|
| 268 |
private static function get_images_url() { |
| 269 |
return ELEMENTOR_URL . 'modules/apps/images/'; |
| 270 |
} |
| 271 |
|
| 272 |
private static function is_elementor_pro_installed() { |
| 273 |
return defined( 'ELEMENTOR_PRO_VERSION' ); |
| 274 |
} |
| 275 |
|
| 276 |
private static function is_plugin_installed( $file_path ) { |
| 277 |
$installed_plugins = get_plugins(); |
| 278 |
|
| 279 |
return isset( $installed_plugins[ $file_path ] ); |
| 280 |
} |
| 281 |
|
| 282 |
private static function is_plugin_activated( $file_path ) { |
| 283 |
return is_plugin_active( $file_path ); |
| 284 |
} |
| 285 |
|
| 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 ); |
| 288 |
} |
| 289 |
|
| 290 |
private static function get_install_plugin_url( $file_path ) { |
| 291 |
$slug = dirname( $file_path ); |
| 292 |
|
| 293 |
return wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $slug ), 'install-plugin_' . $slug ); |
| 294 |
} |
| 295 |
|
| 296 |
private static function render_plugin_item( $plugin ) { |
| 297 |
?> |
| 298 |
<div class="e-a-item"> |
| 299 |
<div class="e-a-heading"> |
| 300 |
<img class="e-a-img" src="<?php echo esc_url( $plugin['image'] ); ?>" alt="<?php echo esc_attr( $plugin['name'] ); ?>"> |
| 301 |
<?php if ( ! empty( $plugin['badge'] ) ) : ?> |
| 302 |
<span class="e-a-badge"><?php echo esc_html( $plugin['badge'] ); ?></span> |
| 303 |
<?php endif; ?> |
| 304 |
</div> |
| 305 |
<h3 class="e-a-title"><?php echo esc_html( $plugin['name'] ); ?></h3> |
| 306 |
<p class="e-a-author"><?php esc_html_e( 'By', 'elementor' ); ?> <a href="<?php echo esc_url( $plugin['author_url'] ); ?>" target="_blank"><?php echo esc_html( $plugin['author'] ); ?></a></p> |
| 307 |
<div class="e-a-desc"> |
| 308 |
<p><?php echo esc_html( $plugin['description'] ); ?></p> |
| 309 |
<?php if ( ! empty( $plugin['offering'] ) ) : ?> |
| 310 |
<p class="e-a-offering"><?php echo esc_html( $plugin['offering'] ); ?></p> |
| 311 |
<?php endif; ?> |
| 312 |
</div> |
| 313 |
|
| 314 |
<p class="e-a-actions"> |
| 315 |
<?php if ( ! empty( $plugin['learn_more_url'] ) ) : ?> |
| 316 |
<a class="e-a-learn-more" href="<?php echo esc_url( $plugin['learn_more_url'] ); ?>" target="_blank"><?php echo esc_html__( 'Learn More', 'elementor' ); ?></a> |
| 317 |
<?php endif; ?> |
| 318 |
<a href="<?php echo esc_url( $plugin['action_url'] ); ?>" class="e-btn e-accent" target="<?php echo isset( $plugin['target'] ) ? esc_attr( $plugin['target'] ) : '_blank'; ?>"><?php echo esc_html( $plugin['action_label'] ); ?></a> |
| 319 |
</p> |
| 320 |
</div> |
| 321 |
<?php |
| 322 |
} |
| 323 |
} |
| 324 |
|