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 / functions / html.php

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

53 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * HTML Functions
4 *
5 * @package GamiPress\HTML_Functions
6 * @author GamiPress <contact@gamipress.com>, Ruben Garcia <rubengcdev@gmail.com>
7 * @since 1.7.1
8 */
9 // Exit if accessed directly
10 if( !defined( 'ABSPATH' ) ) exit;
11
12 /**
13 * Turn an array into a HTML list of hidden inputs
14 *
15 * @since 1.6.5
16 *
17 * @param array $array Array of elements to render
18 * @param array $excluded Optional, elements excluded for being rendered
19 *
20 * @return string
21 */
22 function gamipress_array_as_hidden_inputs( $array, $excluded = array() ) {
23
24 $html = '';
25
26 foreach( $array as $key => $value ) {
27 // Skip excluded keys
28 if( in_array( $key, $excluded ) ) continue;
29
30 // Sanitize value
31 $value = is_array( $value ) ? implode(',', $value ) : $value;
32
33 $html .= '<input type="hidden" name="' . esc_attr( $key ) . '" value="' . esc_attr( $value ) . '">';
34 }
35
36 return $html;
37 }
38
39 /**
40 * Generates the required HTML with the dashicon provided
41 *
42 * @since 1.7.1
43 *
44 * @param string $dashicon Dashicon class
45 * @param string $tag Optional, tag used (recommended i or span)
46 *
47 * @return string
48 */
49 function gamipress_dashicon( $dashicon = 'gamipress', $tag = 'i' ) {
50
51 return '<' . $tag . ' class="dashicons dashicons-' . $dashicon . '"></' . $tag . '>';
52
53 }