PluginProbe
Quick 301 Redirects / trunk
Quick 301 Redirects vtrunk
trunk 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8
quick-301-redirects / recommended-plugins.php

recommended-plugins.php in Quick 301 Redirects trunk, at recommended-plugins.php

512 lines 24.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Recommended Plugins
4 *
5 * @author : Premio <contact@premio.io>
6 * @license : GPL2
7 * */
8
9 if (defined('ABSPATH') === false) {
10 exit;
11 }
12 wp_enqueue_style( 'wp-jquery-ui-dialog' );
13 wp_enqueue_script( 'jquery-ui-dialog' );
14 // You may comment this out IF you're sure the function exists.
15 require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
16 wp_enqueue_style( 'plugin-install' );
17 wp_enqueue_script( 'plugin-install' );
18 wp_enqueue_script( 'updates' );
19 add_thickbox();
20 remove_all_filters('plugins_api');
21 $pluginsAllowedTags = array(
22 'a' => array(
23 'href' => array(),
24 'title' => array(),
25 'target' => array(),
26 ),
27 'abbr' => array( 'title' => array() ),
28 'acronym' => array( 'title' => array() ),
29 'code' => array(),
30 'pre' => array(),
31 'em' => array(),
32 'strong' => array(),
33 'ul' => array(),
34 'ol' => array(),
35 'li' => array(),
36 'p' => array(),
37 'br' => array(),
38 );
39
40 $recommendedPlugins = array();
41
42 /* Chatway Plugin */
43 $args = [
44 'slug' => 'chatway-live-chat',
45 'fields' => [
46 'short_description' => true,
47 'icons' => true,
48 'reviews' => false, // excludes all reviews
49 ],
50 ];
51 $data = plugins_api( 'plugin_information', $args );
52 if ( $data && ! is_wp_error( $data ) ) {
53 $recommendedPlugins['chatway-live-chat'] = $data;
54 $recommendedPlugins['chatway-live-chat']->name = 'Free Live Chat, WordPress Website Chat Plugin, Support Chat App: Chatway';
55 $recommendedPlugins['chatway-live-chat']->short_description = 'Live chat with your website’s visitors through your WordPress website. With Chatway – live chat app, you can do just that and much more!';
56 }
57
58 /* Poptin Plugins */
59 $args = [
60 'slug' => 'poptin',
61 'fields' => [
62 'short_description' => true,
63 'icons' => true,
64 'reviews' => false, // excludes all reviews
65 ],
66 ];
67 $data = plugins_api( 'plugin_information', $args );
68 if ( $data && ! is_wp_error( $data ) ) {
69 $recommendedPlugins['poptin'] = $data;
70 $recommendedPlugins['poptin']->name = 'Poptin: Beautiful Pop Ups and Embedded Inline Contact Forms for Your Website';
71 $recommendedPlugins['poptin']->short_description = 'Pop ups and contact forms builder for your website. Get more sales, leads, and subscribers with beautiful popups & inline forms templates, no coding skills required';
72 }
73
74
75 /* Chaty Plugins */
76 $args = [
77 'slug' => 'chaty',
78 'fields' => [
79 'short_description' => true,
80 'icons' => true,
81 'reviews' => false, // excludes all reviews
82 ],
83 ];
84 $data = plugins_api( 'plugin_information', $args );
85 if ( $data && ! is_wp_error( $data ) ) {
86 $recommendedPlugins['chaty'] = $data;
87 $recommendedPlugins['chaty']->name = 'Chaty: WhatsApp, Facebook Messenger, and Many Other Chat Buttons For Your Website';
88 $recommendedPlugins['chaty']->short_description = 'Let your visitors contact you via Facebook Messenger, Whatsapp, Telegram, Viber, Email, Phone call, SMS and more with customizable chat & call bututons';
89 }
90
91 /* Folders Plugins */
92 $args = [
93 'slug' => 'folders',
94 'fields' => [
95 'short_description' => true,
96 'icons' => true,
97 'reviews' => false, // excludes all reviews
98 ],
99 ];
100 $data = plugins_api( 'plugin_information', $args );
101 if ( $data && ! is_wp_error( $data ) ) {
102 $recommendedPlugins['folders'] = $data;
103 $recommendedPlugins['folders']->name = 'Folders: Organize Your Media Library, Posts, Pages, and Custom posts Using Drag and Drop';
104 $recommendedPlugins['folders']->short_description = 'Folders is a powerful WordPress plugin that will help you quickly and easily organize and manage your Media library files, Pages, Posts, and Custom Posts in folders';
105 }
106 ?>
107 <div class="wrap mystickyelement-wrap recommended-plugins">
108 <h2>
109 <?php _e('Try out our recommended plugins', 'mystickyelements'); ?>
110 <div class="mystickyelement-contact-form-leads-btn">
111 <a href="#" class="create-rule recommeded-plugins-hide"><?php _e('Hide From Menu', 'mystickyelements');?></a>
112 </div>
113 </h2>
114 </div>
115
116 <div class="wrap recommended-plugins">
117 <div class="wp-list-table widefat plugin-install">
118 <div class="the-list">
119 <?php
120 foreach ((array) $recommendedPlugins as $plugin) {
121 if (is_object($plugin)) {
122 $plugin = (array) $plugin;
123 }
124
125 // Display the group heading if there is one.
126 if (isset($plugin['group']) && $plugin['group'] != $group) {
127 if (isset($this->groups[$plugin['group']])) {
128 $group_name = $this->groups[$plugin['group']];
129 if (isset($plugins_group_titles[$group_name])) {
130 $group_name = $plugins_group_titles[$group_name];
131 }
132 } else {
133 $group_name = $plugin['group'];
134 }
135
136 // Starting a new group, close off the divs of the last one.
137 if (! empty($group)) {
138 echo '</div></div>';
139 }
140
141 echo '<div class="plugin-group"><h3>'.esc_html($group_name).'</h3>';
142 // Needs an extra wrapping div for nth-child selectors to work.
143 echo '<div class="plugin-items">';
144
145 $group = $plugin['group'];
146 }//end if
147
148 $title = wp_kses($plugin['name'], $pluginsAllowedTags);
149
150 // Remove any HTML from the description.
151 $description = wp_strip_all_tags($plugin['short_description']);
152 $version = wp_kses($plugin['version'], $pluginsAllowedTags);
153
154 $name = wp_strip_all_tags($title.' '.$version);
155
156 $author = wp_kses($plugin['author'], $pluginsAllowedTags);
157 if (! empty($author)) {
158 // translators: %s: Plugin author.
159 $author = ' <cite>'.sprintf(esc_html__( 'By %s', "chaty"), $author).'</cite>';
160 }
161
162 $requires_php = isset($plugin['requires_php']) ? $plugin['requires_php'] : null;
163 $requires_wp = isset($plugin['requires']) ? $plugin['requires'] : null;
164
165 $compatible_php = is_php_version_compatible($requires_php);
166 $compatible_wp = is_wp_version_compatible($requires_wp);
167 $tested_wp = ( empty($plugin['tested']) || version_compare(get_bloginfo('version'), $plugin['tested'], '<=') );
168
169 $action_links = [];
170
171 if (current_user_can('install_plugins') || current_user_can('update_plugins')) {
172 $status = install_plugin_install_status($plugin);
173
174 switch ($status['status']) {
175 case 'install':
176 if ($status['url']) {
177 if ($compatible_php && $compatible_wp) {
178 $action_links[] = sprintf(
179 '<a class="install-now button" data-slug="%s" href="%s" aria-label="%s" data-name="%s">%s</a>',
180 esc_attr($plugin['slug']),
181 esc_url($status['url']),
182 // translators: %s: Plugin name and version.
183 esc_attr(sprintf(esc_html__('Install %s now', 'folders'), $name)),
184 esc_attr($name),
185 esc_html__( 'Install Now', "chaty")
186 );
187 } else {
188 $action_links[] = sprintf(
189 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
190 esc_html__('Cannot Install', 'folders')
191 );
192 }
193 }
194 break;
195
196 case 'update_available':
197 if ($status['url']) {
198 if ($compatible_php && $compatible_wp) {
199 $action_links[] = sprintf(
200 '<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>',
201 esc_attr($status['file']),
202 esc_attr($plugin['slug']),
203 esc_url($status['url']),
204 // translators: %s: Plugin name and version.
205 esc_attr(sprintf(esc_html__('Update %s now', 'folders'), $name)),
206 esc_attr($name),
207 esc_html__( 'Update Now', "chaty")
208 );
209 } else {
210 $action_links[] = sprintf(
211 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
212 esc_html__('Cannot Update', 'folders')
213 );
214 }
215 }
216 break;
217
218 case 'latest_installed':
219 case 'newer_installed':
220 if (is_plugin_active($status['file'])) {
221 $action_links[] = sprintf(
222 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
223 esc_html__('Active', 'folders')
224 );
225 } else if (current_user_can('activate_plugin', $status['file'])) {
226 $button_text = esc_html__( 'Activate', "chaty");
227 // translators: %s: Plugin name.
228 $button_label = esc_html__('Activate %s', 'folders');
229 $activate_url = add_query_arg(
230 [
231 '_wpnonce' => wp_create_nonce('activate-plugin_'.$status['file']),
232 'action' => 'activate',
233 'plugin' => $status['file'],
234 ],
235 network_admin_url('plugins.php')
236 );
237
238 if (is_network_admin()) {
239 $button_text = esc_html__( 'Network Activate', "chaty");
240 // translators: %s: Plugin name.
241 $button_label = esc_html__('Network Activate %s', 'folders');
242 $activate_url = add_query_arg([ 'networkwide' => 1 ], $activate_url);
243 }
244
245 $action_links[] = sprintf(
246 '<a href="%1$s" class="button activate-now" aria-label="%2$s">%3$s</a>',
247 esc_url($activate_url),
248 esc_attr(sprintf($button_label, $plugin['name'])),
249 $button_text
250 );
251 } else {
252 $action_links[] = sprintf(
253 '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
254 esc_html__('Installed', 'folders')
255 );
256 }//end if
257 break;
258 }//end switch
259 }//end if
260
261 $details_link = self_admin_url(
262 'plugin-install.php?tab=plugin-information&amp;plugin='.$plugin['slug'].'&amp;TB_iframe=true&amp;width=600&amp;height=550'
263 );
264
265 $action_links[] = sprintf(
266 '<a href="%s" class="thickbox open-plugin-details-modal" aria-label="%s" data-title="%s">%s</a>',
267 esc_url($details_link),
268 // translators: %s: Plugin name and version.
269 esc_attr(sprintf(esc_html__( 'More information about %s', "chaty"), $name)),
270 esc_attr($name),
271 esc_html__( 'More Details', "chaty")
272 );
273
274 if (! empty($plugin['icons']['svg'])) {
275 $plugin_icon_url = $plugin['icons']['svg'];
276 } else if (! empty($plugin['icons']['2x'])) {
277 $plugin_icon_url = $plugin['icons']['2x'];
278 } else if (! empty($plugin['icons']['1x'])) {
279 $plugin_icon_url = $plugin['icons']['1x'];
280 } else {
281 $plugin_icon_url = $plugin['icons']['default'];
282 }
283
284 /*
285 * Filters the install action links for a plugin.
286 *
287 * @since 2.7.0
288 *
289 * @param string[] $action_links An array of plugin action links. Defaults are links to Details and Install Now.
290 * @param array $plugin The plugin currently being listed.
291 */
292 $action_links = apply_filters('plugin_install_action_links', $action_links, $plugin);
293
294 $last_updated_timestamp = strtotime($plugin['last_updated']);
295 ?>
296 <div class="plugin-card plugin-card-<?php echo sanitize_html_class($plugin['slug']); ?>">
297 <?php
298 if (! $compatible_php || ! $compatible_wp) {
299 echo '<div class="notice inline notice-error notice-alt"><p>';
300 if (! $compatible_php && ! $compatible_wp) {
301 esc_html_e('This plugin doesn&#8217;t work with your versions of WordPress and PHP.');
302 if (current_user_can('update_core') && current_user_can('update_php')) {
303 printf(
304 // translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page.
305 ' '.esc_html__( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.', "chaty"),
306 esc_url(self_admin_url('update-core.php')),
307 esc_url(wp_get_update_php_url())
308 );
309 wp_update_php_annotation('</p><p><em>', '</em>');
310 } else if (current_user_can('update_core')) {
311 printf(
312 // translators: %s: URL to WordPress Updates screen.
313 ' '.esc_html__( '<a href="%s">Please update WordPress</a>.', "chaty"),
314 esc_url(self_admin_url('update-core.php'))
315 );
316 } else if (current_user_can('update_php')) {
317 printf(
318 // translators: %s: URL to Update PHP page.
319 ' '.esc_html__( '<a href="%s">Learn more about updating PHP</a>.', "chaty"),
320 esc_url(wp_get_update_php_url())
321 );
322 wp_update_php_annotation('</p><p><em>', '</em>');
323 }//end if
324 } else if (! $compatible_wp) {
325 esc_html_e('This plugin doesn&#8217;t work with your version of WordPress.', "chaty");
326 if (current_user_can('update_core')) {
327 printf(
328 // translators: %s: URL to WordPress Updates screen.
329 ' '.esc_html__( '<a href="%s">Please update WordPress</a>.', "chaty"),
330 esc_url(self_admin_url('update-core.php'))
331 );
332 }
333 } else if (! $compatible_php) {
334 esc_html_e('This plugin doesn&#8217;t work with your version of PHP.');
335 if (current_user_can('update_php')) {
336 printf(
337 // translators: %s: URL to Update PHP page.
338 ' '.esc_html__( '<a href="%s">Learn more about updating PHP</a>.', "chaty"),
339 esc_url(wp_get_update_php_url())
340 );
341 wp_update_php_annotation('</p><p><em>', '</em>');
342 }
343 }//end if
344
345 echo '</p></div>';
346 }//end if
347 ?>
348 <div class="plugin-card-top">
349 <div class="name column-name">
350 <h3>
351 <a href="<?php echo esc_url($details_link); ?>" class="thickbox open-plugin-details-modal">
352 <?php echo esc_attr($title); ?>
353 <img src="<?php echo esc_attr($plugin_icon_url); ?>" class="plugin-icon" alt="" />
354 </a>
355 </h3>
356 </div>
357 <div class="action-links">
358 <?php
359 if ($action_links) {
360 echo '<ul class="plugin-action-buttons"><li>'.implode('</li><li>', $action_links).'</li></ul>';
361 }
362 ?>
363 </div>
364 <div class="desc column-description">
365 <p><?php echo esc_attr($description); ?></p>
366 <p class="authors"><?php echo wp_kses($author, $pluginsAllowedTags); ?></p>
367 </div>
368 </div>
369 <div class="plugin-card-bottom">
370 <div class="vers column-rating">
371 <?php
372 wp_star_rating(
373 [
374 'rating' => $plugin['rating'],
375 'type' => 'percent',
376 'number' => $plugin['num_ratings'],
377 ]
378 );
379 ?>
380 <span class="num-ratings" aria-hidden="true">(<?php echo esc_attr(number_format_i18n($plugin['num_ratings'])); ?>)</span>
381 </div>
382 <div class="column-updated">
383 <strong><?php esc_html_e('Last Updated:', "chaty"); ?></strong>
384 <?php
385 // translators: %s: Human-readable time difference.
386 printf(esc_html__( '%s ago', "chaty"), esc_attr(human_time_diff($last_updated_timestamp)));
387 ?>
388 </div>
389 <div class="column-downloaded">
390 <?php
391 if ($plugin['active_installs'] >= 1000000) {
392 $active_installs_millions = floor(($plugin['active_installs'] / 1000000));
393 $active_installs_text = sprintf(
394 // translators: %s: Number of millions.
395 _nx('%s+ Million', '%s+ Million', $active_installs_millions, 'Active plugin installations'),
396 number_format_i18n($active_installs_millions)
397 );
398 } else if (0 == $plugin['active_installs']) {
399 $active_installs_text = esc_html__('Less Than 10', 'folders');
400 } else {
401 $active_installs_text = number_format_i18n($plugin['active_installs']).'+';
402 }
403
404 // translators: %s: Number of installations.
405 printf(esc_html__( '%s Active Installations', "chaty"), esc_attr($active_installs_text));
406 ?>
407 </div>
408 <div class="column-compatibility">
409 <?php
410 if (! $tested_wp) {
411 echo '<span class="compatibility-untested">'.esc_html__( 'Untested with your version of WordPress', "chaty").'</span>';
412 } else if (! $compatible_wp) {
413 echo '<span class="compatibility-incompatible">'.wp_kses( '<strong>Incompatible</strong> with your version of WordPress', $pluginsAllowedTags).'</span>';
414 } else {
415 echo '<span class="compatibility-compatible">'.wp_kses( '<strong>Compatible</strong> with your version of WordPress', $pluginsAllowedTags).'</span>';
416 }
417 ?>
418 </div>
419 </div>
420 </div>
421 <?php
422 }//end foreach
423 ?>
424 </div>
425 </div>
426 <div id="hide-recommeded-plugins" style="display:none;" title="<?php esc_html_e('Are you sure?', 'folders');?>">
427 <p><?php esc_html_e("If you hide the recommended plugins page from your menu, it won't appear there again. Are you sure you'd like to do it?", 'folders');?></p>
428 </div>
429
430 </div>
431 <style>
432 .mystickyelement-contact-form-leads-btn {
433 float: right;
434 }
435 .wrap.mystickyelement-wrap > h2:first-child {
436 font-size: 26px;
437 }
438 .mystickyelement-contact-form-leads-btn a.create-rule {
439 font-size: 18px;
440 padding: 7px 30px;
441 }
442 a.create-rule {
443 background-color: #7761DF;
444 color: #fff;
445 display: inline-block;
446 vertical-align: top;
447 text-decoration: none;
448 padding: 5px 12px;
449 border-radius: 20px;
450 box-shadow: none;
451 outline: none;
452 }
453 .ui-dialog-buttonpane .ui-dialog-buttonset .red-btn, .ui-dialog-buttonpane .ui-dialog-buttonset .purple-btn, .ui-dialog-buttonpane .ui-dialog-buttonset .gray-btn {
454 background-color: #969696;
455 color: #fff;
456 border-color: #969696;
457 border-radius: 25px;
458 line-height: 1.4;
459 padding: 8px 15px 10px;
460 height: auto;
461 display: inline-block;
462 vertical-align: top;
463 font-size: 16px;
464 min-width: 150px;
465 }
466 .ui-dialog .ui-dialog-buttonpane .ui-button {
467 margin: 0 10px;
468 }
469 .ui-dialog-buttonpane .ui-dialog-buttonset .red-btn {
470 background-color: #FF0000;
471 border-color: #FF0000;
472 }
473 </style>
474 <script>
475 (function ($) {
476 "use strict";
477 $(document).ready(function () {
478 $('.recommeded-plugins-hide').on('click', function (event) {
479 event.preventDefault();
480 $("#hide-recommeded-plugins").dialog({
481 resizable: false,
482 modal: true,
483 draggable: false,
484 height: 'auto',
485 width: 400,
486 open: function (event, ui) {
487 $(".ui-widget-overlay").on('click', function () {
488 $('#hide-recommeded-plugins').dialog('close');
489 });
490 },
491 buttons: {
492 "Hide it": {
493 click: function () {
494 window.location = "<?php echo admin_url('admin.php?page=quick-301-redirects-plugins&quick_301_redirects_plugins_page=1&qtr_nonce='.wp_create_nonce('quick_301_redirects_plugins_page'));?>";
495 },
496 text: 'Hide it',
497 class: 'btn red-btn'
498 },
499 "Keep it": {
500 click: function () {
501 $(this).dialog('close');
502 },
503 text: 'Keep it',
504 class: 'btn alt gray-btn'
505 },
506 }
507 });
508 });
509 });
510 })(jQuery);
511 </script>
512