Passed
Push — master ( 7d5ba1...710a9f )
by Paul
04:43
created
plugin/Modules/Blacklist.php 2 patches
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -6,54 +6,54 @@
 block discarded – undo
6 6
 
7 7
 class Blacklist
8 8
 {
9
-    /**
10
-     * @return bool
11
-     */
12
-    public function isBlacklisted(array $review)
13
-    {
14
-        $target = implode("\n", array_filter([
15
-            $review['name'],
16
-            $review['content'],
17
-            $review['email'],
18
-            $review['ip_address'],
19
-            $review['title'],
20
-        ]));
21
-        return (bool) apply_filters('site-reviews/blacklist/is-blacklisted',
22
-            $this->check($target),
23
-            $review,
24
-            $target
25
-        );
26
-    }
9
+	/**
10
+	 * @return bool
11
+	 */
12
+	public function isBlacklisted(array $review)
13
+	{
14
+		$target = implode("\n", array_filter([
15
+			$review['name'],
16
+			$review['content'],
17
+			$review['email'],
18
+			$review['ip_address'],
19
+			$review['title'],
20
+		]));
21
+		return (bool) apply_filters('site-reviews/blacklist/is-blacklisted',
22
+			$this->check($target),
23
+			$review,
24
+			$target
25
+		);
26
+	}
27 27
 
28
-    /**
29
-     * @param string $target
30
-     * @return bool
31
-     */
32
-    protected function check($target)
33
-    {
34
-        $blacklist = $this->getBlacklist();
35
-        if (empty($blacklist)) {
36
-            return false;
37
-        }
38
-        $lines = explode("\n", $blacklist);
39
-        foreach ((array) $lines as $line) {
40
-            $line = trim($line);
41
-            if (empty($line) || 256 < strlen($line)) {
42
-                continue;
43
-            }
44
-            $pattern = sprintf('#%s#i', preg_quote($line, '#'));
45
-            if (preg_match($pattern, $target)) {
46
-                return true;
47
-            }
48
-        }
49
-        return false;
50
-    }
28
+	/**
29
+	 * @param string $target
30
+	 * @return bool
31
+	 */
32
+	protected function check($target)
33
+	{
34
+		$blacklist = $this->getBlacklist();
35
+		if (empty($blacklist)) {
36
+			return false;
37
+		}
38
+		$lines = explode("\n", $blacklist);
39
+		foreach ((array) $lines as $line) {
40
+			$line = trim($line);
41
+			if (empty($line) || 256 < strlen($line)) {
42
+				continue;
43
+			}
44
+			$pattern = sprintf('#%s#i', preg_quote($line, '#'));
45
+			if (preg_match($pattern, $target)) {
46
+				return true;
47
+			}
48
+		}
49
+		return false;
50
+	}
51 51
 
52
-    protected function getBlacklist()
53
-    {
54
-        $option = glsr(OptionManager::class)->get('settings.submissions.blacklist.integration');
55
-        return $option == 'comments'
56
-            ? trim(glsr(OptionManager::class)->getWP('blacklist_keys'))
57
-            : trim(glsr(OptionManager::class)->get('settings.submissions.blacklist.entries'));
58
-    }
52
+	protected function getBlacklist()
53
+	{
54
+		$option = glsr(OptionManager::class)->get('settings.submissions.blacklist.integration');
55
+		return $option == 'comments'
56
+			? trim(glsr(OptionManager::class)->getWP('blacklist_keys'))
57
+			: trim(glsr(OptionManager::class)->get('settings.submissions.blacklist.entries'));
58
+	}
59 59
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -9,17 +9,17 @@  discard block
 block discarded – undo
9 9
     /**
10 10
      * @return bool
11 11
      */
12
-    public function isBlacklisted(array $review)
12
+    public function isBlacklisted( array $review )
13 13
     {
14
-        $target = implode("\n", array_filter([
14
+        $target = implode( "\n", array_filter( [
15 15
             $review['name'],
16 16
             $review['content'],
17 17
             $review['email'],
18 18
             $review['ip_address'],
19 19
             $review['title'],
20
-        ]));
21
-        return (bool) apply_filters('site-reviews/blacklist/is-blacklisted',
22
-            $this->check($target),
20
+        ] ) );
21
+        return (bool)apply_filters( 'site-reviews/blacklist/is-blacklisted',
22
+            $this->check( $target ),
23 23
             $review,
24 24
             $target
25 25
         );
@@ -29,20 +29,20 @@  discard block
 block discarded – undo
29 29
      * @param string $target
30 30
      * @return bool
31 31
      */
32
-    protected function check($target)
32
+    protected function check( $target )
33 33
     {
34 34
         $blacklist = $this->getBlacklist();
35
-        if (empty($blacklist)) {
35
+        if( empty($blacklist) ) {
36 36
             return false;
37 37
         }
38
-        $lines = explode("\n", $blacklist);
39
-        foreach ((array) $lines as $line) {
40
-            $line = trim($line);
41
-            if (empty($line) || 256 < strlen($line)) {
38
+        $lines = explode( "\n", $blacklist );
39
+        foreach( (array)$lines as $line ) {
40
+            $line = trim( $line );
41
+            if( empty($line) || 256 < strlen( $line ) ) {
42 42
                 continue;
43 43
             }
44
-            $pattern = sprintf('#%s#i', preg_quote($line, '#'));
45
-            if (preg_match($pattern, $target)) {
44
+            $pattern = sprintf( '#%s#i', preg_quote( $line, '#' ) );
45
+            if( preg_match( $pattern, $target ) ) {
46 46
                 return true;
47 47
             }
48 48
         }
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
 
52 52
     protected function getBlacklist()
53 53
     {
54
-        $option = glsr(OptionManager::class)->get('settings.submissions.blacklist.integration');
54
+        $option = glsr( OptionManager::class )->get( 'settings.submissions.blacklist.integration' );
55 55
         return $option == 'comments'
56
-            ? trim(glsr(OptionManager::class)->getWP('blacklist_keys'))
57
-            : trim(glsr(OptionManager::class)->get('settings.submissions.blacklist.entries'));
56
+            ? trim( glsr( OptionManager::class )->getWP( 'blacklist_keys' ) )
57
+            : trim( glsr( OptionManager::class )->get( 'settings.submissions.blacklist.entries' ) );
58 58
     }
59 59
 }
Please login to merge, or discard this patch.
plugin/Modules/Notification.php 2 patches
Indentation   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -8,164 +8,164 @@
 block discarded – undo
8 8
 
9 9
 class Notification
10 10
 {
11
-    /**
12
-     * @var bool
13
-     */
14
-    protected $email;
11
+	/**
12
+	 * @var bool
13
+	 */
14
+	protected $email;
15 15
 
16
-    /**
17
-     * @var Review
18
-     */
19
-    protected $review;
16
+	/**
17
+	 * @var Review
18
+	 */
19
+	protected $review;
20 20
 
21
-    /**
22
-     * @var bool
23
-     */
24
-    protected $slack;
21
+	/**
22
+	 * @var bool
23
+	 */
24
+	protected $slack;
25 25
 
26
-    /**
27
-     * @var array
28
-     */
29
-    protected $types;
26
+	/**
27
+	 * @var array
28
+	 */
29
+	protected $types;
30 30
 
31
-    public function __construct()
32
-    {
33
-        $types = glsr(OptionManager::class)->get('settings.general.notifications', []);
34
-        $this->email = count(array_intersect(['admin', 'custom'], $types)) > 0;
35
-        $this->slack = in_array('slack', $types);
36
-        $this->types = $types;
37
-    }
31
+	public function __construct()
32
+	{
33
+		$types = glsr(OptionManager::class)->get('settings.general.notifications', []);
34
+		$this->email = count(array_intersect(['admin', 'custom'], $types)) > 0;
35
+		$this->slack = in_array('slack', $types);
36
+		$this->types = $types;
37
+	}
38 38
 
39
-    /**
40
-     * @return void
41
-     */
42
-    public function send(Review $review)
43
-    {
44
-        if (empty($this->types)) {
45
-            return;
46
-        }
47
-        $this->review = $review;
48
-        $args = [
49
-            'link' => $this->getLink(),
50
-            'title' => $this->getTitle(),
51
-        ];
52
-        $this->sendToEmail($args);
53
-        $this->sendToSlack($args);
54
-    }
39
+	/**
40
+	 * @return void
41
+	 */
42
+	public function send(Review $review)
43
+	{
44
+		if (empty($this->types)) {
45
+			return;
46
+		}
47
+		$this->review = $review;
48
+		$args = [
49
+			'link' => $this->getLink(),
50
+			'title' => $this->getTitle(),
51
+		];
52
+		$this->sendToEmail($args);
53
+		$this->sendToSlack($args);
54
+	}
55 55
 
56
-    /**
57
-     * @return Email
58
-     */
59
-    protected function buildEmail(array $args)
60
-    {
61
-        return glsr(Email::class)->compose([
62
-            'to' => $this->getEmailAddresses(),
63
-            'subject' => $args['title'],
64
-            'template' => 'email-notification',
65
-            'template-tags' => [
66
-                'review_author' => $this->review->author ?: __('Anonymous', 'site-reviews'),
67
-                'review_content' => $this->review->content,
68
-                'review_email' => $this->review->email,
69
-                'review_ip' => $this->review->ip_address,
70
-                'review_link' => sprintf('<a href="%1$s">%1$s</a>', $args['link']),
71
-                'review_rating' => $this->review->rating,
72
-                'review_title' => $this->review->title,
73
-            ],
74
-        ]);
75
-    }
56
+	/**
57
+	 * @return Email
58
+	 */
59
+	protected function buildEmail(array $args)
60
+	{
61
+		return glsr(Email::class)->compose([
62
+			'to' => $this->getEmailAddresses(),
63
+			'subject' => $args['title'],
64
+			'template' => 'email-notification',
65
+			'template-tags' => [
66
+				'review_author' => $this->review->author ?: __('Anonymous', 'site-reviews'),
67
+				'review_content' => $this->review->content,
68
+				'review_email' => $this->review->email,
69
+				'review_ip' => $this->review->ip_address,
70
+				'review_link' => sprintf('<a href="%1$s">%1$s</a>', $args['link']),
71
+				'review_rating' => $this->review->rating,
72
+				'review_title' => $this->review->title,
73
+			],
74
+		]);
75
+	}
76 76
 
77
-    /**
78
-     * @return Slack
79
-     */
80
-    protected function buildSlackNotification(array $args)
81
-    {
82
-        return glsr(Slack::class)->compose($this->review, [
83
-            'button_url' => $args['link'],
84
-            'fallback' => $this->buildEmail($args)->read('plaintext'),
85
-            'pretext' => $args['title'],
86
-        ]);
87
-    }
77
+	/**
78
+	 * @return Slack
79
+	 */
80
+	protected function buildSlackNotification(array $args)
81
+	{
82
+		return glsr(Slack::class)->compose($this->review, [
83
+			'button_url' => $args['link'],
84
+			'fallback' => $this->buildEmail($args)->read('plaintext'),
85
+			'pretext' => $args['title'],
86
+		]);
87
+	}
88 88
 
89
-    /**
90
-     * @return array
91
-     */
92
-    protected function getEmailAddresses()
93
-    {
94
-        $emails = [];
95
-        if (in_array('admin', $this->types)) {
96
-            $emails[] = glsr(OptionManager::class)->getWP('admin_email');
97
-        }
98
-        if (in_array('author', $this->types)) {
99
-            $assignedPost = get_post(intval($this->review->assigned_to));
100
-            if ($assignedPost instanceof WP_Post) {
101
-                $this->email = true;
102
-                $emails[] = get_the_author_meta('user_email', intval($assignedPost->post_author));
103
-            }
104
-        }
105
-        if (in_array('custom', $this->types)) {
106
-            $customEmails = glsr(OptionManager::class)->get('settings.general.notification_email');
107
-            $customEmails = str_replace([' ', ',', ';'], ',', $customEmails);
108
-            $customEmails = explode(',', $customEmails);
109
-            $emails = array_merge($emails, $customEmails);
110
-        }
111
-        $emails = array_filter(array_keys(array_flip($emails)));
112
-        return apply_filters('site-reviews/notification/emails', $emails, $this->review);
113
-    }
89
+	/**
90
+	 * @return array
91
+	 */
92
+	protected function getEmailAddresses()
93
+	{
94
+		$emails = [];
95
+		if (in_array('admin', $this->types)) {
96
+			$emails[] = glsr(OptionManager::class)->getWP('admin_email');
97
+		}
98
+		if (in_array('author', $this->types)) {
99
+			$assignedPost = get_post(intval($this->review->assigned_to));
100
+			if ($assignedPost instanceof WP_Post) {
101
+				$this->email = true;
102
+				$emails[] = get_the_author_meta('user_email', intval($assignedPost->post_author));
103
+			}
104
+		}
105
+		if (in_array('custom', $this->types)) {
106
+			$customEmails = glsr(OptionManager::class)->get('settings.general.notification_email');
107
+			$customEmails = str_replace([' ', ',', ';'], ',', $customEmails);
108
+			$customEmails = explode(',', $customEmails);
109
+			$emails = array_merge($emails, $customEmails);
110
+		}
111
+		$emails = array_filter(array_keys(array_flip($emails)));
112
+		return apply_filters('site-reviews/notification/emails', $emails, $this->review);
113
+	}
114 114
 
115
-    /**
116
-     * @return string
117
-     */
118
-    protected function getLink()
119
-    {
120
-        return admin_url('post.php?post='.$this->review->ID.'&action=edit');
121
-    }
115
+	/**
116
+	 * @return string
117
+	 */
118
+	protected function getLink()
119
+	{
120
+		return admin_url('post.php?post='.$this->review->ID.'&action=edit');
121
+	}
122 122
 
123
-    /**
124
-     * @return string
125
-     */
126
-    protected function getTitle()
127
-    {
128
-        $assignedTitle = get_the_title(intval($this->review->assigned_to));
129
-        $title = _nx(
130
-            'New %s-star review',
131
-            'New %s-star review of: %s',
132
-            intval(empty($assignedTitle)),
133
-            'This string differs depending on whether or not the review has been assigned to a post.',
134
-            'site-reviews'
135
-        );
136
-        $title = sprintf('[%s] %s',
137
-            wp_specialchars_decode(glsr(OptionManager::class)->getWP('blogname'), ENT_QUOTES),
138
-            sprintf($title, $this->review->rating, $assignedTitle)
139
-        );
140
-        return apply_filters('site-reviews/notification/title', $title, $this->review);
141
-    }
123
+	/**
124
+	 * @return string
125
+	 */
126
+	protected function getTitle()
127
+	{
128
+		$assignedTitle = get_the_title(intval($this->review->assigned_to));
129
+		$title = _nx(
130
+			'New %s-star review',
131
+			'New %s-star review of: %s',
132
+			intval(empty($assignedTitle)),
133
+			'This string differs depending on whether or not the review has been assigned to a post.',
134
+			'site-reviews'
135
+		);
136
+		$title = sprintf('[%s] %s',
137
+			wp_specialchars_decode(glsr(OptionManager::class)->getWP('blogname'), ENT_QUOTES),
138
+			sprintf($title, $this->review->rating, $assignedTitle)
139
+		);
140
+		return apply_filters('site-reviews/notification/title', $title, $this->review);
141
+	}
142 142
 
143
-    /**
144
-     * @return void
145
-     */
146
-    protected function sendToEmail(array $args)
147
-    {
148
-        $email = $this->buildEmail($args);
149
-        if (empty($email->to)) {
150
-            glsr_log()->error('Email notification was not sent (missing email address)');
151
-            return;
152
-        }
153
-        $email->send();
154
-    }
143
+	/**
144
+	 * @return void
145
+	 */
146
+	protected function sendToEmail(array $args)
147
+	{
148
+		$email = $this->buildEmail($args);
149
+		if (empty($email->to)) {
150
+			glsr_log()->error('Email notification was not sent (missing email address)');
151
+			return;
152
+		}
153
+		$email->send();
154
+	}
155 155
 
156
-    /**
157
-     * @return void
158
-     */
159
-    protected function sendToSlack(array $args)
160
-    {
161
-        if (!$this->slack) {
162
-            return;
163
-        }
164
-        $notification = $this->buildSlackNotification($args);
165
-        $result = $notification->send();
166
-        if (is_wp_error($result)) {
167
-            $notification->review = null;
168
-            glsr_log()->error($result->get_error_message())->debug($notification);
169
-        }
170
-    }
156
+	/**
157
+	 * @return void
158
+	 */
159
+	protected function sendToSlack(array $args)
160
+	{
161
+		if (!$this->slack) {
162
+			return;
163
+		}
164
+		$notification = $this->buildSlackNotification($args);
165
+		$result = $notification->send();
166
+		if (is_wp_error($result)) {
167
+			$notification->review = null;
168
+			glsr_log()->error($result->get_error_message())->debug($notification);
169
+		}
170
+	}
171 171
 }
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
 
31 31
     public function __construct()
32 32
     {
33
-        $types = glsr(OptionManager::class)->get('settings.general.notifications', []);
34
-        $this->email = count(array_intersect(['admin', 'custom'], $types)) > 0;
35
-        $this->slack = in_array('slack', $types);
33
+        $types = glsr( OptionManager::class )->get( 'settings.general.notifications', [] );
34
+        $this->email = count( array_intersect( ['admin', 'custom'], $types ) ) > 0;
35
+        $this->slack = in_array( 'slack', $types );
36 36
         $this->types = $types;
37 37
     }
38 38
 
39 39
     /**
40 40
      * @return void
41 41
      */
42
-    public function send(Review $review)
42
+    public function send( Review $review )
43 43
     {
44
-        if (empty($this->types)) {
44
+        if( empty($this->types) ) {
45 45
             return;
46 46
         }
47 47
         $this->review = $review;
@@ -49,41 +49,41 @@  discard block
 block discarded – undo
49 49
             'link' => $this->getLink(),
50 50
             'title' => $this->getTitle(),
51 51
         ];
52
-        $this->sendToEmail($args);
53
-        $this->sendToSlack($args);
52
+        $this->sendToEmail( $args );
53
+        $this->sendToSlack( $args );
54 54
     }
55 55
 
56 56
     /**
57 57
      * @return Email
58 58
      */
59
-    protected function buildEmail(array $args)
59
+    protected function buildEmail( array $args )
60 60
     {
61
-        return glsr(Email::class)->compose([
61
+        return glsr( Email::class )->compose( [
62 62
             'to' => $this->getEmailAddresses(),
63 63
             'subject' => $args['title'],
64 64
             'template' => 'email-notification',
65 65
             'template-tags' => [
66
-                'review_author' => $this->review->author ?: __('Anonymous', 'site-reviews'),
66
+                'review_author' => $this->review->author ?: __( 'Anonymous', 'site-reviews' ),
67 67
                 'review_content' => $this->review->content,
68 68
                 'review_email' => $this->review->email,
69 69
                 'review_ip' => $this->review->ip_address,
70
-                'review_link' => sprintf('<a href="%1$s">%1$s</a>', $args['link']),
70
+                'review_link' => sprintf( '<a href="%1$s">%1$s</a>', $args['link'] ),
71 71
                 'review_rating' => $this->review->rating,
72 72
                 'review_title' => $this->review->title,
73 73
             ],
74
-        ]);
74
+        ] );
75 75
     }
76 76
 
77 77
     /**
78 78
      * @return Slack
79 79
      */
80
-    protected function buildSlackNotification(array $args)
80
+    protected function buildSlackNotification( array $args )
81 81
     {
82
-        return glsr(Slack::class)->compose($this->review, [
82
+        return glsr( Slack::class )->compose( $this->review, [
83 83
             'button_url' => $args['link'],
84
-            'fallback' => $this->buildEmail($args)->read('plaintext'),
84
+            'fallback' => $this->buildEmail( $args )->read( 'plaintext' ),
85 85
             'pretext' => $args['title'],
86
-        ]);
86
+        ] );
87 87
     }
88 88
 
89 89
     /**
@@ -92,24 +92,24 @@  discard block
 block discarded – undo
92 92
     protected function getEmailAddresses()
93 93
     {
94 94
         $emails = [];
95
-        if (in_array('admin', $this->types)) {
96
-            $emails[] = glsr(OptionManager::class)->getWP('admin_email');
95
+        if( in_array( 'admin', $this->types ) ) {
96
+            $emails[] = glsr( OptionManager::class )->getWP( 'admin_email' );
97 97
         }
98
-        if (in_array('author', $this->types)) {
99
-            $assignedPost = get_post(intval($this->review->assigned_to));
100
-            if ($assignedPost instanceof WP_Post) {
98
+        if( in_array( 'author', $this->types ) ) {
99
+            $assignedPost = get_post( intval( $this->review->assigned_to ) );
100
+            if( $assignedPost instanceof WP_Post ) {
101 101
                 $this->email = true;
102
-                $emails[] = get_the_author_meta('user_email', intval($assignedPost->post_author));
102
+                $emails[] = get_the_author_meta( 'user_email', intval( $assignedPost->post_author ) );
103 103
             }
104 104
         }
105
-        if (in_array('custom', $this->types)) {
106
-            $customEmails = glsr(OptionManager::class)->get('settings.general.notification_email');
107
-            $customEmails = str_replace([' ', ',', ';'], ',', $customEmails);
108
-            $customEmails = explode(',', $customEmails);
109
-            $emails = array_merge($emails, $customEmails);
105
+        if( in_array( 'custom', $this->types ) ) {
106
+            $customEmails = glsr( OptionManager::class )->get( 'settings.general.notification_email' );
107
+            $customEmails = str_replace( [' ', ',', ';'], ',', $customEmails );
108
+            $customEmails = explode( ',', $customEmails );
109
+            $emails = array_merge( $emails, $customEmails );
110 110
         }
111
-        $emails = array_filter(array_keys(array_flip($emails)));
112
-        return apply_filters('site-reviews/notification/emails', $emails, $this->review);
111
+        $emails = array_filter( array_keys( array_flip( $emails ) ) );
112
+        return apply_filters( 'site-reviews/notification/emails', $emails, $this->review );
113 113
     }
114 114
 
115 115
     /**
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      */
118 118
     protected function getLink()
119 119
     {
120
-        return admin_url('post.php?post='.$this->review->ID.'&action=edit');
120
+        return admin_url( 'post.php?post='.$this->review->ID.'&action=edit' );
121 121
     }
122 122
 
123 123
     /**
@@ -125,29 +125,29 @@  discard block
 block discarded – undo
125 125
      */
126 126
     protected function getTitle()
127 127
     {
128
-        $assignedTitle = get_the_title(intval($this->review->assigned_to));
128
+        $assignedTitle = get_the_title( intval( $this->review->assigned_to ) );
129 129
         $title = _nx(
130 130
             'New %s-star review',
131 131
             'New %s-star review of: %s',
132
-            intval(empty($assignedTitle)),
132
+            intval( empty($assignedTitle) ),
133 133
             'This string differs depending on whether or not the review has been assigned to a post.',
134 134
             'site-reviews'
135 135
         );
136
-        $title = sprintf('[%s] %s',
137
-            wp_specialchars_decode(glsr(OptionManager::class)->getWP('blogname'), ENT_QUOTES),
138
-            sprintf($title, $this->review->rating, $assignedTitle)
136
+        $title = sprintf( '[%s] %s',
137
+            wp_specialchars_decode( glsr( OptionManager::class )->getWP( 'blogname' ), ENT_QUOTES ),
138
+            sprintf( $title, $this->review->rating, $assignedTitle )
139 139
         );
140
-        return apply_filters('site-reviews/notification/title', $title, $this->review);
140
+        return apply_filters( 'site-reviews/notification/title', $title, $this->review );
141 141
     }
142 142
 
143 143
     /**
144 144
      * @return void
145 145
      */
146
-    protected function sendToEmail(array $args)
146
+    protected function sendToEmail( array $args )
147 147
     {
148
-        $email = $this->buildEmail($args);
149
-        if (empty($email->to)) {
150
-            glsr_log()->error('Email notification was not sent (missing email address)');
148
+        $email = $this->buildEmail( $args );
149
+        if( empty($email->to) ) {
150
+            glsr_log()->error( 'Email notification was not sent (missing email address)' );
151 151
             return;
152 152
         }
153 153
         $email->send();
@@ -156,16 +156,16 @@  discard block
 block discarded – undo
156 156
     /**
157 157
      * @return void
158 158
      */
159
-    protected function sendToSlack(array $args)
159
+    protected function sendToSlack( array $args )
160 160
     {
161
-        if (!$this->slack) {
161
+        if( !$this->slack ) {
162 162
             return;
163 163
         }
164
-        $notification = $this->buildSlackNotification($args);
164
+        $notification = $this->buildSlackNotification( $args );
165 165
         $result = $notification->send();
166
-        if (is_wp_error($result)) {
166
+        if( is_wp_error( $result ) ) {
167 167
             $notification->review = null;
168
-            glsr_log()->error($result->get_error_message())->debug($notification);
168
+            glsr_log()->error( $result->get_error_message() )->debug( $notification );
169 169
         }
170 170
     }
171 171
 }
Please login to merge, or discard this patch.
plugin/Controllers/EditorController/Customization.php 2 patches
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -7,84 +7,84 @@
 block discarded – undo
7 7
 
8 8
 class Customization
9 9
 {
10
-    /**
11
-     * @return array
12
-     */
13
-    public function filterEditorSettings(array $settings)
14
-    {
15
-        if ($this->isReviewEditable()) {
16
-            $settings = [
17
-                'media_buttons' => false,
18
-                'quicktags' => false,
19
-                'textarea_rows' => 12,
20
-                'tinymce' => false,
21
-            ];
22
-        }
23
-        return $settings;
24
-    }
10
+	/**
11
+	 * @return array
12
+	 */
13
+	public function filterEditorSettings(array $settings)
14
+	{
15
+		if ($this->isReviewEditable()) {
16
+			$settings = [
17
+				'media_buttons' => false,
18
+				'quicktags' => false,
19
+				'textarea_rows' => 12,
20
+				'tinymce' => false,
21
+			];
22
+		}
23
+		return $settings;
24
+	}
25 25
 
26
-    /**
27
-     * @param string $html
28
-     * @return string
29
-     */
30
-    public function filterEditorTextarea($html)
31
-    {
32
-        if ($this->isReviewEditable()) {
33
-            $html = str_replace('<textarea', '<div id="ed_toolbar"></div><textarea', $html);
34
-        }
35
-        return $html;
36
-    }
26
+	/**
27
+	 * @param string $html
28
+	 * @return string
29
+	 */
30
+	public function filterEditorTextarea($html)
31
+	{
32
+		if ($this->isReviewEditable()) {
33
+			$html = str_replace('<textarea', '<div id="ed_toolbar"></div><textarea', $html);
34
+		}
35
+		return $html;
36
+	}
37 37
 
38
-    /**
39
-     * @return void
40
-     */
41
-    public function removeAutosave()
42
-    {
43
-        if (!$this->isReviewEditor() || $this->isReviewEditable()) {
44
-            return;
45
-        }
46
-        wp_deregister_script('autosave');
47
-    }
38
+	/**
39
+	 * @return void
40
+	 */
41
+	public function removeAutosave()
42
+	{
43
+		if (!$this->isReviewEditor() || $this->isReviewEditable()) {
44
+			return;
45
+		}
46
+		wp_deregister_script('autosave');
47
+	}
48 48
 
49
-    /**
50
-     * @return void
51
-     */
52
-    public function removeMetaBoxes()
53
-    {
54
-        remove_meta_box('slugdiv', Application::POST_TYPE, 'advanced');
55
-    }
49
+	/**
50
+	 * @return void
51
+	 */
52
+	public function removeMetaBoxes()
53
+	{
54
+		remove_meta_box('slugdiv', Application::POST_TYPE, 'advanced');
55
+	}
56 56
 
57
-    /**
58
-     * @return void
59
-     */
60
-    public function removePostTypeSupport()
61
-    {
62
-        if (!$this->isReviewEditor() || $this->isReviewEditable()) {
63
-            return;
64
-        }
65
-        remove_post_type_support(Application::POST_TYPE, 'title');
66
-        remove_post_type_support(Application::POST_TYPE, 'editor');
67
-    }
57
+	/**
58
+	 * @return void
59
+	 */
60
+	public function removePostTypeSupport()
61
+	{
62
+		if (!$this->isReviewEditor() || $this->isReviewEditable()) {
63
+			return;
64
+		}
65
+		remove_post_type_support(Application::POST_TYPE, 'title');
66
+		remove_post_type_support(Application::POST_TYPE, 'editor');
67
+	}
68 68
 
69
-    /**
70
-     * @return bool
71
-     */
72
-    protected function isReviewEditable()
73
-    {
74
-        $postId = intval(filter_input(INPUT_GET, 'post'));
75
-        return $postId > 0
76
-            && 'local' == glsr(Database::class)->get($postId, 'review_type')
77
-            && $this->isReviewEditor();
78
-    }
69
+	/**
70
+	 * @return bool
71
+	 */
72
+	protected function isReviewEditable()
73
+	{
74
+		$postId = intval(filter_input(INPUT_GET, 'post'));
75
+		return $postId > 0
76
+			&& 'local' == glsr(Database::class)->get($postId, 'review_type')
77
+			&& $this->isReviewEditor();
78
+	}
79 79
 
80
-    /**
81
-     * @return bool
82
-     */
83
-    protected function isReviewEditor()
84
-    {
85
-        $screen = glsr_current_screen();
86
-        return 'post' == $screen->base
87
-            && Application::POST_TYPE == $screen->id
88
-            && Application::POST_TYPE == $screen->post_type;
89
-    }
80
+	/**
81
+	 * @return bool
82
+	 */
83
+	protected function isReviewEditor()
84
+	{
85
+		$screen = glsr_current_screen();
86
+		return 'post' == $screen->base
87
+			&& Application::POST_TYPE == $screen->id
88
+			&& Application::POST_TYPE == $screen->post_type;
89
+	}
90 90
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -10,9 +10,9 @@  discard block
 block discarded – undo
10 10
     /**
11 11
      * @return array
12 12
      */
13
-    public function filterEditorSettings(array $settings)
13
+    public function filterEditorSettings( array $settings )
14 14
     {
15
-        if ($this->isReviewEditable()) {
15
+        if( $this->isReviewEditable() ) {
16 16
             $settings = [
17 17
                 'media_buttons' => false,
18 18
                 'quicktags' => false,
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
      * @param string $html
28 28
      * @return string
29 29
      */
30
-    public function filterEditorTextarea($html)
30
+    public function filterEditorTextarea( $html )
31 31
     {
32
-        if ($this->isReviewEditable()) {
33
-            $html = str_replace('<textarea', '<div id="ed_toolbar"></div><textarea', $html);
32
+        if( $this->isReviewEditable() ) {
33
+            $html = str_replace( '<textarea', '<div id="ed_toolbar"></div><textarea', $html );
34 34
         }
35 35
         return $html;
36 36
     }
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public function removeAutosave()
42 42
     {
43
-        if (!$this->isReviewEditor() || $this->isReviewEditable()) {
43
+        if( !$this->isReviewEditor() || $this->isReviewEditable() ) {
44 44
             return;
45 45
         }
46
-        wp_deregister_script('autosave');
46
+        wp_deregister_script( 'autosave' );
47 47
     }
48 48
 
49 49
     /**
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      */
52 52
     public function removeMetaBoxes()
53 53
     {
54
-        remove_meta_box('slugdiv', Application::POST_TYPE, 'advanced');
54
+        remove_meta_box( 'slugdiv', Application::POST_TYPE, 'advanced' );
55 55
     }
56 56
 
57 57
     /**
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
      */
60 60
     public function removePostTypeSupport()
61 61
     {
62
-        if (!$this->isReviewEditor() || $this->isReviewEditable()) {
62
+        if( !$this->isReviewEditor() || $this->isReviewEditable() ) {
63 63
             return;
64 64
         }
65
-        remove_post_type_support(Application::POST_TYPE, 'title');
66
-        remove_post_type_support(Application::POST_TYPE, 'editor');
65
+        remove_post_type_support( Application::POST_TYPE, 'title' );
66
+        remove_post_type_support( Application::POST_TYPE, 'editor' );
67 67
     }
68 68
 
69 69
     /**
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
      */
72 72
     protected function isReviewEditable()
73 73
     {
74
-        $postId = intval(filter_input(INPUT_GET, 'post'));
74
+        $postId = intval( filter_input( INPUT_GET, 'post' ) );
75 75
         return $postId > 0
76
-            && 'local' == glsr(Database::class)->get($postId, 'review_type')
76
+            && 'local' == glsr( Database::class )->get( $postId, 'review_type' )
77 77
             && $this->isReviewEditor();
78 78
     }
79 79
 
Please login to merge, or discard this patch.
plugin/Defaults/EmailDefaults.php 2 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -7,40 +7,40 @@
 block discarded – undo
7 7
 
8 8
 class EmailDefaults extends Defaults
9 9
 {
10
-    /**
11
-     * @return array
12
-     */
13
-    protected function defaults()
14
-    {
15
-        return [
16
-            'after' => '',
17
-            'attachments' => [],
18
-            'bcc' => '',
19
-            'before' => '',
20
-            'cc' => '',
21
-            'from' => $this->getFromName().' <'.$this->getFromEmail().'>',
22
-            'message' => '',
23
-            'reply-to' => '',
24
-            'subject' => '',
25
-            'template' => '',
26
-            'template-tags' => [],
27
-            'to' => '',
28
-        ];
29
-    }
10
+	/**
11
+	 * @return array
12
+	 */
13
+	protected function defaults()
14
+	{
15
+		return [
16
+			'after' => '',
17
+			'attachments' => [],
18
+			'bcc' => '',
19
+			'before' => '',
20
+			'cc' => '',
21
+			'from' => $this->getFromName().' <'.$this->getFromEmail().'>',
22
+			'message' => '',
23
+			'reply-to' => '',
24
+			'subject' => '',
25
+			'template' => '',
26
+			'template-tags' => [],
27
+			'to' => '',
28
+		];
29
+	}
30 30
 
31
-    /**
32
-     * @return string
33
-     */
34
-    protected function getFromEmail()
35
-    {
36
-        return glsr(OptionManager::class)->getWP('admin_email');
37
-    }
31
+	/**
32
+	 * @return string
33
+	 */
34
+	protected function getFromEmail()
35
+	{
36
+		return glsr(OptionManager::class)->getWP('admin_email');
37
+	}
38 38
 
39
-    /**
40
-     * @return string
41
-     */
42
-    protected function getFromName()
43
-    {
44
-        return wp_specialchars_decode(glsr(OptionManager::class)->getWP('blogname'), ENT_QUOTES);
45
-    }
39
+	/**
40
+	 * @return string
41
+	 */
42
+	protected function getFromName()
43
+	{
44
+		return wp_specialchars_decode(glsr(OptionManager::class)->getWP('blogname'), ENT_QUOTES);
45
+	}
46 46
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      */
34 34
     protected function getFromEmail()
35 35
     {
36
-        return glsr(OptionManager::class)->getWP('admin_email');
36
+        return glsr( OptionManager::class )->getWP( 'admin_email' );
37 37
     }
38 38
 
39 39
     /**
@@ -41,6 +41,6 @@  discard block
 block discarded – undo
41 41
      */
42 42
     protected function getFromName()
43 43
     {
44
-        return wp_specialchars_decode(glsr(OptionManager::class)->getWP('blogname'), ENT_QUOTES);
44
+        return wp_specialchars_decode( glsr( OptionManager::class )->getWP( 'blogname' ), ENT_QUOTES );
45 45
     }
46 46
 }
Please login to merge, or discard this patch.
views/pages/settings/schema.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3
-<p><?= __('The JSON-LD schema is disabled by default. To use it, please enable the option in your blocks or shortcodes. The schema appears in Google\'s search results and shows the star rating and other information about your reviews. If the schema has been enabled, you can use Google\'s <a href="https://search.google.com/structured-data/testing-tool">Structured Data Testing Tool</a> to test your pages for valid schema data.', 'site-reviews'); ?></p>
4
-<p><?= __('You may override any of these options on a per-post/page basis by using its Custom Field name and adding a custom value using the <a href="https://codex.wordpress.org/Using_Custom_Fields#Usage">Custom Fields</a> metabox.', 'site-reviews'); ?></p>
3
+<p><?= __( 'The JSON-LD schema is disabled by default. To use it, please enable the option in your blocks or shortcodes. The schema appears in Google\'s search results and shows the star rating and other information about your reviews. If the schema has been enabled, you can use Google\'s <a href="https://search.google.com/structured-data/testing-tool">Structured Data Testing Tool</a> to test your pages for valid schema data.', 'site-reviews' ); ?></p>
4
+<p><?= __( 'You may override any of these options on a per-post/page basis by using its Custom Field name and adding a custom value using the <a href="https://codex.wordpress.org/Using_Custom_Fields#Usage">Custom Fields</a> metabox.', 'site-reviews' ); ?></p>
5 5
 <table class="form-table">
6 6
     <tbody>
7 7
         {{ rows }}
Please login to merge, or discard this patch.
plugin/Modules/Notice.php 2 patches
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -8,112 +8,112 @@
 block discarded – undo
8 8
 
9 9
 class Notice
10 10
 {
11
-    /**
12
-     * @param string $type
13
-     * @param string|array|WP_Error $message
14
-     * @return void
15
-     */
16
-    public function add($type, $message, array $args = [])
17
-    {
18
-        if (empty(array_filter([$message, $type]))) {
19
-            return;
20
-        }
21
-        $args['message'] = $message;
22
-        $args['type'] = $type;
23
-        add_settings_error(Application::ID, '', json_encode($this->normalize($args)));
24
-    }
11
+	/**
12
+	 * @param string $type
13
+	 * @param string|array|WP_Error $message
14
+	 * @return void
15
+	 */
16
+	public function add($type, $message, array $args = [])
17
+	{
18
+		if (empty(array_filter([$message, $type]))) {
19
+			return;
20
+		}
21
+		$args['message'] = $message;
22
+		$args['type'] = $type;
23
+		add_settings_error(Application::ID, '', json_encode($this->normalize($args)));
24
+	}
25 25
 
26
-    /**
27
-     * @param string|array|WP_Error $message
28
-     * @return void
29
-     */
30
-    public function addError($message, array $args = [])
31
-    {
32
-        $this->add('error', $message, $args);
33
-    }
26
+	/**
27
+	 * @param string|array|WP_Error $message
28
+	 * @return void
29
+	 */
30
+	public function addError($message, array $args = [])
31
+	{
32
+		$this->add('error', $message, $args);
33
+	}
34 34
 
35
-    /**
36
-     * @param string|array|WP_Error $message
37
-     * @return void
38
-     */
39
-    public function addSuccess($message, array $args = [])
40
-    {
41
-        $this->add('success', $message, $args);
42
-    }
35
+	/**
36
+	 * @param string|array|WP_Error $message
37
+	 * @return void
38
+	 */
39
+	public function addSuccess($message, array $args = [])
40
+	{
41
+		$this->add('success', $message, $args);
42
+	}
43 43
 
44
-    /**
45
-     * @param string|array|WP_Error $message
46
-     * @return void
47
-     */
48
-    public function addWarning($message, array $args = [])
49
-    {
50
-        $this->add('warning', $message, $args);
51
-    }
44
+	/**
45
+	 * @param string|array|WP_Error $message
46
+	 * @return void
47
+	 */
48
+	public function addWarning($message, array $args = [])
49
+	{
50
+		$this->add('warning', $message, $args);
51
+	}
52 52
 
53
-    /**
54
-     * @return static
55
-     */
56
-    public function clear()
57
-    {
58
-        global $wp_settings_errors;
59
-        $wp_settings_errors = [];
60
-        delete_transient('settings_errors');
61
-        return $this;
62
-    }
53
+	/**
54
+	 * @return static
55
+	 */
56
+	public function clear()
57
+	{
58
+		global $wp_settings_errors;
59
+		$wp_settings_errors = [];
60
+		delete_transient('settings_errors');
61
+		return $this;
62
+	}
63 63
 
64
-    /**
65
-     * @return string
66
-     */
67
-    public function get()
68
-    {
69
-        $notices = array_map('unserialize',
70
-            array_unique(array_map('serialize', get_settings_errors(Application::ID)))
71
-        );
72
-        $notices = array_reduce($notices, function ($carry, $notice) {
73
-            return $carry.$this->buildNotice(json_decode($notice['message'], true));
74
-        });
75
-        return apply_filters('site-reviews/notices', $notices);
76
-    }
64
+	/**
65
+	 * @return string
66
+	 */
67
+	public function get()
68
+	{
69
+		$notices = array_map('unserialize',
70
+			array_unique(array_map('serialize', get_settings_errors(Application::ID)))
71
+		);
72
+		$notices = array_reduce($notices, function ($carry, $notice) {
73
+			return $carry.$this->buildNotice(json_decode($notice['message'], true));
74
+		});
75
+		return apply_filters('site-reviews/notices', $notices);
76
+	}
77 77
 
78
-    /**
79
-     * @return string
80
-     */
81
-    protected function buildNotice(array $args)
82
-    {
83
-        $messages = array_reduce($args['messages'], function ($carry, $message) {
84
-            return $carry.glsr(Builder::class)->p($message);
85
-        });
86
-        $class = 'notice notice-'.$args['type'];
87
-        if ($args['inline']) {
88
-            $class.= ' inline';
89
-        }
90
-        if ($args['dismissible']) {
91
-            $class.= ' is-dismissible';
92
-        }
93
-        return glsr(Builder::class)->div($messages, [
94
-            'class' => $class,
95
-        ]);
96
-    }
78
+	/**
79
+	 * @return string
80
+	 */
81
+	protected function buildNotice(array $args)
82
+	{
83
+		$messages = array_reduce($args['messages'], function ($carry, $message) {
84
+			return $carry.glsr(Builder::class)->p($message);
85
+		});
86
+		$class = 'notice notice-'.$args['type'];
87
+		if ($args['inline']) {
88
+			$class.= ' inline';
89
+		}
90
+		if ($args['dismissible']) {
91
+			$class.= ' is-dismissible';
92
+		}
93
+		return glsr(Builder::class)->div($messages, [
94
+			'class' => $class,
95
+		]);
96
+	}
97 97
 
98
-    /**
99
-     * @return array
100
-     */
101
-    protected function normalize(array $args)
102
-    {
103
-        $defaults = [
104
-            'dismissible' => true,
105
-            'inline' => true,
106
-            'message' => '',
107
-            'type' => '',
108
-        ];
109
-        $args = shortcode_atts($defaults, $args);
110
-        if (!in_array($args['type'], ['error', 'warning', 'success'])) {
111
-            $args['type'] = 'success';
112
-        }
113
-        $args['messages'] = is_wp_error($args['message'])
114
-            ? (array) $args['message']->get_error_message()
115
-            : (array) $args['message'];
116
-        unset($args['message']);
117
-        return $args;
118
-    }
98
+	/**
99
+	 * @return array
100
+	 */
101
+	protected function normalize(array $args)
102
+	{
103
+		$defaults = [
104
+			'dismissible' => true,
105
+			'inline' => true,
106
+			'message' => '',
107
+			'type' => '',
108
+		];
109
+		$args = shortcode_atts($defaults, $args);
110
+		if (!in_array($args['type'], ['error', 'warning', 'success'])) {
111
+			$args['type'] = 'success';
112
+		}
113
+		$args['messages'] = is_wp_error($args['message'])
114
+			? (array) $args['message']->get_error_message()
115
+			: (array) $args['message'];
116
+		unset($args['message']);
117
+		return $args;
118
+	}
119 119
 }
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -13,41 +13,41 @@  discard block
 block discarded – undo
13 13
      * @param string|array|WP_Error $message
14 14
      * @return void
15 15
      */
16
-    public function add($type, $message, array $args = [])
16
+    public function add( $type, $message, array $args = [] )
17 17
     {
18
-        if (empty(array_filter([$message, $type]))) {
18
+        if( empty(array_filter( [$message, $type] )) ) {
19 19
             return;
20 20
         }
21 21
         $args['message'] = $message;
22 22
         $args['type'] = $type;
23
-        add_settings_error(Application::ID, '', json_encode($this->normalize($args)));
23
+        add_settings_error( Application::ID, '', json_encode( $this->normalize( $args ) ) );
24 24
     }
25 25
 
26 26
     /**
27 27
      * @param string|array|WP_Error $message
28 28
      * @return void
29 29
      */
30
-    public function addError($message, array $args = [])
30
+    public function addError( $message, array $args = [] )
31 31
     {
32
-        $this->add('error', $message, $args);
32
+        $this->add( 'error', $message, $args );
33 33
     }
34 34
 
35 35
     /**
36 36
      * @param string|array|WP_Error $message
37 37
      * @return void
38 38
      */
39
-    public function addSuccess($message, array $args = [])
39
+    public function addSuccess( $message, array $args = [] )
40 40
     {
41
-        $this->add('success', $message, $args);
41
+        $this->add( 'success', $message, $args );
42 42
     }
43 43
 
44 44
     /**
45 45
      * @param string|array|WP_Error $message
46 46
      * @return void
47 47
      */
48
-    public function addWarning($message, array $args = [])
48
+    public function addWarning( $message, array $args = [] )
49 49
     {
50
-        $this->add('warning', $message, $args);
50
+        $this->add( 'warning', $message, $args );
51 51
     }
52 52
 
53 53
     /**
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
     {
58 58
         global $wp_settings_errors;
59 59
         $wp_settings_errors = [];
60
-        delete_transient('settings_errors');
60
+        delete_transient( 'settings_errors' );
61 61
         return $this;
62 62
     }
63 63
 
@@ -66,39 +66,39 @@  discard block
 block discarded – undo
66 66
      */
67 67
     public function get()
68 68
     {
69
-        $notices = array_map('unserialize',
70
-            array_unique(array_map('serialize', get_settings_errors(Application::ID)))
69
+        $notices = array_map( 'unserialize',
70
+            array_unique( array_map( 'serialize', get_settings_errors( Application::ID ) ) )
71 71
         );
72
-        $notices = array_reduce($notices, function ($carry, $notice) {
73
-            return $carry.$this->buildNotice(json_decode($notice['message'], true));
72
+        $notices = array_reduce( $notices, function( $carry, $notice ) {
73
+            return $carry.$this->buildNotice( json_decode( $notice['message'], true ) );
74 74
         });
75
-        return apply_filters('site-reviews/notices', $notices);
75
+        return apply_filters( 'site-reviews/notices', $notices );
76 76
     }
77 77
 
78 78
     /**
79 79
      * @return string
80 80
      */
81
-    protected function buildNotice(array $args)
81
+    protected function buildNotice( array $args )
82 82
     {
83
-        $messages = array_reduce($args['messages'], function ($carry, $message) {
84
-            return $carry.glsr(Builder::class)->p($message);
83
+        $messages = array_reduce( $args['messages'], function( $carry, $message ) {
84
+            return $carry.glsr( Builder::class )->p( $message );
85 85
         });
86 86
         $class = 'notice notice-'.$args['type'];
87
-        if ($args['inline']) {
88
-            $class.= ' inline';
87
+        if( $args['inline'] ) {
88
+            $class .= ' inline';
89 89
         }
90
-        if ($args['dismissible']) {
91
-            $class.= ' is-dismissible';
90
+        if( $args['dismissible'] ) {
91
+            $class .= ' is-dismissible';
92 92
         }
93
-        return glsr(Builder::class)->div($messages, [
93
+        return glsr( Builder::class )->div( $messages, [
94 94
             'class' => $class,
95
-        ]);
95
+        ] );
96 96
     }
97 97
 
98 98
     /**
99 99
      * @return array
100 100
      */
101
-    protected function normalize(array $args)
101
+    protected function normalize( array $args )
102 102
     {
103 103
         $defaults = [
104 104
             'dismissible' => true,
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
             'message' => '',
107 107
             'type' => '',
108 108
         ];
109
-        $args = shortcode_atts($defaults, $args);
110
-        if (!in_array($args['type'], ['error', 'warning', 'success'])) {
109
+        $args = shortcode_atts( $defaults, $args );
110
+        if( !in_array( $args['type'], ['error', 'warning', 'success'] ) ) {
111 111
             $args['type'] = 'success';
112 112
         }
113
-        $args['messages'] = is_wp_error($args['message'])
114
-            ? (array) $args['message']->get_error_message()
115
-            : (array) $args['message'];
113
+        $args['messages'] = is_wp_error( $args['message'] )
114
+            ? (array)$args['message']->get_error_message()
115
+            : (array)$args['message'];
116 116
         unset($args['message']);
117 117
         return $args;
118 118
     }
Please login to merge, or discard this patch.
plugin/Modules/Html/Fields/Password.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -4,13 +4,13 @@
 block discarded – undo
4 4
 
5 5
 class Password extends Field
6 6
 {
7
-    /**
8
-     * @return array
9
-     */
10
-    public static function defaults()
11
-    {
12
-        return [
13
-            'class' => 'regular-text',
14
-        ];
15
-    }
7
+	/**
8
+	 * @return array
9
+	 */
10
+	public static function defaults()
11
+	{
12
+		return [
13
+			'class' => 'regular-text',
14
+		];
15
+	}
16 16
 }
Please login to merge, or discard this patch.
plugin/Modules/Rebusify.php 3 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -101,7 +101,8 @@
 block discarded – undo
101 101
     {
102 102
         if (is_wp_error($response)) {
103 103
             $this->message = $response->get_error_message();
104
-        } else {
104
+        }
105
+        else {
105 106
             $responseBody = wp_remote_retrieve_body($response);
106 107
             $responseCode = wp_remote_retrieve_response_code($response);
107 108
             $responseData = (array) json_decode($responseBody, true);
Please login to merge, or discard this patch.
Indentation   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -10,143 +10,143 @@
 block discarded – undo
10 10
 
11 11
 class Rebusify
12 12
 {
13
-    const API_URL = 'https://www.rebusify.com/api/rbs/';
14
-    const WEB_URL = 'https://rebusify.com/plans?ref=105';
13
+	const API_URL = 'https://www.rebusify.com/api/rbs/';
14
+	const WEB_URL = 'https://rebusify.com/plans?ref=105';
15 15
 
16
-    public $message;
17
-    public $response;
18
-    public $success;
16
+	public $message;
17
+	public $response;
18
+	public $success;
19 19
 
20
-    /**
21
-     * @return mixed
22
-     */
23
-    public function __get($key)
24
-    {
25
-        return property_exists($this, $key)
26
-            ? $this->$key
27
-            : Arr::get($this->response, $key, null);
28
-    }
20
+	/**
21
+	 * @return mixed
22
+	 */
23
+	public function __get($key)
24
+	{
25
+		return property_exists($this, $key)
26
+			? $this->$key
27
+			: Arr::get($this->response, $key, null);
28
+	}
29 29
 
30
-    /**
31
-     * @return self
32
-     */
33
-    public function activateKey($apiKey = '', $email = '')
34
-    {
35
-        $this->send('api_key_activation.php', [
36
-            'body' => [
37
-                'apikey' => $apiKey ?: 0,
38
-                'domain' => get_home_url(),
39
-                'email' => $email ?: 0,
40
-            ],
41
-        ]);
42
-        return $this;
43
-    }
30
+	/**
31
+	 * @return self
32
+	 */
33
+	public function activateKey($apiKey = '', $email = '')
34
+	{
35
+		$this->send('api_key_activation.php', [
36
+			'body' => [
37
+				'apikey' => $apiKey ?: 0,
38
+				'domain' => get_home_url(),
39
+				'email' => $email ?: 0,
40
+			],
41
+		]);
42
+		return $this;
43
+	}
44 44
 
45
-    /**
46
-     * @return self
47
-     */
48
-    public function reset()
49
-    {
50
-        $this->message = '';
51
-        $this->response = [];
52
-        $this->success = false;
53
-        return $this;
54
-    }
45
+	/**
46
+	 * @return self
47
+	 */
48
+	public function reset()
49
+	{
50
+		$this->message = '';
51
+		$this->response = [];
52
+		$this->success = false;
53
+		return $this;
54
+	}
55 55
 
56
-    /**
57
-     * @return self
58
-     */
59
-    public function sendReview(Review $review)
60
-    {
61
-        $this->send('index.php', [
62
-            'body' => $this->getBodyForReview($review),
63
-            'timeout' => 120,
64
-        ]);
65
-        return $this;
66
-    }
56
+	/**
57
+	 * @return self
58
+	 */
59
+	public function sendReview(Review $review)
60
+	{
61
+		$this->send('index.php', [
62
+			'body' => $this->getBodyForReview($review),
63
+			'timeout' => 120,
64
+		]);
65
+		return $this;
66
+	}
67 67
 
68
-    /**
69
-     * @return self
70
-     */
71
-    public function sendReviewResponse(Review $review)
72
-    {
73
-        $this->send('fetch_customer_reply.php', [
74
-            'body' => $this->getBodyForResponse($review),
75
-        ]);
76
-        return $this;
77
-    }
68
+	/**
69
+	 * @return self
70
+	 */
71
+	public function sendReviewResponse(Review $review)
72
+	{
73
+		$this->send('fetch_customer_reply.php', [
74
+			'body' => $this->getBodyForResponse($review),
75
+		]);
76
+		return $this;
77
+	}
78 78
 
79
-    /**
80
-     * @return array
81
-     */
82
-    protected function getBodyForResponse(Review $review)
83
-    {
84
-        $rebusifyResponse = [
85
-            'reply' => Str::truncate($review->response, 300),
86
-            'review_id' => glsr(Database::class)->get($review->ID, 'rebusify'), // this is the rebusify review ID
87
-            'review_transaction_id' => $review->review_id,
88
-            'type' => 'M',
89
-        ];
90
-        return apply_filters('site-reviews/rebusify/response', $rebusifyResponse, $review);
91
-    }
79
+	/**
80
+	 * @return array
81
+	 */
82
+	protected function getBodyForResponse(Review $review)
83
+	{
84
+		$rebusifyResponse = [
85
+			'reply' => Str::truncate($review->response, 300),
86
+			'review_id' => glsr(Database::class)->get($review->ID, 'rebusify'), // this is the rebusify review ID
87
+			'review_transaction_id' => $review->review_id,
88
+			'type' => 'M',
89
+		];
90
+		return apply_filters('site-reviews/rebusify/response', $rebusifyResponse, $review);
91
+	}
92 92
 
93
-    /**
94
-     * @return array
95
-     */
96
-    protected function getBodyForReview(Review $review)
97
-    {
98
-        $rebusifyReview = [
99
-            'domain' => get_home_url(),
100
-            'firstname' => Str::truncate(Str::convertName($review->author, 'first'), 25),
101
-            'rate' => $review->rating,
102
-            'review_transaction_id' => $review->review_id,
103
-            'reviews' => Str::truncate($review->content, 280),
104
-            'title' => Str::truncate($review->title, 35),
105
-            'transaction' => Application::ID, // woocommerce field, not needed for Site Reviews
106
-        ];
107
-        return apply_filters('site-reviews/rebusify/review', $rebusifyReview, $review);
108
-    }
93
+	/**
94
+	 * @return array
95
+	 */
96
+	protected function getBodyForReview(Review $review)
97
+	{
98
+		$rebusifyReview = [
99
+			'domain' => get_home_url(),
100
+			'firstname' => Str::truncate(Str::convertName($review->author, 'first'), 25),
101
+			'rate' => $review->rating,
102
+			'review_transaction_id' => $review->review_id,
103
+			'reviews' => Str::truncate($review->content, 280),
104
+			'title' => Str::truncate($review->title, 35),
105
+			'transaction' => Application::ID, // woocommerce field, not needed for Site Reviews
106
+		];
107
+		return apply_filters('site-reviews/rebusify/review', $rebusifyReview, $review);
108
+	}
109 109
 
110
-    /**
111
-     * @param \WP_Error|array $response
112
-     * @return void
113
-     */
114
-    protected function handleResponse($response)
115
-    {
116
-        if (is_wp_error($response)) {
117
-            $this->message = $response->get_error_message();
118
-        } else {
119
-            $responseBody = wp_remote_retrieve_body($response);
120
-            $responseCode = wp_remote_retrieve_response_code($response);
121
-            $responseData = (array) json_decode($responseBody, true);
122
-            $this->response = array_shift($responseData);
123
-            $this->message = Arr::get($this->response, 'msg');
124
-            $this->success = 'success' === Arr::get($this->response, 'result') || 'yes' === Arr::get($this->response, 'success'); // @todo remove this ugly hack!
125
-            if (200 !== $responseCode) {
126
-                glsr_log()->error('Bad response code ['.$responseCode.']');
127
-            }
128
-            if (!$this->success) {
129
-                glsr_log()->error($this->message);
130
-            }
131
-        }
132
-    }
110
+	/**
111
+	 * @param \WP_Error|array $response
112
+	 * @return void
113
+	 */
114
+	protected function handleResponse($response)
115
+	{
116
+		if (is_wp_error($response)) {
117
+			$this->message = $response->get_error_message();
118
+		} else {
119
+			$responseBody = wp_remote_retrieve_body($response);
120
+			$responseCode = wp_remote_retrieve_response_code($response);
121
+			$responseData = (array) json_decode($responseBody, true);
122
+			$this->response = array_shift($responseData);
123
+			$this->message = Arr::get($this->response, 'msg');
124
+			$this->success = 'success' === Arr::get($this->response, 'result') || 'yes' === Arr::get($this->response, 'success'); // @todo remove this ugly hack!
125
+			if (200 !== $responseCode) {
126
+				glsr_log()->error('Bad response code ['.$responseCode.']');
127
+			}
128
+			if (!$this->success) {
129
+				glsr_log()->error($this->message);
130
+			}
131
+		}
132
+	}
133 133
 
134
-    /**
135
-     * @param string $endpoint
136
-     * @return void
137
-     */
138
-    protected function send($endpoint, array $args = [])
139
-    {
140
-        $args = wp_parse_args($args, [
141
-            'body' => null,
142
-            'headers' => ['Content-Type' => 'application/x-www-form-urlencoded'],
143
-            'redirection' => 5,
144
-            'sslverify' => false,
145
-            'timeout' => 5,
146
-        ]);
147
-        $this->reset();
148
-        $this->handleResponse(
149
-            wp_remote_post(trailingslashit(static::API_URL).$endpoint, $args)
150
-        );
151
-    }
134
+	/**
135
+	 * @param string $endpoint
136
+	 * @return void
137
+	 */
138
+	protected function send($endpoint, array $args = [])
139
+	{
140
+		$args = wp_parse_args($args, [
141
+			'body' => null,
142
+			'headers' => ['Content-Type' => 'application/x-www-form-urlencoded'],
143
+			'redirection' => 5,
144
+			'sslverify' => false,
145
+			'timeout' => 5,
146
+		]);
147
+		$this->reset();
148
+		$this->handleResponse(
149
+			wp_remote_post(trailingslashit(static::API_URL).$endpoint, $args)
150
+		);
151
+	}
152 152
 }
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -20,25 +20,25 @@  discard block
 block discarded – undo
20 20
     /**
21 21
      * @return mixed
22 22
      */
23
-    public function __get($key)
23
+    public function __get( $key )
24 24
     {
25
-        return property_exists($this, $key)
25
+        return property_exists( $this, $key )
26 26
             ? $this->$key
27
-            : Arr::get($this->response, $key, null);
27
+            : Arr::get( $this->response, $key, null );
28 28
     }
29 29
 
30 30
     /**
31 31
      * @return self
32 32
      */
33
-    public function activateKey($apiKey = '', $email = '')
33
+    public function activateKey( $apiKey = '', $email = '' )
34 34
     {
35
-        $this->send('api_key_activation.php', [
35
+        $this->send( 'api_key_activation.php', [
36 36
             'body' => [
37 37
                 'apikey' => $apiKey ?: 0,
38 38
                 'domain' => get_home_url(),
39 39
                 'email' => $email ?: 0,
40 40
             ],
41
-        ]);
41
+        ] );
42 42
         return $this;
43 43
     }
44 44
 
@@ -56,77 +56,77 @@  discard block
 block discarded – undo
56 56
     /**
57 57
      * @return self
58 58
      */
59
-    public function sendReview(Review $review)
59
+    public function sendReview( Review $review )
60 60
     {
61
-        $this->send('index.php', [
62
-            'body' => $this->getBodyForReview($review),
61
+        $this->send( 'index.php', [
62
+            'body' => $this->getBodyForReview( $review ),
63 63
             'timeout' => 120,
64
-        ]);
64
+        ] );
65 65
         return $this;
66 66
     }
67 67
 
68 68
     /**
69 69
      * @return self
70 70
      */
71
-    public function sendReviewResponse(Review $review)
71
+    public function sendReviewResponse( Review $review )
72 72
     {
73
-        $this->send('fetch_customer_reply.php', [
74
-            'body' => $this->getBodyForResponse($review),
75
-        ]);
73
+        $this->send( 'fetch_customer_reply.php', [
74
+            'body' => $this->getBodyForResponse( $review ),
75
+        ] );
76 76
         return $this;
77 77
     }
78 78
 
79 79
     /**
80 80
      * @return array
81 81
      */
82
-    protected function getBodyForResponse(Review $review)
82
+    protected function getBodyForResponse( Review $review )
83 83
     {
84 84
         $rebusifyResponse = [
85
-            'reply' => Str::truncate($review->response, 300),
86
-            'review_id' => glsr(Database::class)->get($review->ID, 'rebusify'), // this is the rebusify review ID
85
+            'reply' => Str::truncate( $review->response, 300 ),
86
+            'review_id' => glsr( Database::class )->get( $review->ID, 'rebusify' ), // this is the rebusify review ID
87 87
             'review_transaction_id' => $review->review_id,
88 88
             'type' => 'M',
89 89
         ];
90
-        return apply_filters('site-reviews/rebusify/response', $rebusifyResponse, $review);
90
+        return apply_filters( 'site-reviews/rebusify/response', $rebusifyResponse, $review );
91 91
     }
92 92
 
93 93
     /**
94 94
      * @return array
95 95
      */
96
-    protected function getBodyForReview(Review $review)
96
+    protected function getBodyForReview( Review $review )
97 97
     {
98 98
         $rebusifyReview = [
99 99
             'domain' => get_home_url(),
100
-            'firstname' => Str::truncate(Str::convertName($review->author, 'first'), 25),
100
+            'firstname' => Str::truncate( Str::convertName( $review->author, 'first' ), 25 ),
101 101
             'rate' => $review->rating,
102 102
             'review_transaction_id' => $review->review_id,
103
-            'reviews' => Str::truncate($review->content, 280),
104
-            'title' => Str::truncate($review->title, 35),
103
+            'reviews' => Str::truncate( $review->content, 280 ),
104
+            'title' => Str::truncate( $review->title, 35 ),
105 105
             'transaction' => Application::ID, // woocommerce field, not needed for Site Reviews
106 106
         ];
107
-        return apply_filters('site-reviews/rebusify/review', $rebusifyReview, $review);
107
+        return apply_filters( 'site-reviews/rebusify/review', $rebusifyReview, $review );
108 108
     }
109 109
 
110 110
     /**
111 111
      * @param \WP_Error|array $response
112 112
      * @return void
113 113
      */
114
-    protected function handleResponse($response)
114
+    protected function handleResponse( $response )
115 115
     {
116
-        if (is_wp_error($response)) {
116
+        if( is_wp_error( $response ) ) {
117 117
             $this->message = $response->get_error_message();
118 118
         } else {
119
-            $responseBody = wp_remote_retrieve_body($response);
120
-            $responseCode = wp_remote_retrieve_response_code($response);
121
-            $responseData = (array) json_decode($responseBody, true);
122
-            $this->response = array_shift($responseData);
123
-            $this->message = Arr::get($this->response, 'msg');
124
-            $this->success = 'success' === Arr::get($this->response, 'result') || 'yes' === Arr::get($this->response, 'success'); // @todo remove this ugly hack!
125
-            if (200 !== $responseCode) {
126
-                glsr_log()->error('Bad response code ['.$responseCode.']');
119
+            $responseBody = wp_remote_retrieve_body( $response );
120
+            $responseCode = wp_remote_retrieve_response_code( $response );
121
+            $responseData = (array)json_decode( $responseBody, true );
122
+            $this->response = array_shift( $responseData );
123
+            $this->message = Arr::get( $this->response, 'msg' );
124
+            $this->success = 'success' === Arr::get( $this->response, 'result' ) || 'yes' === Arr::get( $this->response, 'success' ); // @todo remove this ugly hack!
125
+            if( 200 !== $responseCode ) {
126
+                glsr_log()->error( 'Bad response code ['.$responseCode.']' );
127 127
             }
128
-            if (!$this->success) {
129
-                glsr_log()->error($this->message);
128
+            if( !$this->success ) {
129
+                glsr_log()->error( $this->message );
130 130
             }
131 131
         }
132 132
     }
@@ -135,18 +135,18 @@  discard block
 block discarded – undo
135 135
      * @param string $endpoint
136 136
      * @return void
137 137
      */
138
-    protected function send($endpoint, array $args = [])
138
+    protected function send( $endpoint, array $args = [] )
139 139
     {
140
-        $args = wp_parse_args($args, [
140
+        $args = wp_parse_args( $args, [
141 141
             'body' => null,
142 142
             'headers' => ['Content-Type' => 'application/x-www-form-urlencoded'],
143 143
             'redirection' => 5,
144 144
             'sslverify' => false,
145 145
             'timeout' => 5,
146
-        ]);
146
+        ] );
147 147
         $this->reset();
148 148
         $this->handleResponse(
149
-            wp_remote_post(trailingslashit(static::API_URL).$endpoint, $args)
149
+            wp_remote_post( trailingslashit( static::API_URL ).$endpoint, $args )
150 150
         );
151 151
     }
152 152
 }
Please login to merge, or discard this patch.
views/pages/welcome/upgrade-guide.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3 3
 <p class="about-description">If you are using any Site Reviews code snippets or have built any custom integrations with Site Reviews, please make sure to read this upgrade guide.</p>
4 4
 <div class="is-fullwidth">
Please login to merge, or discard this patch.