Passed
Push — master ( 04b043...334ee0 )
by Paul
04:11
created
templates/reviews-form.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3 3
 <div class="glsr-form-wrap">
4 4
     <form class="{{ class }}" id="{{ id }}" method="post" enctype="multipart/form-data">
Please login to merge, or discard this patch.
templates/form/response.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3 3
 <div class="glsr-form-message {{ class }}">
4 4
     {{ message }}
Please login to merge, or discard this patch.
autoload.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -5,23 +5,23 @@
 block discarded – undo
5 5
 require_once ABSPATH.WPINC.'/class-phpass.php';
6 6
 
7 7
 spl_autoload_register(function ($className) {
8
-    $namespaces = [
9
-        'GeminiLabs\\SiteReviews\\' => __DIR__.'/plugin/',
10
-        'GeminiLabs\\SiteReviews\\Tests\\' => __DIR__.'/tests/',
11
-        'GeminiLabs\\Sepia\\PoParser\\' => __DIR__.'/vendors/sepia/po-parser/',
12
-        'GeminiLabs\\Sinergi\\BrowserDetector\\' => __DIR__.'/vendors/sinergi/browser-detector/',
13
-        'GeminiLabs\\Vectorface\\Whip\\' => __DIR__.'/vendors/vectorface/whip/',
14
-    ];
15
-    foreach ($namespaces as $prefix => $baseDir) {
16
-        $len = strlen($prefix);
17
-        if (0 !== strncmp($prefix, $className, $len)) {
18
-            continue;
19
-        }
20
-        $file = $baseDir.str_replace('\\', '/', substr($className, $len)).'.php';
21
-        if (!file_exists($file)) {
22
-            continue;
23
-        }
24
-        require $file;
25
-        break;
26
-    }
8
+	$namespaces = [
9
+		'GeminiLabs\\SiteReviews\\' => __DIR__.'/plugin/',
10
+		'GeminiLabs\\SiteReviews\\Tests\\' => __DIR__.'/tests/',
11
+		'GeminiLabs\\Sepia\\PoParser\\' => __DIR__.'/vendors/sepia/po-parser/',
12
+		'GeminiLabs\\Sinergi\\BrowserDetector\\' => __DIR__.'/vendors/sinergi/browser-detector/',
13
+		'GeminiLabs\\Vectorface\\Whip\\' => __DIR__.'/vendors/vectorface/whip/',
14
+	];
15
+	foreach ($namespaces as $prefix => $baseDir) {
16
+		$len = strlen($prefix);
17
+		if (0 !== strncmp($prefix, $className, $len)) {
18
+			continue;
19
+		}
20
+		$file = $baseDir.str_replace('\\', '/', substr($className, $len)).'.php';
21
+		if (!file_exists($file)) {
22
+			continue;
23
+		}
24
+		require $file;
25
+		break;
26
+	}
27 27
 });
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-defined('WPINC') || die;
3
+defined( 'WPINC' ) || die;
4 4
 
5 5
 require_once ABSPATH.WPINC.'/class-phpass.php';
6 6
 
