Passed
Push — master ( 9a7a6b...7de9ff )
by Paul
03:37
created
plugin/Modules/Translation.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$translations = $this->translations();
32 32
 		$entries = $this->filter( $translations, $this->entries() )->results();
33
-		array_walk( $translations, function( &$entry ) use( $entries ) {
33
+		array_walk( $translations, function( &$entry ) use($entries) {
34 34
 			$entry['desc'] = array_key_exists( $entry['id'], $entries )
35 35
 				? $this->getEntryString( $entries[$entry['id']], 'msgctxt' )
36 36
 				: '';
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function entries()
45 45
 	{
46
-		if( !isset( $this->entries )) {
46
+		if( !isset($this->entries) ) {
47 47
 			$potFile = glsr()->path( glsr()->languages.'/'.Application::ID.'.pot' );
48 48
 			$entries = $this->extractEntriesFromPotFile( $potFile );
49 49
 			$entries = apply_filters( 'site-reviews/translation/entries', $entries );
@@ -88,13 +88,13 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function filter( $filterWith = null, $entries = null, $intersect = true )
90 90
 	{
91
-		if( !is_array( $entries )) {
91
+		if( !is_array( $entries ) ) {
92 92
 			$entries = $this->results;
93 93
 		}
94
-		if( !is_array( $filterWith )) {
94
+		if( !is_array( $filterWith ) ) {
95 95
 			$filterWith = $this->translations();
96 96
 		}
97
-		$keys = array_flip( array_column( $filterWith, 'id' ));
97
+		$keys = array_flip( array_column( $filterWith, 'id' ) );
98 98
 		$this->results = $intersect
99 99
 			? array_intersect_key( $entries, $keys )
100 100
 			: array_diff_key( $entries, $keys );
@@ -108,17 +108,17 @@  discard block
 block discarded – undo
108 108
 	public function render( $template, array $entry )
109 109
 	{
110 110
 		$data = array_combine(
111
-			array_map( function( $key ) { return 'data.'.$key; }, array_keys( $entry )),
111
+			array_map( function( $key ) { return 'data.'.$key; }, array_keys( $entry ) ),
112 112
 			$entry
113 113
 		);
114 114
 		$data['data.class'] = $data['data.error'] = '';
115
-		if( array_search( $entry['s1'], array_column( $this->entries(), 'msgid' )) === false ) {
115
+		if( array_search( $entry['s1'], array_column( $this->entries(), 'msgid' ) ) === false ) {
116 116
 			$data['data.class'] = 'is-invalid';
117 117
 			$data['data.error'] = __( 'This custom translation is no longer valid as the original text has been changed or removed.', 'site-reviews' );
118 118
 		}
119 119
 		return glsr( Template::class )->build( 'partials/translations/'.$template, [
120 120
 			'context' => $data,
121
-		]);
121
+		] );
122 122
 	}
123 123
 
124 124
 	/**
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
 				'p1' => $this->getEntryString( $entry, 'msgid_plural' ),
151 151
 				's1' => $this->getEntryString( $entry, 'msgid' ),
152 152
 			];
153
-			$text = !empty( $data['p1'] )
153
+			$text = !empty($data['p1'])
154 154
 				? sprintf( '%s | %s', $data['s1'], $data['p1'] )
155 155
 				: $data['s1'];
156 156
 			$rendered .= $this->render( 'result', [
157
-				'entry' => json_encode( $data, JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_TAG|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE ),
157
+				'entry' => json_encode( $data, JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_TAG | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ),
158 158
 				'text' => wp_strip_all_tags( $text ),
159
-			]);
159
+			] );
160 160
 		}
161 161
 		if( $resetAfterRender ) {
162 162
 			$this->reset();
@@ -189,12 +189,12 @@  discard block
 block discarded – undo
189 189
 	public function search( $needle = '' )
190 190
 	{
191 191
 		$this->reset();
192
-		$needle = trim( strtolower( $needle ));
192
+		$needle = trim( strtolower( $needle ) );
193 193
 		foreach( $this->entries() as $key => $entry ) {
194
-			$single = strtolower( $this->getEntryString( $entry, 'msgid' ));
195
-			$plural = strtolower( $this->getEntryString( $entry, 'msgid_plural' ));
194
+			$single = strtolower( $this->getEntryString( $entry, 'msgid' ) );
195
+			$plural = strtolower( $this->getEntryString( $entry, 'msgid_plural' ) );
196 196
 			if( strlen( $needle ) < static::SEARCH_THRESHOLD ) {
197
-				if( in_array( $needle, [$single, $plural] )) {
197
+				if( in_array( $needle, [$single, $plural] ) ) {
198 198
 					$this->results[$key] = $entry;
199 199
 				}
200 200
 			}
@@ -212,10 +212,10 @@  discard block
 block discarded – undo
212 212
 	public function translations()
213 213
 	{
214 214
 		static $translations;
215
-		if( empty( $translations )) {
215
+		if( empty($translations) ) {
216 216
 			$settings = glsr( OptionManager::class )->get( 'settings' );
217
-			$translations = isset( $settings['strings'] )
218
-				? $this->normalizeSettings( (array) $settings['strings'] )
217
+			$translations = isset($settings['strings'])
218
+				? $this->normalizeSettings( (array)$settings['strings'] )
219 219
 				: [];
220 220
 		}
221 221
 		return $translations;
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
 	 */
228 228
 	protected function getEntryString( array $entry, $key )
229 229
 	{
230
-		return isset( $entry[$key] )
231
-			? implode( '', (array) $entry[$key] )
230
+		return isset($entry[$key])
231
+			? implode( '', (array)$entry[$key] )
232 232
 			: '';
233 233
 	}
234 234
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 		$keys = [
241 241
 			'msgctxt', 'msgid', 'msgid_plural', 'msgstr', 'msgstr[0]', 'msgstr[1]',
242 242
 		];
243
-		array_walk( $entries, function( &$entry ) use( $keys ) {
243
+		array_walk( $entries, function( &$entry ) use($keys) {
244 244
 			foreach( $keys as $key ) {
245 245
 				$entry = $this->normalizeEntryString( $entry, $key );
246 246
 			}
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 	 */
255 255
 	protected function normalizeEntryString( array $entry, $key )
256 256
 	{
257
-		if( isset( $entry[$key] )) {
257
+		if( isset($entry[$key]) ) {
258 258
 			$entry[$key] = $this->getEntryString( $entry, $key );
259 259
 		}
260 260
 		return $entry;
@@ -268,11 +268,11 @@  discard block
 block discarded – undo
268 268
 		$defaultString = array_fill_keys( ['id', 's1', 's2', 'p1', 'p2'], '' );
269 269
 		$strings = array_filter( $strings, 'is_array' );
270 270
 		foreach( $strings as &$string ) {
271
-			$string['type'] = isset( $string['p1'] ) ? 'plural' : 'single';
271
+			$string['type'] = isset($string['p1']) ? 'plural' : 'single';
272 272
 			$string = wp_parse_args( $string, $defaultString );
273 273
 		}
274 274
 		return array_filter( $strings, function( $string ) {
275
-			return !empty( $string['id'] );
275
+			return !empty($string['id']);
276 276
 		});
277 277
 	}
278 278
 }
Please login to merge, or discard this patch.
plugin/Modules/Translator.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	{
19 19
 		return $this->translate( $translation, $domain, [
20 20
 			'single' => $text,
21
-		]);
21
+		] );
22 22
 	}
23 23
 
24 24
 	/**
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 		return $this->translate( $translation, $domain, [
34 34
 			'context' => $context,
35 35
 			'single' => $text,
36
-		]);
36
+		] );
37 37
 	}
38 38
 
39 39
 	/**
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 			'number' => $number,
51 51
 			'plural' => $plural,
52 52
 			'single' => $single,
53
-		]);
53
+		] );
54 54
 	}
55 55
 
56 56
 	/**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 			'number' => $number,
70 70
 			'plural' => $plural,
71 71
 			'single' => $single,
72
-		]);
72
+		] );
73 73
 	}
74 74
 
75 75
 	/**
@@ -80,12 +80,12 @@  discard block
 block discarded – undo
80 80
 	public function translate( $original, $domain, array $args )
81 81
 	{
82 82
 		$domains = apply_filters( 'site-reviews/translator/domains', [Application::ID] );
83
-		if( !in_array( $domain, $domains )) {
83
+		if( !in_array( $domain, $domains ) ) {
84 84
 			return $original;
85 85
 		}
86 86
 		$args = $this->normalizeTranslationArgs( $args );
87 87
 		$strings = $this->getTranslationStrings( $args['single'], $args['plural'] );
88
-		if( empty( $strings )) {
88
+		if( empty($strings) ) {
89 89
 			return $original;
90 90
 		}
91 91
 		$string = current( $strings );
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	protected function getTranslationStrings( $single, $plural )
103 103
 	{
104
-		return array_filter( glsr( Translation::class )->translations(), function( $string ) use( $single, $plural ) {
104
+		return array_filter( glsr( Translation::class )->translations(), function( $string ) use($single, $plural) {
105 105
 			return $string['s1'] == html_entity_decode( $single, ENT_COMPAT, 'UTF-8' )
106 106
 				&& $string['p1'] == html_entity_decode( $plural, ENT_COMPAT, 'UTF-8' );
107 107
 		});
@@ -127,10 +127,10 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	protected function translatePlural( $domain, array $string, array $args )
129 129
 	{
130
-		if( !empty( $string['s2'] )) {
130
+		if( !empty($string['s2']) ) {
131 131
 			$args['single'] = $string['s2'];
132 132
 		}
133
-		if( !empty( $string['p2'] )) {
133
+		if( !empty($string['p2']) ) {
134 134
 			$args['plural'] = $string['p2'];
135 135
 		}
136 136
 		return get_translations_for_domain( $domain )->translate_plural(
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	 */
148 148
 	protected function translateSingle( $domain, array $string, array $args )
149 149
 	{
150
-		if( !empty( $string['s2'] )) {
150
+		if( !empty($string['s2']) ) {
151 151
 			$args['single'] = $string['s2'];
152 152
 		}
153 153
 		return get_translations_for_domain( $domain )->translate(
Please login to merge, or discard this patch.
plugin/Modules/Html/Fields/Field.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 	 */
22 22
 	public function build()
23 23
 	{
24
-		glsr_log()->error( 'Build method is not implemented for '.get_class( $this ));
24
+		glsr_log()->error( 'Build method is not implemented for '.get_class( $this ) );
25 25
 	}
26 26
 
27 27
 	/**
Please login to merge, or discard this patch.
plugin/Actions.php 2 patches
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.
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -54,57 +54,57 @@
 block discarded – undo
54 54
 	 */
55 55
 	public function run()
56 56
 	{
57
-		add_action( 'admin_enqueue_scripts',                        [$this->admin, 'enqueueAssets'] );
58
-		add_action( 'admin_init',                                   [$this->admin, 'registerTinymcePopups'] );
59
-		add_action( 'media_buttons',                                [$this->admin, 'renderTinymceButton'], 11 );
60
-		add_action( 'plugins_loaded',                               [$this->app, 'getDefaults'], 11 );
61
-		add_action( 'plugins_loaded',                               [$this->app, 'registerAddons'] );
62
-		add_action( 'plugins_loaded',                               [$this->app, 'registerLanguages'] );
63
-		add_action( 'plugins_loaded',                               [$this->app, 'registerReviewTypes'] );
64
-		add_action( 'upgrader_process_complete',                    [$this->app, 'upgraded'], 10, 2 );
65
-		add_action( 'init',                                         [$this->blocks, 'registerAssets'], 9 );
66
-		add_action( 'init',                                         [$this->blocks, 'registerBlocks'] );
67
-		add_action( 'admin_enqueue_scripts',                        [$this->editor, 'customizePostStatusLabels'] );
68
-		add_action( 'add_meta_boxes',                               [$this->editor, 'registerMetaBoxes'], 10, 2 );
69
-		add_action( 'admin_print_scripts',                          [$this->editor, 'removeAutosave'], 999 );
70
-		add_action( 'admin_menu',                                   [$this->editor, 'removeMetaBoxes'] );
71
-		add_action( 'current_screen',                               [$this->editor, 'removePostTypeSupport'] );
72
-		add_action( 'post_submitbox_misc_actions',                  [$this->editor, 'renderPinnedInPublishMetaBox'] );
73
-		add_action( 'admin_head',                                   [$this->editor, 'renderReviewFields'] );
74
-		add_action( 'admin_action_revert',                          [$this->editor, 'revertReview'] );
75
-		add_action( 'save_post_'.Application::POST_TYPE,            [$this->editor, 'saveMetaboxes'] );
76
-		add_action( 'admin_action_approve',                         [$this->listtable, 'approve'] );
77
-		add_action( 'bulk_edit_custom_box',                         [$this->listtable, 'renderBulkEditFields'], 10, 2 );
78
-		add_action( 'restrict_manage_posts',                        [$this->listtable, 'renderColumnFilters'] );
79
-		add_action( 'manage_posts_custom_column',                   [$this->listtable, 'renderColumnValues'], 10, 2 );
80
-		add_action( 'save_post_'.Application::POST_TYPE,            [$this->listtable, 'saveBulkEditFields'] );
81
-		add_action( 'pre_get_posts',                                [$this->listtable, 'setQueryForColumn'] );
82
-		add_action( 'admin_action_unapprove',                       [$this->listtable, 'unapprove'] );
83
-		add_action( 'init',                                         [$this->main, 'registerPostType'], 8 );
84
-		add_action( 'init',                                         [$this->main, 'registerShortcodes'] );
85
-		add_action( 'init',                                         [$this->main, 'registerTaxonomy'] );
86
-		add_action( 'widgets_init',                                 [$this->main, 'registerWidgets'] );
87
-		add_action( 'admin_menu',                                   [$this->menu, 'registerMenuCount'] );
88
-		add_action( 'admin_menu',                                   [$this->menu, 'registerSubMenus'] );
89
-		add_action( 'admin_init',                                   [$this->menu, 'setCustomPermissions'], 999 );
90
-		add_action( 'wp_enqueue_scripts',                           [$this->public, 'enqueueAssets'], 999 );
91
-		add_filter( 'site-reviews/builder',                         [$this->public, 'modifyBuilder'] );
92
-		add_action( 'wp_footer',                                    [$this->public, 'renderSchema'] );
93
-		add_action( 'set_object_terms',                             [$this->review, 'onAfterChangeCategory'], 10, 6 );
94
-		add_action( 'transition_post_status',                       [$this->review, 'onAfterChangeStatus'], 10, 3 );
95
-		add_action( 'site-reviews/review/created',                  [$this->review, 'onAfterCreate'] );
96
-		add_action( 'before_delete_post',                           [$this->review, 'onBeforeDelete'] );
97
-		add_action( 'update_postmeta',                              [$this->review, 'onBeforeUpdate'], 10, 4 );
98
-		add_action( 'admin_init',                                   [$this->router, 'routeAdminPostRequest'] );
99
-		add_action( 'wp_ajax_'.Application::PREFIX.'action',        [$this->router, 'routeAjaxRequest'] );
57
+		add_action( 'admin_enqueue_scripts', [$this->admin, 'enqueueAssets'] );
58
+		add_action( 'admin_init', [$this->admin, 'registerTinymcePopups'] );
59
+		add_action( 'media_buttons', [$this->admin, 'renderTinymceButton'], 11 );
60
+		add_action( 'plugins_loaded', [$this->app, 'getDefaults'], 11 );
61
+		add_action( 'plugins_loaded', [$this->app, 'registerAddons'] );
62
+		add_action( 'plugins_loaded', [$this->app, 'registerLanguages'] );
63
+		add_action( 'plugins_loaded', [$this->app, 'registerReviewTypes'] );
64
+		add_action( 'upgrader_process_complete', [$this->app, 'upgraded'], 10, 2 );
65
+		add_action( 'init', [$this->blocks, 'registerAssets'], 9 );
66
+		add_action( 'init', [$this->blocks, 'registerBlocks'] );
67
+		add_action( 'admin_enqueue_scripts', [$this->editor, 'customizePostStatusLabels'] );
68
+		add_action( 'add_meta_boxes', [$this->editor, 'registerMetaBoxes'], 10, 2 );
69
+		add_action( 'admin_print_scripts', [$this->editor, 'removeAutosave'], 999 );
70
+		add_action( 'admin_menu', [$this->editor, 'removeMetaBoxes'] );
71
+		add_action( 'current_screen', [$this->editor, 'removePostTypeSupport'] );
72
+		add_action( 'post_submitbox_misc_actions', [$this->editor, 'renderPinnedInPublishMetaBox'] );
73
+		add_action( 'admin_head', [$this->editor, 'renderReviewFields'] );
74
+		add_action( 'admin_action_revert', [$this->editor, 'revertReview'] );
75
+		add_action( 'save_post_'.Application::POST_TYPE, [$this->editor, 'saveMetaboxes'] );
76
+		add_action( 'admin_action_approve', [$this->listtable, 'approve'] );
77
+		add_action( 'bulk_edit_custom_box', [$this->listtable, 'renderBulkEditFields'], 10, 2 );
78
+		add_action( 'restrict_manage_posts', [$this->listtable, 'renderColumnFilters'] );
79
+		add_action( 'manage_posts_custom_column', [$this->listtable, 'renderColumnValues'], 10, 2 );
80
+		add_action( 'save_post_'.Application::POST_TYPE, [$this->listtable, 'saveBulkEditFields'] );
81
+		add_action( 'pre_get_posts', [$this->listtable, 'setQueryForColumn'] );
82
+		add_action( 'admin_action_unapprove', [$this->listtable, 'unapprove'] );
83
+		add_action( 'init', [$this->main, 'registerPostType'], 8 );
84
+		add_action( 'init', [$this->main, 'registerShortcodes'] );
85
+		add_action( 'init', [$this->main, 'registerTaxonomy'] );
86
+		add_action( 'widgets_init', [$this->main, 'registerWidgets'] );
87
+		add_action( 'admin_menu', [$this->menu, 'registerMenuCount'] );
88
+		add_action( 'admin_menu', [$this->menu, 'registerSubMenus'] );
89
+		add_action( 'admin_init', [$this->menu, 'setCustomPermissions'], 999 );
90
+		add_action( 'wp_enqueue_scripts', [$this->public, 'enqueueAssets'], 999 );
91
+		add_filter( 'site-reviews/builder', [$this->public, 'modifyBuilder'] );
92
+		add_action( 'wp_footer', [$this->public, 'renderSchema'] );
93
+		add_action( 'set_object_terms', [$this->review, 'onAfterChangeCategory'], 10, 6 );
94
+		add_action( 'transition_post_status', [$this->review, 'onAfterChangeStatus'], 10, 3 );
95
+		add_action( 'site-reviews/review/created', [$this->review, 'onAfterCreate'] );
96
+		add_action( 'before_delete_post', [$this->review, 'onBeforeDelete'] );
97
+		add_action( 'update_postmeta', [$this->review, 'onBeforeUpdate'], 10, 4 );
98
+		add_action( 'admin_init', [$this->router, 'routeAdminPostRequest'] );
99
+		add_action( 'wp_ajax_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] );
100 100
 		add_action( 'wp_ajax_nopriv_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] );
101
-		add_action( 'init',                                         [$this->router, 'routePublicPostRequest'] );
102
-		add_action( 'site-reviews/schedule/session/purge',          [$this->session, 'deleteExpiredSessions'] );
103
-		add_action( 'admin_init',                                   [$this->settings, 'registerSettings'] );
104
-		add_action( Application::TAXONOMY.'_term_edit_form_top',    [$this->taxonomy, 'disableParents'] );
105
-		add_action( Application::TAXONOMY.'_term_new_form_tag',     [$this->taxonomy, 'disableParents'] );
106
-		add_action( Application::TAXONOMY.'_add_form_fields',       [$this->taxonomy, 'enableParents'] );
107
-		add_action( Application::TAXONOMY.'_edit_form',             [$this->taxonomy, 'enableParents'] );
108
-		add_action( 'restrict_manage_posts',                        [$this->taxonomy, 'renderTaxonomyFilter'], 9 );
101
+		add_action( 'init', [$this->router, 'routePublicPostRequest'] );
102
+		add_action( 'site-reviews/schedule/session/purge', [$this->session, 'deleteExpiredSessions'] );
103
+		add_action( 'admin_init', [$this->settings, 'registerSettings'] );
104
+		add_action( Application::TAXONOMY.'_term_edit_form_top', [$this->taxonomy, 'disableParents'] );
105
+		add_action( Application::TAXONOMY.'_term_new_form_tag', [$this->taxonomy, 'disableParents'] );
106
+		add_action( Application::TAXONOMY.'_add_form_fields', [$this->taxonomy, 'enableParents'] );
107
+		add_action( Application::TAXONOMY.'_edit_form', [$this->taxonomy, 'enableParents'] );
108
+		add_action( 'restrict_manage_posts', [$this->taxonomy, 'renderTaxonomyFilter'], 9 );
109 109
 	}
110 110
 }
Please login to merge, or discard this patch.
plugin/Blocks/SiteReviewsFormBlock.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -73,8 +73,8 @@
 block discarded – undo
73 73
 		add_filter( 'site-reviews/rendered/field', function( $html, $type, $args ) {
74 74
 			if( $args['path'] == 'rating' ) {
75 75
 				$stars = '<span class="glsr-stars">';
76
-				$stars.= str_repeat( '<span class="glsr-star glsr-star-empty" aria-hidden="true"></span>', 5 );
77
-				$stars.= '</span>';
76
+				$stars .= str_repeat( '<span class="glsr-star glsr-star-empty" aria-hidden="true"></span>', 5 );
77
+				$stars .= '</span>';
78 78
 				$html = preg_replace( '/(.*)(<select.*)(<\/select>)(.*)/', '$1'.$stars.'$4', $html );
79 79
 			}
80 80
 			return $html;
Please login to merge, or discard this patch.
plugin/Blocks/BlockGenerator.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,14 +19,14 @@
 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' ) )return;
23 23
 		register_block_type( Application::ID.'/'.$block, [
24 24
 			'attributes' => $this->attributes(),
25 25
 			'editor_script' => Application::ID.'/blocks',
26 26
 			'editor_style' => Application::ID.'/blocks',
27 27
 			'render_callback' => [$this, 'render'],
28 28
 			'style' => Application::ID,
29
-		]);
29
+		] );
30 30
 	}
31 31
 
32 32
 	/**
Please login to merge, or discard this 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/BlocksController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,8 +79,8 @@
 block discarded – undo
79 79
 		foreach( $blocks as $block ) {
80 80
 			$id = str_replace( '_reviews', '', Application::ID.'_'.$block );
81 81
 			$blockClass = glsr( Helper::class )->buildClassName( $id.'-block', 'Blocks' );
82
-			if( !class_exists( $blockClass )) {
83
-				glsr_log()->error( sprintf( 'Class missing (%s)', $blockClass ));
82
+			if( !class_exists( $blockClass ) ) {
83
+				glsr_log()->error( sprintf( 'Class missing (%s)', $blockClass ) );
84 84
 				continue;
85 85
 			}
86 86
 			glsr( $blockClass )->register( $block );
Please login to merge, or discard this patch.
plugin/Controllers/EditorController.php 2 patches
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -129,13 +129,13 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	public function renderAssignedToMetabox( WP_Post $post )
131 131
 	{
132
-		if( !$this->isReviewPostType( $post ))return;
132
+		if( !$this->isReviewPostType( $post ) )return;
133 133
 		$assignedTo = (string)get_post_meta( $post->ID, 'assigned_to', true );
134 134
 		wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false );
135 135
 		glsr()->render( 'partials/editor/metabox-assigned-to', [
136 136
 			'id' => $assignedTo,
137 137
 			'template' => $this->buildAssignedToTemplate( $assignedTo, $post ),
138
-		]);
138
+		] );
139 139
 	}
140 140
 
141 141
 	/**
@@ -144,12 +144,12 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	public function renderDetailsMetaBox( WP_Post $post )
146 146
 	{
147
-		if( !$this->isReviewPostType( $post ))return;
147
+		if( !$this->isReviewPostType( $post ) )return;
148 148
 		$review = glsr( ReviewManager::class )->single( $post );
149 149
 		glsr()->render( 'partials/editor/metabox-details', [
150 150
 			'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ),
151 151
 			'metabox' => $this->normalizeDetailsMetaBox( $review ),
152
-		]);
152
+		] );
153 153
 	}
154 154
 
155 155
 	/**
@@ -158,14 +158,14 @@  discard block
 block discarded – undo
158 158
 	 */
159 159
 	public function renderPinnedInPublishMetaBox()
160 160
 	{
161
-		if( !$this->isReviewPostType( get_post() ))return;
161
+		if( !$this->isReviewPostType( get_post() ) )return;
162 162
 		glsr( Template::class )->render( 'partials/editor/pinned', [
163 163
 			'context' => [
164 164
 				'no' => __( 'No', 'site-reviews' ),
165 165
 				'yes' => __( 'Yes', 'site-reviews' ),
166 166
 			],
167
-			'pinned' => wp_validate_boolean( get_post_meta( intval( get_the_ID() ), 'pinned', true )),
168
-		]);
167
+			'pinned' => wp_validate_boolean( get_post_meta( intval( get_the_ID() ), 'pinned', true ) ),
168
+		] );
169 169
 	}
170 170
 
171 171
 	/**
@@ -174,11 +174,11 @@  discard block
 block discarded – undo
174 174
 	 */
175 175
 	public function renderResponseMetaBox( WP_Post $post )
176 176
 	{
177
-		if( !$this->isReviewPostType( $post ))return;
177
+		if( !$this->isReviewPostType( $post ) )return;
178 178
 		wp_nonce_field( 'response', '_nonce-response', false );
179 179
 		glsr()->render( 'partials/editor/metabox-response', [
180 180
 			'response' => get_post_meta( $post->ID, 'response', true ),
181
-		]);
181
+		] );
182 182
 	}
183 183
 
184 184
 	/**
@@ -187,11 +187,11 @@  discard block
 block discarded – undo
187 187
 	 */
188 188
 	public function renderReviewEditor( WP_Post $post )
189 189
 	{
190
-		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return;
190
+		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) )return;
191 191
 		glsr()->render( 'partials/editor/review', [
192 192
 			'post' => $post,
193 193
 			'response' => get_post_meta( $post->ID, 'response', true ),
194
-		]);
194
+		] );
195 195
 	}
196 196
 
197 197
 	/**
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 		$screen = glsr_current_screen();
204 204
 		if( $screen->base != 'post' || $screen->post_type != Application::POST_TYPE )return;
205 205
 		add_action( 'edit_form_after_title', [$this, 'renderReviewEditor'] );
206
-		add_action( 'edit_form_top',         [$this, 'renderReviewNotice'] );
206
+		add_action( 'edit_form_top', [$this, 'renderReviewNotice'] );
207 207
 	}
208 208
 
209 209
 	/**
@@ -212,16 +212,16 @@  discard block
 block discarded – undo
212 212
 	 */
213 213
 	public function renderReviewNotice( WP_Post $post )
214 214
 	{
215
-		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return;
215
+		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) )return;
216 216
 		glsr( Notice::class )->addWarning( sprintf(
217 217
 			__( '%s reviews are read-only.', 'site-reviews' ),
218 218
 			glsr( Columns::class )->buildColumnReviewType( $post->ID )
219
-		));
219
+		) );
220 220
 		glsr( Template::class )->render( 'partials/editor/notice', [
221 221
 			'context' => [
222 222
 				'notices' => glsr( Notice::class )->get(),
223 223
 			],
224
-		]);
224
+		] );
225 225
 	}
