Passed
Push — master ( dd57fd...bbdbbd )
by Paul
04:15
created
views/partials/styles/twentynineteen/field.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
 <p class="glsr-field {{ class }}">
4 4
     {{ label }}
Please login to merge, or discard this patch.
views/pages/settings/licenses.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
 <table class="form-table">
4 4
     <tbody>
Please login to merge, or discard this patch.
views/pages/settings/general.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
 <table class="form-table">
4 4
     <tbody>
Please login to merge, or discard this patch.
views/pages/settings/reviews.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
 <table class="form-table">
4 4
     <tbody>
Please login to merge, or discard this patch.
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   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -9,25 +9,25 @@  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_review' => 2,
20
-        'glsr_get_reviews' => 2,
21
-        'glsr_log' => 3,
22
-        'glsr_star_rating' => 2,
23
-    );
24
-    foreach ($hooks as $function => $acceptedArgs) {
25
-        add_filter($function, function () use ($function) {
26
-            $args = func_get_args();
27
-            array_shift($args); // remove the fallback value
28
-            return call_user_func_array($function, $args);
29
-        }, 10, $acceptedArgs);
30
-    }
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_review' => 2,
20
+		'glsr_get_reviews' => 2,
21
+		'glsr_log' => 3,
22
+		'glsr_star_rating' => 2,
23
+	);
24
+	foreach ($hooks as $function => $acceptedArgs) {
25
+		add_filter($function, function () use ($function) {
26
+			$args = func_get_args();
27
+			array_shift($args); // remove the fallback value
28
+			return call_user_func_array($function, $args);
29
+		}, 10, $acceptedArgs);
30
+	}
31 31
 });
32 32
 
33 33
 /**
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function glsr($alias = null)
37 37
 {
38
-    $app = \GeminiLabs\SiteReviews\Application::load();
39
-    return !is_null($alias)
40
-        ? $app->make($alias)
41
-        : $app;
38
+	$app = \GeminiLabs\SiteReviews\Application::load();
39
+	return !is_null($alias)
40
+		? $app->make($alias)
41
+		: $app;
42 42
 }
43 43
 
44 44
 /**
@@ -48,15 +48,15 @@  discard block
 block discarded – undo
48 48
  */
49 49
 function glsr_array_column(array $array, $column)
50 50
 {
51
-    $result = array();
52
-    foreach ($array as $subarray) {
53
-        $subarray = (array) $subarray;
54
-        if (!isset($subarray[$column])) {
55
-            continue;
56
-        }
57
-        $result[] = $subarray[$column];
58
-    }
59
-    return $result;
51
+	$result = array();
52
+	foreach ($array as $subarray) {
53
+		$subarray = (array) $subarray;
54
+		if (!isset($subarray[$column])) {
55
+			continue;
56
+		}
57
+		$result[] = $subarray[$column];
58
+	}
59
+	return $result;
60 60
 }
61 61
 
62 62
 /**
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
  */
65 65
 function glsr_calculate_ratings()
66 66
 {
67
-    glsr('Database\CountsManager')->updateAll();
68
-    glsr_log()->notice(__('Recalculated rating counts.', 'site-reviews'));
67
+	glsr('Database\CountsManager')->updateAll();
68
+	glsr_log()->notice(__('Recalculated rating counts.', 'site-reviews'));
69 69
 }
70 70
 
71 71
 /**
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
  */
74 74
 function glsr_create_review($reviewValues = array())
75 75
 {
76
-    $review = new \GeminiLabs\SiteReviews\Commands\CreateReview(
77
-        \GeminiLabs\SiteReviews\Helpers\Arr::consolidateArray($reviewValues)
78
-    );
79
-    return glsr('Database\ReviewManager')->create($review);
76
+	$review = new \GeminiLabs\SiteReviews\Commands\CreateReview(
77
+		\GeminiLabs\SiteReviews\Helpers\Arr::consolidateArray($reviewValues)
78
+	);
79
+	return glsr('Database\ReviewManager')->create($review);
80 80
 }
81 81
 
82 82
 /**
@@ -84,12 +84,12 @@  discard block
 block discarded – undo
84 84
  */
85 85
 function glsr_current_screen()
86 86
 {
87
-    if (function_exists('get_current_screen')) {
88
-        $screen = get_current_screen();
89
-    }
90
-    return empty($screen)
91
-        ? (object) array_fill_keys(['base', 'id', 'post_type'], null)
92
-        : $screen;
87
+	if (function_exists('get_current_screen')) {
88
+		$screen = get_current_screen();
89
+	}
90
+	return empty($screen)
91
+		? (object) array_fill_keys(['base', 'id', 'post_type'], null)
92
+		: $screen;
93 93
 }
