/
LctvApiHelpers.inc
51 lines (41 loc) · 967 Bytes
/
LctvApiHelpers.inc
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
<?php
/**
* LiveEdu.tv API helper methods.
*
* @package LctvApi\Credentials
* @since 0.0.3
* @version 0.0.9
*/
class LctvApiHelpers {
/**
* Throw execption if these constants are undefined.
*
* @since 0.0.8
* @storage static
* @access public
*
* @throws Exception - If constant undefined.
*/
public static function ValidateConstants( $constants ) {
foreach ($constants as $constant) {
if ( ! defined( $constant ) ) {
throw new Exception(CONSTANT_UNDEFINED_MSG . $constant, 1);
}
}
}
/**
* Filter named get param or return a supplied default value.
*
* @since 0.0.8
* @storage static
* @access public
*/
public static function SanitizeGetParam( $param_name, $default_value ) {
return ( ! empty( $param_name ) &&
isset( $_GET[$param_name] ) &&
! empty( $_GET[$param_name] ) ) ?
strtolower( htmlspecialchars( $_GET[$param_name] ) ) :
$default_value;
}
}
?>