PluginProbe
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI / 8.0.3
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI v8.0.3
8.0.3 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 All 45 releases
← All changes | templates/points-types.php +232 -0 7.9.28.0.3 View file →
@@ -1,0 +1,232 @@
1 +<?php
2 +/**
3 + * Points Types template
4 + *
5 + * This template can be overridden by copying it to yourtheme/gamipress/points-types.php
6 + * To override a specific points type just copy it as yourtheme/gamipress/points-types-{points-type}.php
7 + */
8 +global $gamipress_template_args;
9 +
10 +// Shorthand
11 +$a = $gamipress_template_args;
12 +
13 +$points_types = gamipress_get_points_types();
14 +
15 +$user_id = isset( $a['user_id'] ) ? absint( $a['user_id'] ) : get_current_user_id();
16 +
17 +// Setup thumbnail size
18 +$thumbnail_size = absint( $a['thumbnail_size'] );
19 +
20 +if( $thumbnail_size === 0 ) {
21 + $thumbnail_size = 'gamipress-points';
22 +} else {
23 + $thumbnail_size = array( $thumbnail_size, $thumbnail_size );
24 +}
25 +
26 +// Sanitize title size
27 +$a['title_size'] = gamipress_sanitize_title_size_option( $a['title_size'] );
28 +
29 +// Setup points classes
30 +$classes = array(
31 + 'gamipress-points-types',
32 + 'gamipress-columns-' . $a['columns'],
33 + 'gamipress-columns-small-' . $a['columns_small'],
34 + 'gamipress-layout-' . $a['layout'],
35 + 'gamipress-align-' . $a['align']
36 +);
37 +
38 +/**
39 + * Points types classes
40 + *
41 + * @since 1.4.0
42 + *
43 + * @param array $classes Array of points types classes
44 + * @param integer $points_types Array of points types to be rendered
45 + * @param array $template_args Template received arguments
46 + */
47 +$classes = apply_filters( 'gamipress_points_types_classes', $classes, $a['points-types'], $a ); ?>
48 +
49 +<div class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>">
50 +
51 + <?php
52 + /**
53 + * Before render points types list
54 + *
55 + * @since 1.0.0
56 + *
57 + * @param array $points_types Array of points types to be rendered
58 + * @param array $template_args Template received arguments
59 + */
60 + do_action( 'gamipress_before_render_points_types_list', $a['points-types'], $a ); ?>
61 +
62 + <?php foreach( $a['points-types'] as $points_type => $points_type_args ) :
63 + if( ! isset( $points_types[$points_type] ) ) :
64 + continue;
65 + endif;
66 +
67 + $points_awards = ( $a['awards'] === 'yes' ) ? $points_type_args['awards'] : array();
68 + $points_deducts = ( $a['deducts'] === 'yes' ) ? $points_type_args['deducts'] : array();
69 + ?>
70 +
71 + <div id="gamipress-points-type-<?php echo esc_attr( $points_type ); ?>" class="gamipress-points-type gamipress-points-type-<?php echo esc_attr( $points_type ); ?>">
72 +
73 + <?php
74 + /**
75 + * Before render points type
76 + *
77 + * @since 1.0.0
78 + *
79 + * @param string $points_type Points type slug
80 + * @param array $points_awards Array of points awards
81 + * @param array $points_deducts Array of points deducts
82 + * @param array $points_types Array of points types to be rendered
83 + * @param array $template_args Template received arguments
84 + */
85 + do_action( 'gamipress_before_render_points_type', $points_type, $points_awards, $points_deducts, $a['points-types'], $a ); ?>
86 +
87 + <?php // Points Type Image
88 + if( $a['thumbnail'] === 'yes' ) : ?>
89 + <div class="gamipress-points-type-image gamipress-points-type-<?php echo esc_attr( $points_type ); ?>-image">
90 + <?php echo gamipress_get_points_type_thumbnail( $points_type, $thumbnail_size ); ?>
91 + </div><!-- .gamipress-points-image -->
92 +
93 + <?php
94 + /**
95 + * After points type thumbnail
96 + *
97 + * @since 1.0.0
98 + *
99 + * @param string $points_type Points type slug
100 + * @param array $points_awards Array of points awards
101 + * @param array $points_deducts Array of points deducts
102 + * @param array $points_types Array of points types to be rendered
103 + * @param array $template_args Template received arguments
104 + */
105 + do_action( 'gamipress_after_points_type_thumbnail', $points_type, $points_awards, $points_deducts, $a['points-types'], $a ); ?>
106 +
107 + <?php endif; ?>
108 +
109 + <div class="gamipress-points-type-description">
110 +
111 + <<?php echo $a['title_size']; ?> class="gamipress-points-type-title"><?php echo $points_types[$points_type]['plural_name']; ?></<?php echo $a['title_size']; ?>>
112 +
113 + <?php
114 + /**
115 + * After points type title
116 + *
117 + * @since 1.0.0
118 + *
119 + * @param string $points_type Points type slug
120 + * @param array $points_awards Array of points awards
121 + * @param array $points_deducts Array of points deducts
122 + * @param array $points_types Array of points types to be rendered
123 + * @param array $template_args Template received arguments
124 + */
125 + do_action( 'gamipress_after_points_type_title', $points_type, $points_awards, $points_deducts, $a['points-types'], $a ); ?>
126 +
127 + <?php if( $a['awards'] === 'yes' && $points_awards ) : ?>
128 +
129 + <div class="gamipress-points-type-awards">
130 +
131 + <?php if ( $a['toggle'] === 'yes' ) : ?>
132 +
133 + <div id="show-more-<?php echo esc_attr( $points_type ); ?>" class="gamipress-open-close-switch">
134 + <a class="show-hide-open" data-action="open" data-open-text="<?php _e( 'Show Details', 'gamipress' ); ?>" data-close-text="<?php _e( 'Hide Details', 'gamipress' ); ?>" href="#"><?php _e( 'Show Details', 'gamipress' ); ?></a>
135 + </div>
136 +
137 + <div id="gamipress-toggle-more-window-<?php echo esc_attr( $points_type ); ?>" class="gamipress-extras-window">
138 + <?php echo gamipress_get_points_awards_for_points_types_list_markup( $points_awards, $user_id, $a ); ?>
139 + </div><!-- .gamipress-extras-window -->
140 +
141 + <?php else : ?>
142 +
143 + <?php echo gamipress_get_points_awards_for_points_types_list_markup( $points_awards, $user_id, $a ); ?>
144 +
145 + <?php endif; ?>
146 +
147 + </div><!-- .gamipress-points-type-awards -->
148 +
149 + <?php
150 + /**
151 + * After points type points awards
152 + *
153 + * @since 1.0.0
154 + *
155 + * @param string $points_type Points type slug
156 + * @param array $points_awards Array of points awards
157 + * @param array $points_deducts Array of points deducts
158 + * @param array $points_types Array of points types to be rendered
159 + * @param array $template_args Template received arguments
160 + */
161 + do_action( 'gamipress_after_points_type_points_awards', $points_type, $points_awards, $points_deducts, $a['points-types'], $a ); ?>
162 +
163 + <?php endif; ?>
164 +
165 + <?php if( $a['deducts'] === 'yes' && $points_deducts ) : ?>
166 +
167 + <div class="gamipress-points-type-deducts">
168 +
169 + <?php if ( $a['toggle'] === 'yes' ) : ?>
170 +
171 + <div id="show-more-<?php echo esc_attr( $points_type ); ?>" class="gamipress-open-close-switch">
172 + <a class="show-hide-open" data-action="open" data-open-text="<?php _e( 'Show Details', 'gamipress' ); ?>" data-close-text="<?php _e( 'Hide Details', 'gamipress' ); ?>" href="#"><?php _e( 'Show Details', 'gamipress' ); ?></a>
173 + </div>
174 +
175 + <div id="gamipress-toggle-more-window-<?php echo esc_attr( $points_type ); ?>" class="gamipress-extras-window">
176 + <?php echo gamipress_get_points_deducts_for_points_types_list_markup( $points_deducts, $user_id, $a ); ?>
177 + </div><!-- .gamipress-extras-window -->
178 +
179 + <?php else : ?>
180 +
181 + <?php echo gamipress_get_points_deducts_for_points_types_list_markup( $points_deducts, $user_id, $a ); ?>
182 +
183 + <?php endif; ?>
184 +
185 + </div><!-- .gamipress-points-type-deducts -->
186 +
187 + <?php
188 + /**
189 + * After points type points deducts
190 + *
191 + * @since 1.0.0
192 + *
193 + * @param string $points_type Points type slug
194 + * @param array $points_awards Array of points awards
195 + * @param array $points_deducts Array of points deducts
196 + * @param array $points_types Array of points types to be rendered
197 + * @param array $template_args Template received arguments
198 + */
199 + do_action( 'gamipress_after_points_type_points_deducts', $points_type, $points_awards, $points_deducts, $a['points-types'], $a ); ?>
200 +
201 + <?php endif; ?>
202 +
203 + </div><!-- .gamipress-points-type-description -->
204 +
205 + <?php
206 + /**
207 + * After render points type
208 + *
209 + * @since 1.0.0
210 + *
211 + * @param string $points_type Points type slug
212 + * @param array $points_awards Array of points awards
213 + * @param array $points_deducts Array of points deducts
214 + * @param array $points_types Array of points types to be rendered
215 + * @param array $template_args Template received arguments
216 + */
217 + do_action( 'gamipress_after_render_points_type', $points_type, $points_awards, $points_deducts, $a['points-types'], $a ); ?>
218 +
219 + </div><!-- .gamipress-points-type-{points_type} -->
220 +
221 + <?php endforeach; ?>
222 +
223 + <?php
224 + /**
225 + * After render points types list
226 + *
227 + * @param array $points_types Array of points types to be rendered
228 + * @param array $template_args Template received arguments
229 + */
230 + do_action( 'gamipress_after_render_points_types_list', $a['points-types'], $a ); ?>
231 +
232 +</div><!-- .gamipress-points-types -->