Test Setup Failed
Push — master ( 51607c...6b8ca8 )
by Paul
03:43
created
plugin/Handlers/RegisterPointers.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 		$pointers = $this->generatePointers( $command->pointers );
17 17
 		wp_localize_script( Application::ID, 'site_reviews_pointers', [
18 18
 			'pointers' => $pointers,
19
-		]);
20
-		if( empty( $pointers ))return;
19
+		] );
20
+		if( empty($pointers) )return;
21 21
 		wp_enqueue_style( 'wp-pointer' );
22 22
 		wp_enqueue_script( 'wp-pointer' );
23 23
 	}
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 		$generatedPointers = [];
33 33
 		foreach( $pointers as $pointer ) {
34 34
 			if( $pointer['screen'] != glsr_current_screen()->id )continue;
35
-			if( in_array( $pointer['id'], $dismissedPointers ))continue;
35
+			if( in_array( $pointer['id'], $dismissedPointers ) )continue;
36 36
 			$generatedPointers[] = $this->generatePointer( $pointer );
37 37
 		}
38 38
 		return $generatedPointers;
Please login to merge, or discard this patch.
plugin/Handlers/RegisterPostType.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,10 +11,10 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
plugin/Handlers/SubmitReview.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	protected function createWebhookNotification( Command $command, array $args )
62 62
 	{
63 63
 		$fields = [];
64
-		$fields[] = ['title' => str_repeat( ':star:', (int) $command->rating )];
64
+		$fields[] = ['title' => str_repeat( ':star:', (int)$command->rating )];
65 65
 		if( $command->title ) {
66 66
 			$fields[] = ['title' => $command->title];
67 67
 		}
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 		if( $command->author ) {
75 75
 			$fields[] = ['value' => trim( $command->author.$command->email.' - '.$command->ipAddress )];
76 76
 		}
77
-		$fields[] = ['value' => sprintf( '<%s|%s>', $args['notification_link'], __( 'View Review', 'site-reviews' ))];
78
-		return json_encode([
77
+		$fields[] = ['value' => sprintf( '<%s|%s>', $args['notification_link'], __( 'View Review', 'site-reviews' ) )];
78
+		return json_encode( [
79 79
 			'icon_url' => glsr()->url.'assets/img/icon.png',
80 80
 			'username' => glsr()->name,
81 81
 			'attachments' => [[
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 				'fallback' => $this->createEmailNotification( $command, $args )->read( 'plaintext' ),
85 85
 				'fields' => $fields,
86 86
 			]],
87
-		]);
87
+		] );
88 88
 	}
89 89
 
