Passed
Push — feature/rebusify ( fe0687...495106 )
by Paul
05:25 queued 15s
created
templates/form/submit-button.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
 <button type="submit" class="glsr-button button btn">
4 4
     <span class="glsr-button-loading"></span>
Please login to merge, or discard this patch.
templates/form/field-errors.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
 <span class="glsr-field-error">
4 4
     {{ errors }}
Please login to merge, or discard this patch.
templates/form/field_checkbox.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3 3
 <div class="glsr-field {{ class }}">
4 4
     <div class="glsr-field-choice">
Please login to merge, or discard this patch.
templates/form/field.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3 3
 <div class="glsr-field {{ class }}">
4 4
     {{ label }}
Please login to merge, or discard this patch.
templates/pagination.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3 3
 <div class="pagination">
4 4
     <nav class="navigation" role="navigation">
Please login to merge, or discard this patch.
templates/email-notification.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
 <strong>A new {review_rating}-star review has been submitted:</strong>
4 4
 
Please login to merge, or discard this patch.
templates/login-register.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3 3
 <div class="glsr-login-register">
4 4
     <p>{{ text }}</p>
Please login to merge, or discard this patch.
templates/reviews.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3 3
 <div class="glsr-reviews-wrap">
4 4
     <div class="{{ class }}" id="{{ id }}">
Please login to merge, or discard this patch.
plugin/Modules/Email.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -42,15 +42,15 @@  discard block
 block discarded – undo
42 42
     /**
43 43
      * @return Email
44 44
      */
45
-    public function compose(array $email)
45
+    public function compose( array $email )
46 46
     {
47
-        $this->normalize($email);
47
+        $this->normalize( $email );
48 48
         $this->attachments = $this->email['attachments'];
49 49
         $this->headers = $this->buildHeaders();
50 50
         $this->message = $this->buildHtmlMessage();
51 51
         $this->subject = $this->email['subject'];
52 52
         $this->to = $this->email['to'];
53
-        add_action('phpmailer_init', [$this, 'buildPlainTextMessage']);
53
+        add_action( 'phpmailer_init', [$this, 'buildPlainTextMessage'] );
54 54
         return $this;
55 55
     }
56 56
 
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
      * @param string $format
59 59
      * @return string|null
60 60
      */
