@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @since 3.1.3 |
64 | 64 | * @since 3.1.5 Added the $vDefault parameter. |
65 | 65 | */ |
66 | - static public function getTransient( $sTransientKey, $vDefault=null ) { |
|
66 | + static public function getTransient( $sTransientKey, $vDefault = null ) { |
|
67 | 67 | |
68 | 68 | // temporarily disable $_wp_using_ext_object_cache |
69 | 69 | global $_wp_using_ext_object_cache; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @since 3.1.3 |
104 | 104 | * @return boolean True if set; otherwise, false. |
105 | 105 | */ |
106 | - static public function setTransient( $sTransientKey, $vValue, $iExpiration=0 ) { |
|
106 | + static public function setTransient( $sTransientKey, $vValue, $iExpiration = 0 ) { |
|
107 | 107 | |
108 | 108 | // temporarily disable $_wp_using_ext_object_cache |
109 | 109 | global $_wp_using_ext_object_cache; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * The method will replace last ending 33 characters if the given string in the first parameter exceeds the limit. So this number must be greater than 33. |
142 | 142 | * @return string |
143 | 143 | */ |
144 | - static public function _getCompatibleTransientKey( $sSubject, $iAllowedCharacterLength=45 ) { |
|
144 | + static public function _getCompatibleTransientKey( $sSubject, $iAllowedCharacterLength = 45 ) { |
|
145 | 145 | |
146 | 146 | // Check if the given string eceees the length limit. |
147 | 147 | if ( strlen( $sSubject ) <= $iAllowedCharacterLength ) { |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | 0, // start position |
156 | 156 | $_iPrefixLengthToKeep - 1 // how many characters to extract |
157 | 157 | ); |
158 | - return $_sPrefixToKeep . '_' . md5( $sSubject ); |
|
158 | + return $_sPrefixToKeep.'_'.md5( $sSubject ); |
|
159 | 159 | |
160 | 160 | } |
161 | 161 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * @param mixed $vDefault the default value that will be returned if nothing is stored. |
170 | 170 | * @param array $aAdditionalOptions an additional options array to merge with the options array. |
171 | 171 | */ |
172 | - static public function getOption( $sOptionKey, $asKey=null, $vDefault=null, array $aAdditionalOptions=array() ) { |
|
172 | + static public function getOption( $sOptionKey, $asKey = null, $vDefault = null, array $aAdditionalOptions = array() ) { |
|
173 | 173 | return self::_getOptionByFunctionName( $sOptionKey, $asKey, $vDefault, $aAdditionalOptions ); |
174 | 174 | } |
175 | 175 | /** |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * @remark Used in the network admin area. |
185 | 185 | * @return mixed |
186 | 186 | */ |
187 | - static public function getSiteOption( $sOptionKey, $asKey=null, $vDefault=null, array $aAdditionalOptions=array() ) { |
|
187 | + static public function getSiteOption( $sOptionKey, $asKey = null, $vDefault = null, array $aAdditionalOptions = array() ) { |
|
188 | 188 | return self::_getOptionByFunctionName( $sOptionKey, $asKey, $vDefault, $aAdditionalOptions, 'get_site_option' ); |
189 | 189 | } |
190 | 190 | /** |
@@ -193,16 +193,16 @@ discard block |
||
193 | 193 | * @since 3.5.3 |
194 | 194 | * @return mixed |
195 | 195 | */ |
196 | - static private function _getOptionByFunctionName( $sOptionKey, $asKey=null, $vDefault=null, array $aAdditionalOptions=array(), $sFunctionName='get_option' ) { |
|
196 | + static private function _getOptionByFunctionName( $sOptionKey, $asKey = null, $vDefault = null, array $aAdditionalOptions = array(), $sFunctionName = 'get_option' ) { |
|
197 | 197 | |
198 | 198 | // Entire options |
199 | - if ( ! isset( $asKey ) ) { |
|
199 | + if ( !isset( $asKey ) ) { |
|
200 | 200 | $_aOptions = $sFunctionName( |
201 | 201 | $sOptionKey, |
202 | 202 | isset( $vDefault ) |
203 | 203 | ? $vDefault |
204 | 204 | : array() |
205 | - );; |
|
205 | + ); ; |
|
206 | 206 | return empty( $aAdditionalOptions ) |
207 | 207 | ? $_aOptions |
208 | 208 | : self::uniteArrays( |
@@ -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 |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | : @mysql_get_server_info(), |
43 | 43 | ); |
44 | 44 | |
45 | - foreach( ( array ) $wpdb->get_results( "SHOW VARIABLES", ARRAY_A ) as $_iIndex => $_aItem ) { |
|
45 | + foreach ( ( array ) $wpdb->get_results( "SHOW VARIABLES", ARRAY_A ) as $_iIndex => $_aItem ) { |
|
46 | 46 | |
47 | 47 | $_aItem = array_values( $_aItem ); |
48 | 48 | $_sKey = array_shift( $_aItem ); |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | static public function getMySQLErrorLogPath() { |
64 | 64 | |
65 | 65 | $_aMySQLInfo = self::getMySQLInfo(); |
66 | - return isset( $_aMySQLInfo['log_error'] ) |
|
67 | - ? $_aMySQLInfo['log_error'] |
|
66 | + return isset( $_aMySQLInfo[ 'log_error' ] ) |
|
67 | + ? $_aMySQLInfo[ 'log_error' ] |
|
68 | 68 | : ''; |
69 | 69 | |
70 | 70 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * Returns a PHP error log. |
74 | 74 | * @since 3.4.6 |
75 | 75 | */ |
76 | - static public function getMySQLErrorLog( $iLines=1 ) { |
|
76 | + static public function getMySQLErrorLog( $iLines = 1 ) { |
|
77 | 77 | |
78 | 78 | $_sLog = self::getFileTailContents( self::getMySQLErrorLogPath(), $iLines ); |
79 | 79 |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | |
39 | 39 | $_sQuoteCharactor = "'"; |
40 | 40 | $_aOutput = array(); |
41 | - foreach( $aAttributes as $_sAttribute => $_mProperty ) { |
|
41 | + foreach ( $aAttributes as $_sAttribute => $_mProperty ) { |
|
42 | 42 | if ( is_scalar( $_mProperty ) ) { |
43 | - $_aOutput[] = "{$_sAttribute}={$_sQuoteCharactor}" . esc_attr( $_mProperty ) . "{$_sQuoteCharactor}"; |
|
43 | + $_aOutput[ ] = "{$_sAttribute}={$_sQuoteCharactor}".esc_attr( $_mProperty )."{$_sQuoteCharactor}"; |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | return implode( ' ', $_aOutput ); |
@@ -79,11 +79,11 @@ discard block |
||
79 | 79 | * @since 3.6.0 |
80 | 80 | * @return string |
81 | 81 | */ |
82 | - static public function getHTMLTag( $sTagName, array $aAttributes, $sValue=null ) { |
|
82 | + static public function getHTMLTag( $sTagName, array $aAttributes, $sValue = null ) { |
|
83 | 83 | $_sTag = tag_escape( $sTagName ); |
84 | 84 | return null === $sValue |
85 | - ? "<" . $_sTag . " " . self::getAttributes( $aAttributes ) . " />" |
|
86 | - : "<" . $_sTag . " " . self::getAttributes( $aAttributes ) . ">" |
|
85 | + ? "<".$_sTag." ".self::getAttributes( $aAttributes )." />" |
|
86 | + : "<".$_sTag." ".self::getAttributes( $aAttributes ).">" |
|
87 | 87 | . $sValue |
88 | 88 | . "</{$_sTag}>"; |
89 | 89 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @return string |
94 | 94 | * @deprecated 3.6.0 Use `getHTMLTag()` instead. |
95 | 95 | */ |
96 | - static public function generateHTMLTag( $sTagName, array $aAttributes, $sValue=null ) { |
|
96 | + static public function generateHTMLTag( $sTagName, array $aAttributes, $sValue = null ) { |
|
97 | 97 | return self::getHTMLTag( $sTagName, $aAttributes, $sValue ); |
98 | 98 | } |
99 | 99 |
@@ -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 |
@@ -113,7 +113,7 @@ |
||
113 | 113 | * @since 3.6.0 Changed the name from `resolveSRC()`. |
114 | 114 | * @return string|null |
115 | 115 | */ |
116 | - static public function getResolvedSRC( $sSRC, $bReturnNullIfNotExist=false ) { |
|
116 | + static public function getResolvedSRC( $sSRC, $bReturnNullIfNotExist=false ) { |
|
117 | 117 | |
118 | 118 | if ( ! self::isResourcePath( $sSRC ) ) { |
119 | 119 | 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 |
@@ -140,7 +140,8 @@ discard block |
||
140 | 140 | $_aExcludeDirNames = ( array ) $aSearchOptions['exclude_dir_names']; |
141 | 141 | $_bIsRecursive = $aSearchOptions[ 'is_recursive' ]; |
142 | 142 | |
143 | - if ( defined( 'GLOB_BRACE' ) ) { // in some OSes this flag constant is not available. |
|
143 | + if ( defined( 'GLOB_BRACE' ) ) { |
|
144 | +// in some OSes this flag constant is not available. |
|
144 | 145 | $_aFilePaths = $_bIsRecursive |
145 | 146 | ? $this->doRecursiveGlob( $sClassDirPath . '*.' . $this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE, $_aExcludeDirPaths, $_aExcludeDirNames ) |
146 | 147 | : ( array ) glob( $sClassDirPath . '*.' . $this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE ); |
@@ -204,26 +205,26 @@ discard block |
||
204 | 205 | /** |
205 | 206 | * Responds to the PHP auto-loader and includes the passed class based on the previously stored path associated with the class name in the constructor. |
206 | 207 | */ |
207 | - public function _replyToAutoLoad_include( $sCalledUnknownClassName ) { |
|
208 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
208 | + public function _replyToAutoLoad_include( $sCalledUnknownClassName ) { |
|
209 | + if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
209 | 210 | return; |
210 | 211 | } |
211 | 212 | include( $this->_aClasses[ $sCalledUnknownClassName ] ); |
212 | 213 | } |
213 | - public function _replyToAutoLoad_include_once( $sCalledUnknownClassName ) { |
|
214 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
214 | + public function _replyToAutoLoad_include_once( $sCalledUnknownClassName ) { |
|
215 | + if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
215 | 216 | return; |
216 | 217 | } |
217 | 218 | include_once( $this->_aClasses[ $sCalledUnknownClassName ] ); |
218 | 219 | } |
219 | - public function _replyToAutoLoad_require( $sCalledUnknownClassName ) { |
|
220 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
220 | + public function _replyToAutoLoad_require( $sCalledUnknownClassName ) { |
|
221 | + if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
221 | 222 | return; |
222 | 223 | } |
223 | 224 | require( $this->_aClasses[ $sCalledUnknownClassName ] ); |
224 | 225 | } |
225 | - public function _replyToAutoLoad_require_once( $sCalledUnknownClassName ) { |
|
226 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
226 | + public function _replyToAutoLoad_require_once( $sCalledUnknownClassName ) { |
|
227 | + if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
227 | 228 | return; |
228 | 229 | } |
229 | 230 | require_once( $this->_aClasses[ $sCalledUnknownClassName ] ); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * Sets up properties and performs registering classes. |
76 | 76 | * |
77 | 77 | * |
78 | - * @param array|string $asScanDirPath the target directory path to scan |
|
78 | + * @param array|string $asScanDirPaths the target directory path to scan |
|
79 | 79 | * @param array $aOptions The recursive settings. |
80 | 80 | * <ul> |
81 | 81 | * <li><code>is_recursive</code> - (boolean) determines whether the scan should be performed recursively.</li> |
@@ -217,6 +217,7 @@ discard block |
||
217 | 217 | /** |
218 | 218 | * The recursive version of the glob() function. |
219 | 219 | * @internal |
220 | + * @param string $sPathPatten |
|
220 | 221 | */ |
221 | 222 | protected function doRecursiveGlob( $sPathPatten, $nFlags=0, array $aExcludeDirs=array(), array $aExcludeDirNames=array() ) { |
222 | 223 |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | 'is_recursive' => true, |
67 | 67 | 'exclude_dir_paths' => array(), |
68 | 68 | 'exclude_dir_names' => array( 'asset', 'assets', 'css', 'js', 'image', 'images', 'license', 'document', 'documents' ), |
69 | - 'allowed_extensions' => array( 'php', ), // 'inc' |
|
69 | + 'allowed_extensions' => array( 'php',), // 'inc' |
|
70 | 70 | 'include_function' => 'include', |
71 | 71 | 'exclude_class_names' => array( /* 'SomeClass', 'SomeOtherClass' */ ), |
72 | 72 | ); |
@@ -105,10 +105,10 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @remark The directory paths set for the 'exclude_dir_paths' option should use the system directory separator. |
107 | 107 | */ |
108 | - public function __construct( $asScanDirPaths, array $aOptions=array(), array $aClasses=array() ) { |
|
108 | + public function __construct( $asScanDirPaths, array $aOptions = array(), array $aClasses = array() ) { |
|
109 | 109 | |
110 | 110 | $_aOptions = $aOptions + self::$_aStructure_Options; |
111 | - $this->_aClasses = $aClasses + $this->_getClassArray( $asScanDirPaths, $_aOptions ); |
|
111 | + $this->_aClasses = $aClasses + $this->_getClassArray( $asScanDirPaths, $_aOptions ); |
|
112 | 112 | $this->_registerClasses( $_aOptions[ 'include_function' ] ); |
113 | 113 | |
114 | 114 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | return array(); |
135 | 135 | } |
136 | 136 | $_aFilePaths = array(); |
137 | - foreach( ( array ) $asScanDirPaths as $_sClassDirPath ) { |
|
137 | + foreach ( ( array ) $asScanDirPaths as $_sClassDirPath ) { |
|
138 | 138 | if ( realpath( $_sClassDirPath ) ) { |
139 | 139 | $_aFilePaths = array_merge( $this->getFilePaths( $_sClassDirPath, $aSearchOptions ), $_aFilePaths ); |
140 | 140 | } |
@@ -142,11 +142,11 @@ discard block |
||
142 | 142 | |
143 | 143 | // Store classes in an array. |
144 | 144 | $_aClasses = array(); |
145 | - foreach( $_aFilePaths as $_sFilePath ) { |
|
145 | + foreach ( $_aFilePaths as $_sFilePath ) { |
|
146 | 146 | |
147 | 147 | // Class name without a file extension. |
148 | 148 | $_sClassNameWOExt = pathinfo( $_sFilePath, PATHINFO_FILENAME ); |
149 | - if ( in_array( $_sClassNameWOExt, $aSearchOptions['exclude_class_names'] ) ) { |
|
149 | + if ( in_array( $_sClassNameWOExt, $aSearchOptions[ 'exclude_class_names' ] ) ) { |
|
150 | 150 | continue; |
151 | 151 | } |
152 | 152 | $_aClasses[ $_sClassNameWOExt ] = $_sFilePath; |
@@ -176,26 +176,26 @@ discard block |
||
176 | 176 | */ |
177 | 177 | protected function getFilePaths( $sClassDirPath, array $aSearchOptions ) { |
178 | 178 | |
179 | - $sClassDirPath = rtrim( $sClassDirPath, '\\/' ) . DIRECTORY_SEPARATOR; // ensures the trailing (back/)slash exists. |
|
180 | - $_aAllowedExtensions = $aSearchOptions['allowed_extensions']; |
|
181 | - $_aExcludeDirPaths = ( array ) $aSearchOptions['exclude_dir_paths']; |
|
182 | - $_aExcludeDirNames = ( array ) $aSearchOptions['exclude_dir_names']; |
|
179 | + $sClassDirPath = rtrim( $sClassDirPath, '\\/' ).DIRECTORY_SEPARATOR; // ensures the trailing (back/)slash exists. |
|
180 | + $_aAllowedExtensions = $aSearchOptions[ 'allowed_extensions' ]; |
|
181 | + $_aExcludeDirPaths = ( array ) $aSearchOptions[ 'exclude_dir_paths' ]; |
|
182 | + $_aExcludeDirNames = ( array ) $aSearchOptions[ 'exclude_dir_names' ]; |
|
183 | 183 | $_bIsRecursive = $aSearchOptions[ 'is_recursive' ]; |
184 | 184 | |
185 | 185 | if ( defined( 'GLOB_BRACE' ) ) { // in some OSes this flag constant is not available. |
186 | 186 | $_aFilePaths = $_bIsRecursive |
187 | - ? $this->doRecursiveGlob( $sClassDirPath . '*.' . $this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE, $_aExcludeDirPaths, $_aExcludeDirNames ) |
|
188 | - : ( array ) glob( $sClassDirPath . '*.' . $this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE ); |
|
187 | + ? $this->doRecursiveGlob( $sClassDirPath.'*.'.$this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE, $_aExcludeDirPaths, $_aExcludeDirNames ) |
|
188 | + : ( array ) glob( $sClassDirPath.'*.'.$this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE ); |
|
189 | 189 | return array_filter( $_aFilePaths ); // drop non-value elements. |
190 | 190 | } |
191 | 191 | |
192 | 192 | // For the Solaris operation system. |
193 | 193 | $_aFilePaths = array(); |
194 | - foreach( $_aAllowedExtensions as $__sAllowedExtension ) { |
|
194 | + foreach ( $_aAllowedExtensions as $__sAllowedExtension ) { |
|
195 | 195 | |
196 | 196 | $__aFilePaths = $_bIsRecursive |
197 | - ? $this->doRecursiveGlob( $sClassDirPath . '*.' . $__sAllowedExtension, 0, $_aExcludeDirPaths, $_aExcludeDirNames ) |
|
198 | - : ( array ) glob( $sClassDirPath . '*.' . $__sAllowedExtension ); |
|
197 | + ? $this->doRecursiveGlob( $sClassDirPath.'*.'.$__sAllowedExtension, 0, $_aExcludeDirPaths, $_aExcludeDirNames ) |
|
198 | + : ( array ) glob( $sClassDirPath.'*.'.$__sAllowedExtension ); |
|
199 | 199 | |
200 | 200 | $_aFilePaths = array_merge( $__aFilePaths, $_aFilePaths ); |
201 | 201 | |
@@ -208,28 +208,28 @@ discard block |
||
208 | 208 | * Constructs the file pattern of the file extension part used for the glob() function with the given file extensions. |
209 | 209 | * @internal |
210 | 210 | */ |
211 | - protected function _getGlobPatternExtensionPart( array $aExtensions=array( 'php', 'inc' ) ) { |
|
211 | + protected function _getGlobPatternExtensionPart( array $aExtensions = array( 'php', 'inc' ) ) { |
|
212 | 212 | return empty( $aExtensions ) |
213 | 213 | ? '*' |
214 | - : '{' . implode( ',', $aExtensions ) . '}'; |
|
214 | + : '{'.implode( ',', $aExtensions ).'}'; |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
218 | 218 | * The recursive version of the glob() function. |
219 | 219 | * @internal |
220 | 220 | */ |
221 | - protected function doRecursiveGlob( $sPathPatten, $nFlags=0, array $aExcludeDirs=array(), array $aExcludeDirNames=array() ) { |
|
221 | + protected function doRecursiveGlob( $sPathPatten, $nFlags = 0, array $aExcludeDirs = array(), array $aExcludeDirNames = array() ) { |
|
222 | 222 | |
223 | 223 | $_aFiles = glob( $sPathPatten, $nFlags ); |
224 | 224 | $_aFiles = is_array( $_aFiles ) ? $_aFiles : array(); // glob() can return false. |
225 | - $_aDirs = glob( dirname( $sPathPatten ) . DIRECTORY_SEPARATOR . '*', GLOB_ONLYDIR|GLOB_NOSORT ); |
|
225 | + $_aDirs = glob( dirname( $sPathPatten ).DIRECTORY_SEPARATOR.'*', GLOB_ONLYDIR | GLOB_NOSORT ); |
|
226 | 226 | $_aDirs = is_array( $_aDirs ) ? $_aDirs : array(); |
227 | 227 | foreach ( $_aDirs as $_sDirPath ) { |
228 | 228 | |
229 | 229 | if ( in_array( $_sDirPath, $aExcludeDirs ) ) { continue; } |
230 | 230 | if ( in_array( pathinfo( $_sDirPath, PATHINFO_DIRNAME ), $aExcludeDirNames ) ) { continue; } |
231 | 231 | |
232 | - $_aFiles = array_merge( $_aFiles, $this->doRecursiveGlob( $_sDirPath . DIRECTORY_SEPARATOR . basename( $sPathPatten ), $nFlags, $aExcludeDirs ) ); |
|
232 | + $_aFiles = array_merge( $_aFiles, $this->doRecursiveGlob( $_sDirPath.DIRECTORY_SEPARATOR.basename( $sPathPatten ), $nFlags, $aExcludeDirs ) ); |
|
233 | 233 | |
234 | 234 | } |
235 | 235 | return $_aFiles; |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | * @return void |
245 | 245 | */ |
246 | 246 | protected function _registerClasses( $sIncludeFunction ) { |
247 | - spl_autoload_register( array( $this, '_replyToAutoLoad_' . $sIncludeFunction ) ); |
|
247 | + spl_autoload_register( array( $this, '_replyToAutoLoad_'.$sIncludeFunction ) ); |
|
248 | 248 | } |
249 | 249 | /**#@+ |
250 | 250 | * Responds to the PHP auto-loader and includes the passed class based on the previously stored path associated with the class name in the constructor. |
@@ -252,25 +252,25 @@ discard block |
||
252 | 252 | * @return void |
253 | 253 | */ |
254 | 254 | public function _replyToAutoLoad_include( $sCalledUnknownClassName ) { |
255 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
255 | + if ( !isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
256 | 256 | return; |
257 | 257 | } |
258 | 258 | include( $this->_aClasses[ $sCalledUnknownClassName ] ); |
259 | 259 | } |
260 | 260 | public function _replyToAutoLoad_include_once( $sCalledUnknownClassName ) { |
261 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
261 | + if ( !isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
262 | 262 | return; |
263 | 263 | } |
264 | 264 | include_once( $this->_aClasses[ $sCalledUnknownClassName ] ); |
265 | 265 | } |
266 | 266 | public function _replyToAutoLoad_require( $sCalledUnknownClassName ) { |
267 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
267 | + if ( !isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
268 | 268 | return; |
269 | 269 | } |
270 | 270 | require( $this->_aClasses[ $sCalledUnknownClassName ] ); |
271 | 271 | } |
272 | 272 | public function _replyToAutoLoad_require_once( $sCalledUnknownClassName ) { |
273 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
273 | + if ( !isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
274 | 274 | return; |
275 | 275 | } |
276 | 276 | require_once( $this->_aClasses[ $sCalledUnknownClassName ] ); |
@@ -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. |
@@ -135,6 +135,7 @@ discard block |
||
135 | 135 | * Determines the log file path. |
136 | 136 | * @since 3.5.3 |
137 | 137 | * @internal |
138 | + * @param string|null $bsFilePath |
|
138 | 139 | * @return string The path of the file to log the contents. |
139 | 140 | */ |
140 | 141 | static private function _getLogFilePath( $bsFilePath, $sCallerClass ) { |
@@ -189,6 +190,7 @@ discard block |
||
189 | 190 | * Returns a length of a value. |
190 | 191 | * @since 3.5.3 |
191 | 192 | * @internal |
193 | + * @param string $sVariableType |
|
192 | 194 | * @return integer|null For string or integer, the string length. For array, the element lengths. For other types, null. |
193 | 195 | */ |
194 | 196 | static private function _getValueLength( $mValue, $sVariableType ) { |
@@ -206,6 +208,8 @@ discard block |
||
206 | 208 | * Returns the heading part of a log item. |
207 | 209 | * @since 3.5.3 |
208 | 210 | * @internal |
211 | + * @param double $fCurrentTimeStamp |
|
212 | + * @param double $nElapsed |
|
209 | 213 | * @return string the heading part of a log item. |
210 | 214 | */ |
211 | 215 | static private function _getLogHeadingLine( $fCurrentTimeStamp, $nElapsed, $sCallerClass, $sCallerFunction ) { |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param string $sFilePath The file path for a log file. |
34 | 34 | * @return void |
35 | 35 | */ |
36 | - static public function dump( $asArray, $sFilePath=null ) { |
|
36 | + static public function dump( $asArray, $sFilePath = null ) { |
|
37 | 37 | echo self::get( $asArray, $sFilePath ); |
38 | 38 | } |
39 | 39 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @since unknown |
45 | 45 | * @deprecated 3.2.0 |
46 | 46 | */ |
47 | - static public function dumpArray( $asArray, $sFilePath=null ) { |
|
47 | + static public function dumpArray( $asArray, $sFilePath = null ) { |
|
48 | 48 | self::dump( $asArray, $sFilePath ); |
49 | 49 | } |
50 | 50 | |
@@ -59,12 +59,12 @@ discard block |
||
59 | 59 | * @param string $sFilePath The file path for a log file. |
60 | 60 | * @param boolean $bEscape Whether to escape characters. |
61 | 61 | */ |
62 | - static public function get( $asArray, $sFilePath=null, $bEscape=true ) { |
|
62 | + static public function get( $asArray, $sFilePath = null, $bEscape = true ) { |
|
63 | 63 | |
64 | 64 | if ( $sFilePath ) self::log( $asArray, $sFilePath ); |
65 | 65 | |
66 | 66 | return $bEscape |
67 | - ? "<pre class='dump-array'>" . htmlspecialchars( self::getAsString( $asArray ) ) . "</pre>" // esc_html() has a bug that breaks with complex HTML code. |
|
67 | + ? "<pre class='dump-array'>".htmlspecialchars( self::getAsString( $asArray ) )."</pre>" // esc_html() has a bug that breaks with complex HTML code. |
|
68 | 68 | : self::getAsString( $asArray ); // non-escape is used for exporting data into file. |
69 | 69 | |
70 | 70 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @since 3.0.0 Changed the $bEncloseInTag parameter to bEscape. |
78 | 78 | * @deprecated 3.2.0 |
79 | 79 | */ |
80 | - static public function getArray( $asArray, $sFilePath=null, $bEscape=true ) { |
|
80 | + static public function getArray( $asArray, $sFilePath = null, $bEscape = true ) { |
|
81 | 81 | return self::get( $asArray, $sFilePath, $bEscape ); |
82 | 82 | } |
83 | 83 | |
@@ -99,18 +99,18 @@ discard block |
||
99 | 99 | * @param string $sFilePath The log file path. |
100 | 100 | * @return void |
101 | 101 | **/ |
102 | - static public function log( $mValue, $sFilePath=null ) { |
|
102 | + static public function log( $mValue, $sFilePath = null ) { |
|
103 | 103 | |
104 | 104 | static $_fPreviousTimeStamp = 0; |
105 | 105 | |
106 | 106 | $_oCallerInfo = debug_backtrace(); |
107 | 107 | $_sCallerFunction = self::getElement( |
108 | - $_oCallerInfo, // subject array |
|
108 | + $_oCallerInfo, // subject array |
|
109 | 109 | array( 1, 'function' ), // key |
110 | 110 | '' // default |
111 | 111 | ); |
112 | - $_sCallerClass = self::getElement( |
|
113 | - $_oCallerInfo, // subject array |
|
112 | + $_sCallerClass = self::getElement( |
|
113 | + $_oCallerInfo, // subject array |
|
114 | 114 | array( 1, 'class' ), // key |
115 | 115 | '' // default |
116 | 116 | ); |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | self::_getLogFilePath( $sFilePath, $_sCallerClass ), |
121 | 121 | self::_getLogHeadingLine( |
122 | 122 | $_fCurrentTimeStamp, |
123 | - round( $_fCurrentTimeStamp - $_fPreviousTimeStamp, 3 ), // elapsed time |
|
123 | + round( $_fCurrentTimeStamp - $_fPreviousTimeStamp, 3 ), // elapsed time |
|
124 | 124 | $_sCallerClass, |
125 | 125 | $_sCallerFunction |
126 | - ) . PHP_EOL |
|
126 | + ).PHP_EOL |
|
127 | 127 | . self::_getLogContents( $mValue ), |
128 | 128 | FILE_APPEND |
129 | 129 | ); |
@@ -145,9 +145,9 @@ discard block |
||
145 | 145 | } |
146 | 146 | // Return a generated default log path. |
147 | 147 | if ( true === $bsFilePath ) { |
148 | - return WP_CONTENT_DIR . DIRECTORY_SEPARATOR . basename( get_class() ) . '_' . date( "Ymd" ) . '.log'; |
|
148 | + return WP_CONTENT_DIR.DIRECTORY_SEPARATOR.basename( get_class() ).'_'.date( "Ymd" ).'.log'; |
|
149 | 149 | } |
150 | - return WP_CONTENT_DIR . DIRECTORY_SEPARATOR . basename( get_class() ) . '_' . basename( $sCallerClass ) . '_' . date( "Ymd" ) . '.log'; |
|
150 | + return WP_CONTENT_DIR.DIRECTORY_SEPARATOR.basename( get_class() ).'_'.basename( $sCallerClass ).'_'.date( "Ymd" ).'.log'; |
|
151 | 151 | |
152 | 152 | } |
153 | 153 | /** |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * @internal |
157 | 157 | */ |
158 | 158 | static private function _createFile( $sFilePath ) { |
159 | - if ( ! $sFilePath || true === $sFilePath ) { |
|
159 | + if ( !$sFilePath || true === $sFilePath ) { |
|
160 | 160 | return false; |
161 | 161 | } |
162 | 162 | if ( file_exists( $sFilePath ) ) { |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | $_iLengths = self::_getValueLength( $mValue, $_sType ); |
180 | 180 | return '(' |
181 | 181 | . $_sType |
182 | - . ( null !== $_iLengths ? ', length: ' . $_iLengths : '' ) |
|
182 | + . ( null !== $_iLengths ? ', length: '.$_iLengths : '' ) |
|
183 | 183 | . ') ' |
184 | 184 | . self::getAsString( $mValue ) |
185 | - . PHP_EOL . PHP_EOL; |
|
185 | + . PHP_EOL.PHP_EOL; |
|
186 | 186 | |
187 | 187 | } |
188 | 188 | /** |
@@ -223,11 +223,11 @@ discard block |
||
223 | 223 | $_nMicroseconds = str_pad( round( ( $_nNow - floor( $_nNow ) ) * 10000 ), 4, '0' ); |
224 | 224 | |
225 | 225 | $_aOutput = array( |
226 | - date( "Y/m/d H:i:s", $_nNow ) . '.' . $_nMicroseconds, |
|
226 | + date( "Y/m/d H:i:s", $_nNow ).'.'.$_nMicroseconds, |
|
227 | 227 | self::_getFormattedElapsedTime( $nElapsed ), |
228 | 228 | $_iPageLoadID, |
229 | 229 | AdminPageFramework_Registry::getVersion(), |
230 | - $sCallerClass . '::' . $sCallerFunction, |
|
230 | + $sCallerClass.'::'.$sCallerFunction, |
|
231 | 231 | current_filter(), |
232 | 232 | self::getCurrentURL(), |
233 | 233 | ); |
@@ -245,22 +245,22 @@ discard block |
||
245 | 245 | $_aElapsedParts = explode( ".", ( string ) $nElapsed ); |
246 | 246 | $_sElapsedFloat = str_pad( |
247 | 247 | self::getElement( |
248 | - $_aElapsedParts, // subject array |
|
248 | + $_aElapsedParts, // subject array |
|
249 | 249 | 1, // key |
250 | 250 | 0 // default |
251 | 251 | ), |
252 | 252 | 3, |
253 | 253 | '0' |
254 | 254 | ); |
255 | - $_sElapsed = self::getElement( |
|
256 | - $_aElapsedParts, // subject array |
|
257 | - 0, // key |
|
255 | + $_sElapsed = self::getElement( |
|
256 | + $_aElapsedParts, // subject array |
|
257 | + 0, // key |
|
258 | 258 | 0 // default |
259 | 259 | ); |
260 | - $_sElapsed = strlen( $_sElapsed ) > 1 |
|
261 | - ? '+' . substr( $_sElapsed, -1, 2 ) |
|
262 | - : ' ' . $_sElapsed; |
|
263 | - return $_sElapsed . '.' . $_sElapsedFloat; |
|
260 | + $_sElapsed = strlen( $_sElapsed ) > 1 |
|
261 | + ? '+'.substr( $_sElapsed, -1, 2 ) |
|
262 | + : ' '.$_sElapsed; |
|
263 | + return $_sElapsed.'.'.$_sElapsedFloat; |
|
264 | 264 | |
265 | 265 | } |
266 | 266 | /** |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * @since 3.0.3 Changed the default log location and file name. |
271 | 271 | * @deprecated 3.1.0 Use the `log()` method instead. |
272 | 272 | */ |
273 | - static public function logArray( $asArray, $sFilePath=null ) { |
|
273 | + static public function logArray( $asArray, $sFilePath = null ) { |
|
274 | 274 | self::log( $asArray, $sFilePath ); |
275 | 275 | } |
276 | 276 | |
@@ -303,13 +303,13 @@ discard block |
||
303 | 303 | * @return array |
304 | 304 | * @internal |
305 | 305 | */ |
306 | - static public function getSliceByDepth( array $aSubject, $iDepth=0 ) { |
|
306 | + static public function getSliceByDepth( array $aSubject, $iDepth = 0 ) { |
|
307 | 307 | |
308 | 308 | foreach ( $aSubject as $_sKey => $_vValue ) { |
309 | 309 | if ( is_object( $_vValue ) ) { |
310 | 310 | $aSubject[ $_sKey ] = method_exists( $_vValue, '__toString' ) |
311 | 311 | ? ( string ) $_vValue // cast string |
312 | - : get_object_vars( $_vValue ); // convert it to array. |
|
312 | + : get_object_vars( $_vValue ); // convert it to array. |
|
313 | 313 | } |
314 | 314 | if ( is_array( $_vValue ) ) { |
315 | 315 | $_iDepth = $iDepth; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @return integer |
35 | 35 | * @internal |
36 | 36 | */ |
37 | - static public function sortArrayByKey( $a, $b, $sKey='order' ) { |
|
37 | + static public function sortArrayByKey( $a, $b, $sKey = 'order' ) { |
|
38 | 38 | return isset( $a[ $sKey ], $b[ $sKey ] ) |
39 | 39 | ? $a[ $sKey ] - $b[ $sKey ] |
40 | 40 | : 1; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | static public function unsetDimensionalArrayElement( &$mSubject, array $aKeys ) { |
78 | 78 | |
79 | 79 | $_sKey = array_shift( $aKeys ); |
80 | - if ( ! empty( $aKeys ) ) { |
|
80 | + if ( !empty( $aKeys ) ) { |
|
81 | 81 | if ( isset( $mSubject[ $_sKey ] ) && is_array( $mSubject[ $_sKey ] ) ) { |
82 | 82 | self::unsetDimensionalArrayElement( $mSubject[ $_sKey ], $aKeys ); |
83 | 83 | } |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | static public function setMultiDimensionalArray( &$mSubject, array $aKeys, $mValue ) { |
99 | 99 | |
100 | 100 | $_sKey = array_shift( $aKeys ); |
101 | - if ( ! empty( $aKeys ) ) { |
|
102 | - if( ! isset( $mSubject[ $_sKey ] ) || ! is_array( $mSubject[ $_sKey ] ) ) { |
|
101 | + if ( !empty( $aKeys ) ) { |
|
102 | + if ( !isset( $mSubject[ $_sKey ] ) || !is_array( $mSubject[ $_sKey ] ) ) { |
|
103 | 103 | $mSubject[ $_sKey ] = array(); |
104 | 104 | } |
105 | 105 | self::setMultiDimensionalArray( $mSubject[ $_sKey ], $aKeys, $mValue ); |
@@ -153,10 +153,10 @@ discard block |
||
153 | 153 | |
154 | 154 | $_aNumeric = self::getIntegerKeyElements( $aSubject ); |
155 | 155 | $_aAssociative = self::invertCastArrayContents( $aSubject, $_aNumeric ); |
156 | - foreach( $_aNumeric as &$_aElem ) { |
|
156 | + foreach ( $_aNumeric as &$_aElem ) { |
|
157 | 157 | $_aElem = self::uniteArrays( $_aElem, $_aAssociative ); |
158 | 158 | } |
159 | - if ( ! empty( $_aAssociative ) ) { |
|
159 | + if ( !empty( $_aAssociative ) ) { |
|
160 | 160 | array_unshift( $_aNumeric, $_aAssociative ); // insert the main section to the beginning of the array. |
161 | 161 | } |
162 | 162 | return $_aNumeric; |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | public static function castArrayContents( array $aModel, array $aSubject ) { |
180 | 180 | |
181 | 181 | $_aCast = array(); |
182 | - foreach( $aModel as $_isKey => $_v ) { |
|
182 | + foreach ( $aModel as $_isKey => $_v ) { |
|
183 | 183 | $_aCast[ $_isKey ] = self::getElement( |
184 | - $aSubject, // subject array |
|
185 | - $_isKey, // key |
|
184 | + $aSubject, // subject array |
|
185 | + $_isKey, // key |
|
186 | 186 | null // default |
187 | 187 | ); |
188 | 188 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | public static function invertCastArrayContents( array $aModel, array $aSubject ) { |
204 | 204 | |
205 | 205 | $_aInvert = array(); |
206 | - foreach( $aModel as $_isKey => $_v ) { |
|
206 | + foreach ( $aModel as $_isKey => $_v ) { |
|
207 | 207 | if ( array_key_exists( $_isKey, $aSubject ) ) { |
208 | 208 | continue; |
209 | 209 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | public static function uniteArrays( /* $aPrecedence, $aArray1, $aArray2, ... */ ) { |
230 | 230 | |
231 | 231 | $_aArray = array(); |
232 | - foreach( array_reverse( func_get_args() ) as $_aArg ) { |
|
232 | + foreach ( array_reverse( func_get_args() ) as $_aArg ) { |
|
233 | 233 | $_aArray = self::uniteArraysRecursive( |
234 | 234 | self::getAsArray( $_aArg ), |
235 | 235 | $_aArray |
@@ -260,14 +260,14 @@ discard block |
||
260 | 260 | $aPrecedence = array(); |
261 | 261 | } |
262 | 262 | |
263 | - if ( ! is_array( $aDefault ) || ! is_array( $aPrecedence ) ) { |
|
263 | + if ( !is_array( $aDefault ) || !is_array( $aPrecedence ) ) { |
|
264 | 264 | return $aPrecedence; |
265 | 265 | } |
266 | 266 | |
267 | - foreach( $aDefault as $sKey => $v ) { |
|
267 | + foreach ( $aDefault as $sKey => $v ) { |
|
268 | 268 | |
269 | 269 | // If the precedence does not have the key, assign the default's value. |
270 | - if ( ! array_key_exists( $sKey, $aPrecedence ) || is_null( $aPrecedence[ $sKey ] ) ) { |
|
270 | + if ( !array_key_exists( $sKey, $aPrecedence ) || is_null( $aPrecedence[ $sKey ] ) ) { |
|
271 | 271 | $aPrecedence[ $sKey ] = $v; |
272 | 272 | } else { |
273 | 273 | |
@@ -298,9 +298,9 @@ discard block |
||
298 | 298 | * - NULL |
299 | 299 | * @return array The modified array. |
300 | 300 | */ |
301 | - static public function dropElementsByType( array $aArray, $aTypes=array( 'array' ) ) { |
|
301 | + static public function dropElementsByType( array $aArray, $aTypes = array( 'array' ) ) { |
|
302 | 302 | |
303 | - foreach( $aArray as $isKey => $vValue ) { |
|
303 | + foreach ( $aArray as $isKey => $vValue ) { |
|
304 | 304 | if ( in_array( gettype( $vValue ), $aTypes ) ) { |
305 | 305 | unset( $aArray[ $isKey ] ); |
306 | 306 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | */ |
317 | 317 | static public function dropElementByValue( array $aArray, $vValue ) { |
318 | 318 | |
319 | - foreach( self::getAsArray( $vValue, true ) as $_vValue ) { |
|
319 | + foreach ( self::getAsArray( $vValue, true ) as $_vValue ) { |
|
320 | 320 | $_sKey = array_search( $_vValue, $aArray, true ); |
321 | 321 | if ( $_sKey === false ) { |
322 | 322 | continue; |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | */ |
339 | 339 | static public function dropElementsByKey( array $aArray, $asKeys ) { |
340 | 340 | |
341 | - foreach( self::getAsArray( $asKeys, true ) as $_isKey ) { |
|
341 | + foreach ( self::getAsArray( $asKeys, true ) as $_isKey ) { |
|
342 | 342 | unset( $aArray[ $_isKey ] ); |
343 | 343 | } |
344 | 344 | return $aArray; |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | |
205 | 205 | $_aInvert = array(); |
206 | 206 | foreach( $aModel as $_isKey => $_v ) { |
207 | - if ( array_key_exists( $_isKey, $aSubject ) ) { |
|
207 | + if ( array_key_exists( $_isKey, $aSubject ) ) { |
|
208 | 208 | continue; |
209 | 209 | } |
210 | 210 | $_aInvert[ $_isKey ] = $_v; |
@@ -256,11 +256,11 @@ discard block |
||
256 | 256 | */ |
257 | 257 | public static function uniteArraysRecursive( $aPrecedence, $aDefault ) { |
258 | 258 | |
259 | - if ( is_null( $aPrecedence ) ) { |
|
259 | + if ( is_null( $aPrecedence ) ) { |
|
260 | 260 | $aPrecedence = array(); |
261 | 261 | } |
262 | 262 | |
263 | - if ( ! is_array( $aDefault ) || ! is_array( $aPrecedence ) ) { |
|
263 | + if ( ! is_array( $aDefault ) || ! is_array( $aPrecedence ) ) { |
|
264 | 264 | return $aPrecedence; |
265 | 265 | } |
266 | 266 |