94 94
 
95 95
 /**
@@ -98,16 +98,16 @@  discard block
 block discarded – undo
98 98
  */
99 99
 function glsr_debug(...$vars)
100 100
 {
101
-    if (1 == count($vars)) {
102
-        $value = htmlspecialchars(print_r($vars[0], true), ENT_QUOTES, 'UTF-8');
103
-        printf('<div class="glsr-debug"><pre>%s</pre></div>', $value);
104
-    } else {
105
-        echo '<div class="glsr-debug-group">';
106
-        foreach ($vars as $var) {
107
-            glsr_debug($var);
108
-        }
109
-        echo '</div>';
110
-    }
101
+	if (1 == count($vars)) {
102
+		$value = htmlspecialchars(print_r($vars[0], true), ENT_QUOTES, 'UTF-8');
103
+		printf('<div class="glsr-debug"><pre>%s</pre></div>', $value);
104
+	} else {
105
+		echo '<div class="glsr-debug-group">';
106
+		foreach ($vars as $var) {
107
+			glsr_debug($var);
108
+		}
109
+		echo '</div>';
110
+	}
111 111
 }
112 112
 
113 113
 /**
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
  */
119 119
 function glsr_get($array, $path = '', $fallback = '')
120 120
 {
121
-    return \GeminiLabs\SiteReviews\Helpers\Arr::get($array, $path, $fallback);
121
+	return \GeminiLabs\SiteReviews\Helpers\Arr::get($array, $path, $fallback);
122 122
 }
123 123
 
124 124
 /**
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
  */
130 130
 function glsr_get_option($path = '', $fallback = '', $cast = '')
131 131
 {
132
-    return is_string($path)
133
-        ? glsr('Database\OptionManager')->get(\GeminiLabs\SiteReviews\Helpers\Str::prefix('settings.', $path), $fallback, $cast)
134
-        : $fallback;
132
+	return is_string($path)
133
+		? glsr('Database\OptionManager')->get(\GeminiLabs\SiteReviews\Helpers\Str::prefix('settings.', $path), $fallback, $cast)
134
+		: $fallback;
135 135
 }
136 136
 
137 137
 /**
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
  */
140 140
 function glsr_get_options()
141 141
 {
142
-    return glsr('Database\OptionManager')->get('settings');
142
+	return glsr('Database\OptionManager')->get('settings');
143 143
 }
144 144
 
145 145
 /**
@@ -148,13 +148,13 @@  discard block
 block discarded – undo
148 148
  */
149 149
 function glsr_get_review($post)
150 150
 {
151
-    if (is_numeric($post)) {
152
-        $post = get_post($post);
153
-    }
154
-    if (!($post instanceof WP_Post)) {
155
-        $post = new WP_Post((object) []);
156
-    }
157
-    return glsr('Database\ReviewManager')->single($post);
151
+	if (is_numeric($post)) {
152
+		$post = get_post($post);
153
+	}
154
+	if (!($post instanceof WP_Post)) {
155
+		$post = new WP_Post((object) []);
156
+	}
157
+	return glsr('Database\ReviewManager')->single($post);
158 158
 }
159 159
 
160 160
 /**
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
  */
163 163
 function glsr_get_reviews($args = array())
164 164
 {
165
-    return glsr('Database\ReviewManager')->get(\GeminiLabs\SiteReviews\Helpers\Arr::consolidateArray($args));
165
+	return glsr('Database\ReviewManager')->get(\GeminiLabs\SiteReviews\Helpers\Arr::consolidateArray($args));
166 166
 }
167 167
 
168 168
 /**
@@ -170,12 +170,12 @@  discard block
 block discarded – undo
170 170
  */
171 171
 function glsr_log()
172 172
 {
173
-    $args = func_get_args();
174
-    $console = glsr('Modules\Console');
175
-    if ($value = \GeminiLabs\SiteReviews\Helpers\Arr::get($args, '0')) {
176
-        return $console->debug($value, \GeminiLabs\SiteReviews\Helpers\Arr::get($args, '1', []));
177
-    }
178
-    return $console;
173
+	$args = func_get_args();
174
+	$console = glsr('Modules\Console');
175
+	if ($value = \GeminiLabs\SiteReviews\Helpers\Arr::get($args, '0')) {
176
+		return $console->debug($value, \GeminiLabs\SiteReviews\Helpers\Arr::get($args, '1', []));
177
+	}
178
+	return $console;
179 179
 }
180 180
 
181 181
 /**
@@ -183,5 +183,5 @@  discard block
 block discarded – undo
183 183
  */
