Passed
Push — master ( 2c1b34...eeeeb5 )
by Paul
04:03
created
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.
plugin/Controllers/SettingsController.php 3 patches
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -134,7 +134,8 @@  discard block
 block discarded – undo
134 134
                 $integration->pluginName
135 135
             ));
136 136
             return false;
137
-        } elseif (!$integration->isSupported()) {
137
+        }
138
+        elseif (!$integration->isSupported()) {
138 139
             glsr(Notice::class)->addError(sprintf(
139 140
                 __('Please update the %s plugin to v%s or greater to enable integration.', 'site-reviews'),
140 141
                 $integration->pluginName,
@@ -161,7 +162,8 @@  discard block
 block discarded – undo
161 162
             if (!$updater->isLicenseValid()) {
162 163
                 throw new Exception('Invalid license: '.$license.' ('.$addon->id.')');
163 164
             }
164
-        } catch (Exception $e) {
165
+        }
166
+        catch (Exception $e) {
165 167
             $license = '';
166 168
             glsr_log()->debug($e->getMessage());
167 169
             glsr(Notice::class)->addError(__('A license you entered was invalid.', 'site-reviews'));
Please login to merge, or discard this patch.
Indentation   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -12,163 +12,163 @@
 block discarded – undo
12 12
 
13 13
 class SettingsController extends Controller
14 14
 {
15
-    /**
16
-     * @param mixed $input
17
-     * @return array
18
-     * @callback register_setting
19
-     */
20
-    public function callbackRegisterSettings($input)
21
-    {
22
-        $settings = Arr::consolidateArray($input);
23
-        if (1 === count($settings) && array_key_exists('settings', $settings)) {
24
-            $options = array_replace_recursive(glsr(OptionManager::class)->all(), $input);
25
-            $options = $this->sanitizeGeneral($input, $options);
26
-            $options = $this->sanitizeLicenses($input, $options);
27
-            $options = $this->sanitizeSubmissions($input, $options);
28
-            $options = $this->sanitizeTranslations($input, $options);
29
-            $options = apply_filters('site-reviews/settings/callback', $options, $settings);
30
-            if (filter_input(INPUT_POST, 'option_page') == Application::ID.'-settings') {
31
-                glsr(Notice::class)->addSuccess(__('Settings updated.', 'site-reviews'));
32
-            }
33
-            return $options;
34
-        }
35
-        return $input;
36
-    }
15
+	/**
16
+	 * @param mixed $input
17
+	 * @return array
18
+	 * @callback register_setting
19
+	 */
20
+	public function callbackRegisterSettings($input)
21
+	{
22
+		$settings = Arr::consolidateArray($input);
23
+		if (1 === count($settings) && array_key_exists('settings', $settings)) {
24
+			$options = array_replace_recursive(glsr(OptionManager::class)->all(), $input);
25
+			$options = $this->sanitizeGeneral($input, $options);
26
+			$options = $this->sanitizeLicenses($input, $options);
27
+			$options = $this->sanitizeSubmissions($input, $options);
28
+			$options = $this->sanitizeTranslations($input, $options);
29
+			$options = apply_filters('site-reviews/settings/callback', $options, $settings);
30
+			if (filter_input(INPUT_POST, 'option_page') == Application::ID.'-settings') {
31
+				glsr(Notice::class)->addSuccess(__('Settings updated.', 'site-reviews'));
32
+			}
33
+			return $options;
34
+		}
35
+		return $input;
36
+	}
37 37
 
38
-    /**
39
-     * @return void
40
-     * @action admin_init
41
-     */
42
-    public function registerSettings()
43
-    {
44
-        register_setting(Application::ID.'-settings', OptionManager::databaseKey(), [
45
-            'sanitize_callback' => [$this, 'callbackRegisterSettings'],
46
-        ]);
47
-    }
38
+	/**
39
+	 * @return void
40
+	 * @action admin_init
41
+	 */
42
+	public function registerSettings()
43
+	{
44
+		register_setting(Application::ID.'-settings', OptionManager::databaseKey(), [
45
+			'sanitize_callback' => [$this, 'callbackRegisterSettings'],
46
+		]);
47
+	}
48 48
 
49
-    /**
50
-     * @return array
51
-     */
52
-    protected function sanitizeGeneral(array $input, array $options)
53
-    {
54
-        $key = 'settings.general';
55
-        $inputForm = Arr::get($input, $key);
56
-        if (!$this->hasMultilingualIntegration(Arr::get($inputForm, 'multilingual'))) {
57
-            $options = Arr::set($options, $key.'.multilingual', '');
58
-        }
59
-        if ('' == trim(Arr::get($inputForm, 'notification_message'))) {
60
-            $defaultValue = Arr::get(glsr()->defaults, $key.'.notification_message');
61
-            $options = Arr::set($options, $key.'.notification_message', $defaultValue);
62
-        }
63
-        $defaultValue = Arr::get($inputForm, 'notifications', []);
64
-        $options = Arr::set($options, $key.'.notifications', $defaultValue);
65
-        return $options;
66
-    }
49
+	/**
50
+	 * @return array
51
+	 */
52
+	protected function sanitizeGeneral(array $input, array $options)
53
+	{
54
+		$key = 'settings.general';
55
+		$inputForm = Arr::get($input, $key);
56
+		if (!$this->hasMultilingualIntegration(Arr::get($inputForm, 'multilingual'))) {
57
+			$options = Arr::set($options, $key.'.multilingual', '');
58
+		}
59
+		if ('' == trim(Arr::get($inputForm, 'notification_message'))) {
60
+			$defaultValue = Arr::get(glsr()->defaults, $key.'.notification_message');
61
+			$options = Arr::set($options, $key.'.notification_message', $defaultValue);
62
+		}
63
+		$defaultValue = Arr::get($inputForm, 'notifications', []);
64
+		$options = Arr::set($options, $key.'.notifications', $defaultValue);
65
+		return $options;
66
+	}
67 67
 
68
-    /**
69
-     * @return array
70
-     */
71
-    protected function sanitizeLicenses(array $input, array $options)
72
-    {
73
-        $key = 'settings.licenses';
74
-        $licenses = Arr::consolidateArray(Arr::get($input, $key));
75
-        foreach ($licenses as $slug => &$license) {
76
-            if (empty($license)) {
77
-                continue;
78
-            }
79
-            $license = $this->verifyLicense($license, $slug);
80
-        }
81
-        $options = Arr::set($options, $key, $licenses);
82
-        return $options;
83
-    }
68
+	/**
69
+	 * @return array
70
+	 */
71
+	protected function sanitizeLicenses(array $input, array $options)
72
+	{
73
+		$key = 'settings.licenses';
74
+		$licenses = Arr::consolidateArray(Arr::get($input, $key));
75
+		foreach ($licenses as $slug => &$license) {
76
+			if (empty($license)) {
77
+				continue;
78
+			}
79
+			$license = $this->verifyLicense($license, $slug);
80
+		}
81
+		$options = Arr::set($options, $key, $licenses);
82
+		return $options;
83
+	}
84 84
 
85
-    /**
86
-     * @return array
87
-     */
88
-    protected function sanitizeSubmissions(array $input, array $options)
89
-    {
90
-        $key = 'settings.submissions';
91
-        $inputForm = Arr::get($input, $key);
92
-        $defaultValue = isset($inputForm['required'])
93
-            ? $inputForm['required']
94
-            : [];
95
-        $options = Arr::set($options, $key.'.required', $defaultValue);
96
-        return $options;
97
-    }
85
+	/**
86
+	 * @return array
87
+	 */
88
+	protected function sanitizeSubmissions(array $input, array $options)
89
+	{
90
+		$key = 'settings.submissions';
91
+		$inputForm = Arr::get($input, $key);
92
+		$defaultValue = isset($inputForm['required'])
93
+			? $inputForm['required']
94
+			: [];
95
+		$options = Arr::set($options, $key.'.required', $defaultValue);
96
+		return $options;
97
+	}
98 98
 
99
-    /**
100
-     * @return array
101
-     */
102
-    protected function sanitizeTranslations(array $input, array $options)
103
-    {
104
-        $key = 'settings.strings';
105
-        $inputForm = Arr::consolidateArray(Arr::get($input, $key));
106
-        if (!empty($inputForm)) {
107
-            $options = Arr::set($options, $key, array_values(array_filter($inputForm)));
108
-            $allowedTags = [
109
-                'a' => ['class' => [], 'href' => [], 'target' => []],
110
-                'span' => ['class' => []],
111
-            ];
112
-            array_walk($options['settings']['strings'], function (&$string) use ($allowedTags) {
113
-                if (isset($string['s2'])) {
114
-                    $string['s2'] = wp_kses($string['s2'], $allowedTags);
115
-                }
116
-                if (isset($string['p2'])) {
117
-                    $string['p2'] = wp_kses($string['p2'], $allowedTags);
118
-                }
119
-            });
120
-        }
121
-        return $options;
122
-    }
99
+	/**
100
+	 * @return array
101
+	 */
102
+	protected function sanitizeTranslations(array $input, array $options)
103
+	{
104
+		$key = 'settings.strings';
105
+		$inputForm = Arr::consolidateArray(Arr::get($input, $key));
106
+		if (!empty($inputForm)) {
107
+			$options = Arr::set($options, $key, array_values(array_filter($inputForm)));
108
+			$allowedTags = [
109
+				'a' => ['class' => [], 'href' => [], 'target' => []],
110
+				'span' => ['class' => []],
111
+			];
112
+			array_walk($options['settings']['strings'], function (&$string) use ($allowedTags) {
113
+				if (isset($string['s2'])) {
114
+					$string['s2'] = wp_kses($string['s2'], $allowedTags);
115
+				}
116
+				if (isset($string['p2'])) {
117
+					$string['p2'] = wp_kses($string['p2'], $allowedTags);
118
+				}
119
+			});
120
+		}
121
+		return $options;
122
+	}
123 123
 
124
-    /**
125
-     * @param string $integrationSlug
126
-     * @return bool
127
-     */
128
-    protected function hasMultilingualIntegration($integrationSlug)
129
-    {
130
-        $integration = glsr(Multilingual::class)->getIntegration($integrationSlug);
131
-        if (!$integration) {
132
-            return false;
133
-        }
134
-        if (!$integration->isActive()) {
135
-            glsr(Notice::class)->addError(sprintf(
136
-                __('Please install/activate the %s plugin to enable integration.', 'site-reviews'),
137
-                $integration->pluginName
138
-            ));
139
-            return false;
140
-        } elseif (!$integration->isSupported()) {
141
-            glsr(Notice::class)->addError(sprintf(
142
-                __('Please update the %s plugin to v%s or greater to enable integration.', 'site-reviews'),
143
-                $integration->pluginName,
144
-                $integration->supportedVersion
145
-            ));
146
-            return false;
147
-        }
148
-        return true;
149
-    }
124
+	/**
125
+	 * @param string $integrationSlug
126
+	 * @return bool
127
+	 */
128
+	protected function hasMultilingualIntegration($integrationSlug)
129
+	{
130
+		$integration = glsr(Multilingual::class)->getIntegration($integrationSlug);
131
+		if (!$integration) {
132
+			return false;
133
+		}
134
+		if (!$integration->isActive()) {
135
+			glsr(Notice::class)->addError(sprintf(
136
+				__('Please install/activate the %s plugin to enable integration.', 'site-reviews'),
137
+				$integration->pluginName
138
+			));
139
+			return false;
140
+		} elseif (!$integration->isSupported()) {
141
+			glsr(Notice::class)->addError(sprintf(
142
+				__('Please update the %s plugin to v%s or greater to enable integration.', 'site-reviews'),
143
+				$integration->pluginName,
144
+				$integration->supportedVersion
145
+			));
146
+			return false;
147
+		}
148
+		return true;
149
+	}
150 150
 
151
-    /**
152
-     * @param string $license
153
-     * @param string $slug
154
-     * @return string
155
-     */
156
-    protected function verifyLicense($license, $slug)
157
-    {
158
-        try {
159
-            $addon = glsr($slug);
160
-            $updater = new Updater($addon->update_url, $addon->file, [
161
-                'license' => $license,
162
-                'testedTo' => $addon->testedTo,
163
-            ]);
164
-            if (!$updater->isLicenseValid()) {
165
-                throw new Exception('Invalid license: '.$license.' ('.$addon->id.')');
166
-            }
167
-        } catch (Exception $e) {
168
-            $license = '';
169
-            glsr_log()->debug($e->getMessage());
170
-            glsr(Notice::class)->addError(__('A license you entered was invalid.', 'site-reviews'));
171
-        }
172
-        return $license;
173
-    }
151
+	/**
152
+	 * @param string $license
153
+	 * @param string $slug
154
+	 * @return string
155
+	 */
156
+	protected function verifyLicense($license, $slug)
157
+	{
158
+		try {
159
+			$addon = glsr($slug);
160
+			$updater = new Updater($addon->update_url, $addon->file, [
161
+				'license' => $license,
162
+				'testedTo' => $addon->testedTo,
163
+			]);
164
+			if (!$updater->isLicenseValid()) {
165
+				throw new Exception('Invalid license: '.$license.' ('.$addon->id.')');
166
+			}
167
+		} catch (Exception $e) {
168
+			$license = '';
169
+			glsr_log()->debug($e->getMessage());
170
+			glsr(Notice::class)->addError(__('A license you entered was invalid.', 'site-reviews'));
171
+		}
172
+		return $license;
173
+	}
174 174
 }
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -17,18 +17,18 @@  discard block
 block discarded – undo
17 17
      * @return array
18 18
      * @callback register_setting
19 19
      */
20
-    public function callbackRegisterSettings($input)
20
+    public function callbackRegisterSettings( $input )
21 21
     {
22
-        $settings = Arr::consolidateArray($input);
23
-        if (1 === count($settings) && array_key_exists('settings', $settings)) {
24
-            $options = array_replace_recursive(glsr(OptionManager::class)->all(), $input);
25
-            $options = $this->sanitizeGeneral($input, $options);
26
-            $options = $this->sanitizeLicenses($input, $options);
27
-            $options = $this->sanitizeSubmissions($input, $options);
28
-            $options = $this->sanitizeTranslations($input, $options);
29
-            $options = apply_filters('site-reviews/settings/callback', $options, $settings);
30
-            if (filter_input(INPUT_POST, 'option_page') == Application::ID.'-settings') {
31
-                glsr(Notice::class)->addSuccess(__('Settings updated.', 'site-reviews'));
22
+        $settings = Arr::consolidateArray( $input );
23
+        if( 1 === count( $settings ) && array_key_exists( 'settings', $settings ) ) {
24
+            $options = array_replace_recursive( glsr( OptionManager::class )->all(), $input );
25
+            $options = $this->sanitizeGeneral( $input, $options );
26
+            $options = $this->sanitizeLicenses( $input, $options );
27
+            $options = $this->sanitizeSubmissions( $input, $options );
28
+            $options = $this->sanitizeTranslations( $input, $options );
29
+            $options = apply_filters( 'site-reviews/settings/callback', $options, $settings );
30
+            if( filter_input( INPUT_POST, 'option_page' ) == Application::ID.'-settings' ) {
31
+                glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ) );
32 32
             }
33 33
             return $options;
34 34
         }
@@ -41,80 +41,80 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public function registerSettings()
43 43
     {
44
-        register_setting(Application::ID.'-settings', OptionManager::databaseKey(), [
44
+        register_setting( Application::ID.'-settings', OptionManager::databaseKey(), [
45 45
             'sanitize_callback' => [$this, 'callbackRegisterSettings'],
46
-        ]);
46
+        ] );
47 47
     }
48 48
 
49 49
     /**
50 50
      * @return array
51 51
      */
52
-    protected function sanitizeGeneral(array $input, array $options)
52
+    protected function sanitizeGeneral( array $input, array $options )
53 53
     {
54 54
         $key = 'settings.general';
55
-        $inputForm = Arr::get($input, $key);
56
-        if (!$this->hasMultilingualIntegration(Arr::get($inputForm, 'multilingual'))) {
57
-            $options = Arr::set($options, $key.'.multilingual', '');
55
+        $inputForm = Arr::get( $input, $key );
56
+        if( !$this->hasMultilingualIntegration( Arr::get( $inputForm, 'multilingual' ) ) ) {
57
+            $options = Arr::set( $options, $key.'.multilingual', '' );
58 58
         }
59
-        if ('' == trim(Arr::get($inputForm, 'notification_message'))) {
60
-            $defaultValue = Arr::get(glsr()->defaults, $key.'.notification_message');
61
-            $options = Arr::set($options, $key.'.notification_message', $defaultValue);
59
+        if( '' == trim( Arr::get( $inputForm, 'notification_message' ) ) ) {
60
+            $defaultValue = Arr::get( glsr()->defaults, $key.'.notification_message' );
61
+            $options = Arr::set( $options, $key.'.notification_message', $defaultValue );
62 62
         }
63
-        $defaultValue = Arr::get($inputForm, 'notifications', []);
64
-        $options = Arr::set($options, $key.'.notifications', $defaultValue);
63
+        $defaultValue = Arr::get( $inputForm, 'notifications', [] );
64
+        $options = Arr::set( $options, $key.'.notifications', $defaultValue );
65 65
         return $options;
66 66
     }
67 67
 
68 68
     /**
69 69
      * @return array
70 70
      */
71
-    protected function sanitizeLicenses(array $input, array $options)
71
+    protected function sanitizeLicenses( array $input, array $options )
72 72
     {
73 73
         $key = 'settings.licenses';
74
-        $licenses = Arr::consolidateArray(Arr::get($input, $key));
75
-        foreach ($licenses as $slug => &$license) {
76
-            if (empty($license)) {
74
+        $licenses = Arr::consolidateArray( Arr::get( $input, $key ) );
75
+        foreach( $licenses as $slug => &$license ) {
76
+            if( empty($license) ) {
77 77
                 continue;
78 78
             }
79
-            $license = $this->verifyLicense($license, $slug);
79
+            $license = $this->verifyLicense( $license, $slug );
80 80
         }
81
-        $options = Arr::set($options, $key, $licenses);
81
+        $options = Arr::set( $options, $key, $licenses );
82 82
         return $options;
83 83
     }
84 84
 
85 85
     /**
86 86
      * @return array
87 87
      */
88
-    protected function sanitizeSubmissions(array $input, array $options)
88
+    protected function sanitizeSubmissions( array $input, array $options )
89 89
     {
90 90
         $key = 'settings.submissions';
91
-        $inputForm = Arr::get($input, $key);
91
+        $inputForm = Arr::get( $input, $key );
92 92
         $defaultValue = isset($inputForm['required'])
93 93
             ? $inputForm['required']
94 94
             : [];
95
-        $options = Arr::set($options, $key.'.required', $defaultValue);
95
+        $options = Arr::set( $options, $key.'.required', $defaultValue );
96 96
         return $options;
97 97
     }
98 98
 
99 99
     /**
100 100
      * @return array
101 101
      */
102
-    protected function sanitizeTranslations(array $input, array $options)
102
+    protected function sanitizeTranslations( array $input, array $options )
103 103
     {
104 104
         $key = 'settings.strings';
105
-        $inputForm = Arr::consolidateArray(Arr::get($input, $key));
106
-        if (!empty($inputForm)) {
107
-            $options = Arr::set($options, $key, array_values(array_filter($inputForm)));
105
+        $inputForm = Arr::consolidateArray( Arr::get( $input, $key ) );
106
+        if( !empty($inputForm) ) {
107
+            $options = Arr::set( $options, $key, array_values( array_filter( $inputForm ) ) );
108 108
             $allowedTags = [
109 109
                 'a' => ['class' => [], 'href' => [], 'target' => []],
110 110
                 'span' => ['class' => []],
111 111
             ];
112
-            array_walk($options['settings']['strings'], function (&$string) use ($allowedTags) {
113
-                if (isset($string['s2'])) {
114
-                    $string['s2'] = wp_kses($string['s2'], $allowedTags);
112
+            array_walk( $options['settings']['strings'], function( &$string ) use ($allowedTags) {
113
+                if( isset($string['s2']) ) {
114
+                    $string['s2'] = wp_kses( $string['s2'], $allowedTags );
115 115
                 }
116
-                if (isset($string['p2'])) {
117
-                    $string['p2'] = wp_kses($string['p2'], $allowedTags);
116
+                if( isset($string['p2']) ) {
117
+                    $string['p2'] = wp_kses( $string['p2'], $allowedTags );
118 118
                 }
119 119
             });
120 120
         }
@@ -125,24 +125,24 @@  discard block
 block discarded – undo
125 125
      * @param string $integrationSlug
126 126
      * @return bool
127 127
      */
128
-    protected function hasMultilingualIntegration($integrationSlug)
128
+    protected function hasMultilingualIntegration( $integrationSlug )
129 129
     {
130
-        $integration = glsr(Multilingual::class)->getIntegration($integrationSlug);
131
-        if (!$integration) {
130
+        $integration = glsr( Multilingual::class )->getIntegration( $integrationSlug );
131
+        if( !$integration ) {
132 132
             return false;
133 133
         }
134
-        if (!$integration->isActive()) {
135
-            glsr(Notice::class)->addError(sprintf(
136
-                __('Please install/activate the %s plugin to enable integration.', 'site-reviews'),
134
+        if( !$integration->isActive() ) {
135
+            glsr( Notice::class )->addError( sprintf(
136
+                __( 'Please install/activate the %s plugin to enable integration.', 'site-reviews' ),
137 137
                 $integration->pluginName
138
-            ));
138
+            ) );
139 139
             return false;
140
-        } elseif (!$integration->isSupported()) {
141
-            glsr(Notice::class)->addError(sprintf(
142
-                __('Please update the %s plugin to v%s or greater to enable integration.', 'site-reviews'),
140
+        } elseif( !$integration->isSupported() ) {
141
+            glsr( Notice::class )->addError( sprintf(
142
+                __( 'Please update the %s plugin to v%s or greater to enable integration.', 'site-reviews' ),
143 143
                 $integration->pluginName,
144 144
                 $integration->supportedVersion
145
-            ));
145
+            ) );
146 146
             return false;
147 147
         }
148 148
         return true;
@@ -153,21 +153,21 @@  discard block
 block discarded – undo
153 153
      * @param string $slug
154 154
      * @return string
155 155
      */
156
-    protected function verifyLicense($license, $slug)
156
+    protected function verifyLicense( $license, $slug )
157 157
     {
158 158
         try {
159
-            $addon = glsr($slug);
160
-            $updater = new Updater($addon->update_url, $addon->file, [
159
+            $addon = glsr( $slug );
160
+            $updater = new Updater( $addon->update_url, $addon->file, [
161 161
                 'license' => $license,
162 162
                 'testedTo' => $addon->testedTo,
163
-            ]);
164
-            if (!$updater->isLicenseValid()) {
165
-                throw new Exception('Invalid license: '.$license.' ('.$addon->id.')');
163
+            ] );
164
+            if( !$updater->isLicenseValid() ) {
165
+                throw new Exception( 'Invalid license: '.$license.' ('.$addon->id.')' );
166 166
             }
167
-        } catch (Exception $e) {
167
+        } catch( Exception $e ) {
168 168
             $license = '';
169
-            glsr_log()->debug($e->getMessage());
170
-            glsr(Notice::class)->addError(__('A license you entered was invalid.', 'site-reviews'));
169
+            glsr_log()->debug( $e->getMessage() );
170
+            glsr( Notice::class )->addError( __( 'A license you entered was invalid.', 'site-reviews' ) );
171 171
         }
172 172
         return $license;
173 173
     }
Please login to merge, or discard this patch.
plugin/Reviews.php 2 patches
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -9,65 +9,65 @@
 block discarded – undo
9 9
 
10 10
 class Reviews extends ArrayObject
11 11
 {
12
-    /**
13
-     * @var array
14
-     */
15
-    public $args;
12
+	/**
13
+	 * @var array
14
+	 */
15
+	public $args;
16 16
 
17
-    /**
18
-     * @var int
19
-     */
20
-    public $max_num_pages;
17
+	/**
18
+	 * @var int
19
+	 */
20
+	public $max_num_pages;
21 21
 
22
-    /**
23
-     * @var array
24
-     */
25
-    public $reviews;
22
+	/**
23
+	 * @var array
24
+	 */
25
+	public $reviews;
26 26
 
27
-    public function __construct(array $reviews, $maxPageCount, array $args)
28
-    {
29
-        $this->args = $args;
30
-        $this->max_num_pages = $maxPageCount;
31
-        $this->reviews = $reviews;
32
-        parent::__construct($reviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS);
33
-    }
27
+	public function __construct(array $reviews, $maxPageCount, array $args)
28
+	{
29
+		$this->args = $args;
30
+		$this->max_num_pages = $maxPageCount;
31
+		$this->reviews = $reviews;
32
+		parent::__construct($reviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS);
33
+	}
34 34
 
35
-    /**
36
-     * @return string
37
-     */
38
-    public function __toString()
39
-    {
40
-        return (string) $this->build();
41
-    }
35
+	/**
36
+	 * @return string
37
+	 */
38
+	public function __toString()
39
+	{
40
+		return (string) $this->build();
41
+	}
42 42
 
43
-    /**
44
-     * @return ReviewsHtml
45
-     */
46
-    public function build()
47
-    {
48
-        $args = glsr(SiteReviewsDefaults::class)->merge($this->args);
49
-        return glsr(SiteReviewsPartial::class)->build($args, $this);
50
-    }
43
+	/**
44
+	 * @return ReviewsHtml
45
+	 */
46
+	public function build()
47
+	{
48
+		$args = glsr(SiteReviewsDefaults::class)->merge($this->args);
49
+		return glsr(SiteReviewsPartial::class)->build($args, $this);
50
+	}
51 51
 
52
-    /**
53
-     * @param mixed $key
54
-     * @return mixed
55
-     */
56
-    public function offsetGet($key)
57
-    {
58
-        if (array_key_exists($key, $this->reviews)) {
59
-            return $this->reviews[$key];
60
-        }
61
-        return property_exists($this, $key)
62
-            ? $this->$key
63
-            : null;
64
-    }
52
+	/**
53
+	 * @param mixed $key
54
+	 * @return mixed
55
+	 */
56
+	public function offsetGet($key)
57
+	{
58
+		if (array_key_exists($key, $this->reviews)) {
59
+			return $this->reviews[$key];
60
+		}
61
+		return property_exists($this, $key)
62
+			? $this->$key
63
+			: null;
64
+	}
65 65
 
66
-    /**
67
-     * @return void
68
-     */
69
-    public function render()
70
-    {
71
-        echo $this->build();
72
-    }
66
+	/**
67
+	 * @return void
68
+	 */
69
+	public function render()
70
+	{
71
+		echo $this->build();
72
+	}
73 73
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@  discard block
 block discarded – undo
24 24
      */
25 25
     public $reviews;
26 26
 
27
-    public function __construct(array $reviews, $maxPageCount, array $args)
27
+    public function __construct( array $reviews, $maxPageCount, array $args )
28 28
     {
29 29
         $this->args = $args;
30 30
         $this->max_num_pages = $maxPageCount;
31 31
         $this->reviews = $reviews;
32
-        parent::__construct($reviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS);
32
+        parent::__construct( $reviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS );
33 33
     }
34 34
 
35 35
     /**
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function __toString()
39 39
     {
40
-        return (string) $this->build();
40
+        return (string)$this->build();
41 41
     }
42 42
 
43 43
     /**
@@ -45,20 +45,20 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function build()
47 47
     {
48
-        $args = glsr(SiteReviewsDefaults::class)->merge($this->args);
49
-        return glsr(SiteReviewsPartial::class)->build($args, $this);
48
+        $args = glsr( SiteReviewsDefaults::class )->merge( $this->args );
49
+        return glsr( SiteReviewsPartial::class )->build( $args, $this );
50 50
     }
51 51
 
52 52
     /**
53 53
      * @param mixed $key
54 54
      * @return mixed
55 55
      */
56
-    public function offsetGet($key)
56
+    public function offsetGet( $key )
57 57
     {
58
-        if (array_key_exists($key, $this->reviews)) {
58
+        if( array_key_exists( $key, $this->reviews ) ) {
59 59
             return $this->reviews[$key];
60 60
         }
61
-        return property_exists($this, $key)
61
+        return property_exists( $this, $key )
62 62
             ? $this->$key
63 63
             : null;
64 64
     }
Please login to merge, or discard this patch.