7
-spl_autoload_register(function ($className) {
7
+spl_autoload_register( function( $className ) {
8 8
     $namespaces = [
9 9
         'GeminiLabs\\SiteReviews\\' => __DIR__.'/plugin/',
10 10
         'GeminiLabs\\SiteReviews\\Tests\\' => __DIR__.'/tests/',
@@ -12,13 +12,13 @@  discard block
 block discarded – undo
12 12
         'GeminiLabs\\Sinergi\\BrowserDetector\\' => __DIR__.'/vendors/sinergi/browser-detector/',
13 13
         'GeminiLabs\\Vectorface\\Whip\\' => __DIR__.'/vendors/vectorface/whip/',
14 14
     ];
15
-    foreach ($namespaces as $prefix => $baseDir) {
16
-        $len = strlen($prefix);
17
-        if (0 !== strncmp($prefix, $className, $len)) {
15
+    foreach( $namespaces as $prefix => $baseDir ) {
16
+        $len = strlen( $prefix );
17
+        if( 0 !== strncmp( $prefix, $className, $len ) ) {
18 18
             continue;
19 19
         }
20
-        $file = $baseDir.str_replace('\\', '/', substr($className, $len)).'.php';
21
-        if (!file_exists($file)) {
20
+        $file = $baseDir.str_replace( '\\', '/', substr( $className, $len ) ).'.php';
21
+        if( !file_exists( $file ) ) {
22 22
             continue;
23 23
         }
24 24
         require $file;
Please login to merge, or discard this patch.
compatibility.php 2 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -8,10 +8,10 @@  discard block
 block discarded – undo
8 8
  * @see https://www.elegantthemes.com/gallery/divi/
9 9
  */
10 10
 add_action('site-reviews/customize/divi', function ($instance) {
11
-    if ('label' != $instance->tag || 'checkbox' != $instance->args['type']) {
12
-        return;
13
-    }
14
-    $instance->args['text'] = '<i></i>'.$instance->args['text'];
11
+	if ('label' != $instance->tag || 'checkbox' != $instance->args['type']) {
12
+		return;
13
+	}
14
+	$instance->args['text'] = '<i></i>'.$instance->args['text'];
15 15
 });
16 16
 
17 17
 /*
@@ -22,14 +22,14 @@  discard block
 block discarded – undo
22 22
  * @see https://wordpress.org/plugins/wp-super-cache/
23 23
  */
24 24
 add_action('site-reviews/review/created', function ($review, $request) {
25
-    if (!function_exists('wp_cache_post_change')) {
26
-        return;
27
-    }
28
-    wp_cache_post_change($request->post_id);
29
-    if (empty($review->assigned_to) || $review->assigned_to == $request->post_id) {
30
-        return;
31
-    }
32
-    wp_cache_post_change($review->assigned_to);
25
+	if (!function_exists('wp_cache_post_change')) {
26
+		return;
27
+	}
28
+	wp_cache_post_change($request->post_id);
29
+	if (empty($review->assigned_to) || $review->assigned_to == $request->post_id) {
30
+		return;
31
+	}
32
+	wp_cache_post_change($review->assigned_to);
33 33
 }, 10, 2);
34 34
 
35 35
 /*
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
  * @see https://wordpress.org/plugins/speed-booster-pack/
39 39
  */
40 40
 add_filter('sbp_exclude_defer_scripts', function ($scriptHandles) {
41
-    $scriptHandles[] = 'site-reviews/google-recaptcha';
42
-    return array_keys(array_flip($scriptHandles));
41
+	$scriptHandles[] = 'site-reviews/google-recaptcha';
42
+	return array_keys(array_flip($scriptHandles));
43 43
 });
44 44
 
45 45
 /*
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
  * @see https://searchandfilter.com/
50 50
  */
51 51
 add_filter('sf_edit_query_args', function ($query) {
52
-    if (!empty($query['meta_key']) && '_glsr_ranking' == $query['meta_key']) {
53
-        unset($query['meta_key']);
54
-        $query['meta_query'] = [
55
-            'relation' => 'OR',
56
-            ['key' => '_glsr_ranking', 'compare' => 'NOT EXISTS'], // this comes first!
57
-            ['key' => '_glsr_ranking', 'compare' => 'EXISTS'],
58
-        ];
59
-    }
60
-    return $query;
52
+	if (!empty($query['meta_key']) && '_glsr_ranking' == $query['meta_key']) {
53
+		unset($query['meta_key']);
54
+		$query['meta_query'] = [
55
+			'relation' => 'OR',
56
+			['key' => '_glsr_ranking', 'compare' => 'NOT EXISTS'], // this comes first!
57
+			['key' => '_glsr_ranking', 'compare' => 'EXISTS'],
58
+		];
59
+	}
60
+	return $query;
61 61
 }, 20);
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-defined('WPINC') || die;
3
+defined( 'WPINC' ) || die;
4 4
 
5 5
 /*
6 6
  * @param \GeminiLabs\SiteReviews\Modules\Html\Builder $instance
7 7
  * @return void
8 8
  * @see https://www.elegantthemes.com/gallery/divi/
9 9
  */
10
-add_action('site-reviews/customize/divi', function ($instance) {
11
-    if ('label' != $instance->tag || 'checkbox' != $instance->args['type']) {
10
+add_action( 'site-reviews/customize/divi', function( $instance ) {
11
+    if( 'label' != $instance->tag || 'checkbox' != $instance->args['type'] ) {
12 12
         return;
13 13
     }
14 14
     $instance->args['text'] = '<i></i>'.$instance->args['text'];
@@ -21,25 +21,25 @@  discard block
 block discarded – undo
21 21
  * @return void
22 22
  * @see https://wordpress.org/plugins/wp-super-cache/
23 23
  */
24
-add_action('site-reviews/review/created', function ($review, $request) {
25
-    if (!function_exists('wp_cache_post_change')) {
24
+add_action( 'site-reviews/review/created', function( $review, $request ) {
25
+    if( !function_exists( 'wp_cache_post_change' ) ) {
26 26
         return;
27 27
     }
28
-    wp_cache_post_change($request->post_id);
29
-    if (empty($review->assigned_to) || $review->assigned_to == $request->post_id) {
28
+    wp_cache_post_change( $request->post_id );
29
+    if( empty($review->assigned_to) || $review->assigned_to == $request->post_id ) {
30 30
         return;
31 31
     }
32
-    wp_cache_post_change($review->assigned_to);
33
-}, 10, 2);
32
+    wp_cache_post_change( $review->assigned_to );
33
+}, 10, 2 );
34 34
 
35 35
 /*
36 36
  * @param array $scriptHandles
37 37
  * @return array
38 38
  * @see https://wordpress.org/plugins/speed-booster-pack/
39 39
  */
40
-add_filter('sbp_exclude_defer_scripts', function ($scriptHandles) {
40
+add_filter( 'sbp_exclude_defer_scripts', function( $scriptHandles ) {
41 41
     $scriptHandles[] = 'site-reviews/google-recaptcha';
42
-    return array_keys(array_flip($scriptHandles));
42
+    return array_keys( array_flip( $scriptHandles ) );
43 43
 });
44 44
 
45 45
 /*
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
  * @return array
49 49
  * @see https://searchandfilter.com/
50 50
  */
51
-add_filter('sf_edit_query_args', function ($query) {
52
-    if (!empty($query['meta_key']) && '_glsr_ranking' == $query['meta_key']) {
51
+add_filter( 'sf_edit_query_args', function( $query ) {
52
+    if( !empty($query['meta_key']) && '_glsr_ranking' == $query['meta_key'] ) {
53 53
         unset($query['meta_key']);
54 54
         $query['meta_query'] = [
55 55
             'relation' => 'OR',
@@ -58,4 +58,4 @@  discard block
 block discarded – undo
58 58
         ];
59 59
     }
60 60
     return $query;
61
-}, 20);
61
+}, 20 );
Please login to merge, or discard this patch.
helpers.php 3 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -100,7 +100,8 @@
 block discarded – undo
100 100
     if (1 == count($vars)) {
101 101
         $value = htmlspecialchars(print_r($vars[0], true), ENT_QUOTES, 'UTF-8');
102 102
         printf('<div class="glsr-debug"><pre>%s</pre></div>', $value);
103
-    } else {
103
+    }
104
+    else {
104 105
         echo '<div class="glsr-debug-group">';
105 106
         foreach ($vars as $var) {
106 107
             glsr_debug($var);
Please login to merge, or discard this patch.
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -9,26 +9,26 @@  discard block
 block discarded – undo
9 9
  * @return mixed
10 10
  */
11 11
 add_filter('plugins_loaded', function () {
12
-    $hooks = array(
13
-        'glsr_calculate_ratings' => 1,
14
-        'glsr_create_review' => 2,
15
-        'glsr_debug' => 10,
16
-        'glsr_get' => 4,
17
-        'glsr_get_option' => 4,
18
-        'glsr_get_options' => 1,
19
-        'glsr_get_rating' => 2,
20
-        'glsr_get_review' => 2,
21
-        'glsr_get_reviews' => 2,
22
-        'glsr_log' => 3,
23
-        'glsr_star_rating' => 2,
24
-    );
25
-    foreach ($hooks as $function => $acceptedArgs) {
26
-        add_filter($function, function () use ($function) {
27
-            $args = func_get_args();
28
-            array_shift($args); // remove the fallback value
29
-            return call_user_func_array($function, $args);
30
-        }, 10, $acceptedArgs);
31
-    }
12
+	$hooks = array(
13
+		'glsr_calculate_ratings' => 1,
14
+		'glsr_create_review' => 2,
15
+		'glsr_debug' => 10,
16
+		'glsr_get' => 4,
17
+		'glsr_get_option' => 4,
18
+		'glsr_get_options' => 1,
19
+		'glsr_get_rating' => 2,
20
+		'glsr_get_review' => 2,
21
+		'glsr_get_reviews' => 2,
22
+		'glsr_log' => 3,
23
+		'glsr_star_rating' => 2,
24
+	);
25
+	foreach ($hooks as $function => $acceptedArgs) {
26
+		add_filter($function, function () use ($function) {
27
+			$args = func_get_args();
28
+			array_shift($args); // remove the fallback value
29
+			return call_user_func_array($function, $args);
30
+		}, 10, $acceptedArgs);
31
+	}
32 32
 });
33 33
 
34 34
 /**
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
  */
37 37
 function glsr($alias = null)
38 38
 {
39
-    $app = \GeminiLabs\SiteReviews\Application::load();
40
-    return !is_null($alias)
41
-        ? $app->make($alias)
42
-        : $app;
39
+	$app = \GeminiLabs\SiteReviews\Application::load();
40
+	return !is_null($alias)
41
+		? $app->make($alias)
42
+		: $app;
43 43
 }
44 44
 
45 45
 /**
@@ -49,15 +49,15 @@  discard block
 block discarded – undo
49 49
  */
50 50
 function glsr_array_column(array $array, $column)
51 51
 {
52
-    $result = array();
53
-    foreach ($array as $subarray) {
54
-        $subarray = (array) $subarray;
55
-        if (!isset($subarray[$column])) {
56
-            continue;
57
-        }
58
-        $result[] = $subarray[$column];
59
-    }
60
-    return $result;
52
+	$result = array();
53
+	foreach ($array as $subarray) {
54
+		$subarray = (array) $subarray;
55
+		if (!isset($subarray[$column])) {
56
+			continue;
57
+		}
58
+		$result[] = $subarray[$column];
59
+	}
60
+	return $result;
61 61
 }
62 62
 
63 63
 /**
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
  */
66 66
 function glsr_calculate_ratings()
67 67
 {
68
-    glsr('Database\CountsManager')->updateAll();
69
-    glsr_log()->notice(__('Recalculated rating counts.', 'site-reviews'));
68
+	glsr('Database\CountsManager')->updateAll();
69
+	glsr_log()->notice(__('Recalculated rating counts.', 'site-reviews'));
70 70
 }
71 71
 
72 72
 /**
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
  */
75 75
 function glsr_create_review($reviewValues = array())
76 76
 {
77
-    $review = new \GeminiLabs\SiteReviews\Commands\CreateReview(
78
-        \GeminiLabs\SiteReviews\Helpers\Arr::consolidateArray($reviewValues)
79
-    );
80
-    return glsr('Database\ReviewManager')->create($review);
77
+	$review = new \GeminiLabs\SiteReviews\Commands\CreateReview(
78
+		\GeminiLabs\SiteReviews\Helpers\Arr::consolidateArray($reviewValues)
79
+	);
80
+	return glsr('Database\ReviewManager')->create($review);
81 81
 }
82 82
 
83 83
 /**
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
  */
86 86
 function glsr_current_screen()
87 87
 {
88
-    if (function_exists('get_current_screen')) {
89
-        $screen = get_current_screen();
90
-    }
91
-    return empty($screen)
92
-        ? (object) array_fill_keys(['base', 'id', 'post_type'], null)
93
-        : $screen;
88
+	if (function_exists('get_current_screen')) {
89
+		$screen = get_current_screen();
90
+	}
91
+	return empty($screen)
92
+		? (object) array_fill_keys(['base', 'id', 'post_type'], null)
93
+		: $screen;
94 94
 }
95 95
 
96 96
 /**
@@ -99,16 +99,16 @@  discard block
 block discarded – undo
99 99
  */
100 100
 function glsr_debug(...$vars)
101 101
 {
102
-    if (1 == count($vars)) {
103
-        $value = htmlspecialchars(print_r($vars[0], true), ENT_QUOTES, 'UTF-8');
104
-        printf('<div class="glsr-debug"><pre>%s</pre></div>', $value);
105
-    } else {
106
-        echo '<div class="glsr-debug-group">';
107
-        foreach ($vars as $var) {
108
-            glsr_debug($var);
109
-        }
110
-        echo '</div>';
111
-    }
102
+	if (1 == count($vars)) {
103
+		$value = htmlspecialchars(print_r($vars[0], true), ENT_QUOTES, 'UTF-8');
104
+		printf('<div class="glsr-debug"><pre>%s</pre></div>', $value);
105
+	} else {
106
+		echo '<div class="glsr-debug-group">';
107
+		foreach ($vars as $var) {
108
+			glsr_debug($var);
109
+		}
110
+		echo '</div>';
111
+	}
112 112
 }
113 113
 
114 114
 /**
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
  */
120 120
 function glsr_get($array, $path = '', $fallback = '')
121 121
 {
122
-    return \GeminiLabs\SiteReviews\Helpers\Arr::get($array, $path, $fallback);
122
+	return \GeminiLabs\SiteReviews\Helpers\Arr::get($array, $path, $fallback);
123 123
 }
124 124
 
125 125
 /**
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
  */
131 131
 function glsr_get_option($path = '', $fallback = '', $cast = '')
132 132
 {
133
-    return is_string($path)
134
-        ? glsr('Database\OptionManager')->get(\GeminiLabs\SiteReviews\Helpers\Str::prefix('settings.', $path), $fallback, $cast)
135
-        : $fallback;
133
+	return is_string($path)
134
+		? glsr('Database\OptionManager')->get(\GeminiLabs\SiteReviews\Helpers\Str::prefix('settings.', $path), $fallback, $cast)
135
+		: $fallback;
136 136
 }
137 137
 
138 138
 /**
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
  */
141 141
 function glsr_get_options()
142 142
 {
143
-    return glsr('Database\OptionManager')->get('settings');
143
+	return glsr('Database\OptionManager')->get('settings');
144 144
 }
145 145
 
146 146
 /**
@@ -148,15 +148,15 @@  discard block
 block discarded – undo
148 148
  */
149 149
 function glsr_get_rating($args = array())
150 150
 {
151
-    $args = \GeminiLabs\SiteReviews\Helpers\Arr::consolidateArray($args);
152
-    $counts = glsr('Database\ReviewManager')->getRatingCounts($args);
153
-    return (object) array(
154
-        'average' => glsr('Modules\Rating')->getAverage($counts),
155
-        'maximum' => glsr()->constant('MAX_RATING', \GeminiLabs\SiteReviews\Modules\Rating::class),
156
-        'minimum' => glsr()->constant('MIN_RATING', \GeminiLabs\SiteReviews\Modules\Rating::class),
157
-        'ratings' => $counts,
158
-        'reviews' => array_sum($counts),
159
-    );
151
+	$args = \GeminiLabs\SiteReviews\Helpers\Arr::consolidateArray($args);
152
+	$counts = glsr('Database\ReviewManager')->getRatingCounts($args);
153
+	return (object) array(
154
+		'average' => glsr('Modules\Rating')->getAverage($counts),
155
+		'maximum' => glsr()->constant('MAX_RATING', \GeminiLabs\SiteReviews\Modules\Rating::class),
156
+		'minimum' => glsr()->constant('MIN_RATING', \GeminiLabs\SiteReviews\Modules\Rating::class),
157
+		'ratings' => $counts,
158
+		'reviews' => array_sum($counts),
159
+	);
160 160
 }
161 161
 
162 162
 /**
@@ -165,13 +165,13 @@  discard block
 block discarded – undo
165 165
  */
166 166
 function glsr_get_review($post)
167 167
 {
168
-    if (is_numeric($post)) {
169
-        $post = get_post($post);
170
-    }
171
-    if (!($post instanceof WP_Post)) {
172
-        $post = new WP_Post((object) []);
173
-    }
174
-    return glsr('Database\ReviewManager')->single($post);
168
+	if (is_numeric($post)) {
169
+		$post = get_post($post);
170
+	}
171
+	if (!($post instanceof WP_Post)) {
172
+		$post = new WP_Post((object) []);
173
+	}
174
+	return glsr('Database\ReviewManager')->single($post);
175 175
 }
176 176
 
177 177
 /**
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
  */
180 180
 function glsr_get_reviews($args = array())
181 181
 {
182
-    return glsr('Database\ReviewManager')->get(\GeminiLabs\SiteReviews\Helpers\Arr::consolidateArray($args));
182
+	return glsr('Database\ReviewManager')->get(\GeminiLabs\SiteReviews\Helpers\Arr::consolidateArray($args));
183 183
 }
184 184
 
185 185
 /**
@@ -187,12 +187,12 @@  discard block
 block discarded – undo
187 187
  */
188 188
 function glsr_log()
189 189
 {
190
-    $args = func_get_args();
191
-    $console = glsr('Modules\Console');
192
-    if ($value = \GeminiLabs\SiteReviews\Helpers\Arr::get($args, '0')) {
193
-        return $console->debug($value, \GeminiLabs\SiteReviews\Helpers\Arr::get($args, '1', []));
194
-    }
195
-    return $console;
190
+	$args = func_get_args();
191
+	$console = glsr('Modules\Console');
192
+	if ($value = \GeminiLabs\SiteReviews\Helpers\Arr::get($args, '0')) {
193
+		return $console->debug($value, \GeminiLabs\SiteReviews\Helpers\Arr::get($args, '1', []));
194
+	}
195
+	return $console;
196 196
 }
197 197
 
198 198
 /**
@@ -200,5 +200,5 @@  discard block
 block discarded – undo
200 200
  */
201 201
 function glsr_star_rating($rating)
202 202
 {
203
-    return glsr('Modules\Html\Partial')->build('star-rating', ['rating' => $rating]);
203
+	return glsr('Modules\Html\Partial')->build('star-rating', ['rating' => $rating]);
204 204
 }
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-defined('WPINC') || die;
3
+defined( 'WPINC' ) || die;
4 4
 
5 5
 /*
6 6
  * Alternate method of using the functions without having to use `function_exists()`
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @param mixed ...
9 9
  * @return mixed
10 10
  */
11
-add_filter('plugins_loaded', function () {
11
+add_filter( 'plugins_loaded', function() {
12 12
     $hooks = array(
13 13
         'glsr_calculate_ratings' => 1,
14 14
         'glsr_create_review' => 2,
@@ -22,23 +22,23 @@  discard block
 block discarded – undo
22 22
         'glsr_log' => 3,
23 23
         'glsr_star_rating' => 2,
24 24
     );
25
-    foreach ($hooks as $function => $acceptedArgs) {
26
-        add_filter($function, function () use ($function) {
25
+    foreach( $hooks as $function => $acceptedArgs ) {
26
+        add_filter( $function, function() use ($function) {
27 27
             $args = func_get_args();
28
-            array_shift($args); // remove the fallback value
29
-            return call_user_func_array($function, $args);
30
-        }, 10, $acceptedArgs);
28
+            array_shift( $args ); // remove the fallback value
29
+            return call_user_func_array( $function, $args );
30
+        }, 10, $acceptedArgs );
31 31
     }
32 32
 });
33 33
 
34 34
 /**
35 35
  * @return mixed
36 36
  */
37
-function glsr($alias = null)
37
+function glsr( $alias = null )
38 38
 {
39 39
     $app = \GeminiLabs\SiteReviews\Application::load();
40
-    return !is_null($alias)
41
-        ? $app->make($alias)
40
+    return !is_null( $alias )
41
+        ? $app->make( $alias )
42 42
         : $app;
43 43
 }
44 44
 
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
  * @param $column string
48 48
  * @return array
49 49
  */
50
-function glsr_array_column(array $array, $column)
50
+function glsr_array_column( array $array, $column )
51 51
 {
52 52
     $result = array();
53
-    foreach ($array as $subarray) {
54
-        $subarray = (array) $subarray;
55
-        if (!isset($subarray[$column])) {
53
+    foreach( $array as $subarray ) {
54
+        $subarray = (array)$subarray;
55
+        if( !isset($subarray[$column]) ) {
56 56
             continue;
57 57
         }
58 58
         $result[] = $subarray[$column];
@@ -65,19 +65,19 @@  discard block
 block discarded – undo
65 65
  */
66 66
 function glsr_calculate_ratings()
67 67
 {
68
-    glsr('Database\CountsManager')->updateAll();
69
-    glsr_log()->notice(__('Recalculated rating counts.', 'site-reviews'));
68
+    glsr( 'Database\CountsManager' )->updateAll();
69
+    glsr_log()->notice( __( 'Recalculated rating counts.', 'site-reviews' ) );
70 70
 }
71 71
 
72 72
 /**
73 73
  * @return \GeminiLabs\SiteReviews\Review|false
74 74
  */
75
-function glsr_create_review($reviewValues = array())
75
+function glsr_create_review( $reviewValues = array() )
76 76
 {
77 77
     $review = new \GeminiLabs\SiteReviews\Commands\CreateReview(
78
-        \GeminiLabs\SiteReviews\Helpers\Arr::consolidateArray($reviewValues)
78
+        \GeminiLabs\SiteReviews\Helpers\Arr::consolidateArray( $reviewValues )
79 79
     );
80
-    return glsr('Database\ReviewManager')->create($review);
80
+    return glsr( 'Database\ReviewManager' )->create( $review );
81 81
 }
82 82
 
83 83
 /**
@@ -85,11 +85,11 @@  discard block
 block discarded – undo
85 85
  */
86 86
 function glsr_current_screen()
87 87
 {
88
-    if (function_exists('get_current_screen')) {
88
+    if( function_exists( 'get_current_screen' ) ) {
89 89
         $screen = get_current_screen();
90 90
     }
91 91
     return empty($screen)
92
-        ? (object) array_fill_keys(['base', 'id', 'post_type'], null)
92
+        ? (object)array_fill_keys( ['base', 'id', 'post_type'], null )
93 93
         : $screen;
94 94
 }
95 95
 
@@ -97,15 +97,15 @@  discard block
 block discarded – undo
97 97
  * @param mixed ...$vars
98 98
  * @return void
99 99
  */
100
-function glsr_debug(...$vars)
100
+function glsr_debug( ...$vars )
101 101
 {
102
-    if (1 == count($vars)) {
103
-        $value = htmlspecialchars(print_r($vars[0], true), ENT_QUOTES, 'UTF-8');
104
-        printf('<div class="glsr-debug"><pre>%s</pre></div>', $value);
102
+    if( 1 == count( $vars ) ) {
103
+        $value = htmlspecialchars( print_r( $vars[0], true ), ENT_QUOTES, 'UTF-8' );
104
+        printf( '<div class="glsr-debug"><pre>%s</pre></div>', $value );
105 105
     } else {
106 106
         echo '<div class="glsr-debug-group">';
107
-        foreach ($vars as $var) {
108
-            glsr_debug($var);
107
+        foreach( $vars as $var ) {
108
+            glsr_debug( $var );
109 109
         }
110 110
         echo '</div>';
111 111
     }
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
  * @param mixed $fallback
118 118
  * @return mixed
119 119
  */
120
-function glsr_get($array, $path = '', $fallback = '')
120
+function glsr_get( $array, $path = '', $fallback = '' )
121 121
 {
122
-    return \GeminiLabs\SiteReviews\Helpers\Arr::get($array, $path, $fallback);
122
+    return \GeminiLabs\SiteReviews\Helpers\Arr::get( $array, $path, $fallback );
123 123
 }
124 124
 
125 125
 /**
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
  * @param string $cast
129 129
  * @return string|array
130 130
  */
131
-function glsr_get_option($path = '', $fallback = '', $cast = '')
131
+function glsr_get_option( $path = '', $fallback = '', $cast = '' )
132 132
 {
133
-    return is_string($path)
134
-        ? glsr('Database\OptionManager')->get(\GeminiLabs\SiteReviews\Helpers\Str::prefix('settings.', $path), $fallback, $cast)
133
+    return is_string( $path )
134
+        ? glsr( 'Database\OptionManager' )->get( \GeminiLabs\SiteReviews\Helpers\Str::prefix( 'settings.', $path ), $fallback, $cast )
135 135
         : $fallback;
136 136
 }
137 137
 
@@ -140,22 +140,22 @@  discard block
 block discarded – undo
140 140
  */
141 141
 function glsr_get_options()
142 142
 {
143
-    return glsr('Database\OptionManager')->get('settings');
143
+    return glsr( 'Database\OptionManager' )->get( 'settings' );
144 144
 }
145 145
 
146 146
 /**
147 147
  * @return object
148 148
  */
149
-function glsr_get_rating($args = array())
149
+function glsr_get_rating( $args = array() )
150 150
 {
151
-    $args = \GeminiLabs\SiteReviews\Helpers\Arr::consolidateArray($args);
152
-    $counts = glsr('Database\ReviewManager')->getRatingCounts($args);
153
-    return (object) array(
154
-        'average' => glsr('Modules\Rating')->getAverage($counts),
155
-        'maximum' => glsr()->constant('MAX_RATING', \GeminiLabs\SiteReviews\Modules\Rating::class),
156
-        'minimum' => glsr()->constant('MIN_RATING', \GeminiLabs\SiteReviews\Modules\Rating::class),
151
+    $args = \GeminiLabs\SiteReviews\Helpers\Arr::consolidateArray( $args );
152
+    $counts = glsr( 'Database\ReviewManager' )->getRatingCounts( $args );
153
+    return (object)array(
154
+        'average' => glsr( 'Modules\Rating' )->getAverage( $counts ),
155
+        'maximum' => glsr()->constant( 'MAX_RATING', \GeminiLabs\SiteReviews\Modules\Rating::class ),
156
+        'minimum' => glsr()->constant( 'MIN_RATING', \GeminiLabs\SiteReviews\Modules\Rating::class ),
157 157
         'ratings' => $counts,
158
-        'reviews' => array_sum($counts),
158
+        'reviews' => array_sum( $counts ),
159 159
     );
160 160
 }
161 161
 
@@ -163,23 +163,23 @@  discard block
 block discarded – undo
163 163
  * @param \WP_Post|int $post
164 164
  * @return \GeminiLabs\SiteReviews\Review
165 165
  */
166
-function glsr_get_review($post)
166
+function glsr_get_review( $post )
167 167
 {
168
-    if (is_numeric($post)) {
169
-        $post = get_post($post);
168
+    if( is_numeric( $post ) ) {
169
+        $post = get_post( $post );
170 170
     }
171
-    if (!($post instanceof WP_Post)) {
172
-        $post = new WP_Post((object) []);
171
+    if( !($post instanceof WP_Post) ) {
172
+        $post = new WP_Post( (object)[] );
173 173
     }
174
-    return glsr('Database\ReviewManager')->single($post);
174
+    return glsr( 'Database\ReviewManager' )->single( $post );
175 175
 }
176 176
 
177 177
 /**
178 178
  * @return array
179 179
  */
180
-function glsr_get_reviews($args = array())
180
+function glsr_get_reviews( $args = array() )
181 181
 {
182
-    return glsr('Database\ReviewManager')->get(\GeminiLabs\SiteReviews\Helpers\Arr::consolidateArray($args));
182
+    return glsr( 'Database\ReviewManager' )->get( \GeminiLabs\SiteReviews\Helpers\Arr::consolidateArray( $args ) );
183 183
 }
184 184
 
185 185
 /**
@@ -188,9 +188,9 @@  discard block
 block discarded – undo
188 188
 function glsr_log()
189 189
 {
190 190
     $args = func_get_args();
191
-    $console = glsr('Modules\Console');
192
-    if ($value = \GeminiLabs\SiteReviews\Helpers\Arr::get($args, '0')) {
193
-        return $console->debug($value, \GeminiLabs\SiteReviews\Helpers\Arr::get($args, '1', []));
191
+    $console = glsr( 'Modules\Console' );
192
+    if( $value = \GeminiLabs\SiteReviews\Helpers\Arr::get( $args, '0' ) ) {
193
+        return $console->debug( $value, \GeminiLabs\SiteReviews\Helpers\Arr::get( $args, '1', [] ) );
194 194
     }
195 195
     return $console;
196 196
 }
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 /**
199 199
  * @return string
200 200
  */
201
-function glsr_star_rating($rating)
201
+function glsr_star_rating( $rating )
202 202
 {
203
-    return glsr('Modules\Html\Partial')->build('star-rating', ['rating' => $rating]);
203
+    return glsr( 'Modules\Html\Partial' )->build( 'star-rating', ['rating' => $rating] );
204 204
 }
Please login to merge, or discard this patch.
plugin/Provider.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -10,17 +10,17 @@
 block discarded – undo
10 10
 
11 11
 class Provider implements ProviderContract
12 12
 {
13
-    /**
14
-     * @return void
15
-     */
16
-    public function register(Application $app)
17
-    {
18
-        $app->bind(Application::class, $app);
19
-        $app->singleton(Actions::class, Actions::class);
20
-        $app->singleton(Filters::class, Filters::class);
21
-        $app->singleton(OptionManager::class, OptionManager::class);
22
-        $app->singleton(Translator::class, Translator::class);
23
-        $app->singleton(Translation::class, Translation::class);
24
-        $app->singleton(MainController::class, MainController::class); // this goes last
25
-    }
13
+	/**
14
+	 * @return void
15
+	 */
16
+	public function register(Application $app)
17
+	{
18
+		$app->bind(Application::class, $app);
19
+		$app->singleton(Actions::class, Actions::class);
20
+		$app->singleton(Filters::class, Filters::class);
21
+		$app->singleton(OptionManager::class, OptionManager::class);
22
+		$app->singleton(Translator::class, Translator::class);
23
+		$app->singleton(Translation::class, Translation::class);
24
+		$app->singleton(MainController::class, MainController::class); // this goes last
25
+	}
26 26
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -13,14 +13,14 @@
 block discarded – undo
13 13
     /**
14 14
      * @return void
15 15
      */
16
-    public function register(Application $app)
16
+    public function register( Application $app )
17 17
     {
18
-        $app->bind(Application::class, $app);
19
-        $app->singleton(Actions::class, Actions::class);
20
-        $app->singleton(Filters::class, Filters::class);
21
-        $app->singleton(OptionManager::class, OptionManager::class);
22
-        $app->singleton(Translator::class, Translator::class);
23
-        $app->singleton(Translation::class, Translation::class);
24
-        $app->singleton(MainController::class, MainController::class); // this goes last
18
+        $app->bind( Application::class, $app );
19
+        $app->singleton( Actions::class, Actions::class );
20
+        $app->singleton( Filters::class, Filters::class );
21
+        $app->singleton( OptionManager::class, OptionManager::class );
22
+        $app->singleton( Translator::class, Translator::class );
23
+        $app->singleton( Translation::class, Translation::class );
24
+        $app->singleton( MainController::class, MainController::class ); // this goes last
25 25
     }
26 26
 }
Please login to merge, or discard this patch.
plugin/Handlers/ChangeStatus.php 2 patches
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -8,70 +8,70 @@
 block discarded – undo
8 8
 
9 9
 class ChangeStatus
10 10
 {
11
-    /**
12
-     * @return array
13
-     */
14
-    public function handle(Command $command)
15
-    {
16
-        $postId = wp_update_post([
17
-            'ID' => $command->id,
18
-            'post_status' => $command->status,
19
-        ]);
20
-        if (is_wp_error($postId)) {
21
-            glsr_log()->error($postId->get_error_message());
22
-            return [];
23
-        }
24
-        return [
25
-            'class' => 'status-'.$command->status,
26
-            'counts' => $this->getStatusLinks(),
27
-            'link' => $this->getPostLink($postId).$this->getPostState($postId),
28
-            'pending' => wp_count_posts(Application::POST_TYPE, 'readable')->pending,
29
-        ];
30
-    }
11
+	/**
12
+	 * @return array
13
+	 */
14
+	public function handle(Command $command)
15
+	{
16
+		$postId = wp_update_post([
17
+			'ID' => $command->id,
18
+			'post_status' => $command->status,
19
+		]);
20
+		if (is_wp_error($postId)) {
21
+			glsr_log()->error($postId->get_error_message());
22
+			return [];
23
+		}
24
+		return [
25
+			'class' => 'status-'.$command->status,
26
+			'counts' => $this->getStatusLinks(),
27
+			'link' => $this->getPostLink($postId).$this->getPostState($postId),
28
+			'pending' => wp_count_posts(Application::POST_TYPE, 'readable')->pending,
29
+		];
30
+	}
31 31
 
32
-    /**
33
-     * @param int $postId
34
-     * @return string
35
-     */
36
-    protected function getPostLink($postId)
37
-    {
38
-        $title = _draft_or_post_title($postId);
39
-        return glsr(Builder::class)->a($title, [
40
-            'aria-label' => '&#8220;'.esc_attr($title).'&#8221; ('.__('Edit', 'site-reviews').')',
41
-            'class' => 'row-title',
42
-            'href' => get_edit_post_link($postId),
43
-        ]);
44
-    }
32
+	/**
33
+	 * @param int $postId
34
+	 * @return string
35
+	 */
36
+	protected function getPostLink($postId)
37
+	{
38
+		$title = _draft_or_post_title($postId);
39
+		return glsr(Builder::class)->a($title, [
40
+			'aria-label' => '&#8220;'.esc_attr($title).'&#8221; ('.__('Edit', 'site-reviews').')',
41
+			'class' => 'row-title',
42
+			'href' => get_edit_post_link($postId),
43
+		]);
44
+	}
45 45
 
46
-    /**
47
-     * @param int $postId
48
-     * @return string
49
-     */
50
-    protected function getPostState($postId)
51
-    {
52
-        ob_start();
53
-        _post_states(get_post($postId));
54
-        return ob_get_clean();
55
-    }
46
+	/**
47
+	 * @param int $postId
48
+	 * @return string
49
+	 */
50
+	protected function getPostState($postId)
51
+	{
52
+		ob_start();
53
+		_post_states(get_post($postId));
54
+		return ob_get_clean();
55
+	}
56 56
 
57
-    /**
58
-     * @return void|string
59
-     */
60
-    protected function getStatusLinks()
61
-    {
62
-        global $avail_post_stati;
63
-        require_once ABSPATH.'wp-admin/includes/class-wp-posts-list-table.php';
64
-        $hookName = 'edit-'.Application::POST_TYPE;
65
-        set_current_screen($hookName);
66
-        $avail_post_stati = get_available_post_statuses(Application::POST_TYPE);
67
-        $table = new \WP_Posts_List_Table(['screen' => $hookName]);
68
-        $views = apply_filters('views_'.$hookName, $table->get_views()); // uses compat get_views()
69
-        if (empty($views)) {
70
-            return;
71
-        }
72
-        foreach ($views as $class => $view) {
73
-            $views[$class] = "\t<li class='$class'>$view";
74
-        }
75
-        return implode(' |</li>', $views).'</li>';
76
-    }
57
+	/**
58
+	 * @return void|string
59
+	 */
60
+	protected function getStatusLinks()
61
+	{
62
+		global $avail_post_stati;
63
+		require_once ABSPATH.'wp-admin/includes/class-wp-posts-list-table.php';
64
+		$hookName = 'edit-'.Application::POST_TYPE;
65
+		set_current_screen($hookName);
66
+		$avail_post_stati = get_available_post_statuses(Application::POST_TYPE);
67
+		$table = new \WP_Posts_List_Table(['screen' => $hookName]);
68
+		$views = apply_filters('views_'.$hookName, $table->get_views()); // uses compat get_views()
69
+		if (empty($views)) {
70
+			return;
71
+		}
72
+		foreach ($views as $class => $view) {
73
+			$views[$class] = "\t<li class='$class'>$view";
74
+		}
75
+		return implode(' |</li>', $views).'</li>';
76
+	}
77 77
 }
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -11,21 +11,21 @@  discard block
 block discarded – undo
11 11
     /**
12 12
      * @return array
13 13
      */
14
-    public function handle(Command $command)
14
+    public function handle( Command $command )
15 15
     {
16
-        $postId = wp_update_post([
16
+        $postId = wp_update_post( [
17 17
             'ID' => $command->id,
18 18
             'post_status' => $command->status,
19
-        ]);
20
-        if (is_wp_error($postId)) {
21
-            glsr_log()->error($postId->get_error_message());
19
+        ] );
20
+        if( is_wp_error( $postId ) ) {
21
+            glsr_log()->error( $postId->get_error_message() );
22 22
             return [];
23 23
         }
24 24
         return [
25 25
             'class' => 'status-'.$command->status,
26 26
             'counts' => $this->getStatusLinks(),
27
-            'link' => $this->getPostLink($postId).$this->getPostState($postId),
28
-            'pending' => wp_count_posts(Application::POST_TYPE, 'readable')->pending,
27
+            'link' => $this->getPostLink( $postId ).$this->getPostState( $postId ),
28
+            'pending' => wp_count_posts( Application::POST_TYPE, 'readable' )->pending,
29 29
         ];
30 30
     }
31 31
 
@@ -33,24 +33,24 @@  discard block
 block discarded – undo
33 33
      * @param int $postId
34 34
      * @return string
35 35
      */
36
-    protected function getPostLink($postId)
36
+    protected function getPostLink( $postId )
37 37
     {
38
-        $title = _draft_or_post_title($postId);
39
-        return glsr(Builder::class)->a($title, [
40
-            'aria-label' => '&#8220;'.esc_attr($title).'&#8221; ('.__('Edit', 'site-reviews').')',
38
+        $title = _draft_or_post_title( $postId );
39
+        return glsr( Builder::class )->a( $title, [
40
+            'aria-label' => '&#8220;'.esc_attr( $title ).'&#8221; ('.__( 'Edit', 'site-reviews' ).')',
41 41
             'class' => 'row-title',
42
-            'href' => get_edit_post_link($postId),
43
-        ]);
42
+            'href' => get_edit_post_link( $postId ),
43
+        ] );
44 44
     }
45 45
 
46 46
     /**
47 47
      * @param int $postId
48 48
      * @return string
49 49
      */
50
-    protected function getPostState($postId)
50
+    protected function getPostState( $postId )
51 51
     {
52 52
         ob_start();
53
-        _post_states(get_post($postId));
53
+        _post_states( get_post( $postId ) );
54 54
         return ob_get_clean();
55 55
     }
56 56
 
@@ -62,16 +62,16 @@  discard block
 block discarded – undo
62 62
         global $avail_post_stati;
63 63
         require_once ABSPATH.'wp-admin/includes/class-wp-posts-list-table.php';
64 64
         $hookName = 'edit-'.Application::POST_TYPE;
65
-        set_current_screen($hookName);
66
-        $avail_post_stati = get_available_post_statuses(Application::POST_TYPE);
67
-        $table = new \WP_Posts_List_Table(['screen' => $hookName]);
68
-        $views = apply_filters('views_'.$hookName, $table->get_views()); // uses compat get_views()
69
-        if (empty($views)) {
65
+        set_current_screen( $hookName );
66
+        $avail_post_stati = get_available_post_statuses( Application::POST_TYPE );
67
+        $table = new \WP_Posts_List_Table( ['screen' => $hookName] );
68
+        $views = apply_filters( 'views_'.$hookName, $table->get_views() ); // uses compat get_views()
69
+        if( empty($views) ) {
70 70
             return;
71 71
         }
72
-        foreach ($views as $class => $view) {
72
+        foreach( $views as $class => $view ) {
73 73
             $views[$class] = "\t<li class='$class'>$view";
74 74
         }
75
-        return implode(' |</li>', $views).'</li>';
75
+        return implode( ' |</li>', $views ).'</li>';
76 76
     }
77 77
 }
Please login to merge, or discard this patch.
plugin/Handlers/CreateReview.php 2 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -8,40 +8,40 @@
 block discarded – undo
8 8
 
9 9
 class CreateReview
10 10
 {
11
-    /**
12
-     * @return void|string
13
-     */
14
-    public function handle(Command $command)
15
-    {
16
-        $review = glsr(ReviewManager::class)->create($command);
17
-        if (!$review) {
18
-            glsr()->sessionSet($command->form_id.'errors', []);
19
-            glsr()->sessionSet($command->form_id.'message', __('Your review could not be submitted and the error has been logged. Please notify the site admin.', 'site-reviews'));
20
-            return;
21
-        }
22
-        glsr()->sessionSet($command->form_id.'message', __('Your review has been submitted!', 'site-reviews'));
23
-        glsr(Notification::class)->send($review);
24
-        if ($command->ajax_request) {
25
-            return;
26
-        }
27
-        wp_safe_redirect($this->getReferer($command));
28
-        exit;
29
-    }
11
+	/**
12
+	 * @return void|string
13
+	 */
14
+	public function handle(Command $command)
15
+	{
16
+		$review = glsr(ReviewManager::class)->create($command);
17
+		if (!$review) {
18
+			glsr()->sessionSet($command->form_id.'errors', []);
19
+			glsr()->sessionSet($command->form_id.'message', __('Your review could not be submitted and the error has been logged. Please notify the site admin.', 'site-reviews'));
20
+			return;
21
+		}
22
+		glsr()->sessionSet($command->form_id.'message', __('Your review has been submitted!', 'site-reviews'));
23
+		glsr(Notification::class)->send($review);
24
+		if ($command->ajax_request) {
25
+			return;
26
+		}
27
+		wp_safe_redirect($this->getReferer($command));
28
+		exit;
29
+	}
30 30
 
31
-    /**
32
-     * @return string
33
-     */
34
-    protected function getReferer(Command $command)
35
-    {
36
-        $referer = trim(strval(get_post_meta($command->post_id, 'redirect_to', true)));
37
-        $referer = apply_filters('site-reviews/review/redirect', $referer, $command);
38
-        if (empty($referer)) {
39
-            $referer = $command->referer;
40
-        }
41
-        if (empty($referer)) {
42
-            glsr_log()->warning('The form referer ($_SERVER[REQUEST_URI]) was empty.')->debug($command);
43
-            $referer = home_url();
44
-        }
45
-        return $referer;
46
-    }
31
+	/**
32
+	 * @return string
33
+	 */
34
+	protected function getReferer(Command $command)
35
+	{
36
+		$referer = trim(strval(get_post_meta($command->post_id, 'redirect_to', true)));
37
+		$referer = apply_filters('site-reviews/review/redirect', $referer, $command);
38
+		if (empty($referer)) {
39
+			$referer = $command->referer;
40
+		}
41
+		if (empty($referer)) {
42
+			glsr_log()->warning('The form referer ($_SERVER[REQUEST_URI]) was empty.')->debug($command);
43
+			$referer = home_url();
44
+		}
45
+		return $referer;
46
+	}
47 47
 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -11,35 +11,35 @@
 block discarded – undo
11 11
     /**
12 12
      * @return void|string
13 13
      */
14
-    public function handle(Command $command)
14
+    public function handle( Command $command )
15 15
     {
16
-        $review = glsr(ReviewManager::class)->create($command);
17
-        if (!$review) {
18
-            glsr()->sessionSet($command->form_id.'errors', []);
19
-            glsr()->sessionSet($command->form_id.'message', __('Your review could not be submitted and the error has been logged. Please notify the site admin.', 'site-reviews'));
16
+        $review = glsr( ReviewManager::class )->create( $command );
17
+        if( !$review ) {
18
+            glsr()->sessionSet( $command->form_id.'errors', [] );
19
+            glsr()->sessionSet( $command->form_id.'message', __( 'Your review could not be submitted and the error has been logged. Please notify the site admin.', 'site-reviews' ) );
20 20
             return;
21 21
         }
22
-        glsr()->sessionSet($command->form_id.'message', __('Your review has been submitted!', 'site-reviews'));
23
-        glsr(Notification::class)->send($review);
24
-        if ($command->ajax_request) {
22
+        glsr()->sessionSet( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' ) );
23
+        glsr( Notification::class )->send( $review );
24
+        if( $command->ajax_request ) {
25 25
             return;
26 26
         }
27
-        wp_safe_redirect($this->getReferer($command));
27
+        wp_safe_redirect( $this->getReferer( $command ) );
28 28
         exit;
29 29
     }
30 30
 
31 31
     /**
32 32
      * @return string
33 33
      */
34
-    protected function getReferer(Command $command)
34
+    protected function getReferer( Command $command )
35 35
     {
36
-        $referer = trim(strval(get_post_meta($command->post_id, 'redirect_to', true)));
37
-        $referer = apply_filters('site-reviews/review/redirect', $referer, $command);
38
-        if (empty($referer)) {
36
+        $referer = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ) ) );
37
+        $referer = apply_filters( 'site-reviews/review/redirect', $referer, $command );
38
+        if( empty($referer) ) {
39 39
             $referer = $command->referer;
40 40
         }
41
-        if (empty($referer)) {
42
-            glsr_log()->warning('The form referer ($_SERVER[REQUEST_URI]) was empty.')->debug($command);
41
+        if( empty($referer) ) {
42
+            glsr_log()->warning( 'The form referer ($_SERVER[REQUEST_URI]) was empty.' )->debug( $command );
43 43
             $referer = home_url();
44 44
         }
45 45
         return $referer;
Please login to merge, or discard this patch.
plugin/Modules/Html/Fields/Button.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -4,13 +4,13 @@
 block discarded – undo
4 4
 
5 5
 class Button extends Field
6 6
 {
7
-    /**
8
-     * @return array
9
-     */
10
-    public static function defaults()
11
-    {
12
-        return [
13
-            'class' => 'button',
14
-        ];
15
-    }
7
+	/**
8
+	 * @return array
9
+	 */
10
+	public static function defaults()
11
+	{
12
+		return [
13
+			'class' => 'button',
14
+		];
15
+	}
16 16
 }
Please login to merge, or discard this patch.