PluginProbe
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI / trunk
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI vtrunk
8.0.1 8.0.2 8.0.0 7.9.9.7 7.9.9.6 7.9.9.5 7.9.9.4 7.9.9.3 7.9.9.2 7.9.9.1 7.9.9 7.9.8 7.9.7 7.9.6 7.9.5 7.9.4 7.9.3 7.9.2 7.9.1 7.9.0 7.8.9 7.8.8 7.8.7 7.8.6 7.8.5 All 44 releases
gamipress / includes / admin / pages / assets.php

assets.php in GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI trunk, at includes/admin/pages/assets.php

120 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Admin Assets Pages
4 *
5 * @package GamiPress\Admin\Assets
6 * @author GamiPress <contact@gamipress.com>, Ruben Garcia <rubengcdev@gmail.com>
7 * @since 1.6.0
8 */
9 // Exit if accessed directly
10 if( !defined( 'ABSPATH' ) ) exit;
11
12 /**
13 * Assets page
14 *
15 * @since 1.6.0
16 *
17 * @return void
18 */
19 function gamipress_assets_page() {
20
21 if( ! function_exists( 'plugins_api' ) ) {
22 require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
23 }
24
25 wp_enqueue_script( 'plugin-install' );
26 add_thickbox();
27 wp_enqueue_script( 'updates' );
28
29 ?>
30 <div class="wrap">
31 <div id="icon-options-general" class="icon32"></div>
32 <h1 class="wp-heading-inline"><?php _e( 'GamiPress Assets', 'gamipress' ); ?></h1>
33 <hr class="wp-header-end">
34
35 <p><?php esc_html_e( 'Resources to decorate your gamification elements and take their design to the next level!', 'gamipress' ); ?></p>
36
37 <form id="plugin-filter" method="post">
38 <div class="wp-list-table widefat gamipress-assets">
39
40 <?php
41
42 $plugins = gamipress_plugins_api();
43
44 if ( is_wp_error( $plugins ) ) {
45 echo $plugins->get_error_message();
46 return;
47 }
48
49 foreach ( $plugins as $plugin ) {
50
51 // Skip if is not an asset
52 if( ! gamipress_is_plugin_asset( $plugin ) )
53 continue;
54
55 gamipress_render_plugin_card( $plugin );
56
57 }
58
59 ?>
60 </div>
61 </form>
62 </div>
63 <?php
64 }
65
66 /**
67 * Helper function to determine if give plugin has the passes category
68 *
69 * @since 1.6.9.2
70 *
71 * @param stdClass $plugin
72 *
73 * @return bool
74 */
75 function gamipress_is_plugin_pass( $plugin ) {
76
77 // Check if plugin has categories
78 if( is_array( $plugin->info->category ) && count( $plugin->info->category ) ) {
79
80 // Loop plugin categories
81 foreach( $plugin->info->category as $category ) {
82
83 // Passes category found
84 if( $category->slug === 'passes' ) {
85 return true;
86 }
87 }
88
89 }
90
91 return false;
92 }
93
94 /**
95 * Helper function to determine if give plugin has the asset tag
96 *
97 * @since 1.6.0
98 *
99 * @param stdClass $plugin
100 *
101 * @return bool
102 */
103 function gamipress_is_plugin_asset( $plugin ) {
104
105 // Check if plugin has tags
106 if( is_array( $plugin->info->tags ) && count( $plugin->info->tags ) ) {
107
108 // Loop plugin tags
109 foreach( $plugin->info->tags as $tag ) {
110
111 // asset tag found
112 if( $tag->slug === 'asset' ) {
113 return true;
114 }
115 }
116
117 }
118
119 return false;
120 }