184 184
 function glsr_star_rating($rating)
185 185
 {
186
-    return glsr('Modules\Html\Partial')->build('star-rating', ['rating' => $rating]);
186
+	return glsr('Modules\Html\Partial')->build('star-rating', ['rating' => $rating]);
187 187
 }
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 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,
@@ -21,23 +21,23 @@  discard block
 block discarded – undo
21 21
         'glsr_log' => 3,
22 22
         'glsr_star_rating' => 2,
23 23
     );
24
-    foreach ($hooks as $function => $acceptedArgs) {
25
-        add_filter($function, function () use ($function) {
24
+    foreach( $hooks as $function => $acceptedArgs ) {
25
+        add_filter( $function, function() use ($function) {
26 26
             $args = func_get_args();
27
-            array_shift($args); // remove the fallback value
28
-            return call_user_func_array($function, $args);
29
-        }, 10, $acceptedArgs);
27
+            array_shift( $args ); // remove the fallback value
28
+            return call_user_func_array( $function, $args );
29
+        }, 10, $acceptedArgs );
30 30
     }
31 31
 });
32 32
 
33 33
 /**
34 34
  * @return mixed
35 35
  */
36
-function glsr($alias = null)
36
+function glsr( $alias = null )
37 37
 {
38 38
     $app = \GeminiLabs\SiteReviews\Application::load();
39
-    return !is_null($alias)
40
-        ? $app->make($alias)
39
+    return !is_null( $alias )
40
+        ? $app->make( $alias )
41 41
         : $app;
42 42
 }
43 43
 
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
46 46
  * @param $column string
47 47
  * @return array
48 48
  */
