Passed
Push — master ( 796b78...de3336 )
by Paul
05:32
created
site-reviews.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,16 +18,16 @@
 block discarded – undo
18 18
 
19 19
 defined( 'WPINC' ) || die;
20 20
 
21
-if( !class_exists( 'GL_Plugin_Check_v1' )) {
21
+if( !class_exists( 'GL_Plugin_Check_v1' ) ) {
22 22
 	require_once __DIR__.'/activate.php';
23 23
 }
24
-if( GL_Plugin_Check_v1::shouldDeactivate( __FILE__, array( 'wordpress' => '4.7.0' )))return;
24
+if( GL_Plugin_Check_v1::shouldDeactivate( __FILE__, array( 'wordpress' => '4.7.0' ) ) )return;
25 25
 
26 26
 require_once __DIR__.'/autoload.php';
27 27
 require_once __DIR__.'/helpers.php';
28 28
 
29 29
 $app = new GeminiLabs\SiteReviews\Application;
30 30
 $app->make( 'Provider' )->register( $app );
31
-register_activation_hook( __FILE__, array( $app, 'activate' ));
32
-register_deactivation_hook( __FILE__, array( $app, 'deactivate' ));
31
+register_activation_hook( __FILE__, array( $app, 'activate' ) );
32
+register_deactivation_hook( __FILE__, array( $app, 'deactivate' ) );
33 33
 $app->init();
Please login to merge, or discard this patch.
helpers.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 function glsr( $alias = null ) {
8 8
 	$app = \GeminiLabs\SiteReviews\Application::load();
9
-	return empty( $alias )
9
+	return empty($alias)
10 10
 		? $app
11 11
 		: $app->make( $alias );
12 12
 }
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
  * @return \WP_Screen|object
17 17
  */
18 18
 function glsr_current_screen() {
19
-	if( function_exists( 'get_current_screen' )) {
19
+	if( function_exists( 'get_current_screen' ) ) {
20 20
 		$screen = get_current_screen();
21 21
 	}
22
-	return empty( $screen )
22
+	return empty($screen)
23 23
 		? (object)array_fill_keys( ['base', 'id', 'post_type'], null )
24 24
 		: $screen;
25 25
 }
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
  */
55 55
 function glsr_log() {
56 56
 	$args = func_get_args();
57
-	$context = isset( $args[1] )
57
+	$context = isset($args[1])
58 58
 		? $args[1]
59 59
 		: [];
60 60
 	$logger = glsr( 'Modules\Logger' );
61
-	return empty( $args )
61
+	return empty($args)
62 62
 		? $logger
63 63
 		: $logger->log( 'debug', $args[0], $context );
64 64
 }
Please login to merge, or discard this patch.
views/templates/reviews-form.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,31 +2,31 @@
 block discarded – undo
2 2
 
3 3
 $render->rating( 'rating', [
4 4
 	'label' => __( 'Your overall rating', 'site-reviews' ),
5
-]);
5
+] );
6 6
 $render->text( 'title', [
7 7
 	'label' => __( 'Title of your review', 'site-reviews' ),
8 8
 	'placeholder' => __( 'Summarize your review or highlight an interesting detail', 'site-reviews' ),
9
-]);
9
+] );
10 10
 $render->textarea( 'content', [
11 11
 	'label' => __( 'Your review', 'site-reviews' ),
12 12
 	'placeholder' => __( 'Tell people your review', 'site-reviews' ),
13
-]);
13
+] );
14 14
 $render->text( 'name', [
15 15
 	'label' => __( 'Your name', 'site-reviews' ),
16 16
 	'placeholder' => __( 'Tell us your name', 'site-reviews' ),
17
-]);
17
+] );
18 18
 $render->email( 'email', [
19 19
 	'label' => __( 'Your email', 'site-reviews' ),
20 20
 	'placeholder' => __( 'Tell us your email', 'site-reviews' ),
21
-]);
21
+] );
22 22
 $render->checkbox( 'terms', [
23 23
 	'label' => __( 'This review is based on my own experience and is my genuine opinion.', 'site-reviews' ),
24
-]);
24
+] );
25 25
 $render->honeypot( 'gotcha' );
26 26
 $render->hidden( 'assign_to' );
