| @@ -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' => [ | 
| @@ -19,7 +19,7 @@ discard block | ||
| 19 | 19 | public function registerPostType() | 
| 20 | 20 |  	{ | 
| 21 | 21 | if( !glsr()->hasPermission() )return; | 
| 22 | - $command = new RegisterPostType([ | |
| 22 | + $command = new RegisterPostType( [ | |
| 23 | 23 | 'capabilities'=> ['create_posts' => 'create_'.Application::POST_TYPE], | 
| 24 | 24 | 'columns' => [ | 
| 25 | 25 | 'title' => '', | 
| @@ -37,7 +37,7 @@ discard block | ||
| 37 | 37 | 'plural' => __( 'Reviews', 'site-reviews' ), | 
| 38 | 38 | 'post_type' => Application::POST_TYPE, | 
| 39 | 39 | 'single' => __( 'Review', 'site-reviews' ), | 
| 40 | - ]); | |
| 40 | + ] ); | |
| 41 | 41 | $this->execute( $command ); | 
| 42 | 42 | } | 
| 43 | 43 | |
| @@ -47,11 +47,11 @@ discard block | ||
| 47 | 47 | */ | 
| 48 | 48 | public function registerShortcodes() | 
| 49 | 49 |  	{ | 
| 50 | - $command = new RegisterShortcodes([ | |
| 50 | + $command = new RegisterShortcodes( [ | |
| 51 | 51 | 'site_reviews', | 
| 52 | 52 | 'site_reviews_form', | 
| 53 | 53 | 'site_reviews_summary', | 
| 54 | - ]); | |
| 54 | + ] ); | |
| 55 | 55 | $this->execute( $command ); | 
| 56 | 56 | } | 
| 57 | 57 | |
| @@ -61,13 +61,13 @@ discard block | ||
| 61 | 61 | */ | 
| 62 | 62 | public function registerTaxonomy() | 
| 63 | 63 |  	{ | 
| 64 | - $command = new RegisterTaxonomy([ | |
| 64 | + $command = new RegisterTaxonomy( [ | |
| 65 | 65 | 'hierarchical' => true, | 
| 66 | 66 | 'meta_box_cb' => [glsr( EditorController::class ), 'renderTaxonomyMetabox'], | 
| 67 | 67 | 'public' => false, | 
| 68 | 68 | 'show_admin_column' => true, | 
| 69 | 69 | 'show_ui' => true, | 
| 70 | - ]); | |
| 70 | + ] ); | |
| 71 | 71 | $this->execute( $command ); | 
| 72 | 72 | } | 
| 73 | 73 | |
| @@ -77,7 +77,7 @@ discard block | ||
| 77 | 77 | */ | 
| 78 | 78 | public function registerWidgets() | 
| 79 | 79 |  	{ | 
| 80 | - $command = new RegisterWidgets([ | |
| 80 | + $command = new RegisterWidgets( [ | |
| 81 | 81 | 'site-reviews' => [ | 
| 82 | 82 | 'class' => 'glsr-widget glsr-widget-site-reviews', | 
| 83 | 83 | 'description' => __( 'Your site’s most recent reviews.', 'site-reviews' ), | 
| @@ -93,7 +93,7 @@ discard block | ||
| 93 | 93 | 'description' => __( 'A summary of your site’s reviews.', 'site-reviews' ), | 
| 94 | 94 | 'title' => __( 'Summary of Reviews', 'site-reviews' ), | 
| 95 | 95 | ], | 
| 96 | - ]); | |
| 96 | + ] ); | |
| 97 | 97 | $this->execute( $command ); | 
| 98 | 98 | } | 
| 99 | 99 | } | 
| @@ -20,7 +20,9 @@ discard block | ||
| 20 | 20 |  	{ | 
| 21 | 21 | global $menu, $typenow; | 
| 22 | 22 |  		foreach( $menu as $key => $value ) { | 
| 23 | - if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; | |
| 23 | +			if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE ) { | |
| 24 | + continue; | |
| 25 | + } | |
| 24 | 26 | $postCount = wp_count_posts( Application::POST_TYPE ); | 
| 25 | 27 | $pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [ | 
| 26 | 28 | 'class' => 'pending-count', | 
| @@ -52,7 +54,9 @@ discard block | ||
| 52 | 54 |  		foreach( $pages as $slug => $title ) { | 
| 53 | 55 | $method = glsr( Helper::class )->buildMethodName( 'render-'.$slug.'-menu' ); | 
| 54 | 56 | $callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug ); | 
| 55 | - if( !is_callable( $callback ))continue; | |
| 57 | +			if( !is_callable( $callback )) { | |
| 58 | + continue; | |
| 59 | + } | |
| 56 | 60 | add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, Application::CAPABILITY, $slug, $callback ); | 
| 57 | 61 | } | 
| 58 | 62 | } | 
| @@ -21,17 +21,17 @@ discard block | ||
| 21 | 21 |  	{ | 
| 22 | 22 | global $menu, $typenow; | 
| 23 | 23 |  		foreach( $menu as $key => $value ) { | 
| 24 | - if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; | |
| 24 | + if( !isset($value[2]) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; | |
| 25 | 25 | $postCount = wp_count_posts( Application::POST_TYPE ); | 
| 26 | 26 | $pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [ | 
| 27 | 27 | 'class' => 'pending-count', | 
| 28 | - ]); | |
| 28 | + ] ); | |
| 29 | 29 | $awaitingModeration = glsr( Builder::class )->span( $pendingCount, [ | 
| 30 | 30 | 'class' => 'awaiting-mod count-'.$postCount->pending, | 
| 31 | - ]); | |
| 31 | + ] ); | |
| 32 | 32 | $menu[$key][0] .= ' '.$awaitingModeration; | 
| 33 | 33 |  			if( $typenow === Application::POST_TYPE ) { | 
| 34 | - $menu[$key][4].= ' current'; | |
| 34 | + $menu[$key][4] .= ' current'; | |
| 35 | 35 | } | 
| 36 | 36 | break; | 
| 37 | 37 | } | 
| @@ -48,11 +48,11 @@ discard block | ||
| 48 | 48 | 'tools' => __( 'Tools', 'site-reviews' ), | 
| 49 | 49 | 'addons' => __( 'Addons', 'site-reviews' ), | 
| 50 | 50 | 'documentation' => __( 'Documentation', 'site-reviews' ), | 
| 51 | - ]); | |
| 51 | + ] ); | |
| 52 | 52 |  		foreach( $pages as $slug => $title ) { | 
| 53 | 53 | $method = glsr( Helper::class )->buildMethodName( 'render-'.$slug.'-menu' ); | 
| 54 | 54 | $callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug ); | 
| 55 | - if( !is_callable( $callback ))continue; | |
| 55 | + if( !is_callable( $callback ) )continue; | |
| 56 | 56 | add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, Application::CAPABILITY, $slug, $callback ); | 
| 57 | 57 | } | 
| 58 | 58 | } | 
| @@ -66,7 +66,7 @@ discard block | ||
| 66 | 66 |  	{ | 
| 67 | 67 | $this->renderPage( 'addons', [ | 
| 68 | 68 | 'template' => glsr( Template::class ), | 
| 69 | - ]); | |
| 69 | + ] ); | |
| 70 | 70 | } | 
| 71 | 71 | |
| 72 | 72 | /** | 
| @@ -82,10 +82,10 @@ discard block | ||
| 82 | 82 | 'shortcodes' => __( 'Shortcodes', 'site-reviews' ), | 
| 83 | 83 | 'hooks' => __( 'Hooks', 'site-reviews' ), | 
| 84 | 84 | 'functions' => __( 'Functions', 'site-reviews' ), | 
| 85 | - ]); | |
| 85 | + ] ); | |
| 86 | 86 | $this->renderPage( 'documentation', [ | 
| 87 | 87 | 'tabs' => $tabs, | 
| 88 | - ]); | |
| 88 | + ] ); | |
| 89 | 89 | } | 
| 90 | 90 | |
| 91 | 91 | /** | 
| @@ -103,17 +103,17 @@ discard block | ||
| 103 | 103 | 'translations' => __( 'Translations', 'site-reviews' ), | 
| 104 | 104 | 'addons' => __( 'Addons', 'site-reviews' ), | 
| 105 | 105 | 'licenses' => __( 'Licenses', 'site-reviews' ), | 
| 106 | - ]); | |
| 107 | -		if( empty( glsr( Helper::class )->getPathValue( 'settings.addons', glsr()->defaults ))) { | |
| 108 | - unset( $tabs['addons'] ); | |
| 106 | + ] ); | |
| 107 | +		if( empty(glsr( Helper::class )->getPathValue( 'settings.addons', glsr()->defaults )) ) { | |
| 108 | + unset($tabs['addons']); | |
| 109 | 109 | } | 
| 110 | -		if( empty( glsr( Helper::class )->getPathValue( 'settings.licenses', glsr()->defaults ))) { | |
| 111 | - unset( $tabs['licenses'] ); | |
| 110 | +		if( empty(glsr( Helper::class )->getPathValue( 'settings.licenses', glsr()->defaults )) ) { | |
| 111 | + unset($tabs['licenses']); | |
| 112 | 112 | } | 
| 113 | 113 | $this->renderPage( 'settings', [ | 
| 114 | 114 | 'html' => glsr( Html::class ), | 
| 115 | 115 | 'tabs' => $tabs, | 
| 116 | - ]); | |
| 116 | + ] ); | |
| 117 | 117 | } | 
| 118 | 118 | |
| 119 | 119 | /** | 
| @@ -128,9 +128,9 @@ discard block | ||
| 128 | 128 | 'import-export' => __( 'Import/Export', 'site-reviews' ), | 
| 129 | 129 | 'console' => __( 'Console', 'site-reviews' ), | 
| 130 | 130 | 'system-info' => __( 'System Info', 'site-reviews' ), | 
| 131 | - ]); | |
| 132 | -		if( !apply_filters( 'site-reviews/addon/sync/enable', false )) { | |
| 133 | - unset( $tabs['sync'] ); | |
| 131 | + ] ); | |
| 132 | +		if( !apply_filters( 'site-reviews/addon/sync/enable', false ) ) { | |
| 133 | + unset($tabs['sync']); | |
| 134 | 134 | } | 
| 135 | 135 | $this->renderPage( 'tools', [ | 
| 136 | 136 | 'data' => [ | 
| @@ -143,7 +143,7 @@ discard block | ||
| 143 | 143 | ], | 
| 144 | 144 | 'html' => glsr( Html::class ), | 
| 145 | 145 | 'tabs' => $tabs, | 
| 146 | - ]); | |
| 146 | + ] ); | |
| 147 | 147 | } | 
| 148 | 148 | |
| 149 | 149 | /** | 
| @@ -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; | 
| @@ -14,11 +14,11 @@ discard block | ||
| 14 | 14 | */ | 
| 15 | 15 | public function buildClassName( $name, $path = '' ) | 
| 16 | 16 |  	{ | 
| 17 | - $className = explode( '_', $this->snakeCase( $name )); | |
| 17 | + $className = explode( '_', $this->snakeCase( $name ) ); | |
| 18 | 18 | $className = array_map( 'ucfirst', $className ); | 
| 19 | 19 | $className = implode( '', $className ); | 
| 20 | 20 | $path = ltrim( str_replace( __NAMESPACE__, '', $path ), '\\' ); | 
| 21 | - return !empty( $path ) | |
| 21 | + return !empty($path) | |
| 22 | 22 | ? __NAMESPACE__.'\\'.$path.'\\'.$className | 
| 23 | 23 | : $className; | 
| 24 | 24 | } | 
| @@ -30,7 +30,7 @@ discard block | ||
| 30 | 30 | */ | 
| 31 | 31 | public function buildMethodName( $name, $prefix = '' ) | 
| 32 | 32 |  	{ | 
| 33 | - return lcfirst( $prefix.$this->buildClassName( $name )); | |
| 33 | + return lcfirst( $prefix.$this->buildClassName( $name ) ); | |
| 34 | 34 | } | 
| 35 | 35 | |
| 36 | 36 | /** | 
| @@ -39,7 +39,7 @@ discard block | ||
| 39 | 39 | */ | 
| 40 | 40 | public function buildPropertyName( $name ) | 
| 41 | 41 |  	{ | 
| 42 | - return lcfirst( $this->buildClassName( $name )); | |
| 42 | + return lcfirst( $this->buildClassName( $name ) ); | |
| 43 | 43 | } | 
| 44 | 44 | |
| 45 | 45 | /** | 
| @@ -70,7 +70,7 @@ discard block | ||
| 70 | 70 | */ | 
| 71 | 71 | public function convertPathToId( $path, $prefix = '' ) | 
| 72 | 72 |  	{ | 
| 73 | - return str_replace( ['[', ']'], ['-', ''], $this->convertPathToName( $path, $prefix )); | |
| 73 | + return str_replace( ['[', ']'], ['-', ''], $this->convertPathToName( $path, $prefix ) ); | |
| 74 | 74 | } | 
| 75 | 75 | |
| 76 | 76 | /** | 
| @@ -81,7 +81,7 @@ discard block | ||
| 81 | 81 |  	{ | 
| 82 | 82 | $levels = explode( '.', $path ); | 
| 83 | 83 |  		return array_reduce( $levels, function( $result, $value ) { | 
| 84 | - return $result.= '['.$value.']'; | |
| 84 | + return $result .= '['.$value.']'; | |
| 85 | 85 | }, $prefix ); | 
| 86 | 86 | } | 
| 87 | 87 | |
| @@ -91,7 +91,7 @@ discard block | ||
| 91 | 91 | */ | 
| 92 | 92 | public function dashCase( $string ) | 
| 93 | 93 |  	{ | 
| 94 | - return str_replace( '_', '-', $this->snakeCase( $string )); | |
| 94 | + return str_replace( '_', '-', $this->snakeCase( $string ) ); | |
| 95 | 95 | } | 
| 96 | 96 | |
| 97 | 97 | /** | 
| @@ -113,11 +113,11 @@ discard block | ||
| 113 | 113 | */ | 
| 114 | 114 | public function filterInput( $key, array $request = [] ) | 
| 115 | 115 |  	{ | 
| 116 | -		if( isset( $request[$key] )) { | |
| 116 | +		if( isset($request[$key]) ) { | |
| 117 | 117 | return $request[$key]; | 
| 118 | 118 | } | 
| 119 | 119 | $variable = filter_input( INPUT_POST, $key ); | 
| 120 | -		if( is_null( $variable ) && isset( $_POST[$key] )) { | |
| 120 | +		if( is_null( $variable ) && isset($_POST[$key]) ) { | |
| 121 | 121 | $variable = $_POST[$key]; | 
| 122 | 122 | } | 
| 123 | 123 | return $variable; | 
| @@ -130,7 +130,7 @@ discard block | ||
| 130 | 130 | public function filterInputArray( $key ) | 
| 131 | 131 |  	{ | 
| 132 | 132 | $variable = filter_input( INPUT_POST, $key, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); | 
| 133 | -		if( empty( $variable ) && !empty( $_POST[$key] ) && is_array( $_POST[$key] )) { | |
| 133 | +		if( empty($variable) && !empty($_POST[$key]) && is_array( $_POST[$key] ) ) { | |
| 134 | 134 | $variable = $_POST[$key]; | 
| 135 | 135 | } | 
| 136 | 136 | return (array)$variable; | 
| @@ -146,13 +146,13 @@ discard block | ||
| 146 | 146 | $result = []; | 
| 147 | 147 |  		foreach( $array as $key => $value ) { | 
| 148 | 148 | $newKey = ltrim( $prefix.'.'.$key, '.' ); | 
| 149 | -			if( $this->isIndexedFlatArray( $value )) { | |
| 149 | +			if( $this->isIndexedFlatArray( $value ) ) { | |
| 150 | 150 |  				if( $flattenValue ) { | 
| 151 | 151 | $value = '['.implode( ', ', $value ).']'; | 
| 152 | 152 | } | 
| 153 | 153 | } | 
| 154 | -			else if( is_array( $value )) { | |
| 155 | - $result = array_merge( $result, $this->flattenArray( $value, $flattenValue, $newKey )); | |
| 154 | +			else if( is_array( $value ) ) { | |
| 155 | + $result = array_merge( $result, $this->flattenArray( $value, $flattenValue, $newKey ) ); | |
| 156 | 156 | continue; | 
| 157 | 157 | } | 
| 158 | 158 | $result[$newKey] = $value; | 
| @@ -171,7 +171,7 @@ discard block | ||
| 171 | 171 | Whip::IPV4 => $cloudflareIps['v4'], | 
| 172 | 172 | Whip::IPV6 => $cloudflareIps['v6'], | 
| 173 | 173 | ], | 
| 174 | - ]))->getValidIpAddress(); | |
| 174 | + ] ))->getValidIpAddress(); | |
| 175 | 175 | } | 
| 176 | 176 | |
| 177 | 177 | /** | 
| @@ -184,7 +184,7 @@ discard block | ||
| 184 | 184 |  	{ | 
| 185 | 185 | $keys = explode( '.', $path ); | 
| 186 | 186 |  		foreach( $keys as $key ) { | 
| 187 | -			if( !isset( $values[$key] )) { | |
| 187 | +			if( !isset($values[$key]) ) { | |
| 188 | 188 | return $fallback; | 
| 189 | 189 | } | 
| 190 | 190 | $values = $values[$key]; | 
| @@ -198,7 +198,7 @@ discard block | ||
| 198 | 198 | */ | 
| 199 | 199 | public function isIndexedArray( $array ) | 
| 200 | 200 |  	{ | 
| 201 | -		if( !is_array( $array )) { | |
| 201 | +		if( !is_array( $array ) ) { | |
| 202 | 202 | return false; | 
| 203 | 203 | } | 
| 204 | 204 | $current = 0; | 
| @@ -217,7 +217,7 @@ discard block | ||
| 217 | 217 | */ | 
| 218 | 218 | public function isIndexedFlatArray( $array ) | 
| 219 | 219 |  	{ | 
| 220 | -		if( !is_array( $array ) || array_filter( $array, 'is_array' )) { | |
| 220 | +		if( !is_array( $array ) || array_filter( $array, 'is_array' ) ) { | |
| 221 | 221 | return false; | 
| 222 | 222 | } | 
| 223 | 223 | return $this->isIndexedArray( $array ); | 
| @@ -230,7 +230,7 @@ discard block | ||
| 230 | 230 | */ | 
| 231 | 231 | public function prefixString( $string, $prefix = '' ) | 
| 232 | 232 |  	{ | 
| 233 | - return $prefix.str_replace( $prefix, '', trim( $string )); | |
| 233 | + return $prefix.str_replace( $prefix, '', trim( $string ) ); | |
| 234 | 234 | } | 
| 235 | 235 | |
| 236 | 236 | /** | 
| @@ -276,7 +276,7 @@ discard block | ||
| 276 | 276 | */ | 
| 277 | 277 | public function snakeCase( $string ) | 
| 278 | 278 |  	{ | 
| 279 | -		if( !ctype_lower( $string )) { | |
| 279 | +		if( !ctype_lower( $string ) ) { | |
| 280 | 280 | $string = preg_replace( '/\s+/u', '', $string ); | 
| 281 | 281 | $string = preg_replace( '/(.)(?=[A-Z])/u', '$1_', $string ); | 
| 282 | 282 | $string = mb_strtolower( $string, 'UTF-8' ); | 
| @@ -291,6 +291,6 @@ discard block | ||
| 291 | 291 | */ | 
| 292 | 292 | public function startsWith( $needle, $haystack ) | 
| 293 | 293 |  	{ | 
| 294 | - return substr( $haystack, 0, strlen( $needle )) === $needle; | |
| 294 | + return substr( $haystack, 0, strlen( $needle ) ) === $needle; | |
| 295 | 295 | } | 
| 296 | 296 | } | 
| @@ -153,7 +153,9 @@ discard block | ||
| 153 | 153 | */ | 
| 154 | 154 | public function scheduleCronJob() | 
| 155 | 155 |  	{ | 
| 156 | - if( wp_next_scheduled( static::CRON_EVENT ))return; | |
| 156 | +		if( wp_next_scheduled( static::CRON_EVENT )) { | |
| 157 | + return; | |
| 158 | + } | |
| 157 | 159 | wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT ); | 
| 158 | 160 | } | 
| 159 | 161 | |
| @@ -184,7 +186,9 @@ discard block | ||
| 184 | 186 | || !in_array( plugin_basename( $this->file ), $data['plugins'] ) | 
| 185 | 187 | || $data['action'] != 'update' | 
| 186 | 188 | || $data['type'] != 'plugin' | 
| 187 | - )return; | |
| 189 | +		) { | |
| 190 | + return; | |
| 191 | + } | |
| 188 | 192 | $this->upgrade(); | 
| 189 | 193 | } | 
| 190 | 194 | |
| @@ -66,7 +66,7 @@ discard block | ||
| 66 | 66 | */ | 
| 67 | 67 | public function getDefaults() | 
| 68 | 68 |  	{ | 
| 69 | -		if( empty( $this->defaults )) { | |
| 69 | +		if( empty($this->defaults) ) { | |
| 70 | 70 | $this->defaults = $this->make( DefaultsManager::class )->get(); | 
| 71 | 71 | $this->upgrade(); | 
| 72 | 72 | } | 
| @@ -79,7 +79,7 @@ discard block | ||
| 79 | 79 | public function hasPermission() | 
| 80 | 80 |  	{ | 
| 81 | 81 | $isAdmin = $this->isAdmin(); | 
| 82 | - return !$isAdmin || ( $isAdmin && current_user_can( static::CAPABILITY )); | |
| 82 | + return !$isAdmin || ($isAdmin && current_user_can( static::CAPABILITY )); | |
| 83 | 83 | } | 
| 84 | 84 | |
| 85 | 85 | /** | 
| @@ -134,7 +134,7 @@ discard block | ||
| 134 | 134 | $types = apply_filters( 'site-reviews/addon/types', [] ); | 
| 135 | 135 | $this->reviewTypes = wp_parse_args( $types, [ | 
| 136 | 136 | 'local' => __( 'Local', 'site-reviews' ), | 
| 137 | - ]); | |
| 137 | + ] ); | |
| 138 | 138 | } | 
| 139 | 139 | |
| 140 | 140 | /** | 
| @@ -144,15 +144,15 @@ discard block | ||
| 144 | 144 | public function render( $view, array $data = [] ) | 
| 145 | 145 |  	{ | 
| 146 | 146 | $file = ''; | 
| 147 | -		if( glsr( Helper::class )->startsWith( $view, 'templates/' )) { | |
| 147 | +		if( glsr( Helper::class )->startsWith( $view, 'templates/' ) ) { | |
| 148 | 148 | $file = str_replace( 'templates/', 'site-reviews/', $view ).'.php'; | 
| 149 | 149 | $file = get_stylesheet_directory().'/'.$file; | 
| 150 | 150 | } | 
| 151 | -		if( !file_exists( $file )) { | |
| 151 | +		if( !file_exists( $file ) ) { | |
| 152 | 152 | $file = $this->path( 'views/'.$view.'.php' ); | 
| 153 | 153 | } | 
| 154 | 154 | $file = apply_filters( 'site-reviews/views/file', $file, $view, $data ); | 
| 155 | -		if( !file_exists( $file )) { | |
| 155 | +		if( !file_exists( $file ) ) { | |
| 156 | 156 | glsr_log()->error( 'File not found: '.$file ); | 
| 157 | 157 | return; | 
| 158 | 158 | } | 
| @@ -166,7 +166,7 @@ discard block | ||
| 166 | 166 | */ | 
| 167 | 167 | public function scheduleCronJob() | 
| 168 | 168 |  	{ | 
| 169 | - if( wp_next_scheduled( static::CRON_EVENT ))return; | |
| 169 | + if( wp_next_scheduled( static::CRON_EVENT ) )return; | |
| 170 | 170 | wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT ); | 
| 171 | 171 | } | 
| 172 | 172 | |
| @@ -175,7 +175,7 @@ discard block | ||
| 175 | 175 | */ | 
| 176 | 176 | public function unscheduleCronJob() | 
| 177 | 177 |  	{ | 
| 178 | - wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT )), static::CRON_EVENT ); | |
| 178 | + wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT ) ), static::CRON_EVENT ); | |
| 179 | 179 | } | 
| 180 | 180 | |
| 181 | 181 | /** | 
| @@ -207,6 +207,6 @@ discard block | ||
| 207 | 207 | */ | 
| 208 | 208 | public function url( $path = '' ) | 
| 209 | 209 |  	{ | 
| 210 | - return esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' )); | |
| 210 | + return esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ) ); | |
| 211 | 211 | } | 
| 212 | 212 | } | 
| @@ -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 ); | 
| @@ -22,10 +22,10 @@ discard block | ||
| 22 | 22 | 'after_widget' => '</div>', | 
| 23 | 23 | 'before_title' => '<h3 class="glsr-shortcode-title">', | 
| 24 | 24 | 'after_title' => '</h3>', | 
| 25 | - ]); | |
| 25 | + ] ); | |
| 26 | 26 | $instance = $this->normalize( $instance ); | 
| 27 | 27 | $partial = glsr( Html::class )->buildPartial( $shortcodePartial, $instance ); | 
| 28 | -		if( !empty( $instance['title'] )) { | |
| 28 | +		if( !empty($instance['title']) ) { | |
| 29 | 29 | $instance['title'] = $args['before_title'].$instance['title'].$args['after_title']; | 
| 30 | 30 | } | 
| 31 | 31 | return $args['before_widget'].$instance['title'].$partial.$args['after_widget']; | 
| @@ -68,10 +68,10 @@ discard block | ||
| 68 | 68 | */ | 
| 69 | 69 | public function normalize( $args ) | 
| 70 | 70 |  	{ | 
| 71 | - $args = shortcode_atts( $this->getDefaults(), wp_parse_args( $args )); | |
| 71 | + $args = shortcode_atts( $this->getDefaults(), wp_parse_args( $args ) ); | |
| 72 | 72 |  		array_walk( $args, function( &$value, $key ) { | 
| 73 | 73 | $methodName = glsr( Helper::class )->buildMethodName( $key, 'normalize' ); | 
| 74 | - if( !method_exists( $this, $methodName ))return; | |
| 74 | + if( !method_exists( $this, $methodName ) )return; | |
| 75 | 75 | $value = $this->$methodName( $value ); | 
| 76 | 76 | }); | 
| 77 | 77 | return $this->sanitize( $args ); | 
| @@ -103,13 +103,13 @@ discard block | ||
| 103 | 103 | */ | 
| 104 | 104 | protected function normalizeHide( $hide ) | 
| 105 | 105 |  	{ | 
| 106 | -		if( is_string( $hide )) { | |
| 106 | +		if( is_string( $hide ) ) { | |
| 107 | 107 | $hide = explode( ',', $hide ); | 
| 108 | 108 | } | 
| 109 | 109 | $hiddenKeys = defined( 'static::HIDDEN_KEYS' ) | 
| 110 | 110 | ? static::HIDDEN_KEYS | 
| 111 | 111 | : []; | 
| 112 | -		return array_filter( array_map( 'trim', $hide ), function( $value ) use( $hiddenKeys ) { | |
| 112 | +		return array_filter( array_map( 'trim', $hide ), function( $value ) use($hiddenKeys) { | |
| 113 | 113 | return in_array( $value, $hiddenKeys ); | 
| 114 | 114 | }); | 
| 115 | 115 | } | 
| @@ -137,9 +137,9 @@ discard block | ||
| 137 | 137 | __( 'Terrible', 'site-reviews' ), | 
| 138 | 138 | ]; | 
| 139 | 139 | $defaults = array_pad( $defaults, Rating::MAX_RATING, '' ); | 
| 140 | - $labels = array_map( 'trim', explode( ',', $labels )); | |
| 140 | + $labels = array_map( 'trim', explode( ',', $labels ) ); | |
| 141 | 141 |  		foreach( $defaults as $i => $label ) { | 
| 142 | - if( empty( $labels[$i] ))continue; | |
| 142 | + if( empty($labels[$i]) )continue; | |
| 143 | 143 | $defaults[$i] = $labels[$i]; | 
| 144 | 144 | } | 
| 145 | 145 | 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 | ); | 
| @@ -181,7 +181,9 @@ discard block | ||
| 181 | 181 | $key = $value; | 
| 182 | 182 | $value = true; | 
| 183 | 183 | } | 
| 184 | - if( !in_array( $key, static::BOOLEAN_ATTRIBUTES ))continue; | |
| 184 | +			if( !in_array( $key, static::BOOLEAN_ATTRIBUTES )) { | |
| 185 | + continue; | |
| 186 | + } | |
| 185 | 187 | $this->attributes[$key] = wp_validate_boolean( $value ); | 
| 186 | 188 | } | 
| 187 | 189 | } | 
| @@ -196,7 +198,9 @@ discard block | ||
| 196 | 198 | $key = $value; | 
| 197 | 199 | $value = ''; | 
| 198 | 200 | } | 
| 199 | - if( !glsr( Helper::class )->startsWith( 'data-', $key ))continue; | |
| 201 | +			if( !glsr( Helper::class )->startsWith( 'data-', $key )) { | |
| 202 | + continue; | |
| 203 | + } | |
| 200 | 204 |  			if( is_array( $value )) { | 
| 201 | 205 | $value = json_encode( $value, JSON_HEX_APOS | JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES ); | 
| 202 | 206 | } | 
| @@ -210,7 +214,9 @@ discard block | ||
| 210 | 214 | protected function normalizeStringAttributes() | 
| 211 | 215 |  	{ | 
| 212 | 216 |  		foreach( $this->attributes as $key => $value ) { | 
| 213 | - if( !is_string( $value ))continue; | |
| 217 | +			if( !is_string( $value )) { | |
| 218 | + continue; | |
| 219 | + } | |
| 214 | 220 | $this->attributes[$key] = trim( $value ); | 
| 215 | 221 | } | 
| 216 | 222 | } | 
| @@ -221,7 +227,9 @@ discard block | ||
| 221 | 227 | */ | 
| 222 | 228 | protected function normalizeInputType( $method ) | 
| 223 | 229 |  	{ | 
| 224 | - if( $method != 'input' )return; | |
| 230 | +		if( $method != 'input' ) { | |
| 231 | + return; | |
| 232 | + } | |
| 225 | 233 | $attributes = wp_parse_args( $this->attributes, ['type' => ''] ); | 
| 226 | 234 |  		if( !in_array( $attributes['type'], static::INPUT_TYPES )) { | 
| 227 | 235 | $this->attributes['type'] = 'text'; | 
| @@ -117,7 +117,7 @@ discard block | ||
| 117 | 117 | */ | 
| 118 | 118 | protected function filterAttributes( array $allowedAttributeKeys ) | 
| 119 | 119 |  	{ | 
| 120 | - return array_intersect_key( $this->attributes, array_flip( $allowedAttributeKeys )); | |
| 120 | + return array_intersect_key( $this->attributes, array_flip( $allowedAttributeKeys ) ); | |
| 121 | 121 | } | 
| 122 | 122 | |
| 123 | 123 | /** | 
| @@ -128,7 +128,7 @@ discard block | ||
| 128 | 128 | $globalAttributes = $this->filterAttributes( static::GLOBAL_ATTRIBUTES ); | 
| 129 | 129 | $wildcards = []; | 
| 130 | 130 |  		foreach( static::GLOBAL_WILDCARD_ATTRIBUTES as $wildcard ) { | 
| 131 | -			$newWildcards = array_filter( $this->attributes, function( $key ) use( $wildcard ) { | |
| 131 | +			$newWildcards = array_filter( $this->attributes, function( $key ) use($wildcard) { | |
| 132 | 132 | return glsr( Helper::class )->startsWith( $wildcard, $key ); | 
| 133 | 133 | }, ARRAY_FILTER_USE_KEY ); | 
| 134 | 134 | $wildcards = array_merge( $wildcards, $newWildcards ); | 
| @@ -142,7 +142,7 @@ discard block | ||
| 142 | 142 | protected function getPermanentAttributes() | 
| 143 | 143 |  	{ | 
| 144 | 144 | $permanentAttributes = []; | 
| 145 | -		if( array_key_exists( 'value', $this->attributes )) { | |
| 145 | +		if( array_key_exists( 'value', $this->attributes ) ) { | |
| 146 | 146 | $permanentAttributes['value'] = $this->attributes['value']; | 
| 147 | 147 | } | 
| 148 | 148 | return $permanentAttributes; | 
| @@ -194,11 +194,11 @@ discard block | ||
| 194 | 194 | protected function normalizeBooleanAttributes() | 
| 195 | 195 |  	{ | 
| 196 | 196 |  		foreach( $this->attributes as $key => $value ) { | 
| 197 | -			if( $this->isAttributeKeyNumeric( $key, $value )) { | |
| 197 | +			if( $this->isAttributeKeyNumeric( $key, $value ) ) { | |
| 198 | 198 | $key = $value; | 
| 199 | 199 | $value = true; | 
| 200 | 200 | } | 
| 201 | - if( !in_array( $key, static::BOOLEAN_ATTRIBUTES ))continue; | |
| 201 | + if( !in_array( $key, static::BOOLEAN_ATTRIBUTES ) )continue; | |
| 202 | 202 | $this->attributes[$key] = wp_validate_boolean( $value ); | 
| 203 | 203 | } | 
| 204 | 204 | } | 
| @@ -209,12 +209,12 @@ discard block | ||
| 209 | 209 | protected function normalizeDataAttributes() | 
| 210 | 210 |  	{ | 
| 211 | 211 |  		foreach( $this->attributes as $key => $value ) { | 
| 212 | -			if( $this->isAttributeKeyNumeric( $key, $value )) { | |
| 212 | +			if( $this->isAttributeKeyNumeric( $key, $value ) ) { | |
| 213 | 213 | $key = $value; | 
| 214 | 214 | $value = ''; | 
| 215 | 215 | } | 
| 216 | - if( !glsr( Helper::class )->startsWith( 'data-', $key ))continue; | |
| 217 | -			if( is_array( $value )) { | |
| 216 | + if( !glsr( Helper::class )->startsWith( 'data-', $key ) )continue; | |
| 217 | +			if( is_array( $value ) ) { | |
| 218 | 218 | $value = json_encode( $value, JSON_HEX_APOS | JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES ); | 
| 219 | 219 | } | 
| 220 | 220 | $this->attributes[$key] = $value; | 
| @@ -227,7 +227,7 @@ discard block | ||
| 227 | 227 | protected function normalizeStringAttributes() | 
| 228 | 228 |  	{ | 
| 229 | 229 |  		foreach( $this->attributes as $key => $value ) { | 
| 230 | - if( !is_string( $value ))continue; | |
| 230 | + if( !is_string( $value ) )continue; | |
| 231 | 231 | $this->attributes[$key] = trim( $value ); | 
| 232 | 232 | } | 
| 233 | 233 | } | 
| @@ -240,7 +240,7 @@ discard block | ||
| 240 | 240 |  	{ | 
| 241 | 241 | if( $method != 'input' )return; | 
| 242 | 242 | $attributes = wp_parse_args( $this->attributes, ['type' => ''] ); | 
| 243 | -		if( !in_array( $attributes['type'], static::INPUT_TYPES )) { | |
| 243 | +		if( !in_array( $attributes['type'], static::INPUT_TYPES ) ) { | |
| 244 | 244 | $this->attributes['type'] = 'text'; | 
| 245 | 245 | } | 
| 246 | 246 | } | 
| @@ -254,11 +254,11 @@ discard block | ||
| 254 | 254 | $permanentAttributes = $this->getPermanentAttributes(); | 
| 255 | 255 |  		foreach( $this->attributes as $key => $value ) { | 
| 256 | 256 |  			if( in_array( $key, static::BOOLEAN_ATTRIBUTES ) && !$value ) { | 
| 257 | - unset( $attributes[$key] ); | |
| 257 | + unset($attributes[$key]); | |
| 258 | 258 | } | 
| 259 | -			if( glsr( Helper::class )->startsWith( 'data-', $key )) { | |
| 259 | +			if( glsr( Helper::class )->startsWith( 'data-', $key ) ) { | |
| 260 | 260 | $permanentAttributes[$key] = $value; | 
| 261 | - unset( $attributes[$key] ); | |
| 261 | + unset($attributes[$key]); | |
| 262 | 262 | } | 
| 263 | 263 | } | 
| 264 | 264 | $this->attributes = array_merge( array_filter( $attributes ), $permanentAttributes ); | 
| @@ -37,7 +37,9 @@ | ||
| 37 | 37 | $lines = explode( "\n", $blacklist ); | 
| 38 | 38 |  		foreach( (array) $lines as $line ) { | 
| 39 | 39 | $line = trim( $line ); | 
| 40 | - if( empty( $line ) || 256 < strlen( $line ))continue; | |
| 40 | +			if( empty( $line ) || 256 < strlen( $line )) { | |
| 41 | + continue; | |
| 42 | + } | |
| 41 | 43 | $pattern = sprintf( '#%s#i', preg_quote( $line, '#' )); | 
| 42 | 44 |  			if( preg_match( $pattern, $target )) { | 
| 43 | 45 | return true; | 
| @@ -11,14 +11,14 @@ discard block | ||
| 11 | 11 | */ | 
| 12 | 12 | public function isBlacklisted( array $review ) | 
| 13 | 13 |  	{ | 
| 14 | - $target = implode( "\n", array_filter([ | |
| 14 | + $target = implode( "\n", array_filter( [ | |
| 15 | 15 | $review['name'], | 
| 16 | 16 | $review['content'], | 
| 17 | 17 | $review['email'], | 
| 18 | 18 | $review['ip_address'], | 
| 19 | 19 | $review['title'], | 
| 20 | - ])); | |
| 21 | - return (bool) apply_filters( 'site-reviews/blacklist/is-blacklisted', | |
| 20 | + ] ) ); | |
| 21 | + return (bool)apply_filters( 'site-reviews/blacklist/is-blacklisted', | |
| 22 | 22 | $this->check( $target ), | 
| 23 | 23 | $review | 
| 24 | 24 | ); | 
| @@ -30,16 +30,16 @@ discard block | ||
| 30 | 30 | */ | 
| 31 | 31 | protected function check( $target ) | 
| 32 | 32 |  	{ | 
| 33 | - $blacklist = trim( glsr( OptionManager::class )->get( 'settings.submissions.blacklist.entries' )); | |
| 34 | -		if( empty( $blacklist )) { | |
| 33 | + $blacklist = trim( glsr( OptionManager::class )->get( 'settings.submissions.blacklist.entries' ) ); | |
| 34 | +		if( empty($blacklist) ) { | |
| 35 | 35 | return false; | 
| 36 | 36 | } | 
| 37 | 37 | $lines = explode( "\n", $blacklist ); | 
| 38 | -		foreach( (array) $lines as $line ) { | |
| 38 | +		foreach( (array)$lines as $line ) { | |
| 39 | 39 | $line = trim( $line ); | 
| 40 | - if( empty( $line ) || 256 < strlen( $line ))continue; | |
| 41 | - $pattern = sprintf( '#%s#i', preg_quote( $line, '#' )); | |
| 42 | -			if( preg_match( $pattern, $target )) { | |
| 40 | + if( empty($line) || 256 < strlen( $line ) )continue; | |
| 41 | + $pattern = sprintf( '#%s#i', preg_quote( $line, '#' ) ); | |
| 42 | +			if( preg_match( $pattern, $target ) ) { | |
| 43 | 43 | return true; | 
| 44 | 44 | } | 
| 45 | 45 | } |