49
-function glsr_array_column(array $array, $column)
49
+function glsr_array_column( array $array, $column )
50 50
 {
51 51
     $result = array();
52
-    foreach ($array as $subarray) {
53
-        $subarray = (array) $subarray;
54
-        if (!isset($subarray[$column])) {
52
+    foreach( $array as $subarray ) {
53
+        $subarray = (array)$subarray;
54
+        if( !isset($subarray[$column]) ) {
55 55
             continue;
56 56
         }
57 57
         $result[] = $subarray[$column];
@@ -64,19 +64,19 @@  discard block
 block discarded – undo
64 64
  */
65 65
 function glsr_calculate_ratings()
66 66
 {
67
-    glsr('Database\CountsManager')->updateAll();
68
-    glsr_log()->notice(__('Recalculated rating counts.', 'site-reviews'));
67
+    glsr( 'Database\CountsManager' )->updateAll();
68
+    glsr_log()->notice( __( 'Recalculated rating counts.', 'site-reviews' ) );
69 69
 }
70 70
 
71 71
 /**
72 72
  * @return \GeminiLabs\SiteReviews\Review|false
73 73
  */
74
-function glsr_create_review($reviewValues = array())
74
+function glsr_create_review( $reviewValues = array() )
75 75
 {
76 76
     $review = new \GeminiLabs\SiteReviews\Commands\CreateReview(
77
-        \GeminiLabs\SiteReviews\Helpers\Arr::consolidateArray($reviewValues)
77
+        \GeminiLabs\SiteReviews\Helpers\Arr::consolidateArray( $reviewValues )
78 78
     );
79
-    return glsr('Database\ReviewManager')->create($review);
79
+    return glsr( 'Database\ReviewManager' )->create( $review );
80 80
 }
81 81
 
82 82
 /**
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
  */
85 85
 function glsr_current_screen()
86 86
 {
87
-    if (function_exists('get_current_screen')) {
87
+    if( function_exists( 'get_current_screen' ) ) {
88 88
         $screen = get_current_screen();
89 89
     }
90 90
     return empty($screen)
91
-        ? (object) array_fill_keys(['base', 'id', 'post_type'], null)
91
+        ? (object)array_fill_keys( ['base', 'id', 'post_type'], null )
92 92
         : $screen;
93 93
 }
94 94
 
@@ -96,15 +96,15 @@  discard block
 block discarded – undo
96 96
  * @param mixed ...$vars
97 97
  * @return void
98 98
  */
99
-function glsr_debug(...$vars)
99
+function glsr_debug( ...$vars )
100 100
 {
101
-    if (1 == count($vars)) {
102
-        $value = htmlspecialchars(print_r($vars[0], true), ENT_QUOTES, 'UTF-8');
103
-        printf('<div class="glsr-debug"><pre>%s</pre></div>', $value);
101
+    if( 1 == count( $vars ) ) {
102
+        $value = htmlspecialchars( print_r( $vars[0], true ), ENT_QUOTES, 'UTF-8' );
103
+        printf( '<div class="glsr-debug"><pre>%s</pre></div>', $value );
104 104
     } else {
105 105
         echo '<div class="glsr-debug-group">';
106
-        foreach ($vars as $var) {
107
-            glsr_debug($var);
106
+        foreach( $vars as $var ) {
107
+            glsr_debug( $var );
108 108
         }
109 109
         echo '</div>';
110 110
     }
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
  * @param mixed $fallback
117 117
  * @return mixed
118 118
  */
119
-function glsr_get($array, $path = '', $fallback = '')
119
+function glsr_get( $array, $path = '', $fallback = '' )
120 120
 {
121
-    return \GeminiLabs\SiteReviews\Helpers\Arr::get($array, $path, $fallback);
121
+    return \GeminiLabs\SiteReviews\Helpers\Arr::get( $array, $path, $fallback );
122 122
 }
123 123
 
124 124
 /**
@@ -127,10 +127,10 @@  discard block
 block discarded – undo
127 127
  * @param string $cast
128 128
  * @return string|array
129 129
  */
130
-function glsr_get_option($path = '', $fallback = '', $cast = '')
130
+function glsr_get_option( $path = '', $fallback = '', $cast = '' )
131 131
 {
132
-    return is_string($path)
133
-        ? glsr('Database\OptionManager')->get(\GeminiLabs\SiteReviews\Helpers\Str::prefix('settings.', $path), $fallback, $cast)
132
+    return is_string( $path )
133
+        ? glsr( 'Database\OptionManager' )->get( \GeminiLabs\SiteReviews\Helpers\Str::prefix( 'settings.', $path ), $fallback, $cast )
134 134
         : $fallback;
135 135
 }
136 136
 
@@ -139,30 +139,30 @@  discard block
 block discarded – undo
139 139
  */
140 140
 function glsr_get_options()
141 141
 {
142
-    return glsr('Database\OptionManager')->get('settings');
142
+    return glsr( 'Database\OptionManager' )->get( 'settings' );
143 143
 }
144 144
 
145 145
 /**
146 146
  * @param \WP_Post|int $post
147 147
  * @return \GeminiLabs\SiteReviews\Review
148 148
  */
149
-function glsr_get_review($post)
149
+function glsr_get_review( $post )
150 150
 {
151
-    if (is_numeric($post)) {
152
-        $post = get_post($post);
151
+    if( is_numeric( $post ) ) {
152
+        $post = get_post( $post );
153 153
     }
154
-    if (!($post instanceof WP_Post)) {
155
-        $post = new WP_Post((object) []);
154
+    if( !($post instanceof WP_Post) ) {
155
+        $post = new WP_Post( (object)[] );
156 156
     }
157
-    return glsr('Database\ReviewManager')->single($post);
157
+    return glsr( 'Database\ReviewManager' )->single( $post );
158 158
 }
159 159
 
160 160
 /**
161 161
  * @return array
162 162
  */
163
-function glsr_get_reviews($args = array())
163
+function glsr_get_reviews( $args = array() )
164 164
 {
165
-    return glsr('Database\ReviewManager')->get(\GeminiLabs\SiteReviews\Helpers\Arr::consolidateArray($args));
165
+    return glsr( 'Database\ReviewManager' )->get( \GeminiLabs\SiteReviews\Helpers\Arr::consolidateArray( $args ) );
166 166
 }
167 167
 
168 168
 /**
@@ -171,9 +171,9 @@  discard block
 block discarded – undo
171 171
 function glsr_log()
172 172
 {
173 173
     $args = func_get_args();
174
-    $console = glsr('Modules\Console');
175
-    if ($value = \GeminiLabs\SiteReviews\Helpers\Arr::get($args, '0')) {
176
-        return $console->debug($value, \GeminiLabs\SiteReviews\Helpers\Arr::get($args, '1', []));
174
+    $console = glsr( 'Modules\Console' );
175
+    if( $value = \GeminiLabs\SiteReviews\Helpers\Arr::get( $args, '0' ) ) {
176
+        return $console->debug( $value, \GeminiLabs\SiteReviews\Helpers\Arr::get( $args, '1', [] ) );
177 177
     }
178 178
     return $console;
179 179
 }
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 /**
182 182
  * @return string
183 183
  */
184
-function glsr_star_rating($rating)
184
+function glsr_star_rating( $rating )
185 185
 {
186
-    return glsr('Modules\Html\Partial')->build('star-rating', ['rating' => $rating]);
186
+    return glsr( 'Modules\Html\Partial' )->build( 'star-rating', ['rating' => $rating] );
187 187
 }
Please login to merge, or discard this patch.