Passed
Push — master ( ccb079...7906b4 )
by Paul
04:39
created
plugin/Modules/Multilingual.php 2 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -14,52 +14,52 @@
 block discarded – undo
14 14
  */
15 15
 class Multilingual
16 16
 {
17
-    protected $integration;
17
+	protected $integration;
18 18
 
19
-    /**
20
-     * @param string $method
21
-     * @param array $args
22
-     * @return 
23
-     */
24
-    public function __call($method, $args = [])
25
-    {
26
-        if ($this->isIntegrated() && method_exists($this->integration, $method)) {
27
-            return call_user_func_array([$this->integration, $method], $args);
28
-        }
29
-        return Arr::get($args, 0, false);
30
-    }
19
+	/**
20
+	 * @param string $method
21
+	 * @param array $args
22
+	 * @return 
23
+	 */
24
+	public function __call($method, $args = [])
25
+	{
26
+		if ($this->isIntegrated() && method_exists($this->integration, $method)) {
27
+			return call_user_func_array([$this->integration, $method], $args);
28
+		}
29
+		return Arr::get($args, 0, false);
30
+	}
31 31
 
32
-    /**
33
-     * @param string $integration
34
-     * @return false|\GeminiLabs\SiteReviews\Modules\Multilingual\Polylang|\GeminiLabs\SiteReviews\Modules\Multilingual\Wpml
35
-     */
36
-    public function getIntegration($integration = '')
37
-    {
38
-        if (empty($integration)) {
39
-            $integration = glsr(OptionManager::class)->get('settings.general.multilingual');
40
-        }
41
-        if (!empty($integration)) {
42
-            $integrationClass = 'GeminiLabs\SiteReviews\Modules\Multilingual\\'.ucfirst($integration);
43
-            if (class_exists($integrationClass)) {
44
-                return glsr($integrationClass);
45
-            }
46
-            glsr_log()->error($integrationClass.' does not exist');
47
-        }
48
-        return false;
49
-    }
32
+	/**
33
+	 * @param string $integration
34
+	 * @return false|\GeminiLabs\SiteReviews\Modules\Multilingual\Polylang|\GeminiLabs\SiteReviews\Modules\Multilingual\Wpml
35
+	 */
36
+	public function getIntegration($integration = '')
37
+	{
38
+		if (empty($integration)) {
39
+			$integration = glsr(OptionManager::class)->get('settings.general.multilingual');
40
+		}
41
+		if (!empty($integration)) {
42
+			$integrationClass = 'GeminiLabs\SiteReviews\Modules\Multilingual\\'.ucfirst($integration);
43
+			if (class_exists($integrationClass)) {
44
+				return glsr($integrationClass);
45
+			}
46
+			glsr_log()->error($integrationClass.' does not exist');
47
+		}
48
+		return false;
49
+	}
50 50
 
51
-    /**
52
-     * return bool
53
-     */
54
-    public function isIntegrated()
55
-    {
56
-        if (!empty($this->integration)) {
57
-            return true;
58
-        }
59
-        if ($integration = $this->getIntegration()) {
60
-            $this->integration = $integration;
61
-            return true;
62
-        }
63
-        return false;
64
-    }
51
+	/**
52
+	 * return bool
53
+	 */
54
+	public function isIntegrated()
55
+	{
56
+		if (!empty($this->integration)) {
57
+			return true;
58
+		}
59
+		if ($integration = $this->getIntegration()) {
60
+			$this->integration = $integration;
61
+			return true;
62
+		}
63
+		return false;
64
+	}
65 65
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -21,29 +21,29 @@  discard block
 block discarded – undo
21 21
      * @param array $args
22 22
      * @return 
23 23
      */
24
-    public function __call($method, $args = [])
24
+    public function __call( $method, $args = [] )
25 25
     {
26
-        if ($this->isIntegrated() && method_exists($this->integration, $method)) {
27
-            return call_user_func_array([$this->integration, $method], $args);
26
+        if( $this->isIntegrated() && method_exists( $this->integration, $method ) ) {
27
+            return call_user_func_array( [$this->integration, $method], $args );
28 28
         }
29
-        return Arr::get($args, 0, false);
29
+        return Arr::get( $args, 0, false );
30 30
     }
31 31
 
32 32
     /**
33 33
      * @param string $integration
34 34
      * @return false|\GeminiLabs\SiteReviews\Modules\Multilingual\Polylang|\GeminiLabs\SiteReviews\Modules\Multilingual\Wpml
35 35
      */
36
-    public function getIntegration($integration = '')
36
+    public function getIntegration( $integration = '' )
37 37
     {
38
-        if (empty($integration)) {
39
-            $integration = glsr(OptionManager::class)->get('settings.general.multilingual');
38
+        if( empty($integration) ) {
39
+            $integration = glsr( OptionManager::class )->get( 'settings.general.multilingual' );
40 40
         }
41
-        if (!empty($integration)) {
42
-            $integrationClass = 'GeminiLabs\SiteReviews\Modules\Multilingual\\'.ucfirst($integration);
43
-            if (class_exists($integrationClass)) {
44
-                return glsr($integrationClass);
41
+        if( !empty($integration) ) {
42
+            $integrationClass = 'GeminiLabs\SiteReviews\Modules\Multilingual\\'.ucfirst( $integration );
43
+            if( class_exists( $integrationClass ) ) {
44
+                return glsr( $integrationClass );
45 45
             }
46
-            glsr_log()->error($integrationClass.' does not exist');
46
+            glsr_log()->error( $integrationClass.' does not exist' );
47 47
         }
48 48
         return false;
49 49
     }
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public function isIntegrated()
55 55
     {
56
-        if (!empty($this->integration)) {
56
+        if( !empty($this->integration) ) {
57 57
             return true;
58 58
         }
59
-        if ($integration = $this->getIntegration()) {
59
+        if( $integration = $this->getIntegration() ) {
60 60
             $this->integration = $integration;
61 61
             return true;
62 62
         }
Please login to merge, or discard this patch.
views/pages/settings/translations.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3
-<p><?= sprintf(__('Here you can customise any text of the plugin, including the submission form labels and placeholders. However, if you have a multilingual website you should use the %s plugin instead.', 'site-reviews'), '<a href="https://wordpress.org/plugins/loco-translate/">Loco Translate</a>'); ?></p>
3
+<p><?= sprintf( __( 'Here you can customise any text of the plugin, including the submission form labels and placeholders. However, if you have a multilingual website you should use the %s plugin instead.', 'site-reviews' ), '<a href="https://wordpress.org/plugins/loco-translate/">Loco Translate</a>' ); ?></p>
4 4
 
5 5
 <div class="glsr-strings-form">
6 6
     <div class="glsr-search-box" id="glsr-search-translations">
7
-        <span class="screen-reader-text"><?= __('Search for translatable text', 'site-reviews'); ?></span>
7
+        <span class="screen-reader-text"><?= __( 'Search for translatable text', 'site-reviews' ); ?></span>
8 8
         <div class="glsr-spinner">
9 9
             <span class="spinner"></span>
10 10
         </div>
11
-        <input type="search" class="glsr-search-input" autocomplete="off" placeholder="<?= __('Search here for text to translate...', 'site-reviews'); ?>">
12
-        <?php wp_nonce_field('search-translations', '_search_nonce', false); ?>
11
+        <input type="search" class="glsr-search-input" autocomplete="off" placeholder="<?= __( 'Search here for text to translate...', 'site-reviews' ); ?>">
12
+        <?php wp_nonce_field( 'search-translations', '_search_nonce', false ); ?>
13 13
         <div class="glsr-search-results" data-prefix="{{ database_key }}"></div>
14 14
     </div>
15 15
     <table class="glsr-strings-table wp-list-table widefat striped {{ class }}">
16 16
         <thead>
17 17
             <tr>
18
-                <th scope="col" class="manage-column column-primary"><?= __('Original Text', 'site-reviews'); ?></th>
19
-                <th scope="col" class="manage-column"><?= __('Custom Translation', 'site-reviews'); ?></th>
18
+                <th scope="col" class="manage-column column-primary"><?= __( 'Original Text', 'site-reviews' ); ?></th>
19
+                <th scope="col" class="manage-column"><?= __( 'Custom Translation', 'site-reviews' ); ?></th>
20 20
             </tr>
21 21
         </thead>
22 22
         <tbody>{{ translations }}</tbody>
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 </div>
26 26
 
27 27
 <script type="text/html" id="tmpl-glsr-string-plural">
28
-<?php include glsr()->path('views/partials/translations/plural.php'); ?>
28
+<?php include glsr()->path( 'views/partials/translations/plural.php' ); ?>
29 29
 </script>
30 30
 <script type="text/html" id="tmpl-glsr-string-single">
31
-<?php include glsr()->path('views/partials/translations/single.php'); ?>
31
+<?php include glsr()->path( 'views/partials/translations/single.php' ); ?>
32 32
 </script>
Please login to merge, or discard this patch.
plugin/Modules/ReviewLimits.php 2 patches
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -8,105 +8,105 @@
 block discarded – undo
8 8
 
9 9
 class ReviewLimits
10 10
 {
11
-    protected $request;
11
+	protected $request;
12 12
 
13
-    /**
14
-     * @return array
15
-     * @filter site-reviews/get/reviews/query
16
-     */
17
-    public function filterReviewsQuery(array $parameters, array $args)
18
-    {
19
-        if ($authorId = get_current_user_id()) {
20
-            $parameters['author'] = $authorId;
21
-        }
22
-        $parameters['post_status'] = ['pending', 'publish'];
23
-        return apply_filters('site-reviews/review-limits/query', $parameters, $args);
24
-    }
13
+	/**
14
+	 * @return array
15
+	 * @filter site-reviews/get/reviews/query
16
+	 */
17
+	public function filterReviewsQuery(array $parameters, array $args)
18
+	{
19
+		if ($authorId = get_current_user_id()) {
20
+			$parameters['author'] = $authorId;
21
+		}
22
+		$parameters['post_status'] = ['pending', 'publish'];
23
+		return apply_filters('site-reviews/review-limits/query', $parameters, $args);
24
+	}
25 25
 
26
-    /**
27
-     * @return bool
28
-     */
29
-    public function hasReachedLimit(array $request = [])
30
-    {
31
-        $this->request = $request;
32
-        $method = Helper::buildMethodName(
33
-            glsr(OptionManager::class)->get('settings.submissions.limit'), 'validateBy'
34
-        );
35
-        return method_exists($this, $method)
36
-            ? !call_user_func([$this, $method])
37
-            : false;
38
-    }
26
+	/**
27
+	 * @return bool
28
+	 */
29
+	public function hasReachedLimit(array $request = [])
30
+	{
31
+		$this->request = $request;
32
+		$method = Helper::buildMethodName(
33
+			glsr(OptionManager::class)->get('settings.submissions.limit'), 'validateBy'
34
+		);
35
+		return method_exists($this, $method)
36
+			? !call_user_func([$this, $method])
37
+			: false;
38
+	}
39 39
 
40
-    /**
41
-     * @param string $value
42
-     * @param string $whitelist
43
-     * @return bool
44
-     */
45
-    public function isWhitelisted($value, $whitelist)
46
-    {
47
-        if (empty($whitelist)) {
48
-            return false;
49
-        }
50
-        return in_array($value, array_filter(explode("\n", $whitelist), 'trim'));
51
-    }
40
+	/**
41
+	 * @param string $value
42
+	 * @param string $whitelist
43
+	 * @return bool
44
+	 */
45
+	public function isWhitelisted($value, $whitelist)
46
+	{
47
+		if (empty($whitelist)) {
48
+			return false;
49
+		}
50
+		return in_array($value, array_filter(explode("\n", $whitelist), 'trim'));
51
+	}
52 52
 
53
-    /**
54
-     * @param string $whitelistName
55
-     * @return string
56
-     */
57
-    protected function getWhitelist($whitelistName)
58
-    {
59
-        return glsr(OptionManager::class)->get('settings.submissions.limit_whitelist.'.$whitelistName);
60
-    }
53
+	/**
54
+	 * @param string $whitelistName
55
+	 * @return string
56
+	 */
57
+	protected function getWhitelist($whitelistName)
58
+	{
59
+		return glsr(OptionManager::class)->get('settings.submissions.limit_whitelist.'.$whitelistName);
60
+	}
61 61
 
62
-    /**
63
-     * @return bool
64
-     */
65
-    protected function validate($key, $value, $addMetaQuery = true)
66
-    {
67
-        if ($this->isWhitelisted($value, $this->getWhitelist($key))) {
68
-            return true;
69
-        }
70
-        add_filter('site-reviews/get/reviews/query', [$this, 'filterReviewsQuery'], 5, 2);
71
-        $args = ['assigned_to' => Arr::get($this->request, 'assign_to')];
72
-        if ($addMetaQuery) {
73
-            $args[$key] = $value;
74
-        }
75
-        $reviews = glsr_get_reviews($args);
76
-        remove_filter('site-reviews/get/reviews/query', [$this, 'filterReviewsQuery'], 5);
77
-        $result = 0 === count($reviews);
78
-        $result = apply_filters('site-reviews/review-limits/validate', $result, $reviews, $this->request, $key);
79
-        return wp_validate_boolean($result);
80
-    }
62
+	/**
63
+	 * @return bool
64
+	 */
65
+	protected function validate($key, $value, $addMetaQuery = true)
66
+	{
67
+		if ($this->isWhitelisted($value, $this->getWhitelist($key))) {
68
+			return true;
69
+		}
70
+		add_filter('site-reviews/get/reviews/query', [$this, 'filterReviewsQuery'], 5, 2);
71
+		$args = ['assigned_to' => Arr::get($this->request, 'assign_to')];
72
+		if ($addMetaQuery) {
73
+			$args[$key] = $value;
74
+		}
75
+		$reviews = glsr_get_reviews($args);
76
+		remove_filter('site-reviews/get/reviews/query', [$this, 'filterReviewsQuery'], 5);
77
+		$result = 0 === count($reviews);
78
+		$result = apply_filters('site-reviews/review-limits/validate', $result, $reviews, $this->request, $key);
79
+		return wp_validate_boolean($result);
80
+	}
81 81
 
82
-    /**
83
-     * @return bool
84
-     */
85
-    protected function validateByEmail()
86
-    {
87
-        glsr_log()->debug('Email is: '.Arr::get($this->request, 'email'));
88
-        return $this->validate('email', Arr::get($this->request, 'email'));
89
-    }
82
+	/**
83
+	 * @return bool
84
+	 */
85
+	protected function validateByEmail()
86
+	{
87
+		glsr_log()->debug('Email is: '.Arr::get($this->request, 'email'));
88
+		return $this->validate('email', Arr::get($this->request, 'email'));
89
+	}
90 90
 
91
-    /**
92
-     * @return bool
93
-     */
94
-    protected function validateByIpAddress()
95
-    {
96
-        glsr_log()->debug('IP Address is: '.Arr::get($this->request, 'ip_address'));
97
-        return $this->validate('ip_address', Arr::get($this->request, 'ip_address'));
98
-    }
91
+	/**
92
+	 * @return bool
93
+	 */
94
+	protected function validateByIpAddress()
95
+	{
96
+		glsr_log()->debug('IP Address is: '.Arr::get($this->request, 'ip_address'));
97
+		return $this->validate('ip_address', Arr::get($this->request, 'ip_address'));
98
+	}
99 99
 
100
-    /**
101
-     * @return bool
102
-     */
103
-    protected function validateByUsername()
104
-    {
105
-        $user = wp_get_current_user();
106
-        if (!$user->exists()) {
107
-            return true;
108
-        }
109
-        glsr_log()->debug('Username is: '.$user->user_login);
110
-        return $this->validate('username', $user->user_login, false);
111
-    }
100
+	/**
101
+	 * @return bool
102
+	 */
103
+	protected function validateByUsername()
104
+	{
105
+		$user = wp_get_current_user();
106
+		if (!$user->exists()) {
107
+			return true;
108
+		}
109
+		glsr_log()->debug('Username is: '.$user->user_login);
110
+		return $this->validate('username', $user->user_login, false);
111
+	}
112 112
 }
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -14,26 +14,26 @@  discard block
 block discarded – undo
14 14
      * @return array
15 15
      * @filter site-reviews/get/reviews/query
16 16
      */
17
-    public function filterReviewsQuery(array $parameters, array $args)
17
+    public function filterReviewsQuery( array $parameters, array $args )
18 18
     {
19
-        if ($authorId = get_current_user_id()) {
19
+        if( $authorId = get_current_user_id() ) {
20 20
             $parameters['author'] = $authorId;
21 21
         }
22 22
         $parameters['post_status'] = ['pending', 'publish'];
23
-        return apply_filters('site-reviews/review-limits/query', $parameters, $args);
23
+        return apply_filters( 'site-reviews/review-limits/query', $parameters, $args );
24 24
     }
25 25
 
26 26
     /**
27 27
      * @return bool
28 28
      */
29
-    public function hasReachedLimit(array $request = [])
29
+    public function hasReachedLimit( array $request = [] )
30 30
     {
31 31
         $this->request = $request;
32 32
         $method = Helper::buildMethodName(
33
-            glsr(OptionManager::class)->get('settings.submissions.limit'), 'validateBy'
33
+            glsr( OptionManager::class )->get( 'settings.submissions.limit' ), 'validateBy'
34 34
         );
35
-        return method_exists($this, $method)
36
-            ? !call_user_func([$this, $method])
35
+        return method_exists( $this, $method )
36
+            ? !call_user_func( [$this, $method] )
37 37
             : false;
38 38
     }
39 39
 
@@ -42,41 +42,41 @@  discard block
 block discarded – undo
42 42
      * @param string $whitelist
43 43
      * @return bool
44 44
      */
45
-    public function isWhitelisted($value, $whitelist)
45
+    public function isWhitelisted( $value, $whitelist )
46 46
     {
47
-        if (empty($whitelist)) {
47
+        if( empty($whitelist) ) {
48 48
             return false;
49 49
         }
50
-        return in_array($value, array_filter(explode("\n", $whitelist), 'trim'));
50
+        return in_array( $value, array_filter( explode( "\n", $whitelist ), 'trim' ) );
51 51
     }
52 52
 
53 53
     /**
54 54
      * @param string $whitelistName
55 55
      * @return string
56 56
      */
57
-    protected function getWhitelist($whitelistName)
57
+    protected function getWhitelist( $whitelistName )
58 58
     {
59
-        return glsr(OptionManager::class)->get('settings.submissions.limit_whitelist.'.$whitelistName);
59
+        return glsr( OptionManager::class )->get( 'settings.submissions.limit_whitelist.'.$whitelistName );
60 60
     }
61 61
 
62 62
     /**
63 63
      * @return bool
64 64
      */
65
-    protected function validate($key, $value, $addMetaQuery = true)
65
+    protected function validate( $key, $value, $addMetaQuery = true )
66 66
     {
67
-        if ($this->isWhitelisted($value, $this->getWhitelist($key))) {
67
+        if( $this->isWhitelisted( $value, $this->getWhitelist( $key ) ) ) {
68 68
             return true;
69 69
         }
70
-        add_filter('site-reviews/get/reviews/query', [$this, 'filterReviewsQuery'], 5, 2);
71
-        $args = ['assigned_to' => Arr::get($this->request, 'assign_to')];
72
-        if ($addMetaQuery) {
70
+        add_filter( 'site-reviews/get/reviews/query', [$this, 'filterReviewsQuery'], 5, 2 );
71
+        $args = ['assigned_to' => Arr::get( $this->request, 'assign_to' )];
72
+        if( $addMetaQuery ) {
73 73
             $args[$key] = $value;
74 74
         }
75
-        $reviews = glsr_get_reviews($args);
76
-        remove_filter('site-reviews/get/reviews/query', [$this, 'filterReviewsQuery'], 5);
77
-        $result = 0 === count($reviews);
78
-        $result = apply_filters('site-reviews/review-limits/validate', $result, $reviews, $this->request, $key);
79
-        return wp_validate_boolean($result);
75
+        $reviews = glsr_get_reviews( $args );
76
+        remove_filter( 'site-reviews/get/reviews/query', [$this, 'filterReviewsQuery'], 5 );
77
+        $result = 0 === count( $reviews );
78
+        $result = apply_filters( 'site-reviews/review-limits/validate', $result, $reviews, $this->request, $key );
79
+        return wp_validate_boolean( $result );
80 80
     }
81 81
 
82 82
     /**
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
      */
85 85
     protected function validateByEmail()
86 86
     {
87
-        glsr_log()->debug('Email is: '.Arr::get($this->request, 'email'));
88
-        return $this->validate('email', Arr::get($this->request, 'email'));
87
+        glsr_log()->debug( 'Email is: '.Arr::get( $this->request, 'email' ) );
88
+        return $this->validate( 'email', Arr::get( $this->request, 'email' ) );
89 89
     }
90 90
 
91 91
     /**
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
      */
94 94
     protected function validateByIpAddress()
95 95
     {
96
-        glsr_log()->debug('IP Address is: '.Arr::get($this->request, 'ip_address'));
97
-        return $this->validate('ip_address', Arr::get($this->request, 'ip_address'));
96
+        glsr_log()->debug( 'IP Address is: '.Arr::get( $this->request, 'ip_address' ) );
97
+        return $this->validate( 'ip_address', Arr::get( $this->request, 'ip_address' ) );
98 98
     }
99 99
 
100 100
     /**
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
     protected function validateByUsername()
104 104
     {
105 105
         $user = wp_get_current_user();
106
-        if (!$user->exists()) {
106
+        if( !$user->exists() ) {
107 107
             return true;
108 108
         }
109
-        glsr_log()->debug('Username is: '.$user->user_login);
110
-        return $this->validate('username', $user->user_login, false);
109
+        glsr_log()->debug( 'Username is: '.$user->user_login );
110
+        return $this->validate( 'username', $user->user_login, false );
111 111
     }
112 112
 }
Please login to merge, or discard this patch.
plugin/Modules/Validator/ValidationRules.php 2 patches
Indentation   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -10,126 +10,126 @@
 block discarded – undo
10 10
  */
11 11
 trait ValidationRules
12 12
 {
13
-    /**
14
-     * Get the size of an attribute.
15
-     * @param string $attribute
16
-     * @param mixed $value
17
-     * @return mixed
18
-     */
19
-    abstract protected function getSize($attribute, $value);
13
+	/**
14
+	 * Get the size of an attribute.
15
+	 * @param string $attribute
16
+	 * @param mixed $value
17
+	 * @return mixed
18
+	 */
19
+	abstract protected function getSize($attribute, $value);
20 20
 
21
-    /**
22
-     * Replace all placeholders.
23
-     * @param string $message
24
-     * @return string
25
-     */
26
-    protected function replace($message, array $parameters)
27
-    {
28
-        if (!Str::contains($message, '%s')) {
29
-            return $message;
30
-        }
31
-        return preg_replace_callback('/(%s)/', function () use (&$parameters) {
32
-            foreach ($parameters as $key => $value) {
33
-                return array_shift($parameters);
34
-            }
35
-        }, $message);
36
-    }
21
+	/**
22
+	 * Replace all placeholders.
23
+	 * @param string $message
24
+	 * @return string
25
+	 */
26
+	protected function replace($message, array $parameters)
27
+	{
28
+		if (!Str::contains($message, '%s')) {
29
+			return $message;
30
+		}
31
+		return preg_replace_callback('/(%s)/', function () use (&$parameters) {
32
+			foreach ($parameters as $key => $value) {
33
+				return array_shift($parameters);
34
+			}
35
+		}, $message);
36
+	}
37 37
 
38
-    /**
39
-     * Validate that an attribute was "accepted".
40
-     * This validation rule implies the attribute is "required".
41
-     * @param string $attribute
42
-     * @param mixed $value
43
-     * @return bool
44
-     */
45
-    public function validateAccepted($value)
46
-    {
47
-        $acceptable = ['yes', 'on', '1', 1, true, 'true'];
48
-        return $this->validateRequired($value) && in_array($value, $acceptable, true);
49
-    }
38
+	/**
39
+	 * Validate that an attribute was "accepted".
40
+	 * This validation rule implies the attribute is "required".
41
+	 * @param string $attribute
42
+	 * @param mixed $value
43
+	 * @return bool
44
+	 */
45
+	public function validateAccepted($value)
46
+	{
47
+		$acceptable = ['yes', 'on', '1', 1, true, 'true'];
48
+		return $this->validateRequired($value) && in_array($value, $acceptable, true);
49
+	}
50 50
 
51
-    /**
52
-     * Validate the size of an attribute is between a set of values.
53
-     * @param string $attribute
54
-     * @param mixed $value
55
-     * @return bool
56
-     */
57
-    public function validateBetween($value, $attribute, array $parameters)
58
-    {
59
-        $this->requireParameterCount(2, $parameters, 'between');
60
-        $size = $this->getSize($attribute, $value);
61
-        return $size >= $parameters[0] && $size <= $parameters[1];
62
-    }
51
+	/**
52
+	 * Validate the size of an attribute is between a set of values.
53
+	 * @param string $attribute
54
+	 * @param mixed $value
55
+	 * @return bool
56
+	 */
57
+	public function validateBetween($value, $attribute, array $parameters)
58
+	{
59
+		$this->requireParameterCount(2, $parameters, 'between');
60
+		$size = $this->getSize($attribute, $value);
61
+		return $size >= $parameters[0] && $size <= $parameters[1];
62
+	}
63 63
 
64
-    /**
65
-     * Validate that an attribute is a valid e-mail address.
66
-     * @param mixed $value
67
-     * @return bool
68
-     */
69
-    public function validateEmail($value)
70
-    {
71
-        return false !== filter_var($value, FILTER_VALIDATE_EMAIL);
72
-    }
64
+	/**
65
+	 * Validate that an attribute is a valid e-mail address.
66
+	 * @param mixed $value
67
+	 * @return bool
68
+	 */
69
+	public function validateEmail($value)
70
+	{
71
+		return false !== filter_var($value, FILTER_VALIDATE_EMAIL);
72
+	}
73 73
 
74
-    /**
75
-     * Validate the size of an attribute is less than a maximum value.
76
-     * @param string $attribute
77
-     * @param mixed $value
78
-     * @return bool
79
-     */
80
-    public function validateMax($value, $attribute, array $parameters)
81
-    {
82
-        $this->requireParameterCount(1, $parameters, 'max');
83
-        return $this->getSize($attribute, $value) <= $parameters[0];
84
-    }
74
+	/**
75
+	 * Validate the size of an attribute is less than a maximum value.
76
+	 * @param string $attribute
77
+	 * @param mixed $value
78
+	 * @return bool
79
+	 */
80
+	public function validateMax($value, $attribute, array $parameters)
81
+	{
82
+		$this->requireParameterCount(1, $parameters, 'max');
83
+		return $this->getSize($attribute, $value) <= $parameters[0];
84
+	}
85 85
 
86
-    /**
87
-     * Validate the size of an attribute is greater than a minimum value.
88
-     * @param string $attribute
89
-     * @param mixed $value
90
-     * @return bool
91
-     */
92
-    public function validateMin($value, $attribute, array $parameters)
93
-    {
94
-        $this->requireParameterCount(1, $parameters, 'min');
95
-        return $this->getSize($attribute, $value) >= $parameters[0];
96
-    }
86
+	/**
87
+	 * Validate the size of an attribute is greater than a minimum value.
88
+	 * @param string $attribute
89
+	 * @param mixed $value
90
+	 * @return bool
91
+	 */
92
+	public function validateMin($value, $attribute, array $parameters)
93
+	{
94
+		$this->requireParameterCount(1, $parameters, 'min');
95
+		return $this->getSize($attribute, $value) >= $parameters[0];
96
+	}
97 97
 
98
-    /**
99
-     * Validate that an attribute is numeric.
100
-     * @param mixed $value
101
-     * @return bool
102
-     */
103
-    public function validateNumber($value)
104
-    {
105
-        return is_numeric($value);
106
-    }
98
+	/**
99
+	 * Validate that an attribute is numeric.
100
+	 * @param mixed $value
101
+	 * @return bool
102
+	 */
103
+	public function validateNumber($value)
104
+	{
105
+		return is_numeric($value);
106
+	}
107 107
 
108
-    /**
109
-     * Validate that a required attribute exists.
110
-     * @param mixed $value
111
-     * @return bool
112
-     */
113
-    public function validateRequired($value)
114
-    {
115
-        return is_null($value)
116
-            || (is_string($value) && in_array(trim($value), ['', '[]']))
117
-            || (is_array($value) && empty($value))
118
-            ? false
119
-            : true;
120
-    }
108
+	/**
109
+	 * Validate that a required attribute exists.
110
+	 * @param mixed $value
111
+	 * @return bool
112
+	 */
113
+	public function validateRequired($value)
114
+	{
115
+		return is_null($value)
116
+			|| (is_string($value) && in_array(trim($value), ['', '[]']))
117
+			|| (is_array($value) && empty($value))
118
+			? false
119
+			: true;
120
+	}
121 121
 
122
-    /**
123
-     * Require a certain number of parameters to be present.
124
-     * @param int $count
125
-     * @param string $rule
126
-     * @return void
127
-     * @throws InvalidArgumentException
128
-     */
129
-    protected function requireParameterCount($count, array $parameters, $rule)
130
-    {
131
-        if (count($parameters) < $count) {
132
-            throw new InvalidArgumentException("Validation rule $rule requires at least $count parameters.");
133
-        }
134
-    }
122
+	/**
123
+	 * Require a certain number of parameters to be present.
124
+	 * @param int $count
125
+	 * @param string $rule
126
+	 * @return void
127
+	 * @throws InvalidArgumentException
128
+	 */
129
+	protected function requireParameterCount($count, array $parameters, $rule)
130
+	{
131
+		if (count($parameters) < $count) {
132
+			throw new InvalidArgumentException("Validation rule $rule requires at least $count parameters.");
133
+		}
134
+	}
135 135
 }
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -16,23 +16,23 @@  discard block
 block discarded – undo
16 16
      * @param mixed $value
17 17
      * @return mixed
18 18
      */
19
-    abstract protected function getSize($attribute, $value);
19
+    abstract protected function getSize( $attribute, $value );
20 20
 
21 21
     /**
22 22
      * Replace all placeholders.
23 23
      * @param string $message
24 24
      * @return string
25 25
      */
26
-    protected function replace($message, array $parameters)
26
+    protected function replace( $message, array $parameters )
27 27
     {
28
-        if (!Str::contains($message, '%s')) {
28
+        if( !Str::contains( $message, '%s' ) ) {
29 29
             return $message;
30 30
         }
31
-        return preg_replace_callback('/(%s)/', function () use (&$parameters) {
32
-            foreach ($parameters as $key => $value) {
33
-                return array_shift($parameters);
31
+        return preg_replace_callback( '/(%s)/', function() use (&$parameters) {
32
+            foreach( $parameters as $key => $value ) {
33
+                return array_shift( $parameters );
34 34
             }
35
-        }, $message);
35
+        }, $message );
36 36
     }
37 37
 
38 38
     /**
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
      * @param mixed $value
43 43
      * @return bool
44 44
      */
45
-    public function validateAccepted($value)
45
+    public function validateAccepted( $value )
46 46
     {
47 47
         $acceptable = ['yes', 'on', '1', 1, true, 'true'];
48
-        return $this->validateRequired($value) && in_array($value, $acceptable, true);
48
+        return $this->validateRequired( $value ) && in_array( $value, $acceptable, true );
49 49
     }
50 50
 
51 51
     /**
@@ -54,10 +54,10 @@  discard block
 block discarded – undo
54 54
      * @param mixed $value
55 55
      * @return bool
56 56
      */
57
-    public function validateBetween($value, $attribute, array $parameters)
57
+    public function validateBetween( $value, $attribute, array $parameters )
58 58
     {
59
-        $this->requireParameterCount(2, $parameters, 'between');
60
-        $size = $this->getSize($attribute, $value);
59
+        $this->requireParameterCount( 2, $parameters, 'between' );
60
+        $size = $this->getSize( $attribute, $value );
61 61
         return $size >= $parameters[0] && $size <= $parameters[1];
62 62
     }
63 63
 
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
      * @param mixed $value
67 67
      * @return bool
68 68
      */
69
-    public function validateEmail($value)
69
+    public function validateEmail( $value )
70 70
     {
71
-        return false !== filter_var($value, FILTER_VALIDATE_EMAIL);
71
+        return false !== filter_var( $value, FILTER_VALIDATE_EMAIL );
72 72
     }
73 73
 
74 74
     /**
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
      * @param mixed $value
78 78
      * @return bool
79 79
      */
80
-    public function validateMax($value, $attribute, array $parameters)
80
+    public function validateMax( $value, $attribute, array $parameters )
81 81
     {
82
-        $this->requireParameterCount(1, $parameters, 'max');
83
-        return $this->getSize($attribute, $value) <= $parameters[0];
82
+        $this->requireParameterCount( 1, $parameters, 'max' );
83
+        return $this->getSize( $attribute, $value ) <= $parameters[0];
84 84
     }
85 85
 
86 86
     /**
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
      * @param mixed $value
90 90
      * @return bool
91 91
      */
92
-    public function validateMin($value, $attribute, array $parameters)
92
+    public function validateMin( $value, $attribute, array $parameters )
93 93
     {
94
-        $this->requireParameterCount(1, $parameters, 'min');
95
-        return $this->getSize($attribute, $value) >= $parameters[0];
94
+        $this->requireParameterCount( 1, $parameters, 'min' );
95
+        return $this->getSize( $attribute, $value ) >= $parameters[0];
96 96
     }
97 97
 
98 98
     /**
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
      * @param mixed $value
101 101
      * @return bool
102 102
      */
103
-    public function validateNumber($value)
103
+    public function validateNumber( $value )
104 104
     {
105
-        return is_numeric($value);
105
+        return is_numeric( $value );
106 106
     }
107 107
 
108 108
     /**
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
      * @param mixed $value
111 111
      * @return bool
112 112
      */
113
-    public function validateRequired($value)
113
+    public function validateRequired( $value )
114 114
     {
115
-        return is_null($value)
116
-            || (is_string($value) && in_array(trim($value), ['', '[]']))
117
-            || (is_array($value) && empty($value))
115
+        return is_null( $value )
116
+            || (is_string( $value ) && in_array( trim( $value ), ['', '[]'] ))
117
+            || (is_array( $value ) && empty($value))
118 118
             ? false
119 119
             : true;
120 120
     }
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
126 126
      * @return void
127 127
      * @throws InvalidArgumentException
128 128
      */
129
-    protected function requireParameterCount($count, array $parameters, $rule)
129
+    protected function requireParameterCount( $count, array $parameters, $rule )
130 130
     {
131
-        if (count($parameters) < $count) {
132
-            throw new InvalidArgumentException("Validation rule $rule requires at least $count parameters.");
131
+        if( count( $parameters ) < $count ) {
132
+            throw new InvalidArgumentException( "Validation rule $rule requires at least $count parameters." );
133 133
         }
134 134
     }
135 135
 }
Please login to merge, or discard this patch.
plugin/Contracts/MultilingualContract.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -4,29 +4,29 @@
 block discarded – undo
4 4
 
5 5
 interface MultilingualContract
6 6
 {
7
-    /**
8
-     * @param int|string $postId
9
-     * @return int
10
-     */
11
-    public function getPostId($postId);
7
+	/**
8
+	 * @param int|string $postId
9
+	 * @return int
10
+	 */
11
+	public function getPostId($postId);
12 12
 
13
-    /**
14
-     * @return array
15
-     */
16
-    public function getPostIds(array $postIds);
13
+	/**
14
+	 * @return array
15
+	 */
16
+	public function getPostIds(array $postIds);
17 17
 
18
-    /**
19
-     * @return bool
20
-     */
21
-    public function isActive();
18
+	/**
19
+	 * @return bool
20
+	 */
21
+	public function isActive();
22 22
 
23
-    /**
24
-     * @return bool
25
-     */
26
-    public function isEnabled();
23
+	/**
24
+	 * @return bool
25
+	 */
26
+	public function isEnabled();
27 27
 
28
-    /**
29
-     * @return bool
30
-     */
31
-    public function isSupported();
28
+	/**
29
+	 * @return bool
30
+	 */
31
+	public function isSupported();
32 32
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@
 block discarded – undo
8 8
      * @param int|string $postId
9 9
      * @return int
10 10
      */
11
-    public function getPostId($postId);
11
+    public function getPostId( $postId );
12 12
 
13 13
     /**
14 14
      * @return array
15 15
      */
16
-    public function getPostIds(array $postIds);
16
+    public function getPostIds( array $postIds );
17 17
 
18 18
     /**
19 19
      * @return bool
Please login to merge, or discard this patch.
site-reviews.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,17 +20,17 @@
 block discarded – undo
20 20
 defined('WPINC') || die;
21 21
 
22 22
 if (!class_exists('GL_Plugin_Check_v4')) {
23
-    require_once __DIR__.'/activate.php';
23
+	require_once __DIR__.'/activate.php';
24 24
 }
25 25
 if ((new GL_Plugin_Check_v4(__FILE__))->canProceed()) {
26
-    require_once __DIR__.'/autoload.php';
27
-    require_once __DIR__.'/compatibility.php';
28
-    require_once __DIR__.'/deprecated.php';
29
-    require_once __DIR__.'/helpers.php';
30
-    $app = new GeminiLabs\SiteReviews\Application();
31
-    $app->make('Provider')->register($app);
32
-    register_activation_hook(__FILE__, array($app, 'activate'));
33
-    register_deactivation_hook(__FILE__, array($app, 'deactivate'));
34
-    register_shutdown_function(array($app, 'catchFatalError'));
35
-    $app->init();
26
+	require_once __DIR__.'/autoload.php';
27
+	require_once __DIR__.'/compatibility.php';
28
+	require_once __DIR__.'/deprecated.php';
29
+	require_once __DIR__.'/helpers.php';
30
+	$app = new GeminiLabs\SiteReviews\Application();
31
+	$app->make('Provider')->register($app);
32
+	register_activation_hook(__FILE__, array($app, 'activate'));
33
+	register_deactivation_hook(__FILE__, array($app, 'deactivate'));
34
+	register_shutdown_function(array($app, 'catchFatalError'));
35
+	$app->init();
36 36
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,20 +17,20 @@
 block discarded – undo
17 17
  * Text Domain:       site-reviews
18 18
  * Domain Path:       languages
19 19
  */
20
-defined('WPINC') || die;
20
+defined( 'WPINC' ) || die;
21 21
 
22
-if (!class_exists('GL_Plugin_Check_v4')) {
22
+if( !class_exists( 'GL_Plugin_Check_v4' ) ) {
23 23
     require_once __DIR__.'/activate.php';
24 24
 }
25
-if ((new GL_Plugin_Check_v4(__FILE__))->canProceed()) {
25
+if( (new GL_Plugin_Check_v4( __FILE__ ))->canProceed() ) {
26 26
     require_once __DIR__.'/autoload.php';
27 27
     require_once __DIR__.'/compatibility.php';
28 28
     require_once __DIR__.'/deprecated.php';
29 29
     require_once __DIR__.'/helpers.php';
30 30
     $app = new GeminiLabs\SiteReviews\Application();
31
-    $app->make('Provider')->register($app);
32
-    register_activation_hook(__FILE__, array($app, 'activate'));
33
-    register_deactivation_hook(__FILE__, array($app, 'deactivate'));
34
-    register_shutdown_function(array($app, 'catchFatalError'));
31
+    $app->make( 'Provider' )->register( $app );
32
+    register_activation_hook( __FILE__, array( $app, 'activate' ) );
33
+    register_deactivation_hook( __FILE__, array( $app, 'deactivate' ) );
34
+    register_shutdown_function( array( $app, 'catchFatalError' ) );
35 35
     $app->init();
36 36
 }
Please login to merge, or discard this patch.
activate.php 3 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -125,7 +125,8 @@
 block discarded – undo
125 125
                 sprintf($messages['wrong_version'], $messages['php_version'].' '.$this->versions['php']),
126 126
                 sprintf($messages['update_php'], PHP_VERSION).'</p><p>'.$rollbackMessage
127 127
             );
128
-        } elseif (!$this->isWpValid()) {
128
+        }
129
+        elseif (!$this->isWpValid()) {
129 130
             printf($noticeTemplate,
130 131
                 sprintf($messages['notice'], $pluginName),
131 132
                 sprintf($messages['wrong_version'], $messages['wp_version'].' '.$this->versions['wordpress']),
Please login to merge, or discard this patch.
Indentation   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -8,141 +8,141 @@
 block discarded – undo
8 8
  */
9 9
 class GL_Plugin_Check_v4
10 10
 {
11
-    const MIN_PHP_VERSION = '5.6.0';
12
-    const MIN_WORDPRESS_VERSION = '4.7.0';
11
+	const MIN_PHP_VERSION = '5.6.0';
12
+	const MIN_WORDPRESS_VERSION = '4.7.0';
13 13
 
14
-    /**
15
-     * @var array
16
-     */
17
-    public $versions;
14
+	/**
15
+	 * @var array
16
+	 */
17
+	public $versions;
18 18
 
19
-    /**
20
-     * @var string
21
-     */
22
-    protected $file;
19
+	/**
20
+	 * @var string
21
+	 */
22
+	protected $file;
23 23
 
24
-    /**
25
-     * @param string $file
26
-     */
27
-    public function __construct($file)
28
-    {
29
-        $this->file = realpath($file);
30
-        $versionRequirements = get_file_data($this->file, [
31
-            'php' => 'Requires PHP',
32
-            'wordpress' => 'Requires at least',
33
-        ]);
34
-        $this->versions = wp_parse_args(array_filter($versionRequirements), [
35
-            'php' => static::MIN_PHP_VERSION,
36
-            'wordpress' => static::MIN_WORDPRESS_VERSION,
37
-        ]);
38
-    }
24
+	/**
25
+	 * @param string $file
26
+	 */
27
+	public function __construct($file)
28
+	{
29
+		$this->file = realpath($file);
30
+		$versionRequirements = get_file_data($this->file, [
31
+			'php' => 'Requires PHP',
32
+			'wordpress' => 'Requires at least',
33
+		]);
34
+		$this->versions = wp_parse_args(array_filter($versionRequirements), [
35
+			'php' => static::MIN_PHP_VERSION,
36
+			'wordpress' => static::MIN_WORDPRESS_VERSION,
37
+		]);
38
+	}
39 39
 
40
-    /**
41
-     * @return bool
42
-     */
43
-    public function canProceed()
44
-    {
45
-        if ($this->isValid()) {
46
-            return true;
47
-        }
48
-        add_action('activated_plugin', [$this, 'deactivate']);
49
-        add_action('admin_notices', [$this, 'deactivate']);
50
-        return false;
51
-    }
40
+	/**
41
+	 * @return bool
42
+	 */
43
+	public function canProceed()
44
+	{
45
+		if ($this->isValid()) {
46
+			return true;
47
+		}
48
+		add_action('activated_plugin', [$this, 'deactivate']);
49
+		add_action('admin_notices', [$this, 'deactivate']);
50
+		return false;
51
+	}
52 52
 
53
-    /**
54
-     * @return bool
55
-     */
56
-    public function isPhpValid()
57
-    {
58
-        return !version_compare(PHP_VERSION, $this->versions['php'], '<');
59
-    }
53
+	/**
54
+	 * @return bool
55
+	 */
56
+	public function isPhpValid()
57
+	{
58
+		return !version_compare(PHP_VERSION, $this->versions['php'], '<');
59
+	}
60 60
 
61
-    /**
62
-     * @return bool
63
-     */
64
-    public function isValid()
65
-    {
66
-        return $this->isPhpValid() && $this->isWpValid();
67
-    }
61
+	/**
62
+	 * @return bool
63
+	 */
64
+	public function isValid()
65
+	{
66
+		return $this->isPhpValid() && $this->isWpValid();
67
+	}
68 68
 
69
-    /**
70
-     * @return bool
71
-     */
72
-    public function isWpValid()
73
-    {
74
-        global $wp_version;
75
-        return !version_compare($wp_version, $this->versions['wordpress'], '<');
76
-    }
69
+	/**
70
+	 * @return bool
71
+	 */
72
+	public function isWpValid()
73
+	{
74
+		global $wp_version;
75
+		return !version_compare($wp_version, $this->versions['wordpress'], '<');
76
+	}
77 77
 
78
-    /**
79
-     * @param string $plugin
80
-     * @return void
81
-     */
82
-    public function deactivate($plugin)
83
-    {
84
-        if ($this->isValid()) {
85
-            return;
86
-        }
87
-        $pluginSlug = plugin_basename($this->file);
88
-        if ($plugin == $pluginSlug) {
89
-            $this->redirect(); //exit
90
-        }
91
-        $pluginData = get_file_data($this->file, ['name' => 'Plugin Name'], 'plugin');
92
-        deactivate_plugins($pluginSlug);
93
-        $this->printNotice($pluginData['name']);
94
-    }
78
+	/**
79
+	 * @param string $plugin
80
+	 * @return void
81
+	 */
82
+	public function deactivate($plugin)
83
+	{
84
+		if ($this->isValid()) {
85
+			return;
86
+		}
87
+		$pluginSlug = plugin_basename($this->file);
88
+		if ($plugin == $pluginSlug) {
89
+			$this->redirect(); //exit
90
+		}
91
+		$pluginData = get_file_data($this->file, ['name' => 'Plugin Name'], 'plugin');
92
+		deactivate_plugins($pluginSlug);
93
+		$this->printNotice($pluginData['name']);
94
+	}
95 95
 
96
-    /**
97
-     * @return array
98
-     */
99
-    protected function getMessages()
100
-    {
101
-        return [
102
-            'notice' => __('The %s plugin was deactivated.', 'site-reviews'),
103
-            'php_version' => __('PHP version', 'site-reviews'),
104
-            'rollback' => __('You can use the %s plugin to restore %s to the previous version.', 'site-reviews'),
105
-            'update_php' => __('Please contact your hosting provider or server administrator to upgrade the version of PHP on your server (your server is running PHP version %s), or try to find an alternative plugin.', 'site-reviews'),
106
-            'update_wp' => __('Update WordPress', 'site-reviews'),
107
-            'wp_version' => __('WordPress version', 'site-reviews'),
108
-            'wrong_version' => __('This plugin requires %s or greater in order to work properly.', 'site-reviews'),
109
-        ];
110
-    }
96
+	/**
97
+	 * @return array
98
+	 */
99
+	protected function getMessages()
100
+	{
101
+		return [
102
+			'notice' => __('The %s plugin was deactivated.', 'site-reviews'),
103
+			'php_version' => __('PHP version', 'site-reviews'),
104
+			'rollback' => __('You can use the %s plugin to restore %s to the previous version.', 'site-reviews'),
105
+			'update_php' => __('Please contact your hosting provider or server administrator to upgrade the version of PHP on your server (your server is running PHP version %s), or try to find an alternative plugin.', 'site-reviews'),
106
+			'update_wp' => __('Update WordPress', 'site-reviews'),
107
+			'wp_version' => __('WordPress version', 'site-reviews'),
108
+			'wrong_version' => __('This plugin requires %s or greater in order to work properly.', 'site-reviews'),
109
+		];
110
+	}
111 111
 
112
-    /**
113
-     * @param string $pluginName
114
-     * @return void
115
-     */
116
-    protected function printNotice($pluginName)
117
-    {
118
-        $noticeTemplate = '<div id="message" class="notice notice-error error is-dismissible"><p><strong>%s</strong></p><p>%s</p><p>%s</p></div>';
119
-        $messages = $this->getMessages();
120
-        $rollbackMessage = sprintf('<strong>'.$messages['rollback'].'</strong>', '<a href="https://wordpress.org/plugins/wp-rollback/">WP Rollback</a>', $pluginName);
121
-        if (!$this->isPhpValid()) {
122
-            printf($noticeTemplate,
123
-                sprintf($messages['notice'], $pluginName),
124
-                sprintf($messages['wrong_version'], $messages['php_version'].' '.$this->versions['php']),
125
-                sprintf($messages['update_php'], PHP_VERSION).'</p><p>'.$rollbackMessage
126
-            );
127
-        } elseif (!$this->isWpValid()) {
128
-            printf($noticeTemplate,
129
-                sprintf($messages['notice'], $pluginName),
130
-                sprintf($messages['wrong_version'], $messages['wp_version'].' '.$this->versions['wordpress']),
131
-                $rollbackMessage.'</p><p>'.sprintf('<a href="%s">%s</a>', admin_url('update-core.php'), $messages['update_wp'])
132
-            );
133
-        }
134
-    }
112
+	/**
113
+	 * @param string $pluginName
114
+	 * @return void
115
+	 */
116
+	protected function printNotice($pluginName)
117
+	{
118
+		$noticeTemplate = '<div id="message" class="notice notice-error error is-dismissible"><p><strong>%s</strong></p><p>%s</p><p>%s</p></div>';
119
+		$messages = $this->getMessages();
120
+		$rollbackMessage = sprintf('<strong>'.$messages['rollback'].'</strong>', '<a href="https://wordpress.org/plugins/wp-rollback/">WP Rollback</a>', $pluginName);
121
+		if (!$this->isPhpValid()) {
122
+			printf($noticeTemplate,
123
+				sprintf($messages['notice'], $pluginName),
124
+				sprintf($messages['wrong_version'], $messages['php_version'].' '.$this->versions['php']),
125
+				sprintf($messages['update_php'], PHP_VERSION).'</p><p>'.$rollbackMessage
126
+			);
127
+		} elseif (!$this->isWpValid()) {
128
+			printf($noticeTemplate,
129
+				sprintf($messages['notice'], $pluginName),
130
+				sprintf($messages['wrong_version'], $messages['wp_version'].' '.$this->versions['wordpress']),
131
+				$rollbackMessage.'</p><p>'.sprintf('<a href="%s">%s</a>', admin_url('update-core.php'), $messages['update_wp'])
132
+			);
133
+		}
134
+	}
135 135
 
136
-    /**
137
-     * @return void
138
-     */
139
-    protected function redirect()
140
-    {
141
-        wp_safe_redirect(self_admin_url(sprintf('plugins.php?plugin_status=%s&paged=%s&s=%s',
142
-            filter_input(INPUT_GET, 'plugin_status'),
143
-            filter_input(INPUT_GET, 'paged'),
144
-            filter_input(INPUT_GET, 's')
145
-        )));
146
-        exit;
147
-    }
136
+	/**
137
+	 * @return void
138
+	 */
139
+	protected function redirect()
140
+	{
141
+		wp_safe_redirect(self_admin_url(sprintf('plugins.php?plugin_status=%s&paged=%s&s=%s',
142
+			filter_input(INPUT_GET, 'plugin_status'),
143
+			filter_input(INPUT_GET, 'paged'),
144
+			filter_input(INPUT_GET, 's')
145
+		)));
146
+		exit;
147
+	}
148 148
 }
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 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
  * Check for minimum system requirments on plugin activation.
@@ -24,17 +24,17 @@  discard block
 block discarded – undo
24 24
     /**
25 25
      * @param string $file
26 26
      */
27
-    public function __construct($file)
27
+    public function __construct( $file )
28 28
     {
29
-        $this->file = realpath($file);
30
-        $versionRequirements = get_file_data($this->file, [
29
+        $this->file = realpath( $file );
30
+        $versionRequirements = get_file_data( $this->file, [
31 31
             'php' => 'Requires PHP',
32 32
             'wordpress' => 'Requires at least',
33
-        ]);
34
-        $this->versions = wp_parse_args(array_filter($versionRequirements), [
33
+        ] );
34
+        $this->versions = wp_parse_args( array_filter( $versionRequirements ), [
35 35
             'php' => static::MIN_PHP_VERSION,
36 36
             'wordpress' => static::MIN_WORDPRESS_VERSION,
37
-        ]);
37
+        ] );
38 38
     }
39 39
 
40 40
     /**
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function canProceed()
44 44
     {
45
-        if ($this->isValid()) {
45
+        if( $this->isValid() ) {
46 46
             return true;
47 47
         }
48
-        add_action('activated_plugin', [$this, 'deactivate']);
49
-        add_action('admin_notices', [$this, 'deactivate']);
48
+        add_action( 'activated_plugin', [$this, 'deactivate'] );
49
+        add_action( 'admin_notices', [$this, 'deactivate'] );
50 50
         return false;
51 51
     }
52 52
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function isPhpValid()
57 57
     {
58
-        return !version_compare(PHP_VERSION, $this->versions['php'], '<');
58
+        return !version_compare( PHP_VERSION, $this->versions['php'], '<' );
59 59
     }
60 60
 
61 61
     /**
@@ -72,25 +72,25 @@  discard block
 block discarded – undo
72 72
     public function isWpValid()
73 73
     {
74 74
         global $wp_version;
75
-        return !version_compare($wp_version, $this->versions['wordpress'], '<');
75
+        return !version_compare( $wp_version, $this->versions['wordpress'], '<' );
76 76
     }
77 77
 
78 78
     /**
79 79
      * @param string $plugin
80 80
      * @return void
81 81
      */
82
-    public function deactivate($plugin)
82
+    public function deactivate( $plugin )
83 83
     {
84
-        if ($this->isValid()) {
84
+        if( $this->isValid() ) {
85 85
             return;
86 86
         }
87
-        $pluginSlug = plugin_basename($this->file);
88
-        if ($plugin == $pluginSlug) {
87
+        $pluginSlug = plugin_basename( $this->file );
88
+        if( $plugin == $pluginSlug ) {
89 89
             $this->redirect(); //exit
90 90
         }
91
-        $pluginData = get_file_data($this->file, ['name' => 'Plugin Name'], 'plugin');
92
-        deactivate_plugins($pluginSlug);
93
-        $this->printNotice($pluginData['name']);
91
+        $pluginData = get_file_data( $this->file, ['name' => 'Plugin Name'], 'plugin' );
92
+        deactivate_plugins( $pluginSlug );
93
+        $this->printNotice( $pluginData['name'] );
94 94
     }
95 95
 
96 96
     /**
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
     protected function getMessages()
100 100
     {
101 101
         return [
102
-            'notice' => __('The %s plugin was deactivated.', 'site-reviews'),
103
-            'php_version' => __('PHP version', 'site-reviews'),
104
-            'rollback' => __('You can use the %s plugin to restore %s to the previous version.', 'site-reviews'),
105
-            'update_php' => __('Please contact your hosting provider or server administrator to upgrade the version of PHP on your server (your server is running PHP version %s), or try to find an alternative plugin.', 'site-reviews'),
106
-            'update_wp' => __('Update WordPress', 'site-reviews'),
107
-            'wp_version' => __('WordPress version', 'site-reviews'),
108
-            'wrong_version' => __('This plugin requires %s or greater in order to work properly.', 'site-reviews'),
102
+            'notice' => __( 'The %s plugin was deactivated.', 'site-reviews' ),
103
+            'php_version' => __( 'PHP version', 'site-reviews' ),
104
+            'rollback' => __( 'You can use the %s plugin to restore %s to the previous version.', 'site-reviews' ),
105
+            'update_php' => __( 'Please contact your hosting provider or server administrator to upgrade the version of PHP on your server (your server is running PHP version %s), or try to find an alternative plugin.', 'site-reviews' ),
106
+            'update_wp' => __( 'Update WordPress', 'site-reviews' ),
107
+            'wp_version' => __( 'WordPress version', 'site-reviews' ),
108
+            'wrong_version' => __( 'This plugin requires %s or greater in order to work properly.', 'site-reviews' ),
109 109
         ];
110 110
     }
111 111
 
@@ -113,22 +113,22 @@  discard block
 block discarded – undo
113 113
      * @param string $pluginName
114 114
      * @return void
115 115
      */
116
-    protected function printNotice($pluginName)
116
+    protected function printNotice( $pluginName )
117 117
     {
118 118
         $noticeTemplate = '<div id="message" class="notice notice-error error is-dismissible"><p><strong>%s</strong></p><p>%s</p><p>%s</p></div>';
119 119
         $messages = $this->getMessages();
120
-        $rollbackMessage = sprintf('<strong>'.$messages['rollback'].'</strong>', '<a href="https://wordpress.org/plugins/wp-rollback/">WP Rollback</a>', $pluginName);
121
-        if (!$this->isPhpValid()) {
122
-            printf($noticeTemplate,
123
-                sprintf($messages['notice'], $pluginName),
124
-                sprintf($messages['wrong_version'], $messages['php_version'].' '.$this->versions['php']),
125
-                sprintf($messages['update_php'], PHP_VERSION).'</p><p>'.$rollbackMessage
120
+        $rollbackMessage = sprintf( '<strong>'.$messages['rollback'].'</strong>', '<a href="https://wordpress.org/plugins/wp-rollback/">WP Rollback</a>', $pluginName );
121
+        if( !$this->isPhpValid() ) {
122
+            printf( $noticeTemplate,
123
+                sprintf( $messages['notice'], $pluginName ),
124
+                sprintf( $messages['wrong_version'], $messages['php_version'].' '.$this->versions['php'] ),
125
+                sprintf( $messages['update_php'], PHP_VERSION ).'</p><p>'.$rollbackMessage
126 126
             );
127
-        } elseif (!$this->isWpValid()) {
128
-            printf($noticeTemplate,
129
-                sprintf($messages['notice'], $pluginName),
130
-                sprintf($messages['wrong_version'], $messages['wp_version'].' '.$this->versions['wordpress']),
131
-                $rollbackMessage.'</p><p>'.sprintf('<a href="%s">%s</a>', admin_url('update-core.php'), $messages['update_wp'])
127
+        } elseif( !$this->isWpValid() ) {
128
+            printf( $noticeTemplate,
129
+                sprintf( $messages['notice'], $pluginName ),
130
+                sprintf( $messages['wrong_version'], $messages['wp_version'].' '.$this->versions['wordpress'] ),
131
+                $rollbackMessage.'</p><p>'.sprintf( '<a href="%s">%s</a>', admin_url( 'update-core.php' ), $messages['update_wp'] )
132 132
             );
133 133
         }
134 134
     }
@@ -138,11 +138,11 @@  discard block
 block discarded – undo
138 138
      */
139 139
     protected function redirect()
140 140
     {
141
-        wp_safe_redirect(self_admin_url(sprintf('plugins.php?plugin_status=%s&paged=%s&s=%s',
142
-            filter_input(INPUT_GET, 'plugin_status'),
143
-            filter_input(INPUT_GET, 'paged'),
144
-            filter_input(INPUT_GET, 's')
145
-        )));
141
+        wp_safe_redirect( self_admin_url( sprintf( 'plugins.php?plugin_status=%s&paged=%s&s=%s',
142
+            filter_input( INPUT_GET, 'plugin_status' ),
143
+            filter_input( INPUT_GET, 'paged' ),
144
+            filter_input( INPUT_GET, 's' )
145
+        ) ) );
146 146
         exit;
147 147
     }
148 148
 }
Please login to merge, or discard this patch.
views/pages/documentation/index.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3 3
 <div class="wrap">
4 4
     <h1 class="wp-heading-inline">
5
-        <?= esc_html(get_admin_page_title()); ?>
6
-        <a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=welcome'); ?>" class="page-title-action"><?= __('About', 'site-reviews'); ?></a>
5
+        <?= esc_html( get_admin_page_title() ); ?>
6
+        <a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=welcome' ); ?>" class="page-title-action"><?= __( 'About', 'site-reviews' ); ?></a>
7 7
     </h1>
8 8
     <?= $notices; ?>
9
-    <p><?= __('Click an active tab to expand/collapse all sections.', 'site-reviews'); ?></p>
9
+    <p><?= __( 'Click an active tab to expand/collapse all sections.', 'site-reviews' ); ?></p>
10 10
     <h2 class="glsr-nav-tab-wrapper nav-tab-wrapper">
11
-        <?php foreach ($tabs as $id => $title) : ?>
11
+        <?php foreach( $tabs as $id => $title ) : ?>
12 12
         <a class="glsr-nav-tab nav-tab" href="#<?= $id; ?>"><?= $title; ?></a>
13 13
         <?php endforeach; ?>
14 14
     </h2>
15
-    <?php foreach ($tabs as $id => $title) : ?>
15
+    <?php foreach( $tabs as $id => $title ) : ?>
16 16
     <div class="glsr-nav-view ui-tabs-hide" id="<?= $id; ?>">
17
-        <?php glsr()->render('pages/documentation/'.$id, $data); ?>
17
+        <?php glsr()->render( 'pages/documentation/'.$id, $data ); ?>
18 18
     </div>
19 19
     <?php endforeach; ?>
20 20
     <input type="hidden" name="_active_tab">
Please login to merge, or discard this patch.
views/pages/welcome/index.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,23 +1,23 @@
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3 3
 <div class="glsr-welcome wrap about-wrap about-wrap-content">
4 4
     <h1>Welcome to <?= glsr()->name; ?></h1>
5 5
     <div class="about-text">Site Reviews is a free WordPress review plugin with advanced features that makes it easy to manage reviews on your website. Follow the instructions below to get started!</div>
6 6
     <div class="wp-badge">Version <?= glsr()->version; ?></div>
7 7
     <p class="about-buttons">
8
-        <a class="button" href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=documentation'); ?>">Documentation</a>
8
+        <a class="button" href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=documentation' ); ?>">Documentation</a>
9 9
         <a class="button" href="https://wordpress.org/support/plugin/site-reviews/">Support</a>
10 10
         <a target="_blank" class="button" href="https://www.facebook.com/sharer/sharer.php?u=https%3A//geminilabs.io/site-reviews"><span class="dashicons dashicons-facebook-alt"></span> Share</a>
11 11
         <a target="_blank" class="button" href="https://twitter.com/intent/tweet?text=Site Reviews is a fantastic WordPress review plugin with advanced features that makes it easy to manage reviews on your website.&url=https://geminilabs.io/site-reviews&hashtags=WordPress,reviewplugins,"><span class="dashicons dashicons-twitter"></span> Tweet</a>
12 12
     </p>
13 13
     <nav class="glsr-nav-tab-wrapper nav-tab-wrapper">
14
-        <?php foreach ($tabs as $id => $title) : ?>
14
+        <?php foreach( $tabs as $id => $title ) : ?>
15 15
         <a class="glsr-nav-tab nav-tab" href="#<?= $id; ?>"><?= $title; ?></a>
16 16
         <?php endforeach; ?>
17 17
     </nav>
18
-    <?php foreach ($tabs as $id => $title) : ?>
18
+    <?php foreach( $tabs as $id => $title ) : ?>
19 19
     <div class="glsr-nav-view ui-tabs-hide" id="<?= $id; ?>">
20
-        <?php $template->render('pages/welcome/'.$id, $data); ?>
20
+        <?php $template->render( 'pages/welcome/'.$id, $data ); ?>
21 21
     </div>
22 22
     <?php endforeach; ?>
23 23
     <input type="hidden" name="_active_tab">
Please login to merge, or discard this patch.