90 90
 	/**
@@ -113,12 +113,12 @@  discard block
 block discarded – undo
113 113
 	protected function sendNotification( $post_id, Command $command )
114 114
 	{
115 115
 		$notificationType = glsr( OptionManager::class )->get( 'settings.general.notification' );
116
-		if( !in_array( $notificationType, ['default','custom','webhook'] ))return;
117
-		$assignedToTitle = get_the_title( (int) $command->assignedTo );
116
+		if( !in_array( $notificationType, ['default', 'custom', 'webhook'] ) )return;
117
+		$assignedToTitle = get_the_title( (int)$command->assignedTo );
118 118
 		$notificationSubject = _nx(
119 119
 			'New %s-star review',
120 120
 			'New %s-star review of: %s',
121
-			(int) empty( $assignedToTitle ),
121
+			(int)empty($assignedToTitle),
122 122
 			'The text is different depending on whether or not the review has been assigned to a post.',
123 123
 			'site-reviews'
124 124
 		);
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 			sprintf( $notificationSubject, $command->rating, $assignedToTitle )
128 128
 		);
129 129
 		$args = [
130
-			'notification_link' => esc_url( admin_url( sprintf( 'post.php?post=%s&action=edit', $post_id ))),
130
+			'notification_link' => esc_url( admin_url( sprintf( 'post.php?post=%s&action=edit', $post_id ) ) ),
131 131
 			'notification_title' => $notificationTitle,
132 132
 			'notification_type' => $notificationType,
133 133
 		];
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 		$args['recipient'] = $args['notification_type'] === 'default'
145 145
 			? get_option( 'admin_email' )
146 146
 			: glsr( OptionManager::class )->get( 'settings.general.notification_email' );
147
-		$result = !empty( $args['recipient'] )
147
+		$result = !empty($args['recipient'])
148 148
 			? $this->createEmailNotification( $command, $args )->send()
149 149
 			: false;
150 150
 		if( $result === null ) {
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 		if( $result === false ) {
154 154
 			glsr_log( __( 'Email notification was not sent: wp_mail() failed.', 'site-reviews' ), 'error' );
155 155
 		}
156
-		return (bool) $result;
156
+		return (bool)$result;
157 157
 	}
158 158
 
159 159
 	/**
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 			'sslverify' => false,
172 172
 			'headers' => ['Content-Type' => 'application/json'],
173 173
 			'body' => apply_filters( 'site-reviews/webhook/notification', $notification, $command ),
174
-		]);
175
-		if( is_wp_error( $result )) {
174
+		] );
175
+		if( is_wp_error( $result ) ) {
176 176
 			glsr_log( $result->get_error_message(), 'error' );
177 177
 		}
178 178
 		return $result;
Please login to merge, or discard this patch.
plugin/Handlers/TogglePinned.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@
 block discarded – undo
12 12
 	 */
13 13
 	public function handle( Command $command )
14 14
 	{
15
-		if( !get_post( $command->id )) {
15
+		if( !get_post( $command->id ) ) {
16 16
 			return false;
17 17
 		}
18
-		if( is_null( $command->pinned )) {
18
+		if( is_null( $command->pinned ) ) {
19 19
 			$meta = get_post_meta( $command->id, 'pinned', true );
20 20
 			$command->pinned = !wp_validate_boolean( $meta );
21 21
 		}
Please login to merge, or discard this patch.
plugin/Handlers/EnqueueAdminAssets.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 		$dependencies = []; //glsr( Html::class )->getDependencies();
63 63
 		$dependencies = array_merge( $dependencies, [
64 64
 			'jquery', 'jquery-ui-sortable', 'underscore', 'wp-util',
65
-		]);
65
+		] );
66 66
 		return $dependencies;
67 67
 	}