27 27
 $render->hidden( 'category' );
28 28
 $render->hidden( 'excluded' );
29 29
 $render->hidden( 'id' );
30 30
 wp_nonce_field( 'post-review' );
31
-$render->submit( __( 'Submit your review', 'site-reviews' ));
31
+$render->submit( __( 'Submit your review', 'site-reviews' ) );
32 32
 $render->result();
Please login to merge, or discard this patch.
config/settings.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@
 block discarded – undo
197 197
 		'type' => 'text',
198 198
 	],
199 199
 	'settings.submissions.required' => [
200
-		'default' => ['title','content','name','email'],
200
+		'default' => ['title', 'content', 'name', 'email'],
201 201
 		'label' => __( 'Required Fields', 'site-reviews' ),
202 202
 		'options' => [
203 203
 			'title' => __( 'Title', 'site-reviews' ),
Please login to merge, or discard this patch.
plugin/Widgets/SiteReviewsSummaryWidget.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,22 +20,22 @@  discard block
 block discarded – undo
20 20
 			'class' => 'widefat',
21 21
 			'label' => __( 'Title', 'site-reviews' ),
22 22
 			'name' => 'title',
23
-		]);
23
+		] );
24 24
 		if( count( glsr()->reviewTypes ) > 1 ) {
25 25
 			$this->renderField( 'select', [
26 26
 				'class' => 'widefat',
27 27
 				'label' => __( 'Which type of review would you like to use?', 'site-reviews' ),
28 28
 				'name' => 'type',
29 29
 				'options' => ['' => __( 'All review types', 'site-reviews' )] + glsr()->reviewTypes,
30
-			]);
30
+			] );
31 31
 		}
32
-		if( !empty( $terms )) {
32
+		if( !empty($terms) ) {
33 33
 			$this->renderField( 'select', [
34 34
 				'class' => 'widefat',
35 35
 				'label' => __( 'Limit summary to this category', 'site-reviews' ),
36 36
 				'name' => 'category',
37 37
 				'options' => ['' => __( 'All Categories', 'site-reviews' )] + $terms,
38
-			]);
38
+			] );
39 39
 		}
40 40
 		$this->renderField( 'text', [
41 41
 			'class' => 'widefat',
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
 			'description' => sprintf( __( "Separate multiple ID's with a comma. You may also enter %s to automatically represent the current page/post ID.", 'site-reviews' ), '<code>post_id</code>' ),
44 44
 			'label' => __( 'Limit summary to reviews assigned to a page/post ID', 'site-reviews' ),
45 45
 			'name' => 'assigned_to',
46
-		]);
46
+		] );
47 47
 		$this->renderField( 'text', [
48 48
 			'class' => 'widefat',
49 49
 			'label' => __( 'Enter any custom CSS classes here', 'site-reviews' ),
50 50
 			'name' => 'class',
51
-		]);
51
+		] );
52 52
 		$this->renderField( 'checkbox', [
53 53
 			'name' => 'hide',
54 54
 			'options' => [
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 				'summary' => __( 'Hide the summary text?', 'site-reviews' ),
59 59
 				'if_empty' => __( 'Hide the summary if no reviews are found?', 'site-reviews' ),
60 60
 			],
61
-		]);
61
+		] );
62 62
 	}
63 63
 
