-
Notifications
You must be signed in to change notification settings - Fork 0
/
formatting.php
122 lines (114 loc) · 2.24 KB
/
formatting.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php
/**
* S.O.L.I.D. MVC additional functions and abbreviations for Main WordPress Formatting API.
*
* This is the file of functions, that is missing in wp-includes\formatting.php
*
* @see \wp-includes\formatting.php
* @package WordPress
*/
if(!function_exists('es'))
{
/**
* Short name for esc_sql
* @see esc_sql()
*
* @param string $text
* @return string
*/
function es($text)
{
return esc_sql($text);
}
}
if(!function_exists('ea'))
{
/**
* Short name for esc_attr
* @see esc_attr()
*
* @param string $text
* @return string
*/
function ea($text)
{
return esc_attr($text);
}
}
if(!function_exists('esc_br_html'))
{
/**
* Escape with line-breaks
*
* Related ticked - https://core.trac.wordpress.org/ticket/46188
*
* @param string $text
* @return string
*/
function esc_br_html($text)
{
$escaped_text_array = array_map('esc_html', explode("\n", $text));
$escaped_multiline_text = implode("<br />", $escaped_text_array);
return $escaped_multiline_text;
}
}
if(!function_exists('ebh'))
{
/**
* Short name for esc_br_html
* @see esc_br_html()
*
* Related ticked - https://core.trac.wordpress.org/ticket/46188
*
* @param string $text
* @return string
*/
function ebh($text)
{
$escaped_text_array = array_map('esc_html', explode("\n", $text));
$escaped_multiline_text = implode("<br />", $escaped_text_array);
return $escaped_multiline_text;
}
}
if(!function_exists('eh'))
{
/**
* Short name for esc_html
* @see esc_html()
*
* @param string $text
* @return string
*/
function eh($text)
{
return esc_html($text);
}
}
if(!function_exists('ej'))
{
/**
* Short name for esc_js
* @see esc_js()
*
* @param string $text
* @return string
*/
function ej($text)
{
return esc_js($text);
}
}
if(!function_exists('et'))
{
/**
* Short name for esc_textarea
* @see esc_textarea()
*
* @param string $text
* @return string
*/
function et($text)
{
return esc_textarea($text);
}
}