1 | <?php |
||
18 | class AdminPageFramework_WPUtility_Option extends AdminPageFramework_WPUtility_File { |
||
19 | |||
20 | /** |
||
21 | * @since 3.8.23 |
||
22 | * @return bool |
||
23 | */ |
||
24 | static public function isNetworkAdmin() { |
||
31 | |||
32 | /** |
||
33 | * Deletes transient items by prefix of a transient key. |
||
34 | * |
||
35 | * @since 3.8.23 |
||
36 | * @param array|string $asPrefixes |
||
37 | * @retuen void |
||
38 | */ |
||
39 | public static function cleanTransients( $asPrefixes=array( 'apf' ) ) { |
||
58 | |||
59 | /** |
||
60 | * @param $asPrefixes |
||
61 | * @sicne 3.8.23 |
||
62 | * @return void |
||
63 | */ |
||
64 | public static function cleanTransientsForNetwork( $asPrefixes ) { |
||
78 | |||
79 | /** |
||
80 | * @param $sTransientKey |
||
81 | * @param mixed $mDefault |
||
82 | * @return array |
||
83 | * @since 3.8.23 |
||
84 | */ |
||
85 | static public function getTransientAsArray( $sTransientKey, $mDefault=null ) { |
||
90 | |||
91 | /** |
||
92 | * @param $sTransientKey |
||
93 | * @param null $mDefault |
||
94 | * @return array |
||
95 | * @since 3.8.23 |
||
96 | */ |
||
97 | static public function getTransientWithoutCacheAsArray( $sTransientKey, $mDefault=null ) { |
||
102 | |||
103 | /** |
||
104 | * Retrieve the transient value directly from the database. |
||
105 | * |
||
106 | * Similar to the built-in get_transient() method but this one does not use the stored cache in the memory. |
||
107 | * Used for checking a lock in a sub-routine that should not run simultaneously. |
||
108 | * |
||
109 | * @param string $sTransientKey |
||
110 | * @param mixed $mDefault |
||
111 | * @sicne 3.8.23 |
||
112 | * @return mixed|false `false` on failing to retrieve the transient value. |
||
113 | */ |
||
114 | static public function getTransientWithoutCache( $sTransientKey, $mDefault=null ) { |
||
141 | |||
142 | /** |
||
143 | * @param string $sTransientKey |
||
144 | * @param mixed $mDefault |
||
145 | * @since 3.8.23 |
||
146 | * @return mixed |
||
147 | */ |
||
148 | static public function getTransientWithoutCacheForNetwork($sTransientKey, $mDefault ) { |
||
172 | |||
173 | /** |
||
174 | * Stores whether the page is loaded in the network admin or not. |
||
175 | * @since 3.1.3 |
||
176 | */ |
||
177 | static private $_bIsNetworkAdmin; |
||
178 | |||
179 | /** |
||
180 | * Deletes the given transient. |
||
181 | * |
||
182 | * @since 3.1.3 |
||
183 | * @param string $sTransientKey |
||
184 | * @return boolean True if the transient was deleted, false otherwise. |
||
185 | */ |
||
186 | static public function deleteTransient( $sTransientKey ) { |
||
205 | /** |
||
206 | * Retrieves the given transient. |
||
207 | * |
||
208 | * @since 3.1.3 |
||
209 | * @since 3.1.5 Added the $vDefault parameter. |
||
210 | * @param string $sTransientKey |
||
211 | * @param mixed $vDefault |
||
212 | * @return mixed |
||
213 | */ |
||
214 | static public function getTransient( $sTransientKey, $vDefault=null ) { |
||
239 | /** |
||
240 | * Sets the given transient. |
||
241 | * |
||
242 | * @since 3.1.3 |
||
243 | * @return boolean True if set; otherwise, false. |
||
244 | * @param string $sTransientKey |
||
245 | * @param mixed $vValue |
||
246 | * @param integer $iExpiration |
||
247 | */ |
||
248 | static public function setTransient( $sTransientKey, $vValue, $iExpiration=0 ) { |
||
267 | /** |
||
268 | * Returns a compatible transient key when it is too long. |
||
269 | * |
||
270 | * @since 3.5.9 |
||
271 | * @since 3.8.23 Deprecated the second parameter. |
||
272 | * @see https://codex.wordpress.org/Function_Reference/set_transient |
||
273 | * @param string $sSubject The subject string to format. |
||
274 | * @param integer $iDeprecated Deprecated. Previously, the allowed character length for the transient key: 40 for network and 45 for regular sites. |
||
275 | * The method will replace last ending 33 characters if the given string in the first parameter exceeds the limit. So this number must be greater than 33. |
||
276 | * @return string |
||
277 | * @todo it is said as of WordPress 4.3, it will be 255 since the database table column type becomes VARCHAR(255). |
||
278 | */ |
||
279 | static public function _getCompatibleTransientKey( $sSubject, $iDeprecated=null ) { |
||
300 | |||
301 | /** |
||
302 | * Retrieves the saved option value from the options table with the given option key, field ID, and section ID by giving a function name. |
||
303 | * |
||
304 | * @since 3.0.1 |
||
305 | * @since 3.3.0 Added the <var>$aAdditionalOptions</var> parameter. |
||
306 | * @param string $sOptionKey the option key of the options table. |
||
307 | * @param string|array $asKey the field id or the array that represents the key structure consisting of the section ID and the field ID. |
||
308 | * @param mixed $vDefault the default value that will be returned if nothing is stored. |
||
309 | * @param array $aAdditionalOptions an additional options array to merge with the options array. |
||
310 | * @return mixed |
||
311 | */ |
||
312 | static public function getOption( $sOptionKey, $asKey=null, $vDefault=null, array $aAdditionalOptions=array() ) { |
||
315 | /** |
||
316 | * Retrieves the saved option value from the site options table with the given option key, field ID, and section ID by giving a function name. |
||
317 | * |
||
318 | * @since 3.1.0 |
||
319 | * @since 3.5.3 Added the $aAdditionalOptions parameter. |
||
320 | * @param string $sOptionKey the option key of the options table. |
||
321 | * @param array|string $asKey the field id or the array that represents the key structure consisting of the section ID and the field ID. |
||
322 | * @param mixed $vDefault the default value that will be returned if nothing is stored. |
||
323 | * @param array $aAdditionalOptions an additional options array to merge with the options array. |
||
324 | * @remark Used in the network admin area. |
||
325 | * @return mixed |
||
326 | */ |
||
327 | static public function getSiteOption( $sOptionKey, $asKey=null, $vDefault=null, array $aAdditionalOptions=array() ) { |
||
330 | |||
331 | /** |
||
332 | * Retrieves the saved option value from the options table |
||
333 | * with the given option key, field ID, and section ID by giving a function name. |
||
334 | * |
||
335 | * @param $sOptionKey |
||
336 | * @param null $asKey |
||
337 | * @param null $vDefault |
||
338 | * @param array $aAdditionalOptions |
||
339 | * @param string $sFunctionName |
||
340 | * @return mixed |
||
341 | * @since 3.5.3 |
||
342 | */ |
||
343 | static private function _getOptionByFunctionName( $sOptionKey, $asKey=null, $vDefault=null, array $aAdditionalOptions=array(), $sFunctionName='get_option' ) { |
||
385 | |||
386 | } |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.