@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | */ |
26 | 26 | static public function getCurrentAdminURL() { |
27 | 27 | |
28 | - $sRequestURI = $GLOBALS['is_IIS'] ? $_SERVER['PATH_INFO'] : $_SERVER["REQUEST_URI"]; |
|
29 | - $sPageURL = 'on' == @$_SERVER["HTTPS"] ? "https://" : "http://"; |
|
28 | + $sRequestURI = $GLOBALS[ 'is_IIS' ] ? $_SERVER[ 'PATH_INFO' ] : $_SERVER[ "REQUEST_URI" ]; |
|
29 | + $sPageURL = 'on' == @$_SERVER[ "HTTPS" ] ? "https://" : "http://"; |
|
30 | 30 | |
31 | - if ( "80" != $_SERVER["SERVER_PORT"] ) { |
|
32 | - $sPageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $sRequestURI; |
|
31 | + if ( "80" != $_SERVER[ "SERVER_PORT" ] ) { |
|
32 | + $sPageURL .= $_SERVER[ "SERVER_NAME" ].":".$_SERVER[ "SERVER_PORT" ].$sRequestURI; |
|
33 | 33 | } else { |
34 | - $sPageURL .= $_SERVER["SERVER_NAME"] . $sRequestURI; |
|
34 | + $sPageURL .= $_SERVER[ "SERVER_NAME" ].$sRequestURI; |
|
35 | 35 | } |
36 | 36 | return $sPageURL; |
37 | 37 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param string $sSubjectURL ( optional ) The subject url to modify |
49 | 49 | * @return string The modified url. |
50 | 50 | */ |
51 | - static public function getQueryAdminURL( $aAddingQueries=array(), $aRemovingQueryKeys=array(), $sSubjectURL='' ) { |
|
51 | + static public function getQueryAdminURL( $aAddingQueries = array(), $aRemovingQueryKeys = array(), $sSubjectURL = '' ) { |
|
52 | 52 | |
53 | 53 | $_sAdminURL = is_network_admin() |
54 | 54 | ? network_admin_url( AdminPageFramework_WPUtility_Page::getPageNow() ) |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $_oWPStyles = new WP_Styles(); // It doesn't matter whether the file is a style or not. Just use the built-in WordPress class to calculate the SRC URL. |
99 | 99 | $_sRelativePath = AdminPageFramework_Utility::getRelativePath( ABSPATH, $sFilePath ); |
100 | 100 | $_sRelativePath = preg_replace( "/^\.[\/\\\]/", '', $_sRelativePath, 1 ); // removes the heading ./ or .\ |
101 | - $_sHref = trailingslashit( $_oWPStyles->base_url ) . $_sRelativePath; |
|
101 | + $_sHref = trailingslashit( $_oWPStyles->base_url ).$_sRelativePath; |
|
102 | 102 | unset( $_oWPStyles ); // for PHP 5.2.x or below |
103 | 103 | return $_sHref; |
104 | 104 | |
@@ -115,9 +115,9 @@ discard block |
||
115 | 115 | * @since 3.7.9 Changed not to escape characters. |
116 | 116 | * @return string|null |
117 | 117 | */ |
118 | - static public function getResolvedSRC( $sSRC, $bReturnNullIfNotExist=false ) { |
|
118 | + static public function getResolvedSRC( $sSRC, $bReturnNullIfNotExist = false ) { |
|
119 | 119 | |
120 | - if ( ! self::isResourcePath( $sSRC ) ) { |
|
120 | + if ( !self::isResourcePath( $sSRC ) ) { |
|
121 | 121 | return $bReturnNullIfNotExist |
122 | 122 | ? null |
123 | 123 | : $sSRC; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | // If the file exists, it means it is an absolute path. If so, calculate the URL from the path. |
132 | 132 | if ( file_exists( realpath( $sSRC ) ) ) { |
133 | - return self::getSRCFromPath( $sSRC ); // url escaping is done in the method |
|
133 | + return self::getSRCFromPath( $sSRC ); // url escaping is done in the method |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | if ( $bReturnNullIfNotExist ) { |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | /** |
145 | 145 | * @deprecated 3.6.0 Use `getResolvedSRC()` instead. |
146 | 146 | */ |
147 | - static public function resolveSRC( $sSRC, $bReturnNullIfNotExist=false ) { |
|
147 | + static public function resolveSRC( $sSRC, $bReturnNullIfNotExist = false ) { |
|
148 | 148 | return self::getResolvedSRC( $sSRC, $bReturnNullIfNotExist ); |
149 | 149 | } |
150 | 150 |
@@ -114,7 +114,7 @@ |
||
114 | 114 | * @since 3.7.9 Changed not to escape characters. |
115 | 115 | * @return string|null |
116 | 116 | */ |
117 | - static public function getResolvedSRC( $sSRC, $bReturnNullIfNotExist=false ) { |
|
117 | + static public function getResolvedSRC( $sSRC, $bReturnNullIfNotExist=false ) { |
|
118 | 118 | |
119 | 119 | if ( ! self::isResourcePath( $sSRC ) ) { |
120 | 120 | return $bReturnNullIfNotExist |
@@ -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 |
@@ -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 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @return integer |
34 | 34 | * @internal |
35 | 35 | */ |
36 | - static public function sortArrayByKey( $a, $b, $sKey='order' ) { |
|
36 | + static public function sortArrayByKey( $a, $b, $sKey = 'order' ) { |
|
37 | 37 | return isset( $a[ $sKey ], $b[ $sKey ] ) |
38 | 38 | ? $a[ $sKey ] - $b[ $sKey ] |
39 | 39 | : 1; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | static public function unsetDimensionalArrayElement( &$mSubject, array $aKeys ) { |
77 | 77 | |
78 | 78 | $_sKey = array_shift( $aKeys ); |
79 | - if ( ! empty( $aKeys ) ) { |
|
79 | + if ( !empty( $aKeys ) ) { |
|
80 | 80 | if ( isset( $mSubject[ $_sKey ] ) && is_array( $mSubject[ $_sKey ] ) ) { |
81 | 81 | self::unsetDimensionalArrayElement( $mSubject[ $_sKey ], $aKeys ); |
82 | 82 | } |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | static public function setMultiDimensionalArray( &$mSubject, array $aKeys, $mValue ) { |
98 | 98 | |
99 | 99 | $_sKey = array_shift( $aKeys ); |
100 | - if ( ! empty( $aKeys ) ) { |
|
101 | - if( ! isset( $mSubject[ $_sKey ] ) || ! is_array( $mSubject[ $_sKey ] ) ) { |
|
100 | + if ( !empty( $aKeys ) ) { |
|
101 | + if ( !isset( $mSubject[ $_sKey ] ) || !is_array( $mSubject[ $_sKey ] ) ) { |
|
102 | 102 | $mSubject[ $_sKey ] = array(); |
103 | 103 | } |
104 | 104 | self::setMultiDimensionalArray( $mSubject[ $_sKey ], $aKeys, $mValue ); |
@@ -152,10 +152,10 @@ discard block |
||
152 | 152 | |
153 | 153 | $_aNumeric = self::getIntegerKeyElements( $aSubject ); |
154 | 154 | $_aAssociative = self::invertCastArrayContents( $aSubject, $_aNumeric ); |
155 | - foreach( $_aNumeric as &$_aElem ) { |
|
155 | + foreach ( $_aNumeric as &$_aElem ) { |
|
156 | 156 | $_aElem = self::uniteArrays( $_aElem, $_aAssociative ); |
157 | 157 | } |
158 | - if ( ! empty( $_aAssociative ) ) { |
|
158 | + if ( !empty( $_aAssociative ) ) { |
|
159 | 159 | array_unshift( $_aNumeric, $_aAssociative ); // insert the main section to the beginning of the array. |
160 | 160 | } |
161 | 161 | return $_aNumeric; |
@@ -178,10 +178,10 @@ discard block |
||
178 | 178 | public static function castArrayContents( array $aModel, array $aSubject ) { |
179 | 179 | |
180 | 180 | $_aCast = array(); |
181 | - foreach( $aModel as $_isKey => $_v ) { |
|
181 | + foreach ( $aModel as $_isKey => $_v ) { |
|
182 | 182 | $_aCast[ $_isKey ] = self::getElement( |
183 | - $aSubject, // subject array |
|
184 | - $_isKey, // key |
|
183 | + $aSubject, // subject array |
|
184 | + $_isKey, // key |
|
185 | 185 | null // default |
186 | 186 | ); |
187 | 187 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | public static function invertCastArrayContents( array $aModel, array $aSubject ) { |
203 | 203 | |
204 | 204 | $_aInvert = array(); |
205 | - foreach( $aModel as $_isKey => $_v ) { |
|
205 | + foreach ( $aModel as $_isKey => $_v ) { |
|
206 | 206 | if ( array_key_exists( $_isKey, $aSubject ) ) { |
207 | 207 | continue; |
208 | 208 | } |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | public static function uniteArrays( /* $aPrecedence, $aArray1, $aArray2, ... */ ) { |
229 | 229 | |
230 | 230 | $_aArray = array(); |
231 | - foreach( array_reverse( func_get_args() ) as $_aArg ) { |
|
231 | + foreach ( array_reverse( func_get_args() ) as $_aArg ) { |
|
232 | 232 | $_aArray = self::uniteArraysRecursive( |
233 | 233 | self::getAsArray( $_aArg ), |
234 | 234 | $_aArray |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | $aPrecedence = array(); |
260 | 260 | } |
261 | 261 | |
262 | - if ( ! is_array( $aDefault ) || ! is_array( $aPrecedence ) ) { |
|
262 | + if ( !is_array( $aDefault ) || !is_array( $aPrecedence ) ) { |
|
263 | 263 | return $aPrecedence; |
264 | 264 | } |
265 | 265 | |
@@ -268,10 +268,10 @@ discard block |
||
268 | 268 | return $aPrecedence; |
269 | 269 | } |
270 | 270 | |
271 | - foreach( $aDefault as $sKey => $v ) { |
|
271 | + foreach ( $aDefault as $sKey => $v ) { |
|
272 | 272 | |
273 | 273 | // If the precedence does not have the key, assign the default's value. |
274 | - if ( ! array_key_exists( $sKey, $aPrecedence ) || is_null( $aPrecedence[ $sKey ] ) ) { |
|
274 | + if ( !array_key_exists( $sKey, $aPrecedence ) || is_null( $aPrecedence[ $sKey ] ) ) { |
|
275 | 275 | $aPrecedence[ $sKey ] = $v; |
276 | 276 | } else { |
277 | 277 | |
@@ -302,9 +302,9 @@ discard block |
||
302 | 302 | * - NULL |
303 | 303 | * @return array The modified array. |
304 | 304 | */ |
305 | - static public function dropElementsByType( array $aArray, $aTypes=array( 'array' ) ) { |
|
305 | + static public function dropElementsByType( array $aArray, $aTypes = array( 'array' ) ) { |
|
306 | 306 | |
307 | - foreach( $aArray as $isKey => $vValue ) { |
|
307 | + foreach ( $aArray as $isKey => $vValue ) { |
|
308 | 308 | if ( in_array( gettype( $vValue ), $aTypes ) ) { |
309 | 309 | unset( $aArray[ $isKey ] ); |
310 | 310 | } |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | */ |
321 | 321 | static public function dropElementByValue( array $aArray, $vValue ) { |
322 | 322 | |
323 | - foreach( self::getAsArray( $vValue, true ) as $_vValue ) { |
|
323 | + foreach ( self::getAsArray( $vValue, true ) as $_vValue ) { |
|
324 | 324 | $_sKey = array_search( $_vValue, $aArray, true ); |
325 | 325 | if ( $_sKey === false ) { |
326 | 326 | continue; |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | */ |
343 | 343 | static public function dropElementsByKey( array $aArray, $asKeys ) { |
344 | 344 | |
345 | - foreach( self::getAsArray( $asKeys, true ) as $_isKey ) { |
|
345 | + foreach ( self::getAsArray( $asKeys, true ) as $_isKey ) { |
|
346 | 346 | unset( $aArray[ $_isKey ] ); |
347 | 347 | } |
348 | 348 | return $aArray; |
@@ -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 | /** |
@@ -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 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @since 3.7.0 Moved from `AdminPageFramework_Utility_Array`. |
26 | 26 | */ |
27 | 27 | static public function getFirstElement( array $aArray ) { |
28 | - foreach( $aArray as $_mElement ) { |
|
28 | + foreach ( $aArray as $_mElement ) { |
|
29 | 29 | return $_mElement; |
30 | 30 | } |
31 | 31 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @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. |
45 | 45 | * @return mixed The set value or the default value. |
46 | 46 | */ |
47 | - static public function getElement( $aSubject, $aisKey, $mDefault=null, $asToDefault=array( null ) ) { |
|
47 | + static public function getElement( $aSubject, $aisKey, $mDefault = null, $asToDefault = array( null ) ) { |
|
48 | 48 | |
49 | 49 | $_aToDefault = is_null( $asToDefault ) |
50 | 50 | ? array( null ) |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @since 3.7.0 Moved from `AdminPageFramework_Utility_Array`. |
72 | 72 | * @return array The cast retrieved element value. |
73 | 73 | */ |
74 | - static public function getElementAsArray( $aSubject, $aisKey, $mDefault=null, $asToDefault=array( null ) ) { |
|
74 | + static public function getElementAsArray( $aSubject, $aisKey, $mDefault = null, $asToDefault = array( null ) ) { |
|
75 | 75 | return self::getAsArray( |
76 | 76 | self::getElement( $aSubject, $aisKey, $mDefault, $asToDefault ), |
77 | 77 | true // preserve an empty value |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | foreach ( $aParse as $_isKey => $_v ) { |
92 | 92 | |
93 | - if ( ! is_numeric( $_isKey ) ) { |
|
93 | + if ( !is_numeric( $_isKey ) ) { |
|
94 | 94 | unset( $aParse[ $_isKey ] ); |
95 | 95 | continue; |
96 | 96 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | // Convert string numeric value to integer or float. |
99 | 99 | $_isKey = $_isKey + 0; |
100 | 100 | |
101 | - if ( ! is_int( $_isKey ) ) { |
|
101 | + if ( !is_int( $_isKey ) ) { |
|
102 | 102 | unset( $aParse[ $_isKey ] ); |
103 | 103 | } |
104 | 104 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | static public function getNonIntegerKeyElements( array $aParse ) { |
118 | 118 | |
119 | 119 | foreach ( $aParse as $_isKey => $_v ) { |
120 | - if ( is_numeric( $_isKey ) && is_int( $_isKey+ 0 ) ) { |
|
120 | + if ( is_numeric( $_isKey ) && is_int( $_isKey + 0 ) ) { |
|
121 | 121 | unset( $aParse[ $_isKey ] ); |
122 | 122 | } |
123 | 123 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * @since 3.7.0 Moved from `AdminPageFramework_Utility_Array`. |
151 | 151 | * @return mixed |
152 | 152 | */ |
153 | - static public function getArrayValueByArrayKeys( $aArray, $aKeys, $vDefault=null ) { |
|
153 | + static public function getArrayValueByArrayKeys( $aArray, $aKeys, $vDefault = null ) { |
|
154 | 154 | |
155 | 155 | $_sKey = array_shift( $aKeys ); |
156 | 156 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | * @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()`. |
190 | 190 | * @return array The cast array. |
191 | 191 | */ |
192 | - static public function getAsArray( $mValue, $bPreserveEmpty=false ) { |
|
192 | + static public function getAsArray( $mValue, $bPreserveEmpty = false ) { |
|
193 | 193 | |
194 | 194 | if ( is_array( $mValue ) ) { |
195 | 195 | return $mValue; |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | * @return numeric |
26 | 26 | * @since 3.7.4 |
27 | 27 | */ |
28 | - static public function getUnusedNumericIndex( $aArray, $nIndex, $iOffset=1 ) { |
|
28 | + static public function getUnusedNumericIndex( $aArray, $nIndex, $iOffset = 1 ) { |
|
29 | 29 | |
30 | 30 | // Check if the order value is not used. |
31 | - if ( ! isset( $aArray[ $nIndex ] ) ) { |
|
31 | + if ( !isset( $aArray[ $nIndex ] ) ) { |
|
32 | 32 | return $nIndex; |
33 | 33 | } |
34 | 34 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @return boolean |
44 | 44 | */ |
45 | 45 | static public function isAssociative( array $aArray ) { |
46 | - return array_keys ( $aArray ) !== range( 0, count( $aArray ) - 1 ); |
|
46 | + return array_keys( $aArray ) !== range( 0, count( $aArray ) - 1 ); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | */ |
77 | 77 | static public function getReadableListOfArray( array $aArray ) { |
78 | 78 | |
79 | - $_aOutput = array(); |
|
80 | - foreach( $aArray as $_sKey => $_vValue ) { |
|
81 | - $_aOutput[] = self::getReadableArrayContents( $_sKey, $_vValue, 32 ) . PHP_EOL; |
|
79 | + $_aOutput = array(); |
|
80 | + foreach ( $aArray as $_sKey => $_vValue ) { |
|
81 | + $_aOutput[ ] = self::getReadableArrayContents( $_sKey, $_vValue, 32 ).PHP_EOL; |
|
82 | 82 | } |
83 | 83 | return implode( PHP_EOL, $_aOutput ); |
84 | 84 | |
@@ -89,37 +89,37 @@ discard block |
||
89 | 89 | * @since 3.3.0 |
90 | 90 | * @return string The generated human readable array contents. |
91 | 91 | */ |
92 | - static public function getReadableArrayContents( $sKey, $vValue, $sLabelCharLengths=16, $iOffset=0 ) { |
|
92 | + static public function getReadableArrayContents( $sKey, $vValue, $sLabelCharLengths = 16, $iOffset = 0 ) { |
|
93 | 93 | |
94 | 94 | $_aOutput = array(); |
95 | - $_aOutput[] = ( $iOffset |
|
96 | - ? str_pad( ' ', $iOffset ) |
|
95 | + $_aOutput[ ] = ( $iOffset |
|
96 | + ? str_pad( ' ', $iOffset ) |
|
97 | 97 | : '' |
98 | 98 | ) |
99 | 99 | . ( $sKey |
100 | - ? '[' . $sKey . ']' |
|
100 | + ? '['.$sKey.']' |
|
101 | 101 | : '' |
102 | 102 | ); |
103 | 103 | |
104 | - if ( ! in_array( gettype( $vValue ), array( 'array', 'object' ) ) ) { |
|
105 | - $_aOutput[] = $vValue; |
|
104 | + if ( !in_array( gettype( $vValue ), array( 'array', 'object' ) ) ) { |
|
105 | + $_aOutput[ ] = $vValue; |
|
106 | 106 | return implode( PHP_EOL, $_aOutput ); |
107 | 107 | } |
108 | 108 | |
109 | 109 | foreach ( $vValue as $_sTitle => $_asDescription ) { |
110 | - if ( ! in_array( gettype( $_asDescription ), array( 'array', 'object' ) ) ) { |
|
111 | - $_aOutput[] = str_pad( ' ', $iOffset ) |
|
110 | + if ( !in_array( gettype( $_asDescription ), array( 'array', 'object' ) ) ) { |
|
111 | + $_aOutput[ ] = str_pad( ' ', $iOffset ) |
|
112 | 112 | . $_sTitle |
113 | 113 | . str_pad( ':', $sLabelCharLengths - self::getStringLength( $_sTitle ) ) |
114 | 114 | . $_asDescription; |
115 | 115 | continue; |
116 | 116 | } |
117 | - $_aOutput[] = str_pad( ' ', $iOffset ) |
|
117 | + $_aOutput[ ] = str_pad( ' ', $iOffset ) |
|
118 | 118 | . $_sTitle |
119 | 119 | . ": {" |
120 | 120 | . self::getReadableArrayContents( '', $_asDescription, 16, $iOffset + 4 ) |
121 | 121 | . PHP_EOL |
122 | - . str_pad( ' ', $iOffset ) . "}"; |
|
122 | + . str_pad( ' ', $iOffset )."}"; |
|
123 | 123 | } |
124 | 124 | return implode( PHP_EOL, $_aOutput ); |
125 | 125 | |
@@ -132,11 +132,11 @@ discard block |
||
132 | 132 | */ |
133 | 133 | static public function getReadableListOfArrayAsHTML( array $aArray ) { |
134 | 134 | |
135 | - $_aOutput = array(); |
|
136 | - foreach( $aArray as $_sKey => $_vValue ) { |
|
137 | - $_aOutput[] = "<ul class='array-contents'>" |
|
135 | + $_aOutput = array(); |
|
136 | + foreach ( $aArray as $_sKey => $_vValue ) { |
|
137 | + $_aOutput[ ] = "<ul class='array-contents'>" |
|
138 | 138 | . self::getReadableArrayContentsHTML( $_sKey, $_vValue ) |
139 | - . "</ul>" . PHP_EOL; |
|
139 | + . "</ul>".PHP_EOL; |
|
140 | 140 | } |
141 | 141 | return implode( PHP_EOL, $_aOutput ); |
142 | 142 | |
@@ -153,25 +153,25 @@ discard block |
||
153 | 153 | $_aOutput = array(); |
154 | 154 | |
155 | 155 | // Title - array key |
156 | - $_aOutput[] = $sKey |
|
157 | - ? "<h3 class='array-key'>" . $sKey . "</h3>" |
|
156 | + $_aOutput[ ] = $sKey |
|
157 | + ? "<h3 class='array-key'>".$sKey."</h3>" |
|
158 | 158 | : ""; |
159 | 159 | |
160 | 160 | // If it does not have a nested array or object, |
161 | - if ( ! in_array( gettype( $vValue ), array( 'array', 'object' ) ) ) { |
|
162 | - $_aOutput[] = "<div class='array-value'>" |
|
161 | + if ( !in_array( gettype( $vValue ), array( 'array', 'object' ) ) ) { |
|
162 | + $_aOutput[ ] = "<div class='array-value'>" |
|
163 | 163 | . html_entity_decode( nl2br( str_replace( ' ', ' ', $vValue ) ), ENT_QUOTES ) |
164 | 164 | . "</div>"; |
165 | - return "<li>" . implode( PHP_EOL, $_aOutput ) . "</li>"; |
|
165 | + return "<li>".implode( PHP_EOL, $_aOutput )."</li>"; |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | // Now it is a nested item. |
169 | 169 | foreach ( $vValue as $_sKey => $_vValue ) { |
170 | - $_aOutput[] = "<ul class='array-contents'>" |
|
170 | + $_aOutput[ ] = "<ul class='array-contents'>" |
|
171 | 171 | . self::getReadableArrayContentsHTML( $_sKey, $_vValue ) |
172 | 172 | . "</ul>"; |
173 | 173 | } |
174 | - return implode( PHP_EOL, $_aOutput ) ; |
|
174 | + return implode( PHP_EOL, $_aOutput ); |
|
175 | 175 | |
176 | 176 | } |
177 | 177 |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | static public function getReadableListOfArray( array $aArray ) { |
59 | 59 | |
60 | 60 | $_aOutput = array(); |
61 | - foreach( $aArray as $_sKey => $_vValue ) { |
|
61 | + foreach( $aArray as $_sKey => $_vValue ) { |
|
62 | 62 | $_aOutput[] = self::getReadableArrayContents( $_sKey, $_vValue, 32 ) . PHP_EOL; |
63 | 63 | } |
64 | 64 | return implode( PHP_EOL, $_aOutput ); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | static public function getReadableListOfArrayAsHTML( array $aArray ) { |
115 | 115 | |
116 | 116 | $_aOutput = array(); |
117 | - foreach( $aArray as $_sKey => $_vValue ) { |
|
117 | + foreach( $aArray as $_sKey => $_vValue ) { |
|
118 | 118 | $_aOutput[] = "<ul class='array-contents'>" |
119 | 119 | . self::getReadableArrayContentsHTML( $_sKey, $_vValue ) |
120 | 120 | . "</ul>" . PHP_EOL; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | } |
148 | 148 | |
149 | 149 | // Now it is a nested item. |
150 | - foreach ( $vValue as $_sKey => $_vValue ) { |
|
150 | + foreach ( $vValue as $_sKey => $_vValue ) { |
|
151 | 151 | $_aOutput[] = "<ul class='array-contents'>" |
152 | 152 | . self::getReadableArrayContentsHTML( $_sKey, $_vValue ) |
153 | 153 | . "</ul>"; |
@@ -170,7 +170,7 @@ |
||
170 | 170 | * @since 3.5.3 |
171 | 171 | * @return string The found page slug. An empty string if not found. |
172 | 172 | * @remark Do not return `null` when not found as some framework methods check the retuened value with `isset()` and if null is given, `isset()` yields `false` while it does `true` for an emtpy string (''). |
173 | - */ |
|
173 | + */ |
|
174 | 174 | public function getCurrentPageSlug() { |
175 | 175 | return isset( $_GET[ 'page' ] ) |
176 | 176 | ? $_GET[ 'page' ] |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | /** |
58 | 58 | * Sets up hooks and properties. |
59 | 59 | */ |
60 | - public function __construct( $oCaller, $sClassName, $sCapability='manage_options', $sTextDomain='admin-page-framework', $sStructureType='page_meta_box' ) { |
|
60 | + public function __construct( $oCaller, $sClassName, $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework', $sStructureType = 'page_meta_box' ) { |
|
61 | 61 | |
62 | 62 | // Let them overload. |
63 | 63 | unset( |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | public function _getScreenIDOfPage( $sPageSlug ) { |
107 | 107 | $_oAdminPage = $this->_getOwnerObjectOfPage( $sPageSlug ); |
108 | 108 | return $_oAdminPage |
109 | - ? $_oAdminPage->oProp->aPages[ $sPageSlug ][ '_page_hook' ] . ( is_network_admin() ? '-network' : '' ) |
|
109 | + ? $_oAdminPage->oProp->aPages[ $sPageSlug ][ '_page_hook' ].( is_network_admin() ? '-network' : '' ) |
|
110 | 110 | : ''; |
111 | 111 | } |
112 | 112 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @since 3.0.0 |
117 | 117 | * @return boolean Returns true if it is of framework's added page; otherwise, false. |
118 | 118 | */ |
119 | - public function isPageAdded( $sPageSlug='' ) { |
|
119 | + public function isPageAdded( $sPageSlug = '' ) { |
|
120 | 120 | $_oAdminPage = $this->_getOwnerObjectOfPage( $sPageSlug ); |
121 | 121 | return $_oAdminPage |
122 | 122 | ? $_oAdminPage->oProp->isPageAdded( $sPageSlug ) |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | public function isCurrentTab( $sTabSlug ) { |
134 | 134 | |
135 | 135 | $_sCurrentPageSlug = $this->getElement( $_GET, 'page' ); |
136 | - if ( ! $_sCurrentPageSlug ) { |
|
136 | + if ( !$_sCurrentPageSlug ) { |
|
137 | 137 | return false; |
138 | 138 | } |
139 | 139 | $_sCurrentTabSlug = $this->getElement( |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public function getDefaultInPageTab( $sPageSlug ) { |
188 | 188 | |
189 | - if ( ! $sPageSlug ) { |
|
189 | + if ( !$sPageSlug ) { |
|
190 | 190 | return ''; |
191 | 191 | } |
192 | 192 | return ( $_oAdminPage = $this->_getOwnerObjectOfPage( $sPageSlug ) ) |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | */ |
202 | 202 | public function getOptionKey( $sPageSlug ) { |
203 | 203 | |
204 | - if ( ! $sPageSlug ) { |
|
204 | + if ( !$sPageSlug ) { |
|
205 | 205 | return ''; |
206 | 206 | } |
207 | 207 | return ( $_oAdminPage = $this->_getOwnerObjectOfPage( $sPageSlug ) ) |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | $GLOBALS, |
229 | 229 | array( 'aAdminPageFramework', 'aPageClasses' ) |
230 | 230 | ); |
231 | - foreach( $_aPageClasses as $_oAdminPage ) { |
|
231 | + foreach ( $_aPageClasses as $_oAdminPage ) { |
|
232 | 232 | if ( $_oAdminPage->oProp->isPageAdded( $sPageSlug ) ) { |
233 | 233 | return $_oAdminPage; |
234 | 234 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | /** |
58 | 58 | * Sets up hooks and properties. |
59 | 59 | */ |
60 | - public function __construct( $oCaller, $sClassName, $sCapability='manage_options', $sTextDomain='admin-page-framework', $sStructureType='page_meta_box' ) { |
|
60 | + public function __construct( $oCaller, $sClassName, $sCapability='manage_options', $sTextDomain='admin-page-framework', $sStructureType='page_meta_box' ) { |
|
61 | 61 | |
62 | 62 | // Let them overload. |
63 | 63 | unset( |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @since 3.0.0 |
117 | 117 | * @return boolean Returns true if it is of framework's added page; otherwise, false. |
118 | 118 | */ |
119 | - public function isPageAdded( $sPageSlug='' ) { |
|
119 | + public function isPageAdded( $sPageSlug='' ) { |
|
120 | 120 | $_oAdminPage = $this->_getOwnerObjectOfPage( $sPageSlug ); |
121 | 121 | return $_oAdminPage |
122 | 122 | ? $_oAdminPage->oProp->isPageAdded( $sPageSlug ) |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | public function isCurrentTab( $sTabSlug ) { |
134 | 134 | |
135 | 135 | $_sCurrentPageSlug = $this->getElement( $_GET, 'page' ); |
136 | - if ( ! $_sCurrentPageSlug ) { |
|
136 | + if ( ! $_sCurrentPageSlug ) { |
|
137 | 137 | return false; |
138 | 138 | } |
139 | 139 | $_sCurrentTabSlug = $this->getElement( |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public function getDefaultInPageTab( $sPageSlug ) { |
188 | 188 | |
189 | - if ( ! $sPageSlug ) { |
|
189 | + if ( ! $sPageSlug ) { |
|
190 | 190 | return ''; |
191 | 191 | } |
192 | 192 | return ( $_oAdminPage = $this->_getOwnerObjectOfPage( $sPageSlug ) ) |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | */ |
202 | 202 | public function getOptionKey( $sPageSlug ) { |
203 | 203 | |
204 | - if ( ! $sPageSlug ) { |
|
204 | + if ( ! $sPageSlug ) { |
|
205 | 205 | return ''; |
206 | 206 | } |
207 | 207 | return ( $_oAdminPage = $this->_getOwnerObjectOfPage( $sPageSlug ) ) |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | * @remark the $_deprecated parameter is just to avoid the PHP strict standards warning. |
31 | 31 | * @internal |
32 | 32 | */ |
33 | - public function _enqueueStyles( $aSRCs, $aCustomArgs=array(), $_deprecated=null ) { |
|
33 | + public function _enqueueStyles( $aSRCs, $aCustomArgs = array(), $_deprecated = null ) { |
|
34 | 34 | |
35 | 35 | $_aHandleIDs = array(); |
36 | - foreach( ( array ) $aSRCs as $_sSRC ) { |
|
37 | - $_aHandleIDs[] = $this->_enqueueStyle( $_sSRC, $aCustomArgs ); |
|
36 | + foreach ( ( array ) $aSRCs as $_sSRC ) { |
|
37 | + $_aHandleIDs[ ] = $this->_enqueueStyle( $_sSRC, $aCustomArgs ); |
|
38 | 38 | } |
39 | 39 | return $_aHandleIDs; |
40 | 40 | |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
59 | 59 | * @internal |
60 | 60 | */ |
61 | - public function _enqueueStyle( $sSRC, $aCustomArgs=array(), $_deprecated=null ) { |
|
61 | + public function _enqueueStyle( $sSRC, $aCustomArgs = array(), $_deprecated = null ) { |
|
62 | 62 | |
63 | - $sSRC = trim( $sSRC ); |
|
63 | + $sSRC = trim( $sSRC ); |
|
64 | 64 | if ( empty( $sSRC ) ) { |
65 | 65 | return ''; |
66 | 66 | } |
@@ -77,13 +77,13 @@ discard block |
||
77 | 77 | array( |
78 | 78 | 'sSRC' => $sSRC, |
79 | 79 | 'sType' => 'style', |
80 | - 'handle_id' => 'style_' . $this->oProp->sClassName . '_' . ( ++$this->oProp->iEnqueuedStyleIndex ), |
|
80 | + 'handle_id' => 'style_'.$this->oProp->sClassName.'_'.( ++$this->oProp->iEnqueuedStyleIndex ), |
|
81 | 81 | ), |
82 | 82 | self::$_aStructure_EnqueuingResources |
83 | 83 | ); |
84 | 84 | |
85 | 85 | // Store the attributes in another container by url. |
86 | - $this->oProp->aResourceAttributes[ $this->oProp->aEnqueuingStyles[ $_sSRCHash ]['handle_id'] ] = $this->oProp->aEnqueuingStyles[ $_sSRCHash ]['attributes']; |
|
86 | + $this->oProp->aResourceAttributes[ $this->oProp->aEnqueuingStyles[ $_sSRCHash ][ 'handle_id' ] ] = $this->oProp->aEnqueuingStyles[ $_sSRCHash ][ 'attributes' ]; |
|
87 | 87 | |
88 | 88 | return $this->oProp->aEnqueuingStyles[ $_sSRCHash ][ 'handle_id' ]; |
89 | 89 | |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | * @since 3.0.0 |
96 | 96 | * @remark the $_deprecated parameter is just to avoid the PHP strict standards warning. |
97 | 97 | */ |
98 | - public function _enqueueScripts( $aSRCs, $aCustomArgs=array(), $_deprecated=null ) { |
|
98 | + public function _enqueueScripts( $aSRCs, $aCustomArgs = array(), $_deprecated = null ) { |
|
99 | 99 | |
100 | 100 | $_aHandleIDs = array(); |
101 | - foreach( ( array ) $aSRCs as $_sSRC ) { |
|
102 | - $_aHandleIDs[] = $this->_enqueueScript( $_sSRC, $aCustomArgs ); |
|
101 | + foreach ( ( array ) $aSRCs as $_sSRC ) { |
|
102 | + $_aHandleIDs[ ] = $this->_enqueueScript( $_sSRC, $aCustomArgs ); |
|
103 | 103 | } |
104 | 104 | return $_aHandleIDs; |
105 | 105 | |
@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
125 | 125 | * @internal |
126 | 126 | */ |
127 | - public function _enqueueScript( $sSRC, $aCustomArgs=array(), $_deprecated=null ) { |
|
127 | + public function _enqueueScript( $sSRC, $aCustomArgs = array(), $_deprecated = null ) { |
|
128 | 128 | |
129 | - $sSRC = trim( $sSRC ); |
|
129 | + $sSRC = trim( $sSRC ); |
|
130 | 130 | if ( empty( $sSRC ) ) { |
131 | 131 | return ''; |
132 | 132 | } |
@@ -143,13 +143,13 @@ discard block |
||
143 | 143 | array( |
144 | 144 | 'sSRC' => $sSRC, |
145 | 145 | 'sType' => 'script', |
146 | - 'handle_id' => 'script_' . $this->oProp->sClassName . '_' . ( ++$this->oProp->iEnqueuedScriptIndex ), |
|
146 | + 'handle_id' => 'script_'.$this->oProp->sClassName.'_'.( ++$this->oProp->iEnqueuedScriptIndex ), |
|
147 | 147 | ), |
148 | 148 | self::$_aStructure_EnqueuingResources |
149 | 149 | ); |
150 | 150 | |
151 | 151 | // Store the attributes in another container by url. |
152 | - $this->oProp->aResourceAttributes[ $this->oProp->aEnqueuingScripts[ $_sSRCHash ]['handle_id'] ] = $this->oProp->aEnqueuingScripts[ $_sSRCHash ]['attributes']; |
|
152 | + $this->oProp->aResourceAttributes[ $this->oProp->aEnqueuingScripts[ $_sSRCHash ][ 'handle_id' ] ] = $this->oProp->aEnqueuingScripts[ $_sSRCHash ][ 'attributes' ]; |
|
153 | 153 | |
154 | 154 | return $this->oProp->aEnqueuingScripts[ $_sSRCHash ][ 'handle_id' ]; |
155 | 155 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * @since 3.0.0 |
162 | 162 | * @internal |
163 | 163 | */ |
164 | - public function _forceToEnqueueStyle( $sSRC, $aCustomArgs=array() ) { |
|
164 | + public function _forceToEnqueueStyle( $sSRC, $aCustomArgs = array() ) { |
|
165 | 165 | return $this->_enqueueStyle( $sSRC, $aCustomArgs ); |
166 | 166 | } |
167 | 167 | /** |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @since 3.0.0 |
171 | 171 | * @internal |
172 | 172 | */ |
173 | - public function _forceToEnqueueScript( $sSRC, $aCustomArgs=array() ) { |
|
173 | + public function _forceToEnqueueScript( $sSRC, $aCustomArgs = array() ) { |
|
174 | 174 | return $this->_enqueueScript( $sSRC, $aCustomArgs ); |
175 | 175 | } |
176 | 176 |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | public function _enqueueStyle( $sSRC, $aCustomArgs=array(), $_deprecated=null ) { |
62 | 62 | |
63 | 63 | $sSRC = trim( $sSRC ); |
64 | - if ( empty( $sSRC ) ) { |
|
64 | + if ( empty( $sSRC ) ) { |
|
65 | 65 | return ''; |
66 | 66 | } |
67 | 67 | $sSRC = $this->oUtil->getResolvedSRC( $sSRC ); |
@@ -127,14 +127,14 @@ discard block |
||
127 | 127 | public function _enqueueScript( $sSRC, $aCustomArgs=array(), $_deprecated=null ) { |
128 | 128 | |
129 | 129 | $sSRC = trim( $sSRC ); |
130 | - if ( empty( $sSRC ) ) { |
|
130 | + if ( empty( $sSRC ) ) { |
|
131 | 131 | return ''; |
132 | 132 | } |
133 | 133 | $sSRC = $this->oUtil->getResolvedSRC( $sSRC ); |
134 | 134 | |
135 | 135 | // Setting the key based on the url prevents duplicate items |
136 | 136 | $_sSRCHash = md5( $sSRC ); |
137 | - if ( isset( $this->oProp->aEnqueuingScripts[ $_sSRCHash ] ) ) { |
|
137 | + if ( isset( $this->oProp->aEnqueuingScripts[ $_sSRCHash ] ) ) { |
|
138 | 138 | return ''; |
139 | 139 | } |
140 | 140 |