@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | $className = $this->camelCase( $name ); |
| 18 | 18 | $path = ltrim( str_replace( __NAMESPACE__, '', $path ), '\\' ); |
| 19 | - return !empty( $path ) |
|
| 19 | + return !empty($path) |
|
| 20 | 20 | ? __NAMESPACE__.'\\'.$path.'\\'.$className |
| 21 | 21 | : $className; |
| 22 | 22 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function buildMethodName( $name, $prefix = '' ) |
| 30 | 30 | { |
| 31 | - return lcfirst( $prefix.$this->buildClassName( $name )); |
|
| 31 | + return lcfirst( $prefix.$this->buildClassName( $name ) ); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function buildPropertyName( $name ) |
| 39 | 39 | { |
| 40 | - return lcfirst( $this->buildClassName( $name )); |
|
| 40 | + return lcfirst( $this->buildClassName( $name ) ); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public function camelCase( $string ) |
| 48 | 48 | { |
| 49 | - $string = ucwords( str_replace( ['-', '_'], ' ', trim( $string ))); |
|
| 49 | + $string = ucwords( str_replace( ['-', '_'], ' ', trim( $string ) ) ); |
|
| 50 | 50 | return str_replace( ' ', '', $string ); |
| 51 | 51 | } |
| 52 | 52 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function convertPathToId( $path, $prefix = '' ) |
| 80 | 80 | { |
| 81 | - return str_replace( ['[', ']'], ['-', ''], $this->convertPathToName( $path, $prefix )); |
|
| 81 | + return str_replace( ['[', ']'], ['-', ''], $this->convertPathToName( $path, $prefix ) ); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | { |
| 90 | 90 | $levels = explode( '.', $path ); |
| 91 | 91 | return array_reduce( $levels, function( $result, $value ) { |
| 92 | - return $result.= '['.$value.']'; |
|
| 92 | + return $result .= '['.$value.']'; |
|
| 93 | 93 | }, $prefix ); |
| 94 | 94 | } |
| 95 | 95 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public function convertStringToArray( $string, $callback = null ) |
| 102 | 102 | { |
| 103 | - $array = array_map( 'trim', explode( ',', $string )); |
|
| 103 | + $array = array_map( 'trim', explode( ',', $string ) ); |
|
| 104 | 104 | return $callback |
| 105 | 105 | ? array_filter( $array, $callback ) |
| 106 | 106 | : array_filter( $array ); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | public function dashCase( $string ) |
| 114 | 114 | { |
| 115 | - return str_replace( '_', '-', $this->snakeCase( $string )); |
|
| 115 | + return str_replace( '_', '-', $this->snakeCase( $string ) ); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -134,11 +134,11 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | public function filterInput( $key, array $request = [] ) |
| 136 | 136 | { |
| 137 | - if( isset( $request[$key] )) { |
|
| 137 | + if( isset($request[$key]) ) { |
|
| 138 | 138 | return $request[$key]; |
| 139 | 139 | } |
| 140 | 140 | $variable = filter_input( INPUT_POST, $key ); |
| 141 | - if( is_null( $variable ) && isset( $_POST[$key] )) { |
|
| 141 | + if( is_null( $variable ) && isset($_POST[$key]) ) { |
|
| 142 | 142 | $variable = $_POST[$key]; |
| 143 | 143 | } |
| 144 | 144 | return $variable; |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | public function filterInputArray( $key ) |
| 152 | 152 | { |
| 153 | 153 | $variable = filter_input( INPUT_POST, $key, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); |
| 154 | - if( empty( $variable ) && !empty( $_POST[$key] ) && is_array( $_POST[$key] )) { |
|
| 154 | + if( empty($variable) && !empty($_POST[$key]) && is_array( $_POST[$key] ) ) { |
|
| 155 | 155 | $variable = $_POST[$key]; |
| 156 | 156 | } |
| 157 | 157 | return (array)$variable; |
@@ -167,13 +167,13 @@ discard block |
||
| 167 | 167 | $result = []; |
| 168 | 168 | foreach( $array as $key => $value ) { |
| 169 | 169 | $newKey = ltrim( $prefix.'.'.$key, '.' ); |
| 170 | - if( $this->isIndexedFlatArray( $value )) { |
|
| 170 | + if( $this->isIndexedFlatArray( $value ) ) { |
|
| 171 | 171 | if( $flattenValue ) { |
| 172 | 172 | $value = '['.implode( ', ', $value ).']'; |
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | - else if( is_array( $value )) { |
|
| 176 | - $result = array_merge( $result, $this->flattenArray( $value, $flattenValue, $newKey )); |
|
| 175 | + else if( is_array( $value ) ) { |
|
| 176 | + $result = array_merge( $result, $this->flattenArray( $value, $flattenValue, $newKey ) ); |
|
| 177 | 177 | continue; |
| 178 | 178 | } |
| 179 | 179 | $result[$newKey] = $value; |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | Whip::IPV4 => $cloudflareIps['v4'], |
| 196 | 196 | Whip::IPV6 => $ipv6, |
| 197 | 197 | ], |
| 198 | - ]))->getValidIpAddress(); |
|
| 198 | + ] ))->getValidIpAddress(); |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | /** |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | { |
| 209 | 209 | $keys = explode( '.', $path ); |
| 210 | 210 | foreach( $keys as $key ) { |
| 211 | - if( !isset( $values[$key] )) { |
|
| 211 | + if( !isset($values[$key]) ) { |
|
| 212 | 212 | return $fallback; |
| 213 | 213 | } |
| 214 | 214 | $values = $values[$key]; |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | public function isIndexedArray( $array ) |
| 224 | 224 | { |
| 225 | - if( !is_array( $array )) { |
|
| 225 | + if( !is_array( $array ) ) { |
|
| 226 | 226 | return false; |
| 227 | 227 | } |
| 228 | 228 | $current = 0; |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | */ |
| 242 | 242 | public function isIndexedFlatArray( $array ) |
| 243 | 243 | { |
| 244 | - if( !is_array( $array ) || array_filter( $array, 'is_array' )) { |
|
| 244 | + if( !is_array( $array ) || array_filter( $array, 'is_array' ) ) { |
|
| 245 | 245 | return false; |
| 246 | 246 | } |
| 247 | 247 | return $this->isIndexedArray( $array ); |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | */ |
| 255 | 255 | public function prefixString( $string, $prefix = '' ) |
| 256 | 256 | { |
| 257 | - return $prefix.str_replace( $prefix, '', trim( $string )); |
|
| 257 | + return $prefix.str_replace( $prefix, '', trim( $string ) ); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | /** |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | */ |
| 280 | 280 | public function removePrefix( $prefix, $text ) { |
| 281 | 281 | return 0 === strpos( $text, $prefix ) |
| 282 | - ? substr( $text, strlen( $prefix )) |
|
| 282 | + ? substr( $text, strlen( $prefix ) ) |
|
| 283 | 283 | : $text; |
| 284 | 284 | } |
| 285 | 285 | |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | */ |
| 311 | 311 | public function snakeCase( $string ) |
| 312 | 312 | { |
| 313 | - if( !ctype_lower( $string )) { |
|
| 313 | + if( !ctype_lower( $string ) ) { |
|
| 314 | 314 | $string = preg_replace( '/\s+/u', '', $string ); |
| 315 | 315 | $string = preg_replace( '/(.)(?=[A-Z])/u', '$1_', $string ); |
| 316 | 316 | $string = function_exists( 'mb_strtolower' ) |
@@ -327,6 +327,6 @@ discard block |
||
| 327 | 327 | */ |
| 328 | 328 | public function startsWith( $needle, $haystack ) |
| 329 | 329 | { |
| 330 | - return substr( $haystack, 0, strlen( $needle )) === $needle; |
|
| 330 | + return substr( $haystack, 0, strlen( $needle ) ) === $needle; |
|
| 331 | 331 | } |
| 332 | 332 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | 'setting' => 'Plugin Settings', |
| 41 | 41 | 'reviews' => 'Review Counts', |
| 42 | 42 | ]; |
| 43 | - $systemInfo = array_reduce( array_keys( $details ), function( $carry, $key ) use( $details ) { |
|
| 43 | + $systemInfo = array_reduce( array_keys( $details ), function( $carry, $key ) use($details) { |
|
| 44 | 44 | $methodName = glsr( Helper::class )->buildMethodName( 'get-'.$key.'-details' ); |
| 45 | 45 | if( method_exists( $this, $methodName ) && $systemDetails = $this->$methodName() ) { |
| 46 | 46 | return $carry.$this->implode( |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | { |
| 61 | 61 | $plugins = get_plugins(); |
| 62 | 62 | $activePlugins = (array)get_option( 'active_plugins', [] ); |
| 63 | - $inactive = array_diff_key( $plugins, array_flip( $activePlugins )); |
|
| 64 | - return $this->normalizePluginList( array_diff_key( $plugins, $inactive )); |
|
| 63 | + $inactive = array_diff_key( $plugins, array_flip( $activePlugins ) ); |
|
| 64 | + return $this->normalizePluginList( array_diff_key( $plugins, $inactive ) ); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | public function getInactivePluginDetails() |
| 96 | 96 | { |
| 97 | 97 | $activePlugins = (array)get_option( 'active_plugins', [] ); |
| 98 | - return $this->normalizePluginList( array_diff_key( get_plugins(), array_flip( $activePlugins ))); |
|
| 98 | + return $this->normalizePluginList( array_diff_key( get_plugins(), array_flip( $activePlugins ) ) ); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | { |
| 106 | 106 | $plugins = array_merge( |
| 107 | 107 | get_mu_plugins(), |
| 108 | - get_plugins( '/../'.basename( WPMU_PLUGIN_DIR )) |
|
| 108 | + get_plugins( '/../'.basename( WPMU_PLUGIN_DIR ) ) |
|
| 109 | 109 | ); |
| 110 | - if( empty( $plugins ))return; |
|
| 110 | + if( empty($plugins) )return; |
|
| 111 | 111 | return $this->normalizePluginList( $plugins ); |
| 112 | 112 | } |
| 113 | 113 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public function getMultisitePluginDetails() |
| 118 | 118 | { |
| 119 | - if( !is_multisite() || empty( get_site_option( 'active_sitewide_plugins', [] )))return; |
|
| 119 | + if( !is_multisite() || empty(get_site_option( 'active_sitewide_plugins', [] )) )return; |
|
| 120 | 120 | return $this->normalizePluginList( wp_get_active_network_plugins() ); |
| 121 | 121 | } |
| 122 | 122 | |
@@ -143,11 +143,11 @@ discard block |
||
| 143 | 143 | 'Max Input Vars' => ini_get( 'max_input_vars' ), |
| 144 | 144 | 'Memory Limit' => ini_get( 'memory_limit' ), |
| 145 | 145 | 'Post Max Size' => ini_get( 'post_max_size' ), |
| 146 | - 'Session Cookie Path' => esc_html( ini_get( 'session.cookie_path' )), |
|
| 147 | - 'Session Name' => esc_html( ini_get( 'session.name' )), |
|
| 148 | - 'Session Save Path' => esc_html( ini_get( 'session.save_path' )), |
|
| 149 | - 'Session Use Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_cookies' )), true ), |
|
| 150 | - 'Session Use Only Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_only_cookies' )), true ), |
|
| 146 | + 'Session Cookie Path' => esc_html( ini_get( 'session.cookie_path' ) ), |
|
| 147 | + 'Session Name' => esc_html( ini_get( 'session.name' ) ), |
|
| 148 | + 'Session Save Path' => esc_html( ini_get( 'session.save_path' ) ), |
|
| 149 | + 'Session Use Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_cookies' ) ), true ), |
|
| 150 | + 'Session Use Only Cookies' => var_export( wp_validate_boolean( ini_get( 'session.use_only_cookies' ) ), true ), |
|
| 151 | 151 | 'Upload Max Filesize' => ini_get( 'upload_max_filesize' ), |
| 152 | 152 | ]; |
| 153 | 153 | } |
@@ -159,8 +159,8 @@ discard block |
||
| 159 | 159 | { |
| 160 | 160 | $counts = glsr( CountsManager::class )->getCounts(); |
| 161 | 161 | $counts = glsr( Helper::class )->flattenArray( $counts ); |
| 162 | - array_walk( $counts, function( &$ratings ) use( $counts ) { |
|
| 163 | - if( !is_array( $ratings )) { |
|
| 162 | + array_walk( $counts, function( &$ratings ) use($counts) { |
|
| 163 | + if( !is_array( $ratings ) ) { |
|
| 164 | 164 | glsr_log() |
| 165 | 165 | ->error( '$ratings is not an array, possibly due to incorrectly imported reviews.' ) |
| 166 | 166 | ->debug( $ratings ) |
@@ -199,8 +199,8 @@ discard block |
||
| 199 | 199 | ksort( $settings ); |
| 200 | 200 | $details = []; |
| 201 | 201 | foreach( $settings as $key => $value ) { |
| 202 | - if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key ))continue; |
|
| 203 | - $value = htmlspecialchars( trim( preg_replace('/\s\s+/', '\\n', $value )), ENT_QUOTES, 'UTF-8' ); |
|
| 202 | + if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key ) )continue; |
|
| 203 | + $value = htmlspecialchars( trim( preg_replace( '/\s\s+/', '\\n', $value ) ), ENT_QUOTES, 'UTF-8' ); |
|
| 204 | 204 | $details[$key] = $value; |
| 205 | 205 | } |
| 206 | 206 | return $details; |
@@ -272,10 +272,10 @@ discard block |
||
| 272 | 272 | 'WPE_APIKEY' => 'WP Engine', |
| 273 | 273 | ]; |
| 274 | 274 | foreach( $checks as $key => $value ) { |
| 275 | - if( !$this->isWebhostCheckValid( $key ))continue; |
|
| 275 | + if( !$this->isWebhostCheckValid( $key ) )continue; |
|
| 276 | 276 | return $value; |
| 277 | 277 | } |
| 278 | - return implode( ',', array_filter( [DB_HOST, filter_input( INPUT_SERVER, 'SERVER_NAME' )] )); |
|
| 278 | + return implode( ',', array_filter( [DB_HOST, filter_input( INPUT_SERVER, 'SERVER_NAME' )] ) ); |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /** |
@@ -296,8 +296,8 @@ discard block |
||
| 296 | 296 | { |
| 297 | 297 | $plugins = get_plugins(); |
| 298 | 298 | $activePlugins = (array)get_option( 'active_plugins', [] ); |
| 299 | - $inactive = $this->normalizePluginList( array_diff_key( $plugins, array_flip( $activePlugins ))); |
|
| 300 | - $active = $this->normalizePluginList( array_diff_key( $plugins, $inactive )); |
|
| 299 | + $inactive = $this->normalizePluginList( array_diff_key( $plugins, array_flip( $activePlugins ) ) ); |
|
| 300 | + $active = $this->normalizePluginList( array_diff_key( $plugins, $inactive ) ); |
|
| 301 | 301 | return $active + $inactive; |
| 302 | 302 | } |
| 303 | 303 | |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | protected function implode( $title, array $details ) |
| 309 | 309 | { |
| 310 | 310 | $strings = ['['.$title.']']; |
| 311 | - $padding = max( array_map( 'strlen', array_keys( $details )) ); |
|
| 311 | + $padding = max( array_map( 'strlen', array_keys( $details ) ) ); |
|
| 312 | 312 | $padding = max( [$padding, static::PAD] ); |
| 313 | 313 | foreach( $details as $key => $value ) { |
| 314 | 314 | $strings[] = is_string( $key ) |
@@ -351,9 +351,9 @@ discard block |
||
| 351 | 351 | $keys = [ |
| 352 | 352 | 'licenses.', 'submissions.recaptcha.key', 'submissions.recaptcha.secret', |
| 353 | 353 | ]; |
| 354 | - array_walk( $settings, function( &$value, $setting ) use( $keys ) { |
|
| 354 | + array_walk( $settings, function( &$value, $setting ) use($keys) { |
|
| 355 | 355 | foreach( $keys as $key ) { |
| 356 | - if( !glsr( Helper::class )->startsWith( $key, $setting ) || empty( $value ))continue; |
|
| 356 | + if( !glsr( Helper::class )->startsWith( $key, $setting ) || empty($value) )continue; |
|
| 357 | 357 | $value = str_repeat( '•', 13 ); |
| 358 | 358 | return; |
| 359 | 359 | } |