226 226
 
227 227
 	/**
@@ -231,12 +231,12 @@  discard block
 block discarded – undo
231 231
 	 */
232 232
 	public function renderTaxonomyMetabox( WP_Post $post )
233 233
 	{
234
-		if( !$this->isReviewPostType( $post ))return;
234
+		if( !$this->isReviewPostType( $post ) )return;
235 235
 		glsr()->render( 'partials/editor/metabox-categories', [
236 236
 			'post' => $post,
237 237
 			'tax_name' => Application::TAXONOMY,
238 238
 			'taxonomy' => get_taxonomy( Application::TAXONOMY ),
239
-		]);
239
+		] );
240 240
 	}
241 241
 
242 242
 	/**
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 */
247 247
 	public function revertReview()
248 248
 	{
249
-		check_admin_referer( 'revert-review_'.( $postId = $this->getPostId() ));
249
+		check_admin_referer( 'revert-review_'.($postId = $this->getPostId()) );
250 250
 		glsr( ReviewManager::class )->revert( $postId );
251 251
 		$this->redirect( $postId, 52 );
252 252
 	}
@@ -269,13 +269,13 @@  discard block
 block discarded – undo
269 269
 	protected function buildAssignedToTemplate( $assignedTo, WP_Post $post )
270 270
 	{
271 271
 		$assignedPost = glsr( Database::class )->getAssignedToPost( $post->ID, $assignedTo );
272
-		if( !( $assignedPost instanceof WP_Post ))return;
272
+		if( !($assignedPost instanceof WP_Post) )return;
273 273
 		return glsr( Template::class )->build( 'partials/editor/assigned-post', [
274 274
 			'context' => [
275 275
 				'data.url' => (string)get_permalink( $assignedPost ),
276 276
 				'data.title' => get_the_title( $assignedPost ),
277 277
 			],
278
-		]);
278
+		] );
279 279
 	}
