PluginProbe
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services / 8.8.3
WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services v8.8.3
8.8.3 8.8.2 8.8.1 8.8.0 8.7.9 8.7.8 8.7.7 8.7.6 8.7.5 8.7.4 8.7.3 8.7.2 8.7.1 8.7.0 8.6.9 8.6.8 8.6.7 8.6.6 8.6.5 8.6.4 8.6.2 8.6.1 8.6.0 8.5.9 8.5.8 All 539 releases
chatbot / qc-support-promo-page / qc-clr-recommendbot-support-plugin.php

qc-clr-recommendbot-support-plugin.php in WPBot – AI ChatBot for Live Support, Lead Generation, WordPress Automation, AI Services 8.8.3, at qc-support-promo-page/qc-clr-recommendbot-support-plugin.php

1,515 lines 93.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 }
5
6 add_action( 'wp_ajax_qcld_recommend_support_function_first_wpchatbot_ajax', 'qcld_recommend_support_function_first_wpchatbot_ajax' );
7 if( !function_exists('qcld_recommend_support_function_first_wpchatbot_ajax') ){
8
9 function qcld_recommend_support_function_first_wpchatbot_ajax(){
10
11 check_ajax_referer( 'wpchatbot', 'security');
12
13 require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
14 remove_all_filters('plugins_api');
15
16 /* Conversational Forms Plugins */
17 $argus = [
18
19 [
20 'slug' => 'knowledgebase-helpdesk',
21 'fields' => [
22 'short_description' => true,
23 'icons' => true,
24 'reviews' => true, // excludes all reviews
25 ],
26 'live_preview' => 'https://dev.quantumcloud.net/knowledgebase/',
27 'update_to_pro' => 'https://www.quantumcloud.net/products/knowledgebase-helpdesk/'
28 ],
29 [
30 'slug' => 'woowbot-woocommerce-chatbot',
31 'fields' => [
32 'short_description' => true,
33 'icons' => true,
34 'reviews' => true, // excludes all reviews
35 ],
36 'live_preview' => 'https://woowbot.pro/',
37 'update_to_pro' => 'https://woowbot.pro/pricing/'
38 ],
39 [
40 'slug' => 'wpchatbot',
41 'fields' => [
42 'short_description' => true,
43 'icons' => true,
44 'reviews' => true, // excludes all reviews
45 ],
46 'live_preview' => 'https://www.turbopowers.com/',
47 'update_to_pro' => 'https://www.turbopowers.com/pricing/'
48 ]
49
50
51
52 ];
53
54
55
56 ?>
57
58 <div class="recommended-plugins">
59 <div class="wp-list-table widefat plugin-install">
60 <div class="the-list">
61 <?php
62
63 //$qcld_plugininstal = array();
64 foreach ( $argus as $arg ) {
65
66
67 $transient_key = 'qcld_plugin_info_' . md5( $arg['slug'] );
68 $data = get_transient( $transient_key );
69 if ( false === $data ) {
70 $data = plugins_api( 'plugin_information', $arg );
71 if ( $data && ! is_wp_error( $data ) ) {
72 set_transient( $transient_key, $data, 12 * HOUR_IN_SECONDS );
73 }
74 }
75
76 if ( $data && ! is_wp_error( $data ) ) {
77 $qcld_plugininstal['convers-form'] = $data;
78 }
79 foreach ( (array) $qcld_plugininstal as $key => $plugin ) {
80 if ( is_object( $plugin ) ) {
81 $plugin = (array) $plugin;
82 }
83
84 $qcld_chatplugintags = array(
85 'a' => array(
86 'href' => array(),
87 'title' => array(),
88 'target' => array(),
89 ),
90 );
91
92 // Display the group heading if there is one.
93 if ( isset( $plugin['group'] ) && $plugin['group'] != $group ) {
94 if ( isset( $this->groups[ $plugin['group'] ] ) ) {
95 $group_name = $this->groups[ $plugin['group'] ];
96 if ( isset( $plugins_group_titles[ $group_name ] ) ) {
97 $group_name = $plugins_group_titles[ $group_name ];
98 }
99 } else {
100 $group_name = $plugin['group'];
101 }
102
103 // Starting a new group, close off the divs of the last one.
104 if ( ! empty( $group ) ) {
105 echo '</div></div>';
106 }
107
108 echo '<div class="plugin-group"><h3>' . esc_html( $group_name ) . '</h3>';
109 // Needs an extra wrapping div for nth-child selectors to work.
110 echo '<div class="plugin-items">';
111
112 $group = $plugin['group'];
113 }
114 $title = wp_kses( $plugin['name'], $qcld_chatplugintags );
115
116 // Remove any HTML from the description.
117 $description = wp_strip_all_tags( $plugin['short_description'] );
118 $version = wp_kses( $plugin['version'], $qcld_chatplugintags );
119
120 $name = wp_strip_all_tags( $title . ' ' . $version );
121
122 $author = wp_kses( $plugin['author'], $qcld_chatplugintags );
123 if ( ! empty( $author ) ) {
124 /* translators: %s: Plugin author. */
125 $author = ' <cite>' . sprintf( __( 'By %s', 'chatbot' ), $author ) . '</cite>';
126 }
127
128 $requires_php = isset( $plugin['requires_php'] ) ? $plugin['requires_php'] : null;
129 $requires_wp = isset( $plugin['requires'] ) ? $plugin['requires'] : null;
130
131 $compatible_php = is_php_version_compatible( $requires_php );
132 $compatible_wp = is_wp_version_compatible( $requires_wp );
133 $tested_wp = ( empty( $plugin['tested'] ) || version_compare( get_bloginfo( 'version' ), $plugin['tested'], '<=' ) );
134
135 $action_links = array();
136
137 if ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) {
138 $status = install_plugin_install_status( $plugin );
139
140 switch ( $status['status'] ) {
141 case 'install':
142 if ( $status['url'] ) {
143 if ( $compatible_php && $compatible_wp ) {
144 $action_links[] = sprintf(
145 '<a class="install-now button" data-slug="%s" href="%s" aria-label="%s" data-name="%s">%s</a>',
146 esc_attr( $plugin['slug'] ),
147 esc_url( $status['url'] ),
148 /* translators: %s: Plugin name and version. */
149 esc_attr( sprintf( _x( 'Install %s now', 'plugin', 'chatbot' ), $name ) ),
150 esc_attr( $name ),
151 __( 'Install Now', 'chatbot' )
152 );
153 } else {
154 $action_links[] = sprintf(
155 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
156 _x( 'Cannot Install', 'plugin', 'chatbot' )
157 );
158 }
159 }
160 break;
161
162 case 'update_available':
163 if ( $status['url'] ) {
164 if ( $compatible_php && $compatible_wp ) {
165 $action_links[] = sprintf(
166 '<a class="update-now button aria-button-if-js" data-plugin="%s" data-slug="%s" href="%s" aria-label="%s" data-name="%s">%s</a>',
167 esc_attr( $status['file'] ),
168 esc_attr( $plugin['slug'] ),
169 esc_url( $status['url'] ),
170 /* translators: %s: Plugin name and version. */
171 esc_attr( sprintf( _x( 'Update %s now', 'plugin', 'chatbot' ), $name ) ),
172 esc_attr( $name ),
173 __( 'Update Now', 'chatbot' )
174 );
175 } else {
176 $action_links[] = sprintf(
177 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
178 _x( 'Cannot Update', 'plugin', 'chatbot' )
179 );
180 }
181 }
182 break;
183
184 case 'latest_installed':
185 case 'newer_installed':
186 if ( is_plugin_active( $status['file'] ) ) {
187 $action_links[] = sprintf(
188 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
189 _x( 'Active', 'plugin', 'chatbot' )
190 );
191 } elseif ( current_user_can( 'activate_plugin', $status['file'] ) ) {
192 $button_text = __( 'Activate', 'chatbot' );
193 /* translators: %s: Plugin name. */
194 $button_label = _x( 'Activate %s', 'plugin', 'chatbot' );
195 $activate_url = add_query_arg(
196 array(
197 '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ),
198 'action' => 'activate',
199 'plugin' => $status['file'],
200 ),
201 network_admin_url( 'plugins.php' )
202 );
203
204 if ( is_network_admin() ) {
205 $button_text = __( 'Network Activate', 'chatbot' );
206 /* translators: %s: Plugin name. */
207 $button_label = _x( 'Network Activate %s', 'plugin', 'chatbot' );
208 $activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url );
209 }
210
211 $action_links[] = sprintf(
212 '<a href="%1$s" class="button activate-now" aria-label="%2$s">%3$s</a>',
213 esc_url( $activate_url ),
214 esc_attr( sprintf( $button_label, $plugin['name'] ) ),
215 $button_text
216 );
217 } else {
218 $action_links[] = sprintf(
219 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
220 _x( 'Installed', 'plugin', 'chatbot' )
221 );
222 }
223 break;
224 }
225 }
226
227 // $details_link = self_admin_url(
228 // 'plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin['slug'] .
229 // '&amp;width=700&amp;height=550'
230 // );
231 // $action_links[] = sprintf( '%s','<a href="#" data-toggle="modal" data-target="#myModal_'.$plugin['slug'].'">More Details</a><div class="modal fade" id="myModal_'.$plugin['slug'].'" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"><div class="modal-dialog" role="document"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button></div><div class="modal-body"><iframe width="100%" height="550" src="'.$details_link.'"></iframe></div></div></div></div>');
232 $plugin_live_link = "https://wordpress.org/plugins/".$plugin['slug'];
233 $action_links[] = sprintf( '%s','<a href="'.esc_url($plugin_live_link).'" target="_blank">' . esc_html__('More Details', 'chatbot') . '</a>');
234 /*===show icon ==*/
235 if ( ! empty( $plugin['icons']['svg'] ) ) {
236 $plugin_icon_url = $plugin['icons']['svg'];
237 } elseif ( ! empty( $plugin['icons']['2x'] ) ) {
238 $plugin_icon_url = $plugin['icons']['2x'];
239 } elseif ( ! empty( $plugin['icons']['1x'] ) ) {
240 $plugin_icon_url = $plugin['icons']['1x'];
241 } else {
242 $plugin_icon_url = $plugin['icons']['default'];
243 }
244 /*
245 * $action_links An array of plugin action links. Defaults are links to Details and Install Now.
246 * $plugin The plugin currently being listed.
247 */
248 $action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin );
249
250 $last_updated_timestamp = strtotime( $plugin['last_updated'] );
251 ?>
252 <div class="plugin-card plugin-card-<?php echo sanitize_html_class( $plugin['slug'] ); ?>">
253 <?php
254 if ( ! $compatible_php || ! $compatible_wp ) {
255 echo '<div class="notice inline notice-error notice-alt"><p>';
256 if ( ! $compatible_php && ! $compatible_wp ) {
257 _e( 'This plugin doesn&#8217;t work with your versions of WordPress and PHP.', 'chatbot' ); // phpcs:ignore WordPress.Security.EscapeOutput.UnsafePrintingFunction
258 if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
259 printf(
260 /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
261 ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.', 'chatbot' ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
262 esc_url( self_admin_url( 'update-core.php' ) ),
263 esc_url( wp_get_update_php_url() )
264 );
265 wp_update_php_annotation( '</p><p><em>', '</em>' );
266 } elseif ( current_user_can( 'update_core' ) ) {
267 printf(
268 /* translators: %s: URL to WordPress Updates screen. */
269 ' ' . __( '<a href="%s">Please update WordPress</a>.', 'chatbot' ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
270 esc_url( self_admin_url( 'update-core.php' ) )
271 );
272 } elseif ( current_user_can( 'update_php' ) ) {
273 printf(
274 /* translators: %s: URL to Update PHP page. */
275 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.', 'chatbot' ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
276 esc_url( wp_get_update_php_url() )
277 );
278 wp_update_php_annotation( '</p><p><em>', '</em>' );
279 }
280 } elseif ( ! $compatible_wp ) {
281 _e( 'This plugin doesn&#8217;t work with your version of WordPress.', 'chatbot' ); // phpcs:ignore WordPress.Security.EscapeOutput.UnsafePrintingFunction
282 if ( current_user_can( 'update_core' ) ) {
283 printf(
284 /* translators: %s: URL to WordPress Updates screen. */
285 ' ' . __( '<a href="%s">Please update WordPress</a>.', 'chatbot' ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
286 esc_url( self_admin_url( 'update-core.php' ) )
287 );
288 }
289 } elseif ( ! $compatible_php ) {
290 _e( 'This plugin doesn&#8217;t work with your version of PHP.', 'chatbot' ); // phpcs:ignore WordPress.Security.EscapeOutput.UnsafePrintingFunction
291 if ( current_user_can( 'update_php' ) ) {
292 printf(
293 /* translators: %s: URL to Update PHP page. */
294 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.', 'chatbot' ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
295 esc_url( wp_get_update_php_url() )
296 );
297 wp_update_php_annotation( '</p><p><em>', '</em>' );
298 }
299 }
300 echo '</p></div>';
301 }
302 ?>
303 <div class="plugin-card-top">
304 <div class="name column-name">
305 <h3>
306 <a href="<?php echo esc_url( $plugin_live_link ); ?>" target="_blank" >
307 <?php echo esc_attr($title); ?>
308
309 <img src="<?php echo esc_attr( $plugin_icon_url ); ?>" class="plugin-icon" alt="" />
310 </a>
311 </h3>
312 </div>
313 <div class="action-links">
314 <?php
315 if ( $action_links ) {
316 echo '<ul class="plugin-action-buttons"><li>' . implode( '</li><li>', array_map( 'wp_kses_post', $action_links ) ) . '</li></ul>';
317 }
318 ?>
319 </div>
320 <?php
321
322 if ( ( isset( $arg['live_preview'] ) && !empty( $arg['live_preview'] ) ) || ( isset( $arg['update_to_pro'] ) && !empty( $arg['update_to_pro'] ) ) ) { ?>
323 <div class="action-pro-links">
324 <ul class="plugin-action-pro-buttons">
325 <?php
326 if ( !empty( $arg['live_preview'] ) ) {
327 echo '<li><a href="'.esc_url( $arg['live_preview'] ).'" target="_blank">' . esc_html__('Live Preview', 'chatbot') . '</a></li>';
328 }
329 if ( !empty( $arg['update_to_pro'] ) ) {
330 echo '<li><a href="'.esc_url( $arg['update_to_pro'] ).'" target="_blank">' . esc_html__('Update To Pro', 'chatbot') . '</a></li>';
331 }
332 ?>
333 </ul>
334 </div>
335 <?php } ?>
336 </div>
337 </div>
338 <?php
339 }
340 }
341 ?>
342 </div>
343 </div>
344
345 </div>
346 <?php
347
348 echo ob_get_clean(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- output buffered using WP APIs with proper escaping throughout
349 exit();
350
351
352
353
354 }
355
356 }
357
358
359 add_action( 'wp_ajax_qcld_recommend_support_function_second_wpchatbot_ajax', 'qcld_recommend_support_function_second_wpchatbot_ajax' );
360 if( !function_exists('qcld_recommend_support_function_second_wpchatbot_ajax') ){
361
362 function qcld_recommend_support_function_second_wpchatbot_ajax(){
363
364 check_ajax_referer( 'wpchatbot', 'security');
365
366 require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
367 remove_all_filters('plugins_api');
368
369 /* Conversational Forms Plugins */
370 $argus = [
371
372 [
373 'slug' => 'phone-directory',
374 'fields' => [
375 'short_description' => true,
376 'icons' => true,
377 'reviews' => false, // excludes all reviews
378 ],
379 'live_preview' => 'https://dev.quantumcloud.net/simple-business-directory/',
380 'update_to_pro' => 'https://www.quantumcloud.net/products/simple-business-directory/'
381 ],
382 [
383 'slug' => 'slider-hero',
384 'fields' => [
385 'short_description' => true,
386 'icons' => true,
387 'reviews' => false, // excludes all reviews
388 ],
389 'live_preview' => 'https://dev2.testversions.com/sliderhero/',
390 'update_to_pro' => 'https://www.quantumcloud.net/products/slider-hero/'
391 ],
392 [
393 'slug' => 'simple-link-directory',
394 'fields' => [
395 'short_description' => true,
396 'icons' => true,
397 'reviews' => false, // excludes all reviews
398 ],
399 'live_preview' => 'https://dev.quantumcloud.net/sld/',
400 'update_to_pro' => 'https://www.quantumcloud.net/products/simple-link-directory/'
401 ]
402
403
404
405 ];
406
407
408
409 ?>
410
411 <div class="recommended-plugins">
412 <div class="wp-list-table widefat plugin-install">
413 <div class="the-list">
414 <?php
415
416 //$qcld_plugininstal = array();
417 foreach ( $argus as $arg ) {
418
419
420 $transient_key = 'qcld_plugin_info_' . md5( $arg['slug'] );
421 $data = get_transient( $transient_key );
422 if ( false === $data ) {
423 $data = plugins_api( 'plugin_information', $arg );
424 if ( $data && ! is_wp_error( $data ) ) {
425 set_transient( $transient_key, $data, 12 * HOUR_IN_SECONDS );
426 }
427 }
428
429 if ( $data && ! is_wp_error( $data ) ) {
430 $qcld_plugininstal['convers-form'] = $data;
431 }
432 foreach ( (array) $qcld_plugininstal as $key => $plugin ) {
433 if ( is_object( $plugin ) ) {
434 $plugin = (array) $plugin;
435 }
436
437 $qcld_chatplugintags = array(
438 'a' => array(
439 'href' => array(),
440 'title' => array(),
441 'target' => array(),
442 ),
443 );
444
445 // Display the group heading if there is one.
446 if ( isset( $plugin['group'] ) && $plugin['group'] != $group ) {
447 if ( isset( $this->groups[ $plugin['group'] ] ) ) {
448 $group_name = $this->groups[ $plugin['group'] ];
449 if ( isset( $plugins_group_titles[ $group_name ] ) ) {
450 $group_name = $plugins_group_titles[ $group_name ];
451 }
452 } else {
453 $group_name = $plugin['group'];
454 }
455
456 // Starting a new group, close off the divs of the last one.
457 if ( ! empty( $group ) ) {
458 echo '</div></div>';
459 }
460
461 echo '<div class="plugin-group"><h3>' . esc_html( $group_name ) . '</h3>';
462 // Needs an extra wrapping div for nth-child selectors to work.
463 echo '<div class="plugin-items">';
464
465 $group = $plugin['group'];
466 }
467 $title = wp_kses( $plugin['name'], $qcld_chatplugintags );
468
469 // Remove any HTML from the description.
470 $description = wp_strip_all_tags( $plugin['short_description'] );
471 $version = wp_kses( $plugin['version'], $qcld_chatplugintags );
472
473 $name = wp_strip_all_tags( $title . ' ' . $version );
474
475 $author = wp_kses( $plugin['author'], $qcld_chatplugintags );
476 if ( ! empty( $author ) ) {
477 /* translators: %s: Plugin author. */
478 $author = ' <cite>' . sprintf( __( 'By %s', 'chatbot' ), $author ) . '</cite>';
479 }
480
481 $requires_php = isset( $plugin['requires_php'] ) ? $plugin['requires_php'] : null;
482 $requires_wp = isset( $plugin['requires'] ) ? $plugin['requires'] : null;
483
484 $compatible_php = is_php_version_compatible( $requires_php );
485 $compatible_wp = is_wp_version_compatible( $requires_wp );
486 $tested_wp = ( empty( $plugin['tested'] ) || version_compare( get_bloginfo( 'version' ), $plugin['tested'], '<=' ) );
487
488 $action_links = array();
489
490 if ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) {
491 $status = install_plugin_install_status( $plugin );
492
493 switch ( $status['status'] ) {
494 case 'install':
495 if ( $status['url'] ) {
496 if ( $compatible_php && $compatible_wp ) {
497 $action_links[] = sprintf(
498 '<a class="install-now button" data-slug="%s" href="%s" aria-label="%s" data-name="%s">%s</a>',
499 esc_attr( $plugin['slug'] ),
500 esc_url( $status['url'] ),
501 /* translators: %s: Plugin name and version. */
502 esc_attr( sprintf( _x( 'Install %s now', 'plugin', 'chatbot' ), $name ) ),
503 esc_attr( $name ),
504 __( 'Install Now', 'chatbot' )
505 );
506 } else {
507 $action_links[] = sprintf(
508 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
509 _x( 'Cannot Install', 'plugin', 'chatbot' )
510 );
511 }
512 }
513 break;
514
515 case 'update_available':
516 if ( $status['url'] ) {
517 if ( $compatible_php && $compatible_wp ) {
518 $action_links[] = sprintf(
519 '<a class="update-now button aria-button-if-js" data-plugin="%s" data-slug="%s" href="%s" aria-label="%s" data-name="%s">%s</a>',
520 esc_attr( $status['file'] ),
521 esc_attr( $plugin['slug'] ),
522 esc_url( $status['url'] ),
523 /* translators: %s: Plugin name and version. */
524 esc_attr( sprintf( _x( 'Update %s now', 'plugin', 'chatbot' ), $name ) ),
525 esc_attr( $name ),
526 __( 'Update Now', 'chatbot' )
527 );
528 } else {
529 $action_links[] = sprintf(
530 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
531 _x( 'Cannot Update', 'plugin', 'chatbot' )
532 );
533 }
534 }
535 break;
536
537 case 'latest_installed':
538 case 'newer_installed':
539 if ( is_plugin_active( $status['file'] ) ) {
540 $action_links[] = sprintf(
541 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
542 _x( 'Active', 'plugin', 'chatbot' )
543 );
544 } elseif ( current_user_can( 'activate_plugin', $status['file'] ) ) {
545 $button_text = __( 'Activate', 'chatbot' );
546 /* translators: %s: Plugin name. */
547 $button_label = _x( 'Activate %s', 'plugin', 'chatbot' );
548 $activate_url = add_query_arg(
549 array(
550 '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ),
551 'action' => 'activate',
552 'plugin' => $status['file'],
553 ),
554 network_admin_url( 'plugins.php' )
555 );
556
557 if ( is_network_admin() ) {
558 $button_text = __( 'Network Activate', 'chatbot' );
559 /* translators: %s: Plugin name. */
560 $button_label = _x( 'Network Activate %s', 'plugin', 'chatbot' );
561 $activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url );
562 }
563
564 $action_links[] = sprintf(
565 '<a href="%1$s" class="button activate-now" aria-label="%2$s">%3$s</a>',
566 esc_url( $activate_url ),
567 esc_attr( sprintf( $button_label, $plugin['name'] ) ),
568 $button_text
569 );
570 } else {
571 $action_links[] = sprintf(
572 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
573 _x( 'Installed', 'plugin', 'chatbot' )
574 );
575 }
576 break;
577 }
578 }
579
580 // $details_link = self_admin_url(
581 // 'plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin['slug'] .
582 // '&amp;width=700&amp;height=550'
583 // );
584 // $action_links[] = sprintf( '%s','<a href="#" data-toggle="modal" data-target="#myModal_'.$plugin['slug'].'">More Details</a><div class="modal fade" id="myModal_'.$plugin['slug'].'" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"><div class="modal-dialog" role="document"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button></div><div class="modal-body"><iframe width="100%" height="550" src="'.$details_link.'"></iframe></div></div></div></div>');
585 $plugin_live_link = "https://wordpress.org/plugins/".$plugin['slug'];
586 $action_links[] = sprintf( '%s','<a href="'.esc_url($plugin_live_link).'" target="_blank">' . esc_html__('More Details', 'chatbot') . '</a>');
587 /*===show icon ==*/
588 if ( ! empty( $plugin['icons']['svg'] ) ) {
589 $plugin_icon_url = $plugin['icons']['svg'];
590 } elseif ( ! empty( $plugin['icons']['2x'] ) ) {
591 $plugin_icon_url = $plugin['icons']['2x'];
592 } elseif ( ! empty( $plugin['icons']['1x'] ) ) {
593 $plugin_icon_url = $plugin['icons']['1x'];
594 } else {
595 $plugin_icon_url = $plugin['icons']['default'];
596 }
597 /*
598 * $action_links An array of plugin action links. Defaults are links to Details and Install Now.
599 * $plugin The plugin currently being listed.
600 */
601 $action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin );
602
603 $last_updated_timestamp = strtotime( $plugin['last_updated'] );
604 ?>
605 <div class="plugin-card plugin-card-<?php echo sanitize_html_class( $plugin['slug'] ); ?>">
606 <?php
607 if ( ! $compatible_php || ! $compatible_wp ) {
608 echo '<div class="notice inline notice-error notice-alt"><p>';
609 if ( ! $compatible_php && ! $compatible_wp ) {
610 _e( 'This plugin doesn&#8217;t work with your versions of WordPress and PHP.', 'chatbot' ); // phpcs:ignore WordPress.Security.EscapeOutput.UnsafePrintingFunction
611 if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
612 printf(
613 /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
614 ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.', 'chatbot' ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
615 esc_url( self_admin_url( 'update-core.php' ) ),
616 esc_url( wp_get_update_php_url() )
617 );
618 wp_update_php_annotation( '</p><p><em>', '</em>' );
619 } elseif ( current_user_can( 'update_core' ) ) {
620 printf(
621 /* translators: %s: URL to WordPress Updates screen. */
622 ' ' . __( '<a href="%s">Please update WordPress</a>.', 'chatbot' ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
623 esc_url( self_admin_url( 'update-core.php' ) )
624 );
625 } elseif ( current_user_can( 'update_php' ) ) {
626 printf(
627 /* translators: %s: URL to Update PHP page. */
628 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.', 'chatbot' ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
629 esc_url( wp_get_update_php_url() )
630 );
631 wp_update_php_annotation( '</p><p><em>', '</em>' );
632 }
633 } elseif ( ! $compatible_wp ) {
634 _e( 'This plugin doesn&#8217;t work with your version of WordPress.', 'chatbot' ); // phpcs:ignore WordPress.Security.EscapeOutput.UnsafePrintingFunction
635 if ( current_user_can( 'update_core' ) ) {
636 printf(
637 /* translators: %s: URL to WordPress Updates screen. */
638 ' ' . __( '<a href="%s">Please update WordPress</a>.', 'chatbot' ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
639 esc_url( self_admin_url( 'update-core.php' ) )
640 );
641 }
642 } elseif ( ! $compatible_php ) {
643 _e( 'This plugin doesn&#8217;t work with your version of PHP.', 'chatbot' ); // phpcs:ignore WordPress.Security.EscapeOutput.UnsafePrintingFunction
644 if ( current_user_can( 'update_php' ) ) {
645 printf(
646 /* translators: %s: URL to Update PHP page. */
647 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.', 'chatbot' ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
648 esc_url( wp_get_update_php_url() )
649 );
650 wp_update_php_annotation( '</p><p><em>', '</em>' );
651 }
652 }
653 echo '</p></div>';
654 }
655 ?>
656 <div class="plugin-card-top">
657 <div class="name column-name">
658 <h3>
659 <a href="<?php echo esc_url( $plugin_live_link ); ?>" target="_blank" >
660 <?php echo esc_attr($title); ?>
661
662 <img src="<?php echo esc_attr( $plugin_icon_url ); ?>" class="plugin-icon" alt="" />
663 </a>
664 </h3>
665 </div>
666 <div class="action-links">
667 <?php
668 if ( $action_links ) {
669 echo '<ul class="plugin-action-buttons"><li>' . implode( '</li><li>', array_map( 'wp_kses_post', $action_links ) ) . '</li></ul>';
670 }
671 ?>
672 </div>
673 <?php
674
675 if ( ( isset( $arg['live_preview'] ) && !empty( $arg['live_preview'] ) ) || ( isset( $arg['update_to_pro'] ) && !empty( $arg['update_to_pro'] ) ) ) { ?>
676 <div class="action-pro-links">
677 <ul class="plugin-action-pro-buttons">
678 <?php
679 if ( !empty( $arg['live_preview'] ) ) {
680 echo '<li><a href="'.esc_url( $arg['live_preview'] ).'" target="_blank">' . esc_html__('Live Preview', 'chatbot') . '</a></li>';
681 }
682 if ( !empty( $arg['update_to_pro'] ) ) {
683 echo '<li><a href="'.esc_url( $arg['update_to_pro'] ).'" target="_blank">' . esc_html__('Update To Pro', 'chatbot') . '</a></li>';
684 }
685 ?>
686 </ul>
687 </div>
688 <?php } ?>
689 </div>
690 </div>
691 <?php
692 }
693 }
694 ?>
695 </div>
696 </div>
697
698 </div>
699 <?php
700
701 echo ob_get_clean(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- output buffered using WP APIs with proper escaping throughout
702 exit();
703
704
705
706
707 }
708
709 }
710
711
712
713 add_action( 'wp_ajax_qcld_recommend_support_function_third_wpchatbot_ajax', 'qcld_recommend_support_function_third_wpchatbot_ajax' );
714 if( !function_exists('qcld_recommend_support_function_third_wpchatbot_ajax') ){
715
716 function qcld_recommend_support_function_third_wpchatbot_ajax(){
717
718 check_ajax_referer( 'wpchatbot', 'security');
719
720 require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
721 remove_all_filters('plugins_api');
722
723 /* Conversational Forms Plugins */
724 $argus = [
725
726 [
727 'slug' => 'infographic-and-list-builder-ilist',
728 'fields' => [
729 'short_description' => true,
730 'icons' => true,
731 'reviews' => false, // excludes all reviews
732 ],
733 'live_preview' => 'https://dev.quantumcloud.net/iList/',
734 'update_to_pro' => 'https://www.quantumcloud.net/products/infographic-maker-ilist/'
735 ],
736 [
737 'slug' => 'ichart',
738 'fields' => [
739 'short_description' => true,
740 'icons' => true,
741 'reviews' => false, // excludes all reviews
742 ],
743 'live_preview' => 'https://dev.quantumcloud.net/ichart/',
744 'update_to_pro' => 'https://www.quantumcloud.net/products/ichart/'
745 ],
746 [
747 'slug' => 'comment-link-remove',
748 'fields' => [
749 'short_description' => true,
750 'icons' => true,
751 'reviews' => false, // excludes all reviews
752 ],
753 'live_preview' => 'https://dev.quantumcloud.net/comment-tools/',
754 'update_to_pro' => 'https://www.quantumcloud.net/products/comment-tools/'
755 ],
756 [
757 'slug' => 'shop-assistant-for-woocommerce-jarvis',
758 'fields' => [
759 'short_description' => true,
760 'icons' => true,
761 'reviews' => false, // excludes all reviews
762 ],
763 'live_preview' => 'https://dev.quantumcloud.net/JARVIS-woo/',
764 'update_to_pro' => 'https://www.quantumcloud.net/products/woocommerce-shop-assistant-jarvis/'
765 ],
766 [
767 'slug' => 'express-shop',
768 'fields' => [
769 'short_description' => true,
770 'icons' => true,
771 'reviews' => false, // excludes all reviews
772 ],
773 'live_preview' => 'https://dev.quantumcloud.net/express-shop-pro/',
774 'update_to_pro' => 'https://www.quantumcloud.net/products/express-shop/'
775 ],
776
777 [
778 'slug' => 'woo-tabbed-category-product-listing',
779 'fields' => [
780 'short_description' => true,
781 'icons' => true,
782 'reviews' => false, // excludes all reviews
783 ],
784 'live_preview' => 'https://dev.quantumcloud.net/woocommerce-tabbed-product-display/',
785 'update_to_pro' => 'https://www.quantumcloud.net/products/woo-tabbed-category-product-listing/'
786 ]
787
788
789
790 ];
791
792
793
794 ?>
795
796 <div class="recommended-plugins">
797 <div class="wp-list-table widefat plugin-install">
798 <div class="the-list">
799 <?php
800
801 //$qcld_plugininstal = array();
802 foreach ( $argus as $arg ) {
803
804
805 $transient_key = 'qcld_plugin_info_' . md5( $arg['slug'] );
806 $data = get_transient( $transient_key );
807 if ( false === $data ) {
808 $data = plugins_api( 'plugin_information', $arg );
809 if ( $data && ! is_wp_error( $data ) ) {
810 set_transient( $transient_key, $data, 12 * HOUR_IN_SECONDS );
811 }
812 }
813
814 if ( $data && ! is_wp_error( $data ) ) {
815 $qcld_plugininstal['convers-form'] = $data;
816 }
817 foreach ( (array) $qcld_plugininstal as $key => $plugin ) {
818 if ( is_object( $plugin ) ) {
819 $plugin = (array) $plugin;
820 }
821
822 $qcld_chatplugintags = array(
823 'a' => array(
824 'href' => array(),
825 'title' => array(),
826 'target' => array(),
827 ),
828 );
829
830 // Display the group heading if there is one.
831 if ( isset( $plugin['group'] ) && $plugin['group'] != $group ) {
832 if ( isset( $this->groups[ $plugin['group'] ] ) ) {
833 $group_name = $this->groups[ $plugin['group'] ];
834 if ( isset( $plugins_group_titles[ $group_name ] ) ) {
835 $group_name = $plugins_group_titles[ $group_name ];
836 }
837 } else {
838 $group_name = $plugin['group'];
839 }
840
841 // Starting a new group, close off the divs of the last one.
842 if ( ! empty( $group ) ) {
843 echo '</div></div>';
844 }
845
846 echo '<div class="plugin-group"><h3>' . esc_html( $group_name ) . '</h3>';
847 // Needs an extra wrapping div for nth-child selectors to work.
848 echo '<div class="plugin-items">';
849
850 $group = $plugin['group'];
851 }
852 $title = wp_kses( $plugin['name'], $qcld_chatplugintags );
853
854 // Remove any HTML from the description.
855 $description = wp_strip_all_tags( $plugin['short_description'] );
856 $version = wp_kses( $plugin['version'], $qcld_chatplugintags );
857
858 $name = wp_strip_all_tags( $title . ' ' . $version );
859
860 $author = wp_kses( $plugin['author'], $qcld_chatplugintags );
861 if ( ! empty( $author ) ) {
862 /* translators: %s: Plugin author. */
863 $author = ' <cite>' . sprintf( __( 'By %s', 'chatbot' ), $author ) . '</cite>';
864 }
865
866 $requires_php = isset( $plugin['requires_php'] ) ? $plugin['requires_php'] : null;
867 $requires_wp = isset( $plugin['requires'] ) ? $plugin['requires'] : null;
868
869 $compatible_php = is_php_version_compatible( $requires_php );
870 $compatible_wp = is_wp_version_compatible( $requires_wp );
871 $tested_wp = ( empty( $plugin['tested'] ) || version_compare( get_bloginfo( 'version' ), $plugin['tested'], '<=' ) );
872
873 $action_links = array();
874
875 if ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) {
876 $status = install_plugin_install_status( $plugin );
877
878 switch ( $status['status'] ) {
879 case 'install':
880 if ( $status['url'] ) {
881 if ( $compatible_php && $compatible_wp ) {
882 $action_links[] = sprintf(
883 '<a class="install-now button" data-slug="%s" href="%s" aria-label="%s" data-name="%s">%s</a>',
884 esc_attr( $plugin['slug'] ),
885 esc_url( $status['url'] ),
886 /* translators: %s: Plugin name and version. */
887 esc_attr( sprintf( _x( 'Install %s now', 'plugin', 'chatbot' ), $name ) ),
888 esc_attr( $name ),
889 __( 'Install Now', 'chatbot' )
890 );
891 } else {
892 $action_links[] = sprintf(
893 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
894 _x( 'Cannot Install', 'plugin', 'chatbot' )
895 );
896 }
897 }
898 break;
899
900 case 'update_available':
901 if ( $status['url'] ) {
902 if ( $compatible_php && $compatible_wp ) {
903 $action_links[] = sprintf(
904 '<a class="update-now button aria-button-if-js" data-plugin="%s" data-slug="%s" href="%s" aria-label="%s" data-name="%s">%s</a>',
905 esc_attr( $status['file'] ),
906 esc_attr( $plugin['slug'] ),
907 esc_url( $status['url'] ),
908 /* translators: %s: Plugin name and version. */
909 esc_attr( sprintf( _x( 'Update %s now', 'plugin', 'chatbot' ), $name ) ),
910 esc_attr( $name ),
911 __( 'Update Now', 'chatbot' )
912 );
913 } else {
914 $action_links[] = sprintf(
915 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
916 _x( 'Cannot Update', 'plugin', 'chatbot' )
917 );
918 }
919 }
920 break;
921
922 case 'latest_installed':
923 case 'newer_installed':
924 if ( is_plugin_active( $status['file'] ) ) {
925 $action_links[] = sprintf(
926 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
927 _x( 'Active', 'plugin', 'chatbot' )
928 );
929 } elseif ( current_user_can( 'activate_plugin', $status['file'] ) ) {
930 $button_text = __( 'Activate', 'chatbot' );
931 /* translators: %s: Plugin name. */
932 $button_label = _x( 'Activate %s', 'plugin', 'chatbot' );
933 $activate_url = add_query_arg(
934 array(
935 '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ),
936 'action' => 'activate',
937 'plugin' => $status['file'],
938 ),
939 network_admin_url( 'plugins.php' )
940 );
941
942 if ( is_network_admin() ) {
943 $button_text = __( 'Network Activate', 'chatbot' );
944 /* translators: %s: Plugin name. */
945 $button_label = _x( 'Network Activate %s', 'plugin', 'chatbot' );
946 $activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url );
947 }
948
949 $action_links[] = sprintf(
950 '<a href="%1$s" class="button activate-now" aria-label="%2$s">%3$s</a>',
951 esc_url( $activate_url ),
952 esc_attr( sprintf( $button_label, $plugin['name'] ) ),
953 $button_text
954 );
955 } else {
956 $action_links[] = sprintf(
957 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
958 _x( 'Installed', 'plugin', 'chatbot' )
959 );
960 }
961 break;
962 }
963 }
964
965 // $details_link = self_admin_url(
966 // 'plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin['slug'] .
967 // '&amp;width=700&amp;height=550'
968 // );
969 // $action_links[] = sprintf( '%s','<a href="#" data-toggle="modal" data-target="#myModal_'.$plugin['slug'].'">More Details</a><div class="modal fade" id="myModal_'.$plugin['slug'].'" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"><div class="modal-dialog" role="document"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button></div><div class="modal-body"><iframe width="100%" height="550" src="'.$details_link.'"></iframe></div></div></div></div>');
970 $plugin_live_link = "https://wordpress.org/plugins/".$plugin['slug'];
971 $action_links[] = sprintf( '%s','<a href="'.esc_url($plugin_live_link).'" target="_blank">' . esc_html__('More Details', 'chatbot') . '</a>');
972 /*===show icon ==*/
973 if ( ! empty( $plugin['icons']['svg'] ) ) {
974 $plugin_icon_url = $plugin['icons']['svg'];
975 } elseif ( ! empty( $plugin['icons']['2x'] ) ) {
976 $plugin_icon_url = $plugin['icons']['2x'];
977 } elseif ( ! empty( $plugin['icons']['1x'] ) ) {
978 $plugin_icon_url = $plugin['icons']['1x'];
979 } else {
980 $plugin_icon_url = $plugin['icons']['default'];
981 }
982 /*
983 * $action_links An array of plugin action links. Defaults are links to Details and Install Now.
984 * $plugin The plugin currently being listed.
985 */
986 $action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin );
987
988 $last_updated_timestamp = strtotime( $plugin['last_updated'] );
989 ?>
990 <div class="plugin-card plugin-card-<?php echo sanitize_html_class( $plugin['slug'] ); ?>">
991 <?php
992 if ( ! $compatible_php || ! $compatible_wp ) {
993 echo '<div class="notice inline notice-error notice-alt"><p>';
994 if ( ! $compatible_php && ! $compatible_wp ) {
995 _e( 'This plugin doesn&#8217;t work with your versions of WordPress and PHP.', 'chatbot' ); // phpcs:ignore WordPress.Security.EscapeOutput.UnsafePrintingFunction
996 if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
997 printf(
998 /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
999 ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.', 'chatbot' ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1000 esc_url( self_admin_url( 'update-core.php' ) ),
1001 esc_url( wp_get_update_php_url() )
1002 );
1003 wp_update_php_annotation( '</p><p><em>', '</em>' );
1004 } elseif ( current_user_can( 'update_core' ) ) {
1005 printf(
1006 /* translators: %s: URL to WordPress Updates screen. */
1007 ' ' . __( '<a href="%s">Please update WordPress</a>.', 'chatbot' ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1008 esc_url( self_admin_url( 'update-core.php' ) )
1009 );
1010 } elseif ( current_user_can( 'update_php' ) ) {
1011 printf(
1012 /* translators: %s: URL to Update PHP page. */
1013 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.', 'chatbot' ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1014 esc_url( wp_get_update_php_url() )
1015 );
1016 wp_update_php_annotation( '</p><p><em>', '</em>' );
1017 }
1018 } elseif ( ! $compatible_wp ) {
1019 _e( 'This plugin doesn&#8217;t work with your version of WordPress.', 'chatbot' ); // phpcs:ignore WordPress.Security.EscapeOutput.UnsafePrintingFunction
1020 if ( current_user_can( 'update_core' ) ) {
1021 printf(
1022 /* translators: %s: URL to WordPress Updates screen. */
1023 ' ' . __( '<a href="%s">Please update WordPress</a>.', 'chatbot' ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1024 esc_url( self_admin_url( 'update-core.php' ) )
1025 );
1026 }
1027 } elseif ( ! $compatible_php ) {
1028 _e( 'This plugin doesn&#8217;t work with your version of PHP.', 'chatbot' ); // phpcs:ignore WordPress.Security.EscapeOutput.UnsafePrintingFunction
1029 if ( current_user_can( 'update_php' ) ) {
1030 printf(
1031 /* translators: %s: URL to Update PHP page. */
1032 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.', 'chatbot' ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1033 esc_url( wp_get_update_php_url() )
1034 );
1035 wp_update_php_annotation( '</p><p><em>', '</em>' );
1036 }
1037 }
1038 echo '</p></div>';
1039 }
1040 ?>
1041 <div class="plugin-card-top">
1042 <div class="name column-name">
1043 <h3>
1044 <a href="<?php echo esc_url( $plugin_live_link ); ?>" target="_blank" >
1045 <?php echo esc_attr($title); ?>
1046
1047 <img src="<?php echo esc_attr( $plugin_icon_url ); ?>" class="plugin-icon" alt="" />
1048 </a>
1049 </h3>
1050 </div>
1051 <div class="action-links">
1052 <?php
1053 if ( $action_links ) {
1054 echo '<ul class="plugin-action-buttons"><li>' . implode( '</li><li>', array_map( 'wp_kses_post', $action_links ) ) . '</li></ul>';
1055 }
1056 ?>
1057 </div>
1058 <?php
1059
1060 if ( ( isset( $arg['live_preview'] ) && !empty( $arg['live_preview'] ) ) || ( isset( $arg['update_to_pro'] ) && !empty( $arg['update_to_pro'] ) ) ) { ?>
1061 <div class="action-pro-links">
1062 <ul class="plugin-action-pro-buttons">
1063 <?php
1064 if ( !empty( $arg['live_preview'] ) ) {
1065 echo '<li><a href="'.esc_url( $arg['live_preview'] ).'" target="_blank">' . esc_html__('Live Preview', 'chatbot') . '</a></li>';
1066 }
1067 if ( !empty( $arg['update_to_pro'] ) ) {
1068 echo '<li><a href="'.esc_url( $arg['update_to_pro'] ).'" target="_blank">' . esc_html__('Update To Pro', 'chatbot') . '</a></li>';
1069 }
1070 ?>
1071 </ul>
1072 </div>
1073 <?php } ?>
1074 </div>
1075 </div>
1076 <?php
1077 }
1078 }
1079 ?>
1080 </div>
1081 </div>
1082
1083 </div>
1084 <?php
1085
1086 echo ob_get_clean(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- output buffered using WP APIs with proper escaping throughout
1087 exit();
1088
1089
1090
1091
1092 }
1093
1094 }
1095
1096
1097
1098
1099 add_action( 'wp_ajax_qcld_recommend_support_function_four_wpchatbot_ajax', 'qcld_recommend_support_function_four_wpchatbot_ajax' );
1100 if( !function_exists('qcld_recommend_support_function_four_wpchatbot_ajax') ){
1101
1102 function qcld_recommend_support_function_four_wpchatbot_ajax(){
1103
1104 check_ajax_referer( 'wpchatbot', 'security');
1105
1106 require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
1107 remove_all_filters('plugins_api');
1108
1109 /* Conversational Forms Plugins */
1110 $argus = [
1111
1112 [
1113 'slug' => 'portfolio-x',
1114 'fields' => [
1115 'short_description' => true,
1116 'icons' => true,
1117 'reviews' => false, // excludes all reviews
1118 ],
1119 'live_preview' => 'https://dev.quantumcloud.net/portfolio-x/',
1120 'update_to_pro' => 'https://www.quantumcloud.net/products/portfolio-x-plugin/'
1121 ],
1122 [
1123 'slug' => 'bargain',
1124 'fields' => [
1125 'short_description' => true,
1126 'icons' => true,
1127 'reviews' => false, // excludes all reviews
1128 ],
1129 'live_preview' => 'https://dev.quantumcloud.net/bargainbot/',
1130 'update_to_pro' => 'https://www.quantumcloud.net/products/bargain-bot/'
1131 ],
1132
1133 [
1134 'slug' => 'highlight',
1135 'fields' => [
1136 'short_description' => true,
1137 'icons' => true,
1138 'reviews' => false, // excludes all reviews
1139 ],
1140 'live_preview' => 'https://dev.dna88.com/highlight/',
1141 'update_to_pro' => 'https://www.dna88.com/product/highlight/'
1142 ],
1143 [
1144 'slug' => 'video-connect',
1145 'fields' => [
1146 'short_description' => true,
1147 'icons' => true,
1148 'reviews' => false, // excludes all reviews
1149 ],
1150 'live_preview' => 'https://dev.dna88.com/video-connect/',
1151 'update_to_pro' => 'https://www.dna88.com/product/video-connect/'
1152 ],
1153
1154 [
1155 'slug' => 'voice-widgets',
1156 'fields' => [
1157 'short_description' => true,
1158 'icons' => true,
1159 'reviews' => false, // excludes all reviews
1160 ],
1161 'live_preview' => 'https://dev.dna88.com/voice-widgets/',
1162 'update_to_pro' => 'https://www.dna88.com/product/voice-widgets-pro/'
1163 ],
1164
1165 [
1166 'slug' => 'seo-help',
1167 'fields' => [
1168 'short_description' => true,
1169 'icons' => true,
1170 'reviews' => false, // excludes all reviews
1171 ],
1172 'live_preview' => '',
1173 'update_to_pro' => 'https://www.dna88.com/product/seo-help-pro/'
1174 ],
1175 [
1176 'slug' => 'logo-or-image-replace',
1177 'fields' => [
1178 'short_description' => true,
1179 'icons' => true,
1180 'reviews' => false, // excludes all reviews
1181 ],
1182 'live_preview' => '',
1183 'update_to_pro' => 'https://www.quantumcloud.net/products/image-tools-for-wordpress/'
1184 ],
1185 [
1186 'slug' => 'simple-media-directory',
1187 'fields' => [
1188 'short_description' => true,
1189 'icons' => true,
1190 'reviews' => false, // excludes all reviews
1191 ],
1192 'live_preview' => 'https://dev.quantumcloud.net/simple-media-directory/',
1193 'update_to_pro' => ''
1194 ],
1195
1196 [
1197 'slug' => 'increase-sales',
1198 'fields' => [
1199 'short_description' => true,
1200 'icons' => true,
1201 'reviews' => false, // excludes all reviews
1202 ],
1203 'live_preview' => '',
1204 'update_to_pro' => ''
1205 ]
1206
1207
1208
1209 ];
1210
1211
1212
1213 ?>
1214
1215 <div class="recommended-plugins">
1216 <div class="wp-list-table widefat plugin-install">
1217 <div class="the-list">
1218 <?php
1219
1220 //$qcld_plugininstal = array();
1221 foreach ( $argus as $arg ) {
1222
1223
1224 $transient_key = 'qcld_plugin_info_' . md5( $arg['slug'] );
1225 $data = get_transient( $transient_key );
1226 if ( false === $data ) {
1227 $data = plugins_api( 'plugin_information', $arg );
1228 if ( $data && ! is_wp_error( $data ) ) {
1229 set_transient( $transient_key, $data, 12 * HOUR_IN_SECONDS );
1230 }
1231 }
1232
1233 if ( $data && ! is_wp_error( $data ) ) {
1234 $qcld_plugininstal['convers-form'] = $data;
1235 }
1236 foreach ( (array) $qcld_plugininstal as $key => $plugin ) {
1237 if ( is_object( $plugin ) ) {
1238 $plugin = (array) $plugin;
1239 }
1240
1241 $qcld_chatplugintags = array(
1242 'a' => array(
1243 'href' => array(),
1244 'title' => array(),
1245 'target' => array(),
1246 ),
1247 );
1248
1249 // Display the group heading if there is one.
1250 if ( isset( $plugin['group'] ) && $plugin['group'] != $group ) {
1251 if ( isset( $this->groups[ $plugin['group'] ] ) ) {
1252 $group_name = $this->groups[ $plugin['group'] ];
1253 if ( isset( $plugins_group_titles[ $group_name ] ) ) {
1254 $group_name = $plugins_group_titles[ $group_name ];
1255 }
1256 } else {
1257 $group_name = $plugin['group'];
1258 }
1259
1260 // Starting a new group, close off the divs of the last one.
1261 if ( ! empty( $group ) ) {
1262 echo '</div></div>';
1263 }
1264
1265 echo '<div class="plugin-group"><h3>' . esc_html( $group_name ) . '</h3>';
1266 // Needs an extra wrapping div for nth-child selectors to work.
1267 echo '<div class="plugin-items">';
1268
1269 $group = $plugin['group'];
1270 }
1271 $title = wp_kses( $plugin['name'], $qcld_chatplugintags );
1272
1273 // Remove any HTML from the description.
1274 $description = wp_strip_all_tags( $plugin['short_description'] );
1275 $version = wp_kses( $plugin['version'], $qcld_chatplugintags );
1276
1277 $name = wp_strip_all_tags( $title . ' ' . $version );
1278
1279 $author = wp_kses( $plugin['author'], $qcld_chatplugintags );
1280 if ( ! empty( $author ) ) {
1281 /* translators: %s: Plugin author. */
1282 $author = ' <cite>' . sprintf( __( 'By %s', 'chatbot' ), $author ) . '</cite>';
1283 }
1284
1285 $requires_php = isset( $plugin['requires_php'] ) ? $plugin['requires_php'] : null;
1286 $requires_wp = isset( $plugin['requires'] ) ? $plugin['requires'] : null;
1287
1288 $compatible_php = is_php_version_compatible( $requires_php );
1289 $compatible_wp = is_wp_version_compatible( $requires_wp );
1290 $tested_wp = ( empty( $plugin['tested'] ) || version_compare( get_bloginfo( 'version' ), $plugin['tested'], '<=' ) );
1291
1292 $action_links = array();
1293
1294 if ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) {
1295 $status = install_plugin_install_status( $plugin );
1296
1297 switch ( $status['status'] ) {
1298 case 'install':
1299 if ( $status['url'] ) {
1300 if ( $compatible_php && $compatible_wp ) {
1301 $action_links[] = sprintf(
1302 '<a class="install-now button" data-slug="%s" href="%s" aria-label="%s" data-name="%s">%s</a>',
1303 esc_attr( $plugin['slug'] ),
1304 esc_url( $status['url'] ),
1305 /* translators: %s: Plugin name and version. */
1306 esc_attr( sprintf( _x( 'Install %s now', 'plugin', 'chatbot' ), $name ) ),
1307 esc_attr( $name ),
1308 __( 'Install Now', 'chatbot' )
1309 );
1310 } else {
1311 $action_links[] = sprintf(
1312 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
1313 _x( 'Cannot Install', 'plugin', 'chatbot' )
1314 );
1315 }
1316 }
1317 break;
1318
1319 case 'update_available':
1320 if ( $status['url'] ) {
1321 if ( $compatible_php && $compatible_wp ) {
1322 $action_links[] = sprintf(
1323 '<a class="update-now button aria-button-if-js" data-plugin="%s" data-slug="%s" href="%s" aria-label="%s" data-name="%s">%s</a>',
1324 esc_attr( $status['file'] ),
1325 esc_attr( $plugin['slug'] ),
1326 esc_url( $status['url'] ),
1327 /* translators: %s: Plugin name and version. */
1328 esc_attr( sprintf( _x( 'Update %s now', 'plugin', 'chatbot' ), $name ) ),
1329 esc_attr( $name ),
1330 __( 'Update Now', 'chatbot' )
1331 );
1332 } else {
1333 $action_links[] = sprintf(
1334 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
1335 _x( 'Cannot Update', 'plugin', 'chatbot' )
1336 );
1337 }
1338 }
1339 break;
1340
1341 case 'latest_installed':
1342 case 'newer_installed':
1343 if ( is_plugin_active( $status['file'] ) ) {
1344 $action_links[] = sprintf(
1345 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
1346 _x( 'Active', 'plugin', 'chatbot' )
1347 );
1348 } elseif ( current_user_can( 'activate_plugin', $status['file'] ) ) {
1349 $button_text = __( 'Activate', 'chatbot' );
1350 /* translators: %s: Plugin name. */
1351 $button_label = _x( 'Activate %s', 'plugin', 'chatbot' );
1352 $activate_url = add_query_arg(
1353 array(
1354 '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ),
1355 'action' => 'activate',
1356 'plugin' => $status['file'],
1357 ),
1358 network_admin_url( 'plugins.php' )
1359 );
1360
1361 if ( is_network_admin() ) {
1362 $button_text = __( 'Network Activate', 'chatbot' );
1363 /* translators: %s: Plugin name. */
1364 $button_label = _x( 'Network Activate %s', 'plugin', 'chatbot' );
1365 $activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url );
1366 }
1367
1368 $action_links[] = sprintf(
1369 '<a href="%1$s" class="button activate-now" aria-label="%2$s">%3$s</a>',
1370 esc_url( $activate_url ),
1371 esc_attr( sprintf( $button_label, $plugin['name'] ) ),
1372 $button_text
1373 );
1374 } else {
1375 $action_links[] = sprintf(
1376 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
1377 _x( 'Installed', 'plugin', 'chatbot' )
1378 );
1379 }
1380 break;
1381 }
1382 }
1383
1384 // $details_link = self_admin_url(
1385 // 'plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin['slug'] .
1386 // '&amp;width=700&amp;height=550'
1387 // );
1388 // $action_links[] = sprintf( '%s','<a href="#" data-toggle="modal" data-target="#myModal_'.$plugin['slug'].'">More Details</a><div class="modal fade" id="myModal_'.$plugin['slug'].'" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"><div class="modal-dialog" role="document"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button></div><div class="modal-body"><iframe width="100%" height="550" src="'.$details_link.'"></iframe></div></div></div></div>');
1389 $plugin_live_link = "https://wordpress.org/plugins/".$plugin['slug'];
1390 $action_links[] = sprintf( '%s','<a href="'.esc_url($plugin_live_link).'" target="_blank">' . esc_html__('More Details', 'chatbot') . '</a>');
1391 /*===show icon ==*/
1392 if ( ! empty( $plugin['icons']['svg'] ) ) {
1393 $plugin_icon_url = $plugin['icons']['svg'];
1394 } elseif ( ! empty( $plugin['icons']['2x'] ) ) {
1395 $plugin_icon_url = $plugin['icons']['2x'];
1396 } elseif ( ! empty( $plugin['icons']['1x'] ) ) {
1397 $plugin_icon_url = $plugin['icons']['1x'];
1398 } else {
1399 $plugin_icon_url = $plugin['icons']['default'];
1400 }
1401 /*
1402 * $action_links An array of plugin action links. Defaults are links to Details and Install Now.
1403 * $plugin The plugin currently being listed.
1404 */
1405 $action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin );
1406
1407 $last_updated_timestamp = strtotime( $plugin['last_updated'] );
1408 ?>
1409 <div class="plugin-card plugin-card-<?php echo sanitize_html_class( $plugin['slug'] ); ?>">
1410 <?php
1411 if ( ! $compatible_php || ! $compatible_wp ) {
1412 echo '<div class="notice inline notice-error notice-alt"><p>';
1413 if ( ! $compatible_php && ! $compatible_wp ) {
1414 _e( 'This plugin doesn&#8217;t work with your versions of WordPress and PHP.', 'chatbot' ); // phpcs:ignore WordPress.Security.EscapeOutput.UnsafePrintingFunction
1415 if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
1416 printf(
1417 /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
1418 ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.', 'chatbot' ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1419 esc_url( self_admin_url( 'update-core.php' ) ),
1420 esc_url( wp_get_update_php_url() )
1421 );
1422 wp_update_php_annotation( '</p><p><em>', '</em>' );
1423 } elseif ( current_user_can( 'update_core' ) ) {
1424 printf(
1425 /* translators: %s: URL to WordPress Updates screen. */
1426 ' ' . __( '<a href="%s">Please update WordPress</a>.', 'chatbot' ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1427 esc_url( self_admin_url( 'update-core.php' ) )
1428 );
1429 } elseif ( current_user_can( 'update_php' ) ) {
1430 printf(
1431 /* translators: %s: URL to Update PHP page. */
1432 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.', 'chatbot' ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1433 esc_url( wp_get_update_php_url() )
1434 );
1435 wp_update_php_annotation( '</p><p><em>', '</em>' );
1436 }
1437 } elseif ( ! $compatible_wp ) {
1438 _e( 'This plugin doesn&#8217;t work with your version of WordPress.', 'chatbot' ); // phpcs:ignore WordPress.Security.EscapeOutput.UnsafePrintingFunction
1439 if ( current_user_can( 'update_core' ) ) {
1440 printf(
1441 /* translators: %s: URL to WordPress Updates screen. */
1442 ' ' . __( '<a href="%s">Please update WordPress</a>.', 'chatbot' ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1443 esc_url( self_admin_url( 'update-core.php' ) )
1444 );
1445 }
1446 } elseif ( ! $compatible_php ) {
1447 _e( 'This plugin doesn&#8217;t work with your version of PHP.', 'chatbot' ); // phpcs:ignore WordPress.Security.EscapeOutput.UnsafePrintingFunction
1448 if ( current_user_can( 'update_php' ) ) {
1449 printf(
1450 /* translators: %s: URL to Update PHP page. */
1451 ' ' . __( '<a href="%s">Learn more about updating PHP</a>.', 'chatbot' ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1452 esc_url( wp_get_update_php_url() )
1453 );
1454 wp_update_php_annotation( '</p><p><em>', '</em>' );
1455 }
1456 }
1457 echo '</p></div>';
1458 }
1459 ?>
1460 <div class="plugin-card-top">
1461 <div class="name column-name">
1462 <h3>
1463 <a href="<?php echo esc_url( $plugin_live_link ); ?>" target="_blank" >
1464 <?php echo esc_attr($title); ?>
1465
1466 <img src="<?php echo esc_attr( $plugin_icon_url ); ?>" class="plugin-icon" alt="" />
1467 </a>
1468 </h3>
1469 </div>
1470 <div class="action-links">
1471 <?php
1472 if ( $action_links ) {
1473 echo '<ul class="plugin-action-buttons"><li>' . implode( '</li><li>', array_map( 'wp_kses_post', $action_links ) ) . '</li></ul>';
1474 }
1475 ?>
1476 </div>
1477 <?php
1478
1479 if ( ( isset( $arg['live_preview'] ) && !empty( $arg['live_preview'] ) ) || ( isset( $arg['update_to_pro'] ) && !empty( $arg['update_to_pro'] ) ) ) { ?>
1480 <div class="action-pro-links">
1481 <ul class="plugin-action-pro-buttons">
1482 <?php
1483 if ( !empty( $arg['live_preview'] ) ) {
1484 echo '<li><a href="'.esc_url( $arg['live_preview'] ).'" target="_blank">' . esc_html__('Live Preview', 'chatbot') . '</a></li>';
1485 }
1486 if ( !empty( $arg['update_to_pro'] ) ) {
1487 echo '<li><a href="'.esc_url( $arg['update_to_pro'] ).'" target="_blank">' . esc_html__('Update To Pro', 'chatbot') . '</a></li>';
1488 }
1489 ?>
1490 </ul>
1491 </div>
1492 <?php } ?>
1493 </div>
1494 </div>
1495 <?php
1496 }
1497 }
1498 ?>
1499 </div>
1500 </div>
1501
1502 </div>
1503 <?php
1504
1505 echo ob_get_clean(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- output buffered using WP APIs with proper escaping throughout
1506 exit();
1507
1508
1509
1510
1511 }
1512
1513 }
1514
1515