Passed
Push — master ( ad7989...648c0b )
by Paul
09:21 queued 04:46
created
plugin/Controllers/MenuController.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,9 @@  discard block
 block discarded – undo
22 22
 	{
23 23
 		global $menu, $typenow;
24 24
 		foreach( $menu as $key => $value ) {
25
-			if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue;
25
+			if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE ) {
26
+				continue;
27
+			}
26 28
 			$postCount = wp_count_posts( Application::POST_TYPE );
27 29
 			$pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [
28 30
 				'class' => 'pending-count',
@@ -53,7 +55,9 @@  discard block
 block discarded – undo
53 55
 		foreach( $pages as $slug => $title ) {
54 56
 			$method = glsr( Helper::class )->buildMethodName( 'render-'.$slug.'-menu' );
55 57
 			$callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug );
56
-			if( !is_callable( $callback ))continue;
58
+			if( !is_callable( $callback )) {
59
+				continue;
60
+			}
57 61
 			add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, glsr()->constant( 'CAPABILITY' ), $slug, $callback );
58 62
 		}
59 63
 	}
Please login to merge, or discard this patch.
plugin/Actions.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,8 @@
 block discarded – undo
33 33
 	protected $settings;
34 34
 	protected $taxonomy;
35 35
 
36
-	public function __construct( Application $app ) {
36
+	public function __construct( Application $app )
37
+	{
37 38
 		$this->app = $app;
38 39
 		$this->admin = $app->make( AdminController::class );
39 40
 		$this->blocks = $app->make( BlocksController::class );
Please login to merge, or discard this patch.
plugin/Blocks/BlockGenerator.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,9 @@
 block discarded – undo
19 19
 	 */
20 20
 	public function register( $block )
21 21
 	{
22
-		if( !function_exists( 'register_block_type' ))return;
22
+		if( !function_exists( 'register_block_type' )) {
23
+			return;
24
+		}
23 25
 		register_block_type( Application::ID.'/'.$block, [
24 26
 			'attributes' => $this->attributes(),
25 27
 			'editor_script' => Application::ID.'/blocks',
Please login to merge, or discard this patch.
plugin/Controllers/TaxonomyController.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,9 @@
 block discarded – undo
35 35
 	 */
36 36
 	public function renderTaxonomyFilter()
37 37
 	{
38
-		if( !is_object_in_taxonomy( glsr_current_screen()->post_type, Application::TAXONOMY ))return;
38
+		if( !is_object_in_taxonomy( glsr_current_screen()->post_type, Application::TAXONOMY )) {
39
+			return;
40
+		}
39 41
 		echo glsr( Builder::class )->label( __( 'Filter by category', 'site-reviews' ), [
40 42
 			'class' => 'screen-reader-text',
41 43
 			'for' => Application::TAXONOMY,
Please login to merge, or discard this patch.
plugin/Controllers/AdminController.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -108,12 +108,16 @@
 block discarded – undo
108 108
 	public function renderTinymceButton( $editorId )
109 109
 	{
110 110
 		$allowedEditors = apply_filters( 'site-reviews/tinymce/editor-ids', ['content'], $editorId );
111
-		if( glsr_current_screen()->base != 'post' || !in_array( $editorId, $allowedEditors ))return;
111
+		if( glsr_current_screen()->base != 'post' || !in_array( $editorId, $allowedEditors )) {
112
+			return;
113
+		}
112 114
 		$shortcodes = [];
113 115
 		foreach( glsr()->mceShortcodes as $shortcode => $values ) {
114 116
 			$shortcodes[$shortcode] = $values;
115 117
 		}
116
-		if( empty( $shortcodes ))return;
118
+		if( empty( $shortcodes )) {
119
+			return;
120
+		}
117 121
 		glsr()->render( 'partials/editor/tinymce', [
118 122
 			'shortcodes' => $shortcodes,
119 123
 		]);
Please login to merge, or discard this patch.
plugin/Handlers/ChangeStatus.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,9 @@
 block discarded – undo
65 65
 		$avail_post_stati = get_available_post_statuses( Application::POST_TYPE );
66 66
 		$table = new \WP_Posts_List_Table( ['screen' => $hookName] );
67 67
 		$views = apply_filters( 'views_'.$hookName, $table->get_views() ); // uses compat get_views()
68
-		if( empty( $views ))return;
68
+		if( empty( $views )) {
69
+			return;
70
+		}
69 71
 		foreach( $views as $class => $view ) {
70 72
 			$views[$class] = "\t<li class='$class'>$view";
71 73
 		}
Please login to merge, or discard this patch.
compatibility.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,7 +8,9 @@  discard block
 block discarded – undo
8 8
  * @see https://www.elegantthemes.com/gallery/divi/
9 9
  */
10 10
 add_action( 'site-reviews/customize/divi', function( $instance ) {
11
-	if( $instance->tag != 'label' || $instance->args['type'] != 'checkbox' )return;
11
+	if( $instance->tag != 'label' || $instance->args['type'] != 'checkbox' ) {
12
+		return;
13
+	}
12 14
 	$instance->args['text'] = '<i></i>'.$instance->args['text'];
13 15
 });
14 16
 
@@ -20,9 +22,13 @@  discard block
 block discarded – undo
20 22
  * @see https://wordpress.org/plugins/wp-super-cache/
21 23
  */
22 24
 add_action( 'site-reviews/review/created', function( $review, $request ) {
23
-	if( !function_exists( 'wp_cache_post_change' ))return;
25
+	if( !function_exists( 'wp_cache_post_change' )) {
26
+		return;
27
+	}
24 28
 	wp_cache_post_change( $request->post_id );
25
-	if( empty( $review->assigned_to ) || $review->assigned_to == $request->post_id )return;
29
+	if( empty( $review->assigned_to ) || $review->assigned_to == $request->post_id ) {
30
+		return;
31
+	}
26 32
 	wp_cache_post_change( $review->assigned_to );
27 33
 }, 10, 2 );
28 34
 
Please login to merge, or discard this patch.
plugin/Shortcodes/TinymcePopupGenerator.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -56,9 +56,13 @@  discard block
 block discarded – undo
56 56
 	protected function generateFields( array $fields )
57 57
 	{
58 58
 		$generatedFields = array_map( function( $field ) {
59
-			if( empty( $field ))return;
59
+			if( empty( $field )) {
60
+				return;
61
+			}
60 62
 			$field = $this->normalize( $field );
61
-			if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] )))return;
63
+			if( !method_exists( $this, $method = 'normalize'.ucfirst( $field['type'] ))) {
64
+				return;
65
+			}
62 66
 			return $this->$method( $field );
63 67
 		}, $fields );
64 68
 		return array_values( array_filter( $generatedFields ));
@@ -73,7 +77,9 @@  discard block
 block discarded – undo
73 77
 		if( !empty( $this->errors )) {
74 78
 			$errors = [];
75 79
 			foreach( $this->required as $name => $alert ) {
76
-				if( false !== array_search( $name, glsr_array_column( $fields, 'name' )))continue;
80
+				if( false !== array_search( $name, glsr_array_column( $fields, 'name' ))) {
81
+					continue;
82
+				}
77 83
 				$errors[] = $this->errors[$name];
78 84
 			}
79 85
 			$this->errors = $errors;
@@ -117,7 +123,9 @@  discard block
 block discarded – undo
117 123
 	 */
118 124
 	protected function normalizeContainer( array $field )
119 125
 	{
120
-		if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field ))return;
126
+		if( !array_key_exists( 'html', $field ) && !array_key_exists( 'items', $field )) {
127
+			return;
128
+		}
121 129
 		$field['items'] = $this->generateFields( $field['items'] );
122 130
 		return $field;
123 131
 	}
@@ -127,7 +135,9 @@  discard block
 block discarded – undo
127 135
 	 */
128 136
 	protected function normalizeField( array $field, array $defaults )
129 137
 	{
130
-		if( !$this->validate( $field ))return;
138
+		if( !$this->validate( $field )) {
139
+			return;
140
+		}
131 141
 		return array_filter( shortcode_atts( $defaults, $field ), function( $value ) {
132 142
 			return $value !== '';
133 143
 		});
@@ -148,7 +158,9 @@  discard block
 block discarded – undo
148 158
 			'type' => '',
149 159
 			'value' => '',
150 160
 		]);
151
-		if( !is_array( $listbox ))return;
161
+		if( !is_array( $listbox )) {
162
+			return;
163
+		}
152 164
 		if( !array_key_exists( '', $listbox['options'] )) {
153 165
 			$listbox['options'] = ['' => $listbox['placeholder']] + $listbox['options'];
154 166
 		}
Please login to merge, or discard this patch.
helpers.php 1 patch
Braces   +31 added lines, -14 removed lines patch added patch discarded remove patch
@@ -19,7 +19,9 @@  discard block
 block discarded – undo
19 19
 		'glsr_get_review', 'glsr_get_reviews',
20 20
 		'glsr_log',
21 21
 	);
22
-	if( !in_array( $hook, $hooks ) || !function_exists( $hook ))return;
22
+	if( !in_array( $hook, $hooks ) || !function_exists( $hook )) {
23
+		return;
24
+	}
23 25
 	add_filter( $hook, function() use( $hook, $args ) {
24 26
 		array_shift( $args ); // remove the fallback value
25 27
 		return call_user_func_array( $hook, $args );
@@ -29,7 +31,8 @@  discard block
 block discarded – undo
29 31
 /**
30 32
  * @return mixed
31 33
  */
32
-function glsr( $alias = null ) {
34
+function glsr( $alias = null )
35
+{
33 36
 	$app = \GeminiLabs\SiteReviews\Application::load();
34 37
 	return !empty( $alias )
35 38
 		? $app->make( $alias )
@@ -41,11 +44,14 @@  discard block
 block discarded – undo
41 44
  * @param $column string
42 45
  * @return array
43 46
  */
44
-function glsr_array_column( array $array, $column ) {
47
+function glsr_array_column( array $array, $column )
48
+{
45 49
 	$result = array();
46 50
 	foreach( $array as $subarray ) {
47 51
 		$subarray = (array)$subarray;
48
-		if( !isset( $subarray[$column] ))continue;
52
+		if( !isset( $subarray[$column] )) {
53
+			continue;
54
+		}
49 55
 		$result[] = $subarray[$column];
50 56
 	}
51 57
 	return $result;
@@ -54,7 +60,8 @@  discard block
 block discarded – undo
54 60
 /**
55 61
  * @return void
56 62
  */
57
-function glsr_calculate_ratings() {
63
+function glsr_calculate_ratings()
64
+{
58 65
 	glsr( 'Controllers\AdminController' )->routerCountReviews( false );
59 66
 	glsr_log()->info( __( 'Recalculated rating counts.', 'site-reviews' ));
60 67
 }
@@ -62,7 +69,8 @@  discard block
 block discarded – undo
62 69
 /**
63 70
  * @return null|\GeminiLabs\SiteReviews\Review
64 71
  */
65
-function glsr_create_review( $reviewValues = array() ) {
72
+function glsr_create_review( $reviewValues = array() )
73
+{
66 74
 	if( !is_array( $reviewValues )) {
67 75
 		$reviewValues = array();
68 76
 	}
@@ -76,7 +84,8 @@  discard block
 block discarded – undo
76 84
 /**
77 85
  * @return \WP_Screen|object
78 86
  */
79
-function glsr_current_screen() {
87
+function glsr_current_screen()
88
+{
80 89
 	if( function_exists( 'get_current_screen' )) {
81 90
 		$screen = get_current_screen();
82 91
 	}
@@ -89,7 +98,8 @@  discard block
 block discarded – undo
89 98
  * @param mixed ...$vars
90 99
  * @return void
91 100
  */
92
-function glsr_debug( ...$vars ) {
101
+function glsr_debug( ...$vars )
102
+{
93 103
 	if( count( $vars ) == 1 ) {
94 104
 		$value = htmlspecialchars( print_r( $vars[0], true ), ENT_QUOTES, 'UTF-8' );
95 105
 		printf( '<div class="glsr-debug"><pre>%s</pre></div>', $value );
@@ -108,7 +118,8 @@  discard block
 block discarded – undo
108 118
  * @param mixed $fallback
109 119
  * @return string|array
110 120
  */
111
-function glsr_get_option( $path = '', $fallback = '' ) {
121
+function glsr_get_option( $path = '', $fallback = '' )
122
+{
112 123
 	return is_string( $path )
113 124
 		? glsr( 'Database\OptionManager' )->get( 'settings.'.$path, $fallback )
114 125
 		: $fallback;
@@ -117,7 +128,8 @@  discard block
 block discarded – undo
117 128
 /**
118 129
  * @return array
119 130
  */
120
-function glsr_get_options() {
131
+function glsr_get_options()
132
+{
121 133
 	return glsr( 'Database\OptionManager' )->get( 'settings' );
122 134
 }
123 135
 
@@ -125,8 +137,11 @@  discard block
 block discarded – undo
125 137
  * @param int $post_id
126 138
  * @return \GeminiLabs\SiteReviews\Review|void
127 139
  */
128
-function glsr_get_review( $post_id ) {
129
-	if( !is_numeric( $post_id ))return;
140
+function glsr_get_review( $post_id )
141
+{
142
+	if( !is_numeric( $post_id )) {
143
+		return;
144
+	}
130 145
 	$post = get_post( $post_id );
131 146
 	if( $post instanceof WP_Post ) {
132 147
 		return glsr( 'Database\ReviewManager' )->single( $post );
@@ -137,7 +152,8 @@  discard block
 block discarded – undo
137 152
  * @return array
138 153
  * @todo document change of $reviews->reviews to $reviews->results
139 154
  */
140
-function glsr_get_reviews( $args = array() ) {
155
+function glsr_get_reviews( $args = array() )
156
+{
141 157
 	if( !is_array( $args )) {
142 158
 		$args = [];
143 159
 	}
@@ -147,7 +163,8 @@  discard block
 block discarded – undo
147 163
 /**
148 164
  * @return \GeminiLabs\SiteReviews\Modules\Console
149 165
  */
150
-function glsr_log() {
166
+function glsr_log()
167
+{
151 168
 	$args = func_get_args();
152 169
 	$context = isset( $args[1] )
153 170
 		? $args[1]
Please login to merge, or discard this patch.