280 280
 
281 281
 	/**
@@ -299,13 +299,13 @@  discard block
 block discarded – undo
299 299
 				'class' => 'button button-large',
300 300
 				'href' => $revertUrl,
301 301
 				'id' => 'revert',
302
-			]);
302
+			] );
303 303
 		}
304 304
 		return glsr( Builder::class )->button( __( 'Nothing to Revert', 'site-reviews' ), [
305 305
 			'class' => 'button button-large',
306 306
 			'disabled' => true,
307 307
 			'id' => 'revert',
308
-		]);
308
+		] );
309 309
 	}
310 310
 
311 311
 	/**
@@ -318,11 +318,11 @@  discard block
 block discarded – undo
318 318
 		$reviewType = array_key_exists( $review->review_type, glsr()->reviewTypes )
319 319
 			? glsr()->reviewTypes[$review->review_type]
320 320
 			: __( 'Unknown', 'site-reviews' );
321
-		if( !empty( $review->url )) {
321
+		if( !empty($review->url) ) {
322 322
 			$reviewType = glsr( Builder::class )->a( $reviewType, [
323 323
 				'href' => $review->url,
324 324
 				'target' => '_blank',
325
-			]);
325
+			] );
326 326
 		}
327 327
 		return $reviewType;
328 328
 	}
@@ -351,16 +351,16 @@  discard block
 block discarded – undo
351 351
 	 */
