forked from Codestar/codestar-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
helpers.php
58 lines (50 loc) · 1.07 KB
/
helpers.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Array search key & value
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! function_exists( 'csf_array_search' ) ) {
function csf_array_search( $array, $key, $value ) {
$results = array();
if ( is_array( $array ) ) {
if ( isset( $array[$key] ) && $array[$key] == $value ) {
$results[] = $array;
}
foreach ( $array as $sub_array ) {
$results = array_merge( $results, csf_array_search( $sub_array, $key, $value ) );
}
}
return $results;
}
}
/**
*
* Between Microtime
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! function_exists( 'csf_timeout' ) ) {
function csf_timeout( $timenow, $starttime, $timeout = 30 ) {
return ( ( $timenow - $starttime ) < $timeout ) ? true : false;
}
}
/**
*
* Check for wp editor api
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! function_exists( 'csf_wp_editor_api' ) ) {
function csf_wp_editor_api() {
global $wp_version;
return version_compare( $wp_version, '4.8', '>=' );
}
}