Passed
Push — master ( 7de9ff...9a7a6b )
by Paul
07:10 queued 03:33
created
helpers.php 1 patch
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -4,7 +4,8 @@  discard block
 block discarded – undo
4 4
 /**
5 5
  * @return mixed
6 6
  */
7
-function glsr( $alias = null ) {
7
+function glsr( $alias = null )
8
+{
8 9
 	$app = \GeminiLabs\SiteReviews\Application::load();
9 10
 	return !empty( $alias )
10 11
 		? $app->make( $alias )
@@ -14,7 +15,8 @@  discard block
 block discarded – undo
14 15
 /**
15 16
  * @return false|\GeminiLabs\SiteReviews\Review
16 17
  */
17
-function glsr_create_review( array $reviewValues = [] ) {
18
+function glsr_create_review( array $reviewValues = [] )
19
+{
18 20
 	if( empty( $reviewValues )) {
19 21
 		return false;
20 22
 	}
@@ -25,7 +27,8 @@  discard block
 block discarded – undo
25 27
 /**
26 28
  * @return \WP_Screen|object
27 29
  */
28
-function glsr_current_screen() {
30
+function glsr_current_screen()
31
+{
29 32
 	if( function_exists( 'get_current_screen' )) {
30 33
 		$screen = get_current_screen();
31 34
 	}
@@ -38,7 +41,8 @@  discard block
 block discarded – undo
38 41
  * @param mixed ...$vars
39 42
  * @return void
40 43
  */
41
-function glsr_debug( ...$vars ) {
44
+function glsr_debug( ...$vars )
45
+{
42 46
 	if( count( $vars ) == 1 ) {
43 47
 		$value = htmlspecialchars( print_r( $vars[0], true ), ENT_QUOTES, 'UTF-8' );
44 48
 		printf( '<div class="glsr-debug"><pre>%s</pre></div>', $value );
@@ -57,14 +61,16 @@  discard block
 block discarded – undo
57 61
  * @param mixed $fallback
58 62
  * @return string|array
59 63
  */
60
-function glsr_get_option( $path = '', $fallback = '' ) {
64
+function glsr_get_option( $path = '', $fallback = '' )
65
+{
61 66
 	return glsr( 'Database\OptionManager' )->get( 'settings.'.$path, $fallback );
62 67
 }
63 68
 
64 69
 /**
65 70
  * @return array
66 71
  */
67
-function glsr_get_options() {
72
+function glsr_get_options()
73
+{
68 74
 	return glsr( 'Database\OptionManager' )->get( 'settings' );
69 75
 }
70 76
 
@@ -72,7 +78,8 @@  discard block
 block discarded – undo
72 78
  * @param int $post_id
73 79
  * @return void|\GeminiLabs\SiteReviews\Review
74 80
  */
75
-function glsr_get_review( $post_id ) {
81
+function glsr_get_review( $post_id )
82
+{
76 83
 	$post = get_post( $post_id );
77 84
 	if( $post instanceof WP_Post ) {
78 85
 		return glsr( 'Database\ReviewManager' )->single( $post );
@@ -83,14 +90,16 @@  discard block
 block discarded – undo
83 90
  * @return array
84 91
  * @todo document change of $reviews->reviews to $reviews->results
85 92
  */
86
-function glsr_get_reviews( array $args = array() ) {
93
+function glsr_get_reviews( array $args = array() )
94
+{
87 95
 	return glsr( 'Database\ReviewManager' )->get( $args );
88 96
 }
89 97
 
90 98
 /**
91 99
  * @return \GeminiLabs\SiteReviews\Modules\Console
92 100
  */
93
-function glsr_log() {
101
+function glsr_log()
102
+{
94 103
 	$args = func_get_args();
95 104
 	$context = isset( $args[1] )
96 105
 		? $args[1]
Please login to merge, or discard this patch.
plugin/Modules/Upgrader.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@  discard block
 block discarded – undo
16 16
 		$filenames = [];
17 17
 		$iterator = new DirectoryIterator( dirname( __FILE__ ).'/Upgrader' );
18 18
 		foreach( $iterator as $fileinfo ) {
19
-			if( !$fileinfo->isFile() )continue;
19
+			if( !$fileinfo->isFile() ) {
20
+				continue;
21
+			}
20 22
 			$filenames[] = $fileinfo->getFilename();
21 23
 		}
22 24
 		natsort( $filenames );
@@ -24,7 +26,9 @@  discard block
 block discarded – undo
24 26
 			$className = str_replace( '.php', '', $file );
25 27
 			$version = str_replace( ['Upgrade_', '_'], ['', '.'], $className );
26 28
 			$versionSuffix = preg_replace( '/[\d.]+(.+)?/', '${1}', glsr()->version ); // allow alpha/beta versions
27
-			if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' ))return;
29
+			if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' )) {
30
+				return;
31
+			}
28 32
 			glsr( 'Modules\\Upgrader\\'.$className );
29 33
 			glsr_log()->info( 'Completed Upgrade for v'.$version.$versionSuffix );
30 34
 		});
@@ -45,7 +49,9 @@  discard block
 block discarded – undo
45 49
 	 */
46 50
 	public function setReviewCounts()
47 51
 	{
48
-		if( !empty( glsr( OptionManager::class )->get( 'last_review_count' )))return;
52
+		if( !empty( glsr( OptionManager::class )->get( 'last_review_count' ))) {
53
+			return;
54
+		}
49 55
 		add_action( 'admin_init', function() {
50 56
 			glsr( AdminController::class )->routerCountReviews( false );
51 57
 			glsr_log()->info( __( 'Calculated rating counts.', 'site-reviews' ));
Please login to merge, or discard this patch.
plugin/Controllers/ReviewController.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,7 +25,9 @@  discard block
 block discarded – undo
25 25
 	{
26 26
 		sort( $termIds );
27 27
 		sort( $oldTermIds );
28
-		if( $termIds === $oldTermIds || !$this->isReviewPostId( $postId ))return;
28
+		if( $termIds === $oldTermIds || !$this->isReviewPostId( $postId )) {
29
+			return;
30
+		}
29 31
 		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
30 32
 		$ignoredTerms = array_intersect( $oldTermIds, $termIds );
31 33
 		if( $review->term_ids = array_diff( $oldTermIds, $ignoredTerms )) {
@@ -52,7 +54,9 @@  discard block
 block discarded – undo
52 54
 	 */
53 55
 	public function onBeforeDelete( $postId )
54 56
 	{
55
-		if( !$this->isReviewPostId( $postId ))return;
57
+		if( !$this->isReviewPostId( $postId )) {
58
+			return;
59
+		}
56 60
 		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
57 61
 		glsr( CountsManager::class )->decrease( $review );
58 62
 	}
@@ -69,9 +73,13 @@  discard block
 block discarded – undo
69 73
 	{
70 74
 		if( !$this->isReviewPostId( $postId )
71 75
 			|| !in_array( $metaKey, ['assigned_to', 'rating', 'review_type'] )
72
-		)return;
76
+		) {
77
+			return;
78
+		}
73 79
 		$review = glsr( ReviewManager::class )->single( get_post( $postId ));
74
-		if( $review->$metaKey == $metaValue )return;
80
+		if( $review->$metaKey == $metaValue ) {
81
+			return;
82
+		}
75 83
 		$method = glsr( Helper::class )->buildMethodName( $metaKey, 'onBeforeChange' );
76 84
 		call_user_func( [$this, $method], $review, $metaValue );
77 85
 	}
@@ -117,7 +125,9 @@  discard block
 block discarded – undo
117 125
 	 */
118 126
 	public function onChangeStatus( $newStatus, $oldStatus, WP_Post $post )
119 127
 	{
120
-		if( $post->post_type != Application::POST_TYPE || in_array( $oldStatus, ['new', $newStatus] ))return;
128
+		if( $post->post_type != Application::POST_TYPE || in_array( $oldStatus, ['new', $newStatus] )) {
129
+			return;
130
+		}
121 131
 		$review = glsr( ReviewManager::class )->single( get_post( $post->ID ));
122 132
 		if( $post->post_status == 'publish' ) {
123 133
 			glsr( CountsManager::class )->increase( $review );
Please login to merge, or discard this patch.
plugin/Controllers/AdminController.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -108,12 +108,16 @@
 block discarded – undo
108 108
 	public function renderTinymceButton( $editorId )
109 109
 	{
110 110
 		$allowedEditors = apply_filters( 'site-reviews/tinymce/editor-ids', ['content'] );
111
-		if( glsr_current_screen()->base != 'post' || !in_array( $editorId, $allowedEditors ))return;
111
+		if( glsr_current_screen()->base != 'post' || !in_array( $editorId, $allowedEditors )) {
112
+			return;
113
+		}
112 114
 		$shortcodes = [];
113 115
 		foreach( glsr()->mceShortcodes as $shortcode => $values ) {
114 116
 			$shortcodes[$shortcode] = $values;
115 117
 		}
116
-		if( empty( $shortcodes ))return;
118
+		if( empty( $shortcodes )) {
119
+			return;
120
+		}
117 121
 		glsr()->render( 'partials/editor/tinymce', [
118 122
 			'shortcodes' => $shortcodes,
119 123
 		]);
Please login to merge, or discard this patch.