352 352
 	protected function normalizeDetailsMetaBox( Review $review )
353 353
 	{
354
-		$user = empty( $review->user_id )
354
+		$user = empty($review->user_id)
355 355
 			? __( 'Unregistered user', 'site-reviews' )
356 356
 			: glsr( Builder::class )->a( get_the_author_meta( 'display_name', $review->user_id ), [
357 357
 				'href' => get_author_posts_url( $review->user_id ),
358
-			]);
359
-		$email = empty( $review->email )
358
+			] );
359
+		$email = empty($review->email)
360 360
 			? '&mdash;'
361 361
 			: glsr( Builder::class )->a( $review->email, [
362 362
 				'href' => 'mailto:'.$review->email.'?subject='.esc_attr( __( 'RE:', 'site-reviews' ).' '.$review->title ),
363
-			]);
363
+			] );
364 364
 		$metabox = [
365 365
 			__( 'Rating', 'site-reviews' ) => glsr( Partial::class )->build( 'star-rating', ['rating' => $review->rating] ),
366 366
 			__( 'Type', 'site-reviews' ) => $this->getReviewType( $review ),
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 			__( 'IP Address', 'site-reviews' ) => $review->ip_address,
372 372
 			__( 'Avatar', 'site-reviews' ) => sprintf( '<img src="%s" width="96">', $review->avatar ),
373 373
 		];
