1 | <?php |
||
19 | class AdminPageFramework_Utility extends AdminPageFramework_Utility_HTMLAttribute { |
||
20 | |||
21 | /** |
||
22 | * @param array $aRequest |
||
23 | * @param boolean $bStripSlashes Whether to fix magic quotes. |
||
24 | * @return array |
||
25 | * @since 3.8.24 |
||
26 | */ |
||
27 | static public function getHTTPRequestSanitized( array $aRequest, $bStripSlashes ) { |
||
39 | /** |
||
40 | * A light version of _sanitize_text_fields(). |
||
41 | * |
||
42 | * This does not strip HTML tags. |
||
43 | * |
||
44 | * @param string $sString |
||
45 | * @param boolean $bKeepLineFeeds |
||
46 | * @return string |
||
47 | * @sicne 3.8.25 |
||
48 | * @see _sanitize_text_fields() |
||
49 | */ |
||
50 | static private function ___getHTTPRequestTextValueSanitized( $sString, $bKeepLineFeeds=true ) { |
||
70 | |||
71 | /** |
||
72 | * @var array |
||
73 | * @since 3.8.24 |
||
74 | */ |
||
75 | static private $___aObjectCache = array(); |
||
76 | /** |
||
77 | * @param string|array $asName If array, it represents a multi-dimensional keys. |
||
78 | * @param mixed $mValue |
||
79 | * @since 3.8.24 |
||
80 | */ |
||
81 | static public function setObjectCache( $asName, $mValue ) { |
||
84 | |||
85 | /** |
||
86 | * @param array|string $asName |
||
87 | * @since 3.8.24 |
||
88 | */ |
||
89 | static public function unsetObjectCache( $asName ) { |
||
92 | |||
93 | /** |
||
94 | * Caches values in the class property. |
||
95 | * |
||
96 | * @remark The stored data will be gone after the page load. |
||
97 | * @param array|string $asName The key of the object cache array. If an array is given, it represents the multi-dimensional keys. |
||
98 | * @param mixed $mDefault |
||
99 | * @return mixed |
||
100 | * @since 3.8.24 |
||
101 | */ |
||
102 | static public function getObjectCache( $asName, $mDefault=null ) { |
||
105 | |||
106 | /** |
||
107 | * Shows a message for a deprecated item. |
||
108 | * |
||
109 | * Uses the `E_USER_NOTICE` error level so that the message won't be shown if `WP_DEBUG` is `false`. |
||
110 | * |
||
111 | * @remark This method is overridden by the `AdminPageFramework_FrameworkUtility` class. |
||
112 | * @param string $sDeprecated |
||
113 | * @param string $sAlternative |
||
114 | * @param string $sProgramName |
||
115 | * @since 3.8.8 |
||
116 | */ |
||
117 | static public function showDeprecationNotice( $sDeprecated, $sAlternative='', $sProgramName='Admin Page Framework' ) { |
||
129 | |||
130 | /** |
||
131 | * Calls back a user defined function. |
||
132 | * |
||
133 | * This is meant to be used to filter a value using a callback. When a callback is not available, the first parameter element will be returned. |
||
134 | * so set a default return value to the first element of the parameter array. |
||
135 | * |
||
136 | * @since 3.7.0 |
||
137 | * @since 3.8.5 Moved from `AdminPageFramework_Form_Base`. Added the default value to the `$asParameters`second parameter. |
||
138 | * @param callable $oCallable |
||
139 | * @param string|array $asParameters Parameters to pass to the callback function. |
||
140 | * @return mixed |
||
141 | */ |
||
142 | public function callBack( $oCallable, $asParameters=array() ) { |
||
152 | |||
153 | /** |
||
154 | * Checks if the given id (usually a function name) has been called throughout the page load. |
||
155 | * |
||
156 | * This is used to check if a function which needs to be done only once has been already called or not. |
||
157 | * |
||
158 | * @since 3.7.0 |
||
159 | * @param string $sKey The string identifier of the call. |
||
160 | * @return boolean |
||
161 | */ |
||
162 | static public function hasBeenCalled( $sKey ) { |
||
169 | /** |
||
170 | * Stores calls. |
||
171 | * @internal |
||
172 | */ |
||
173 | static private $___aCallStack = array(); |
||
174 | |||
175 | /** |
||
176 | * Captures the output buffer of the given function. |
||
177 | * @since 3.6.3 |
||
178 | * @param callable $cCallable |
||
179 | * @param array $aParameters |
||
180 | * @return string The captured output buffer. |
||
181 | */ |
||
182 | static public function getOutputBuffer( $cCallable, array $aParameters=array() ) { |
||
191 | |||
192 | /** |
||
193 | * Generates brief object information. |
||
194 | * |
||
195 | * @remark Meant to be used for the `__toString()` method. |
||
196 | * @since 3.6.0 |
||
197 | * @param object $oInstance |
||
198 | * @return string |
||
199 | */ |
||
200 | static public function getObjectInfo( $oInstance ) { |
||
207 | |||
208 | |||
209 | /** |
||
210 | * Returns one or the other. |
||
211 | * |
||
212 | * Saves one conditional statement. |
||
213 | * |
||
214 | * @remark Use this only when the performance is not critical. |
||
215 | * @since 3.5.3 |
||
216 | * @param boolean|integer|double|string|array|object|resource|NULL $mValue The value to evaluate. |
||
217 | * @param boolean|integer|double|string|array|object|resource|NULL $mTrue The value to return when the first parameter value yields true. |
||
218 | * @param boolean|integer|double|string|array|object|resource|NULL $mFalse The value to return when the first parameter value yields false. |
||
219 | * @return mixed |
||
220 | */ |
||
221 | static public function getAOrB( $mValue, $mTrue=null, $mFalse=null ) { |
||
224 | |||
225 | } |
||
226 |