PluginProbe ʕ •ᴥ•ʔ
WP Chat App / 3.6.9
WP Chat App v3.6.9
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 / includes / Recommended / views / content.php
wp-whatsapp / includes / Recommended / views Last commit date
content.php 1 year ago
content.php
253 lines
1 <?php
2
3 $plugins_allowed_tags = array(
4 'a' => array(
5 'href' => array(),
6 'title' => array(),
7 'target' => array(),
8 ),
9 'abbr' => array( 'title' => array() ),
10 'acronym' => array( 'title' => array() ),
11 'code' => array(),
12 'pre' => array(),
13 'em' => array(),
14 'strong' => array(),
15 'ul' => array(),
16 'ol' => array(),
17 'li' => array(),
18 'p' => array(),
19 'br' => array(),
20 );
21
22 foreach ( (array) $recommended_plugins as $recommended_plugin ) {
23 if ( is_object( $recommended_plugin ) ) {
24 $recommended_plugin = (array) $recommended_plugin;
25 }
26
27 $plugin_title = wp_kses( $recommended_plugin['name'], $plugins_allowed_tags );
28
29 // Remove any HTML from the description.
30 $description = wp_strip_all_tags( $recommended_plugin['short_description'] );
31
32 $name = wp_strip_all_tags( $plugin_title );
33
34 $download_link = isset( $recommended_plugin['download_link'] ) ? $recommended_plugin['download_link'] : null;
35
36 $compatible_php = true;
37 $compatible_wp = true;
38 $tested_wp = true;
39
40 $action_links = array();
41
42 $plugin_status = '<span class="plugin-status-not-install">Not installed</span>';
43
44 if ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) {
45 $plugin_pro_ver = $this->check_pro_version_exists( $recommended_plugin );
46 if ( false === $plugin_pro_ver ) {
47 $install_status = install_plugin_install_status( $recommended_plugin );
48 } else {
49 $install_status = array(
50 'status' => 'latest_installed',
51 'url' => false,
52 'version' => '',
53 'file' => $plugin_pro_ver,
54 );
55 }
56
57 switch ( $install_status['status'] ) {
58 case 'install':
59 if ( $install_status['url'] ) {
60 if ( $compatible_php && $compatible_wp ) {
61 $action_links[] = sprintf(
62 '<button class="install-now button button-primary" data-install-url="%s" aria-label="%s">%s</button>',
63 esc_attr( $download_link ),
64 /* translators: %s: Plugin name and version. */
65 esc_attr( sprintf( _x( 'Install %s now', 'plugin', 'wp-whatsapp' ), $name ) ),
66 __( 'Install Now', 'wp-whatsapp' )
67 );
68 } else {
69 $action_links[] = sprintf(
70 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
71 _x( 'Cannot Install', 'plugin', 'wp-whatsapp' )
72 );
73 }
74 }
75 $plugin_status = '<span class="plugin-status-not-install" data-plugin-url="' . esc_attr( $download_link ) . '">Not installed</span>';
76 break;
77
78 case 'update_available':
79 if ( $install_status['url'] ) {
80 if ( $compatible_php && $compatible_wp ) {
81 $action_links[] = sprintf(
82 '<button class="update-now button aria-button-if-js" data-plugin="%s" data-slug="%s" data-update-url="%s" aria-label="%s" data-name="%s">%s</button>',
83 esc_attr( $install_status['file'] ),
84 esc_attr( $recommended_plugin['slug'] ),
85 esc_url( $install_status['url'] ),
86 /* translators: %s: Plugin name and version. */
87 esc_attr( sprintf( _x( 'Update %s now', 'plugin', 'wp-whatsapp' ), $name ) ),
88 esc_attr( $name ),
89 __( 'Update Now', 'wp-whatsapp' )
90 );
91 } else {
92 $action_links[] = sprintf(
93 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
94 _x( 'Cannot Update', 'plugin', 'wp-whatsapp' )
95 );
96 }
97 }
98 if ( is_plugin_active( $install_status['file'] ) ) {
99 $plugin_status = '<span class="plugin-status-active">Active</span>';
100 } else {
101 $plugin_status = '<span class="plugin-status-inactive" data-plugin-file="' . esc_attr( $install_status['file'] ) . '">Inactive</span>';
102 }
103 break;
104
105 case 'latest_installed':
106 case 'newer_installed':
107 if ( is_plugin_active( $install_status['file'] ) ) {
108 $plugin_status = '<span class="plugin-status-active">Active</span>';
109 $action_links[] = sprintf(
110 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
111 _x( 'Activated', 'plugin', 'wp-whatsapp' )
112 );
113 } elseif ( current_user_can( 'activate_plugin', $install_status['file'] ) ) {
114 $plugin_status = '<span class="plugin-status-inactive" data-plugin-file="' . esc_attr( $install_status['file'] ) . '">Inactive</span>';
115 if ( $compatible_php && $compatible_wp ) {
116 $button_text = __( 'Activate', 'wp-whatsapp' );
117 /* translators: %s: Plugin name. */
118 $button_label = _x( 'Activate %s', 'plugin', 'wp-whatsapp' );
119 $activate_url = add_query_arg(
120 array(
121 '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $install_status['file'] ),
122 'action' => 'activate',
123 'plugin' => $install_status['file'],
124 ),
125 network_admin_url( 'plugins.php' )
126 );
127
128 if ( is_network_admin() ) {
129 $button_text = __( 'Network Activate', 'wp-whatsapp' );
130 /* translators: %s: Plugin name. */
131 $button_label = _x( 'Network Activate %s', 'plugin', 'wp-whatsapp' );
132 $activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url );
133 }
134
135 $action_links[] = sprintf(
136 '<button class="button activate-now" data-plugin-file="%1$s" aria-label="%2$s">%3$s</button>',
137 esc_attr( $install_status['file'] ),
138 esc_attr( sprintf( $button_label, $recommended_plugin['name'] ) ),
139 $button_text
140 );
141 } else {
142 $action_links[] = sprintf(
143 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
144 _x( 'Cannot Activate', 'plugin', 'wp-whatsapp' )
145 );
146 }
147 } else {
148 $action_links[] = sprintf(
149 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
150 _x( 'Installed', 'plugin', 'wp-whatsapp' )
151 );
152 }
153 break;
154 }
155 }
156
157 $details_link = self_admin_url(
158 'plugin-install.php?tab=plugin-information&amp;plugin=' . $recommended_plugin['slug'] .
159 '&amp;TB_iframe=true&amp;width=600&amp;height=550'
160 );
161
162 $plugin_icon_url = $recommended_plugin['icon'];
163
164 /**
165 * Filters the install action links for a plugin.
166 *
167 * @since 2.7.0
168 *
169 * @param string[] $action_links An array of plugin action links. Defaults are links to Details and Install Now.
170 * @param array $plugin The plugin currently being listed.
171 */
172 $action_links = apply_filters( 'plugin_install_action_links', $action_links, $recommended_plugin );
173
174 ?>
175 <div class="plugin-card plugin-card-<?php echo sanitize_html_class( $recommended_plugin['slug'] ); ?>">
176 <?php
177 if ( ! $compatible_php || ! $compatible_wp ) {
178 echo '<div class="notice inline notice-error notice-alt"><p>';
179 if ( ! $compatible_php && ! $compatible_wp ) {
180 echo esc_html__( 'This plugin doesn&#8217;t work with your versions of WordPress and PHP.', 'wp-whatsapp' );
181 if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
182 printf(
183 /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
184 ' ' . esc_html__( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.', 'wp-whatsapp' ),
185 esc_url( self_admin_url( 'update-core.php' ) ),
186 esc_url( wp_get_update_php_url() )
187 );
188 wp_update_php_annotation( '</p><p><em>', '</em>' );
189 } elseif ( current_user_can( 'update_core' ) ) {
190 printf(
191 /* translators: %s: URL to WordPress Updates screen. */
192 ' ' . esc_html__( '<a href="%s">Please update WordPress</a>.', 'wp-whatsapp' ),
193 esc_url( self_admin_url( 'update-core.php' ) )
194 );
195 } elseif ( current_user_can( 'update_php' ) ) {
196 printf(
197 /* translators: %s: URL to Update PHP page. */
198 ' ' . esc_html__( '<a href="%s">Learn more about updating PHP</a>.', 'wp-whatsapp' ),
199 esc_url( wp_get_update_php_url() )
200 );
201 wp_update_php_annotation( '</p><p><em>', '</em>' );
202 }
203 } elseif ( ! $compatible_wp ) {
204 echo esc_html__( 'This plugin doesn&#8217;t work with your version of WordPress.', 'wp-whatsapp' );
205 if ( current_user_can( 'update_core' ) ) {
206 printf(
207 /* translators: %s: URL to WordPress Updates screen. */
208 ' ' . esc_html__( '<a href="%s">Please update WordPress</a>.', 'wp-whatsapp' ),
209 esc_url( self_admin_url( 'update-core.php' ) )
210 );
211 }
212 } elseif ( ! $compatible_php ) {
213 echo esc_html__( 'This plugin doesn&#8217;t work with your version of PHP.', 'wp-whatsapp' );
214 if ( current_user_can( 'update_php' ) ) {
215 printf(
216 /* translators: %s: URL to Update PHP page. */
217 ' ' . esc_html__( '<a href="%s">Learn more about updating PHP</a>.', 'wp-whatsapp' ),
218 esc_url( wp_get_update_php_url() )
219 );
220 wp_update_php_annotation( '</p><p><em>', '</em>' );
221 }
222 }
223 echo '</p></div>';
224 }
225 ?>
226 <div class="plugin-card-top">
227 <div class="name column-name">
228 <h3>
229 <a href="<?php echo esc_url( $details_link ); ?>" class="thickbox open-plugin-details-modal">
230 <?php echo wp_kses_post( $plugin_title ); ?>
231 <img src="<?php echo esc_url( $plugin_icon_url ); ?>" class="plugin-icon" alt="" />
232 </a>
233 </h3>
234 </div>
235 <div class="desc column-description">
236 <p><?php echo wp_kses_post( $description ); ?></p>
237 </div>
238 </div>
239 <div class="plugin-card-bottom">
240 <div class="vers column-rating">
241 <?php printf( '<span class="plugin-status" >%s: %s</span>', esc_html( 'Status' ), wp_kses_post( $plugin_status ) ); ?>
242 </div>
243 <div class="column-updated">
244 <?php
245 if ( $action_links ) {
246 echo '<ul class="plugin-action-buttons"><li>' . wp_kses_post( implode( '</li><li>', $action_links ) ) . '</li></ul>';
247 }
248 ?>
249 </div>
250 </div>
251 </div>
252 <?php } ?>
253