| @@ -11,7 +11,9 @@ | ||
| 11 | 11 | */ | 
| 12 | 12 | public function handle( Command $command ) | 
| 13 | 13 |  	{ | 
| 14 | - if( in_array( $command->postType, get_post_types( ['_builtin' => true] )))return; | |
| 14 | +		if( in_array( $command->postType, get_post_types( ['_builtin' => true] ))) { | |
| 15 | + return; | |
| 16 | + } | |
| 15 | 17 | register_post_type( $command->postType, $command->args ); | 
| 16 | 18 | glsr()->postTypeColumns = wp_parse_args( glsr()->postTypeColumns, [ | 
| 17 | 19 | $command->postType => $command->columns, | 
| @@ -11,10 +11,10 @@ | ||
| 11 | 11 | */ | 
| 12 | 12 | public function handle( Command $command ) | 
| 13 | 13 |  	{ | 
| 14 | - if( in_array( $command->postType, get_post_types( ['_builtin' => true] )))return; | |
| 14 | + if( in_array( $command->postType, get_post_types( ['_builtin' => true] ) ) )return; | |
| 15 | 15 | register_post_type( $command->postType, $command->args ); | 
| 16 | 16 | glsr()->postTypeColumns = wp_parse_args( glsr()->postTypeColumns, [ | 
| 17 | 17 | $command->postType => $command->columns, | 
| 18 | - ]); | |
| 18 | + ] ); | |
| 19 | 19 | } | 
| 20 | 20 | } | 
| @@ -19,7 +19,9 @@ | ||
| 19 | 19 | */ | 
| 20 | 20 | public function registerPostType() | 
| 21 | 21 |  	{ | 
| 22 | - if( !glsr()->hasPermission() )return; | |
| 22 | +		if( !glsr()->hasPermission() ) { | |
| 23 | + return; | |
| 24 | + } | |
| 23 | 25 | $command = new RegisterPostType([ | 
| 24 | 26 | 'capabilities'=> ['create_posts' => 'create_'.Application::POST_TYPE], | 
| 25 | 27 | 'columns' => [ | 
| @@ -21,7 +21,7 @@ discard block | ||
| 21 | 21 | public function registerPostType() | 
| 22 | 22 |  	{ | 
| 23 | 23 | if( !glsr()->hasPermission() )return; | 
| 24 | - $command = new RegisterPostType([ | |
| 24 | + $command = new RegisterPostType( [ | |
| 25 | 25 | 'capabilities'=> ['create_posts' => 'create_'.Application::POST_TYPE], | 
| 26 | 26 | 'columns' => [ | 
| 27 | 27 | 'title' => '', | 
| @@ -41,7 +41,7 @@ discard block | ||
| 41 | 41 | 'rest_controller_class' => RestReviewController::class, | 
| 42 | 42 | 'show_in_rest' => true, | 
| 43 | 43 | 'single' => __( 'Review', 'site-reviews' ), | 
| 44 | - ]); | |
| 44 | + ] ); | |
| 45 | 45 | $this->execute( $command ); | 
| 46 | 46 | } | 
| 47 | 47 | |
| @@ -51,11 +51,11 @@ discard block | ||
| 51 | 51 | */ | 
| 52 | 52 | public function registerShortcodes() | 
| 53 | 53 |  	{ | 
| 54 | - $command = new RegisterShortcodes([ | |
| 54 | + $command = new RegisterShortcodes( [ | |
| 55 | 55 | 'site_reviews', | 
| 56 | 56 | 'site_reviews_form', | 
| 57 | 57 | 'site_reviews_summary', | 
| 58 | - ]); | |
| 58 | + ] ); | |
| 59 | 59 | $this->execute( $command ); | 
| 60 | 60 | } | 
| 61 | 61 | |
| @@ -65,7 +65,7 @@ discard block | ||
| 65 | 65 | */ | 
| 66 | 66 | public function registerTaxonomy() | 
| 67 | 67 |  	{ | 
| 68 | - $command = new RegisterTaxonomy([ | |
| 68 | + $command = new RegisterTaxonomy( [ | |
| 69 | 69 | 'hierarchical' => true, | 
| 70 | 70 | 'meta_box_cb' => [glsr( EditorController::class ), 'renderTaxonomyMetabox'], | 
| 71 | 71 | 'public' => false, | 
| @@ -73,7 +73,7 @@ discard block | ||
| 73 | 73 | 'show_admin_column' => true, | 
| 74 | 74 | 'show_in_rest' => true, | 
| 75 | 75 | 'show_ui' => true, | 
| 76 | - ]); | |
| 76 | + ] ); | |
| 77 | 77 | $this->execute( $command ); | 
| 78 | 78 | } | 
| 79 | 79 | |
| @@ -83,7 +83,7 @@ discard block | ||
| 83 | 83 | */ | 
| 84 | 84 | public function registerWidgets() | 
| 85 | 85 |  	{ | 
| 86 | - $command = new RegisterWidgets([ | |
| 86 | + $command = new RegisterWidgets( [ | |
| 87 | 87 | 'site-reviews' => [ | 
| 88 | 88 | 'class' => 'glsr-widget glsr-widget-site-reviews', | 
| 89 | 89 | 'description' => __( 'Your site’s most recent reviews.', 'site-reviews' ), | 
| @@ -99,7 +99,7 @@ discard block | ||
| 99 | 99 | 'description' => __( 'A summary of your site’s reviews.', 'site-reviews' ), | 
| 100 | 100 | 'title' => __( 'Summary of Reviews', 'site-reviews' ), | 
| 101 | 101 | ], | 
| 102 | - ]); | |
| 102 | + ] ); | |
| 103 | 103 | $this->execute( $command ); | 
| 104 | 104 | } | 
| 105 | 105 | } | 
| @@ -166,7 +166,9 @@ | ||
| 166 | 166 |  	{ | 
| 167 | 167 | $result = []; | 
| 168 | 168 |  		foreach( $array as $key => $value ) { | 
| 169 | - if( !$value )continue; | |
| 169 | +			if( !$value ) { | |
| 170 | + continue; | |
| 171 | + } | |
| 170 | 172 | $result[$key] = is_array( $value ) | 
| 171 | 173 | ? $this->removeEmptyArrayValues( $value ) | 
| 172 | 174 | : $value; | 
| @@ -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 | |
| @@ -89,7 +89,7 @@ discard block | ||
| 89 | 89 | */ | 
| 90 | 90 | public function convertPathToId( $path, $prefix = '' ) | 
| 91 | 91 |  	{ | 
| 92 | - return str_replace( ['[', ']'], ['-', ''], $this->convertPathToName( $path, $prefix )); | |
| 92 | + return str_replace( ['[', ']'], ['-', ''], $this->convertPathToName( $path, $prefix ) ); | |
| 93 | 93 | } | 
| 94 | 94 | |
| 95 | 95 | /** | 
| @@ -100,7 +100,7 @@ discard block | ||
| 100 | 100 |  	{ | 
| 101 | 101 | $levels = explode( '.', $path ); | 
| 102 | 102 |  		return array_reduce( $levels, function( $result, $value ) { | 
| 103 | - return $result.= '['.$value.']'; | |
| 103 | + return $result .= '['.$value.']'; | |
| 104 | 104 | }, $prefix ); | 
| 105 | 105 | } | 
| 106 | 106 | |
| @@ -111,7 +111,7 @@ discard block | ||
| 111 | 111 | */ | 
| 112 | 112 | public function convertStringToArray( $string, $callback = null ) | 
| 113 | 113 |  	{ | 
| 114 | - $array = array_map( 'trim', explode( ',', $string )); | |
| 114 | + $array = array_map( 'trim', explode( ',', $string ) ); | |
| 115 | 115 | return $callback | 
| 116 | 116 | ? array_filter( $array, $callback ) | 
| 117 | 117 | : array_filter( $array ); | 
| @@ -123,7 +123,7 @@ discard block | ||
| 123 | 123 | */ | 
| 124 | 124 | public function dashCase( $string ) | 
| 125 | 125 |  	{ | 
| 126 | - return str_replace( '_', '-', $this->snakeCase( $string )); | |
| 126 | + return str_replace( '_', '-', $this->snakeCase( $string ) ); | |
| 127 | 127 | } | 
| 128 | 128 | |
| 129 | 129 | /** | 
| @@ -137,7 +137,7 @@ discard block | ||
| 137 | 137 |  	{ | 
| 138 | 138 | $keys = explode( '.', $path ); | 
| 139 | 139 |  		foreach( $keys as $key ) { | 
| 140 | -			if( !isset( $data[$key] )) { | |
| 140 | +			if( !isset($data[$key]) ) { | |
| 141 | 141 | return $fallback; | 
| 142 | 142 | } | 
| 143 | 143 | $data = $data[$key]; | 
| @@ -183,11 +183,11 @@ discard block | ||
| 183 | 183 | */ | 
| 184 | 184 | public function filterInput( $key, array $request = [] ) | 
| 185 | 185 |  	{ | 
| 186 | -		if( isset( $request[$key] )) { | |
| 186 | +		if( isset($request[$key]) ) { | |
| 187 | 187 | return $request[$key]; | 
| 188 | 188 | } | 
| 189 | 189 | $variable = filter_input( INPUT_POST, $key ); | 
| 190 | -		if( is_null( $variable ) && isset( $_POST[$key] )) { | |
| 190 | +		if( is_null( $variable ) && isset($_POST[$key]) ) { | |
| 191 | 191 | $variable = $_POST[$key]; | 
| 192 | 192 | } | 
| 193 | 193 | return $variable; | 
| @@ -200,7 +200,7 @@ discard block | ||
| 200 | 200 | public function filterInputArray( $key ) | 
| 201 | 201 |  	{ | 
| 202 | 202 | $variable = filter_input( INPUT_POST, $key, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); | 
| 203 | -		if( empty( $variable ) && !empty( $_POST[$key] ) && is_array( $_POST[$key] )) { | |
| 203 | +		if( empty($variable) && !empty($_POST[$key]) && is_array( $_POST[$key] ) ) { | |
| 204 | 204 | $variable = $_POST[$key]; | 
| 205 | 205 | } | 
| 206 | 206 | return (array)$variable; | 
| @@ -216,13 +216,13 @@ discard block | ||
| 216 | 216 | $result = []; | 
| 217 | 217 |  		foreach( $array as $key => $value ) { | 
| 218 | 218 | $newKey = ltrim( $prefix.'.'.$key, '.' ); | 
| 219 | -			if( $this->isIndexedFlatArray( $value )) { | |
| 219 | +			if( $this->isIndexedFlatArray( $value ) ) { | |
| 220 | 220 |  				if( $flattenValue ) { | 
| 221 | 221 | $value = '['.implode( ', ', $value ).']'; | 
| 222 | 222 | } | 
| 223 | 223 | } | 
| 224 | -			else if( is_array( $value )) { | |
| 225 | - $result = array_merge( $result, $this->flattenArray( $value, $flattenValue, $newKey )); | |
| 224 | +			else if( is_array( $value ) ) { | |
| 225 | + $result = array_merge( $result, $this->flattenArray( $value, $flattenValue, $newKey ) ); | |
| 226 | 226 | continue; | 
| 227 | 227 | } | 
| 228 | 228 | $result[$newKey] = $value; | 
| @@ -244,7 +244,7 @@ discard block | ||
| 244 | 244 | Whip::IPV4 => $cloudflareIps['v4'], | 
| 245 | 245 | Whip::IPV6 => $ipv6, | 
| 246 | 246 | ], | 
| 247 | - ]))->getValidIpAddress(); | |
| 247 | + ] ))->getValidIpAddress(); | |
| 248 | 248 | } | 
| 249 | 249 | |
| 250 | 250 | /** | 
| @@ -254,14 +254,14 @@ discard block | ||
| 254 | 254 | */ | 
| 255 | 255 | public function insertInArray( array $array, array $insert, $key, $position = 'before' ) | 
| 256 | 256 |  	{ | 
| 257 | - $keyPosition = intval( array_search( $key, array_keys( $array ))); | |
| 257 | + $keyPosition = intval( array_search( $key, array_keys( $array ) ) ); | |
| 258 | 258 |  		if( 'after' == $position ) { | 
| 259 | 259 | $keyPosition++; | 
| 260 | 260 | } | 
| 261 | 261 |  		if( false !== $keyPosition ) { | 
| 262 | 262 | $result = array_slice( $array, 0, $keyPosition ); | 
| 263 | 263 | $result = array_merge( $result, $insert ); | 
| 264 | - return array_merge( $result, array_slice( $array, $keyPosition )); | |
| 264 | + return array_merge( $result, array_slice( $array, $keyPosition ) ); | |
| 265 | 265 | } | 
| 266 | 266 | return array_merge( $array, $insert ); | 
| 267 | 267 | } | 
| @@ -272,7 +272,7 @@ discard block | ||
| 272 | 272 | */ | 
| 273 | 273 | public function isIndexedFlatArray( $array ) | 
| 274 | 274 |  	{ | 
| 275 | -		if( !is_array( $array ) || array_filter( $array, 'is_array' )) { | |
| 275 | +		if( !is_array( $array ) || array_filter( $array, 'is_array' ) ) { | |
| 276 | 276 | return false; | 
| 277 | 277 | } | 
| 278 | 278 | return wp_is_numeric_array( $array ); | 
| @@ -285,7 +285,7 @@ discard block | ||
| 285 | 285 | */ | 
| 286 | 286 | public function prefixString( $string, $prefix = '' ) | 
| 287 | 287 |  	{ | 
| 288 | - return $prefix.str_replace( $prefix, '', trim( $string )); | |
| 288 | + return $prefix.str_replace( $prefix, '', trim( $string ) ); | |
| 289 | 289 | } | 
| 290 | 290 | |
| 291 | 291 | /** | 
| @@ -311,7 +311,7 @@ discard block | ||
| 311 | 311 | public function removePrefix( $prefix, $text ) | 
| 312 | 312 |  	{ | 
| 313 | 313 | return 0 === strpos( $text, $prefix ) | 
| 314 | - ? substr( $text, strlen( $prefix )) | |
| 314 | + ? substr( $text, strlen( $prefix ) ) | |
| 315 | 315 | : $text; | 
| 316 | 316 | } | 
| 317 | 317 | |
| @@ -321,7 +321,7 @@ discard block | ||
| 321 | 321 | */ | 
| 322 | 322 | public function snakeCase( $string ) | 
| 323 | 323 |  	{ | 
| 324 | -		if( !ctype_lower( $string )) { | |
| 324 | +		if( !ctype_lower( $string ) ) { | |
| 325 | 325 | $string = preg_replace( '/\s+/u', '', $string ); | 
| 326 | 326 | $string = preg_replace( '/(.)(?=[A-Z])/u', '$1_', $string ); | 
| 327 | 327 | $string = function_exists( 'mb_strtolower' ) | 
| @@ -338,6 +338,6 @@ discard block | ||
| 338 | 338 | */ | 
| 339 | 339 | public function startsWith( $needle, $haystack ) | 
| 340 | 340 |  	{ | 
| 341 | - return substr( $haystack, 0, strlen( $needle )) === $needle; | |
| 341 | + return substr( $haystack, 0, strlen( $needle ) ) === $needle; | |
| 342 | 342 | } | 
| 343 | 343 | } | 
| @@ -113,7 +113,7 @@ | ||
| 113 | 113 | } | 
| 114 | 114 | |
| 115 | 115 | /** | 
| 116 | - * Bind a singleton instance to the container | |
| 116 | + * Bind a singleton instance to the container | |
| 117 | 117 | * @param string $alias | 
| 118 | 118 | * @param callable|string|null $binding | 
| 119 | 119 | * @return void | 
| @@ -37,7 +37,7 @@ discard block | ||
| 37 | 37 | */ | 
| 38 | 38 | public static function load() | 
| 39 | 39 |  	{ | 
| 40 | -		if( empty( static::$instance )) { | |
| 40 | +		if( empty(static::$instance) ) { | |
| 41 | 41 | static::$instance = new static; | 
| 42 | 42 | } | 
| 43 | 43 | return static::$instance; | 
| @@ -49,11 +49,11 @@ discard block | ||
| 49 | 49 | */ | 
| 50 | 50 | public function __get( $property ) | 
| 51 | 51 |  	{ | 
| 52 | -		if( property_exists( $this, $property ) && !in_array( $property, static::PROTECTED_PROPERTIES )) { | |
| 52 | +		if( property_exists( $this, $property ) && !in_array( $property, static::PROTECTED_PROPERTIES ) ) { | |
| 53 | 53 | return $this->$property; | 
| 54 | 54 | } | 
| 55 | - $constant = 'static::'.strtoupper( $this->make( Helper::class )->snakeCase( $property )); | |
| 56 | -		if( defined( $constant )) { | |
| 55 | + $constant = 'static::'.strtoupper( $this->make( Helper::class )->snakeCase( $property ) ); | |
| 56 | +		if( defined( $constant ) ) { | |
| 57 | 57 | return constant( $constant ); | 
| 58 | 58 | } | 
| 59 | 59 | return glsr_get( $this->storage, $property, null ); | 
| @@ -66,14 +66,14 @@ discard block | ||
| 66 | 66 | */ | 
| 67 | 67 | public function __set( $property, $value ) | 
| 68 | 68 |  	{ | 
| 69 | -		if( !property_exists( $this, $property ) || in_array( $property, static::PROTECTED_PROPERTIES )) { | |
| 69 | +		if( !property_exists( $this, $property ) || in_array( $property, static::PROTECTED_PROPERTIES ) ) { | |
| 70 | 70 | $this->storage[$property] = $value; | 
| 71 | 71 | } | 
| 72 | -		else if( !isset( $this->$property )) { | |
| 72 | +		else if( !isset($this->$property) ) { | |
| 73 | 73 | $this->$property = $value; | 
| 74 | 74 | } | 
| 75 | 75 |  		else { | 
| 76 | - throw new Exception( sprintf( 'The "%s" property cannot be changed once set.', $property )); | |
| 76 | + throw new Exception( sprintf( 'The "%s" property cannot be changed once set.', $property ) ); | |
| 77 | 77 | } | 
| 78 | 78 | } | 
| 79 | 79 | |
| @@ -95,16 +95,16 @@ discard block | ||
| 95 | 95 | */ | 
| 96 | 96 | public function make( $abstract ) | 
| 97 | 97 |  	{ | 
| 98 | -		if( !isset( $this->services[$abstract] )) { | |
| 98 | +		if( !isset($this->services[$abstract]) ) { | |
| 99 | 99 | $abstract = $this->addNamespace( $abstract ); | 
| 100 | 100 | } | 
| 101 | -		if( isset( $this->services[$abstract] )) { | |
| 101 | +		if( isset($this->services[$abstract]) ) { | |
| 102 | 102 | $abstract = $this->services[$abstract]; | 
| 103 | 103 | } | 
| 104 | -		if( is_callable( $abstract )) { | |
| 104 | +		if( is_callable( $abstract ) ) { | |
| 105 | 105 | return call_user_func_array( $abstract, [$this] ); | 
| 106 | 106 | } | 
| 107 | -		if( is_object( $abstract )) { | |
| 107 | +		if( is_object( $abstract ) ) { | |
| 108 | 108 | return $abstract; | 
| 109 | 109 | } | 
| 110 | 110 | return $this->resolve( $abstract ); | 
| @@ -118,7 +118,7 @@ discard block | ||
| 118 | 118 | */ | 
| 119 | 119 | public function singleton( $alias, $binding ) | 
| 120 | 120 |  	{ | 
| 121 | - $this->bind( $alias, $this->make( $binding )); | |
| 121 | + $this->bind( $alias, $this->make( $binding ) ); | |
| 122 | 122 | } | 
| 123 | 123 | |
| 124 | 124 | /** | 
| @@ -128,7 +128,7 @@ discard block | ||
| 128 | 128 | */ | 
| 129 | 129 | protected function addNamespace( $abstract ) | 
| 130 | 130 |  	{ | 
| 131 | -		if( strpos( $abstract, __NAMESPACE__ ) === false && !class_exists( $abstract )) { | |
| 131 | +		if( strpos( $abstract, __NAMESPACE__ ) === false && !class_exists( $abstract ) ) { | |
| 132 | 132 | $abstract = __NAMESPACE__.'\\'.$abstract; | 
| 133 | 133 | } | 
| 134 | 134 | return $abstract; | 
| @@ -150,7 +150,7 @@ discard block | ||
| 150 | 150 | throw new Exception( 'Target ['.$concrete.'] is not instantiable.' ); | 
| 151 | 151 | } | 
| 152 | 152 | $constructor = $reflector->getConstructor(); | 
| 153 | -		if( empty( $constructor )) { | |
| 153 | +		if( empty($constructor) ) { | |
| 154 | 154 | return new $concrete; | 
| 155 | 155 | } | 
| 156 | 156 | return $reflector->newInstanceArgs( | 
| @@ -76,7 +76,9 @@ discard block | ||
| 76 | 76 | $args = shortcode_atts( $this->getDefaults(), wp_parse_args( $args )); | 
| 77 | 77 |  		array_walk( $args, function( &$value, $key ) { | 
| 78 | 78 | $methodName = glsr( Helper::class )->buildMethodName( $key, 'normalize' ); | 
| 79 | - if( !method_exists( $this, $methodName ))return; | |
| 79 | +			if( !method_exists( $this, $methodName )) { | |
| 80 | + return; | |
| 81 | + } | |
| 80 | 82 | $value = $this->$methodName( $value ); | 
| 81 | 83 | }); | 
| 82 | 84 | return $this->sanitize( $args ); | 
| @@ -141,7 +143,9 @@ discard block | ||
| 141 | 143 | $defaults = array_pad( $defaults, Rating::MAX_RATING, '' ); | 
| 142 | 144 | $labels = array_map( 'trim', explode( ',', $labels )); | 
| 143 | 145 |  		foreach( $defaults as $i => $label ) { | 
| 144 | - if( empty( $labels[$i] ))continue; | |
| 146 | +			if( empty( $labels[$i] )) { | |
| 147 | + continue; | |
| 148 | + } | |
| 145 | 149 | $defaults[$i] = $labels[$i]; | 
| 146 | 150 | } | 
| 147 | 151 | return array_combine( range( Rating::MAX_RATING, 1 ), $defaults ); | 
| @@ -23,11 +23,11 @@ discard block | ||
| 23 | 23 | 'after_widget' => '</div>', | 
| 24 | 24 | 'before_title' => '<h3 class="glsr-'.$type.'-title">', | 
| 25 | 25 | 'after_title' => '</h3>', | 
| 26 | - ]); | |
| 26 | + ] ); | |
| 27 | 27 | $args = apply_filters( 'site-reviews/shortcode/args', $args, $type, $shortcodePartial ); | 
| 28 | 28 | $instance = $this->normalize( $instance ); | 
| 29 | 29 | $partial = glsr( Partial::class )->build( $shortcodePartial, $instance ); | 
| 30 | -		if( !empty( $instance['title'] )) { | |
| 30 | +		if( !empty($instance['title']) ) { | |
| 31 | 31 | $instance['title'] = $args['before_title'].$instance['title'].$args['after_title']; | 
| 32 | 32 | } | 
| 33 | 33 | return $args['before_widget'].$instance['title'].$partial.$args['after_widget']; | 
| @@ -90,10 +90,10 @@ discard block | ||
| 90 | 90 | */ | 
| 91 | 91 | public function normalize( $args ) | 
| 92 | 92 |  	{ | 
| 93 | - $args = shortcode_atts( $this->getDefaults(), wp_parse_args( $args )); | |
| 93 | + $args = shortcode_atts( $this->getDefaults(), wp_parse_args( $args ) ); | |
| 94 | 94 |  		array_walk( $args, function( &$value, $key ) { | 
| 95 | 95 | $methodName = glsr( Helper::class )->buildMethodName( $key, 'normalize' ); | 
| 96 | - if( !method_exists( $this, $methodName ))return; | |
| 96 | + if( !method_exists( $this, $methodName ) )return; | |
| 97 | 97 | $value = $this->$methodName( $value ); | 
| 98 | 98 | }); | 
| 99 | 99 | return $this->sanitize( $args ); | 
| @@ -111,7 +111,7 @@ discard block | ||
| 111 | 111 | protected function normalizeAssignedTo( $postId ) | 
| 112 | 112 |  	{ | 
| 113 | 113 |  		if( $postId == 'parent_id' ) { | 
| 114 | - $postId = intval( wp_get_post_parent_id( intval( get_the_ID() ))); | |
| 114 | + $postId = intval( wp_get_post_parent_id( intval( get_the_ID() ) ) ); | |
| 115 | 115 | } | 
| 116 | 116 |  		else if( $postId == 'post_id' ) { | 
| 117 | 117 | $postId = intval( get_the_ID() ); | 
| @@ -134,11 +134,11 @@ discard block | ||
| 134 | 134 | */ | 
| 135 | 135 | protected function normalizeHide( $hide ) | 
| 136 | 136 |  	{ | 
| 137 | -		if( is_string( $hide )) { | |
| 137 | +		if( is_string( $hide ) ) { | |
| 138 | 138 | $hide = explode( ',', $hide ); | 
| 139 | 139 | } | 
| 140 | 140 | $hideKeys = array_keys( $this->getHideOptions() ); | 
| 141 | -		return array_filter( array_map( 'trim', $hide ), function( $value ) use( $hideKeys ) { | |
| 141 | +		return array_filter( array_map( 'trim', $hide ), function( $value ) use($hideKeys) { | |
| 142 | 142 | return in_array( $value, $hideKeys ); | 
| 143 | 143 | }); | 
| 144 | 144 | } | 
| @@ -166,9 +166,9 @@ discard block | ||
| 166 | 166 | __( 'Terrible', 'site-reviews' ), | 
| 167 | 167 | ]; | 
| 168 | 168 | $defaults = array_pad( $defaults, Rating::MAX_RATING, '' ); | 
| 169 | - $labels = array_map( 'trim', explode( ',', $labels )); | |
| 169 | + $labels = array_map( 'trim', explode( ',', $labels ) ); | |
| 170 | 170 |  		foreach( $defaults as $i => $label ) { | 
| 171 | - if( empty( $labels[$i] ))continue; | |
| 171 | + if( empty($labels[$i]) )continue; | |
| 172 | 172 | $defaults[$i] = $labels[$i]; | 
| 173 | 173 | } | 
| 174 | 174 | return array_combine( range( Rating::MAX_RATING, 1 ), $defaults ); | 
| @@ -29,7 +29,9 @@ | ||
| 29 | 29 |  	{ | 
| 30 | 30 |  		foreach( $args as $key => $value ) { | 
| 31 | 31 | $property = glsr( Helper::class )->buildPropertyName( $key ); | 
| 32 | - if( !property_exists( $this, $property ))continue; | |
| 32 | +			if( !property_exists( $this, $property )) { | |
| 33 | + continue; | |
| 34 | + } | |
| 33 | 35 | $this->$property = $value; | 
| 34 | 36 | unset( $args[$key] ); | 
| 35 | 37 | } | 
| @@ -30,13 +30,13 @@ discard block | ||
| 30 | 30 |  	{ | 
| 31 | 31 |  		foreach( $args as $key => $value ) { | 
| 32 | 32 | $property = glsr( Helper::class )->buildPropertyName( $key ); | 
| 33 | - if( !property_exists( $this, $property ))continue; | |
| 33 | + if( !property_exists( $this, $property ) )continue; | |
| 34 | 34 | $this->$property = $value; | 
| 35 | - unset( $args[$key] ); | |
| 35 | + unset($args[$key]); | |
| 36 | 36 | } | 
| 37 | 37 | $this->args = wp_parse_args( $args, [ | 
| 38 | 38 | 'menu_name' => $this->plural, | 
| 39 | - ]); | |
| 39 | + ] ); | |
| 40 | 40 | } | 
| 41 | 41 | |
| 42 | 42 | /** | 
| @@ -59,8 +59,8 @@ discard block | ||
| 59 | 59 | 'singular_name' => $this->single, | 
| 60 | 60 | 'uploaded_to_this_item' => sprintf( _x( 'Uploaded to this %s', 'Uploaded to this Post', 'site-reviews' ), $this->single ), | 
| 61 | 61 | 'view_item' => sprintf( _x( 'View %s', 'View Post', 'site-reviews' ), $this->single ), | 
| 62 | - ]); | |
| 63 | - unset( $this->args['menu_name'] ); | |
| 62 | + ] ); | |
| 63 | + unset($this->args['menu_name']); | |
| 64 | 64 | } | 
| 65 | 65 | |
| 66 | 66 | /** | 
| @@ -69,12 +69,12 @@ discard block | ||
| 69 | 69 | protected function normalizeColumns() | 
| 70 | 70 |  	{ | 
| 71 | 71 | $this->columns = ['cb' => ''] + $this->columns; | 
| 72 | -		if( array_key_exists( 'category', $this->columns )) { | |
| 72 | +		if( array_key_exists( 'category', $this->columns ) ) { | |
| 73 | 73 | $keys = array_keys( $this->columns ); | 
| 74 | 74 | $keys[array_search( 'category', $keys )] = 'taxonomy-'.Application::TAXONOMY; | 
| 75 | 75 | $this->columns = array_combine( $keys, $this->columns ); | 
| 76 | 76 | } | 
| 77 | -		if( array_key_exists( 'pinned', $this->columns )) { | |
| 77 | +		if( array_key_exists( 'pinned', $this->columns ) ) { | |
| 78 | 78 | $this->columns['pinned'] = glsr( Builder::class )->span( '<span>'.$this->columns['pinned'].'</span>', | 
| 79 | 79 | ['class' => 'pinned-icon'] | 
| 80 | 80 | ); | 
| @@ -15,7 +15,9 @@ discard block | ||
| 15 | 15 | */ | 
| 16 | 16 | public function add( $type, $message, array $args = [] ) | 
| 17 | 17 |  	{ | 
| 18 | - if( empty( array_filter( [$message, $type] )))return; | |
| 18 | +		if( empty( array_filter( [$message, $type] ))) { | |
| 19 | + return; | |
| 20 | + } | |
| 19 | 21 | $args['message'] = $message; | 
| 20 | 22 | $args['type'] = $type; | 
| 21 | 23 | add_settings_error( Application::ID, '', json_encode( $this->normalize( $args ))); | 
| @@ -56,7 +58,9 @@ discard block | ||
| 56 | 58 | $notices = array_map( 'unserialize', | 
| 57 | 59 | array_unique( array_map( 'serialize', get_settings_errors( Application::ID ))) | 
| 58 | 60 | ); | 
| 59 | - if( empty( $notices ))return; | |
| 61 | +		if( empty( $notices )) { | |
| 62 | + return; | |
| 63 | + } | |
| 60 | 64 |  		return array_reduce( $notices, function( $carry, $notice ) { | 
| 61 | 65 | return $carry.$this->buildNotice( json_decode( $notice['message'], true )); | 
| 62 | 66 | }); | 
| @@ -15,10 +15,10 @@ discard block | ||
| 15 | 15 | */ | 
| 16 | 16 | public function add( $type, $message, array $args = [] ) | 
| 17 | 17 |  	{ | 
| 18 | - if( empty( array_filter( [$message, $type] )))return; | |
| 18 | + if( empty(array_filter( [$message, $type] )) )return; | |
| 19 | 19 | $args['message'] = $message; | 
| 20 | 20 | $args['type'] = $type; | 
| 21 | - add_settings_error( Application::ID, '', json_encode( $this->normalize( $args ))); | |
| 21 | + add_settings_error( Application::ID, '', json_encode( $this->normalize( $args ) ) ); | |
| 22 | 22 | } | 
| 23 | 23 | |
| 24 | 24 | /** | 
| @@ -54,11 +54,11 @@ discard block | ||
| 54 | 54 | public function get() | 
| 55 | 55 |  	{ | 
| 56 | 56 | $notices = array_map( 'unserialize', | 
| 57 | - array_unique( array_map( 'serialize', get_settings_errors( Application::ID ))) | |
| 57 | + array_unique( array_map( 'serialize', get_settings_errors( Application::ID ) ) ) | |
| 58 | 58 | ); | 
| 59 | - if( empty( $notices ))return; | |
| 59 | + if( empty($notices) )return; | |
| 60 | 60 |  		return array_reduce( $notices, function( $carry, $notice ) { | 
| 61 | - return $carry.$this->buildNotice( json_decode( $notice['message'], true )); | |
| 61 | + return $carry.$this->buildNotice( json_decode( $notice['message'], true ) ); | |
| 62 | 62 | }); | 
| 63 | 63 | } | 
| 64 | 64 | |
| @@ -79,7 +79,7 @@ discard block | ||
| 79 | 79 | } | 
| 80 | 80 | return glsr( Builder::class )->div( $messages, [ | 
| 81 | 81 | 'class' => $class, | 
| 82 | - ]); | |
| 82 | + ] ); | |
| 83 | 83 | } | 
| 84 | 84 | |
| 85 | 85 | /** | 
| @@ -94,13 +94,13 @@ discard block | ||
| 94 | 94 | 'type' => '', | 
| 95 | 95 | ]; | 
| 96 | 96 | $args = shortcode_atts( $defaults, $args ); | 
| 97 | -		if( !in_array( $args['type'], ['error', 'warning', 'success'] )) { | |
| 97 | +		if( !in_array( $args['type'], ['error', 'warning', 'success'] ) ) { | |
| 98 | 98 | $args['type'] = 'success'; | 
| 99 | 99 | } | 
| 100 | 100 | $args['messages'] = is_wp_error( $args['message'] ) | 
| 101 | 101 | ? (array)$args['message']->get_error_message() | 
| 102 | 102 | : (array)$args['message']; | 
| 103 | - unset( $args['message'] ); | |
| 103 | + unset($args['message']); | |
| 104 | 104 | return $args; | 
| 105 | 105 | } | 
| 106 | 106 | } | 
| @@ -30,7 +30,9 @@ discard block | ||
| 30 | 30 | // 'is_test' => 1, | 
| 31 | 31 | ]; | 
| 32 | 32 |  		foreach( $_SERVER as $key => $value ) { | 
| 33 | - if( is_array( $value ) || in_array( $key, ['HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW'] ))continue; | |
| 33 | +			if( is_array( $value ) || in_array( $key, ['HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW'] )) { | |
| 34 | + continue; | |
| 35 | + } | |
| 34 | 36 | $submission[$key] = $value; | 
| 35 | 37 | } | 
| 36 | 38 | return $this->check( apply_filters( 'site-reviews/akismet/submission', $submission, $review )); | 
| @@ -56,12 +58,16 @@ discard block | ||
| 56 | 58 |  	{ | 
| 57 | 59 | $query = []; | 
| 58 | 60 |  		foreach( $data as $key => $value ) { | 
| 59 | - if( is_array( $value ) || is_object( $value ))continue; | |
| 61 | +			if( is_array( $value ) || is_object( $value )) { | |
| 62 | + continue; | |
| 63 | + } | |
| 60 | 64 |  			if( $value === false ) { | 
| 61 | 65 | $value = '0'; | 
| 62 | 66 | } | 
| 63 | 67 | $value = trim( $value ); | 
| 64 | - if( !strlen( $value ))continue; | |
| 68 | +			if( !strlen( $value )) { | |
| 69 | + continue; | |
| 70 | + } | |
| 65 | 71 | $query[] = urlencode( $key ).'='.urlencode( $value ); | 
| 66 | 72 | } | 
| 67 | 73 | return implode( '&', $query ); | 
| @@ -31,10 +31,10 @@ discard block | ||
| 31 | 31 | // 'is_test' => 1, | 
| 32 | 32 | ]; | 
| 33 | 33 |  		foreach( $_SERVER as $key => $value ) { | 
| 34 | - if( is_array( $value ) || in_array( $key, ['HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW'] ))continue; | |
| 34 | + if( is_array( $value ) || in_array( $key, ['HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW'] ) )continue; | |
| 35 | 35 | $submission[$key] = $value; | 
| 36 | 36 | } | 
| 37 | - return $this->check( apply_filters( 'site-reviews/akismet/submission', $submission, $review )); | |
| 37 | + return $this->check( apply_filters( 'site-reviews/akismet/submission', $submission, $review ) ); | |
| 38 | 38 | } | 
| 39 | 39 | |
| 40 | 40 | /** | 
| @@ -57,12 +57,12 @@ discard block | ||
| 57 | 57 |  	{ | 
| 58 | 58 | $query = []; | 
| 59 | 59 |  		foreach( $data as $key => $value ) { | 
| 60 | - if( is_array( $value ) || is_object( $value ))continue; | |
| 60 | + if( is_array( $value ) || is_object( $value ) )continue; | |
| 61 | 61 |  			if( $value === false ) { | 
| 62 | 62 | $value = '0'; | 
| 63 | 63 | } | 
| 64 | 64 | $value = trim( $value ); | 
| 65 | - if( !strlen( $value ))continue; | |
| 65 | + if( !strlen( $value ) )continue; | |
| 66 | 66 | $query[] = urlencode( $key ).'='.urlencode( $value ); | 
| 67 | 67 | } | 
| 68 | 68 | return implode( '&', $query ); | 
| @@ -77,7 +77,7 @@ discard block | ||
| 77 | 77 | || !is_callable( ['Akismet', 'get_api_key'] ) | 
| 78 | 78 | || !is_callable( ['Akismet', 'http_post'] ) | 
| 79 | 79 | ? false | 
| 80 | - : (bool) AkismetPlugin::get_api_key(); | |
| 80 | + : (bool)AkismetPlugin::get_api_key(); | |
| 81 | 81 | return apply_filters( 'site-reviews/akismet/is-active', $check ); | 
| 82 | 82 | } | 
| 83 | 83 | } | 
| @@ -15,13 +15,13 @@ discard block | ||
| 15 | 15 | public function __construct( $idBase, $name, $values ) | 
| 16 | 16 |  	{ | 
| 17 | 17 | $controlOptions = $widgetOptions = []; | 
| 18 | -		if( isset( $values['class'] )) { | |
| 18 | +		if( isset($values['class']) ) { | |
| 19 | 19 | $widgetOptions['classname'] = $values['class']; | 
| 20 | 20 | } | 
| 21 | -		if( isset( $values['description'] )) { | |
| 21 | +		if( isset($values['description']) ) { | |
| 22 | 22 | $widgetOptions['description'] = $values['description']; | 
| 23 | 23 | } | 
| 24 | -		if( isset( $values['width'] )) { | |
| 24 | +		if( isset($values['width']) ) { | |
| 25 | 25 | $controlOptions['width'] = $values['width']; | 
| 26 | 26 | } | 
| 27 | 27 | parent::__construct( $idBase, $name, $widgetOptions, $controlOptions ); | 
| @@ -34,10 +34,10 @@ discard block | ||
| 34 | 34 | protected function renderField( $tag, array $args = [] ) | 
| 35 | 35 |  	{ | 
| 36 | 36 | $args = $this->normalizeFieldAttributes( $tag, $args ); | 
| 37 | -		$field = glsr( Builder::class )->{$tag}( $args['name'], $args ); | |
| 37 | +		$field = glsr( Builder::class )->{$tag}($args['name'], $args); | |
| 38 | 38 | echo glsr( Builder::class )->div( $field, [ | 
| 39 | 39 | 'class' => 'glsr-field', | 
| 40 | - ]); | |
| 40 | + ] ); | |
| 41 | 41 | } | 
| 42 | 42 | |
| 43 | 43 | /** | 
| @@ -46,10 +46,10 @@ discard block | ||
| 46 | 46 | */ | 
| 47 | 47 | protected function normalizeFieldAttributes( $tag, array $args ) | 
| 48 | 48 |  	{ | 
| 49 | -		if( empty( $args['value'] )) { | |
| 49 | +		if( empty($args['value']) ) { | |
| 50 | 50 | $args['value'] = $this->widgetArgs[$args['name']]; | 
| 51 | 51 | } | 
| 52 | -		if( empty( $this->widgetArgs['options'] ) && in_array( $tag, ['checkbox', 'radio'] )) { | |
| 52 | +		if( empty($this->widgetArgs['options']) && in_array( $tag, ['checkbox', 'radio'] ) ) { | |
| 53 | 53 | $args['checked'] = in_array( $args['value'], (array)$this->widgetArgs[$args['name']] ); | 
| 54 | 54 | } | 
| 55 | 55 | $args['id'] = $this->get_field_id( $args['name'] ); |