61
-    public function read($format = '')
61
+    public function read( $format = '' )
62 62
     {
63
-        if ('plaintext' == $format) {
64
-            $message = $this->stripHtmlTags($this->message);
65
-            return apply_filters('site-reviews/email/message', $message, 'text', $this);
63
+        if( 'plaintext' == $format ) {
64
+            $message = $this->stripHtmlTags( $this->message );
65
+            return apply_filters( 'site-reviews/email/message', $message, 'text', $this );
66 66
         }
67 67
         return $this->message;
68 68
     }
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function send()
74 74
     {
75
-        if (!$this->message || !$this->subject || !$this->to) {
75
+        if( !$this->message || !$this->subject || !$this->to ) {
76 76
             return;
77 77
         }
78
-        add_action('wp_mail_failed', [$this, 'logMailError']);
78
+        add_action( 'wp_mail_failed', [$this, 'logMailError'] );
79 79
         $sent = wp_mail(
80 80
             $this->to,
81 81
             $this->subject,
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
             $this->headers,
84 84
             $this->attachments
85 85
         );
86
-        remove_action('wp_mail_failed', [$this, 'logMailError']);
86
+        remove_action( 'wp_mail_failed', [$this, 'logMailError'] );
87 87
         $this->reset();
88 88
         return $sent;
89 89
     }
@@ -92,16 +92,16 @@  discard block
 block discarded – undo
92 92
      * @return void
93 93
      * @action phpmailer_init
94 94
      */
95
-    public function buildPlainTextMessage(PHPMailer $phpmailer)
95
+    public function buildPlainTextMessage( PHPMailer $phpmailer )
96 96
     {
97
-        if (empty($this->email)) {
97
+        if( empty($this->email) ) {
98 98
             return;
99 99
         }
100
-        if ('text/plain' === $phpmailer->ContentType || !empty($phpmailer->AltBody)) {
100
+        if( 'text/plain' === $phpmailer->ContentType || !empty($phpmailer->AltBody) ) {
101 101
             return;
102 102
         }
103
-        $message = $this->stripHtmlTags($phpmailer->Body);
104
-        $phpmailer->AltBody = apply_filters('site-reviews/email/message', $message, 'text', $this);
103
+        $message = $this->stripHtmlTags( $phpmailer->Body );
104
+        $phpmailer->AltBody = apply_filters( 'site-reviews/email/message', $message, 'text', $this );
105 105
     }
106 106
 
107 107
     /**
@@ -112,14 +112,14 @@  discard block
 block discarded – undo
112 112
         $allowed = [
113 113
             'bcc', 'cc', 'from', 'reply-to',
114 114
         ];
115
-        $headers = array_intersect_key($this->email, array_flip($allowed));
116
-        $headers = array_filter($headers);
117
-        foreach ($headers as $key => $value) {
115
+        $headers = array_intersect_key( $this->email, array_flip( $allowed ) );
116
+        $headers = array_filter( $headers );
117
+        foreach( $headers as $key => $value ) {
118 118
             unset($headers[$key]);
119 119
             $headers[] = $key.': '.$value;
120 120
         }
121 121
         $headers[] = 'Content-Type: text/html';
122
-        return apply_filters('site-reviews/email/headers', $headers, $this);
122
+        return apply_filters( 'site-reviews/email/headers', $headers, $this );
123 123
     }
124 124
 
125 125
     /**
@@ -127,50 +127,50 @@  discard block
 block discarded – undo
127 127
      */
128 128
     protected function buildHtmlMessage()
129 129
     {
130
-        $template = trim(glsr(OptionManager::class)->get('settings.general.notification_message'));
131
-        if (!empty($template)) {
132
-            $message = glsr(Template::class)->interpolate($template, $this->email['template-tags'], $this->email['template']);
133
-        } elseif ($this->email['template']) {
134
-            $message = glsr(Template::class)->build('templates/'.$this->email['template'], [
130
+        $template = trim( glsr( OptionManager::class )->get( 'settings.general.notification_message' ) );
131
+        if( !empty($template) ) {
132
+            $message = glsr( Template::class )->interpolate( $template, $this->email['template-tags'], $this->email['template'] );
133
+        } elseif( $this->email['template'] ) {
134
+            $message = glsr( Template::class )->build( 'templates/'.$this->email['template'], [
135 135
                 'context' => $this->email['template-tags'],
136
-            ]);
136
+            ] );
137 137
         }
138
-        if (!isset($message)) {
138
+        if( !isset($message) ) {
139 139
             $message = $this->email['message'];
140 140
         }
141 141
         $message = $this->email['before'].$message.$this->email['after'];
142
-        $message = strip_shortcodes($message);
143
-        $message = wptexturize($message);
144
-        $message = wpautop($message);
145
-        $message = str_replace('&lt;&gt; ', '', $message);
146
-        $message = str_replace(']]>', ']]&gt;', $message);
147
-        $message = glsr(Template::class)->build('partials/email/index', [
142
+        $message = strip_shortcodes( $message );
143
+        $message = wptexturize( $message );
144
+        $message = wpautop( $message );
145
+        $message = str_replace( '&lt;&gt; ', '', $message );
146
+        $message = str_replace( ']]>', ']]&gt;', $message );
147
+        $message = glsr( Template::class )->build( 'partials/email/index', [
148 148
             'context' => ['message' => $message],
149
-        ]);
150
-        return apply_filters('site-reviews/email/message', stripslashes($message), 'html', $this);
149
+        ] );
150
+        return apply_filters( 'site-reviews/email/message', stripslashes( $message ), 'html', $this );
151 151
     }
152 152
 
153 153
     /**
154 154
      * @param \WP_Error $error
155 155
      * @return void
156 156
      */
157
-    protected function logMailError($error)
157
+    protected function logMailError( $error )
158 158
     {
159
-        glsr_log()->error('Email was not sent (wp_mail failed)')
160
-            ->debug($this)
161
-            ->debug($error);
159
+        glsr_log()->error( 'Email was not sent (wp_mail failed)' )
160
+            ->debug( $this )
161
+            ->debug( $error );
162 162
     }
163 163
 
164 164
     /**
165 165
      * @return void
166 166
      */
167
-    protected function normalize(array $email = [])
167
+    protected function normalize( array $email = [] )
168 168
     {
169
-        $email = shortcode_atts(glsr(EmailDefaults::class)->defaults(), $email);
170
-        if (empty($email['reply-to'])) {
169
+        $email = shortcode_atts( glsr( EmailDefaults::class )->defaults(), $email );
170
+        if( empty($email['reply-to']) ) {
171 171
             $email['reply-to'] = $email['from'];
172 172
         }
173
-        $this->email = apply_filters('site-reviews/email/compose', $email, $this);
173
+        $this->email = apply_filters( 'site-reviews/email/compose', $email, $this );
174 174
     }
175 175
 
176 176
     /**
@@ -189,21 +189,21 @@  discard block
 block discarded – undo
189 189
     /**
190 190
      * @return string
191 191
      */
192
-    protected function stripHtmlTags($string)
192
+    protected function stripHtmlTags( $string )
193 193
     {
194 194
         // remove invisible elements
195
-        $string = preg_replace('@<(embed|head|noembed|noscript|object|script|style)[^>]*?>.*?</\\1>@siu', '', $string);
195
+        $string = preg_replace( '@<(embed|head|noembed|noscript|object|script|style)[^>]*?>.*?</\\1>@siu', '', $string );
196 196
         // replace certain elements with a line-break
197
-        $string = preg_replace('@</(div|h[1-9]|p|pre|tr)@iu', "\r\n\$0", $string);
197
+        $string = preg_replace( '@</(div|h[1-9]|p|pre|tr)@iu', "\r\n\$0", $string );
198 198
         // replace other elements with a space
199
-        $string = preg_replace('@</(td|th)@iu', ' $0', $string);
199
+        $string = preg_replace( '@</(td|th)@iu', ' $0', $string );
200 200
         // add a placeholder for plain-text bullets to list elements
201
-        $string = preg_replace('@<(li)[^>]*?>@siu', '$0-o-^-o-', $string);
201
+        $string = preg_replace( '@<(li)[^>]*?>@siu', '$0-o-^-o-', $string );
202 202
         // strip all remaining HTML tags
203
-        $string = wp_strip_all_tags($string);
204
-        $string = wp_specialchars_decode($string, ENT_QUOTES);
205
-        $string = preg_replace('/\v(?:[\v\h]+){2,}/', "\r\n\r\n", $string);
206
-        $string = str_replace('-o-^-o-', ' - ', $string);
207
-        return html_entity_decode($string, ENT_QUOTES, 'UTF-8');
203
+        $string = wp_strip_all_tags( $string );
204
+        $string = wp_specialchars_decode( $string, ENT_QUOTES );
205
+        $string = preg_replace( '/\v(?:[\v\h]+){2,}/', "\r\n\r\n", $string );
206
+        $string = str_replace( '-o-^-o-', ' - ', $string );
207
+        return html_entity_decode( $string, ENT_QUOTES, 'UTF-8' );
208 208
     }
209 209
 }
Please login to merge, or discard this patch.