64 64
 	/**
Please login to merge, or discard this patch.
plugin/Widgets/SiteReviewsFormWidget.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -20,30 +20,30 @@  discard block
 block discarded – undo
20 20
 			'class' => 'widefat',
21 21
 			'label' => __( 'Title', 'site-reviews' ),
22 22
 			'name' => 'title',
23
-		]);
23
+		] );
24 24
 		$this->renderField( 'textarea', [
25 25
 			'class' => 'widefat',
26 26
 			'label' => __( 'Description', 'site-reviews' ),
27 27
 			'name' => 'description',
28
-		]);
28
+		] );
29 29
 		$this->renderField( 'select', [
30 30
 			'class' => 'widefat',
31 31
 			'label' => __( 'Automatically assign a category', 'site-reviews' ),
32 32
 			'name' => 'category',
33 33
 			'options' => ['' => __( 'Do not assign a category', 'site-reviews' )] + $terms,
34
-		]);
34
+		] );
35 35
 		$this->renderField( 'text', [
36 36
 			'class' => 'widefat',
37 37
 			'default' => '',
38 38
 			'description' => sprintf( __( 'You may also enter %s to assign to the current post.', 'site-reviews' ), '<code>post_id</code>' ),
39 39
 			'label' => __( 'Assign reviews to a custom page/post ID', 'site-reviews' ),
40 40
 			'name' => 'assign_to',
41
-		]);
41
+		] );
42 42
 		$this->renderField( 'text', [
43 43
 			'class' => 'widefat',
44 44
 			'label' => __( 'Enter any custom CSS classes here', 'site-reviews' ),
45 45
 			'name' => 'class',
46
-		]);
46
+		] );
47 47
 		$this->renderField( 'checkbox', [
48 48
 			'name' => 'hide',
49 49
 			'options' => [
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 				'terms' => __( 'Hide the terms field', 'site-reviews' ),
53 53
 				'title' => __( 'Hide the title field', 'site-reviews' ),
54 54
 			],
55
-		]);
55
+		] );
56 56
 	}
57 57
 
58 58
 	/**
Please login to merge, or discard this patch.
plugin/Widgets/SiteReviewsWidget.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,14 +20,14 @@  discard block
 block discarded – undo
20 20
 			'class' => 'widefat',
21 21
 			'label' => __( 'Title', 'site-reviews' ),
22 22
 			'name' => 'title',
23
-		]);
23
+		] );
24 24
 		$this->renderField( 'number', [
25 25
 			'class' => 'small-text',
26 26
 			'default' => 5,
27 27
 			'label' => __( 'How many reviews would you like to display?', 'site-reviews' ),
28 28
 			'max' => 100,
29 29
 			'name' => 'count',
30
-		]);
30
+		] );
31 31
 		$this->renderField( 'select', [
32 32
 			'label' => __( 'What is the minimum rating to display?', 'site-reviews' ),
33 33
 			'name' => 'rating',
@@ -38,22 +38,22 @@  discard block
 block discarded – undo
38 38
 				'2' => sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 ),
39 39
 				'1' => sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 ),
40 40
 			],
41
-		]);
41
+		] );
42 42
 		if( count( glsr()->reviewTypes ) > 1 ) {
43 43
 			$this->renderField( 'select', [
44 44
 				'class' => 'widefat',
45 45
 				'label' => __( 'Which reviews would you like to display?', 'site-reviews' ),
46 46
 				'name' => 'display',
47 47
 				'options' => ['' => __( 'All Reviews', 'site-reviews' )] + glsr()->reviewTypes,
48
-			]);
48
+			] );
49 49
 		}
50
-		if( !empty( $terms )) {
50
+		if( !empty($terms) ) {
51 51
 			$this->renderField( 'select', [
52 52
 				'class' => 'widefat',
53 53
 				'label' => __( 'Limit reviews to this category', 'site-reviews' ),
54 54
 				'name' => 'category',
55 55
 				'options' => ['' => __( 'All Categories', 'site-reviews' )] + $terms,
56
-			]);
56
+			] );
57 57
 		}
58 58
 		$this->renderField( 'text', [
59 59
 			'class' => 'widefat',
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
 			'description' => sprintf( __( "Separate multiple ID's with a comma. You may also enter %s to automatically represent the current page/post ID.", 'site-reviews' ), '<code>post_id</code>' ),
62 62
 			'label' => __( 'Limit reviews to those assigned to this page/post ID', 'site-reviews' ),
63 63
 			'name' => 'assigned_to',
64
-		]);
64
+		] );
65 65
 		$this->renderField( 'text', [
66 66
 			'class' => 'widefat',
67 67
 			'label' => __( 'Enter any custom CSS classes here', 'site-reviews' ),
68 68
 			'name' => 'class',
69
-		]);
69
+		] );
70 70
 		$this->renderField( 'checkbox', [
71 71
 			'name' => 'hide',
72 72
 			'options' => [
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 				'response' => __( 'Hide the review response?', 'site-reviews' ),
78 78
 				'title' => __( 'Hide the review title?', 'site-reviews' ),
79 79
 			],
80
-		]);
80
+		] );
81 81
 	}
82 82
 
83 83
 	/**
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	public function update( $newInstance, $oldInstance )
89 89
 	{
90
-		if( !is_numeric( $newInstance['count'] )) {
90
+		if( !is_numeric( $newInstance['count'] ) ) {
91 91
 			$newInstance['count'] = 10;
92 92
 		}
93
-		$newInstance['count'] = min( 50, max( 0, intval( $newInstance['count'] )));
93
+		$newInstance['count'] = min( 50, max( 0, intval( $newInstance['count'] ) ) );
94 94
 		return parent::update( $newInstance, $oldInstance );
95 95
 	}
96 96
 
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsButton.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -13,15 +13,15 @@  discard block
 block discarded – undo
13 13
 	public function fields()
14 14
 	{
15 15
 		return [[
16
-			'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' )),
16
+			'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' ) ),
17 17
 			'minWidth' => 320,
18 18
 			'type' => 'container',
19
-		],[
19
+		], [
20 20
 			'label' => esc_html__( 'Title', 'site-reviews' ),
21 21
 			'name' => 'title',
22 22
 			'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ),
23 23
 			'type' => 'textbox',
24
-		],[
24
+		], [
25 25
 			'label' => esc_html__( 'Count', 'site-reviews' ),
26 26
 			'maxLength' => 5,
27 27
 			'name' => 'count',
@@ -29,19 +29,19 @@  discard block
 block discarded – undo
29 29
 			'text' => '10',
30 30
 			'tooltip' => __( 'How many reviews would you like to display (default: 10)?', 'site-reviews' ),
31 31
 			'type' => 'textbox',
32
-		],[
32
+		], [
33 33
 			'label' => esc_html__( 'Rating', 'site-reviews' ),
34 34
 			'name' => 'rating',
35 35
 			'options' => [
36
-				'5' => esc_html( sprintf( _n( '%s star', '%s stars', 5, 'site-reviews' ), 5 )),
37
-				'4' => esc_html( sprintf( _n( '%s star', '%s stars', 4, 'site-reviews' ), 4 )),
38
-				'3' => esc_html( sprintf( _n( '%s star', '%s stars', 3, 'site-reviews' ), 3 )),
39
-				'2' => esc_html( sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 )),
40
-				'1' => esc_html( sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 )),
36
+				'5' => esc_html( sprintf( _n( '%s star', '%s stars', 5, 'site-reviews' ), 5 ) ),
37
+				'4' => esc_html( sprintf( _n( '%s star', '%s stars', 4, 'site-reviews' ), 4 ) ),
38
+				'3' => esc_html( sprintf( _n( '%s star', '%s stars', 3, 'site-reviews' ), 3 ) ),
39
+				'2' => esc_html( sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 ) ),
40
+				'1' => esc_html( sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 ) ),
41 41
 			],
42 42
 			'tooltip' => __( 'What is the minimum rating to display (default: 1 star)?', 'site-reviews' ),
43 43
 			'type' => 'listbox',
44
-		],[
44
+		], [
45 45
 			'label' => esc_html__( 'Pagination', 'site-reviews' ),
46 46
 			'name' => 'pagination',
47 47
 			'options' => [
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 			'name' => 'assigned_to',
60 60
 			'tooltip' => __( 'Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page.', 'site-reviews' ),
61 61
 			'type' => 'textbox',
62
-		],[
62
+		], [
63 63
 			'label' => esc_html__( 'Schema', 'site-reviews' ),
64 64
 			'name' => 'schema',
65 65
 			'options' => [
@@ -68,39 +68,39 @@  discard block
 block discarded – undo
68 68
 			],
69 69
 			'tooltip' => __( 'Rich snippets are disabled by default.', 'site-reviews' ),
70 70
 			'type' => 'listbox',
71
-		],[
71
+		], [
72 72
 			'label' => esc_html__( 'Classes', 'site-reviews' ),
73 73
 			'name' => 'class',
74 74
 			'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ),
75 75
 			'type' => 'textbox',
76
-		],[
76
+		], [
77 77
 			'columns' => 2,
78 78
 			'items' => [[
79 79
 				'name' => 'hide_author',
80 80
 				'text' => esc_html__( 'Author', 'site-reviews' ),
81 81
 				'tooltip' => __( 'Hide the review author?', 'site-reviews' ),
82 82
 				'type' => 'checkbox',
83
-			],[
83
+			], [
84 84
 				'name' => 'hide_date',
85 85
 				'text' => esc_html__( 'Date', 'site-reviews' ),
86 86
 				'tooltip' => __( 'Hide the review date?', 'site-reviews' ),
87 87
 				'type' => 'checkbox',
88
-			],[
88
+			], [
89 89
 				'name' => 'hide_excerpt',
90 90
 				'text' => esc_html__( 'Excerpt', 'site-reviews' ),
91 91
 				'tooltip' => __( 'Hide the review excerpt?', 'site-reviews' ),
92 92
 				'type' => 'checkbox',
93
-			],[
93
+			], [
94 94
 				'name' => 'hide_rating',
95 95
 				'text' => esc_html__( 'Rating', 'site-reviews' ),
96 96
 				'tooltip' => __( 'Hide the review rating?', 'site-reviews' ),
97 97
 				'type' => 'checkbox',
98
-			],[
98
+			], [
99 99
 				'name' => 'hide_response',
100 100
 				'text' => esc_html__( 'Response', 'site-reviews' ),
101 101
 				'tooltip' => __( 'Hide the review response?', 'site-reviews' ),
102 102
 				'type' => 'checkbox',
103
-			],[
103
+			], [
104 104
 				'name' => 'hide_title',
105 105
 				'text' => esc_html__( 'Title', 'site-reviews' ),
106 106
 				'tooltip' => __( 'Hide the review title?', 'site-reviews' ),
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 			'label' => esc_html__( 'Hide', 'site-reviews' ),
111 111
 			'spacing' => 5,
112 112
 			'type' => 'container',
113
-		],[
113
+		], [
114 114
 			'hidden' => true,
115 115
 			'name' => 'id',
116 116
 			'type' => 'textbox',
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	public function getTerms()
124 124
 	{
125 125
 		$terms = glsr( Database::class )->getTerms();
126
-		if( empty( $terms )) {
126
+		if( empty($terms) ) {
127 127
 			return [];
128 128
 		}
129 129
 		return [
Please login to merge, or discard this patch.
plugin/Shortcodes/Shortcode.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
 			'after_widget' => '</div>',
28 28
 			'before_title' => '<h3 class="glsr-shortcode-title">',
29 29
 			'after_title' => '</h3>',
30
-		]);
30
+		] );
31 31
 		$instance = $this->normalize( $instance );
32 32
 		$partial = glsr( Html::class )->buildPartial( $shortcodePartial, $instance );
33
-		if( !empty( $instance['title'] )) {
33
+		if( !empty($instance['title']) ) {
34 34
 			$instance['title'] = $args['before_title'].$instance['title'].$args['after_title'];
35 35
 		}
36 36
 		return $args['before_widget'].$instance['title'].$partial.$args['after_widget'];
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function normalize( $args )
75 75
 	{
76
-		$args = shortcode_atts( $this->getDefaults(), wp_parse_args( $args ));
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 ) )return;
80 80
 			$value = $this->$methodName( $value );
81 81
 		});
82 82
 		return $this->sanitize( $args );
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	protected function normalizeHide( $hide )
110 110
 	{
111
-		if( is_string( $hide )) {
111
+		if( is_string( $hide ) ) {
112 112
 			$hide = explode( ',', $hide );
113 113
 		}
114 114
 		return array_filter( array_map( 'trim', $hide ), function( $value ) {
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
139 139
 			__( 'Terrible', 'site-reviews' ),
140 140
 		];
141 141
 		$defaults = array_pad( $defaults, Rating::MAX_RATING, '' );
142
-		$labels = array_map( 'trim', explode( ',', $labels ));
142
+		$labels = array_map( 'trim', explode( ',', $labels ) );
143 143
 		foreach( $defaults as $i => $label ) {
144
-			if( empty( $labels[$i] ))continue;
144
+			if( empty($labels[$i]) )continue;
145 145
 			$defaults[$i] = $labels[$i];
146 146
 		}
147 147
 		return array_combine( range( Rating::MAX_RATING, 1 ), $defaults );
Please login to merge, or discard this patch.