@@ -52,7 +52,7 @@ |
||
52 | 52 | * @since 3.5.3 |
53 | 53 | * @return string The site language. |
54 | 54 | */ |
55 | - static public function getSiteLanguage( $sDefault='en_US' ) { |
|
55 | + static public function getSiteLanguage( $sDefault = 'en_US' ) { |
|
56 | 56 | return defined( 'WPLANG' ) && WPLANG ? WPLANG : $sDefault; |
57 | 57 | } |
58 | 58 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @remark An alias of the dumpArray() method. |
27 | 27 | * @since 3.2.0 |
28 | 28 | */ |
29 | - static public function dump( $asArray, $sFilePath=null ) { |
|
29 | + static public function dump( $asArray, $sFilePath = null ) { |
|
30 | 30 | echo self::get( $asArray, $sFilePath ); |
31 | 31 | } |
32 | 32 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @since unknown |
38 | 38 | * @deprecated 3.2.0 |
39 | 39 | */ |
40 | - static public function dumpArray( $asArray, $sFilePath=null ) { |
|
40 | + static public function dumpArray( $asArray, $sFilePath = null ) { |
|
41 | 41 | self::dump( $asArray, $sFilePath ); |
42 | 42 | } |
43 | 43 | |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | * @remark An alias of getArray() method. |
50 | 50 | * @since 3.2.0 |
51 | 51 | */ |
52 | - static public function get( $asArray, $sFilePath=null, $bEscape=true ) { |
|
52 | + static public function get( $asArray, $sFilePath = null, $bEscape = true ) { |
|
53 | 53 | |
54 | 54 | if ( $sFilePath ) self::log( $asArray, $sFilePath ); |
55 | 55 | |
56 | 56 | return $bEscape |
57 | - ? "<pre class='dump-array'>" . htmlspecialchars( self::getAsString( $asArray ) ) . "</pre>" // esc_html() has a bug that breaks with complex HTML code. |
|
57 | + ? "<pre class='dump-array'>".htmlspecialchars( self::getAsString( $asArray ) )."</pre>" // esc_html() has a bug that breaks with complex HTML code. |
|
58 | 58 | : self::getAsString( $asArray ); // non-escape is used for exporting data into file. |
59 | 59 | |
60 | 60 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @since 3.0.0 Changed the $bEncloseInTag parameter to bEscape. |
68 | 68 | * @deprecated` 3.2.0 |
69 | 69 | */ |
70 | - static public function getArray( $asArray, $sFilePath=null, $bEscape=true ) { |
|
70 | + static public function getArray( $asArray, $sFilePath = null, $bEscape = true ) { |
|
71 | 71 | return self::get( $asArray, $sFilePath, $bEscape ); |
72 | 72 | } |
73 | 73 | |
@@ -83,18 +83,18 @@ discard block |
||
83 | 83 | * @param string $sFilePath The log file path. |
84 | 84 | * @return void |
85 | 85 | **/ |
86 | - static public function log( $mValue, $sFilePath=null ) { |
|
86 | + static public function log( $mValue, $sFilePath = null ) { |
|
87 | 87 | |
88 | 88 | static $_fPreviousTimeStamp = 0; |
89 | 89 | |
90 | 90 | $_oCallerInfo = debug_backtrace(); |
91 | 91 | $_sCallerFunction = self::getElement( |
92 | - $_oCallerInfo, // subject array |
|
92 | + $_oCallerInfo, // subject array |
|
93 | 93 | array( 1, 'function' ), // key |
94 | 94 | '' // default |
95 | 95 | ); |
96 | - $_sCallerClass = self::getElement( |
|
97 | - $_oCallerInfo, // subject array |
|
96 | + $_sCallerClass = self::getElement( |
|
97 | + $_oCallerInfo, // subject array |
|
98 | 98 | array( 1, 'class' ), // key |
99 | 99 | '' // default |
100 | 100 | ); |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | self::_getLogFilePath( $sFilePath, $_sCallerClass ), |
105 | 105 | self::_getLogHeadingLine( |
106 | 106 | $_fCurrentTimeStamp, |
107 | - round( $_fCurrentTimeStamp - $_fPreviousTimeStamp, 3 ), // elapsed time |
|
107 | + round( $_fCurrentTimeStamp - $_fPreviousTimeStamp, 3 ), // elapsed time |
|
108 | 108 | $_sCallerClass, |
109 | 109 | $_sCallerFunction |
110 | - ) . PHP_EOL |
|
110 | + ).PHP_EOL |
|
111 | 111 | . self::_getLogContents( $mValue ), |
112 | 112 | FILE_APPEND |
113 | 113 | ); |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | return $sFilePath; |
128 | 128 | } |
129 | 129 | if ( true === $sFilePath ) { |
130 | - return WP_CONTENT_DIR . DIRECTORY_SEPARATOR . get_class() . '_' . date( "Ymd" ) . '.log'; |
|
130 | + return WP_CONTENT_DIR.DIRECTORY_SEPARATOR.get_class().'_'.date( "Ymd" ).'.log'; |
|
131 | 131 | } |
132 | - return WP_CONTENT_DIR . DIRECTORY_SEPARATOR . get_class() . '_' . $sCallerClass . '_' . date( "Ymd" ) . '.log'; |
|
132 | + return WP_CONTENT_DIR.DIRECTORY_SEPARATOR.get_class().'_'.$sCallerClass.'_'.date( "Ymd" ).'.log'; |
|
133 | 133 | |
134 | 134 | } |
135 | 135 | /** |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | $_iLengths = self::_getValueLength( $mValue, $_sType ); |
145 | 145 | return '(' |
146 | 146 | . $_sType |
147 | - . ( null !== $_iLengths ? ', length: ' . $_iLengths : '' ) |
|
147 | + . ( null !== $_iLengths ? ', length: '.$_iLengths : '' ) |
|
148 | 148 | . ') ' |
149 | 149 | . self::getAsString( $mValue ) |
150 | - . PHP_EOL . PHP_EOL; |
|
150 | + . PHP_EOL.PHP_EOL; |
|
151 | 151 | |
152 | 152 | } |
153 | 153 | /** |
@@ -188,11 +188,11 @@ discard block |
||
188 | 188 | $_nMicroseconds = str_pad( round( ( $_nNow - floor( $_nNow ) ) * 10000 ), 4, '0' ); |
189 | 189 | |
190 | 190 | $_aOutput = array( |
191 | - date( "Y/m/d H:i:s", $_nNow ) . '.' . $_nMicroseconds, |
|
191 | + date( "Y/m/d H:i:s", $_nNow ).'.'.$_nMicroseconds, |
|
192 | 192 | self::_getFormattedElapsedTime( $nElapsed ), |
193 | 193 | $_iPageLoadID, |
194 | 194 | AdminPageFramework_Registry::getVersion(), |
195 | - $sCallerClass . '::' . $sCallerFunction, |
|
195 | + $sCallerClass.'::'.$sCallerFunction, |
|
196 | 196 | current_filter(), |
197 | 197 | self::getCurrentURL(), |
198 | 198 | ); |
@@ -210,22 +210,22 @@ discard block |
||
210 | 210 | $_aElapsedParts = explode( ".", ( string ) $nElapsed ); |
211 | 211 | $_sElapsedFloat = str_pad( |
212 | 212 | self::getElement( |
213 | - $_aElapsedParts, // subject array |
|
213 | + $_aElapsedParts, // subject array |
|
214 | 214 | 1, // key |
215 | 215 | 0 // default |
216 | 216 | ), |
217 | 217 | 3, |
218 | 218 | '0' |
219 | 219 | ); |
220 | - $_sElapsed = self::getElement( |
|
221 | - $_aElapsedParts, // subject array |
|
222 | - 0, // key |
|
220 | + $_sElapsed = self::getElement( |
|
221 | + $_aElapsedParts, // subject array |
|
222 | + 0, // key |
|
223 | 223 | 0 // default |
224 | 224 | ); |
225 | - $_sElapsed = strlen( $_sElapsed ) > 1 |
|
226 | - ? '+' . substr( $_sElapsed, -1, 2 ) |
|
227 | - : ' ' . $_sElapsed; |
|
228 | - return $_sElapsed . '.' . $_sElapsedFloat; |
|
225 | + $_sElapsed = strlen( $_sElapsed ) > 1 |
|
226 | + ? '+'.substr( $_sElapsed, -1, 2 ) |
|
227 | + : ' '.$_sElapsed; |
|
228 | + return $_sElapsed.'.'.$_sElapsedFloat; |
|
229 | 229 | |
230 | 230 | } |
231 | 231 | /** |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | * @since 3.0.3 Changed the default log location and file name. |
236 | 236 | * @deprecated 3.1.0 Use the `log()` method instead. |
237 | 237 | */ |
238 | - static public function logArray( $asArray, $sFilePath=null ) { |
|
238 | + static public function logArray( $asArray, $sFilePath = null ) { |
|
239 | 239 | self::log( $asArray, $sFilePath ); |
240 | 240 | } |
241 | 241 | |
@@ -265,13 +265,13 @@ discard block |
||
265 | 265 | * |
266 | 266 | * @since 3.4.4 |
267 | 267 | */ |
268 | - static public function getSliceByDepth( array $aSubject, $iDepth=0 ) { |
|
268 | + static public function getSliceByDepth( array $aSubject, $iDepth = 0 ) { |
|
269 | 269 | |
270 | 270 | foreach ( $aSubject as $_sKey => $_vValue ) { |
271 | 271 | if ( is_object( $_vValue ) ) { |
272 | 272 | $aSubject[ $_sKey ] = method_exists( $_vValue, '__toString' ) |
273 | 273 | ? ( string ) $_vValue // cast string |
274 | - : get_object_vars( $_vValue ); // convert it to array. |
|
274 | + : get_object_vars( $_vValue ); // convert it to array. |
|
275 | 275 | } |
276 | 276 | if ( is_array( $_vValue ) ) { |
277 | 277 | $_iDepth = $iDepth; |
@@ -51,7 +51,9 @@ |
||
51 | 51 | */ |
52 | 52 | static public function get( $asArray, $sFilePath=null, $bEscape=true ) { |
53 | 53 | |
54 | - if ( $sFilePath ) self::log( $asArray, $sFilePath ); |
|
54 | + if ( $sFilePath ) { |
|
55 | + self::log( $asArray, $sFilePath ); |
|
56 | + } |
|
55 | 57 | |
56 | 58 | return $bEscape |
57 | 59 | ? "<pre class='dump-array'>" . htmlspecialchars( self::getAsString( $asArray ) ) . "</pre>" // esc_html() has a bug that breaks with complex HTML code. |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Admin Page Framework |
|
4 | - * |
|
5 | - * http://en.michaeluno.jp/admin-page-framework/ |
|
6 | - * Copyright (c) 2013-2016 Michael Uno; Licensed MIT |
|
7 | - * |
|
8 | - */ |
|
3 | + * Admin Page Framework |
|
4 | + * |
|
5 | + * http://en.michaeluno.jp/admin-page-framework/ |
|
6 | + * Copyright (c) 2013-2016 Michael Uno; Licensed MIT |
|
7 | + * |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Provides utility methods which can be accessed among different components of the framework. |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @return integer |
35 | 35 | * @internal |
36 | 36 | */ |
37 | - static public function sortArrayByKey( $a, $b, $sKey='order' ) { |
|
37 | + static public function sortArrayByKey( $a, $b, $sKey = 'order' ) { |
|
38 | 38 | return isset( $a[ $sKey ], $b[ $sKey ] ) |
39 | 39 | ? $a[ $sKey ] - $b[ $sKey ] |
40 | 40 | : 1; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | static public function unsetDimensionalArrayElement( &$mSubject, array $aKeys ) { |
78 | 78 | |
79 | 79 | $_sKey = array_shift( $aKeys ); |
80 | - if ( ! empty( $aKeys ) ) { |
|
80 | + if ( !empty( $aKeys ) ) { |
|
81 | 81 | if ( isset( $mSubject[ $_sKey ] ) && is_array( $mSubject[ $_sKey ] ) ) { |
82 | 82 | self::unsetDimensionalArrayElement( $mSubject[ $_sKey ], $aKeys ); |
83 | 83 | } |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | static public function setMultiDimensionalArray( &$mSubject, array $aKeys, $mValue ) { |
99 | 99 | |
100 | 100 | $_sKey = array_shift( $aKeys ); |
101 | - if ( ! empty( $aKeys ) ) { |
|
102 | - if( ! isset( $mSubject[ $_sKey ] ) || ! is_array( $mSubject[ $_sKey ] ) ) { |
|
101 | + if ( !empty( $aKeys ) ) { |
|
102 | + if ( !isset( $mSubject[ $_sKey ] ) || !is_array( $mSubject[ $_sKey ] ) ) { |
|
103 | 103 | $mSubject[ $_sKey ] = array(); |
104 | 104 | } |
105 | 105 | self::setMultiDimensionalArray( $mSubject[ $_sKey ], $aKeys, $mValue ); |
@@ -153,10 +153,10 @@ discard block |
||
153 | 153 | |
154 | 154 | $_aNumeric = self::getIntegerKeyElements( $aSubject ); |
155 | 155 | $_aAssociative = self::invertCastArrayContents( $aSubject, $_aNumeric ); |
156 | - foreach( $_aNumeric as &$_aElem ) { |
|
156 | + foreach ( $_aNumeric as &$_aElem ) { |
|
157 | 157 | $_aElem = self::uniteArrays( $_aElem, $_aAssociative ); |
158 | 158 | } |
159 | - if ( ! empty( $_aAssociative ) ) { |
|
159 | + if ( !empty( $_aAssociative ) ) { |
|
160 | 160 | array_unshift( $_aNumeric, $_aAssociative ); // insert the main section to the beginning of the array. |
161 | 161 | } |
162 | 162 | return $_aNumeric; |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | public static function castArrayContents( array $aModel, array $aSubject ) { |
180 | 180 | |
181 | 181 | $_aCast = array(); |
182 | - foreach( $aModel as $_isKey => $_v ) { |
|
182 | + foreach ( $aModel as $_isKey => $_v ) { |
|
183 | 183 | $_aCast[ $_isKey ] = self::getElement( |
184 | - $aSubject, // subject array |
|
185 | - $_isKey, // key |
|
184 | + $aSubject, // subject array |
|
185 | + $_isKey, // key |
|
186 | 186 | null // default |
187 | 187 | ); |
188 | 188 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | public static function invertCastArrayContents( array $aModel, array $aSubject ) { |
204 | 204 | |
205 | 205 | $_aInvert = array(); |
206 | - foreach( $aModel as $_isKey => $_v ) { |
|
206 | + foreach ( $aModel as $_isKey => $_v ) { |
|
207 | 207 | if ( array_key_exists( $_isKey, $aSubject ) ) { |
208 | 208 | continue; |
209 | 209 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | public static function uniteArrays( /* $aPrecedence, $aArray1, $aArray2, ... */ ) { |
230 | 230 | |
231 | 231 | $_aArray = array(); |
232 | - foreach( array_reverse( func_get_args() ) as $_aArg ) { |
|
232 | + foreach ( array_reverse( func_get_args() ) as $_aArg ) { |
|
233 | 233 | $_aArray = self::uniteArraysRecursive( |
234 | 234 | self::getAsArray( $_aArg ), |
235 | 235 | $_aArray |
@@ -260,14 +260,14 @@ discard block |
||
260 | 260 | $aPrecedence = array(); |
261 | 261 | } |
262 | 262 | |
263 | - if ( ! is_array( $aDefault ) || ! is_array( $aPrecedence ) ) { |
|
263 | + if ( !is_array( $aDefault ) || !is_array( $aPrecedence ) ) { |
|
264 | 264 | return $aPrecedence; |
265 | 265 | } |
266 | 266 | |
267 | - foreach( $aDefault as $sKey => $v ) { |
|
267 | + foreach ( $aDefault as $sKey => $v ) { |
|
268 | 268 | |
269 | 269 | // If the precedence does not have the key, assign the default's value. |
270 | - if ( ! array_key_exists( $sKey, $aPrecedence ) || is_null( $aPrecedence[ $sKey ] ) ) { |
|
270 | + if ( !array_key_exists( $sKey, $aPrecedence ) || is_null( $aPrecedence[ $sKey ] ) ) { |
|
271 | 271 | $aPrecedence[ $sKey ] = $v; |
272 | 272 | } else { |
273 | 273 | |
@@ -298,9 +298,9 @@ discard block |
||
298 | 298 | * - NULL |
299 | 299 | * @return array The modified array. |
300 | 300 | */ |
301 | - static public function dropElementsByType( array $aArray, $aTypes=array( 'array' ) ) { |
|
301 | + static public function dropElementsByType( array $aArray, $aTypes = array( 'array' ) ) { |
|
302 | 302 | |
303 | - foreach( $aArray as $isKey => $vValue ) { |
|
303 | + foreach ( $aArray as $isKey => $vValue ) { |
|
304 | 304 | if ( in_array( gettype( $vValue ), $aTypes ) ) { |
305 | 305 | unset( $aArray[ $isKey ] ); |
306 | 306 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | */ |
317 | 317 | static public function dropElementByValue( array $aArray, $vValue ) { |
318 | 318 | |
319 | - foreach( self::getAsArray( $vValue, true ) as $_vValue ) { |
|
319 | + foreach ( self::getAsArray( $vValue, true ) as $_vValue ) { |
|
320 | 320 | $_sKey = array_search( $_vValue, $aArray, true ); |
321 | 321 | if ( $_sKey === false ) { |
322 | 322 | continue; |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | */ |
339 | 339 | static public function dropElementsByKey( array $aArray, $asKeys ) { |
340 | 340 | |
341 | - foreach( self::getAsArray( $asKeys, true ) as $_isKey ) { |
|
341 | + foreach ( self::getAsArray( $asKeys, true ) as $_isKey ) { |
|
342 | 342 | unset( $aArray[ $_isKey ] ); |
343 | 343 | } |
344 | 344 | return $aArray; |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | |
205 | 205 | $_aInvert = array(); |
206 | 206 | foreach( $aModel as $_isKey => $_v ) { |
207 | - if ( array_key_exists( $_isKey, $aSubject ) ) { |
|
207 | + if ( array_key_exists( $_isKey, $aSubject ) ) { |
|
208 | 208 | continue; |
209 | 209 | } |
210 | 210 | $_aInvert[ $_isKey ] = $_v; |
@@ -256,11 +256,11 @@ discard block |
||
256 | 256 | */ |
257 | 257 | public static function uniteArraysRecursive( $aPrecedence, $aDefault ) { |
258 | 258 | |
259 | - if ( is_null( $aPrecedence ) ) { |
|
259 | + if ( is_null( $aPrecedence ) ) { |
|
260 | 260 | $aPrecedence = array(); |
261 | 261 | } |
262 | 262 | |
263 | - if ( ! is_array( $aDefault ) || ! is_array( $aPrecedence ) ) { |
|
263 | + if ( ! is_array( $aDefault ) || ! is_array( $aPrecedence ) ) { |
|
264 | 264 | return $aPrecedence; |
265 | 265 | } |
266 | 266 |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @since 3.6.3 |
45 | 45 | * @return string The captured output buffer. |
46 | 46 | */ |
47 | - static public function getOutputBuffer( $oCallable, array $aParameters=array() ) { |
|
47 | + static public function getOutputBuffer( $oCallable, array $aParameters = array() ) { |
|
48 | 48 | |
49 | 49 | ob_start(); |
50 | 50 | echo call_user_func_array( $oCallable, $aParameters ); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | $_iCount = count( get_object_vars( $oInstance ) ); |
67 | 67 | $_sClassName = get_class( $oInstance ); |
68 | - return '(object) ' . $_sClassName . ': ' . $_iCount . ' properties.'; |
|
68 | + return '(object) '.$_sClassName.': '.$_iCount.' properties.'; |
|
69 | 69 | |
70 | 70 | } |
71 | 71 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @param boolean|integer|double|string|array|object|resource|NULL $mTrue The value to return when the first parameter value yields false. |
83 | 83 | * @return mixed |
84 | 84 | */ |
85 | - static public function getAOrB( $mValue, $mTrue=null, $mFalse=null ) { |
|
85 | + static public function getAOrB( $mValue, $mTrue = null, $mFalse = null ) { |
|
86 | 86 | return $mValue ? $mTrue : $mFalse; |
87 | 87 | } |
88 | 88 |
@@ -32,16 +32,16 @@ discard block |
||
32 | 32 | * @since 3.5.3 Moved from `AdminPageFramework_Utility_Array`. |
33 | 33 | * @deprecated 3.5.3 Use `getElement()`. |
34 | 34 | */ |
35 | - public static function getCorrespondingArrayValue( $vSubject, $sKey, $sDefault='', $bBlankToDefault=false ) { |
|
35 | + public static function getCorrespondingArrayValue( $vSubject, $sKey, $sDefault = '', $bBlankToDefault = false ) { |
|
36 | 36 | |
37 | 37 | // If $vSubject is null, |
38 | - if ( ! isset( $vSubject ) ) { return $sDefault; } |
|
38 | + if ( !isset( $vSubject ) ) { return $sDefault; } |
|
39 | 39 | |
40 | 40 | // If the $bBlankToDefault flag is set and the subject value is a blank string, return the default value. |
41 | 41 | if ( $bBlankToDefault && $vSubject == '' ) { return $sDefault; } |
42 | 42 | |
43 | 43 | // If $vSubject is not an array, |
44 | - if ( ! is_array( $vSubject ) ) { return ( string ) $vSubject; } // consider it as string. |
|
44 | + if ( !is_array( $vSubject ) ) { return ( string ) $vSubject; } // consider it as string. |
|
45 | 45 | |
46 | 46 | // Consider $vSubject as array. |
47 | 47 | if ( isset( $vSubject[ $sKey ] ) ) { return $vSubject[ $sKey ]; } |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | * @since 3.5.3 Moved from `AdminPageFramework_FieldType_Base`. |
87 | 87 | * @deprecated 3.5.3 Use the `getElement()` method. |
88 | 88 | */ |
89 | - protected function getFieldElementByKey( $asElement, $sKey, $asDefault='' ) { |
|
89 | + protected function getFieldElementByKey( $asElement, $sKey, $asDefault = '' ) { |
|
90 | 90 | |
91 | - if ( ! is_array( $asElement ) || ! isset( $sKey ) ) { return $asElement; } |
|
91 | + if ( !is_array( $asElement ) || !isset( $sKey ) ) { return $asElement; } |
|
92 | 92 | |
93 | 93 | $aElements = &$asElement; // it is an array |
94 | 94 | return isset( $aElements[ $sKey ] ) |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | static public function shiftTillTrue( array $aArray ) { |
109 | 109 | |
110 | - foreach( $aArray as &$vElem ) { |
|
110 | + foreach ( $aArray as &$vElem ) { |
|
111 | 111 | |
112 | 112 | if ( $vElem ) { break; } |
113 | 113 | unset( $vElem ); |
@@ -139,15 +139,15 @@ discard block |
||
139 | 139 | */ |
140 | 140 | static public function getAttributes( array $aAttributes ) { |
141 | 141 | |
142 | - $_sQuoteCharactor ="'"; |
|
142 | + $_sQuoteCharactor = "'"; |
|
143 | 143 | $_aOutput = array(); |
144 | - foreach( $aAttributes as $sAttribute => $sProperty ) { |
|
144 | + foreach ( $aAttributes as $sAttribute => $sProperty ) { |
|
145 | 145 | |
146 | 146 | // Must be resolved as a string. |
147 | 147 | if ( in_array( gettype( $sProperty ), array( 'array', 'object' ) ) ) { |
148 | 148 | continue; |
149 | 149 | } |
150 | - $_aOutput[] = "{$sAttribute}={$_sQuoteCharactor}{$sProperty}{$_sQuoteCharactor}"; |
|
150 | + $_aOutput[ ] = "{$sAttribute}={$_sQuoteCharactor}{$sProperty}{$_sQuoteCharactor}"; |
|
151 | 151 | |
152 | 152 | } |
153 | 153 | return implode( ' ', $_aOutput ); |
@@ -32,7 +32,7 @@ |
||
32 | 32 | * @since 3.5.3 Moved from `AdminPageFramework_Utility_Array`. |
33 | 33 | * @deprecated 3.5.3 Use `getElement()`. |
34 | 34 | */ |
35 | - public static function getCorrespondingArrayValue( $vSubject, $sKey, $sDefault='', $bBlankToDefault=false ) { |
|
35 | + public static function getCorrespondingArrayValue( $vSubject, $sKey, $sDefault='', $bBlankToDefault=false ) { |
|
36 | 36 | |
37 | 37 | // If $vSubject is null, |
38 | 38 | if ( ! isset( $vSubject ) ) { return $sDefault; } |
@@ -28,10 +28,10 @@ discard block |
||
28 | 28 | * @param integer $iLines The number of lines to read. |
29 | 29 | * @return string |
30 | 30 | */ |
31 | - static public function getFileTailContents( $asPath=array(), $iLines=1 ) { |
|
31 | + static public function getFileTailContents( $asPath = array(), $iLines = 1 ) { |
|
32 | 32 | |
33 | - $_sPath = self::_getFirstItem( $asPath ); |
|
34 | - if ( ! @is_readable( $_sPath ) ) { |
|
33 | + $_sPath = self::_getFirstItem( $asPath ); |
|
34 | + if ( !@is_readable( $_sPath ) ) { |
|
35 | 35 | return ''; |
36 | 36 | } |
37 | 37 | return trim( |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @since 3.4.6 |
62 | 62 | * @return string |
63 | 63 | */ |
64 | - static public function sanitizeFileName( $sFileName, $sReplacement='_' ) { |
|
64 | + static public function sanitizeFileName( $sFileName, $sReplacement = '_' ) { |
|
65 | 65 | |
66 | 66 | // Remove anything which isn't a word, white space, number |
67 | 67 | // or any of the following characters -_~,;:[](). |
@@ -48,8 +48,8 @@ |
||
48 | 48 | * @since 3.6.3 |
49 | 49 | * @return boolean If the passed value is not null, true; otherwise, false. |
50 | 50 | */ |
51 | - static public function isNotNull( $mValue=null ) { |
|
52 | - return ! is_null( $mValue ); |
|
51 | + static public function isNotNull( $mValue = null ) { |
|
52 | + return !is_null( $mValue ); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @since DVVER Moved from `AdminPageFramework_Utility_Array`. |
27 | 27 | */ |
28 | 28 | static public function getFirstElement( array $aArray ) { |
29 | - foreach( $aArray as $_mElement ) { |
|
29 | + foreach ( $aArray as $_mElement ) { |
|
30 | 30 | return $_mElement; |
31 | 31 | } |
32 | 32 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param string|array $asToDefault When the returning value matches oen of the set values here, the value(s) will be discarded and the default value will be applied. |
46 | 46 | * @return mixed The set value or the default value. |
47 | 47 | */ |
48 | - static public function getElement( $aSubject, $aisKey, $mDefault=null, $asToDefault=array( null ) ) { |
|
48 | + static public function getElement( $aSubject, $aisKey, $mDefault = null, $asToDefault = array( null ) ) { |
|
49 | 49 | |
50 | 50 | $_aToDefault = is_null( $asToDefault ) |
51 | 51 | ? array( null ) |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @since DVVER Moved from `AdminPageFramework_Utility_Array`. |
73 | 73 | * @return array The cast retrieved element value. |
74 | 74 | */ |
75 | - static public function getElementAsArray( $aSubject, $aisKey, $mDefault=null, $asToDefault=array( null ) ) { |
|
75 | + static public function getElementAsArray( $aSubject, $aisKey, $mDefault = null, $asToDefault = array( null ) ) { |
|
76 | 76 | return self::getAsArray( |
77 | 77 | self::getElement( $aSubject, $aisKey, $mDefault, $asToDefault ), |
78 | 78 | true // preserve an empty value |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | foreach ( $aParse as $_isKey => $_v ) { |
93 | 93 | |
94 | - if ( ! is_numeric( $_isKey ) ) { |
|
94 | + if ( !is_numeric( $_isKey ) ) { |
|
95 | 95 | unset( $aParse[ $_isKey ] ); |
96 | 96 | continue; |
97 | 97 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | // Convert string numeric value to integer or float. |
100 | 100 | $_isKey = $_isKey + 0; |
101 | 101 | |
102 | - if ( ! is_int( $_isKey ) ) { |
|
102 | + if ( !is_int( $_isKey ) ) { |
|
103 | 103 | unset( $aParse[ $_isKey ] ); |
104 | 104 | } |
105 | 105 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | static public function getNonIntegerKeyElements( array $aParse ) { |
119 | 119 | |
120 | 120 | foreach ( $aParse as $_isKey => $_v ) { |
121 | - if ( is_numeric( $_isKey ) && is_int( $_isKey+ 0 ) ) { |
|
121 | + if ( is_numeric( $_isKey ) && is_int( $_isKey + 0 ) ) { |
|
122 | 122 | unset( $aParse[ $_isKey ] ); |
123 | 123 | } |
124 | 124 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @since DVVER Moved from `AdminPageFramework_Utility_Array`. |
152 | 152 | * @return mixed |
153 | 153 | */ |
154 | - static public function getArrayValueByArrayKeys( $aArray, $aKeys, $vDefault=null ) { |
|
154 | + static public function getArrayValueByArrayKeys( $aArray, $aKeys, $vDefault = null ) { |
|
155 | 155 | |
156 | 156 | $_sKey = array_shift( $aKeys ); |
157 | 157 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @param boolean bPreserveEmpty If `false` is given, a value that yields `false` such as `false`, an empty sttring `''`, or `0` will not create an element such as `array( false )`. It will be just `array()`. |
191 | 191 | * @return array The cast array. |
192 | 192 | */ |
193 | - static public function getAsArray( $mValue, $bPreserveEmpty=false ) { |
|
193 | + static public function getAsArray( $mValue, $bPreserveEmpty = false ) { |
|
194 | 194 | |
195 | 195 | if ( is_array( $mValue ) ) { |
196 | 196 | return $mValue; |
@@ -158,7 +158,8 @@ |
||
158 | 158 | // array_key_exists( $_sKey, $aArray ) caused warnings in some occasions |
159 | 159 | if ( isset( $aArray[ $_sKey ] ) ) { |
160 | 160 | |
161 | - if ( empty( $aKeys ) ) { // no more keys |
|
161 | + if ( empty( $aKeys ) ) { |
|
162 | +// no more keys |
|
162 | 163 | return $aArray[ $_sKey ]; |
163 | 164 | } |
164 | 165 |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | */ |
37 | 37 | static public function getInlineCSS( array $aCSSRules ) { |
38 | 38 | $_aOutput = array(); |
39 | - foreach( $aCSSRules as $_sProperty => $_sValue ) { |
|
40 | - $_aOutput[] = $_sProperty . ': ' . $_sValue; |
|
39 | + foreach ( $aCSSRules as $_sProperty => $_sValue ) { |
|
40 | + $_aOutput[ ] = $_sProperty.': '.$_sValue; |
|
41 | 41 | } |
42 | 42 | return implode( '; ', $_aOutput ); |
43 | 43 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | static public function getStyleAttribute( $asInlineCSSes ) { |
69 | 69 | |
70 | 70 | $_aCSSRules = array(); |
71 | - foreach( array_reverse( func_get_args() ) as $_asCSSRules ) { |
|
71 | + foreach ( array_reverse( func_get_args() ) as $_asCSSRules ) { |
|
72 | 72 | |
73 | 73 | // For array, store in the container. |
74 | 74 | if ( is_array( $_asCSSRules ) ) { |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | |
79 | 79 | // At this point, it is a string. Break them down to array elements. |
80 | 80 | $__aCSSRules = explode( ';', $_asCSSRules ); |
81 | - foreach( $__aCSSRules as $_sPair ) { |
|
81 | + foreach ( $__aCSSRules as $_sPair ) { |
|
82 | 82 | $_aCSSPair = explode( ':', $_sPair ); |
83 | - if ( ! isset( $_aCSSPair[ 0 ], $_aCSSPair[ 1 ] ) ) { |
|
83 | + if ( !isset( $_aCSSPair[ 0 ], $_aCSSPair[ 1 ] ) ) { |
|
84 | 84 | continue; |
85 | 85 | } |
86 | 86 | $_aCSSRules[ $_aCSSPair[ 0 ] ] = $_aCSSPair[ 1 ]; |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | */ |
118 | 118 | static public function getClassAttribute( /* $asClassSelectors1, $asClassSelectors12, ... */ ) { |
119 | 119 | |
120 | - $_aClasses = array(); |
|
121 | - foreach( func_get_args() as $_asClasses ) { |
|
122 | - if ( ! in_array( gettype( $_asClasses ), array( 'array', 'string' ) ) ) { |
|
120 | + $_aClasses = array(); |
|
121 | + foreach ( func_get_args() as $_asClasses ) { |
|
122 | + if ( !in_array( gettype( $_asClasses ), array( 'array', 'string' ) ) ) { |
|
123 | 123 | continue; |
124 | 124 | } |
125 | 125 | $_aClasses = array_merge( |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | : explode( ' ', $_asClasses ) |
130 | 130 | ); |
131 | 131 | } |
132 | - $_aClasses = array_unique( array_filter( $_aClasses ) ); |
|
132 | + $_aClasses = array_unique( array_filter( $_aClasses ) ); |
|
133 | 133 | |
134 | 134 | // @todo examine if it is okay to remove the trim() function below. |
135 | 135 | return trim( implode( ' ', $_aClasses ) ); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | static public function generateClassAttribute( /* $asClassSelectors1, $asClassSelectors12 ... */ ) { |
146 | 146 | $_aParams = func_get_args(); |
147 | 147 | return call_user_func_array( |
148 | - array( __CLASS__ , 'getClassAttribute' ), |
|
148 | + array( __CLASS__, 'getClassAttribute' ), |
|
149 | 149 | $_aParams |
150 | 150 | ); |
151 | 151 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | static public function getDataAttributeArray( array $aArray ) { |
160 | 160 | |
161 | 161 | $_aNewArray = array(); |
162 | - foreach( $aArray as $sKey => $v ) { |
|
162 | + foreach ( $aArray as $sKey => $v ) { |
|
163 | 163 | if ( in_array( gettype( $v ), array( 'array', 'object' ) ) ) { |
164 | 164 | continue; |
165 | 165 | } |