PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 2.2.10
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v2.2.10
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 2.3.5 2.3.6 2.4.0 2.4.1 2.4.10 2.4.11 2.4.12 2.4.13 2.4.14 2.4.15 2.4.16 2.4.17 2.4.18 2.4.19 2.4.2 2.4.20 2.4.21 All 88 releases
post-carousel / admin / views / sp-framework / functions / helpers.php

helpers.php in Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News 2.2.10, at admin/views/sp-framework/functions/helpers.php

107 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if ( ! defined( 'ABSPATH' ) ) {
2 die; } // Cannot access directly.
3 /**
4 *
5 * Array search key & value
6 *
7 * @since 1.0.0
8 * @version 1.0.0
9 */
10 if ( ! function_exists( 'spf_array_search' ) ) {
11 function spf_array_search( $array, $key, $value ) {
12
13 $results = array();
14
15 if ( is_array( $array ) ) {
16 if ( isset( $array[ $key ] ) && $array[ $key ] == $value ) {
17 $results[] = $array;
18 }
19
20 foreach ( $array as $sub_array ) {
21 $results = array_merge( $results, spf_array_search( $sub_array, $key, $value ) );
22 }
23 }
24
25 return $results;
26
27 }
28 }
29
30 /**
31 *
32 * Getting POST Var
33 *
34 * @since 1.0.0
35 * @version 1.0.0
36 */
37 if ( ! function_exists( 'spf_get_var' ) ) {
38 function spf_get_var( $var, $default = '' ) {
39
40 if ( isset( $_POST[ $var ] ) ) {
41 return $_POST[ $var ];
42 }
43
44 if ( isset( $_GET[ $var ] ) ) {
45 return $_GET[ $var ];
46 }
47
48 return $default;
49
50 }
51 }
52
53 /**
54 *
55 * Getting POST Vars
56 *
57 * @since 1.0.0
58 * @version 1.0.0
59 */
60 if ( ! function_exists( 'spf_get_vars' ) ) {
61 function spf_get_vars( $var, $depth, $default = '' ) {
62
63 if ( isset( $_POST[ $var ][ $depth ] ) ) {
64 return $_POST[ $var ][ $depth ];
65 }
66
67 if ( isset( $_GET[ $var ][ $depth ] ) ) {
68 return $_GET[ $var ][ $depth ];
69 }
70
71 return $default;
72
73 }
74 }
75
76 /**
77 *
78 * Between Microtime
79 *
80 * @since 1.0.0
81 * @version 1.0.0
82 */
83 if ( ! function_exists( 'spf_pcp_microtime' ) ) {
84 function sps_pcp_timeout( $timenow, $starttime, $timeout = 30 ) {
85
86 return ( ( $timenow - $starttime ) < $timeout ) ? true : false;
87
88 }
89 }
90
91 /**
92 *
93 * Check for wp editor api
94 *
95 * @since 1.0.0
96 * @version 1.0.0
97 */
98 if ( ! function_exists( 'spf_wp_editor_api' ) ) {
99 function spf_wp_editor_api() {
100
101 global $wp_version;
102
103 return version_compare( $wp_version, '4.8', '>=' );
104
105 }
106 }
107