374
-		return array_filter( apply_filters( 'site-reviews/metabox/details', $metabox, $review ));
374
+		return array_filter( apply_filters( 'site-reviews/metabox/details', $metabox, $review ) );
375 375
 	}
376 376
 
377 377
 	/**
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 		$redirectUri = $hasReferer
389 389
 			? remove_query_arg( ['deleted', 'ids', 'trashed', 'untrashed'], $referer )
390 390
 			: get_edit_post_link( $postId );
391
-		wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri ));
391
+		wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri ) );
392 392
 		exit;
393 393
 	}
394 394
 }
Please login to merge, or discard this patch.
Braces   +36 added lines, -12 removed lines patch added patch discarded remove patch
@@ -90,10 +90,14 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	public function registerMetaBoxes( $postType, $post )
92 92
 	{
93
-		if( $postType != Application::POST_TYPE )return;
93
+		if( $postType != Application::POST_TYPE ) {
94
+			return;
95
+		}
94 96
 		add_meta_box( Application::ID.'_assigned_to', __( 'Assigned To', 'site-reviews' ), [$this, 'renderAssignedToMetabox'], null, 'side' );
95 97
 		add_meta_box( Application::ID.'_review', __( 'Details', 'site-reviews' ), [$this, 'renderDetailsMetaBox'], null, 'side' );
96
-		if( get_post_meta( $post->ID, 'review_type', true ) != 'local' )return;
98
+		if( get_post_meta( $post->ID, 'review_type', true ) != 'local' ) {
99
+			return;
100
+		}
97 101
 		add_meta_box( Application::ID.'_response', __( 'Respond Publicly', 'site-reviews' ), [$this, 'renderResponseMetaBox'], null, 'normal' );
98 102
 	}
99 103
 
@@ -129,7 +133,9 @@  discard block
 block discarded – undo
129 133
 	 */
