-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhandy-functions.php
67 lines (62 loc) · 1.66 KB
/
handy-functions.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
59
60
61
62
63
64
65
66
67
<?php
// Handy Functions, kept over here
// @since 1.0.0
// Returns TRUE if debug mode is on; else FALSE
// @since 0.2
if(!function_exists('asj_debug')) {
function asj_debug() {
if (defined('APPLICANTSTACK_JOBS_DEBUG') && true === APPLICANTSTACK_JOBS_DEBUG) {
return true;
} else {
return false;
}
}
}
// Returns version number from defined var
// @since 0.2.1
if(!function_exists('asj_ver')) {
function asj_ver() {
if (defined('APPLICANTSTACK_JOBS_VERSION')) {
return APPLICANTSTACK_JOBS_VERSION;
} else {
$plugin_data = get_plugin_data( __FILE__ );
$plugin_version = $plugin_data['Version'];
return $plugin_version;
}
}
}
// Validate api input
if(!function_exists('asj_api_validate')) {
function asj_api_validate($value) {
$applicantstack_api = $value;
if( isset($applicantstack_api) && $applicantstack_api != '') {
$applicantstack_api = esc_attr(get_option('asj_api'));
}
return $applicantstack_api;
}
}
// Validate domain callback
if(!function_exists('asj_domain_validate')) {
function asj_domain_validate($value) {
$applicantstack_domain = $value;
if(isset($applicantstack_domain) && $applicantstack_domain != '') {
$applicantstack_domain = esc_attr(get_option('asj_domain'));
}
// Append trailing slash if it's not there.
if(strpos($applicantstack_domain, '.com/') === false) {
$applicantstack_domain .= '/';
}
return $applicantstack_domain;
}
}
// returns the value of var_dump instead of outputting it.
// Used in debug mode only
if(!function_exists('get_var_dump')) {
function get_var_dump($mixed = null) {
ob_start();
var_dump($mixed);
$content = ob_get_contents();
ob_end_clean();
return $content;
}
}