-
Notifications
You must be signed in to change notification settings - Fork 0
/
helpers.php
77 lines (67 loc) · 1.6 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
/**
* Open Graph protocol type labels are passed through gettext message interpreters for the current context.
* Fake the interpreter function alias if not defined
*/
if ( ! function_exists('_')) {
/**
* @param string $text
* @param string $domain
*
* @return string
*/
function _($text, $domain = '') {
unset($domain);
return $text;
}
}
if ( ! function_exists('base_url')) {
/**
* Get base url
*
* @param string $path
*
* @return string
*/
function base_url($path = '') {
$host = filter_input(INPUT_SERVER, 'HTTP_HOST');
if ( ! isset($host)) {
return $path;
}
$protocol = filter_input(INPUT_SERVER, 'HTTPS');
$protocol = isset($protocol)
? (($protocol and $protocol != 'off') ? 'https' : 'http')
: 'http';
return rtrim($protocol . '://' . $host, '/') . '/' . $path;
}
}
if ( ! function_exists('get_default_charsets')) {
/**
* Get default charsets
*
* @return string[]
*/
function get_default_charsets() {
return require __DIR__ . '/data/charsets.php';
}
}
if ( ! function_exists('get_supported_locales')) {
/**
* Get supported locales
*
* @return array
*/
function get_supported_locales() {
return require __DIR__ . '/data/locales.php';
}
}
if ( ! function_exists('get_og_types')) {
/**
* Get OpenGraph types
*
* @return array
*/
function get_og_types() {
return require __DIR__ . '/data/open-graph/types.php';
}
}