PluginProbe ʕ •ᴥ•ʔ
WP Chat App / trunk
WP Chat App vtrunk
3.8.1 3.8.2 trunk 2.6 3.4 3.4.1 3.4.2 3.4.4 3.4.5 3.4.6 3.5 3.6 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.6.9 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.8.0
wp-whatsapp / vendor-prefixed / views / recommended-plugins-page.php
wp-whatsapp / vendor-prefixed / views Last commit date
help-page.php 4 months ago license-activate-card.php 4 months ago license-card.php 4 months ago licenses-page.php 4 months ago recommended-plugins-data.php 3 months ago recommended-plugins-page.php 3 months ago
recommended-plugins-page.php
152 lines
1 <?php
2
3 namespace WhatsappScoped;
4
5 /**
6 * Other plugins content partial — rendered in AJAX response.
7 * Expects $recommended_plugins in scope.
8 * Ported from YayMail Pro other-plugins-content.php.
9 *
10 * @package YayCommerce\AdminShell\Views
11 */
12 use WhatsappScoped\YayCommerce\AdminShell\Pages\RecommendedPluginsPage;
13 \defined('ABSPATH') || exit;
14 if (empty($recommended_plugins)) {
15 echo '<p>' . \esc_html__('No plugins found.', 'yaycommerce') . '</p>';
16 return;
17 }
18 $page_instance = RecommendedPluginsPage::get_instance();
19 foreach ($recommended_plugins as $key => $plugin_detail) {
20 $plugin_slug = $plugin_detail['slug'];
21 $all_plugins = get_plugins();
22 $install_status = install_plugin_install_status((object) ['slug' => $plugin_slug, 'version' => $plugin_detail['version']]);
23 $status = $install_status['status'] ?? 'not_installed';
24 $exist_pro_ver = $page_instance->check_pro_version_exists($plugin_detail);
25 $is_installed = \in_array($status, ['latest_installed', 'newer_installed'], \true) || $exist_pro_ver;
26 $is_active = 'active' === $status || $exist_pro_ver && is_plugin_active($exist_pro_ver) || $is_installed && is_plugin_active($install_status['file']);
27 $is_update = 'update_available' === $status;
28 // Hide CF7 add-ons when Contact Form 7 itself is not active
29 $cf7_dependent_slugs = ['cf7-multi-step', 'cf7-database'];
30 if (\in_array($plugin_slug, $cf7_dependent_slugs, \true) && !is_plugin_active('contact-form-7/wp-contact-form-7.php')) {
31 continue;
32 }
33 // Hide active plugins that don't need updates
34 if ($is_active && !$is_update) {
35 continue;
36 }
37 $plugin_info_url = \add_query_arg(['tab' => 'plugin-information', 'plugin' => $plugin_slug, 'TB_iframe' => 'true', 'width' => 600, 'height' => 550], \self_admin_url('plugin-install.php'));
38 ?>
39 <div class="plugin-card plugin-card-<?php
40 echo \esc_attr($plugin_slug);
41 ?>">
42 <div class="plugin-card-top">
43 <div class="name column-name">
44 <h3>
45 <a href="<?php
46 echo \esc_url($plugin_info_url);
47 ?>" class="thickbox open-plugin-details-modal">
48 <?php
49 echo \esc_html($plugin_detail['name']);
50 ?>
51 <img src="<?php
52 echo \esc_url($plugin_detail['icon'] ?? '');
53 ?>" class="plugin-icon" alt="">
54 </a>
55 </h3>
56 </div>
57 <div class="desc column-description">
58 <p><?php
59 echo \esc_html($plugin_detail['short_description'] ?? '');
60 ?></p>
61 </div>
62 </div>
63 <div class="plugin-card-bottom">
64 <div class="column-rating">
65 <?php
66 if ($is_active || $exist_pro_ver && is_plugin_active($exist_pro_ver)) {
67 ?>
68 <?php
69 \esc_html_e('Status:', 'yaycommerce');
70 ?>
71 <span class="plugin-status-active" data-plugin-file="<?php
72 echo \esc_attr($exist_pro_ver ?? $install_status['file'] ?? '');
73 ?>"><?php
74 \esc_html_e('Active', 'yaycommerce');
75 ?></span>
76 <?php
77 } elseif ($is_installed) {
78 ?>
79 <?php
80 \esc_html_e('Status:', 'yaycommerce');
81 ?>
82 <span class="plugin-status-inactive" data-plugin-file="<?php
83 echo \esc_attr($exist_pro_ver ?? $install_status['file'] ?? '');
84 ?>"><?php
85 \esc_html_e('Inactive', 'yaycommerce');
86 ?></span>
87 <?php
88 } elseif ($is_update) {
89 ?>
90 <?php
91 \esc_html_e('Status:', 'yaycommerce');
92 ?>
93 <span class="plugin-status-update-available"><?php
94 \esc_html_e('Update available', 'yaycommerce');
95 ?></span>
96 <?php
97 } else {
98 ?>
99 <?php
100 \esc_html_e('Status:', 'yaycommerce');
101 ?>
102 <span class="plugin-status-not-install" data-plugin-url="<?php
103 echo \esc_url($plugin_detail['download_link'] ?? '');
104 ?>"><?php
105 \esc_html_e('Not installed', 'yaycommerce');
106 ?></span>
107 <?php
108 }
109 ?>
110 </div>
111 <div class="column-updated">
112 <ul class="plugin-action-buttons">
113 <?php
114 if ($is_active || $exist_pro_ver && is_plugin_active($exist_pro_ver)) {
115 ?>
116 <li><button class="button button-disabled" disabled><?php
117 \esc_html_e('Activated', 'yaycommerce');
118 ?></button></li>
119 <?php
120 } elseif ($is_installed) {
121 ?>
122 <li><button class="button activate-now" data-plugin-file="<?php
123 echo \esc_attr($exist_pro_ver ?? $install_status['file'] ?? '');
124 ?>"><?php
125 \esc_html_e('Activate', 'yaycommerce');
126 ?></button></li>
127 <?php
128 } elseif ($is_update) {
129 ?>
130 <li><button class="button update-now" data-plugin="<?php
131 echo \esc_attr($exist_pro_ver ?? $install_status['file'] ?? '');
132 ?>"><?php
133 \esc_html_e('Update Now', 'yaycommerce');
134 ?></button></li>
135 <?php
136 } else {
137 ?>
138 <li><button class="button button-primary install-now" data-install-url="<?php
139 echo \esc_url($plugin_detail['download_link'] ?? '');
140 ?>"><?php
141 \esc_html_e('Install Now', 'yaycommerce');
142 ?></button></li>
143 <?php
144 }
145 ?>
146 </ul>
147 </div>
148 </div>
149 </div>
150 <?php
151 }
152