@@ -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. |
@@ -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 |
@@ -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 ) { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | public $sNotice = ''; |
35 | 35 | public $aAttributes = array(); |
36 | 36 | public $aCallbacks = array( |
37 | - 'should_show' => null, // detemines whether the admin notice should be displayed. |
|
37 | + 'should_show' => null, // detemines whether the admin notice should be displayed. |
|
38 | 38 | ); |
39 | 39 | |
40 | 40 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param array $aCallbacks DEVVER+ Stores callbacks. |
46 | 46 | * @since 3.5.0 |
47 | 47 | */ |
48 | - public function __construct( $sNotice, array $aAttributes=array( 'class' => 'error' ), array $aCallbacks=array() ) { |
|
48 | + public function __construct( $sNotice, array $aAttributes = array( 'class' => 'error' ), array $aCallbacks = array() ) { |
|
49 | 49 | |
50 | 50 | $this->aAttributes = $aAttributes + array( |
51 | 51 | 'class' => 'error', // 'updated' etc. |
@@ -53,16 +53,16 @@ discard block |
||
53 | 53 | $this->aAttributes[ 'class' ] = $this->getClassAttribute( |
54 | 54 | $this->aAttributes[ 'class' ], |
55 | 55 | 'admin-page-framework-settings-notice-message', |
56 | - 'admin-page-framework-settings-notice-container', // Moved from `AdminPageFramework_Factory_View`. |
|
56 | + 'admin-page-framework-settings-notice-container', // Moved from `AdminPageFramework_Factory_View`. |
|
57 | 57 | 'notice', |
58 | 58 | 'is-dismissible' // 3.5.12+ |
59 | 59 | ); |
60 | - $this->aCallbacks = $aCallbacks + $this->aCallbacks; |
|
60 | + $this->aCallbacks = $aCallbacks + $this->aCallbacks; |
|
61 | 61 | |
62 | 62 | $this->_loadResources(); |
63 | 63 | |
64 | 64 | // An empty value may be set in oreder only to laode the fade-in script. |
65 | - if ( ! $sNotice ) { |
|
65 | + if ( !$sNotice ) { |
|
66 | 66 | return; |
67 | 67 | } |
68 | 68 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * Sets up scripts. |
81 | 81 | * @since DEVVER |
82 | 82 | */ |
83 | - private function _loadResources(){ |
|
83 | + private function _loadResources() { |
|
84 | 84 | |
85 | 85 | // Make sure to load once per page load. |
86 | 86 | if ( self::$_bLoaded ) { |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function _replyToDisplayAdminNotice() { |
101 | 101 | |
102 | - if ( ! $this->_shouldProceed() ) { |
|
102 | + if ( !$this->_shouldProceed() ) { |
|
103 | 103 | return; |
104 | 104 | } |
105 | 105 | |
@@ -110,14 +110,14 @@ discard block |
||
110 | 110 | 'display: none' |
111 | 111 | ); |
112 | 112 | |
113 | - echo "<div " . $this->getAttributes( $_aAttributes ) . ">" |
|
113 | + echo "<div ".$this->getAttributes( $_aAttributes ).">" |
|
114 | 114 | . "<p>" |
115 | 115 | . self::$_aNotices[ $this->sNotice ] |
116 | 116 | . "</p>" |
117 | 117 | . "</div>" |
118 | 118 | // Insert the same message except it is not hidden. |
119 | 119 | . "<noscript>" |
120 | - . "<div " . $this->getAttributes( $this->aAttributes ) . ">" |
|
120 | + . "<div ".$this->getAttributes( $this->aAttributes ).">" |
|
121 | 121 | . "<p>" |
122 | 122 | . self::$_aNotices[ $this->sNotice ] |
123 | 123 | . "</p>" |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | private function _shouldProceed() { |
135 | 135 | |
136 | - if ( ! is_callable( $this->aCallbacks[ 'should_show' ] ) ) { |
|
136 | + if ( !is_callable( $this->aCallbacks[ 'should_show' ] ) ) { |
|
137 | 137 | return true; |
138 | 138 | } |
139 | 139 | return call_user_func_array( |
@@ -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 | /** |