PluginProbe ʕ •ᴥ•ʔ
Menu Icons by Themeisle – Add Icons to Navigation Menus / 0.11.2
Menu Icons by Themeisle – Add Icons to Navigation Menus v0.11.2
trunk 0.1.0 0.1.1 0.1.2 0.1.3 0.1.4 0.1.5 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.11.2 0.11.3 0.11.4 0.11.5 0.12.0 0.12.1 0.12.10 0.12.11 0.12.12 0.12.2 0.12.3 0.12.4 0.12.5 0.12.6 0.12.7 0.12.8 0.12.9 0.13.0 0.13.1 0.13.10 0.13.11 0.13.12 0.13.13 0.13.14 0.13.15 0.13.16 0.13.17 0.13.18 0.13.19 0.13.2 0.13.20 0.13.21 0.13.22 0.13.23 0.13.3 0.13.4 0.13.5 0.13.6 0.13.7 0.13.8 0.13.9 0.2.0 0.2.1 0.2.2 0.2.3 0.3.0 0.3.1 0.3.2 0.4.0 0.5.0 0.5.1 0.6.0 0.7.0 0.8.0 0.8.1 0.9.0 0.9.2
menu-icons / includes / library / functions.php
menu-icons / includes / library Last commit date
icon-picker 8 years ago menu-item-custom-fields 8 years ago compat.php 8 years ago form-fields.php 8 years ago functions.php 8 years ago
functions.php
112 lines
1 <?php
2
3 /**
4 * Misc. helper functions
5 *
6 * @author Dzikri Aziz <kvcrvt@gmail.com>
7 */
8
9
10 if ( ! function_exists( 'kucrut_get_array_value_deep' ) ) {
11 /**
12 * Get value of a multidimensional array
13 *
14 * @since 0.1.0
15 * @param array $array Haystack
16 * @param array $keys Needles
17 * @return mixed
18 */
19 function kucrut_get_array_value_deep( array $array, array $keys ) {
20 if ( empty( $array ) || empty( $keys ) ) {
21 return $array;
22 }
23
24 foreach ( $keys as $idx => $key ) {
25 unset( $keys[ $idx ] );
26
27 if ( ! isset( $array[ $key ] ) ) {
28 return null;
29 }
30
31 if ( ! empty( $keys ) ) {
32 $array = $array[ $key ];
33 }
34 }
35
36 if ( ! isset( $array[ $key ] ) ) {
37 return null;
38 }
39
40 return $array[ $key ];
41 }
42 }
43
44
45 if ( ! function_exists( 'kucrut_validate' ) ) {
46 /**
47 * Validate settings values
48 *
49 * @param array $values Settings values
50 * @return array
51 */
52 function kucrut_validate( $values, $sanitize_cb = 'wp_kses_data' ) {
53 foreach ( $values as $key => $value ) {
54 if ( is_array( $value ) ) {
55 $values[ $key ] = kucrut_validate( $value );
56 } else {
57 $values[ $key ] = call_user_func_array(
58 $sanitize_cb,
59 array( $value )
60 );
61 }
62 }
63
64 return $values;
65 }
66 }
67
68
69 if ( ! function_exists( 'kucrut_get_image_sizes' ) ) {
70 /**
71 * Get image sizes
72 *
73 * @since 0.9.0
74 * @access protected
75 * @return array
76 */
77 function kucrut_get_image_sizes() {
78 $_sizes = array(
79 'thumbnail' => __( 'Thumbnail', 'menu-icons' ),
80 'medium' => __( 'Medium', 'menu-icons' ),
81 'large' => __( 'Large', 'menu-icons' ),
82 'full' => __( 'Full Size', 'menu-icons' ),
83 );
84
85 $_sizes = apply_filters( 'image_size_names_choose', $_sizes );
86
87 $sizes = array();
88 foreach ( $_sizes as $value => $label ) {
89 $sizes[] = array(
90 'value' => $value,
91 'label' => $label,
92 );
93 }
94
95 return $sizes;
96 }
97 }
98
99
100 if ( ! function_exists( 'kucrut_get_script_suffix' ) ) {
101 /**
102 * Get script & style suffix
103 *
104 * When SCRIPT_DEBUG is defined true, this will return '.min'.
105 *
106 * @return string
107 */
108 function kucrut_get_script_suffix() {
109 return ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
110 }
111 }
112