@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | private $_iLevel; |
40 | 40 | |
41 | - public function __construct( $iLevel=null ) { |
|
41 | + public function __construct( $iLevel = null ) { |
|
42 | 42 | $this->_iLevel = null !== $iLevel |
43 | 43 | ? $iLeevl |
44 | 44 | : error_reporting(); |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | private function _getIncluded() { |
58 | 58 | |
59 | 59 | $_aIncluded = array(); |
60 | - foreach( $this->_aLevels as $_iLevel => $iLevelText ) { |
|
60 | + foreach ( $this->_aLevels as $_iLevel => $iLevelText ) { |
|
61 | 61 | |
62 | 62 | // This is where we check if a level was used or not |
63 | 63 | if ( $this->_iLevel & $_iLevel ) { |
64 | - $_aIncluded[] = $_iLevel; |
|
64 | + $_aIncluded[ ] = $_iLevel; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | } |
@@ -75,16 +75,16 @@ discard block |
||
75 | 75 | $_aValues = array(); |
76 | 76 | |
77 | 77 | if ( count( $aIncluded ) > $_iAll / 2 ) { |
78 | - $_aValues[] = 'E_ALL'; |
|
79 | - foreach( $this->_aLevels as $_iLevel => $iLevelText ) { |
|
80 | - if ( ! in_array( $_iLevel, $aIncluded ) ) { |
|
81 | - $_aValues[] = $iLevelText; |
|
78 | + $_aValues[ ] = 'E_ALL'; |
|
79 | + foreach ( $this->_aLevels as $_iLevel => $iLevelText ) { |
|
80 | + if ( !in_array( $_iLevel, $aIncluded ) ) { |
|
81 | + $_aValues[ ] = $iLevelText; |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | return implode( ' & ~', $_aValues ); |
85 | 85 | } |
86 | - foreach( $aIncluded as $_iLevel ) { |
|
87 | - $_aValues[] = $this->_aLevels[ $_iLevel ]; |
|
86 | + foreach ( $aIncluded as $_iLevel ) { |
|
87 | + $_aValues[ ] = $this->_aLevels[ $_iLevel ]; |
|
88 | 88 | } |
89 | 89 | return implode( ' | ', $_aValues ); |
90 | 90 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | public $sNotice = ''; |
30 | 30 | public $aAttributes = array(); |
31 | 31 | public $aCallbacks = array( |
32 | - 'should_show' => null, // detemines whether the admin notice should be displayed. |
|
32 | + 'should_show' => null, // detemines whether the admin notice should be displayed. |
|
33 | 33 | ); |
34 | 34 | |
35 | 35 | /** |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @param array $aCallbacks DEVVER+ Stores callbacks. |
41 | 41 | * @since 3.5.0 |
42 | 42 | */ |
43 | - public function __construct( $sNotice, array $aAttributes=array( 'class' => 'error' ), array $aCallbacks=array() ) { |
|
43 | + public function __construct( $sNotice, array $aAttributes = array( 'class' => 'error' ), array $aCallbacks = array() ) { |
|
44 | 44 | |
45 | 45 | $this->sNotice = $sNotice; |
46 | 46 | $this->aAttributes = $aAttributes + array( |
@@ -49,16 +49,16 @@ discard block |
||
49 | 49 | $this->aAttributes[ 'class' ] = $this->getClassAttribute( |
50 | 50 | $this->aAttributes[ 'class' ], |
51 | 51 | 'admin-page-framework-settings-notice-message', |
52 | - 'admin-page-framework-settings-notice-container', // Moved from `AdminPageFramework_Factory_View`. |
|
52 | + 'admin-page-framework-settings-notice-container', // Moved from `AdminPageFramework_Factory_View`. |
|
53 | 53 | 'notice', |
54 | 54 | 'is-dismissible' // 3.5.12+ |
55 | 55 | ); |
56 | - $this->aCallbacks = $aCallbacks + $this->aCallbacks; |
|
56 | + $this->aCallbacks = $aCallbacks + $this->aCallbacks; |
|
57 | 57 | |
58 | 58 | $this->_loadResources(); |
59 | 59 | |
60 | 60 | // An empty value may be set in oreder only to laode the fade-in script. |
61 | - if ( ! $this->sNotice ) { |
|
61 | + if ( !$this->sNotice ) { |
|
62 | 62 | return; |
63 | 63 | } |
64 | 64 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * Sets up scripts. |
73 | 73 | * @since DEVVER |
74 | 74 | */ |
75 | - private function _loadResources(){ |
|
75 | + private function _loadResources() { |
|
76 | 76 | |
77 | 77 | // Make sure to load once per page load. |
78 | 78 | if ( self::$_bLoaded ) { |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function _replyToDisplayAdminNotice() { |
93 | 93 | |
94 | - if ( ! $this->_shouldProceed() ) { |
|
94 | + if ( !$this->_shouldProceed() ) { |
|
95 | 95 | return; |
96 | 96 | } |
97 | 97 | |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | 'display: none' |
103 | 103 | ); |
104 | 104 | |
105 | - echo "<div " . $this->getAttributes( $_aAttributes ) . ">" |
|
105 | + echo "<div ".$this->getAttributes( $_aAttributes ).">" |
|
106 | 106 | . "<p>" |
107 | 107 | . $this->sNotice |
108 | 108 | . "</p>" |
109 | 109 | . "</div>" |
110 | 110 | // Insert the same message except it is not hidden. |
111 | 111 | . "<noscript>" |
112 | - . "<div " . $this->getAttributes( $this->aAttributes ) . ">" |
|
112 | + . "<div ".$this->getAttributes( $this->aAttributes ).">" |
|
113 | 113 | . "<p>" |
114 | 114 | . $this->sNotice |
115 | 115 | . "</p>" |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | */ |
124 | 124 | private function _shouldProceed() { |
125 | 125 | |
126 | - if ( ! is_callable( $this->aCallbacks[ 'should_show' ] ) ) { |
|
126 | + if ( !is_callable( $this->aCallbacks[ 'should_show' ] ) ) { |
|
127 | 127 | return true; |
128 | 128 | } |
129 | 129 | return call_user_func_array( |
@@ -72,7 +72,7 @@ |
||
72 | 72 | * Sets up scripts. |
73 | 73 | * @since DEVVER |
74 | 74 | */ |
75 | - private function _loadResources(){ |
|
75 | + private function _loadResources() { |
|
76 | 76 | |
77 | 77 | // Make sure to load once per page load. |
78 | 78 | if ( self::$_bLoaded ) { |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @since 3.6.3 |
24 | 24 | * @return string The captured output buffer. |
25 | 25 | */ |
26 | - static public function getOutputBuffer( $oCallable, array $aParameters=array() ) { |
|
26 | + static public function getOutputBuffer( $oCallable, array $aParameters = array() ) { |
|
27 | 27 | |
28 | 28 | ob_start(); |
29 | 29 | echo call_user_func_array( $oCallable, $aParameters ); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @return integer |
48 | 48 | * @internal |
49 | 49 | */ |
50 | - static public function sortArrayByKey( $a, $b, $sKey='order' ) { |
|
50 | + static public function sortArrayByKey( $a, $b, $sKey = 'order' ) { |
|
51 | 51 | return isset( $a[ $sKey ], $b[ $sKey ] ) |
52 | 52 | ? $a[ $sKey ] - $b[ $sKey ] |
53 | 53 | : 1; |
@@ -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 | |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | * @since 3.1.1 |
79 | 79 | * @return string |
80 | 80 | */ |
81 | - static public function sanitizeLength( $sLength, $sUnit='px' ) { |
|
81 | + static public function sanitizeLength( $sLength, $sUnit = 'px' ) { |
|
82 | 82 | return is_numeric( $sLength ) |
83 | - ? $sLength . $sUnit |
|
83 | + ? $sLength.$sUnit |
|
84 | 84 | : $sLength; |
85 | 85 | } |
86 | 86 | |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | */ |
105 | 105 | static public function getInlineCSS( array $aCSSRules ) { |
106 | 106 | $_aOutput = array(); |
107 | - foreach( $aCSSRules as $_sProperty => $_sValue ) { |
|
108 | - $_aOutput[] = $_sProperty . ': ' . $_sValue; |
|
107 | + foreach ( $aCSSRules as $_sProperty => $_sValue ) { |
|
108 | + $_aOutput[ ] = $_sProperty.': '.$_sValue; |
|
109 | 109 | } |
110 | 110 | return implode( '; ', $_aOutput ); |
111 | 111 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | static public function getStyleAttribute( $asInlineCSSes ) { |
137 | 137 | |
138 | 138 | $_aCSSRules = array(); |
139 | - foreach( array_reverse( func_get_args() ) as $_asCSSRules ) { |
|
139 | + foreach ( array_reverse( func_get_args() ) as $_asCSSRules ) { |
|
140 | 140 | |
141 | 141 | // For array, store in the container. |
142 | 142 | if ( is_array( $_asCSSRules ) ) { |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | |
147 | 147 | // At this point, it is a string. Break them down to array elements. |
148 | 148 | $__aCSSRules = explode( ';', $_asCSSRules ); |
149 | - foreach( $__aCSSRules as $_sPair ) { |
|
149 | + foreach ( $__aCSSRules as $_sPair ) { |
|
150 | 150 | $_aCSSPair = explode( ':', $_sPair ); |
151 | - if ( ! isset( $_aCSSPair[ 0 ], $_aCSSPair[ 1 ] ) ) { |
|
151 | + if ( !isset( $_aCSSPair[ 0 ], $_aCSSPair[ 1 ] ) ) { |
|
152 | 152 | continue; |
153 | 153 | } |
154 | 154 | $_aCSSRules[ $_aCSSPair[ 0 ] ] = $_aCSSPair[ 1 ]; |
@@ -185,9 +185,9 @@ discard block |
||
185 | 185 | */ |
186 | 186 | static public function getClassAttribute( /* $asClassSelectors1, $asClassSelectors12, ... */ ) { |
187 | 187 | |
188 | - $_aClasses = array(); |
|
189 | - foreach( func_get_args() as $_asClasses ) { |
|
190 | - if ( ! in_array( gettype( $_asClasses ), array( 'array', 'string' ) ) ) { |
|
188 | + $_aClasses = array(); |
|
189 | + foreach ( func_get_args() as $_asClasses ) { |
|
190 | + if ( !in_array( gettype( $_asClasses ), array( 'array', 'string' ) ) ) { |
|
191 | 191 | continue; |
192 | 192 | } |
193 | 193 | $_aClasses = array_merge( |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | : explode( ' ', $_asClasses ) |
198 | 198 | ); |
199 | 199 | } |
200 | - $_aClasses = array_unique( array_filter( $_aClasses ) ); |
|
200 | + $_aClasses = array_unique( array_filter( $_aClasses ) ); |
|
201 | 201 | |
202 | 202 | // @todo examine if it is okay to remove the trim() function below. |
203 | 203 | return trim( implode( ' ', $_aClasses ) ); |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | static public function generateClassAttribute( /* $asClassSelectors1, $asClassSelectors12 ... */ ) { |
214 | 214 | $_aParams = func_get_args(); |
215 | 215 | return call_user_func_array( |
216 | - array( __CLASS__ , 'getClassAttribute' ), |
|
216 | + array( __CLASS__, 'getClassAttribute' ), |
|
217 | 217 | $_aParams |
218 | 218 | ); |
219 | 219 | } |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | static public function getDataAttributeArray( array $aArray ) { |
228 | 228 | |
229 | 229 | $_aNewArray = array(); |
230 | - foreach( $aArray as $sKey => $v ) { |
|
230 | + foreach ( $aArray as $sKey => $v ) { |
|
231 | 231 | if ( in_array( gettype( $v ), array( 'array', 'object' ) ) ) { |
232 | 232 | continue; |
233 | 233 | } |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * @param boolean|integer|double|string|array|object|resource|NULL $mTrue The value to return when the first parameter value yields false. |
250 | 250 | * @return mixed |
251 | 251 | */ |
252 | - static public function getAOrB( $mValue, $mTrue=null, $mFalse=null ) { |
|
252 | + static public function getAOrB( $mValue, $mTrue = null, $mFalse = null ) { |
|
253 | 253 | return $mValue ? $mTrue : $mFalse; |
254 | 254 | } |
255 | 255 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * @return boolean |
25 | 25 | */ |
26 | 26 | static public function isAssociative( array $aArray ) { |
27 | - return array_keys ( $aArray ) !== range( 0, count( $aArray ) - 1 ); |
|
27 | + return array_keys( $aArray ) !== range( 0, count( $aArray ) - 1 ); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @since 3.6.0 |
33 | 33 | */ |
34 | 34 | static public function getFirstElement( array $aArray ) { |
35 | - foreach( $aArray as $_mElement ) { |
|
35 | + foreach ( $aArray as $_mElement ) { |
|
36 | 36 | return $_mElement; |
37 | 37 | } |
38 | 38 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * @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. |
51 | 51 | * @return mixed The set value or the default value. |
52 | 52 | */ |
53 | - static public function getElement( $aSubject, $aisKey, $mDefault=null, $asToDefault=array( null ) ) { |
|
53 | + static public function getElement( $aSubject, $aisKey, $mDefault = null, $asToDefault = array( null ) ) { |
|
54 | 54 | |
55 | 55 | $_aToDefault = is_null( $asToDefault ) |
56 | 56 | ? array( null ) |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @since 3.5.3 The second parameter accepts dimensional array keys and added the fourth parameter. |
77 | 77 | * @return array The cast retrieved element value. |
78 | 78 | */ |
79 | - static public function getElementAsArray( $aSubject, $aisKey, $mDefault=null, $asToDefault=array( null ) ) { |
|
79 | + static public function getElementAsArray( $aSubject, $aisKey, $mDefault = null, $asToDefault = array( null ) ) { |
|
80 | 80 | return self::getAsArray( |
81 | 81 | self::getElement( $aSubject, $aisKey, $mDefault, $asToDefault ), |
82 | 82 | true // preserve an empty value |
@@ -98,10 +98,10 @@ discard block |
||
98 | 98 | public static function castArrayContents( array $aModel, array $aSubject ) { |
99 | 99 | |
100 | 100 | $_aCast = array(); |
101 | - foreach( $aModel as $_isKey => $_v ) { |
|
101 | + foreach ( $aModel as $_isKey => $_v ) { |
|
102 | 102 | $_aCast[ $_isKey ] = self::getElement( |
103 | - $aSubject, // subject array |
|
104 | - $_isKey, // key |
|
103 | + $aSubject, // subject array |
|
104 | + $_isKey, // key |
|
105 | 105 | null // default |
106 | 106 | ); |
107 | 107 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | public static function invertCastArrayContents( array $aModel, array $aSubject ) { |
122 | 122 | |
123 | 123 | $_aInvert = array(); |
124 | - foreach( $aModel as $_isKey => $_v ) { |
|
124 | + foreach ( $aModel as $_isKey => $_v ) { |
|
125 | 125 | if ( array_key_exists( $_isKey, $aSubject ) ) { |
126 | 126 | continue; |
127 | 127 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | public static function uniteArrays( /* $aPrecedence, $aArray1, $aArray2, ... */ ) { |
147 | 147 | |
148 | 148 | $_aArray = array(); |
149 | - foreach( array_reverse( func_get_args() ) as $_aArg ) { |
|
149 | + foreach ( array_reverse( func_get_args() ) as $_aArg ) { |
|
150 | 150 | $_aArray = self::uniteArraysRecursive( |
151 | 151 | self::getAsArray( $_aArg ), |
152 | 152 | $_aArray |
@@ -176,14 +176,14 @@ discard block |
||
176 | 176 | $aPrecedence = array(); |
177 | 177 | } |
178 | 178 | |
179 | - if ( ! is_array( $aDefault ) || ! is_array( $aPrecedence ) ) { |
|
179 | + if ( !is_array( $aDefault ) || !is_array( $aPrecedence ) ) { |
|
180 | 180 | return $aPrecedence; |
181 | 181 | } |
182 | 182 | |
183 | - foreach( $aDefault as $sKey => $v ) { |
|
183 | + foreach ( $aDefault as $sKey => $v ) { |
|
184 | 184 | |
185 | 185 | // If the precedence does not have the key, assign the default's value. |
186 | - if ( ! array_key_exists( $sKey, $aPrecedence ) || is_null( $aPrecedence[ $sKey ] ) ) { |
|
186 | + if ( !array_key_exists( $sKey, $aPrecedence ) || is_null( $aPrecedence[ $sKey ] ) ) { |
|
187 | 187 | $aPrecedence[ $sKey ] = $v; |
188 | 188 | } else { |
189 | 189 | |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | |
230 | 230 | foreach ( $aParse as $_isKey => $_v ) { |
231 | 231 | |
232 | - if ( ! is_numeric( $_isKey ) ) { |
|
232 | + if ( !is_numeric( $_isKey ) ) { |
|
233 | 233 | unset( $aParse[ $_isKey ] ); |
234 | 234 | continue; |
235 | 235 | } |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | // Convert string numeric value to integer or float. |
238 | 238 | $_isKey = $_isKey + 0; |
239 | 239 | |
240 | - if ( ! is_int( $_isKey ) ) { |
|
240 | + if ( !is_int( $_isKey ) ) { |
|
241 | 241 | unset( $aParse[ $_isKey ] ); |
242 | 242 | } |
243 | 243 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | static public function getNonIntegerKeyElements( array $aParse ) { |
256 | 256 | |
257 | 257 | foreach ( $aParse as $_isKey => $_v ) { |
258 | - if ( is_numeric( $_isKey ) && is_int( $_isKey+ 0 ) ) { |
|
258 | + if ( is_numeric( $_isKey ) && is_int( $_isKey + 0 ) ) { |
|
259 | 259 | unset( $aParse[ $_isKey ] ); |
260 | 260 | } |
261 | 261 | } |
@@ -305,10 +305,10 @@ discard block |
||
305 | 305 | |
306 | 306 | $_aNumeric = self::getIntegerKeyElements( $aSubject ); |
307 | 307 | $_aAssociative = self::invertCastArrayContents( $aSubject, $_aNumeric ); |
308 | - foreach( $_aNumeric as &$_aElem ) { |
|
308 | + foreach ( $_aNumeric as &$_aElem ) { |
|
309 | 309 | $_aElem = self::uniteArrays( $_aElem, $_aAssociative ); |
310 | 310 | } |
311 | - if ( ! empty( $_aAssociative ) ) { |
|
311 | + if ( !empty( $_aAssociative ) ) { |
|
312 | 312 | array_unshift( $_aNumeric, $_aAssociative ); // insert the main section to the beginning of the array. |
313 | 313 | } |
314 | 314 | return $_aNumeric; |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | * @since 3.0.1 |
340 | 340 | * @return mixed |
341 | 341 | */ |
342 | - static public function getArrayValueByArrayKeys( $aArray, $aKeys, $vDefault=null ) { |
|
342 | + static public function getArrayValueByArrayKeys( $aArray, $aKeys, $vDefault = null ) { |
|
343 | 343 | |
344 | 344 | $_sKey = array_shift( $aKeys ); |
345 | 345 | |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | static public function unsetDimensionalArrayElement( &$mSubject, array $aKeys ) { |
404 | 404 | |
405 | 405 | $_sKey = array_shift( $aKeys ); |
406 | - if ( ! empty( $aKeys ) ) { |
|
406 | + if ( !empty( $aKeys ) ) { |
|
407 | 407 | if ( isset( $mSubject[ $_sKey ] ) && is_array( $mSubject[ $_sKey ] ) ) { |
408 | 408 | self::unsetDimensionalArrayElement( $mSubject[ $_sKey ], $aKeys ); |
409 | 409 | } |
@@ -423,8 +423,8 @@ discard block |
||
423 | 423 | static public function setMultiDimensionalArray( &$mSubject, array $aKeys, $mValue ) { |
424 | 424 | |
425 | 425 | $_sKey = array_shift( $aKeys ); |
426 | - if ( ! empty( $aKeys ) ) { |
|
427 | - if( ! isset( $mSubject[ $_sKey ] ) || ! is_array( $mSubject[ $_sKey ] ) ) { |
|
426 | + if ( !empty( $aKeys ) ) { |
|
427 | + if ( !isset( $mSubject[ $_sKey ] ) || !is_array( $mSubject[ $_sKey ] ) ) { |
|
428 | 428 | $mSubject[ $_sKey ] = array(); |
429 | 429 | } |
430 | 430 | self::setMultiDimensionalArray( $mSubject[ $_sKey ], $aKeys, $mValue ); |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | * @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()`. |
446 | 446 | * @return array The cast array. |
447 | 447 | */ |
448 | - static public function getAsArray( $mValue, $bPreserveEmpty=false ) { |
|
448 | + static public function getAsArray( $mValue, $bPreserveEmpty = false ) { |
|
449 | 449 | |
450 | 450 | if ( is_array( $mValue ) ) { |
451 | 451 | return $mValue; |
@@ -472,9 +472,9 @@ discard block |
||
472 | 472 | */ |
473 | 473 | static public function getReadableListOfArray( array $aArray ) { |
474 | 474 | |
475 | - $_aOutput = array(); |
|
476 | - foreach( $aArray as $_sKey => $_vValue ) { |
|
477 | - $_aOutput[] = self::getReadableArrayContents( $_sKey, $_vValue, 32 ) . PHP_EOL; |
|
475 | + $_aOutput = array(); |
|
476 | + foreach ( $aArray as $_sKey => $_vValue ) { |
|
477 | + $_aOutput[ ] = self::getReadableArrayContents( $_sKey, $_vValue, 32 ).PHP_EOL; |
|
478 | 478 | } |
479 | 479 | return implode( PHP_EOL, $_aOutput ); |
480 | 480 | |
@@ -485,37 +485,37 @@ discard block |
||
485 | 485 | * @since 3.3.0 |
486 | 486 | * @return string The generated human readable array contents. |
487 | 487 | */ |
488 | - static public function getReadableArrayContents( $sKey, $vValue, $sLabelCharLengths=16, $iOffset=0 ) { |
|
488 | + static public function getReadableArrayContents( $sKey, $vValue, $sLabelCharLengths = 16, $iOffset = 0 ) { |
|
489 | 489 | |
490 | 490 | $_aOutput = array(); |
491 | - $_aOutput[] = ( $iOffset |
|
492 | - ? str_pad( ' ', $iOffset ) |
|
491 | + $_aOutput[ ] = ( $iOffset |
|
492 | + ? str_pad( ' ', $iOffset ) |
|
493 | 493 | : '' |
494 | 494 | ) |
495 | 495 | . ( $sKey |
496 | - ? '[' . $sKey . ']' |
|
496 | + ? '['.$sKey.']' |
|
497 | 497 | : '' |
498 | 498 | ); |
499 | 499 | |
500 | - if ( ! in_array( gettype( $vValue ), array( 'array', 'object' ) ) ) { |
|
501 | - $_aOutput[] = $vValue; |
|
500 | + if ( !in_array( gettype( $vValue ), array( 'array', 'object' ) ) ) { |
|
501 | + $_aOutput[ ] = $vValue; |
|
502 | 502 | return implode( PHP_EOL, $_aOutput ); |
503 | 503 | } |
504 | 504 | |
505 | 505 | foreach ( $vValue as $_sTitle => $_asDescription ) { |
506 | - if ( ! in_array( gettype( $_asDescription ), array( 'array', 'object' ) ) ) { |
|
507 | - $_aOutput[] = str_pad( ' ', $iOffset ) |
|
506 | + if ( !in_array( gettype( $_asDescription ), array( 'array', 'object' ) ) ) { |
|
507 | + $_aOutput[ ] = str_pad( ' ', $iOffset ) |
|
508 | 508 | . $_sTitle |
509 | 509 | . str_pad( ':', $sLabelCharLengths - self::getStringLength( $_sTitle ) ) |
510 | 510 | . $_asDescription; |
511 | 511 | continue; |
512 | 512 | } |
513 | - $_aOutput[] = str_pad( ' ', $iOffset ) |
|
513 | + $_aOutput[ ] = str_pad( ' ', $iOffset ) |
|
514 | 514 | . $_sTitle |
515 | 515 | . ": {" |
516 | 516 | . self::getReadableArrayContents( '', $_asDescription, 16, $iOffset + 4 ) |
517 | 517 | . PHP_EOL |
518 | - . str_pad( ' ', $iOffset ) . "}"; |
|
518 | + . str_pad( ' ', $iOffset )."}"; |
|
519 | 519 | } |
520 | 520 | return implode( PHP_EOL, $_aOutput ); |
521 | 521 | |
@@ -528,11 +528,11 @@ discard block |
||
528 | 528 | */ |
529 | 529 | static public function getReadableListOfArrayAsHTML( array $aArray ) { |
530 | 530 | |
531 | - $_aOutput = array(); |
|
532 | - foreach( $aArray as $_sKey => $_vValue ) { |
|
533 | - $_aOutput[] = "<ul class='array-contents'>" |
|
531 | + $_aOutput = array(); |
|
532 | + foreach ( $aArray as $_sKey => $_vValue ) { |
|
533 | + $_aOutput[ ] = "<ul class='array-contents'>" |
|
534 | 534 | . self::getReadableArrayContentsHTML( $_sKey, $_vValue ) |
535 | - . "</ul>" . PHP_EOL; |
|
535 | + . "</ul>".PHP_EOL; |
|
536 | 536 | } |
537 | 537 | return implode( PHP_EOL, $_aOutput ); |
538 | 538 | |
@@ -549,25 +549,25 @@ discard block |
||
549 | 549 | $_aOutput = array(); |
550 | 550 | |
551 | 551 | // Title - array key |
552 | - $_aOutput[] = $sKey |
|
553 | - ? "<h3 class='array-key'>" . $sKey . "</h3>" |
|
552 | + $_aOutput[ ] = $sKey |
|
553 | + ? "<h3 class='array-key'>".$sKey."</h3>" |
|
554 | 554 | : ""; |
555 | 555 | |
556 | 556 | // If it does not have a nested array or object, |
557 | - if ( ! in_array( gettype( $vValue ), array( 'array', 'object' ) ) ) { |
|
558 | - $_aOutput[] = "<div class='array-value'>" |
|
557 | + if ( !in_array( gettype( $vValue ), array( 'array', 'object' ) ) ) { |
|
558 | + $_aOutput[ ] = "<div class='array-value'>" |
|
559 | 559 | . html_entity_decode( nl2br( str_replace( ' ', ' ', $vValue ) ), ENT_QUOTES ) |
560 | 560 | . "</div>"; |
561 | - return "<li>" . implode( PHP_EOL, $_aOutput ) . "</li>"; |
|
561 | + return "<li>".implode( PHP_EOL, $_aOutput )."</li>"; |
|
562 | 562 | } |
563 | 563 | |
564 | 564 | // Now it is a nested item. |
565 | 565 | foreach ( $vValue as $_sKey => $_vValue ) { |
566 | - $_aOutput[] = "<ul class='array-contents'>" |
|
566 | + $_aOutput[ ] = "<ul class='array-contents'>" |
|
567 | 567 | . self::getReadableArrayContentsHTML( $_sKey, $_vValue ) |
568 | 568 | . "</ul>"; |
569 | 569 | } |
570 | - return implode( PHP_EOL, $_aOutput ) ; |
|
570 | + return implode( PHP_EOL, $_aOutput ); |
|
571 | 571 | |
572 | 572 | } |
573 | 573 | |
@@ -587,9 +587,9 @@ discard block |
||
587 | 587 | * - NULL |
588 | 588 | * @return array The modified array. |
589 | 589 | */ |
590 | - static public function dropElementsByType( array $aArray, $aTypes=array( 'array' ) ) { |
|
590 | + static public function dropElementsByType( array $aArray, $aTypes = array( 'array' ) ) { |
|
591 | 591 | |
592 | - foreach( $aArray as $isKey => $vValue ) { |
|
592 | + foreach ( $aArray as $isKey => $vValue ) { |
|
593 | 593 | if ( in_array( gettype( $vValue ), $aTypes ) ) { |
594 | 594 | unset( $aArray[ $isKey ] ); |
595 | 595 | } |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | */ |
605 | 605 | static public function dropElementByValue( array $aArray, $vValue ) { |
606 | 606 | |
607 | - foreach( self::getAsArray( $vValue, true ) as $_vValue ) { |
|
607 | + foreach ( self::getAsArray( $vValue, true ) as $_vValue ) { |
|
608 | 608 | $_sKey = array_search( $_vValue, $aArray, true ); |
609 | 609 | if ( $_sKey === false ) { |
610 | 610 | continue; |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | */ |
626 | 626 | static public function dropElementsByKey( array $aArray, $asKeys ) { |
627 | 627 | |
628 | - foreach( self::getAsArray( $asKeys, true ) as $_isKey ) { |
|
628 | + foreach ( self::getAsArray( $asKeys, true ) as $_isKey ) { |
|
629 | 629 | unset( $aArray[ $_isKey ] ); |
630 | 630 | } |
631 | 631 | return $aArray; |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | $_aInvert = array(); |
124 | 124 | foreach( $aModel as $_isKey => $_v ) { |
125 | - if ( array_key_exists( $_isKey, $aSubject ) ) { |
|
125 | + if ( array_key_exists( $_isKey, $aSubject ) ) { |
|
126 | 126 | continue; |
127 | 127 | } |
128 | 128 | $_aInvert[ $_isKey ] = $_v; |
@@ -172,11 +172,11 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public static function uniteArraysRecursive( $aPrecedence, $aDefault ) { |
174 | 174 | |
175 | - if ( is_null( $aPrecedence ) ) { |
|
175 | + if ( is_null( $aPrecedence ) ) { |
|
176 | 176 | $aPrecedence = array(); |
177 | 177 | } |
178 | 178 | |
179 | - if ( ! is_array( $aDefault ) || ! is_array( $aPrecedence ) ) { |
|
179 | + if ( ! is_array( $aDefault ) || ! is_array( $aPrecedence ) ) { |
|
180 | 180 | return $aPrecedence; |
181 | 181 | } |
182 | 182 | |
@@ -346,7 +346,8 @@ discard block |
||
346 | 346 | // array_key_exists( $_sKey, $aArray ) caused warnings in some occasions |
347 | 347 | if ( isset( $aArray[ $_sKey ] ) ) { |
348 | 348 | |
349 | - if ( empty( $aKeys ) ) { // no more keys |
|
349 | + if ( empty( $aKeys ) ) { |
|
350 | +// no more keys |
|
350 | 351 | return $aArray[ $_sKey ]; |
351 | 352 | } |
352 | 353 | |
@@ -473,7 +474,7 @@ discard block |
||
473 | 474 | static public function getReadableListOfArray( array $aArray ) { |
474 | 475 | |
475 | 476 | $_aOutput = array(); |
476 | - foreach( $aArray as $_sKey => $_vValue ) { |
|
477 | + foreach( $aArray as $_sKey => $_vValue ) { |
|
477 | 478 | $_aOutput[] = self::getReadableArrayContents( $_sKey, $_vValue, 32 ) . PHP_EOL; |
478 | 479 | } |
479 | 480 | return implode( PHP_EOL, $_aOutput ); |
@@ -529,7 +530,7 @@ discard block |
||
529 | 530 | static public function getReadableListOfArrayAsHTML( array $aArray ) { |
530 | 531 | |
531 | 532 | $_aOutput = array(); |
532 | - foreach( $aArray as $_sKey => $_vValue ) { |
|
533 | + foreach( $aArray as $_sKey => $_vValue ) { |
|
533 | 534 | $_aOutput[] = "<ul class='array-contents'>" |
534 | 535 | . self::getReadableArrayContentsHTML( $_sKey, $_vValue ) |
535 | 536 | . "</ul>" . PHP_EOL; |
@@ -562,7 +563,7 @@ discard block |
||
562 | 563 | } |
563 | 564 | |
564 | 565 | // Now it is a nested item. |
565 | - foreach ( $vValue as $_sKey => $_vValue ) { |
|
566 | + foreach ( $vValue as $_sKey => $_vValue ) { |
|
566 | 567 | $_aOutput[] = "<ul class='array-contents'>" |
567 | 568 | . self::getReadableArrayContentsHTML( $_sKey, $_vValue ) |
568 | 569 | . "</ul>"; |
@@ -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 -_~,;:[](). |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | static public function getRelativePath( $from, $to ) { |
32 | 32 | |
33 | 33 | // some compatibility fixes for Windows paths |
34 | - $from = is_dir( $from ) ? rtrim( $from, '\/') . '/' : $from; |
|
35 | - $to = is_dir( $to ) ? rtrim( $to, '\/') . '/' : $to; |
|
34 | + $from = is_dir( $from ) ? rtrim( $from, '\/' ).'/' : $from; |
|
35 | + $to = is_dir( $to ) ? rtrim( $to, '\/' ).'/' : $to; |
|
36 | 36 | $from = str_replace( '\\', '/', $from ); |
37 | 37 | $to = str_replace( '\\', '/', $to ); |
38 | 38 | |
@@ -40,21 +40,21 @@ discard block |
||
40 | 40 | $to = explode( '/', $to ); |
41 | 41 | $relPath = $to; |
42 | 42 | |
43 | - foreach( $from as $depth => $dir ) { |
|
43 | + foreach ( $from as $depth => $dir ) { |
|
44 | 44 | // find first non-matching dir |
45 | - if( $dir === $to[ $depth ] ) { |
|
45 | + if ( $dir === $to[ $depth ] ) { |
|
46 | 46 | // ignore this directory |
47 | 47 | array_shift( $relPath ); |
48 | 48 | } else { |
49 | 49 | // get number of remaining dirs to $from |
50 | 50 | $remaining = count( $from ) - $depth; |
51 | - if( $remaining > 1 ) { |
|
51 | + if ( $remaining > 1 ) { |
|
52 | 52 | // add traversals up to first matching dir |
53 | 53 | $padLength = ( count( $relPath ) + $remaining - 1 ) * -1; |
54 | 54 | $relPath = array_pad( $relPath, $padLength, '..' ); |
55 | 55 | break; |
56 | 56 | } else { |
57 | - $relPath[ 0 ] = './' . $relPath[ 0 ]; |
|
57 | + $relPath[ 0 ] = './'.$relPath[ 0 ]; |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | } |
@@ -68,13 +68,13 @@ discard block |
||
68 | 68 | * @since 3.0.0 |
69 | 69 | * @return string |
70 | 70 | */ |
71 | - static public function getCallerScriptPath( $asRedirectedFiles=array( __FILE__ ) ) { |
|
71 | + static public function getCallerScriptPath( $asRedirectedFiles = array( __FILE__ ) ) { |
|
72 | 72 | |
73 | 73 | $aRedirectedFiles = ( array ) $asRedirectedFiles; |
74 | - $aRedirectedFiles[] = __FILE__; |
|
74 | + $aRedirectedFiles[ ] = __FILE__; |
|
75 | 75 | $_sCallerFilePath = ''; |
76 | - foreach( debug_backtrace() as $aDebugInfo ) { |
|
77 | - $_sCallerFilePath = $aDebugInfo['file']; |
|
76 | + foreach ( debug_backtrace() as $aDebugInfo ) { |
|
77 | + $_sCallerFilePath = $aDebugInfo[ 'file' ]; |
|
78 | 78 | if ( in_array( $_sCallerFilePath, $aRedirectedFiles ) ) { continue; } |
79 | 79 | break; // catch the first found item. |
80 | 80 | } |
@@ -73,7 +73,7 @@ |
||
73 | 73 | $aRedirectedFiles = ( array ) $asRedirectedFiles; |
74 | 74 | $aRedirectedFiles[] = __FILE__; |
75 | 75 | $_sCallerFilePath = ''; |
76 | - foreach( debug_backtrace() as $aDebugInfo ) { |
|
76 | + foreach( debug_backtrace() as $aDebugInfo ) { |
|
77 | 77 | $_sCallerFilePath = $aDebugInfo['file']; |
78 | 78 | if ( in_array( $_sCallerFilePath, $aRedirectedFiles ) ) { continue; } |
79 | 79 | break; // catch the first found item. |
@@ -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 | /** |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @since 3.6.2 Supported a text content to be passed to the first parameter. |
29 | 29 | * @access public |
30 | 30 | */ |
31 | - static public function getScriptData( $sPathOrContent, $sType='plugin', $aDefaultHeaderKeys=array() ) { |
|
31 | + static public function getScriptData( $sPathOrContent, $sType = 'plugin', $aDefaultHeaderKeys = array() ) { |
|
32 | 32 | |
33 | 33 | $_aHeaderKeys = $aDefaultHeaderKeys + array( |
34 | 34 | // storing array key => the comment entry header label |
@@ -66,19 +66,19 @@ discard block |
||
66 | 66 | |
67 | 67 | switch ( trim( $sType ) ) { |
68 | 68 | case 'theme': |
69 | - $aData['sName'] = $aData['sThemeName']; |
|
70 | - $aData['sURI'] = $aData['sThemeURI']; |
|
69 | + $aData[ 'sName' ] = $aData[ 'sThemeName' ]; |
|
70 | + $aData[ 'sURI' ] = $aData[ 'sThemeURI' ]; |
|
71 | 71 | break; |
72 | 72 | case 'library': |
73 | - $aData['sName'] = $aData['sLibraryName']; |
|
74 | - $aData['sURI'] = $aData['sLibraryURI']; |
|
73 | + $aData[ 'sName' ] = $aData[ 'sLibraryName' ]; |
|
74 | + $aData[ 'sURI' ] = $aData[ 'sLibraryURI' ]; |
|
75 | 75 | break; |
76 | 76 | case 'script': |
77 | - $aData['sName'] = $aData['sScriptName']; |
|
77 | + $aData[ 'sName' ] = $aData[ 'sScriptName' ]; |
|
78 | 78 | break; |
79 | 79 | case 'plugin': |
80 | - $aData['sName'] = $aData['sPluginName']; |
|
81 | - $aData['sURI'] = $aData['sPluginURI']; |
|
80 | + $aData[ 'sName' ] = $aData[ 'sPluginName' ]; |
|
81 | + $aData[ 'sURI' ] = $aData[ 'sPluginURI' ]; |
|
82 | 82 | break; |
83 | 83 | default: |
84 | 84 | break; |
@@ -93,22 +93,22 @@ discard block |
||
93 | 93 | * @since 3.6.2 |
94 | 94 | * @return array The script data |
95 | 95 | */ |
96 | - static public function getScriptDataFromContents( $sContent, $sType='plugin', $aDefaultHeaderKeys=array() ) { |
|
96 | + static public function getScriptDataFromContents( $sContent, $sType = 'plugin', $aDefaultHeaderKeys = array() ) { |
|
97 | 97 | |
98 | 98 | // Make sure we catch CR-only line endings. |
99 | 99 | $sContent = str_replace( "\r", "\n", $sContent ); |
100 | 100 | |
101 | - $_aHeaders = $aDefaultHeaderKeys; |
|
101 | + $_aHeaders = $aDefaultHeaderKeys; |
|
102 | 102 | if ( $sType ) { |
103 | 103 | $_aExtraHeaders = apply_filters( "extra_{$sType}_headers", array() ); |
104 | - if ( ! empty( $_aExtraHeaders ) ) { |
|
104 | + if ( !empty( $_aExtraHeaders ) ) { |
|
105 | 105 | $_aExtraHeaders = array_combine( $_aExtraHeaders, $_aExtraHeaders ); // keys equal values |
106 | 106 | $_aHeaders = array_merge( $_aExtraHeaders, ( array ) $aDefaultHeaderKeys ); |
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | 110 | foreach ( $_aHeaders as $_sHeaderKey => $_sRegex ) { |
111 | - $_bFound = preg_match( '/^[ \t\/*#@]*' . preg_quote( $_sRegex, '/' ) . ':(.*)$/mi', $sContent, $_aMatch ); |
|
111 | + $_bFound = preg_match( '/^[ \t\/*#@]*'.preg_quote( $_sRegex, '/' ).':(.*)$/mi', $sContent, $_aMatch ); |
|
112 | 112 | $_aHeaders[ $_sHeaderKey ] = $_bFound && $_aMatch[ 1 ] |
113 | 113 | ? _cleanup_header_comment( $_aMatch[ 1 ] ) |
114 | 114 | : ''; |
@@ -125,14 +125,14 @@ discard block |
||
125 | 125 | * @since 3.4.2 |
126 | 126 | * @see download_url() in file.php in core. |
127 | 127 | */ |
128 | - static public function download( $sURL, $iTimeOut=300 ) { |
|
128 | + static public function download( $sURL, $iTimeOut = 300 ) { |
|
129 | 129 | |
130 | 130 | if ( false === filter_var( $sURL, FILTER_VALIDATE_URL ) ) { |
131 | 131 | return false; |
132 | 132 | } |
133 | 133 | |
134 | 134 | $_sTmpFileName = self::setTempPath( self::getBaseNameOfURL( $sURL ) ); |
135 | - if ( ! $_sTmpFileName ) { |
|
135 | + if ( !$_sTmpFileName ) { |
|
136 | 136 | return false; |
137 | 137 | } |
138 | 138 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | return false; |
151 | 151 | } |
152 | 152 | |
153 | - if ( 200 != wp_remote_retrieve_response_code( $_aoResponse ) ){ |
|
153 | + if ( 200 != wp_remote_retrieve_response_code( $_aoResponse ) ) { |
|
154 | 154 | unlink( $_sTmpFileName ); |
155 | 155 | return false; |
156 | 156 | } |
@@ -175,16 +175,16 @@ discard block |
||
175 | 175 | * @since 3.4.2 |
176 | 176 | * @return string The set file path. |
177 | 177 | */ |
178 | - static public function setTempPath( $sFilePath='' ) { |
|
178 | + static public function setTempPath( $sFilePath = '' ) { |
|
179 | 179 | |
180 | 180 | $_sDir = get_temp_dir(); |
181 | 181 | |
182 | 182 | $sFilePath = basename( $sFilePath ); |
183 | 183 | if ( empty( $sFilePath ) ) { |
184 | - $sFilePath = time() . '.tmp'; |
|
184 | + $sFilePath = time().'.tmp'; |
|
185 | 185 | } |
186 | 186 | |
187 | - $sFilePath = $_sDir . wp_unique_filename( $_sDir, $sFilePath ); |
|
187 | + $sFilePath = $_sDir.wp_unique_filename( $_sDir, $sFilePath ); |
|
188 | 188 | touch( $sFilePath ); |
189 | 189 | return $sFilePath; |
190 | 190 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | */ |
198 | 198 | static public function getBaseNameOfURL( $sURL ) { |
199 | 199 | |
200 | - $_sPath = parse_url( $sURL, PHP_URL_PATH) ; |
|
200 | + $_sPath = parse_url( $sURL, PHP_URL_PATH ); |
|
201 | 201 | $_sFileBaseName = basename( $_sPath ); |
202 | 202 | return $_sFileBaseName; |
203 | 203 |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | return false; |
151 | 151 | } |
152 | 152 | |
153 | - if ( 200 != wp_remote_retrieve_response_code( $_aoResponse ) ){ |
|
153 | + if ( 200 != wp_remote_retrieve_response_code( $_aoResponse ) ) { |
|
154 | 154 | unlink( $_sTmpFileName ); |
155 | 155 | return false; |
156 | 156 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $_sDir = get_temp_dir(); |
181 | 181 | |
182 | 182 | $sFilePath = basename( $sFilePath ); |
183 | - if ( empty( $sFilePath ) ) { |
|
183 | + if ( empty( $sFilePath ) ) { |
|
184 | 184 | $sFilePath = time() . '.tmp'; |
185 | 185 | } |
186 | 186 |