130 134
 	public function renderAssignedToMetabox( WP_Post $post )
131 135
 	{
132
-		if( !$this->isReviewPostType( $post ))return;
136
+		if( !$this->isReviewPostType( $post )) {
137
+			return;
138
+		}
133 139
 		$assignedTo = (string)get_post_meta( $post->ID, 'assigned_to', true );
134 140
 		wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false );
135 141
 		glsr()->render( 'partials/editor/metabox-assigned-to', [
@@ -144,7 +150,9 @@  discard block
 block discarded – undo
144 150
 	 */
145 151
 	public function renderDetailsMetaBox( WP_Post $post )
146 152
 	{
147
-		if( !$this->isReviewPostType( $post ))return;
153
+		if( !$this->isReviewPostType( $post )) {
154
+			return;
155
+		}
148 156
 		$review = glsr( ReviewManager::class )->single( $post );
149 157
 		glsr()->render( 'partials/editor/metabox-details', [
150 158
 			'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ),
@@ -158,7 +166,9 @@  discard block
 block discarded – undo
158 166
 	 */
159 167
 	public function renderPinnedInPublishMetaBox()
160 168
 	{
161
-		if( !$this->isReviewPostType( get_post() ))return;
169
+		if( !$this->isReviewPostType( get_post() )) {
170
+			return;
171
+		}
162 172
 		glsr( Template::class )->render( 'partials/editor/pinned', [
163 173
 			'context' => [
164 174
 				'no' => __( 'No', 'site-reviews' ),
@@ -174,7 +184,9 @@  discard block
 block discarded – undo
174 184
 	 */
175 185
 	public function renderResponseMetaBox( WP_Post $post )
176 186
 	{
177
-		if( !$this->isReviewPostType( $post ))return;
187
+		if( !$this->isReviewPostType( $post )) {
188
+			return;
189
+		}
178 190
 		wp_nonce_field( 'response', '_nonce-response', false );
179 191
 		glsr()->render( 'partials/editor/metabox-response', [
180 192
 			'response' => get_post_meta( $post->ID, 'response', true ),
@@ -187,7 +199,9 @@  discard block
 block discarded – undo
187 199
 	 */
188 200
 	public function renderReviewEditor( WP_Post $post )
189 201
 	{
190
-		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return;
202
+		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) {
203
+			return;
204
+		}
191 205
 		glsr()->render( 'partials/editor/review', [
192 206
 			'post' => $post,
193 207
 			'response' => get_post_meta( $post->ID, 'response', true ),
@@ -201,7 +215,9 @@  discard block
 block discarded – undo
201 215
 	public function renderReviewFields()
202 216
 	{
203 217
 		$screen = glsr_current_screen();
204
-		if( $screen->base != 'post' || $screen->post_type != Application::POST_TYPE )return;
218
+		if( $screen->base != 'post' || $screen->post_type != Application::POST_TYPE ) {
219
+			return;
220
+		}
205 221
 		add_action( 'edit_form_after_title', [$this, 'renderReviewEditor'] );
206 222
 		add_action( 'edit_form_top',         [$this, 'renderReviewNotice'] );
207 223
 	}
@@ -212,7 +228,9 @@  discard block
 block discarded – undo
212 228
 	 */
213 229
 	public function renderReviewNotice( WP_Post $post )
214 230
 	{
215
-		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return;
231
+		if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) {
232
+			return;
233
+		}
216 234
 		glsr( Notice::class )->addWarning( sprintf(
217 235
 			__( '%s reviews are read-only.', 'site-reviews' ),
218 236
 			glsr( Columns::class )->buildColumnReviewType( $post->ID )
@@ -231,7 +249,9 @@  discard block
 block discarded – undo
231 249
 	 */
232 250
 	public function renderTaxonomyMetabox( WP_Post $post )
233 251
 	{
234
-		if( !$this->isReviewPostType( $post ))return;
252
+		if( !$this->isReviewPostType( $post )) {
253
+			return;
254
+		}
235 255
 		glsr()->render( 'partials/editor/metabox-categories', [
236 256
 			'post' => $post,
237 257
 			'tax_name' => Application::TAXONOMY,
@@ -269,7 +289,9 @@  discard block
 block discarded – undo
269 289
 	protected function buildAssignedToTemplate( $assignedTo, WP_Post $post )
270 290
 	{
271 291
 		$assignedPost = glsr( Database::class )->getAssignedToPost( $post->ID, $assignedTo );
272
-		if( !( $assignedPost instanceof WP_Post ))return;
292
+		if( !( $assignedPost instanceof WP_Post )) {
293
+			return;
294
+		}
273 295
 		return glsr( Template::class )->build( 'partials/editor/assigned-post', [
274 296
 			'context' => [
275 297
 				'data.url' => (string)get_permalink( $assignedPost ),
@@ -314,7 +336,9 @@  discard block
 block discarded – undo
314 336
 	 */
315 337
 	protected function getReviewType( $review )
316 338
 	{
317
-		if( count( glsr()->reviewTypes ) < 2 )return;
339
+		if( count( glsr()->reviewTypes ) < 2 ) {
340
+			return;
341
+		}
318 342
 		$reviewType = array_key_exists( $review->review_type, glsr()->reviewTypes )
319 343
 			? glsr()->reviewTypes[$review->review_type]
320 344
 			: __( 'Unknown', 'site-reviews' );
Please login to merge, or discard this patch.
plugin/Controllers/RestReviewController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 		register_rest_route( $this->namespace, '/types', [
29 29
 			'callback' => [$this, 'get_types'],
30 30
 			'methods' => Server::READABLE,
31
-		]);
31
+		] );
32 32
 	}
33 33
 
34 34
 	/**
Please login to merge, or discard this patch.