68 68
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	protected function isCurrentScreen()
73 73
 	{
74 74
 		$screen = glsr_current_screen();
75
-		return $screen && ( $screen->post_type == Application::POST_TYPE
75
+		return $screen && ($screen->post_type == Application::POST_TYPE
76 76
 			|| $screen->base == 'post'
77 77
 			|| $screen->id == 'dashboard'
78 78
 			|| $screen->id == 'widgets'
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	{
87 87
 		$variables = [];
88 88
 		foreach( glsr()->mceShortcodes as $tag => $args ) {
89
-			if( empty( $args['required'] ))continue;
89
+			if( empty($args['required']) )continue;
90 90
 			$variables[$tag] = $args['required'];
91 91
 		}
92 92
 		return $variables;
Please login to merge, or discard this patch.
plugin/Handlers/EnqueueAssets.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -21,14 +21,14 @@  discard block
 block discarded – undo
21 21
 		$this->dependencies = glsr( 'Html' )->getDependencies();
22 22
 		$ajaxNonce = wp_create_nonce( Application::ID.'-ajax-nonce' );
23 23
 		$variables = [
24
-			'action'  => glsr()->prefix . '_action',
25
-			'ajaxurl' => add_query_arg( '_nonce', $ajaxNonce, admin_url( 'admin-ajax.php' )),
24
+			'action'  => glsr()->prefix.'_action',
25
+			'ajaxurl' => add_query_arg( '_nonce', $ajaxNonce, admin_url( 'admin-ajax.php' ) ),
26 26
 			'ajaxnonce' => $ajaxNonce,
27
-			'ajaxpagination' => ['#wpadminbar','.site-navigation-fixed'],
27
+			'ajaxpagination' => ['#wpadminbar', '.site-navigation-fixed'],
28 28
 		];
29 29
 		$this->enqueueAssets();
30 30
 
31
-		wp_localize_script( Application::ID, 'site_reviews', apply_filters( 'site-reviews/enqueue/localize', $variables ));
31
+		wp_localize_script( Application::ID, 'site_reviews', apply_filters( 'site-reviews/enqueue/localize', $variables ) );
32 32
 	}
33 33
 
34 34
 	/**
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
 	 */
37 37
 	public function enqueueAssets()
38 38
 	{
39
-		$currentTheme = sanitize_title( wp_get_theme()->get( 'Name' ));
39
+		$currentTheme = sanitize_title( wp_get_theme()->get( 'Name' ) );
40 40
 		$stylesheet = file_exists( glsr()->path.'assets/css/'.$currentTheme.'.css' )
41 41
 			? glsr()->url.'assets/css/'.$currentTheme.'.css'
42 42
 			: glsr()->url.'assets/css/'.Application::ID.'.css';
43
-		if( apply_filters( 'site-reviews/assets/css', true )) {
43
+		if( apply_filters( 'site-reviews/assets/css', true ) ) {
44 44
 			wp_enqueue_style(
45 45
 				Application::ID,
46 46
 				$stylesheet,
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 				glsr()->version
49 49
 			);
50 50
 		}
51
-		if( apply_filters( 'site-reviews/assets/js', true )) {
51
+		if( apply_filters( 'site-reviews/assets/js', true ) ) {
52 52
 			wp_enqueue_script(
53 53
 				Application::ID,
54 54
 				glsr()->url.'assets/js/'.Application::ID.'.js',
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	public function enqueueRecaptchaScript()
69 69
 	{
70
-		wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg([
70
+		wp_enqueue_script( Application::ID.'/google-recaptcha', add_query_arg( [
71 71
 			'hl' => apply_filters( 'site-reviews/recaptcha/language', get_locale() ),
72 72
 			'onload' => 'glsr_render_recaptcha',
73 73
 			'render' => 'explicit',
74
-		], 'https://www.google.com/recaptcha/api.js' ));
74
+		], 'https://www.google.com/recaptcha/api.js' ) );
75 75
 		$inlineScript = file_get_contents( glsr()->path.'js/recaptcha.js' );
76 76
 		wp_add_inline_script( Application::ID.'/google-recaptcha', $inlineScript, 'before' );
77 77
 	}
Please login to merge, or discard this patch.
plugin/Filters.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -38,20 +38,20 @@
 block discarded – undo
38 38
 	 */
39 39
 	public function run()
40 40
 	{
41
-		add_filter( 'mce_external_plugins',                                    [$this->admin, 'filterTinymcePlugins'], 15 );
42
-		add_filter( 'plugin_action_links_'.$this->basename,                    [$this->admin, 'filterActionLinks'] );
43
-		add_filter( 'dashboard_glance_items',                                  [$this->admin, 'filterDashboardGlanceItems'] );
41
+		add_filter( 'mce_external_plugins', [$this->admin, 'filterTinymcePlugins'], 15 );
42
+		add_filter( 'plugin_action_links_'.$this->basename, [$this->admin, 'filterActionLinks'] );
43
+		add_filter( 'dashboard_glance_items', [$this->admin, 'filterDashboardGlanceItems'] );
44 44
 		// add_filter( 'wp_editor_settings',                                      [$this->editor, 'filterEditorSettings'] );
45 45
 		// add_filter( 'the_editor',                                              [$this->editor, 'filterEditorTextarea'] );
46 46
 		// add_filter( 'gettext',                                                 [$this->editor, 'filterPostStatusLabels'], 10, 3 );
47 47
 		// add_filter( 'gettext_with_context',                                    [$this->editor, 'filterPostStatusLabelsWithContext'], 10, 4 );
48 48
 		// add_filter( 'post_updated_messages',                                   [$this->editor, 'filterUpdateMessages'] );
49
-		add_filter( 'bulk_post_updated_messages',                              [$this->listtable, 'filterBulkUpdateMessages'], 10, 2 );
50
-		add_filter( 'manage_'.Application::POST_TYPE.'_posts_columns',         [$this->listtable, 'filterColumnsForPostType'] );
51
-		add_filter( 'default_hidden_columns',                                  [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2 );
52
-		add_filter( 'post_row_actions',                                        [$this->listtable, 'filterRowActions'], 10, 2 );
49
+		add_filter( 'bulk_post_updated_messages', [$this->listtable, 'filterBulkUpdateMessages'], 10, 2 );
50
+		add_filter( 'manage_'.Application::POST_TYPE.'_posts_columns', [$this->listtable, 'filterColumnsForPostType'] );
51
+		add_filter( 'default_hidden_columns', [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2 );
52
+		add_filter( 'post_row_actions', [$this->listtable, 'filterRowActions'], 10, 2 );
53 53
 		add_filter( 'manage_edit-'.Application::POST_TYPE.'_sortable_columns', [$this->listtable, 'filterSortableColumns'] );
54
-		add_filter( 'ngettext',                                                [$this->listtable, 'filterStatusText'], 10, 5 );
54
+		add_filter( 'ngettext', [$this->listtable, 'filterStatusText'], 10, 5 );
55 55
 		// add_filter( 'script_loader_tag',                                       [$this->public, 'filterEnqueuedScripts'], 10, 2 );
56 56
 		// add_filter( 'query_vars',                                              [$this->public, 'filterQueryVars'] );
57 57
 		// add_filter( 'gettext',                                                 [$this->translator, 'filterGettext'], 10, 3 );
Please login to merge, or discard this patch.
plugin/Controllers/PublicController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,10 +44,10 @@  discard block
 block discarded – undo
44 44
 		$vars[] = Application::PAGED_QUERY_VAR;
45 45
 		// dirty hack to fix a form submission with a field that has "name" as name
46 46
 		if( filter_input( INPUT_POST, 'action' ) == 'submit-review'
47
-			&& !is_null( filter_input( INPUT_POST, 'gotcha' ))) {
47
+			&& !is_null( filter_input( INPUT_POST, 'gotcha' ) ) ) {
48 48
 			$index = array_search( 'name', $vars, true );
49 49
 			if( false !== $index ) {
50
-				unset( $vars[$index] );
50
+				unset($vars[$index]);
51 51
 			}
52 52
 		}
53 53
 		return $vars;
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
 	public function postSubmitReview( array $request )
60 60
 	{
61 61
 		$validated = glsr( ValidateReview::class )->validate( $request );
62
-		if( !empty( $validated->error )) {
62
+		if( !empty($validated->error) ) {
63 63
 			return $validated->request;
64 64
 		}
65 65
 		if( $validated->recaptchaIsUnset )return;
66
-		return $this->execute( new SubmitReview( $validated->request ));
66
+		return $this->execute( new SubmitReview( $validated->request ) );
67 67
 	}
68 68
 }
Please login to merge, or discard this patch.
plugin/Controllers/AdminController.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	{
33 33
 		$links[] = glsr( Builder::class )->a( __( 'Settings', 'site-reviews' ), [
34 34
 			'href' => admin_url( 'edit.php?post_type='.Application::POST_TYPE.'&page=settings' ),
35
-		]);
35
+		] );
36 36
 		return $links;
37 37
 	}
38 38
 
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
 	{
45 45
 		$postType = Application::POST_TYPE;
46 46
 		$postCount = wp_count_posts( $postType );
47
-		if( !isset( $postCount->publish ) || !$postCount->publish ) {
47
+		if( !isset($postCount->publish) || !$postCount->publish ) {
48 48
 			return $items;
49 49
 		}
50 50
 		$postTypeObject = get_post_type_object( $postType );
51 51
 		$text = _n( '%s Review', '%s Reviews', $postCount->publish, 'site-reviews' );
52
-		$text = sprintf( $text, number_format_i18n( $postCount->publish ));
52
+		$text = sprintf( $text, number_format_i18n( $postCount->publish ) );
53 53
 		$items[] = $postTypeObject && current_user_can( $postTypeObject->cap->edit_posts )
54 54
 			? sprintf( '<a class="glsr-review-count" href="edit.php?post_type=%s">%s</a>', $postType, $text )
55 55
 			: sprintf( '<span class="glsr-review-count">%s</span>', $text );
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	public function filterTinymcePlugins( array $plugins )
64 64
 	{
65 65
 		if( user_can_richedit()
66
-			&& ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ))) {
66
+			&& (current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' )) ) {
67 67
 			$plugins['glsr_shortcode'] = glsr()->url( 'assets/scripts/mce-plugin.js' );
68 68
 		}
69 69
 		return $plugins;
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function registerPointers()
77 77
 	{
78
-		$command = new RegisterPointers([[
78
+		$command = new RegisterPointers( [[
79 79
 			'content' => __( 'You can pin exceptional reviews so that they are always shown first.', 'site-reviews' ),
80 80
 			'id' => 'glsr-pointer-pinned',
81 81
 			'position' => [
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 			'screen' => Application::POST_TYPE,
86 86
 			'target' => '#misc-pub-pinned',
87 87
 			'title' => __( 'Pin Your Reviews', 'site-reviews' ),
88
-		]]);
88
+		]] );
89 89
 		$this->execute( $command );
90 90
 	}
91 91
 
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function registerShortcodeButtons()
97 97
 	{
98
-		$command = new RegisterShortcodeButtons([
98
+		$command = new RegisterShortcodeButtons( [
99 99
 			'site_reviews' => esc_html__( 'Recent Reviews', 'site-reviews' ),
100 100
 			'site_reviews_form' => esc_html__( 'Submit a Review', 'site-reviews' ),
101 101
 			'site_reviews_summary' => esc_html__( 'Summary of Reviews', 'site-reviews' ),
102
-		]);
102
+		] );
103 103
 		$this->execute( $command );
104 104
 	}
105 105
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 		if( !$this->isReviewEditable( $post ) )return;
113 113
 		glsr()->render( 'editor/review', [
114 114
 			'post' => $post,
115
-		]);
115
+		] );
116 116
 	}
117 117
 
118 118
 	/**
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	public function renderReviewNotice( WP_Post $post )
123 123
 	{
124 124
 		if( !$this->isReviewEditable( $post ) )return;
125
-		glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ));
125
+		glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ) );
126 126
 		glsr()->render( 'editor/notice' );
127 127
 	}
128 128
 
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
 		if( glsr_current_screen()->base != 'post' )return;
136 136
 		$shortcodes = [];
137 137
 		foreach( glsr()->mceShortcodes as $shortcode => $values ) {
138
-			if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ))continue;
138
+			if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ) )continue;
139 139
 			$shortcodes[$shortcode] = $values;
140 140
 		}
141
-		if( empty( $shortcodes ))return;
141
+		if( empty($shortcodes) )return;
142 142
 		glsr()->render( 'editor/tinymce', [
143 143
 			'shortcodes' => $shortcodes,
144
-		]);
144
+		] );
145 145
 	}
146 146
 
147 147
 	/**
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	public function routerClearLog()
151 151
 	{
152 152
 		glsr( Logger::class )->clear();
153
-		glsr( Notice::class )->addSuccess( __( 'Log cleared.', 'site-reviews' ));
153
+		glsr( Notice::class )->addSuccess( __( 'Log cleared.', 'site-reviews' ) );
154 154
 	}
155 155
 
156 156
 	/**
Please login to merge, or discard this patch.