Passed
Branch master (51607c)
by Paul
05:13
created
plugin/Application.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
 	public function __construct()
33 33
 	{
34 34
 		static::$instance = $this;
35
-		$this->file = realpath( dirname( __DIR__ ).'/'.static::ID.'.php' );
36
-		$plugin = get_file_data( $this->file, [
35
+		$this->file = realpath(dirname(__DIR__).'/'.static::ID.'.php');
36
+		$plugin = get_file_data($this->file, [
37 37
 			'languages' => 'Domain Path',
38 38
 			'name' => 'Plugin Name',
39 39
 			'version' => 'Version',
40
-		], 'plugin' );
41
-		array_walk( $plugin, function( $value, $key ) {
40
+		], 'plugin');
41
+		array_walk($plugin, function($value, $key) {
42 42
 			$this->$key = $value;
43 43
 		});
44 44
 	}
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	public function activate()
50 50
 	{
51
-		$this->make( DefaultsManager::class )->set();
52
-		$this->make( OptionManager::class )->set( 'logging', false );
51
+		$this->make(DefaultsManager::class)->set();
52
+		$this->make(OptionManager::class)->set('logging', false);
53 53
 		$this->scheduleCronJob();
54 54
 		$this->upgrade();
55 55
 	}
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	public function getDefaults()
69 69
 	{
70
-		if( empty( $this->defaults )) {
71
-			$this->defaults = $this->make( DefaultsManager::class )->get();
70
+		if (empty($this->defaults)) {
71
+			$this->defaults = $this->make(DefaultsManager::class)->get();
72 72
 			$this->upgrade();
73 73
 		}
74
-		return apply_filters( 'site-reviews/get/defaults', $this->defaults );
74
+		return apply_filters('site-reviews/get/defaults', $this->defaults);
75 75
 	}
76 76
 
77 77
 	/**
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function hasPermission()
81 81
 	{
82
-		return !$this->isAdmin() || ( $this->isAdmin() && current_user_can( static::CAPABILITY ));
82
+		return !$this->isAdmin() || ($this->isAdmin() && current_user_can(static::CAPABILITY));
83 83
 	}
84 84
 
85 85
 	/**
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	public function init()
89 89
 	{
90
-		$this->make( Actions::class )->run();
91
-		$this->make( Filters::class )->run();
90
+		$this->make(Actions::class)->run();
91
+		$this->make(Filters::class)->run();
92 92
 	}
93 93
 
94 94
 	/**
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
 	 * @param string $file
104 104
 	 * @return string
105 105
 	 */
106
-	public function path( $file = '' )
106
+	public function path($file = '')
107 107
 	{
108
-		return plugin_dir_path( $this->file ).ltrim( trim( $file ), '/' );
108
+		return plugin_dir_path($this->file).ltrim(trim($file), '/');
109 109
 	}
110 110
 
111 111
 	/**
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 */
114 114
 	public function registerAddons()
115 115
 	{
116
-		do_action( 'site-reviews/addon/register', $this );
116
+		do_action('site-reviews/addon/register', $this);
117 117
 	}
118 118
 
119 119
 	/**
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public function registerLanguages()
123 123
 	{
124
-		load_plugin_textdomain( $this->id, false,
125
-			trailingslashit( plugin_basename( $this->path() ).'/'.$this->languages )
124
+		load_plugin_textdomain($this->id, false,
125
+			trailingslashit(plugin_basename($this->path()).'/'.$this->languages)
126 126
 		);
127 127
 	}
128 128
 
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
 	 */
132 132
 	public function registerReviewTypes()
133 133
 	{
134
-		$types = apply_filters( 'site-reviews/addon/types', [] );
135
-		$this->reviewTypes = wp_parse_args( $types, [
136
-			'local' => __( 'Local', 'site-reviews' ),
134
+		$types = apply_filters('site-reviews/addon/types', []);
135
+		$this->reviewTypes = wp_parse_args($types, [
136
+			'local' => __('Local', 'site-reviews'),
137 137
 		]);
138 138
 	}
139 139
 
@@ -141,11 +141,11 @@  discard block
 block discarded – undo
141 141
 	 * @param string $view
142 142
 	 * @return void
143 143
 	 */
144
-	public function render( $view, array $data = [] )
144
+	public function render($view, array $data = [])
145 145
 	{
146
-		$data['html'] = $this->make( Html::class );
147
-		extract( $data );
148
-		return include $this->path( 'views/index.php' );
146
+		$data['html'] = $this->make(Html::class);
147
+		extract($data);
148
+		return include $this->path('views/index.php');
149 149
 	}
150 150
 
151 151
 	/**
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
 	 */
154 154
 	public function scheduleCronJob()
155 155
 	{
156
-		if( wp_next_scheduled( static::CRON_EVENT ))return;
157
-		wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT );
156
+		if (wp_next_scheduled(static::CRON_EVENT))return;
157
+		wp_schedule_event(time(), 'twicedaily', static::CRON_EVENT);
158 158
 	}
159 159
 
160 160
 	/**
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	 */
163 163
 	public function unscheduleCronJob()
164 164
 	{
165
-		wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT )), static::CRON_EVENT );
165
+		wp_unschedule_event(intval(wp_next_scheduled(static::CRON_EVENT)), static::CRON_EVENT);
166 166
 	}
167 167
 
168 168
 	/**
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 */
171 171
 	public function upgrade()
172 172
 	{
173
-		$this->make( Upgrade::class )->run();
173
+		$this->make(Upgrade::class)->run();
174 174
 	}
175 175
 
176 176
 	/**
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
 	 * @return void
179 179
 	 * @action upgrader_process_complete
180 180
 	 */
181
-	public function upgraded( $upgrader, array $data )
181
+	public function upgraded($upgrader, array $data)
182 182
 	{
183
-		if( !array_key_exists( 'plugins', $data )
184
-			|| !in_array( plugin_basename( $this->file ), $data['plugins'] )
183
+		if (!array_key_exists('plugins', $data)
184
+			|| !in_array(plugin_basename($this->file), $data['plugins'])
185 185
 			|| $data['action'] != 'update'
186 186
 			|| $data['type'] != 'plugin'
187 187
 		)return;
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
 	 * @param string $path
193 193
 	 * @return string
194 194
 	 */
195
-	public function url( $path = '' )
195
+	public function url($path = '')
196 196
 	{
197
-		return esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ));
197
+		return esc_url(plugin_dir_url($this->file).ltrim(trim($path), '/'));
198 198
 	}
199 199
 }
Please login to merge, or discard this patch.
plugin/Contracts/ProviderContract.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,5 +9,5 @@
 block discarded – undo
9 9
 	/**
10 10
 	 * @return void
11 11
 	 */
12
-	public function register( Application $app );
12
+	public function register(Application $app);
13 13
 }
Please login to merge, or discard this patch.
plugin/Contracts/ShortcodeContract.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,5 +8,5 @@
 block discarded – undo
8 8
 	 * @params string|array $atts
9 9
 	 * @return string
10 10
 	 */
11
-	public function buildShortcode( $atts = [] );
11
+	public function buildShortcode($atts = []);
12 12
 }
Please login to merge, or discard this patch.
plugin/Contracts/PartialContract.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,5 +7,5 @@
 block discarded – undo
7 7
 	/**
8 8
 	 * @return void|string
9 9
 	 */
10
-	public function build( $name, array $args = [] );
10
+	public function build($name, array $args = []);
11 11
 }
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsFormButton.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -14,60 +14,60 @@  discard block
 block discarded – undo
14 14
 	{
15 15
 		return [[
16 16
 			'type' => 'container',
17
-			'html' => '<p class="strong">'.esc_html__( 'All settings are optional.', 'site-reviews' ).'</p>',
18
-		],[
19
-			'label' => esc_html__( 'Title', 'site-reviews' ),
17
+			'html' => '<p class="strong">'.esc_html__('All settings are optional.', 'site-reviews').'</p>',
18
+		], [
19
+			'label' => esc_html__('Title', 'site-reviews'),
20 20
 			'name' => 'title',
21
-			'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ),
21
+			'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
22 22
 			'type' => 'textbox',
23
-		],[
24
-			'label' => esc_html__( 'Description', 'site-reviews' ),
23
+		], [
24
+			'label' => esc_html__('Description', 'site-reviews'),
25 25
 			'minHeight' => 60,
26 26
 			'minWidth' => 240,
27 27
 			'multiline' => true,
28 28
 			'name' => 'description',
29
-			'tooltip' => __( 'Enter a custom shortcode description.', 'site-reviews' ),
29
+			'tooltip' => __('Enter a custom shortcode description.', 'site-reviews'),
30 30
 			'type' => 'textbox',
31 31
 		],
32 32
 		$this->getTerms(),
33 33
 		[
34
-			'label' => esc_html__( 'Post ID', 'site-reviews' ),
34
+			'label' => esc_html__('Post ID', 'site-reviews'),
35 35
 			'name' => 'assign_to',
36
-			'tooltip' => __( 'Assign submitted reviews to a custom page/post ID. You can also enter "post_id" to assign reviews to the ID of the current page.', 'site-reviews' ),
36
+			'tooltip' => __('Assign submitted reviews to a custom page/post ID. You can also enter "post_id" to assign reviews to the ID of the current page.', 'site-reviews'),
37 37
 			'type' => 'textbox',
38
-		],[
39
-			'label' => esc_html__( 'Classes', 'site-reviews' ),
38
+		], [
39
+			'label' => esc_html__('Classes', 'site-reviews'),
40 40
 			'name' => 'class',
41
-			'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ),
41
+			'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
42 42
 			'type' => 'textbox',
43
-		],[
43
+		], [
44 44
 			'columns' => 2,
45 45
 			'items' => [[
46 46
 				'name' => 'hide_email',
47
-				'text' => esc_html__( 'Email', 'site-reviews' ),
48
-				'tooltip' => __( 'Hide the email field?', 'site-reviews' ),
47
+				'text' => esc_html__('Email', 'site-reviews'),
48
+				'tooltip' => __('Hide the email field?', 'site-reviews'),
49 49
 				'type' => 'checkbox',
50
-			],[
50
+			], [
51 51
 				'name' => 'hide_name',
52
-				'text' => esc_html__( 'Name', 'site-reviews' ),
53
-				'tooltip' => __( 'Hide the name field?', 'site-reviews' ),
52
+				'text' => esc_html__('Name', 'site-reviews'),
53
+				'tooltip' => __('Hide the name field?', 'site-reviews'),
54 54
 				'type' => 'checkbox',
55
-			],[
55
+			], [
56 56
 				'name' => 'hide_terms',
57
-				'text' => esc_html__( 'Terms', 'site-reviews' ),
58
-				'tooltip' => __( 'Hide the terms field?', 'site-reviews' ),
57
+				'text' => esc_html__('Terms', 'site-reviews'),
58
+				'tooltip' => __('Hide the terms field?', 'site-reviews'),
59 59
 				'type' => 'checkbox',
60
-			],[
60
+			], [
61 61
 				'name' => 'hide_title',
62
-				'text' => esc_html__( 'Title', 'site-reviews' ),
63
-				'tooltip' => __( 'Hide the title field?', 'site-reviews' ),
62
+				'text' => esc_html__('Title', 'site-reviews'),
63
+				'tooltip' => __('Hide the title field?', 'site-reviews'),
64 64
 				'type' => 'checkbox',
65 65
 			]],
66
-			'label' => esc_html__( 'Hide', 'site-reviews' ),
66
+			'label' => esc_html__('Hide', 'site-reviews'),
67 67
 			'layout' => 'grid',
68 68
 			'spacing' => 5,
69 69
 			'type' => 'container',
70
-		],[
70
+		], [
71 71
 			'hidden' => true,
72 72
 			'name' => 'id',
73 73
 			'type' => 'textbox',
@@ -79,15 +79,15 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function getTerms()
81 81
 	{
82
-		$terms = glsr( Database::class )->getTerms();
83
-		if( empty( $terms )) {
82
+		$terms = glsr(Database::class)->getTerms();
83
+		if (empty($terms)) {
84 84
 			return [];
85 85
 		}
86 86
 		return [
87
-			'label' => esc_html__( 'Category', 'site-reviews' ),
87
+			'label' => esc_html__('Category', 'site-reviews'),
88 88
 			'name' => 'category',
89 89
 			'options' => $terms,
90
-			'tooltip' => __( 'Automatically assign a category to reviews submitted with this shortcode.', 'site-reviews' ),
90
+			'tooltip' => __('Automatically assign a category to reviews submitted with this shortcode.', 'site-reviews'),
91 91
 			'type' => 'listbox',
92 92
 		];
93 93
 	}
Please login to merge, or discard this patch.
plugin/Shortcodes/Shortcode.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -19,18 +19,18 @@  discard block
 block discarded – undo
19 19
 	 * @param string|array $instance
20 20
 	 * @return string
21 21
 	 */
22
-	public function build( $instance, array $args = [] )
22
+	public function build($instance, array $args = [])
23 23
 	{
24 24
 		$shortcodePartial = $this->getShortcodePartial();
25
-		$args = wp_parse_args( $args, [
25
+		$args = wp_parse_args($args, [
26 26
 			'before_widget' => '<div class="glsr-shortcode shortcode-'.$shortcodePartial.'">',
27 27
 			'after_widget' => '</div>',
28 28
 			'before_title' => '<h3 class="glsr-shortcode-title">',
29 29
 			'after_title' => '</h3>',
30 30
 		]);
31
-		$instance = $this->normalize( $instance );
32
-		$partial = glsr( Html::class )->buildPartial( $shortcodePartial, $instance );
33
-		if( !empty( $instance['title'] )) {
31
+		$instance = $this->normalize($instance);
32
+		$partial = glsr(Html::class)->buildPartial($shortcodePartial, $instance);
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'];
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 	 * @param string|array $atts
41 41
 	 * @return string
42 42
 	 */
43
-	public function buildShortcode( $atts = [] )
43
+	public function buildShortcode($atts = [])
44 44
 	{
45
-		return $this->build( $atts );
45
+		return $this->build($atts);
46 46
 	}
47 47
 
48 48
 	/**
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
 	 */
51 51
 	public function getDefaults()
52 52
 	{
53
-		$className = glsr( Helper::class )->buildClassName(
54
-			str_replace( 'Shortcode', 'Defaults', (new ReflectionClass( $this ))->getShortName() ),
53
+		$className = glsr(Helper::class)->buildClassName(
54
+			str_replace('Shortcode', 'Defaults', (new ReflectionClass($this))->getShortName()),
55 55
 			'Defaults'
56 56
 		);
57
-		return glsr( $className )->defaults();
57
+		return glsr($className)->defaults();
58 58
 	}
59 59
 
60 60
 	/**
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	public function getShortcodePartial()
64 64
 	{
65
-		return glsr( Helper::class )->dashCase(
66
-			str_replace( 'Shortcode', '', (new ReflectionClass( $this ))->getShortName() )
65
+		return glsr(Helper::class)->dashCase(
66
+			str_replace('Shortcode', '', (new ReflectionClass($this))->getShortName())
67 67
 		);
68 68
 	}
69 69
 
@@ -71,25 +71,25 @@  discard block
 block discarded – undo
71 71
 	 * @param array|string $args
72 72
 	 * @return array
73 73
 	 */
74
-	public function normalize( $args )
74
+	public function normalize($args)
75 75
 	{
76
-		$args = shortcode_atts( $this->getDefaults(), wp_parse_args( $args ));
77
-		array_walk( $args, function( &$value, $key ) {
78
-			$methodName = glsr( Helper::class )->buildMethodName( $key, 'normalize' );
79
-			if( !method_exists( $this, $methodName ))return;
80
-			$value = $this->$methodName( $value );
76
+		$args = shortcode_atts($this->getDefaults(), wp_parse_args($args));
77
+		array_walk($args, function(&$value, $key) {
78
+			$methodName = glsr(Helper::class)->buildMethodName($key, 'normalize');
79
+			if (!method_exists($this, $methodName))return;
80
+			$value = $this->$methodName($value);
81 81
 		});
82
-		return $this->sanitize( $args );
82
+		return $this->sanitize($args);
83 83
 	}
84 84
 
85 85
 	/**
86 86
 	 * @param string $postId
87 87
 	 * @return int|string
88 88
 	 */
89
-	protected function normalizeAssignedTo( $postId )
89
+	protected function normalizeAssignedTo($postId)
90 90
 	{
91 91
 		return $postId == 'post_id'
92
-			? intval( get_the_ID() )
92
+			? intval(get_the_ID())
93 93
 			: $postId;
94 94
 	}
95 95
 
@@ -97,22 +97,22 @@  discard block
 block discarded – undo
97 97
 	 * @param string $postId
98 98
 	 * @return int|string
99 99
 	 */
100
-	protected function normalizeAssignTo( $postId )
100
+	protected function normalizeAssignTo($postId)
101 101
 	{
102
-		return $this->normalizeAssignedTo( $postId );
102
+		return $this->normalizeAssignedTo($postId);
103 103
 	}
104 104
 
105 105
 	/**
106 106
 	 * @param string $hide
107 107
 	 * @return array
108 108
 	 */
109
-	protected function normalizeHide( $hide )
109
+	protected function normalizeHide($hide)
110 110
 	{
111
-		if( is_string( $hide )) {
112
-			$hide = explode( ',', $hide );
111
+		if (is_string($hide)) {
112
+			$hide = explode(',', $hide);
113 113
 		}
114
-		return array_filter( array_map( 'trim', $hide ), function( $value ) {
115
-			return in_array( $value, $this->hiddenKeys );
114
+		return array_filter(array_map('trim', $hide), function($value) {
115
+			return in_array($value, $this->hiddenKeys);
116 116
 		});
117 117
 	}
118 118
 
@@ -120,55 +120,55 @@  discard block
 block discarded – undo
120 120
 	 * @param string $id
121 121
 	 * @return string
122 122
 	 */
123
-	protected function normalizeId( $id )
123
+	protected function normalizeId($id)
124 124
 	{
125
-		return sanitize_title( $id );
125
+		return sanitize_title($id);
126 126
 	}
127 127
 
128 128
 	/**
129 129
 	 * @param string $labels
130 130
 	 * @return array
131 131
 	 */
132
-	protected function normalizeLabels( $labels )
132
+	protected function normalizeLabels($labels)
133 133
 	{
134 134
 		$defaults = [
135
-			__( 'Excellent', 'site-reviews' ),
136
-			__( 'Very good', 'site-reviews' ),
137
-			__( 'Average', 'site-reviews' ),
138
-			__( 'Poor', 'site-reviews' ),
139
-			__( 'Terrible', 'site-reviews' ),
135
+			__('Excellent', 'site-reviews'),
136
+			__('Very good', 'site-reviews'),
137
+			__('Average', 'site-reviews'),
138
+			__('Poor', 'site-reviews'),
139
+			__('Terrible', 'site-reviews'),
140 140
 		];
141
-		$defaults = array_pad( $defaults, Rating::MAX_RATING, '' );
142
-		$labels = array_map( 'trim', explode( ',', $labels ));
143
-		foreach( $defaults as $i => $label ) {
144
-			if( empty( $labels[$i] ))continue;
141
+		$defaults = array_pad($defaults, Rating::MAX_RATING, '');
142
+		$labels = array_map('trim', explode(',', $labels));
143
+		foreach ($defaults as $i => $label) {
144
+			if (empty($labels[$i]))continue;
145 145
 			$defaults[$i] = $labels[$i];
146 146
 		}
147
-		return array_combine( range( Rating::MAX_RATING, 1 ), $defaults );
147
+		return array_combine(range(Rating::MAX_RATING, 1), $defaults);
148 148
 	}
149 149
 
150 150
 	/**
151 151
 	 * @param string $schema
152 152
 	 * @return bool
153 153
 	 */
154
-	protected function normalizeSchema( $schema )
154
+	protected function normalizeSchema($schema)
155 155
 	{
156
-		return wp_validate_boolean( $schema );
156
+		return wp_validate_boolean($schema);
157 157
 	}
158 158
 
159 159
 	/**
160 160
 	 * @param string $text
161 161
 	 * @return string
162 162
 	 */
163
-	protected function normalizeText( $text )
163
+	protected function normalizeText($text)
164 164
 	{
165
-		return trim( $text );
165
+		return trim($text);
166 166
 	}
167 167
 
168 168
 	/**
169 169
 	 * @return array
170 170
 	 */
171
-	protected function sanitize( array $args )
171
+	protected function sanitize(array $args)
172 172
 	{
173 173
 		return $args;
174 174
 	}
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsSummaryButton.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -12,66 +12,66 @@
 block discarded – undo
12 12
 	public function fields()
13 13
 	{
14 14
 		return [[
15
-			'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' )),
15
+			'html' => sprintf('<p class="strong">%s</p>', esc_html__('All settings are optional.', 'site-reviews')),
16 16
 			'minWidth' => 320,
17 17
 			'type' => 'container',
18
-		],[
19
-			'label' => esc_html__( 'Title', 'site-reviews' ),
18
+		], [
19
+			'label' => esc_html__('Title', 'site-reviews'),
20 20
 			'name' => 'title',
21
-			'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ),
21
+			'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
22 22
 			'type' => 'textbox',
23 23
 		],
24 24
 		$this->getTypes(),
25 25
 		$this->getTerms(),
26 26
 		[
27
-			'label' => esc_html__( 'Post ID', 'site-reviews' ),
27
+			'label' => esc_html__('Post ID', 'site-reviews'),
28 28
 			'name' => 'assigned_to',
29
-			'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' ),
29
+			'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'),
30 30
 			'type' => 'textbox',
31
-		],[
32
-			'label' => esc_html__( 'Schema', 'site-reviews' ),
31
+		], [
32
+			'label' => esc_html__('Schema', 'site-reviews'),
33 33
 			'name' => 'schema',
34 34
 			'options' => [
35
-				'true' => esc_html__( 'Enable rich snippets', 'site-reviews' ),
36
-				'false' => esc_html__( 'Disable rich snippets', 'site-reviews' ),
35
+				'true' => esc_html__('Enable rich snippets', 'site-reviews'),
36
+				'false' => esc_html__('Disable rich snippets', 'site-reviews'),
37 37
 			],
38
-			'tooltip' => __( 'Rich snippets are disabled by default.', 'site-reviews' ),
38
+			'tooltip' => __('Rich snippets are disabled by default.', 'site-reviews'),
39 39
 			'type' => 'listbox',
40
-		],[
41
-			'label' => esc_html__( 'Classes', 'site-reviews' ),
40
+		], [
41
+			'label' => esc_html__('Classes', 'site-reviews'),
42 42
 			'name' => 'class',
43
-			'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ),
43
+			'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
44 44
 			'type' => 'textbox',
45
-		],[
45
+		], [
46 46
 			'columns' => 2,
47 47
 			'items' => [[
48 48
 				'type' => 'checkbox',
49 49
 				'name' => 'hide_bars',
50
-				'text' => esc_html__( 'Bars', 'site-reviews' ),
51
-				'tooltip' => esc_attr__( 'Hide the percentage bars?', 'site-reviews' ),
52
-			],[
50
+				'text' => esc_html__('Bars', 'site-reviews'),
51
+				'tooltip' => esc_attr__('Hide the percentage bars?', 'site-reviews'),
52
+			], [
53 53
 				'type' => 'checkbox',
54 54
 				'name' => 'hide_if_empty',
55
-				'text' => esc_html__( 'If Empty', 'site-reviews' ),
56
-				'tooltip' => esc_attr__( 'Hide the summary if no reviews are found?', 'site-reviews' ),
57
-			],[
55
+				'text' => esc_html__('If Empty', 'site-reviews'),
56
+				'tooltip' => esc_attr__('Hide the summary if no reviews are found?', 'site-reviews'),
57
+			], [
58 58
 				'type' => 'checkbox',
59 59
 				'name' => 'hide_rating',
60
-				'text' => esc_html__( 'Rating', 'site-reviews' ),
61
-				'tooltip' => esc_attr__( 'Hide the rating?', 'site-reviews' ),
62
-			],[
60
+				'text' => esc_html__('Rating', 'site-reviews'),
61
+				'tooltip' => esc_attr__('Hide the rating?', 'site-reviews'),
62
+			], [
63 63
 				'type' => 'checkbox',
64 64
 				'name' => 'hide_stars',
65
-				'text' => esc_html__( 'Stars', 'site-reviews' ),
66
-				'tooltip' => esc_attr__( 'Hide the stars?', 'site-reviews' ),
67
-			],[
65
+				'text' => esc_html__('Stars', 'site-reviews'),
66
+				'tooltip' => esc_attr__('Hide the stars?', 'site-reviews'),
67
+			], [
68 68
 				'type' => 'checkbox',
69 69
 				'name' => 'hide_summary',
70
-				'text' => esc_html__( 'Summary', 'site-reviews' ),
71
-				'tooltip' => esc_attr__( 'Hide the summary text?', 'site-reviews' ),
70
+				'text' => esc_html__('Summary', 'site-reviews'),
71
+				'tooltip' => esc_attr__('Hide the summary text?', 'site-reviews'),
72 72
 			]],
73 73
 			'layout' => 'grid',
74
-			'label' => esc_html__( 'Hide', 'site-reviews' ),
74
+			'label' => esc_html__('Hide', 'site-reviews'),
75 75
 			'spacing' => 5,
76 76
 			'type' => 'container',
77 77
 		]];
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsFormShortcode.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@
 block discarded – undo
13 13
 	/**
14 14
 	 * @return array
15 15
 	 */
16
-	protected function sanitize( array $args )
16
+	protected function sanitize(array $args)
17 17
 	{
18
-		if( empty( $args['id'] )) {
19
-			$args['id'] = substr( md5( serialize( $args )), 0, 8 );
18
+		if (empty($args['id'])) {
19
+			$args['id'] = substr(md5(serialize($args)), 0, 8);
20 20
 		}
21 21
 		return $args;
22 22
 	}
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsButton.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -13,104 +13,104 @@  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
-		],[
20
-			'label' => esc_html__( 'Title', 'site-reviews' ),
19
+		], [
20
+			'label' => esc_html__('Title', 'site-reviews'),
21 21
 			'name' => 'title',
22
-			'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ),
22
+			'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
23 23
 			'type' => 'textbox',
24
-		],[
25
-			'label' => esc_html__( 'Count', 'site-reviews' ),
24
+		], [
25
+			'label' => esc_html__('Count', 'site-reviews'),
26 26
 			'maxLength' => 5,
27 27
 			'name' => 'count',
28 28
 			'size' => 3,
29 29
 			'text' => '10',
30
-			'tooltip' => __( 'How many reviews would you like to display (default: 10)?', 'site-reviews' ),
30
+			'tooltip' => __('How many reviews would you like to display (default: 10)?', 'site-reviews'),
31 31
 			'type' => 'textbox',
32
-		],[
33
-			'label' => esc_html__( 'Rating', 'site-reviews' ),
32
+		], [
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
-			'tooltip' => __( 'What is the minimum rating to display (default: 1 star)?', 'site-reviews' ),
42
+			'tooltip' => __('What is the minimum rating to display (default: 1 star)?', 'site-reviews'),
43 43
 			'type' => 'listbox',
44
-		],[
45
-			'label' => esc_html__( 'Pagination', 'site-reviews' ),
44
+		], [
45
+			'label' => esc_html__('Pagination', 'site-reviews'),
46 46
 			'name' => 'pagination',
47 47
 			'options' => [
48
-				'true' => esc_html__( 'Enable', 'site-reviews' ),
49
-				'ajax' => esc_html__( 'Enable (using ajax)', 'site-reviews' ),
50
-				'false' => esc_html__( 'Disable', 'site-reviews' ),
48
+				'true' => esc_html__('Enable', 'site-reviews'),
49
+				'ajax' => esc_html__('Enable (using ajax)', 'site-reviews'),
50
+				'false' => esc_html__('Disable', 'site-reviews'),
51 51
 			],
52
-			'tooltip' => __( 'When using pagination this shortcode can only be used once on a page. (default: disable)', 'site-reviews' ),
52
+			'tooltip' => __('When using pagination this shortcode can only be used once on a page. (default: disable)', 'site-reviews'),
53 53
 			'type' => 'listbox',
54 54
 		],
55 55
 		$this->getTypes(),
56 56
 		$this->getTerms(),
57 57
 		[
58
-			'label' => esc_html__( 'Post ID', 'site-reviews' ),
58
+			'label' => esc_html__('Post ID', 'site-reviews'),
59 59
 			'name' => 'assigned_to',
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' ),
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
-		],[
63
-			'label' => esc_html__( 'Schema', 'site-reviews' ),
62
+		], [
63
+			'label' => esc_html__('Schema', 'site-reviews'),
64 64
 			'name' => 'schema',
65 65
 			'options' => [
66
-				'true' => esc_html__( 'Enable rich snippets', 'site-reviews' ),
67
-				'false' => esc_html__( 'Disable rich snippets', 'site-reviews' ),
66
+				'true' => esc_html__('Enable rich snippets', 'site-reviews'),
67
+				'false' => esc_html__('Disable rich snippets', 'site-reviews'),
68 68
 			],
69
-			'tooltip' => __( 'Rich snippets are disabled by default.', 'site-reviews' ),
69
+			'tooltip' => __('Rich snippets are disabled by default.', 'site-reviews'),
70 70
 			'type' => 'listbox',
71
-		],[
72
-			'label' => esc_html__( 'Classes', 'site-reviews' ),
71
+		], [
72
+			'label' => esc_html__('Classes', 'site-reviews'),
73 73
 			'name' => 'class',
74
-			'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ),
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
-				'text' => esc_html__( 'Author', 'site-reviews' ),
81
-				'tooltip' => __( 'Hide the review author?', 'site-reviews' ),
80
+				'text' => esc_html__('Author', 'site-reviews'),
81
+				'tooltip' => __('Hide the review author?', 'site-reviews'),
82 82
 				'type' => 'checkbox',
83
-			],[
83
+			], [
84 84
 				'name' => 'hide_date',
85
-				'text' => esc_html__( 'Date', 'site-reviews' ),
86
-				'tooltip' => __( 'Hide the review date?', 'site-reviews' ),
85
+				'text' => esc_html__('Date', 'site-reviews'),
86
+				'tooltip' => __('Hide the review date?', 'site-reviews'),
87 87
 				'type' => 'checkbox',
88
-			],[
88
+			], [
89 89
 				'name' => 'hide_excerpt',
90
-				'text' => esc_html__( 'Excerpt', 'site-reviews' ),
91
-				'tooltip' => __( 'Hide the review excerpt?', 'site-reviews' ),
90
+				'text' => esc_html__('Excerpt', 'site-reviews'),
91
+				'tooltip' => __('Hide the review excerpt?', 'site-reviews'),
92 92
 				'type' => 'checkbox',
93
-			],[
93
+			], [
94 94
 				'name' => 'hide_rating',
95
-				'text' => esc_html__( 'Rating', 'site-reviews' ),
96
-				'tooltip' => __( 'Hide the review rating?', 'site-reviews' ),
95
+				'text' => esc_html__('Rating', 'site-reviews'),
96
+				'tooltip' => __('Hide the review rating?', 'site-reviews'),
97 97
 				'type' => 'checkbox',
98
-			],[
98
+			], [
99 99
 				'name' => 'hide_response',
100
-				'text' => esc_html__( 'Response', 'site-reviews' ),
101
-				'tooltip' => __( 'Hide the review response?', 'site-reviews' ),
100
+				'text' => esc_html__('Response', 'site-reviews'),
101
+				'tooltip' => __('Hide the review response?', 'site-reviews'),
102 102
 				'type' => 'checkbox',
103
-			],[
103
+			], [
104 104
 				'name' => 'hide_title',
105
-				'text' => esc_html__( 'Title', 'site-reviews' ),
106
-				'tooltip' => __( 'Hide the review title?', 'site-reviews' ),
105
+				'text' => esc_html__('Title', 'site-reviews'),
106
+				'tooltip' => __('Hide the review title?', 'site-reviews'),
107 107
 				'type' => 'checkbox',
108 108
 			]],
109 109
 			'layout' => 'grid',
110
-			'label' => esc_html__( 'Hide', 'site-reviews' ),
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',
@@ -122,15 +122,15 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function getTerms()
124 124
 	{
125
-		$terms = glsr( Database::class )->getTerms();
126
-		if( empty( $terms )) {
125
+		$terms = glsr(Database::class)->getTerms();
126
+		if (empty($terms)) {
127 127
 			return [];
128 128
 		}
129 129
 		return [
130
-			'label' => esc_html__( 'Category', 'site-reviews' ),
130
+			'label' => esc_html__('Category', 'site-reviews'),
131 131
 			'name' => 'category',
132 132
 			'options' => $terms,
133
-			'tooltip' => __( 'Limit reviews to this category.', 'site-reviews' ),
133
+			'tooltip' => __('Limit reviews to this category.', 'site-reviews'),
134 134
 			'type' => 'listbox',
135 135
 		];
136 136
 	}
@@ -140,14 +140,14 @@  discard block
 block discarded – undo
140 140
 	 */
141 141
 	public function getTypes()
142 142
 	{
143
-		if( count( glsr()->reviewTypes ) < 2 ) {
143
+		if (count(glsr()->reviewTypes) < 2) {
144 144
 			return [];
145 145
 		}
146 146
 		return [
147
-			'label' => esc_html__( 'Display', 'site-reviews' ),
147
+			'label' => esc_html__('Display', 'site-reviews'),
148 148
 			'name' => 'display',
149 149
 			'options' => glsr()->reviewTypes,
150
-			'tooltip' => __( 'Which reviews would you like to display?', 'site-reviews' ),
150
+			'tooltip' => __('Which reviews would you like to display?', 'site-reviews'),
151 151
 			'type' => 'listbox',
152 152
 		];
153 153
 	}
Please login to merge, or discard this patch.