Passed
Push — master ( 2009cc...a406f9 )
by Paul
04:50 queued 21s
created
plugin/Modules/Email.php 3 patches
Indentation   +201 added lines, -201 removed lines patch added patch discarded remove patch
@@ -9,205 +9,205 @@
 block discarded – undo
9 9
 
10 10
 class Email
11 11
 {
12
-    /**
13
-     * @var array
14
-     */
15
-    public $attachments;
16
-
17
-    /**
18
-     * @var array
19
-     */
20
-    public $email;
21
-
22
-    /**
23
-     * @var array
24
-     */
25
-    public $headers;
26
-
27
-    /**
28
-     * @var string
29
-     */
30
-    public $message;
31
-
32
-    /**
33
-     * @var string
34
-     */
35
-    public $subject;
36
-
37
-    /**
38
-     * @var string|array
39
-     */
40
-    public $to;
41
-
42
-    /**
43
-     * @return Email
44
-     */
45
-    public function compose(array $email)
46
-    {
47
-        $this->normalize($email);
48
-        $this->attachments = $this->email['attachments'];
49
-        $this->headers = $this->buildHeaders();
50
-        $this->message = $this->buildHtmlMessage();
51
-        $this->subject = $this->email['subject'];
52
-        $this->to = $this->email['to'];
53
-        add_action('phpmailer_init', [$this, 'buildPlainTextMessage']);
54
-        return $this;
55
-    }
56
-
57
-    /**
58
-     * @param string $format
59
-     * @return string|null
60
-     */
61
-    public function read($format = '')
62
-    {
63
-        if ('plaintext' == $format) {
64
-            $message = $this->stripHtmlTags($this->message);
65
-            return apply_filters('site-reviews/email/message', $message, 'text', $this);
66
-        }
67
-        return $this->message;
68
-    }
69
-
70
-    /**
71
-     * @return void|bool
72
-     */
73
-    public function send()
74
-    {
75
-        if (!$this->message || !$this->subject || !$this->to) {
76
-            return;
77
-        }
78
-        add_action('wp_mail_failed', [$this, 'logMailError']);
79
-        $sent = wp_mail(
80
-            $this->to,
81
-            $this->subject,
82
-            $this->message,
83
-            $this->headers,
84
-            $this->attachments
85
-        );
86
-        remove_action('wp_mail_failed', [$this, 'logMailError']);
87
-        $this->reset();
88
-        return $sent;
89
-    }
90
-
91
-    /**
92
-     * @return void
93
-     * @action phpmailer_init
94
-     */
95
-    public function buildPlainTextMessage(PHPMailer $phpmailer)
96
-    {
97
-        if (empty($this->email)) {
98
-            return;
99
-        }
100
-        if ('text/plain' === $phpmailer->ContentType || !empty($phpmailer->AltBody)) {
101
-            return;
102
-        }
103
-        $message = $this->stripHtmlTags($phpmailer->Body);
104
-        $phpmailer->AltBody = apply_filters('site-reviews/email/message', $message, 'text', $this);
105
-    }
106
-
107
-    /**
108
-     * @return array
109
-     */
110
-    protected function buildHeaders()
111
-    {
112
-        $allowed = [
113
-            'bcc', 'cc', 'from', 'reply-to',
114
-        ];
115
-        $headers = array_intersect_key($this->email, array_flip($allowed));
116
-        $headers = array_filter($headers);
117
-        foreach ($headers as $key => $value) {
118
-            unset($headers[$key]);
119
-            $headers[] = $key.': '.$value;
120
-        }
121
-        $headers[] = 'Content-Type: text/html';
122
-        return apply_filters('site-reviews/email/headers', $headers, $this);
123
-    }
124
-
125
-    /**
126
-     * @return string
127
-     */
128
-    protected function buildHtmlMessage()
129
-    {
130
-        $template = trim(glsr(OptionManager::class)->get('settings.general.notification_message'));
131
-        if (!empty($template)) {
132
-            $message = glsr(Template::class)->interpolate(
133
-                $template, 
134
-                ['context' => $this->email['template-tags']], 
135
-                $this->email['template']
136
-            );
137
-        } elseif ($this->email['template']) {
138
-            $message = glsr(Template::class)->build('templates/'.$this->email['template'], [
139
-                'context' => $this->email['template-tags'],
140
-            ]);
141
-        }
142
-        if (!isset($message)) {
143
-            $message = $this->email['message'];
144
-        }
145
-        $message = $this->email['before'].$message.$this->email['after'];
146
-        $message = strip_shortcodes($message);
147
-        $message = wptexturize($message);
148
-        $message = wpautop($message);
149
-        $message = str_replace('<> ', '', $message);
150
-        $message = str_replace(']]>', ']]>', $message);
151
-        $message = glsr(Template::class)->build('partials/email/index', [
152
-            'context' => ['message' => $message],
153
-        ]);
154
-        return apply_filters('site-reviews/email/message', stripslashes($message), 'html', $this);
155
-    }
156
-
157
-    /**
158
-     * @param \WP_Error $error
159
-     * @return void
160
-     */
161
-    protected function logMailError($error)
162
-    {
163
-        glsr_log()->error('Email was not sent (wp_mail failed)')
164
-            ->debug($this)
165
-            ->debug($error);
166
-    }
167
-
168
-    /**
169
-     * @return void
170
-     */
171
-    protected function normalize(array $email = [])
172
-    {
173
-        $email = shortcode_atts(glsr(EmailDefaults::class)->defaults(), $email);
174
-        if (empty($email['reply-to'])) {
175
-            $email['reply-to'] = $email['from'];
176
-        }
177
-        $this->email = apply_filters('site-reviews/email/compose', $email, $this);
178
-    }
179
-
180
-    /**
181
-     * @return void
182
-     */
183
-    protected function reset()
184
-    {
185
-        $this->attachments = [];
186
-        $this->email = [];
187
-        $this->headers = [];
188
-        $this->message = null;
189
-        $this->subject = null;
190
-        $this->to = null;
191
-    }
192
-
193
-    /**
194
-     * @return string
195
-     */
196
-    protected function stripHtmlTags($string)
197
-    {
198
-        // remove invisible elements
199
-        $string = preg_replace('@<(embed|head|noembed|noscript|object|script|style)[^>]*?>.*?</\\1>@siu', '', $string);
200
-        // replace certain elements with a line-break
201
-        $string = preg_replace('@</(div|h[1-9]|p|pre|tr)@iu', "\r\n\$0", $string);
202
-        // replace other elements with a space
203
-        $string = preg_replace('@</(td|th)@iu', ' $0', $string);
204
-        // add a placeholder for plain-text bullets to list elements
205
-        $string = preg_replace('@<(li)[^>]*?>@siu', '$0-o-^-o-', $string);
206
-        // strip all remaining HTML tags
207
-        $string = wp_strip_all_tags($string);
208
-        $string = wp_specialchars_decode($string, ENT_QUOTES);
209
-        $string = preg_replace('/\v(?:[\v\h]+){2,}/', "\r\n\r\n", $string);
210
-        $string = str_replace('-o-^-o-', ' - ', $string);
211
-        return html_entity_decode($string, ENT_QUOTES, 'UTF-8');
212
-    }
12
+	/**
13
+	 * @var array
14
+	 */
15
+	public $attachments;
16
+
17
+	/**
18
+	 * @var array
19
+	 */
20
+	public $email;
21
+
22
+	/**
23
+	 * @var array
24
+	 */
25
+	public $headers;
26
+
27
+	/**
28
+	 * @var string
29
+	 */
30
+	public $message;
31
+
32
+	/**
33
+	 * @var string
34
+	 */
35
+	public $subject;
36
+
37
+	/**
38
+	 * @var string|array
39
+	 */
40
+	public $to;
41
+
42
+	/**
43
+	 * @return Email
44
+	 */
45
+	public function compose(array $email)
46
+	{
47
+		$this->normalize($email);
48
+		$this->attachments = $this->email['attachments'];
49
+		$this->headers = $this->buildHeaders();
50
+		$this->message = $this->buildHtmlMessage();
51
+		$this->subject = $this->email['subject'];
52
+		$this->to = $this->email['to'];
53
+		add_action('phpmailer_init', [$this, 'buildPlainTextMessage']);
54
+		return $this;
55
+	}
56
+
57
+	/**
58
+	 * @param string $format
59
+	 * @return string|null
60
+	 */
61
+	public function read($format = '')
62
+	{
63
+		if ('plaintext' == $format) {
64
+			$message = $this->stripHtmlTags($this->message);
65
+			return apply_filters('site-reviews/email/message', $message, 'text', $this);
66
+		}
67
+		return $this->message;
68
+	}
69
+
70
+	/**
71
+	 * @return void|bool
72
+	 */
73
+	public function send()
74
+	{
75
+		if (!$this->message || !$this->subject || !$this->to) {
76
+			return;
77
+		}
78
+		add_action('wp_mail_failed', [$this, 'logMailError']);
79
+		$sent = wp_mail(
80
+			$this->to,
81
+			$this->subject,
82
+			$this->message,
83
+			$this->headers,
84
+			$this->attachments
85
+		);
86
+		remove_action('wp_mail_failed', [$this, 'logMailError']);
87
+		$this->reset();
88
+		return $sent;
89
+	}
90
+
91
+	/**
92
+	 * @return void
93
+	 * @action phpmailer_init
94
+	 */
95
+	public function buildPlainTextMessage(PHPMailer $phpmailer)
96
+	{
97
+		if (empty($this->email)) {
98
+			return;
99
+		}
100
+		if ('text/plain' === $phpmailer->ContentType || !empty($phpmailer->AltBody)) {
101
+			return;
102
+		}
103
+		$message = $this->stripHtmlTags($phpmailer->Body);
104
+		$phpmailer->AltBody = apply_filters('site-reviews/email/message', $message, 'text', $this);
105
+	}
106
+
107
+	/**
108
+	 * @return array
109
+	 */
110
+	protected function buildHeaders()
111
+	{
112
+		$allowed = [
113
+			'bcc', 'cc', 'from', 'reply-to',
114
+		];
115
+		$headers = array_intersect_key($this->email, array_flip($allowed));
116
+		$headers = array_filter($headers);
117
+		foreach ($headers as $key => $value) {
118
+			unset($headers[$key]);
119
+			$headers[] = $key.': '.$value;
120
+		}
121
+		$headers[] = 'Content-Type: text/html';
122
+		return apply_filters('site-reviews/email/headers', $headers, $this);
123
+	}
124
+
125
+	/**
126
+	 * @return string
127
+	 */
128
+	protected function buildHtmlMessage()
129
+	{
130
+		$template = trim(glsr(OptionManager::class)->get('settings.general.notification_message'));
131
+		if (!empty($template)) {
132
+			$message = glsr(Template::class)->interpolate(
133
+				$template, 
134
+				['context' => $this->email['template-tags']], 
135
+				$this->email['template']
136
+			);
137
+		} elseif ($this->email['template']) {
138
+			$message = glsr(Template::class)->build('templates/'.$this->email['template'], [
139
+				'context' => $this->email['template-tags'],
140
+			]);
141
+		}
142
+		if (!isset($message)) {
143
+			$message = $this->email['message'];
144
+		}
145
+		$message = $this->email['before'].$message.$this->email['after'];
146
+		$message = strip_shortcodes($message);
147
+		$message = wptexturize($message);
148
+		$message = wpautop($message);
149
+		$message = str_replace('&lt;&gt; ', '', $message);
150
+		$message = str_replace(']]>', ']]&gt;', $message);
151
+		$message = glsr(Template::class)->build('partials/email/index', [
152
+			'context' => ['message' => $message],
153
+		]);
154
+		return apply_filters('site-reviews/email/message', stripslashes($message), 'html', $this);
155
+	}
156
+
157
+	/**
158
+	 * @param \WP_Error $error
159
+	 * @return void
160
+	 */
161
+	protected function logMailError($error)
162
+	{
163
+		glsr_log()->error('Email was not sent (wp_mail failed)')
164
+			->debug($this)
165
+			->debug($error);
166
+	}
167
+
168
+	/**
169
+	 * @return void
170
+	 */
171
+	protected function normalize(array $email = [])
172
+	{
173
+		$email = shortcode_atts(glsr(EmailDefaults::class)->defaults(), $email);
174
+		if (empty($email['reply-to'])) {
175
+			$email['reply-to'] = $email['from'];
176
+		}
177
+		$this->email = apply_filters('site-reviews/email/compose', $email, $this);
178
+	}
179
+
180
+	/**
181
+	 * @return void
182
+	 */
183
+	protected function reset()
184
+	{
185
+		$this->attachments = [];
186
+		$this->email = [];
187
+		$this->headers = [];
188
+		$this->message = null;
189
+		$this->subject = null;
190
+		$this->to = null;
191
+	}
192
+
193
+	/**
194
+	 * @return string
195
+	 */
196
+	protected function stripHtmlTags($string)
197
+	{
198
+		// remove invisible elements
199
+		$string = preg_replace('@<(embed|head|noembed|noscript|object|script|style)[^>]*?>.*?</\\1>@siu', '', $string);
200
+		// replace certain elements with a line-break
201
+		$string = preg_replace('@</(div|h[1-9]|p|pre|tr)@iu', "\r\n\$0", $string);
202
+		// replace other elements with a space
203
+		$string = preg_replace('@</(td|th)@iu', ' $0', $string);
204
+		// add a placeholder for plain-text bullets to list elements
205
+		$string = preg_replace('@<(li)[^>]*?>@siu', '$0-o-^-o-', $string);
206
+		// strip all remaining HTML tags
207
+		$string = wp_strip_all_tags($string);
208
+		$string = wp_specialchars_decode($string, ENT_QUOTES);
209
+		$string = preg_replace('/\v(?:[\v\h]+){2,}/', "\r\n\r\n", $string);
210
+		$string = str_replace('-o-^-o-', ' - ', $string);
211
+		return html_entity_decode($string, ENT_QUOTES, 'UTF-8');
212
+	}
213 213
 }
Please login to merge, or discard this 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,54 +127,54 @@  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(
130
+        $template = trim( glsr( OptionManager::class )->get( 'settings.general.notification_message' ) );
131
+        if( !empty($template) ) {
132
+            $message = glsr( Template::class )->interpolate(
133 133
                 $template, 
134 134
                 ['context' => $this->email['template-tags']], 
135 135
                 $this->email['template']
136 136
             );
137
-        } elseif ($this->email['template']) {
138
-            $message = glsr(Template::class)->build('templates/'.$this->email['template'], [
137
+        } elseif( $this->email['template'] ) {
138
+            $message = glsr( Template::class )->build( 'templates/'.$this->email['template'], [
139 139
                 'context' => $this->email['template-tags'],
140
-            ]);
140
+            ] );
141 141
         }
142
-        if (!isset($message)) {
142
+        if( !isset($message) ) {
143 143
             $message = $this->email['message'];
144 144
         }
145 145
         $message = $this->email['before'].$message.$this->email['after'];
146
-        $message = strip_shortcodes($message);
147
-        $message = wptexturize($message);
148
-        $message = wpautop($message);
149
-        $message = str_replace('&lt;&gt; ', '', $message);
150
-        $message = str_replace(']]>', ']]&gt;', $message);
151
-        $message = glsr(Template::class)->build('partials/email/index', [
146
+        $message = strip_shortcodes( $message );
147
+        $message = wptexturize( $message );
148
+        $message = wpautop( $message );
149
+        $message = str_replace( '&lt;&gt; ', '', $message );
150
+        $message = str_replace( ']]>', ']]&gt;', $message );
151
+        $message = glsr( Template::class )->build( 'partials/email/index', [
152 152
             'context' => ['message' => $message],
153
-        ]);
154
-        return apply_filters('site-reviews/email/message', stripslashes($message), 'html', $this);
153
+        ] );
154
+        return apply_filters( 'site-reviews/email/message', stripslashes( $message ), 'html', $this );
155 155
     }
156 156
 
157 157
     /**
158 158
      * @param \WP_Error $error
159 159
      * @return void
160 160
      */
161
-    protected function logMailError($error)
161
+    protected function logMailError( $error )
162 162
     {
163
-        glsr_log()->error('Email was not sent (wp_mail failed)')
164
-            ->debug($this)
165
-            ->debug($error);
163
+        glsr_log()->error( 'Email was not sent (wp_mail failed)' )
164
+            ->debug( $this )
165
+            ->debug( $error );
166 166
     }
167 167
 
168 168
     /**
169 169
      * @return void
170 170
      */
171
-    protected function normalize(array $email = [])
171
+    protected function normalize( array $email = [] )
172 172
     {
173
-        $email = shortcode_atts(glsr(EmailDefaults::class)->defaults(), $email);
174
-        if (empty($email['reply-to'])) {
173
+        $email = shortcode_atts( glsr( EmailDefaults::class )->defaults(), $email );
174
+        if( empty($email['reply-to']) ) {
175 175
             $email['reply-to'] = $email['from'];
176 176
         }
177
-        $this->email = apply_filters('site-reviews/email/compose', $email, $this);
177
+        $this->email = apply_filters( 'site-reviews/email/compose', $email, $this );
178 178
     }
179 179
 
180 180
     /**
@@ -193,21 +193,21 @@  discard block
 block discarded – undo
193 193
     /**
194 194
      * @return string
195 195
      */
196
-    protected function stripHtmlTags($string)
196
+    protected function stripHtmlTags( $string )
197 197
     {
198 198
         // remove invisible elements
199
-        $string = preg_replace('@<(embed|head|noembed|noscript|object|script|style)[^>]*?>.*?</\\1>@siu', '', $string);
199
+        $string = preg_replace( '@<(embed|head|noembed|noscript|object|script|style)[^>]*?>.*?</\\1>@siu', '', $string );
200 200
         // replace certain elements with a line-break
201
-        $string = preg_replace('@</(div|h[1-9]|p|pre|tr)@iu', "\r\n\$0", $string);
201
+        $string = preg_replace( '@</(div|h[1-9]|p|pre|tr)@iu', "\r\n\$0", $string );
202 202
         // replace other elements with a space
203
-        $string = preg_replace('@</(td|th)@iu', ' $0', $string);
203
+        $string = preg_replace( '@</(td|th)@iu', ' $0', $string );
204 204
         // add a placeholder for plain-text bullets to list elements
205
-        $string = preg_replace('@<(li)[^>]*?>@siu', '$0-o-^-o-', $string);
205
+        $string = preg_replace( '@<(li)[^>]*?>@siu', '$0-o-^-o-', $string );
206 206
         // strip all remaining HTML tags
207
-        $string = wp_strip_all_tags($string);
208
-        $string = wp_specialchars_decode($string, ENT_QUOTES);
209
-        $string = preg_replace('/\v(?:[\v\h]+){2,}/', "\r\n\r\n", $string);
210
-        $string = str_replace('-o-^-o-', ' - ', $string);
211
-        return html_entity_decode($string, ENT_QUOTES, 'UTF-8');
207
+        $string = wp_strip_all_tags( $string );
208
+        $string = wp_specialchars_decode( $string, ENT_QUOTES );
209
+        $string = preg_replace( '/\v(?:[\v\h]+){2,}/', "\r\n\r\n", $string );
210
+        $string = str_replace( '-o-^-o-', ' - ', $string );
211
+        return html_entity_decode( $string, ENT_QUOTES, 'UTF-8' );
212 212
     }
213 213
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -134,7 +134,8 @@
 block discarded – undo
134 134
                 ['context' => $this->email['template-tags']], 
135 135
                 $this->email['template']
136 136
             );
137
-        } elseif ($this->email['template']) {
137
+        }
138
+        elseif ($this->email['template']) {
138 139
             $message = glsr(Template::class)->build('templates/'.$this->email['template'], [
139 140
                 'context' => $this->email['template-tags'],
140 141
             ]);
Please login to merge, or discard this patch.
plugin/Modules/Translator.php 2 patches
Indentation   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -6,155 +6,155 @@
 block discarded – undo
6 6
 
7 7
 class Translator
8 8
 {
9
-    /**
10
-     * @param string $translation
11
-     * @param string $text
12
-     * @param string $domain
13
-     * @return string
14
-     * @filter gettext
15
-     */
16
-    public function filterGettext($translation, $text, $domain)
17
-    {
18
-        return $this->translate($translation, $domain, [
19
-            'single' => $text,
20
-        ]);
21
-    }
9
+	/**
10
+	 * @param string $translation
11
+	 * @param string $text
12
+	 * @param string $domain
13
+	 * @return string
14
+	 * @filter gettext
15
+	 */
16
+	public function filterGettext($translation, $text, $domain)
17
+	{
18
+		return $this->translate($translation, $domain, [
19
+			'single' => $text,
20
+		]);
21
+	}
22 22
 
23
-    /**
24
-     * @param string $translation
25
-     * @param string $text
26
-     * @param string $context
27
-     * @param string $domain
28
-     * @return string
29
-     * @filter gettext_with_context
30
-     */
31
-    public function filterGettextWithContext($translation, $text, $context, $domain)
32
-    {
33
-        return $this->translate($translation, $domain, [
34
-            'context' => $context,
35
-            'single' => $text,
36
-        ]);
37
-    }
23
+	/**
24
+	 * @param string $translation
25
+	 * @param string $text
26
+	 * @param string $context
27
+	 * @param string $domain
28
+	 * @return string
29
+	 * @filter gettext_with_context
30
+	 */
31
+	public function filterGettextWithContext($translation, $text, $context, $domain)
32
+	{
33
+		return $this->translate($translation, $domain, [
34
+			'context' => $context,
35
+			'single' => $text,
36
+		]);
37
+	}
38 38
 
39
-    /**
40
-     * @param string $translation
41
-     * @param string $single
42
-     * @param string $plural
43
-     * @param int $number
44
-     * @param string $domain
45
-     * @return string
46
-     * @filter ngettext
47
-     */
48
-    public function filterNgettext($translation, $single, $plural, $number, $domain)
49
-    {
50
-        return $this->translate($translation, $domain, [
51
-            'number' => $number,
52
-            'plural' => $plural,
53
-            'single' => $single,
54
-        ]);
55
-    }
39
+	/**
40
+	 * @param string $translation
41
+	 * @param string $single
42
+	 * @param string $plural
43
+	 * @param int $number
44
+	 * @param string $domain
45
+	 * @return string
46
+	 * @filter ngettext
47
+	 */
48
+	public function filterNgettext($translation, $single, $plural, $number, $domain)
49
+	{
50
+		return $this->translate($translation, $domain, [
51
+			'number' => $number,
52
+			'plural' => $plural,
53
+			'single' => $single,
54
+		]);
55
+	}
56 56
 
57
-    /**
58
-     * @param string $translation
59
-     * @param string $single
60
-     * @param string $plural
61
-     * @param int $number
62
-     * @param string $context
63
-     * @param string $domain
64
-     * @return string
65
-     * @filter ngettext_with_context
66
-     */
67
-    public function filterNgettextWithContext($translation, $single, $plural, $number, $context, $domain)
68
-    {
69
-        return $this->translate($translation, $domain, [
70
-            'context' => $context,
71
-            'number' => $number,
72
-            'plural' => $plural,
73
-            'single' => $single,
74
-        ]);
75
-    }
57
+	/**
58
+	 * @param string $translation
59
+	 * @param string $single
60
+	 * @param string $plural
61
+	 * @param int $number
62
+	 * @param string $context
63
+	 * @param string $domain
64
+	 * @return string
65
+	 * @filter ngettext_with_context
66
+	 */
67
+	public function filterNgettextWithContext($translation, $single, $plural, $number, $context, $domain)
68
+	{
69
+		return $this->translate($translation, $domain, [
70
+			'context' => $context,
71
+			'number' => $number,
72
+			'plural' => $plural,
73
+			'single' => $single,
74
+		]);
75
+	}
76 76
 
77
-    /**
78
-     * @param string $original
79
-     * @param string $domain
80
-     * @return string
81
-     */
82
-    public function translate($original, $domain, array $args)
83
-    {
84
-        $domains = apply_filters('site-reviews/translator/domains', [Application::ID]);
85
-        if (!in_array($domain, $domains)) {
86
-            return $original;
87
-        }
88
-        $args = $this->normalizeTranslationArgs($args);
89
-        $strings = $this->getTranslationStrings($args['single'], $args['plural']);
90
-        if (empty($strings)) {
91
-            return $original;
92
-        }
93
-        $string = current($strings);
94
-        return 'plural' == $string['type']
95
-            ? $this->translatePlural($domain, $string, $args)
96
-            : $this->translateSingle($domain, $string, $args);
97
-    }
77
+	/**
78
+	 * @param string $original
79
+	 * @param string $domain
80
+	 * @return string
81
+	 */
82
+	public function translate($original, $domain, array $args)
83
+	{
84
+		$domains = apply_filters('site-reviews/translator/domains', [Application::ID]);
85
+		if (!in_array($domain, $domains)) {
86
+			return $original;
87
+		}
88
+		$args = $this->normalizeTranslationArgs($args);
89
+		$strings = $this->getTranslationStrings($args['single'], $args['plural']);
90
+		if (empty($strings)) {
91
+			return $original;
92
+		}
93
+		$string = current($strings);
94
+		return 'plural' == $string['type']
95
+			? $this->translatePlural($domain, $string, $args)
96
+			: $this->translateSingle($domain, $string, $args);
97
+	}
98 98
 
99
-    /**
100
-     * @param string $single
101
-     * @param string $plural
102
-     * @return array
103
-     */
104
-    protected function getTranslationStrings($single, $plural)
105
-    {
106
-        return array_filter(glsr(Translation::class)->translations(), function ($string) use ($single, $plural) {
107
-            return $string['s1'] == html_entity_decode($single, ENT_COMPAT, 'UTF-8')
108
-                && $string['p1'] == html_entity_decode($plural, ENT_COMPAT, 'UTF-8');
109
-        });
110
-    }
99
+	/**
100
+	 * @param string $single
101
+	 * @param string $plural
102
+	 * @return array
103
+	 */
104
+	protected function getTranslationStrings($single, $plural)
105
+	{
106
+		return array_filter(glsr(Translation::class)->translations(), function ($string) use ($single, $plural) {
107
+			return $string['s1'] == html_entity_decode($single, ENT_COMPAT, 'UTF-8')
108
+				&& $string['p1'] == html_entity_decode($plural, ENT_COMPAT, 'UTF-8');
109
+		});
110
+	}
111 111
 
112
-    /**
113
-     * @return array
114
-     */
115
-    protected function normalizeTranslationArgs(array $args)
116
-    {
117
-        $defaults = [
118
-            'context' => '',
119
-            'number' => 1,
120
-            'plural' => '',
121
-            'single' => '',
122
-        ];
123
-        return shortcode_atts($defaults, $args);
124
-    }
112
+	/**
113
+	 * @return array
114
+	 */
115
+	protected function normalizeTranslationArgs(array $args)
116
+	{
117
+		$defaults = [
118
+			'context' => '',
119
+			'number' => 1,
120
+			'plural' => '',
121
+			'single' => '',
122
+		];
123
+		return shortcode_atts($defaults, $args);
124
+	}
125 125
 
126
-    /**
127
-     * @param string $domain
128
-     * @return string
129
-     */
130
-    protected function translatePlural($domain, array $string, array $args)
131
-    {
132
-        if (!empty($string['s2'])) {
133
-            $args['single'] = $string['s2'];
134
-        }
135
-        if (!empty($string['p2'])) {
136
-            $args['plural'] = $string['p2'];
137
-        }
138
-        return get_translations_for_domain($domain)->translate_plural(
139
-            $args['single'],
140
-            $args['plural'],
141
-            $args['number'],
142
-            $args['context']
143
-        );
144
-    }
126
+	/**
127
+	 * @param string $domain
128
+	 * @return string
129
+	 */
130
+	protected function translatePlural($domain, array $string, array $args)
131
+	{
132
+		if (!empty($string['s2'])) {
133
+			$args['single'] = $string['s2'];
134
+		}
135
+		if (!empty($string['p2'])) {
136
+			$args['plural'] = $string['p2'];
137
+		}
138
+		return get_translations_for_domain($domain)->translate_plural(
139
+			$args['single'],
140
+			$args['plural'],
141
+			$args['number'],
142
+			$args['context']
143
+		);
144
+	}
145 145
 
146
-    /**
147
-     * @param string $domain
148
-     * @return string
149
-     */
150
-    protected function translateSingle($domain, array $string, array $args)
151
-    {
152
-        if (!empty($string['s2'])) {
153
-            $args['single'] = $string['s2'];
154
-        }
155
-        return get_translations_for_domain($domain)->translate(
156
-            $args['single'],
157
-            $args['context']
158
-        );
159
-    }
146
+	/**
147
+	 * @param string $domain
148
+	 * @return string
149
+	 */
150
+	protected function translateSingle($domain, array $string, array $args)
151
+	{
152
+		if (!empty($string['s2'])) {
153
+			$args['single'] = $string['s2'];
154
+		}
155
+		return get_translations_for_domain($domain)->translate(
156
+			$args['single'],
157
+			$args['context']
158
+		);
159
+	}
160 160
 }
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
      * @return string
14 14
      * @filter gettext
15 15
      */
16
-    public function filterGettext($translation, $text, $domain)
16
+    public function filterGettext( $translation, $text, $domain )
17 17
     {
18
-        return $this->translate($translation, $domain, [
18
+        return $this->translate( $translation, $domain, [
19 19
             'single' => $text,
20
-        ]);
20
+        ] );
21 21
     }
22 22
 
23 23
     /**
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
      * @return string
29 29
      * @filter gettext_with_context
30 30
      */
31
-    public function filterGettextWithContext($translation, $text, $context, $domain)
31
+    public function filterGettextWithContext( $translation, $text, $context, $domain )
32 32
     {
33
-        return $this->translate($translation, $domain, [
33
+        return $this->translate( $translation, $domain, [
34 34
             'context' => $context,
35 35
             'single' => $text,
36
-        ]);
36
+        ] );
37 37
     }
38 38
 
39 39
     /**
@@ -45,13 +45,13 @@  discard block
 block discarded – undo
45 45
      * @return string
46 46
      * @filter ngettext
47 47
      */
48
-    public function filterNgettext($translation, $single, $plural, $number, $domain)
48
+    public function filterNgettext( $translation, $single, $plural, $number, $domain )
49 49
     {
50
-        return $this->translate($translation, $domain, [
50
+        return $this->translate( $translation, $domain, [
51 51
             'number' => $number,
52 52
             'plural' => $plural,
53 53
             'single' => $single,
54
-        ]);
54
+        ] );
55 55
     }
56 56
 
57 57
     /**
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
      * @return string
65 65
      * @filter ngettext_with_context
66 66
      */
67
-    public function filterNgettextWithContext($translation, $single, $plural, $number, $context, $domain)
67
+    public function filterNgettextWithContext( $translation, $single, $plural, $number, $context, $domain )
68 68
     {
69
-        return $this->translate($translation, $domain, [
69
+        return $this->translate( $translation, $domain, [
70 70
             'context' => $context,
71 71
             'number' => $number,
72 72
             'plural' => $plural,
73 73
             'single' => $single,
74
-        ]);
74
+        ] );
75 75
     }
76 76
 
77 77
     /**
@@ -79,21 +79,21 @@  discard block
 block discarded – undo
79 79
      * @param string $domain
80 80
      * @return string
81 81
      */
82
-    public function translate($original, $domain, array $args)
82
+    public function translate( $original, $domain, array $args )
83 83
     {
84
-        $domains = apply_filters('site-reviews/translator/domains', [Application::ID]);
85
-        if (!in_array($domain, $domains)) {
84
+        $domains = apply_filters( 'site-reviews/translator/domains', [Application::ID] );
85
+        if( !in_array( $domain, $domains ) ) {
86 86
             return $original;
87 87
         }
88
-        $args = $this->normalizeTranslationArgs($args);
89
-        $strings = $this->getTranslationStrings($args['single'], $args['plural']);
90
-        if (empty($strings)) {
88
+        $args = $this->normalizeTranslationArgs( $args );
89
+        $strings = $this->getTranslationStrings( $args['single'], $args['plural'] );
90
+        if( empty($strings) ) {
91 91
             return $original;
92 92
         }
93
-        $string = current($strings);
93
+        $string = current( $strings );
94 94
         return 'plural' == $string['type']
95
-            ? $this->translatePlural($domain, $string, $args)
96
-            : $this->translateSingle($domain, $string, $args);
95
+            ? $this->translatePlural( $domain, $string, $args )
96
+            : $this->translateSingle( $domain, $string, $args );
97 97
     }
98 98
 
99 99
     /**
@@ -101,18 +101,18 @@  discard block
 block discarded – undo
101 101
      * @param string $plural
102 102
      * @return array
103 103
      */
104
-    protected function getTranslationStrings($single, $plural)
104
+    protected function getTranslationStrings( $single, $plural )
105 105
     {
106
-        return array_filter(glsr(Translation::class)->translations(), function ($string) use ($single, $plural) {
107
-            return $string['s1'] == html_entity_decode($single, ENT_COMPAT, 'UTF-8')
108
-                && $string['p1'] == html_entity_decode($plural, ENT_COMPAT, 'UTF-8');
106
+        return array_filter( glsr( Translation::class )->translations(), function( $string ) use ($single, $plural) {
107
+            return $string['s1'] == html_entity_decode( $single, ENT_COMPAT, 'UTF-8' )
108
+                && $string['p1'] == html_entity_decode( $plural, ENT_COMPAT, 'UTF-8' );
109 109
         });
110 110
     }
111 111
 
112 112
     /**
113 113
      * @return array
114 114
      */
115
-    protected function normalizeTranslationArgs(array $args)
115
+    protected function normalizeTranslationArgs( array $args )
116 116
     {
117 117
         $defaults = [
118 118
             'context' => '',
@@ -120,22 +120,22 @@  discard block
 block discarded – undo
120 120
             'plural' => '',
121 121
             'single' => '',
122 122
         ];
123
-        return shortcode_atts($defaults, $args);
123
+        return shortcode_atts( $defaults, $args );
124 124
     }
125 125
 
126 126
     /**
127 127
      * @param string $domain
128 128
      * @return string
129 129
      */
130
-    protected function translatePlural($domain, array $string, array $args)
130
+    protected function translatePlural( $domain, array $string, array $args )
131 131
     {
132
-        if (!empty($string['s2'])) {
132
+        if( !empty($string['s2']) ) {
133 133
             $args['single'] = $string['s2'];
134 134
         }
135
-        if (!empty($string['p2'])) {
135
+        if( !empty($string['p2']) ) {
136 136
             $args['plural'] = $string['p2'];
137 137
         }
138
-        return get_translations_for_domain($domain)->translate_plural(
138
+        return get_translations_for_domain( $domain )->translate_plural(
139 139
             $args['single'],
140 140
             $args['plural'],
141 141
             $args['number'],
@@ -147,12 +147,12 @@  discard block
 block discarded – undo
147 147
      * @param string $domain
148 148
      * @return string
149 149
      */
150
-    protected function translateSingle($domain, array $string, array $args)
150
+    protected function translateSingle( $domain, array $string, array $args )
151 151
     {
152
-        if (!empty($string['s2'])) {
152
+        if( !empty($string['s2']) ) {
153 153
             $args['single'] = $string['s2'];
154 154
         }
155
-        return get_translations_for_domain($domain)->translate(
155
+        return get_translations_for_domain( $domain )->translate(
156 156
             $args['single'],
157 157
             $args['context']
158 158
         );
Please login to merge, or discard this patch.
plugin/Controllers/EditorController/Labels.php 2 patches
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -7,106 +7,106 @@
 block discarded – undo
7 7
 
8 8
 class Labels
9 9
 {
10
-    /**
11
-     * @return void
12
-     */
13
-    public function customizePostStatusLabels()
14
-    {
15
-        global $wp_scripts;
16
-        $strings = [
17
-            'savePending' => __('Save as Unapproved', 'site-reviews'),
18
-            'published' => __('Approved', 'site-reviews'),
19
-        ];
20
-        if (isset($wp_scripts->registered['post']->extra['data'])) {
21
-            $l10n = &$wp_scripts->registered['post']->extra['data'];
22
-            foreach ($strings as $search => $replace) {
23
-                $l10n = preg_replace('/("'.$search.'":")([^"]+)/', '$1'.$replace, $l10n);
24
-            }
25
-        }
26
-    }
10
+	/**
11
+	 * @return void
12
+	 */
13
+	public function customizePostStatusLabels()
14
+	{
15
+		global $wp_scripts;
16
+		$strings = [
17
+			'savePending' => __('Save as Unapproved', 'site-reviews'),
18
+			'published' => __('Approved', 'site-reviews'),
19
+		];
20
+		if (isset($wp_scripts->registered['post']->extra['data'])) {
21
+			$l10n = &$wp_scripts->registered['post']->extra['data'];
22
+			foreach ($strings as $search => $replace) {
23
+				$l10n = preg_replace('/("'.$search.'":")([^"]+)/', '$1'.$replace, $l10n);
24
+			}
25
+		}
26
+	}
27 27
 
28
-    /**
29
-     * @param string $translation
30
-     * @param string $test
31
-     * @return string
32
-     */
33
-    public function filterPostStatusLabels($translation, $text)
34
-    {
35
-        $replacements = $this->getStatusLabels();
36
-        return array_key_exists($text, $replacements)
37
-            ? $replacements[$text]
38
-            : $translation;
39
-    }
28
+	/**
29
+	 * @param string $translation
30
+	 * @param string $test
31
+	 * @return string
32
+	 */
33
+	public function filterPostStatusLabels($translation, $text)
34
+	{
35
+		$replacements = $this->getStatusLabels();
36
+		return array_key_exists($text, $replacements)
37
+			? $replacements[$text]
38
+			: $translation;
39
+	}
40 40
 
41
-    /**
42
-     * @return array
43
-     */
44
-    public function filterUpdateMessages(array $messages)
45
-    {
46
-        $post = get_post();
47
-        if (!($post instanceof WP_Post)) {
48
-            return;
49
-        }
50
-        $strings = $this->getReviewLabels();
51
-        $restored = filter_input(INPUT_GET, 'revision');
52
-        if ($revisionTitle = wp_post_revision_title(intval($restored), false)) {
53
-            $restored = sprintf($strings['restored'], $revisionTitle);
54
-        }
55
-        $scheduled_date = date_i18n('M j, Y @ H:i', strtotime($post->post_date));
56
-        $messages[Application::POST_TYPE] = [
57
-             1 => $strings['updated'],
58
-             4 => $strings['updated'],
59
-             5 => $restored,
60
-             6 => $strings['published'],
61
-             7 => $strings['saved'],
62
-             8 => $strings['submitted'],
63
-             9 => sprintf($strings['scheduled'], '<strong>'.$scheduled_date.'</strong>'),
64
-            10 => $strings['draft_updated'],
65
-            50 => $strings['approved'],
66
-            51 => $strings['unapproved'],
67
-            52 => $strings['reverted'],
68
-        ];
69
-        return $messages;
70
-    }
41
+	/**
42
+	 * @return array
43
+	 */
44
+	public function filterUpdateMessages(array $messages)
45
+	{
46
+		$post = get_post();
47
+		if (!($post instanceof WP_Post)) {
48
+			return;
49
+		}
50
+		$strings = $this->getReviewLabels();
51
+		$restored = filter_input(INPUT_GET, 'revision');
52
+		if ($revisionTitle = wp_post_revision_title(intval($restored), false)) {
53
+			$restored = sprintf($strings['restored'], $revisionTitle);
54
+		}
55
+		$scheduled_date = date_i18n('M j, Y @ H:i', strtotime($post->post_date));
56
+		$messages[Application::POST_TYPE] = [
57
+			 1 => $strings['updated'],
58
+			 4 => $strings['updated'],
59
+			 5 => $restored,
60
+			 6 => $strings['published'],
61
+			 7 => $strings['saved'],
62
+			 8 => $strings['submitted'],
63
+			 9 => sprintf($strings['scheduled'], '<strong>'.$scheduled_date.'</strong>'),
64
+			10 => $strings['draft_updated'],
65
+			50 => $strings['approved'],
66
+			51 => $strings['unapproved'],
67
+			52 => $strings['reverted'],
68
+		];
69
+		return $messages;
70
+	}
71 71
 
72
-    /**
73
-     * @return array
74
-     */
75
-    protected function getReviewLabels()
76
-    {
77
-        return [
78
-            'approved' => __('Review has been approved and published.', 'site-reviews'),
79
-            'draft_updated' => __('Review draft updated.', 'site-reviews'),
80
-            'preview' => __('Preview review', 'site-reviews'),
81
-            'published' => __('Review approved and published.', 'site-reviews'),
82
-            'restored' => __('Review restored to revision from %s.', 'site-reviews'),
83
-            'reverted' => __('Review has been reverted to its original submission state (title, content, and submission date).', 'site-reviews'),
84
-            'saved' => __('Review saved.', 'site-reviews'),
85
-            'scheduled' => __('Review scheduled for: %s.', 'site-reviews'),
86
-            'submitted' => __('Review submitted.', 'site-reviews'),
87
-            'unapproved' => __('Review has been unapproved and is now pending.', 'site-reviews'),
88
-            'updated' => __('Review updated.', 'site-reviews'),
89
-            'view' => __('View review', 'site-reviews'),
90
-        ];
91
-    }
72
+	/**
73
+	 * @return array
74
+	 */
75
+	protected function getReviewLabels()
76
+	{
77
+		return [
78
+			'approved' => __('Review has been approved and published.', 'site-reviews'),
79
+			'draft_updated' => __('Review draft updated.', 'site-reviews'),
80
+			'preview' => __('Preview review', 'site-reviews'),
81
+			'published' => __('Review approved and published.', 'site-reviews'),
82
+			'restored' => __('Review restored to revision from %s.', 'site-reviews'),
83
+			'reverted' => __('Review has been reverted to its original submission state (title, content, and submission date).', 'site-reviews'),
84
+			'saved' => __('Review saved.', 'site-reviews'),
85
+			'scheduled' => __('Review scheduled for: %s.', 'site-reviews'),
86
+			'submitted' => __('Review submitted.', 'site-reviews'),
87
+			'unapproved' => __('Review has been unapproved and is now pending.', 'site-reviews'),
88
+			'updated' => __('Review updated.', 'site-reviews'),
89
+			'view' => __('View review', 'site-reviews'),
90
+		];
91
+	}
92 92
 
93
-    /**
94
-     * Store the labels to avoid unnecessary loops.
95
-     * @return array
96
-     */
97
-    protected function getStatusLabels()
98
-    {
99
-        static $labels;
100
-        if (empty($labels)) {
101
-            $labels = [
102
-                'Pending' => __('Unapproved', 'site-reviews'),
103
-                'Pending Review' => __('Unapproved', 'site-reviews'),
104
-                'Privately Published' => __('Privately Approved', 'site-reviews'),
105
-                'Publish' => __('Approve', 'site-reviews'),
106
-                'Published' => __('Approved', 'site-reviews'),
107
-                'Save as Pending' => __('Save as Unapproved', 'site-reviews'),
108
-            ];
109
-        }
110
-        return $labels;
111
-    }
93
+	/**
94
+	 * Store the labels to avoid unnecessary loops.
95
+	 * @return array
96
+	 */
97
+	protected function getStatusLabels()
98
+	{
99
+		static $labels;
100
+		if (empty($labels)) {
101
+			$labels = [
102
+				'Pending' => __('Unapproved', 'site-reviews'),
103
+				'Pending Review' => __('Unapproved', 'site-reviews'),
104
+				'Privately Published' => __('Privately Approved', 'site-reviews'),
105
+				'Publish' => __('Approve', 'site-reviews'),
106
+				'Published' => __('Approved', 'site-reviews'),
107
+				'Save as Pending' => __('Save as Unapproved', 'site-reviews'),
108
+			];
109
+		}
110
+		return $labels;
111
+	}
112 112
 }
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
     {
15 15
         global $wp_scripts;
16 16
         $strings = [
17
-            'savePending' => __('Save as Unapproved', 'site-reviews'),
18
-            'published' => __('Approved', 'site-reviews'),
17
+            'savePending' => __( 'Save as Unapproved', 'site-reviews' ),
18
+            'published' => __( 'Approved', 'site-reviews' ),
19 19
         ];
20
-        if (isset($wp_scripts->registered['post']->extra['data'])) {
20
+        if( isset($wp_scripts->registered['post']->extra['data']) ) {
21 21
             $l10n = &$wp_scripts->registered['post']->extra['data'];
22
-            foreach ($strings as $search => $replace) {
23
-                $l10n = preg_replace('/("'.$search.'":")([^"]+)/', '$1'.$replace, $l10n);
22
+            foreach( $strings as $search => $replace ) {
23
+                $l10n = preg_replace( '/("'.$search.'":")([^"]+)/', '$1'.$replace, $l10n );
24 24
             }
25 25
         }
26 26
     }
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
      * @param string $test
31 31
      * @return string
32 32
      */
33
-    public function filterPostStatusLabels($translation, $text)
33
+    public function filterPostStatusLabels( $translation, $text )
34 34
     {
35 35
         $replacements = $this->getStatusLabels();
36
-        return array_key_exists($text, $replacements)
36
+        return array_key_exists( $text, $replacements )
37 37
             ? $replacements[$text]
38 38
             : $translation;
39 39
     }
@@ -41,18 +41,18 @@  discard block
 block discarded – undo
41 41
     /**
42 42
      * @return array
43 43
      */
44
-    public function filterUpdateMessages(array $messages)
44
+    public function filterUpdateMessages( array $messages )
45 45
     {
46 46
         $post = get_post();
47
-        if (!($post instanceof WP_Post)) {
47
+        if( !($post instanceof WP_Post) ) {
48 48
             return;
49 49
         }
50 50
         $strings = $this->getReviewLabels();
51
-        $restored = filter_input(INPUT_GET, 'revision');
52
-        if ($revisionTitle = wp_post_revision_title(intval($restored), false)) {
53
-            $restored = sprintf($strings['restored'], $revisionTitle);
51
+        $restored = filter_input( INPUT_GET, 'revision' );
52
+        if( $revisionTitle = wp_post_revision_title( intval( $restored ), false ) ) {
53
+            $restored = sprintf( $strings['restored'], $revisionTitle );
54 54
         }
55
-        $scheduled_date = date_i18n('M j, Y @ H:i', strtotime($post->post_date));
55
+        $scheduled_date = date_i18n( 'M j, Y @ H:i', strtotime( $post->post_date ) );
56 56
         $messages[Application::POST_TYPE] = [
57 57
              1 => $strings['updated'],
58 58
              4 => $strings['updated'],
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
              6 => $strings['published'],
61 61
              7 => $strings['saved'],
62 62
              8 => $strings['submitted'],
63
-             9 => sprintf($strings['scheduled'], '<strong>'.$scheduled_date.'</strong>'),
63
+             9 => sprintf( $strings['scheduled'], '<strong>'.$scheduled_date.'</strong>' ),
64 64
             10 => $strings['draft_updated'],
65 65
             50 => $strings['approved'],
66 66
             51 => $strings['unapproved'],
@@ -75,18 +75,18 @@  discard block
 block discarded – undo
75 75
     protected function getReviewLabels()
76 76
     {
77 77
         return [
78
-            'approved' => __('Review has been approved and published.', 'site-reviews'),
79
-            'draft_updated' => __('Review draft updated.', 'site-reviews'),
80
-            'preview' => __('Preview review', 'site-reviews'),
81
-            'published' => __('Review approved and published.', 'site-reviews'),
82
-            'restored' => __('Review restored to revision from %s.', 'site-reviews'),
83
-            'reverted' => __('Review has been reverted to its original submission state (title, content, and submission date).', 'site-reviews'),
84
-            'saved' => __('Review saved.', 'site-reviews'),
85
-            'scheduled' => __('Review scheduled for: %s.', 'site-reviews'),
86
-            'submitted' => __('Review submitted.', 'site-reviews'),
87
-            'unapproved' => __('Review has been unapproved and is now pending.', 'site-reviews'),
88
-            'updated' => __('Review updated.', 'site-reviews'),
89
-            'view' => __('View review', 'site-reviews'),
78
+            'approved' => __( 'Review has been approved and published.', 'site-reviews' ),
79
+            'draft_updated' => __( 'Review draft updated.', 'site-reviews' ),
80
+            'preview' => __( 'Preview review', 'site-reviews' ),
81
+            'published' => __( 'Review approved and published.', 'site-reviews' ),
82
+            'restored' => __( 'Review restored to revision from %s.', 'site-reviews' ),
83
+            'reverted' => __( 'Review has been reverted to its original submission state (title, content, and submission date).', 'site-reviews' ),
84
+            'saved' => __( 'Review saved.', 'site-reviews' ),
85
+            'scheduled' => __( 'Review scheduled for: %s.', 'site-reviews' ),
86
+            'submitted' => __( 'Review submitted.', 'site-reviews' ),
87
+            'unapproved' => __( 'Review has been unapproved and is now pending.', 'site-reviews' ),
88
+            'updated' => __( 'Review updated.', 'site-reviews' ),
89
+            'view' => __( 'View review', 'site-reviews' ),
90 90
         ];
91 91
     }
92 92
 
@@ -97,14 +97,14 @@  discard block
 block discarded – undo
97 97
     protected function getStatusLabels()
98 98
     {
99 99
         static $labels;
100
-        if (empty($labels)) {
100
+        if( empty($labels) ) {
101 101
             $labels = [
102
-                'Pending' => __('Unapproved', 'site-reviews'),
103
-                'Pending Review' => __('Unapproved', 'site-reviews'),
104
-                'Privately Published' => __('Privately Approved', 'site-reviews'),
105
-                'Publish' => __('Approve', 'site-reviews'),
106
-                'Published' => __('Approved', 'site-reviews'),
107
-                'Save as Pending' => __('Save as Unapproved', 'site-reviews'),
102
+                'Pending' => __( 'Unapproved', 'site-reviews' ),
103
+                'Pending Review' => __( 'Unapproved', 'site-reviews' ),
104
+                'Privately Published' => __( 'Privately Approved', 'site-reviews' ),
105
+                'Publish' => __( 'Approve', 'site-reviews' ),
106
+                'Published' => __( 'Approved', 'site-reviews' ),
107
+                'Save as Pending' => __( 'Save as Unapproved', 'site-reviews' ),
108 108
             ];
109 109
         }
110 110
         return $labels;
Please login to merge, or discard this patch.
plugin/Controllers/EditorController.php 2 patches
Indentation   +421 added lines, -421 removed lines patch added patch discarded remove patch
@@ -19,453 +19,453 @@
 block discarded – undo
19 19
 
20 20
 class EditorController extends Controller
21 21
 {
22
-    /**
23
-     * @return void
24
-     * @action admin_enqueue_scripts
25
-     */
26
-    public function customizePostStatusLabels()
27
-    {
28
-        if ($this->canModifyTranslation()) {
29
-            glsr(Labels::class)->customizePostStatusLabels();
30
-        }
31
-    }
22
+	/**
23
+	 * @return void
24
+	 * @action admin_enqueue_scripts
25
+	 */
26
+	public function customizePostStatusLabels()
27
+	{
28
+		if ($this->canModifyTranslation()) {
29
+			glsr(Labels::class)->customizePostStatusLabels();
30
+		}
31
+	}
32 32
 
33
-    /**
34
-     * @param array $settings
35
-     * @return array
36
-     * @filter wp_editor_settings
37
-     */
38
-    public function filterEditorSettings($settings)
39
-    {
40
-        return glsr(Customization::class)->filterEditorSettings(
41
-            Arr::consolidateArray($settings)
42
-        );
43
-    }
33
+	/**
34
+	 * @param array $settings
35
+	 * @return array
36
+	 * @filter wp_editor_settings
37
+	 */
38
+	public function filterEditorSettings($settings)
39
+	{
40
+		return glsr(Customization::class)->filterEditorSettings(
41
+			Arr::consolidateArray($settings)
42
+		);
43
+	}
44 44
 
45
-    /**
46
-     * Modify the WP_Editor html to allow autosizing without breaking the `editor-expand` script.
47
-     * @param string $html
48
-     * @return string
49
-     * @filter the_editor
50
-     */
51
-    public function filterEditorTextarea($html)
52
-    {
53
-        return glsr(Customization::class)->filterEditorTextarea($html);
54
-    }
45
+	/**
46
+	 * Modify the WP_Editor html to allow autosizing without breaking the `editor-expand` script.
47
+	 * @param string $html
48
+	 * @return string
49
+	 * @filter the_editor
50
+	 */
51
+	public function filterEditorTextarea($html)
52
+	{
53
+		return glsr(Customization::class)->filterEditorTextarea($html);
54
+	}
55 55
 
56
-    /**
57
-     * @param bool $protected
58
-     * @param string $metaKey
59
-     * @param string $metaType
60
-     * @return bool
61
-     * @filter is_protected_meta
62
-     */
63
-    public function filterIsProtectedMeta($protected, $metaKey, $metaType)
64
-    {
65
-        if ('post' == $metaType && Application::POST_TYPE == get_post_type()) {
66
-            $values = glsr(CreateReviewDefaults::class)->unguarded();
67
-            $values = Arr::prefixArrayKeys($values);
68
-            if (array_key_exists($metaKey, $values)) {
69
-                $protected = false;
70
-            }
71
-        }
72
-        return $protected;
73
-    }
56
+	/**
57
+	 * @param bool $protected
58
+	 * @param string $metaKey
59
+	 * @param string $metaType
60
+	 * @return bool
61
+	 * @filter is_protected_meta
62
+	 */
63
+	public function filterIsProtectedMeta($protected, $metaKey, $metaType)
64
+	{
65
+		if ('post' == $metaType && Application::POST_TYPE == get_post_type()) {
66
+			$values = glsr(CreateReviewDefaults::class)->unguarded();
67
+			$values = Arr::prefixArrayKeys($values);
68
+			if (array_key_exists($metaKey, $values)) {
69
+				$protected = false;
70
+			}
71
+		}
72
+		return $protected;
73
+	}
74 74
 
75
-    /**
76
-     * @param string $translation
77
-     * @param string $test
78
-     * @param string $domain
79
-     * @return string
80
-     * @filter gettext
81
-     */
82
-    public function filterPostStatusLabels($translation, $text, $domain)
83
-    {
84
-        return $this->canModifyTranslation($domain)
85
-            ? glsr(Labels::class)->filterPostStatusLabels($translation, $text)
86
-            : $translation;
87
-    }
75
+	/**
76
+	 * @param string $translation
77
+	 * @param string $test
78
+	 * @param string $domain
79
+	 * @return string
80
+	 * @filter gettext
81
+	 */
82
+	public function filterPostStatusLabels($translation, $text, $domain)
83
+	{
84
+		return $this->canModifyTranslation($domain)
85
+			? glsr(Labels::class)->filterPostStatusLabels($translation, $text)
86
+			: $translation;
87
+	}
88 88
 
89
-    /**
90
-     * @param string $translation
91
-     * @param string $test
92
-     * @param string $domain
93
-     * @return string
94
-     * @filter gettext_with_context
95
-     */
96
-    public function filterPostStatusLabelsWithContext($translation, $text, $context, $domain)
97
-    {
98
-        return $this->canModifyTranslation($domain)
99
-            ? glsr(Labels::class)->filterPostStatusLabels($translation, $text)
100
-            : $translation;
101
-    }
89
+	/**
90
+	 * @param string $translation
91
+	 * @param string $test
92
+	 * @param string $domain
93
+	 * @return string
94
+	 * @filter gettext_with_context
95
+	 */
96
+	public function filterPostStatusLabelsWithContext($translation, $text, $context, $domain)
97
+	{
98
+		return $this->canModifyTranslation($domain)
99
+			? glsr(Labels::class)->filterPostStatusLabels($translation, $text)
100
+			: $translation;
101
+	}
102 102
 
103
-    /**
104
-     * @param array $messages
105
-     * @return array
106
-     * @filter post_updated_messages
107
-     */
108
-    public function filterUpdateMessages($messages)
109
-    {
110
-        return glsr(Labels::class)->filterUpdateMessages(
111
-            Arr::consolidateArray($messages)
112
-        );
113
-    }
103
+	/**
104
+	 * @param array $messages
105
+	 * @return array
106
+	 * @filter post_updated_messages
107
+	 */
108
+	public function filterUpdateMessages($messages)
109
+	{
110
+		return glsr(Labels::class)->filterUpdateMessages(
111
+			Arr::consolidateArray($messages)
112
+		);
113
+	}
114 114
 
115
-    /**
116
-     * @return void
117
-     * @action add_meta_boxes_{Application::POST_TYPE}
118
-     */
119
-    public function registerMetaBoxes($post)
120
-    {
121
-        add_meta_box(Application::ID.'_assigned_to', __('Assigned To', 'site-reviews'), [$this, 'renderAssignedToMetabox'], null, 'side');
122
-        add_meta_box(Application::ID.'_review', __('Details', 'site-reviews'), [$this, 'renderDetailsMetaBox'], null, 'side');
123
-        if ('local' != glsr(Database::class)->get($post->ID, 'review_type')) {
124
-            return;
125
-        }
126
-        add_meta_box(Application::ID.'_response', __('Respond Publicly', 'site-reviews'), [$this, 'renderResponseMetaBox'], null, 'normal');
127
-    }
115
+	/**
116
+	 * @return void
117
+	 * @action add_meta_boxes_{Application::POST_TYPE}
118
+	 */
119
+	public function registerMetaBoxes($post)
120
+	{
121
+		add_meta_box(Application::ID.'_assigned_to', __('Assigned To', 'site-reviews'), [$this, 'renderAssignedToMetabox'], null, 'side');
122
+		add_meta_box(Application::ID.'_review', __('Details', 'site-reviews'), [$this, 'renderDetailsMetaBox'], null, 'side');
123
+		if ('local' != glsr(Database::class)->get($post->ID, 'review_type')) {
124
+			return;
125
+		}
126
+		add_meta_box(Application::ID.'_response', __('Respond Publicly', 'site-reviews'), [$this, 'renderResponseMetaBox'], null, 'normal');
127
+	}
128 128
 
129
-    /**
130
-     * @return void
131
-     * @action admin_print_scripts
132
-     */
133
-    public function removeAutosave()
134
-    {
135
-        glsr(Customization::class)->removeAutosave();
136
-    }
129
+	/**
130
+	 * @return void
131
+	 * @action admin_print_scripts
132
+	 */
133
+	public function removeAutosave()
134
+	{
135
+		glsr(Customization::class)->removeAutosave();
136
+	}
137 137
 
138
-    /**
139
-     * @return void
140
-     * @action admin_menu
141
-     */
142
-    public function removeMetaBoxes()
143
-    {
144
-        glsr(Customization::class)->removeMetaBoxes();
145
-    }
138
+	/**
139
+	 * @return void
140
+	 * @action admin_menu
141
+	 */
142
+	public function removeMetaBoxes()
143
+	{
144
+		glsr(Customization::class)->removeMetaBoxes();
145
+	}
146 146
 
147
-    /**
148
-     * @return void
149
-     */
150
-    public function removePostTypeSupport()
151
-    {
152
-        glsr(Customization::class)->removePostTypeSupport();
153
-    }
147
+	/**
148
+	 * @return void
149
+	 */
150
+	public function removePostTypeSupport()
151
+	{
152
+		glsr(Customization::class)->removePostTypeSupport();
153
+	}
154 154
 
155
-    /**
156
-     * @param WP_Post $post
157
-     * @return void
158
-     * @callback add_meta_box
159
-     */
160
-    public function renderAssignedToMetabox($post)
161
-    {
162
-        if (!$this->isReviewPostType($post)) {
163
-            return;
164
-        }
165
-        $assignedTo = (string) glsr(Database::class)->get($post->ID, 'assigned_to');
166
-        wp_nonce_field('assigned_to', '_nonce-assigned-to', false);
167
-        glsr()->render('partials/editor/metabox-assigned-to', [
168
-            'id' => $assignedTo,
169
-            'template' => $this->buildAssignedToTemplate($assignedTo, $post),
170
-        ]);
171
-    }
155
+	/**
156
+	 * @param WP_Post $post
157
+	 * @return void
158
+	 * @callback add_meta_box
159
+	 */
160
+	public function renderAssignedToMetabox($post)
161
+	{
162
+		if (!$this->isReviewPostType($post)) {
163
+			return;
164
+		}
165
+		$assignedTo = (string) glsr(Database::class)->get($post->ID, 'assigned_to');
166
+		wp_nonce_field('assigned_to', '_nonce-assigned-to', false);
167
+		glsr()->render('partials/editor/metabox-assigned-to', [
168
+			'id' => $assignedTo,
169
+			'template' => $this->buildAssignedToTemplate($assignedTo, $post),
170
+		]);
171
+	}
172 172
 
173
-    /**
174
-     * @param WP_Post $post
175
-     * @return void
176
-     * @callback add_meta_box
177
-     */
178
-    public function renderDetailsMetaBox($post)
179
-    {
180
-        if (!$this->isReviewPostType($post)) {
181
-            return;
182
-        }
183
-        $review = glsr_get_review($post);
184
-        glsr()->render('partials/editor/metabox-details', [
185
-            'button' => $this->buildDetailsMetaBoxRevertButton($review, $post),
186
-            'metabox' => $this->normalizeDetailsMetaBox($review),
187
-        ]);
188
-    }
173
+	/**
174
+	 * @param WP_Post $post
175
+	 * @return void
176
+	 * @callback add_meta_box
177
+	 */
178
+	public function renderDetailsMetaBox($post)
179
+	{
180
+		if (!$this->isReviewPostType($post)) {
181
+			return;
182
+		}
183
+		$review = glsr_get_review($post);
184
+		glsr()->render('partials/editor/metabox-details', [
185
+			'button' => $this->buildDetailsMetaBoxRevertButton($review, $post),
186
+			'metabox' => $this->normalizeDetailsMetaBox($review),
187
+		]);
188
+	}
189 189
 
190
-    /**
191
-     * @return void
192
-     * @action post_submitbox_misc_actions
193
-     */
194
-    public function renderPinnedInPublishMetaBox()
195
-    {
196
-        if (!$this->isReviewPostType(get_post())) {
197
-            return;
198
-        }
199
-        glsr(Template::class)->render('partials/editor/pinned', [
200
-            'context' => [
201
-                'no' => __('No', 'site-reviews'),
202
-                'yes' => __('Yes', 'site-reviews'),
203
-            ],
204
-            'pinned' => wp_validate_boolean(glsr(Database::class)->get(get_the_ID(), 'pinned')),
205
-        ]);
206
-    }
190
+	/**
191
+	 * @return void
192
+	 * @action post_submitbox_misc_actions
193
+	 */
194
+	public function renderPinnedInPublishMetaBox()
195
+	{
196
+		if (!$this->isReviewPostType(get_post())) {
197
+			return;
198
+		}
199
+		glsr(Template::class)->render('partials/editor/pinned', [
200
+			'context' => [
201
+				'no' => __('No', 'site-reviews'),
202
+				'yes' => __('Yes', 'site-reviews'),
203
+			],
204
+			'pinned' => wp_validate_boolean(glsr(Database::class)->get(get_the_ID(), 'pinned')),
205
+		]);
206
+	}
207 207
 
208
-    /**
209
-     * @param WP_Post $post
210
-     * @return void
211
-     * @callback add_meta_box
212
-     */
213
-    public function renderResponseMetaBox($post)
214
-    {
215
-        if (!$this->isReviewPostType($post)) {
216
-            return;
217
-        }
218
-        wp_nonce_field('response', '_nonce-response', false);
219
-        glsr()->render('partials/editor/metabox-response', [
220
-            'response' => glsr(Database::class)->get($post->ID, 'response'),
221
-        ]);
222
-    }
208
+	/**
209
+	 * @param WP_Post $post
210
+	 * @return void
211
+	 * @callback add_meta_box
212
+	 */
213
+	public function renderResponseMetaBox($post)
214
+	{
215
+		if (!$this->isReviewPostType($post)) {
216
+			return;
217
+		}
218
+		wp_nonce_field('response', '_nonce-response', false);
219
+		glsr()->render('partials/editor/metabox-response', [
220
+			'response' => glsr(Database::class)->get($post->ID, 'response'),
221
+		]);
222
+	}
223 223
 
224
-    /**
225
-     * @param WP_Post $post
226
-     * @return void
227
-     * @action edit_form_after_title
228
-     */
229
-    public function renderReviewEditor($post)
230
-    {
231
-        if (!$this->isReviewPostType($post) || $this->isReviewEditable($post)) {
232
-            return;
233
-        }
234
-        glsr()->render('partials/editor/review', [
235
-            'post' => $post,
236
-            'response' => glsr(Database::class)->get($post->ID, 'response'),
237
-        ]);
238
-    }
224
+	/**
225
+	 * @param WP_Post $post
226
+	 * @return void
227
+	 * @action edit_form_after_title
228
+	 */
229
+	public function renderReviewEditor($post)
230
+	{
231
+		if (!$this->isReviewPostType($post) || $this->isReviewEditable($post)) {
232
+			return;
233
+		}
234
+		glsr()->render('partials/editor/review', [
235
+			'post' => $post,
236
+			'response' => glsr(Database::class)->get($post->ID, 'response'),
237
+		]);
238
+	}
239 239
 
240
-    /**
241
-     * @return void
242
-     * @action admin_head
243
-     */
244
-    public function renderReviewFields()
245
-    {
246
-        $screen = glsr_current_screen();
247
-        if ('post' != $screen->base || Application::POST_TYPE != $screen->post_type) {
248
-            return;
249
-        }
250
-        add_action('edit_form_after_title', [$this, 'renderReviewEditor']);
251
-        add_action('edit_form_top', [$this, 'renderReviewNotice']);
252
-    }
240
+	/**
241
+	 * @return void
242
+	 * @action admin_head
243
+	 */
244
+	public function renderReviewFields()
245
+	{
246
+		$screen = glsr_current_screen();
247
+		if ('post' != $screen->base || Application::POST_TYPE != $screen->post_type) {
248
+			return;
249
+		}
250
+		add_action('edit_form_after_title', [$this, 'renderReviewEditor']);
251
+		add_action('edit_form_top', [$this, 'renderReviewNotice']);
252
+	}
253 253
 
254
-    /**
255
-     * @param WP_Post $post
256
-     * @return void
257
-     * @action edit_form_top
258
-     */
259
-    public function renderReviewNotice($post)
260
-    {
261
-        if (!$this->isReviewPostType($post) || $this->isReviewEditable($post)) {
262
-            return;
263
-        }
264
-        glsr(Notice::class)->addWarning(sprintf(
265
-            __('%s reviews are read-only.', 'site-reviews'),
266
-            glsr(Columns::class)->buildColumnReviewType($post->ID)
267
-        ));
268
-        glsr(Template::class)->render('partials/editor/notice', [
269
-            'context' => [
270
-                'notices' => glsr(Notice::class)->get(),
271
-            ],
272
-        ]);
273
-    }
254
+	/**
255
+	 * @param WP_Post $post
256
+	 * @return void
257
+	 * @action edit_form_top
258
+	 */
259
+	public function renderReviewNotice($post)
260
+	{
261
+		if (!$this->isReviewPostType($post) || $this->isReviewEditable($post)) {
262
+			return;
263
+		}
264
+		glsr(Notice::class)->addWarning(sprintf(
265
+			__('%s reviews are read-only.', 'site-reviews'),
266
+			glsr(Columns::class)->buildColumnReviewType($post->ID)
267
+		));
268
+		glsr(Template::class)->render('partials/editor/notice', [
269
+			'context' => [
270
+				'notices' => glsr(Notice::class)->get(),
271
+			],
272
+		]);
273
+	}
274 274
 
275
-    /**
276
-     * @param WP_Post $post
277
-     * @return void
278
-     * @see glsr_categories_meta_box()
279
-     * @callback register_taxonomy
280
-     */
281
-    public function renderTaxonomyMetabox($post)
282
-    {
283
-        if (!$this->isReviewPostType($post)) {
284
-            return;
285
-        }
286
-        glsr()->render('partials/editor/metabox-categories', [
287
-            'post' => $post,
288
-            'tax_name' => Application::TAXONOMY,
289
-            'taxonomy' => get_taxonomy(Application::TAXONOMY),
290
-        ]);
291
-    }
275
+	/**
276
+	 * @param WP_Post $post
277
+	 * @return void
278
+	 * @see glsr_categories_meta_box()
279
+	 * @callback register_taxonomy
280
+	 */
281
+	public function renderTaxonomyMetabox($post)
282
+	{
283
+		if (!$this->isReviewPostType($post)) {
284
+			return;
285
+		}
286
+		glsr()->render('partials/editor/metabox-categories', [
287
+			'post' => $post,
288
+			'tax_name' => Application::TAXONOMY,
289
+			'taxonomy' => get_taxonomy(Application::TAXONOMY),
290
+		]);
291
+	}
292 292
 
293
-    /**
294
-     * @return void
295
-     * @see $this->filterUpdateMessages()
296
-     * @action admin_action_revert
297
-     */
298
-    public function revertReview()
299
-    {
300
-        if (Application::ID != filter_input(INPUT_GET, 'plugin')) {
301
-            return;
302
-        }
303
-        check_admin_referer('revert-review_'.($postId = $this->getPostId()));
304
-        glsr(ReviewManager::class)->revert($postId);
305
-        $this->redirect($postId, 52);
306
-    }
293
+	/**
294
+	 * @return void
295
+	 * @see $this->filterUpdateMessages()
296
+	 * @action admin_action_revert
297
+	 */
298
+	public function revertReview()
299
+	{
300
+		if (Application::ID != filter_input(INPUT_GET, 'plugin')) {
301
+			return;
302
+		}
303
+		check_admin_referer('revert-review_'.($postId = $this->getPostId()));
304
+		glsr(ReviewManager::class)->revert($postId);
305
+		$this->redirect($postId, 52);
306
+	}
307 307
 
308
-    /**
309
-     * @param int $postId
310
-     * @param \WP_Post $post
311
-     * @param bool $isUpdate
312
-     * @return void
313
-     * @action save_post_.Application::POST_TYPE
314
-     */
315
-    public function saveMetaboxes($postId, $post, $isUpdating)
316
-    {
317
-        glsr(Metaboxes::class)->saveAssignedToMetabox($postId);
318
-        glsr(Metaboxes::class)->saveResponseMetabox($postId);
319
-        if ($isUpdating) {
320
-            do_action('site-reviews/review/saved', glsr_get_review($postId));
321
-        }
322
-    }
308
+	/**
309
+	 * @param int $postId
310
+	 * @param \WP_Post $post
311
+	 * @param bool $isUpdate
312
+	 * @return void
313
+	 * @action save_post_.Application::POST_TYPE
314
+	 */
315
+	public function saveMetaboxes($postId, $post, $isUpdating)
316
+	{
317
+		glsr(Metaboxes::class)->saveAssignedToMetabox($postId);
318
+		glsr(Metaboxes::class)->saveResponseMetabox($postId);
319
+		if ($isUpdating) {
320
+			do_action('site-reviews/review/saved', glsr_get_review($postId));
321
+		}
322
+	}
323 323
 
324
-    /**
325
-     * @param string $assignedTo
326
-     * @return string
327
-     */
328
-    protected function buildAssignedToTemplate($assignedTo, WP_Post $post)
329
-    {
330
-        $assignedPost = glsr(Database::class)->getAssignedToPost($post->ID, $assignedTo);
331
-        if (!($assignedPost instanceof WP_Post)) {
332
-            return;
333
-        }
334
-        return glsr(Template::class)->build('partials/editor/assigned-post', [
335
-            'context' => [
336
-                'data.url' => (string) get_permalink($assignedPost),
337
-                'data.title' => get_the_title($assignedPost),
338
-            ],
339
-        ]);
340
-    }
324
+	/**
325
+	 * @param string $assignedTo
326
+	 * @return string
327
+	 */
328
+	protected function buildAssignedToTemplate($assignedTo, WP_Post $post)
329
+	{
330
+		$assignedPost = glsr(Database::class)->getAssignedToPost($post->ID, $assignedTo);
331
+		if (!($assignedPost instanceof WP_Post)) {
332
+			return;
333
+		}
334
+		return glsr(Template::class)->build('partials/editor/assigned-post', [
335
+			'context' => [
336
+				'data.url' => (string) get_permalink($assignedPost),
337
+				'data.title' => get_the_title($assignedPost),
338
+			],
339
+		]);
340
+	}
341 341
 
342
-    /**
343
-     * @return string
344
-     */
345
-    protected function buildDetailsMetaBoxRevertButton(Review $review, WP_Post $post)
346
-    {
347
-        $isModified = !Arr::compareArrays(
348
-            [$review->title, $review->content, $review->date],
349
-            [
350
-                glsr(Database::class)->get($post->ID, 'title'),
351
-                glsr(Database::class)->get($post->ID, 'content'),
352
-                glsr(Database::class)->get($post->ID, 'date'),
353
-            ]
354
-        );
355
-        if ($isModified) {
356
-            $revertUrl = wp_nonce_url(
357
-                admin_url('post.php?post='.$post->ID.'&action=revert&plugin='.Application::ID),
358
-                'revert-review_'.$post->ID
359
-            );
360
-            return glsr(Builder::class)->a(__('Revert Changes', 'site-reviews'), [
361
-                'class' => 'button button-large',
362
-                'href' => $revertUrl,
363
-                'id' => 'revert',
364
-            ]);
365
-        }
366
-        return glsr(Builder::class)->button(__('Nothing to Revert', 'site-reviews'), [
367
-            'class' => 'button-large',
368
-            'disabled' => true,
369
-            'id' => 'revert',
370
-        ]);
371
-    }
342
+	/**
343
+	 * @return string
344
+	 */
345
+	protected function buildDetailsMetaBoxRevertButton(Review $review, WP_Post $post)
346
+	{
347
+		$isModified = !Arr::compareArrays(
348
+			[$review->title, $review->content, $review->date],
349
+			[
350
+				glsr(Database::class)->get($post->ID, 'title'),
351
+				glsr(Database::class)->get($post->ID, 'content'),
352
+				glsr(Database::class)->get($post->ID, 'date'),
353
+			]
354
+		);
355
+		if ($isModified) {
356
+			$revertUrl = wp_nonce_url(
357
+				admin_url('post.php?post='.$post->ID.'&action=revert&plugin='.Application::ID),
358
+				'revert-review_'.$post->ID
359
+			);
360
+			return glsr(Builder::class)->a(__('Revert Changes', 'site-reviews'), [
361
+				'class' => 'button button-large',
362
+				'href' => $revertUrl,
363
+				'id' => 'revert',
364
+			]);
365
+		}
366
+		return glsr(Builder::class)->button(__('Nothing to Revert', 'site-reviews'), [
367
+			'class' => 'button-large',
368
+			'disabled' => true,
369
+			'id' => 'revert',
370
+		]);
371
+	}
372 372
 
373
-    /**
374
-     * @param string $domain
375
-     * @return bool
376
-     */
377
-    protected function canModifyTranslation($domain = 'default')
378
-    {
379
-        if ('default' != $domain || empty(glsr_current_screen()->base)) {
380
-            return false;
381
-        }
382
-        return Application::POST_TYPE == glsr_current_screen()->post_type
383
-            && in_array(glsr_current_screen()->base, ['edit', 'post']);
384
-    }
373
+	/**
374
+	 * @param string $domain
375
+	 * @return bool
376
+	 */
377
+	protected function canModifyTranslation($domain = 'default')
378
+	{
379
+		if ('default' != $domain || empty(glsr_current_screen()->base)) {
380
+			return false;
381
+		}
382
+		return Application::POST_TYPE == glsr_current_screen()->post_type
383
+			&& in_array(glsr_current_screen()->base, ['edit', 'post']);
384
+	}
385 385
 
386
-    /**
387
-     * @param object $review
388
-     * @return string|void
389
-     */
390
-    protected function getReviewType($review)
391
-    {
392
-        if (count(glsr()->reviewTypes) < 2) {
393
-            return;
394
-        }
395
-        $reviewType = array_key_exists($review->review_type, glsr()->reviewTypes)
396
-            ? glsr()->reviewTypes[$review->review_type]
397
-            : __('Unknown', 'site-reviews');
398
-        if (!empty($review->url)) {
399
-            $reviewType = glsr(Builder::class)->a($reviewType, [
400
-                'href' => $review->url,
401
-                'target' => '_blank',
402
-            ]);
403
-        }
404
-        return $reviewType;
405
-    }
386
+	/**
387
+	 * @param object $review
388
+	 * @return string|void
389
+	 */
390
+	protected function getReviewType($review)
391
+	{
392
+		if (count(glsr()->reviewTypes) < 2) {
393
+			return;
394
+		}
395
+		$reviewType = array_key_exists($review->review_type, glsr()->reviewTypes)
396
+			? glsr()->reviewTypes[$review->review_type]
397
+			: __('Unknown', 'site-reviews');
398
+		if (!empty($review->url)) {
399
+			$reviewType = glsr(Builder::class)->a($reviewType, [
400
+				'href' => $review->url,
401
+				'target' => '_blank',
402
+			]);
403
+		}
404
+		return $reviewType;
405
+	}
406 406
 
407
-    /**
408
-     * @return bool
409
-     */
410
-    protected function isReviewEditable($post)
411
-    {
412
-        return $this->isReviewPostType($post)
413
-            && post_type_supports(Application::POST_TYPE, 'title')
414
-            && 'local' == glsr(Database::class)->get($post->ID, 'review_type');
415
-    }
407
+	/**
408
+	 * @return bool
409
+	 */
410
+	protected function isReviewEditable($post)
411
+	{
412
+		return $this->isReviewPostType($post)
413
+			&& post_type_supports(Application::POST_TYPE, 'title')
414
+			&& 'local' == glsr(Database::class)->get($post->ID, 'review_type');
415
+	}
416 416
 
417
-    /**
418
-     * @param mixed $post
419
-     * @return bool
420
-     */
421
-    protected function isReviewPostType($post)
422
-    {
423
-        return $post instanceof WP_Post && Application::POST_TYPE == $post->post_type;
424
-    }
417
+	/**
418
+	 * @param mixed $post
419
+	 * @return bool
420
+	 */
421
+	protected function isReviewPostType($post)
422
+	{
423
+		return $post instanceof WP_Post && Application::POST_TYPE == $post->post_type;
424
+	}
425 425
 
426
-    /**
427
-     * @return array
428
-     */
429
-    protected function normalizeDetailsMetaBox(Review $review)
430
-    {
431
-        $user = empty($review->user_id)
432
-            ? __('Unregistered user', 'site-reviews')
433
-            : glsr(Builder::class)->a(get_the_author_meta('display_name', $review->user_id), [
434
-                'href' => get_author_posts_url($review->user_id),
435
-            ]);
436
-        $email = empty($review->email)
437
-            ? '&mdash;'
438
-            : glsr(Builder::class)->a($review->email, [
439
-                'href' => 'mailto:'.$review->email.'?subject='.esc_attr(__('RE:', 'site-reviews').' '.$review->title),
440
-            ]);
441
-        $metabox = [
442
-            __('Rating', 'site-reviews') => glsr_star_rating($review->rating),
443
-            __('Type', 'site-reviews') => $this->getReviewType($review),
444
-            __('Date', 'site-reviews') => get_date_from_gmt($review->date, 'F j, Y'),
445
-            __('Name', 'site-reviews') => $review->author,
446
-            __('Email', 'site-reviews') => $email,
447
-            __('User', 'site-reviews') => $user,
448
-            __('IP Address', 'site-reviews') => $review->ip_address,
449
-            __('Avatar', 'site-reviews') => sprintf('<img src="%s" width="96">', $review->avatar),
450
-        ];
451
-        return array_filter(apply_filters('site-reviews/metabox/details', $metabox, $review));
452
-    }
426
+	/**
427
+	 * @return array
428
+	 */
429
+	protected function normalizeDetailsMetaBox(Review $review)
430
+	{
431
+		$user = empty($review->user_id)
432
+			? __('Unregistered user', 'site-reviews')
433
+			: glsr(Builder::class)->a(get_the_author_meta('display_name', $review->user_id), [
434
+				'href' => get_author_posts_url($review->user_id),
435
+			]);
436
+		$email = empty($review->email)
437
+			? '&mdash;'
438
+			: glsr(Builder::class)->a($review->email, [
439
+				'href' => 'mailto:'.$review->email.'?subject='.esc_attr(__('RE:', 'site-reviews').' '.$review->title),
440
+			]);
441
+		$metabox = [
442
+			__('Rating', 'site-reviews') => glsr_star_rating($review->rating),
443
+			__('Type', 'site-reviews') => $this->getReviewType($review),
444
+			__('Date', 'site-reviews') => get_date_from_gmt($review->date, 'F j, Y'),
445
+			__('Name', 'site-reviews') => $review->author,
446
+			__('Email', 'site-reviews') => $email,
447
+			__('User', 'site-reviews') => $user,
448
+			__('IP Address', 'site-reviews') => $review->ip_address,
449
+			__('Avatar', 'site-reviews') => sprintf('<img src="%s" width="96">', $review->avatar),
450
+		];
451
+		return array_filter(apply_filters('site-reviews/metabox/details', $metabox, $review));
452
+	}
453 453
 
454
-    /**
455
-     * @param int $postId
456
-     * @param int $messageIndex
457
-     * @return void
458
-     */
459
-    protected function redirect($postId, $messageIndex)
460
-    {
461
-        $referer = wp_get_referer();
462
-        $hasReferer = !$referer
463
-            || false !== strpos($referer, 'post.php')
464
-            || false !== strpos($referer, 'post-new.php');
465
-        $redirectUri = $hasReferer
466
-            ? remove_query_arg(['deleted', 'ids', 'trashed', 'untrashed'], $referer)
467
-            : get_edit_post_link($postId);
468
-        wp_safe_redirect(add_query_arg(['message' => $messageIndex], $redirectUri));
469
-        exit;
470
-    }
454
+	/**
455
+	 * @param int $postId
456
+	 * @param int $messageIndex
457
+	 * @return void
458
+	 */
459
+	protected function redirect($postId, $messageIndex)
460
+	{
461
+		$referer = wp_get_referer();
462
+		$hasReferer = !$referer
463
+			|| false !== strpos($referer, 'post.php')
464
+			|| false !== strpos($referer, 'post-new.php');
465
+		$redirectUri = $hasReferer
466
+			? remove_query_arg(['deleted', 'ids', 'trashed', 'untrashed'], $referer)
467
+			: get_edit_post_link($postId);
468
+		wp_safe_redirect(add_query_arg(['message' => $messageIndex], $redirectUri));
469
+		exit;
470
+	}
471 471
 }
Please login to merge, or discard this patch.
Spacing   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public function customizePostStatusLabels()
27 27
     {
28
-        if ($this->canModifyTranslation()) {
29
-            glsr(Labels::class)->customizePostStatusLabels();
28
+        if( $this->canModifyTranslation() ) {
29
+            glsr( Labels::class )->customizePostStatusLabels();
30 30
         }
31 31
     }
32 32
 
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
      * @return array
36 36
      * @filter wp_editor_settings
37 37
      */
38
-    public function filterEditorSettings($settings)
38
+    public function filterEditorSettings( $settings )
39 39
     {
40
-        return glsr(Customization::class)->filterEditorSettings(
41
-            Arr::consolidateArray($settings)
40
+        return glsr( Customization::class )->filterEditorSettings(
41
+            Arr::consolidateArray( $settings )
42 42
         );
43 43
     }
44 44
 
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
      * @return string
49 49
      * @filter the_editor
50 50
      */
51
-    public function filterEditorTextarea($html)
51
+    public function filterEditorTextarea( $html )
52 52
     {
53
-        return glsr(Customization::class)->filterEditorTextarea($html);
53
+        return glsr( Customization::class )->filterEditorTextarea( $html );
54 54
     }
55 55
 
56 56
     /**
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
      * @return bool
61 61
      * @filter is_protected_meta
62 62
      */
63
-    public function filterIsProtectedMeta($protected, $metaKey, $metaType)
63
+    public function filterIsProtectedMeta( $protected, $metaKey, $metaType )
64 64
     {
65
-        if ('post' == $metaType && Application::POST_TYPE == get_post_type()) {
66
-            $values = glsr(CreateReviewDefaults::class)->unguarded();
67
-            $values = Arr::prefixArrayKeys($values);
68
-            if (array_key_exists($metaKey, $values)) {
65
+        if( 'post' == $metaType && Application::POST_TYPE == get_post_type() ) {
66
+            $values = glsr( CreateReviewDefaults::class )->unguarded();
67
+            $values = Arr::prefixArrayKeys( $values );
68
+            if( array_key_exists( $metaKey, $values ) ) {
69 69
                 $protected = false;
70 70
             }
71 71
         }
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
      * @return string
80 80
      * @filter gettext
81 81
      */
82
-    public function filterPostStatusLabels($translation, $text, $domain)
82
+    public function filterPostStatusLabels( $translation, $text, $domain )
83 83
     {
84
-        return $this->canModifyTranslation($domain)
85
-            ? glsr(Labels::class)->filterPostStatusLabels($translation, $text)
84
+        return $this->canModifyTranslation( $domain )
85
+            ? glsr( Labels::class )->filterPostStatusLabels( $translation, $text )
86 86
             : $translation;
87 87
     }
88 88
 
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
      * @return string
94 94
      * @filter gettext_with_context
95 95
      */
96
-    public function filterPostStatusLabelsWithContext($translation, $text, $context, $domain)
96
+    public function filterPostStatusLabelsWithContext( $translation, $text, $context, $domain )
97 97
     {
98
-        return $this->canModifyTranslation($domain)
99
-            ? glsr(Labels::class)->filterPostStatusLabels($translation, $text)
98
+        return $this->canModifyTranslation( $domain )
99
+            ? glsr( Labels::class )->filterPostStatusLabels( $translation, $text )
100 100
             : $translation;
101 101
     }
102 102
 
@@ -105,10 +105,10 @@  discard block
 block discarded – undo
105 105
      * @return array
106 106
      * @filter post_updated_messages
107 107
      */
108
-    public function filterUpdateMessages($messages)
108
+    public function filterUpdateMessages( $messages )
109 109
     {
110
-        return glsr(Labels::class)->filterUpdateMessages(
111
-            Arr::consolidateArray($messages)
110
+        return glsr( Labels::class )->filterUpdateMessages(
111
+            Arr::consolidateArray( $messages )
112 112
         );
113 113
     }
114 114
 
@@ -116,14 +116,14 @@  discard block
 block discarded – undo
116 116
      * @return void
117 117
      * @action add_meta_boxes_{Application::POST_TYPE}
118 118
      */
119
-    public function registerMetaBoxes($post)
119
+    public function registerMetaBoxes( $post )
120 120
     {
121
-        add_meta_box(Application::ID.'_assigned_to', __('Assigned To', 'site-reviews'), [$this, 'renderAssignedToMetabox'], null, 'side');
122
-        add_meta_box(Application::ID.'_review', __('Details', 'site-reviews'), [$this, 'renderDetailsMetaBox'], null, 'side');
123
-        if ('local' != glsr(Database::class)->get($post->ID, 'review_type')) {
121
+        add_meta_box( Application::ID.'_assigned_to', __( 'Assigned To', 'site-reviews' ), [$this, 'renderAssignedToMetabox'], null, 'side' );
122
+        add_meta_box( Application::ID.'_review', __( 'Details', 'site-reviews' ), [$this, 'renderDetailsMetaBox'], null, 'side' );
123
+        if( 'local' != glsr( Database::class )->get( $post->ID, 'review_type' ) ) {
124 124
             return;
125 125
         }
126
-        add_meta_box(Application::ID.'_response', __('Respond Publicly', 'site-reviews'), [$this, 'renderResponseMetaBox'], null, 'normal');
126
+        add_meta_box( Application::ID.'_response', __( 'Respond Publicly', 'site-reviews' ), [$this, 'renderResponseMetaBox'], null, 'normal' );
127 127
     }
128 128
 
129 129
     /**
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
      */
133 133
     public function removeAutosave()
134 134
     {
135
-        glsr(Customization::class)->removeAutosave();
135
+        glsr( Customization::class )->removeAutosave();
136 136
     }
137 137
 
138 138
     /**
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
      */
142 142
     public function removeMetaBoxes()
143 143
     {
144
-        glsr(Customization::class)->removeMetaBoxes();
144
+        glsr( Customization::class )->removeMetaBoxes();
145 145
     }
146 146
 
147 147
     /**
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
      */
150 150
     public function removePostTypeSupport()
151 151
     {
152
-        glsr(Customization::class)->removePostTypeSupport();
152
+        glsr( Customization::class )->removePostTypeSupport();
153 153
     }
154 154
 
155 155
     /**
@@ -157,17 +157,17 @@  discard block
 block discarded – undo
157 157
      * @return void
158 158
      * @callback add_meta_box
159 159
      */
160
-    public function renderAssignedToMetabox($post)
160
+    public function renderAssignedToMetabox( $post )
161 161
     {
162
-        if (!$this->isReviewPostType($post)) {
162
+        if( !$this->isReviewPostType( $post ) ) {
163 163
             return;
164 164
         }
165
-        $assignedTo = (string) glsr(Database::class)->get($post->ID, 'assigned_to');
166
-        wp_nonce_field('assigned_to', '_nonce-assigned-to', false);
167
-        glsr()->render('partials/editor/metabox-assigned-to', [
165
+        $assignedTo = (string)glsr( Database::class )->get( $post->ID, 'assigned_to' );
166
+        wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false );
167
+        glsr()->render( 'partials/editor/metabox-assigned-to', [
168 168
             'id' => $assignedTo,
169
-            'template' => $this->buildAssignedToTemplate($assignedTo, $post),
170
-        ]);
169
+            'template' => $this->buildAssignedToTemplate( $assignedTo, $post ),
170
+        ] );
171 171
     }
172 172
 
173 173
     /**
@@ -175,16 +175,16 @@  discard block
 block discarded – undo
175 175
      * @return void
176 176
      * @callback add_meta_box
177 177
      */
178
-    public function renderDetailsMetaBox($post)
178
+    public function renderDetailsMetaBox( $post )
179 179
     {
180
-        if (!$this->isReviewPostType($post)) {
180
+        if( !$this->isReviewPostType( $post ) ) {
181 181
             return;
182 182
         }
183
-        $review = glsr_get_review($post);
184
-        glsr()->render('partials/editor/metabox-details', [
185
-            'button' => $this->buildDetailsMetaBoxRevertButton($review, $post),
186
-            'metabox' => $this->normalizeDetailsMetaBox($review),
187
-        ]);
183
+        $review = glsr_get_review( $post );
184
+        glsr()->render( 'partials/editor/metabox-details', [
185
+            'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ),
186
+            'metabox' => $this->normalizeDetailsMetaBox( $review ),
187
+        ] );
188 188
     }
189 189
 
190 190
     /**
@@ -193,16 +193,16 @@  discard block
 block discarded – undo
193 193
      */
194 194
     public function renderPinnedInPublishMetaBox()
195 195
     {
196
-        if (!$this->isReviewPostType(get_post())) {
196
+        if( !$this->isReviewPostType( get_post() ) ) {
197 197
             return;
198 198
         }
199
-        glsr(Template::class)->render('partials/editor/pinned', [
199
+        glsr( Template::class )->render( 'partials/editor/pinned', [
200 200
             'context' => [
201
-                'no' => __('No', 'site-reviews'),
202
-                'yes' => __('Yes', 'site-reviews'),
201
+                'no' => __( 'No', 'site-reviews' ),
202
+                'yes' => __( 'Yes', 'site-reviews' ),
203 203
             ],
204
-            'pinned' => wp_validate_boolean(glsr(Database::class)->get(get_the_ID(), 'pinned')),
205
-        ]);
204
+            'pinned' => wp_validate_boolean( glsr( Database::class )->get( get_the_ID(), 'pinned' ) ),
205
+        ] );
206 206
     }
207 207
 
208 208
     /**
@@ -210,15 +210,15 @@  discard block
 block discarded – undo
210 210
      * @return void
211 211
      * @callback add_meta_box
212 212
      */
213
-    public function renderResponseMetaBox($post)
213
+    public function renderResponseMetaBox( $post )
214 214
     {
215
-        if (!$this->isReviewPostType($post)) {
215
+        if( !$this->isReviewPostType( $post ) ) {
216 216
             return;
217 217
         }
218
-        wp_nonce_field('response', '_nonce-response', false);
219
-        glsr()->render('partials/editor/metabox-response', [
220
-            'response' => glsr(Database::class)->get($post->ID, 'response'),
221
-        ]);
218
+        wp_nonce_field( 'response', '_nonce-response', false );
219
+        glsr()->render( 'partials/editor/metabox-response', [
220
+            'response' => glsr( Database::class )->get( $post->ID, 'response' ),
221
+        ] );
222 222
     }
223 223
 
224 224
     /**
@@ -226,15 +226,15 @@  discard block
 block discarded – undo
226 226
      * @return void
227 227
      * @action edit_form_after_title
228 228
      */
229
-    public function renderReviewEditor($post)
229
+    public function renderReviewEditor( $post )
230 230
     {
231
-        if (!$this->isReviewPostType($post) || $this->isReviewEditable($post)) {
231
+        if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) ) {
232 232
             return;
233 233
         }
234
-        glsr()->render('partials/editor/review', [
234
+        glsr()->render( 'partials/editor/review', [
235 235
             'post' => $post,
236
-            'response' => glsr(Database::class)->get($post->ID, 'response'),
237
-        ]);
236
+            'response' => glsr( Database::class )->get( $post->ID, 'response' ),
237
+        ] );
238 238
     }
239 239
 
240 240
     /**
@@ -244,11 +244,11 @@  discard block
 block discarded – undo
244 244
     public function renderReviewFields()
245 245
     {
246 246
         $screen = glsr_current_screen();
247
-        if ('post' != $screen->base || Application::POST_TYPE != $screen->post_type) {
247
+        if( 'post' != $screen->base || Application::POST_TYPE != $screen->post_type ) {
248 248
             return;
249 249
         }
250
-        add_action('edit_form_after_title', [$this, 'renderReviewEditor']);
251
-        add_action('edit_form_top', [$this, 'renderReviewNotice']);
250
+        add_action( 'edit_form_after_title', [$this, 'renderReviewEditor'] );
251
+        add_action( 'edit_form_top', [$this, 'renderReviewNotice'] );
252 252
     }
253 253
 
254 254
     /**
@@ -256,20 +256,20 @@  discard block
 block discarded – undo
256 256
      * @return void
257 257
      * @action edit_form_top
258 258
      */
259
-    public function renderReviewNotice($post)
259
+    public function renderReviewNotice( $post )
260 260
     {
261
-        if (!$this->isReviewPostType($post) || $this->isReviewEditable($post)) {
261
+        if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) ) {
262 262
             return;
263 263
         }
264
-        glsr(Notice::class)->addWarning(sprintf(
265
-            __('%s reviews are read-only.', 'site-reviews'),
266
-            glsr(Columns::class)->buildColumnReviewType($post->ID)
267
-        ));
268
-        glsr(Template::class)->render('partials/editor/notice', [
264
+        glsr( Notice::class )->addWarning( sprintf(
265
+            __( '%s reviews are read-only.', 'site-reviews' ),
266
+            glsr( Columns::class )->buildColumnReviewType( $post->ID )
267
+        ) );
268
+        glsr( Template::class )->render( 'partials/editor/notice', [
269 269
             'context' => [
270
-                'notices' => glsr(Notice::class)->get(),
270
+                'notices' => glsr( Notice::class )->get(),
271 271
             ],
272
-        ]);
272
+        ] );
273 273
     }
274 274
 
275 275
     /**
@@ -278,16 +278,16 @@  discard block
 block discarded – undo
278 278
      * @see glsr_categories_meta_box()
279 279
      * @callback register_taxonomy
280 280
      */
281
-    public function renderTaxonomyMetabox($post)
281
+    public function renderTaxonomyMetabox( $post )
282 282
     {
283
-        if (!$this->isReviewPostType($post)) {
283
+        if( !$this->isReviewPostType( $post ) ) {
284 284
             return;
285 285
         }
286
-        glsr()->render('partials/editor/metabox-categories', [
286
+        glsr()->render( 'partials/editor/metabox-categories', [
287 287
             'post' => $post,
288 288
             'tax_name' => Application::TAXONOMY,
289
-            'taxonomy' => get_taxonomy(Application::TAXONOMY),
290
-        ]);
289
+            'taxonomy' => get_taxonomy( Application::TAXONOMY ),
290
+        ] );
291 291
     }
292 292
 
293 293
     /**
@@ -297,12 +297,12 @@  discard block
 block discarded – undo
297 297
      */
298 298
     public function revertReview()
299 299
     {
300
-        if (Application::ID != filter_input(INPUT_GET, 'plugin')) {
300
+        if( Application::ID != filter_input( INPUT_GET, 'plugin' ) ) {
301 301
             return;
302 302
         }
303
-        check_admin_referer('revert-review_'.($postId = $this->getPostId()));
304
-        glsr(ReviewManager::class)->revert($postId);
305
-        $this->redirect($postId, 52);
303
+        check_admin_referer( 'revert-review_'.($postId = $this->getPostId()) );
304
+        glsr( ReviewManager::class )->revert( $postId );
305
+        $this->redirect( $postId, 52 );
306 306
     }
307 307
 
308 308
     /**
@@ -312,12 +312,12 @@  discard block
 block discarded – undo
312 312
      * @return void
313 313
      * @action save_post_.Application::POST_TYPE
314 314
      */
315
-    public function saveMetaboxes($postId, $post, $isUpdating)
315
+    public function saveMetaboxes( $postId, $post, $isUpdating )
316 316
     {
317
-        glsr(Metaboxes::class)->saveAssignedToMetabox($postId);
318
-        glsr(Metaboxes::class)->saveResponseMetabox($postId);
319
-        if ($isUpdating) {
320
-            do_action('site-reviews/review/saved', glsr_get_review($postId));
317
+        glsr( Metaboxes::class )->saveAssignedToMetabox( $postId );
318
+        glsr( Metaboxes::class )->saveResponseMetabox( $postId );
319
+        if( $isUpdating ) {
320
+            do_action( 'site-reviews/review/saved', glsr_get_review( $postId ) );
321 321
         }
322 322
     }
323 323
 
@@ -325,81 +325,81 @@  discard block
 block discarded – undo
325 325
      * @param string $assignedTo
326 326
      * @return string
327 327
      */
328
-    protected function buildAssignedToTemplate($assignedTo, WP_Post $post)
328
+    protected function buildAssignedToTemplate( $assignedTo, WP_Post $post )
329 329
     {
330
-        $assignedPost = glsr(Database::class)->getAssignedToPost($post->ID, $assignedTo);
331
-        if (!($assignedPost instanceof WP_Post)) {
330
+        $assignedPost = glsr( Database::class )->getAssignedToPost( $post->ID, $assignedTo );
331
+        if( !($assignedPost instanceof WP_Post) ) {
332 332
             return;
333 333
         }
334
-        return glsr(Template::class)->build('partials/editor/assigned-post', [
334
+        return glsr( Template::class )->build( 'partials/editor/assigned-post', [
335 335
             'context' => [
336
-                'data.url' => (string) get_permalink($assignedPost),
337
-                'data.title' => get_the_title($assignedPost),
336
+                'data.url' => (string)get_permalink( $assignedPost ),
337
+                'data.title' => get_the_title( $assignedPost ),
338 338
             ],
339
-        ]);
339
+        ] );
340 340
     }
341 341
 
342 342
     /**
343 343
      * @return string
344 344
      */
345
-    protected function buildDetailsMetaBoxRevertButton(Review $review, WP_Post $post)
345
+    protected function buildDetailsMetaBoxRevertButton( Review $review, WP_Post $post )
346 346
     {
347 347
         $isModified = !Arr::compareArrays(
348 348
             [$review->title, $review->content, $review->date],
349 349
             [
350
-                glsr(Database::class)->get($post->ID, 'title'),
351
-                glsr(Database::class)->get($post->ID, 'content'),
352
-                glsr(Database::class)->get($post->ID, 'date'),
350
+                glsr( Database::class )->get( $post->ID, 'title' ),
351
+                glsr( Database::class )->get( $post->ID, 'content' ),
352
+                glsr( Database::class )->get( $post->ID, 'date' ),
353 353
             ]
354 354
         );
355
-        if ($isModified) {
355
+        if( $isModified ) {
356 356
             $revertUrl = wp_nonce_url(
357
-                admin_url('post.php?post='.$post->ID.'&action=revert&plugin='.Application::ID),
357
+                admin_url( 'post.php?post='.$post->ID.'&action=revert&plugin='.Application::ID ),
358 358
                 'revert-review_'.$post->ID
359 359
             );
360
-            return glsr(Builder::class)->a(__('Revert Changes', 'site-reviews'), [
360
+            return glsr( Builder::class )->a( __( 'Revert Changes', 'site-reviews' ), [
361 361
                 'class' => 'button button-large',
362 362
                 'href' => $revertUrl,
363 363
                 'id' => 'revert',
364
-            ]);
364
+            ] );
365 365
         }
366
-        return glsr(Builder::class)->button(__('Nothing to Revert', 'site-reviews'), [
366
+        return glsr( Builder::class )->button( __( 'Nothing to Revert', 'site-reviews' ), [
367 367
             'class' => 'button-large',
368 368
             'disabled' => true,
369 369
             'id' => 'revert',
370
-        ]);
370
+        ] );
371 371
     }
372 372
 
373 373
     /**
374 374
      * @param string $domain
375 375
      * @return bool
376 376
      */
377
-    protected function canModifyTranslation($domain = 'default')
377
+    protected function canModifyTranslation( $domain = 'default' )
378 378
     {
379
-        if ('default' != $domain || empty(glsr_current_screen()->base)) {
379
+        if( 'default' != $domain || empty(glsr_current_screen()->base) ) {
380 380
             return false;
381 381
         }
382 382
         return Application::POST_TYPE == glsr_current_screen()->post_type
383
-            && in_array(glsr_current_screen()->base, ['edit', 'post']);
383
+            && in_array( glsr_current_screen()->base, ['edit', 'post'] );
384 384
     }
385 385
 
386 386
     /**
387 387
      * @param object $review
388 388
      * @return string|void
389 389
      */
390
-    protected function getReviewType($review)
390
+    protected function getReviewType( $review )
391 391
     {
392
-        if (count(glsr()->reviewTypes) < 2) {
392
+        if( count( glsr()->reviewTypes ) < 2 ) {
393 393
             return;
394 394
         }
395
-        $reviewType = array_key_exists($review->review_type, glsr()->reviewTypes)
395
+        $reviewType = array_key_exists( $review->review_type, glsr()->reviewTypes )
396 396
             ? glsr()->reviewTypes[$review->review_type]
397
-            : __('Unknown', 'site-reviews');
398
-        if (!empty($review->url)) {
399
-            $reviewType = glsr(Builder::class)->a($reviewType, [
397
+            : __( 'Unknown', 'site-reviews' );
398
+        if( !empty($review->url) ) {
399
+            $reviewType = glsr( Builder::class )->a( $reviewType, [
400 400
                 'href' => $review->url,
401 401
                 'target' => '_blank',
402
-            ]);
402
+            ] );
403 403
         }
404 404
         return $reviewType;
405 405
     }
@@ -407,18 +407,18 @@  discard block
 block discarded – undo
407 407
     /**
408 408
      * @return bool
409 409
      */
410
-    protected function isReviewEditable($post)
410
+    protected function isReviewEditable( $post )
411 411
     {
412
-        return $this->isReviewPostType($post)
413
-            && post_type_supports(Application::POST_TYPE, 'title')
414
-            && 'local' == glsr(Database::class)->get($post->ID, 'review_type');
412
+        return $this->isReviewPostType( $post )
413
+            && post_type_supports( Application::POST_TYPE, 'title' )
414
+            && 'local' == glsr( Database::class )->get( $post->ID, 'review_type' );
415 415
     }
416 416
 
417 417
     /**
418 418
      * @param mixed $post
419 419
      * @return bool
420 420
      */
421
-    protected function isReviewPostType($post)
421
+    protected function isReviewPostType( $post )
422 422
     {
423 423
         return $post instanceof WP_Post && Application::POST_TYPE == $post->post_type;
424 424
     }
@@ -426,29 +426,29 @@  discard block
 block discarded – undo
426 426
     /**
427 427
      * @return array
428 428
      */
429
-    protected function normalizeDetailsMetaBox(Review $review)
429
+    protected function normalizeDetailsMetaBox( Review $review )
430 430
     {
431 431
         $user = empty($review->user_id)
432
-            ? __('Unregistered user', 'site-reviews')
433
-            : glsr(Builder::class)->a(get_the_author_meta('display_name', $review->user_id), [
434
-                'href' => get_author_posts_url($review->user_id),
435
-            ]);
432
+            ? __( 'Unregistered user', 'site-reviews' )
433
+            : glsr( Builder::class )->a( get_the_author_meta( 'display_name', $review->user_id ), [
434
+                'href' => get_author_posts_url( $review->user_id ),
435
+            ] );
436 436
         $email = empty($review->email)
437 437
             ? '&mdash;'
438
-            : glsr(Builder::class)->a($review->email, [
439
-                'href' => 'mailto:'.$review->email.'?subject='.esc_attr(__('RE:', 'site-reviews').' '.$review->title),
440
-            ]);
438
+            : glsr( Builder::class )->a( $review->email, [
439
+                'href' => 'mailto:'.$review->email.'?subject='.esc_attr( __( 'RE:', 'site-reviews' ).' '.$review->title ),
440
+            ] );
441 441
         $metabox = [
442
-            __('Rating', 'site-reviews') => glsr_star_rating($review->rating),
443
-            __('Type', 'site-reviews') => $this->getReviewType($review),
444
-            __('Date', 'site-reviews') => get_date_from_gmt($review->date, 'F j, Y'),
445
-            __('Name', 'site-reviews') => $review->author,
446
-            __('Email', 'site-reviews') => $email,
447
-            __('User', 'site-reviews') => $user,
448
-            __('IP Address', 'site-reviews') => $review->ip_address,
449
-            __('Avatar', 'site-reviews') => sprintf('<img src="%s" width="96">', $review->avatar),
442
+            __( 'Rating', 'site-reviews' ) => glsr_star_rating( $review->rating ),
443
+            __( 'Type', 'site-reviews' ) => $this->getReviewType( $review ),
444
+            __( 'Date', 'site-reviews' ) => get_date_from_gmt( $review->date, 'F j, Y' ),
445
+            __( 'Name', 'site-reviews' ) => $review->author,
446
+            __( 'Email', 'site-reviews' ) => $email,
447
+            __( 'User', 'site-reviews' ) => $user,
448
+            __( 'IP Address', 'site-reviews' ) => $review->ip_address,
449
+            __( 'Avatar', 'site-reviews' ) => sprintf( '<img src="%s" width="96">', $review->avatar ),
450 450
         ];
451
-        return array_filter(apply_filters('site-reviews/metabox/details', $metabox, $review));
451
+        return array_filter( apply_filters( 'site-reviews/metabox/details', $metabox, $review ) );
452 452
     }
453 453
 
454 454
     /**
@@ -456,16 +456,16 @@  discard block
 block discarded – undo
456 456
      * @param int $messageIndex
457 457
      * @return void
458 458
      */
459
-    protected function redirect($postId, $messageIndex)
459
+    protected function redirect( $postId, $messageIndex )
460 460
     {
461 461
         $referer = wp_get_referer();
462 462
         $hasReferer = !$referer
463
-            || false !== strpos($referer, 'post.php')
464
-            || false !== strpos($referer, 'post-new.php');
463
+            || false !== strpos( $referer, 'post.php' )
464
+            || false !== strpos( $referer, 'post-new.php' );
465 465
         $redirectUri = $hasReferer
466
-            ? remove_query_arg(['deleted', 'ids', 'trashed', 'untrashed'], $referer)
467
-            : get_edit_post_link($postId);
468
-        wp_safe_redirect(add_query_arg(['message' => $messageIndex], $redirectUri));
466
+            ? remove_query_arg( ['deleted', 'ids', 'trashed', 'untrashed'], $referer )
467
+            : get_edit_post_link( $postId );
468
+        wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri ) );
469 469
         exit;
470 470
     }
471 471
 }
Please login to merge, or discard this patch.
config/settings.php 2 patches
Indentation   +548 added lines, -548 removed lines patch added patch discarded remove patch
@@ -1,552 +1,552 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 return [
4
-    'settings.general.style' => [
5
-        'default' => 'default',
6
-        'description' => __('Site Reviews relies on the CSS of your theme to style the submission form. If your theme does not provide proper CSS rules for form elements and you are using a WordPress plugin/theme or CSS Framework listed here, please try selecting it, otherwise choose "Site Reviews (default)".', 'site-reviews'),
7
-        'label' => __('Plugin Style', 'site-reviews'),
8
-        'options' => [
9
-            'bootstrap_4' => 'CSS Framework: Bootstrap 4',
10
-            'bootstrap_4_custom' => 'CSS Framework: Bootstrap 4 (Custom Forms)',
11
-            'contact_form_7' => 'Plugin: Contact Form 7 (v5)',
12
-            'ninja_forms' => 'Plugin: Ninja Forms (v3)',
13
-            'wpforms' => 'Plugin: WPForms Lite (v1)',
14
-            'default' => __('Site Reviews (default)', 'site-reviews'),
15
-            'minimal' => __('Site Reviews (minimal)', 'site-reviews'),
16
-            'divi' => 'Theme: Divi (v3)',
17
-            'materialize' => 'Theme: Materialize',
18
-            'twentyfifteen' => 'Theme: Twenty Fifteen',
19
-            'twentyseventeen' => 'Theme: Twenty Seventeen',
20
-            'twentynineteen' => 'Theme: Twenty Nineteen',
21
-        ],
22
-        'type' => 'select',
23
-    ],
24
-    'settings.general.require.approval' => [
25
-        'default' => 'no',
26
-        'description' => __('Set the status of new review submissions to "unapproved".', 'site-reviews'),
27
-        'label' => __('Require Approval', 'site-reviews'),
28
-        'type' => 'yes_no',
29
-    ],
30
-    'settings.general.require.login' => [
31
-        'default' => 'no',
32
-        'description' => __('Only allow review submissions from registered users.', 'site-reviews'),
33
-        'label' => __('Require Login', 'site-reviews'),
34
-        'type' => 'yes_no',
35
-    ],
36
-    'settings.general.require.login_register' => [
37
-        'default' => 'no',
38
-        'depends_on' => [
39
-            'settings.general.require.login' => 'yes',
40
-        ],
41
-        'description' => sprintf(__('Show a link for a new user to register. The %s Membership option must be enabled in General Settings for this to work.', 'site-reviews'),
42
-            '<a href="'.admin_url('options-general.php#users_can_register').'">'.__('Anyone can register', 'site-reviews').'</a>'
43
-        ),
44
-        'label' => __('Show Registration Link', 'site-reviews'),
45
-        'type' => 'yes_no',
46
-    ],
47
-    'settings.general.multilingual' => [
48
-        'default' => '',
49
-        'description' => __('Integrate with a multilingual plugin to calculate ratings for all languages of a post.', 'site-reviews'),
50
-        'label' => __('Multilingual', 'site-reviews'),
51
-        'options' => [
52
-            '' => __('No Integration', 'site-reviews'),
53
-            'polylang' => __('Integrate with Polylang', 'site-reviews'),
54
-            'wpml' => __('Integrate with WPML', 'site-reviews'),
55
-        ],
56
-        'type' => 'select',
57
-    ],
58
-    'settings.general.rebusify' => [
59
-        'default' => 'no',
60
-        'description' => sprintf(__('Integrate with the %s and validate your reviews on the blockchain to increase online reputation, trust, and transparency.', 'site-reviews'),
61
-            '<a href="https://rebusify.com/plans?ref=105" target="_blank">Rebusify Confidence System</a>'
62
-        ),
63
-        'label' => __('Blockchain Validation', 'site-reviews'),
64
-        'type' => 'yes_no',
65
-    ],
66
-    'settings.general.rebusify_email' => [
67
-        'default' => '',
68
-        'depends_on' => [
69
-            'settings.general.rebusify' => ['yes'],
70
-        ],
71
-        'description' => __('Enter your Rebusify account email here.', 'site-reviews'),
72
-        'label' => __('Rebusify Email', 'site-reviews'),
73
-        'type' => 'text',
74
-    ],
75
-    'settings.general.rebusify_serial' => [
76
-        'default' => '',
77
-        'depends_on' => [
78
-            'settings.general.rebusify' => ['yes'],
79
-        ],
80
-        'description' => __('Enter your Rebusify account serial key here.', 'site-reviews'),
81
-        'label' => __('Rebusify Serial Key', 'site-reviews'),
82
-        'type' => 'password',
83
-    ],
84
-    'settings.general.notifications' => [
85
-        'default' => [],
86
-        'label' => __('Notifications', 'site-reviews'),
87
-        'options' => [
88
-            'admin' => __('Send to administrator', 'site-reviews').' <code>'.(string) get_option('admin_email').'</code>',
89
-            'author' => __('Send to author of the page that the review is assigned to', 'site-reviews'),
90
-            'custom' => __('Send to one or more email addresses', 'site-reviews'),
91
-            'slack' => __('Send to <a href="https://slack.com/">Slack</a>', 'site-reviews'),
92
-        ],
93
-        'type' => 'checkbox',
94
-    ],
95
-    'settings.general.notification_email' => [
96
-        'default' => '',
97
-        'depends_on' => [
98
-            'settings.general.notifications' => ['custom'],
99
-        ],
100
-        'label' => __('Send Notification Emails To', 'site-reviews'),
101
-        'placeholder' => __('Separate multiple emails with a comma', 'site-reviews'),
102
-        'type' => 'text',
103
-    ],
104
-    'settings.general.notification_slack' => [
105
-        'default' => '',
106
-        'depends_on' => [
107
-            'settings.general.notifications' => ['slack'],
108
-        ],
109
-        'description' => sprintf(__('To send notifications to Slack, create a new %s and then paste the provided Webhook URL in the field above.', 'site-reviews'),
110
-            '<a href="https://api.slack.com/incoming-webhooks">'.__('Incoming WebHook', 'site-reviews').'</a>'
111
-        ),
112
-        'label' => __('Slack Webhook URL', 'site-reviews'),
113
-        'type' => 'text',
114
-    ],
115
-    'settings.general.notification_message' => [
116
-        'default' => glsr('Modules\Html\Template')->build('templates/email-notification'),
117
-        'depends_on' => [
118
-            'settings.general.notifications' => ['admin', 'author', 'custom', 'slack'],
119
-        ],
120
-        'description' => __(
121
-            'To restore the default text, save an empty template. '.
122
-            'If you are sending notifications to Slack then this template will only be used as a fallback in the event that <a href="https://api.slack.com/docs/attachments">Message Attachments</a> have been disabled. Available template tags:'.
123
-            '<br><code>{review_rating}</code> The review rating number (1-5)'.
124
-            '<br><code>{review_title}</code> The review title'.
125
-            '<br><code>{review_content}</code> The review content'.
126
-            '<br><code>{review_author}</code> The review author'.
127
-            '<br><code>{review_email}</code> The email of the review author'.
128
-            '<br><code>{review_ip}</code> The IP address of the review author'.
129
-            '<br><code>{review_link}</code> The link to edit/view a review',
130
-            'site-reviews'
131
-        ),
132
-        'label' => __('Notification Template', 'site-reviews'),
133
-        'rows' => 10,
134
-        'type' => 'code',
135
-    ],
136
-    'settings.reviews.date.format' => [
137
-        'default' => '',
138
-        'description' => sprintf(__('The default date format is the one set in your %s.', 'site-reviews'),
139
-            '<a href="'.admin_url('options-general.php#date_format_custom').'">'.__('WordPress settings', 'site-reviews').'</a>'
140
-        ),
141
-        'label' => __('Date Format', 'site-reviews'),
142
-        'options' => [
143
-            '' => __('Use the default date format', 'site-reviews'),
144
-            'relative' => __('Use a relative date format', 'site-reviews'),
145
-            'custom' => __('Use a custom date format', 'site-reviews'),
146
-        ],
147
-        'type' => 'select',
148
-    ],
149
-    'settings.reviews.date.custom' => [
150
-        'default' => get_option('date_format'),
151
-        'depends_on' => [
152
-            'settings.reviews.date.format' => 'custom',
153
-        ],
154
-        'description' => __('Enter a custom date format (<a href="https://codex.wordpress.org/Formatting_Date_and_Time">documentation on date and time formatting</a>).', 'site-reviews'),
155
-        'label' => __('Custom Date Format', 'site-reviews'),
156
-        'type' => 'text',
157
-    ],
158
-    'settings.reviews.name.format' => [
159
-        'default' => '',
160
-        'description' => __('Choose how names are shown in your reviews.', 'site-reviews'),
161
-        'label' => __('Name Format', 'site-reviews'),
162
-        'options' => [
163
-            '' => __('Use the name as given', 'site-reviews'),
164
-            'first' => __('Use the first name only', 'site-reviews'),
165
-            'first_initial' => __('Convert first name to an initial', 'site-reviews'),
166
-            'last_initial' => __('Convert last name to an initial', 'site-reviews'),
167
-            'initials' => __('Convert to all initials', 'site-reviews'),
168
-        ],
169
-        'type' => 'select',
170
-    ],
171
-    'settings.reviews.name.initial' => [
172
-        'default' => '',
173
-        'depends_on' => [
174
-            'settings.reviews.name.format' => ['first_initial', 'last_initial', 'initials'],
175
-        ],
176
-        'description' => __('Choose how the initial is displayed.', 'site-reviews'),
177
-        'label' => __('Initial Format', 'site-reviews'),
178
-        'options' => [
179
-            '' => __('Initial with a space', 'site-reviews'),
180
-            'period' => __('Initial with a period', 'site-reviews'),
181
-            'period_space' => __('Initial with a period and a space', 'site-reviews'),
182
-        ],
183
-        'type' => 'select',
184
-    ],
185
-    'settings.reviews.assigned_links' => [
186
-        'default' => 'no',
187
-        'description' => __('Display a link to the assigned post of a review.', 'site-reviews'),
188
-        'label' => __('Enable Assigned Links', 'site-reviews'),
189
-        'type' => 'yes_no',
190
-    ],
191
-    'settings.reviews.avatars' => [
192
-        'default' => 'no',
193
-        'description' => __('Display reviewer avatars. These are generated from the email address of the reviewer using <a href="https://gravatar.com">Gravatar</a>.', 'site-reviews'),
194
-        'label' => __('Enable Avatars', 'site-reviews'),
195
-        'type' => 'yes_no',
196
-    ],
197
-    'settings.reviews.avatars_regenerate' => [
198
-        'default' => 'no',
199
-        'depends_on' => [
200
-            'settings.reviews.avatars' => 'yes',
201
-        ],
202
-        'description' => __('Regenerate the avatar whenever a local review is shown?', 'site-reviews'),
203
-        'label' => __('Regenerate Avatars', 'site-reviews'),
204
-        'type' => 'yes_no',
205
-    ],
206
-    'settings.reviews.avatars_size' => [
207
-        'default' => 40,
208
-        'depends_on' => [
209
-            'settings.reviews.avatars' => 'yes',
210
-        ],
211
-        'description' => __('Set the avatar size in pixels.', 'site-reviews'),
212
-        'label' => __('Avatar Size', 'site-reviews'),
213
-        'type' => 'number',
214
-    ],
215
-    'settings.reviews.excerpts' => [
216
-        'default' => 'yes',
217
-        'description' => __('Display an excerpt instead of the full review.', 'site-reviews'),
218
-        'label' => __('Enable Excerpts', 'site-reviews'),
219
-        'type' => 'yes_no',
220
-    ],
221
-    'settings.reviews.excerpts_length' => [
222
-        'default' => 55,
223
-        'depends_on' => [
224
-            'settings.reviews.excerpts' => 'yes',
225
-        ],
226
-        'description' => __('Set the excerpt word length.', 'site-reviews'),
227
-        'label' => __('Excerpt Length', 'site-reviews'),
228
-        'type' => 'number',
229
-    ],
230
-    'settings.reviews.fallback' => [
231
-        'default' => 'yes',
232
-        'description' => sprintf(__('Display the fallback text when there are no reviews to display. This can be changed on the %s page. You may also override this by using the "fallback" option on the shortcode. The default fallback text is: %s', 'site-reviews'),
233
-            '<a href="'.admin_url('edit.php?post_type=site-review&page=settings#!translations').'">'.__('Translations', 'site-reviews').'</a>',
234
-            '<code>'.__('There are no reviews yet. Be the first one to write one.', 'site-reviews').'</code>'
235
-        ),
236
-        'label' => __('Enable Fallback Text', 'site-reviews'),
237
-        'type' => 'yes_no',
238
-    ],
239
-    'settings.schema.type.default' => [
240
-        'default' => 'LocalBusiness',
241
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_type</code>',
242
-        'label' => __('Default Schema Type', 'site-reviews'),
243
-        'options' => [
244
-            'LocalBusiness' => __('Local Business', 'site-reviews'),
245
-            'Product' => __('Product', 'site-reviews'),
246
-            'custom' => __('Custom', 'site-reviews'),
247
-        ],
248
-        'type' => 'select',
249
-    ],
250
-    'settings.schema.type.custom' => [
251
-        'default' => '',
252
-        'depends_on' => [
253
-            'settings.schema.type.default' => 'custom',
254
-        ],
255
-        'description' => '<a href="https://schema.org/docs/schemas.html">'.__('View more information on schema types here', 'site-reviews').'</a>',
256
-        'label' => __('Custom Schema Type', 'site-reviews'),
257
-        'type' => 'text',
258
-    ],
259
-    'settings.schema.name.default' => [
260
-        'default' => 'post',
261
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_name</code>',
262
-        'label' => __('Default Name', 'site-reviews'),
263
-        'options' => [
264
-            'post' => __('Use the assigned or current page title', 'site-reviews'),
265
-            'custom' => __('Enter a custom title', 'site-reviews'),
266
-        ],
267
-        'type' => 'select',
268
-    ],
269
-    'settings.schema.name.custom' => [
270
-        'default' => '',
271
-        'depends_on' => [
272
-            'settings.schema.name.default' => 'custom',
273
-        ],
274
-        'label' => __('Custom Name', 'site-reviews'),
275
-        'type' => 'text',
276
-    ],
277
-    'settings.schema.description.default' => [
278
-        'default' => 'post',
279
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_description</code>',
280
-        'label' => __('Default Description', 'site-reviews'),
281
-        'options' => [
282
-            'post' => __('Use the assigned or current page excerpt', 'site-reviews'),
283
-            'custom' => __('Enter a custom description', 'site-reviews'),
284
-        ],
285
-        'type' => 'select',
286
-    ],
287
-    'settings.schema.description.custom' => [
288
-        'default' => '',
289
-        'depends_on' => [
290
-            'settings.schema.description.default' => 'custom',
291
-        ],
292
-        'label' => __('Custom Description', 'site-reviews'),
293
-        'type' => 'text',
294
-    ],
295
-    'settings.schema.url.default' => [
296
-        'default' => 'post',
297
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_url</code>',
298
-        'label' => __('Default URL', 'site-reviews'),
299
-        'options' => [
300
-            'post' => __('Use the assigned or current page URL', 'site-reviews'),
301
-            'custom' => __('Enter a custom URL', 'site-reviews'),
302
-        ],
303
-        'type' => 'select',
304
-    ],
305
-    'settings.schema.url.custom' => [
306
-        'default' => '',
307
-        'depends_on' => [
308
-            'settings.schema.url.default' => 'custom',
309
-        ],
310
-        'label' => __('Custom URL', 'site-reviews'),
311
-        'type' => 'text',
312
-    ],
313
-    'settings.schema.image.default' => [
314
-        'default' => 'post',
315
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_image</code>',
316
-        'label' => __('Default Image', 'site-reviews'),
317
-        'options' => [
318
-            'post' => __('Use the featured image of the assigned or current page', 'site-reviews'),
319
-            'custom' => __('Enter a custom image URL', 'site-reviews'),
320
-        ],
321
-        'type' => 'select',
322
-    ],
323
-    'settings.schema.image.custom' => [
324
-        'default' => '',
325
-        'depends_on' => [
326
-            'settings.schema.image.default' => 'custom',
327
-        ],
328
-        'label' => __('Custom Image URL', 'site-reviews'),
329
-        'type' => 'text',
330
-    ],
331
-    'settings.schema.address' => [
332
-        'default' => '',
333
-        'depends_on' => [
334
-            'settings.schema.type.default' => 'LocalBusiness',
335
-        ],
336
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_address</code>',
337
-        'label' => __('Address', 'site-reviews'),
338
-        'placeholder' => '60 29th Street #343, San Francisco, CA 94110, US',
339
-        'type' => 'text',
340
-    ],
341
-    'settings.schema.telephone' => [
342
-        'default' => '',
343
-        'depends_on' => [
344
-            'settings.schema.type.default' => 'LocalBusiness',
345
-        ],
346
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_telephone</code>',
347
-        'label' => __('Telephone Number', 'site-reviews'),
348
-        'placeholder' => '+1 (877) 273-3049',
349
-        'type' => 'text',
350
-    ],
351
-    'settings.schema.pricerange' => [
352
-        'default' => '',
353
-        'depends_on' => [
354
-            'settings.schema.type.default' => 'LocalBusiness',
355
-        ],
356
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_pricerange</code>',
357
-        'label' => __('Price Range', 'site-reviews'),
358
-        'placeholder' => '$$-$$$',
359
-        'type' => 'text',
360
-    ],
361
-    'settings.schema.offertype' => [
362
-        'default' => 'AggregateOffer',
363
-        'depends_on' => [
364
-            'settings.schema.type.default' => 'Product',
365
-        ],
366
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_offertype</code>',
367
-        'label' => __('Offer Type', 'site-reviews'),
368
-        'options' => [
369
-            'AggregateOffer' => __('AggregateOffer', 'site-reviews'),
370
-            'Offer' => __('Offer', 'site-reviews'),
371
-        ],
372
-        'type' => 'select',
373
-    ],
374
-    'settings.schema.price' => [
375
-        'default' => '',
376
-        'depends_on' => [
377
-            'settings.schema.type.default' => 'Product',
378
-            'settings.schema.offertype' => 'Offer',
379
-        ],
380
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_price</code>',
381
-        'label' => __('Price', 'site-reviews'),
382
-        'placeholder' => '50.00',
383
-        'type' => 'text',
384
-    ],
385
-    'settings.schema.lowprice' => [
386
-        'default' => '',
387
-        'depends_on' => [
388
-            'settings.schema.type.default' => 'Product',
389
-            'settings.schema.offertype' => 'AggregateOffer',
390
-        ],
391
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_lowprice</code>',
392
-        'label' => __('Low Price', 'site-reviews'),
393
-        'placeholder' => '10.00',
394
-        'type' => 'text',
395
-    ],
396
-    'settings.schema.highprice' => [
397
-        'default' => '',
398
-        'depends_on' => [
399
-            'settings.schema.type.default' => 'Product',
400
-            'settings.schema.offertype' => 'AggregateOffer',
401
-        ],
402
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_highprice</code>',
403
-        'label' => __('High Price', 'site-reviews'),
404
-        'placeholder' => '100.00',
405
-        'type' => 'text',
406
-    ],
407
-    'settings.schema.pricecurrency' => [
408
-        'default' => '',
409
-        'depends_on' => [
410
-            'settings.schema.type.default' => 'Product',
411
-        ],
412
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_pricecurrency</code>',
413
-        'label' => __('Price Currency', 'site-reviews'),
414
-        'placeholder' => 'USD',
415
-        'type' => 'text',
416
-    ],
417
-    'settings.submissions.required' => [
418
-        'default' => ['content', 'email', 'name', 'rating', 'terms', 'title'],
419
-        'description' => __('Choose which fields should be required in the submission form.', 'site-reviews'),
420
-        'label' => __('Required Fields', 'site-reviews'),
421
-        'options' => [
422
-            'rating' => __('Rating', 'site-reviews'),
423
-            'title' => __('Title', 'site-reviews'),
424
-            'content' => __('Review', 'site-reviews'),
425
-            'name' => __('Name', 'site-reviews'),
426
-            'email' => __('Email', 'site-reviews'),
427
-            'terms' => __('Terms', 'site-reviews'),
428
-        ],
429
-        'type' => 'checkbox',
430
-    ],
431
-    'settings.submissions.limit' => [
432
-        'default' => '',
433
-        'description' => __('Limits the number of reviews that can be submitted to one-per-person. If you are assigning reviews, then the limit will be applied to the assigned page or category.', 'site-reviews'),
434
-        'label' => __('Limit Reviews', 'site-reviews'),
435
-        'options' => [
436
-            '' => __('No Limit', 'site-reviews'),
437
-            'email' => __('By Email Address', 'site-reviews'),
438
-            'ip_address' => __('By IP Address', 'site-reviews'),
439
-            'username' => __('By Username (will only work for registered users)', 'site-reviews'),
440
-        ],
441
-        'type' => 'select',
442
-    ],
443
-    'settings.submissions.limit_whitelist.email' => [
444
-        'default' => '',
445
-        'depends_on' => [
446
-            'settings.submissions.limit' => ['email'],
447
-        ],
448
-        'description' => __('One Email per line. All emails in the whitelist will be excluded from the review submission limit.', 'site-reviews'),
449
-        'label' => __('Email Whitelist', 'site-reviews'),
450
-        'rows' => 5,
451
-        'type' => 'code',
452
-    ],
453
-    'settings.submissions.limit_whitelist.ip_address' => [
454
-        'default' => '',
455
-        'depends_on' => [
456
-            'settings.submissions.limit' => ['ip_address'],
457
-        ],
458
-        'description' => __('One IP Address per line. All IP Addresses in the whitelist will be excluded from the review submission limit..', 'site-reviews'),
459
-        'label' => __('IP Address Whitelist', 'site-reviews'),
460
-        'rows' => 5,
461
-        'type' => 'code',
462
-    ],
463
-    'settings.submissions.limit_whitelist.username' => [
464
-        'default' => '',
465
-        'depends_on' => [
466
-            'settings.submissions.limit' => ['username'],
467
-        ],
468
-        'description' => __('One Username per line. All registered users with a Username in the whitelist will be excluded from the review submission limit.', 'site-reviews'),
469
-        'label' => __('Username Whitelist', 'site-reviews'),
470
-        'rows' => 5,
471
-        'type' => 'code',
472
-    ],
473
-    'settings.submissions.recaptcha.integration' => [
474
-        'default' => '',
475
-        'description' => __('Invisible reCAPTCHA is a free anti-spam service from Google. To use it, you will need to <a href="https://www.google.com/recaptcha/admin" target="_blank">sign up</a> for an API key pair for your site.', 'site-reviews'),
476
-        'label' => __('Invisible reCAPTCHA', 'site-reviews'),
477
-        'options' => [
478
-            '' => 'Do not use reCAPTCHA',
479
-            'all' => 'Use reCAPTCHA',
480
-            'guest' => 'Use reCAPTCHA only for guest users',
481
-        ],
482
-        'type' => 'select',
483
-    ],
484
-    'settings.submissions.recaptcha.key' => [
485
-        'default' => '',
486
-        'depends_on' => [
487
-            'settings.submissions.recaptcha.integration' => ['all', 'guest'],
488
-        ],
489
-        'label' => __('Site Key', 'site-reviews'),
490
-        'type' => 'text',
491
-    ],
492
-    'settings.submissions.recaptcha.secret' => [
493
-        'default' => '',
494
-        'depends_on' => [
495
-            'settings.submissions.recaptcha.integration' => ['all', 'guest'],
496
-        ],
497
-        'label' => __('Site Secret', 'site-reviews'),
498
-        'type' => 'text',
499
-    ],
500
-    'settings.submissions.recaptcha.position' => [
501
-        'default' => 'bottomleft',
502
-        'depends_on' => [
503
-            'settings.submissions.recaptcha.integration' => ['all', 'guest'],
504
-        ],
505
-        'description' => __('This option may not work consistently if another plugin is loading reCAPTCHA on the same page as Site Reviews.', 'site-reviews'),
506
-        'label' => __('Badge Position', 'site-reviews'),
507
-        'options' => [
508
-            'bottomleft' => 'Bottom Left',
509
-            'bottomright' => 'Bottom Right',
510
-            'inline' => 'Inline',
511
-        ],
512
-        'type' => 'select',
513
-    ],
514
-    'settings.submissions.akismet' => [
515
-        'default' => 'no',
516
-        'description' => __('The <a href="https://akismet.com" target="_blank">Akismet plugin</a> integration provides spam-filtering for your reviews. In order for this setting to have any affect, you will need to first install and activate the Akismet plugin and set up a WordPress.com API key.', 'site-reviews'),
517
-        'label' => __('Enable Akismet Integration', 'site-reviews'),
518
-        'type' => 'yes_no',
519
-    ],
520
-    'settings.submissions.blacklist.integration' => [
521
-        'default' => '',
522
-        'description' => sprintf(__('Choose which Blacklist you would prefer to use for reviews. The %s can be found in the WordPress Discussion Settings page.', 'site-reviews'),
523
-            '<a href="'.admin_url('options-discussion.php#users_can_register').'">'.__('Comment Blacklist', 'site-reviews').'</a>'
524
-        ),
525
-        'label' => __('Blacklist', 'site-reviews'),
526
-        'options' => [
527
-            '' => 'Use the Site Reviews Blacklist',
528
-            'comments' => 'Use the WordPress Comment Blacklist',
529
-        ],
530
-        'type' => 'select',
531
-    ],
532
-    'settings.submissions.blacklist.entries' => [
533
-        'default' => '',
534
-        'depends_on' => [
535
-            'settings.submissions.blacklist.integration' => [''],
536
-        ],
537
-        'description' => __('One entry or IP address per line. When a review contains any of these entries in its title, content, name, email, or IP address, it will be rejected. It is case-insensitive and will match partial words, so "press" will match "WordPress".', 'site-reviews'),
538
-        'label' => __('Review Blacklist', 'site-reviews'),
539
-        'rows' => 10,
540
-        'type' => 'code',
541
-    ],
542
-    'settings.submissions.blacklist.action' => [
543
-        'default' => 'unapprove',
544
-        'description' => __('Choose the action that should be taken when a review is blacklisted.', 'site-reviews'),
545
-        'label' => __('Blacklist Action', 'site-reviews'),
546
-        'options' => [
547
-            'unapprove' => __('Require approval', 'site-reviews'),
548
-            'reject' => __('Reject submission', 'site-reviews'),
549
-        ],
550
-        'type' => 'select',
551
-    ],
4
+	'settings.general.style' => [
5
+		'default' => 'default',
6
+		'description' => __('Site Reviews relies on the CSS of your theme to style the submission form. If your theme does not provide proper CSS rules for form elements and you are using a WordPress plugin/theme or CSS Framework listed here, please try selecting it, otherwise choose "Site Reviews (default)".', 'site-reviews'),
7
+		'label' => __('Plugin Style', 'site-reviews'),
8
+		'options' => [
9
+			'bootstrap_4' => 'CSS Framework: Bootstrap 4',
10
+			'bootstrap_4_custom' => 'CSS Framework: Bootstrap 4 (Custom Forms)',
11
+			'contact_form_7' => 'Plugin: Contact Form 7 (v5)',
12
+			'ninja_forms' => 'Plugin: Ninja Forms (v3)',
13
+			'wpforms' => 'Plugin: WPForms Lite (v1)',
14
+			'default' => __('Site Reviews (default)', 'site-reviews'),
15
+			'minimal' => __('Site Reviews (minimal)', 'site-reviews'),
16
+			'divi' => 'Theme: Divi (v3)',
17
+			'materialize' => 'Theme: Materialize',
18
+			'twentyfifteen' => 'Theme: Twenty Fifteen',
19
+			'twentyseventeen' => 'Theme: Twenty Seventeen',
20
+			'twentynineteen' => 'Theme: Twenty Nineteen',
21
+		],
22
+		'type' => 'select',
23
+	],
24
+	'settings.general.require.approval' => [
25
+		'default' => 'no',
26
+		'description' => __('Set the status of new review submissions to "unapproved".', 'site-reviews'),
27
+		'label' => __('Require Approval', 'site-reviews'),
28
+		'type' => 'yes_no',
29
+	],
30
+	'settings.general.require.login' => [
31
+		'default' => 'no',
32
+		'description' => __('Only allow review submissions from registered users.', 'site-reviews'),
33
+		'label' => __('Require Login', 'site-reviews'),
34
+		'type' => 'yes_no',
35
+	],
36
+	'settings.general.require.login_register' => [
37
+		'default' => 'no',
38
+		'depends_on' => [
39
+			'settings.general.require.login' => 'yes',
40
+		],
41
+		'description' => sprintf(__('Show a link for a new user to register. The %s Membership option must be enabled in General Settings for this to work.', 'site-reviews'),
42
+			'<a href="'.admin_url('options-general.php#users_can_register').'">'.__('Anyone can register', 'site-reviews').'</a>'
43
+		),
44
+		'label' => __('Show Registration Link', 'site-reviews'),
45
+		'type' => 'yes_no',
46
+	],
47
+	'settings.general.multilingual' => [
48
+		'default' => '',
49
+		'description' => __('Integrate with a multilingual plugin to calculate ratings for all languages of a post.', 'site-reviews'),
50
+		'label' => __('Multilingual', 'site-reviews'),
51
+		'options' => [
52
+			'' => __('No Integration', 'site-reviews'),
53
+			'polylang' => __('Integrate with Polylang', 'site-reviews'),
54
+			'wpml' => __('Integrate with WPML', 'site-reviews'),
55
+		],
56
+		'type' => 'select',
57
+	],
58
+	'settings.general.rebusify' => [
59
+		'default' => 'no',
60
+		'description' => sprintf(__('Integrate with the %s and validate your reviews on the blockchain to increase online reputation, trust, and transparency.', 'site-reviews'),
61
+			'<a href="https://rebusify.com/plans?ref=105" target="_blank">Rebusify Confidence System</a>'
62
+		),
63
+		'label' => __('Blockchain Validation', 'site-reviews'),
64
+		'type' => 'yes_no',
65
+	],
66
+	'settings.general.rebusify_email' => [
67
+		'default' => '',
68
+		'depends_on' => [
69
+			'settings.general.rebusify' => ['yes'],
70
+		],
71
+		'description' => __('Enter your Rebusify account email here.', 'site-reviews'),
72
+		'label' => __('Rebusify Email', 'site-reviews'),
73
+		'type' => 'text',
74
+	],
75
+	'settings.general.rebusify_serial' => [
76
+		'default' => '',
77
+		'depends_on' => [
78
+			'settings.general.rebusify' => ['yes'],
79
+		],
80
+		'description' => __('Enter your Rebusify account serial key here.', 'site-reviews'),
81
+		'label' => __('Rebusify Serial Key', 'site-reviews'),
82
+		'type' => 'password',
83
+	],
84
+	'settings.general.notifications' => [
85
+		'default' => [],
86
+		'label' => __('Notifications', 'site-reviews'),
87
+		'options' => [
88
+			'admin' => __('Send to administrator', 'site-reviews').' <code>'.(string) get_option('admin_email').'</code>',
89
+			'author' => __('Send to author of the page that the review is assigned to', 'site-reviews'),
90
+			'custom' => __('Send to one or more email addresses', 'site-reviews'),
91
+			'slack' => __('Send to <a href="https://slack.com/">Slack</a>', 'site-reviews'),
92
+		],
93
+		'type' => 'checkbox',
94
+	],
95
+	'settings.general.notification_email' => [
96
+		'default' => '',
97
+		'depends_on' => [
98
+			'settings.general.notifications' => ['custom'],
99
+		],
100
+		'label' => __('Send Notification Emails To', 'site-reviews'),
101
+		'placeholder' => __('Separate multiple emails with a comma', 'site-reviews'),
102
+		'type' => 'text',
103
+	],
104
+	'settings.general.notification_slack' => [
105
+		'default' => '',
106
+		'depends_on' => [
107
+			'settings.general.notifications' => ['slack'],
108
+		],
109
+		'description' => sprintf(__('To send notifications to Slack, create a new %s and then paste the provided Webhook URL in the field above.', 'site-reviews'),
110
+			'<a href="https://api.slack.com/incoming-webhooks">'.__('Incoming WebHook', 'site-reviews').'</a>'
111
+		),
112
+		'label' => __('Slack Webhook URL', 'site-reviews'),
113
+		'type' => 'text',
114
+	],
115
+	'settings.general.notification_message' => [
116
+		'default' => glsr('Modules\Html\Template')->build('templates/email-notification'),
117
+		'depends_on' => [
118
+			'settings.general.notifications' => ['admin', 'author', 'custom', 'slack'],
119
+		],
120
+		'description' => __(
121
+			'To restore the default text, save an empty template. '.
122
+			'If you are sending notifications to Slack then this template will only be used as a fallback in the event that <a href="https://api.slack.com/docs/attachments">Message Attachments</a> have been disabled. Available template tags:'.
123
+			'<br><code>{review_rating}</code> The review rating number (1-5)'.
124
+			'<br><code>{review_title}</code> The review title'.
125
+			'<br><code>{review_content}</code> The review content'.
126
+			'<br><code>{review_author}</code> The review author'.
127
+			'<br><code>{review_email}</code> The email of the review author'.
128
+			'<br><code>{review_ip}</code> The IP address of the review author'.
129
+			'<br><code>{review_link}</code> The link to edit/view a review',
130
+			'site-reviews'
131
+		),
132
+		'label' => __('Notification Template', 'site-reviews'),
133
+		'rows' => 10,
134
+		'type' => 'code',
135
+	],
136
+	'settings.reviews.date.format' => [
137
+		'default' => '',
138
+		'description' => sprintf(__('The default date format is the one set in your %s.', 'site-reviews'),
139
+			'<a href="'.admin_url('options-general.php#date_format_custom').'">'.__('WordPress settings', 'site-reviews').'</a>'
140
+		),
141
+		'label' => __('Date Format', 'site-reviews'),
142
+		'options' => [
143
+			'' => __('Use the default date format', 'site-reviews'),
144
+			'relative' => __('Use a relative date format', 'site-reviews'),
145
+			'custom' => __('Use a custom date format', 'site-reviews'),
146
+		],
147
+		'type' => 'select',
148
+	],
149
+	'settings.reviews.date.custom' => [
150
+		'default' => get_option('date_format'),
151
+		'depends_on' => [
152
+			'settings.reviews.date.format' => 'custom',
153
+		],
154
+		'description' => __('Enter a custom date format (<a href="https://codex.wordpress.org/Formatting_Date_and_Time">documentation on date and time formatting</a>).', 'site-reviews'),
155
+		'label' => __('Custom Date Format', 'site-reviews'),
156
+		'type' => 'text',
157
+	],
158
+	'settings.reviews.name.format' => [
159
+		'default' => '',
160
+		'description' => __('Choose how names are shown in your reviews.', 'site-reviews'),
161
+		'label' => __('Name Format', 'site-reviews'),
162
+		'options' => [
163
+			'' => __('Use the name as given', 'site-reviews'),
164
+			'first' => __('Use the first name only', 'site-reviews'),
165
+			'first_initial' => __('Convert first name to an initial', 'site-reviews'),
166
+			'last_initial' => __('Convert last name to an initial', 'site-reviews'),
167
+			'initials' => __('Convert to all initials', 'site-reviews'),
168
+		],
169
+		'type' => 'select',
170
+	],
171
+	'settings.reviews.name.initial' => [
172
+		'default' => '',
173
+		'depends_on' => [
174
+			'settings.reviews.name.format' => ['first_initial', 'last_initial', 'initials'],
175
+		],
176
+		'description' => __('Choose how the initial is displayed.', 'site-reviews'),
177
+		'label' => __('Initial Format', 'site-reviews'),
178
+		'options' => [
179
+			'' => __('Initial with a space', 'site-reviews'),
180
+			'period' => __('Initial with a period', 'site-reviews'),
181
+			'period_space' => __('Initial with a period and a space', 'site-reviews'),
182
+		],
183
+		'type' => 'select',
184
+	],
185
+	'settings.reviews.assigned_links' => [
186
+		'default' => 'no',
187
+		'description' => __('Display a link to the assigned post of a review.', 'site-reviews'),
188
+		'label' => __('Enable Assigned Links', 'site-reviews'),
189
+		'type' => 'yes_no',
190
+	],
191
+	'settings.reviews.avatars' => [
192
+		'default' => 'no',
193
+		'description' => __('Display reviewer avatars. These are generated from the email address of the reviewer using <a href="https://gravatar.com">Gravatar</a>.', 'site-reviews'),
194
+		'label' => __('Enable Avatars', 'site-reviews'),
195
+		'type' => 'yes_no',
196
+	],
197
+	'settings.reviews.avatars_regenerate' => [
198
+		'default' => 'no',
199
+		'depends_on' => [
200
+			'settings.reviews.avatars' => 'yes',
201
+		],
202
+		'description' => __('Regenerate the avatar whenever a local review is shown?', 'site-reviews'),
203
+		'label' => __('Regenerate Avatars', 'site-reviews'),
204
+		'type' => 'yes_no',
205
+	],
206
+	'settings.reviews.avatars_size' => [
207
+		'default' => 40,
208
+		'depends_on' => [
209
+			'settings.reviews.avatars' => 'yes',
210
+		],
211
+		'description' => __('Set the avatar size in pixels.', 'site-reviews'),
212
+		'label' => __('Avatar Size', 'site-reviews'),
213
+		'type' => 'number',
214
+	],
215
+	'settings.reviews.excerpts' => [
216
+		'default' => 'yes',
217
+		'description' => __('Display an excerpt instead of the full review.', 'site-reviews'),
218
+		'label' => __('Enable Excerpts', 'site-reviews'),
219
+		'type' => 'yes_no',
220
+	],
221
+	'settings.reviews.excerpts_length' => [
222
+		'default' => 55,
223
+		'depends_on' => [
224
+			'settings.reviews.excerpts' => 'yes',
225
+		],
226
+		'description' => __('Set the excerpt word length.', 'site-reviews'),
227
+		'label' => __('Excerpt Length', 'site-reviews'),
228
+		'type' => 'number',
229
+	],
230
+	'settings.reviews.fallback' => [
231
+		'default' => 'yes',
232
+		'description' => sprintf(__('Display the fallback text when there are no reviews to display. This can be changed on the %s page. You may also override this by using the "fallback" option on the shortcode. The default fallback text is: %s', 'site-reviews'),
233
+			'<a href="'.admin_url('edit.php?post_type=site-review&page=settings#!translations').'">'.__('Translations', 'site-reviews').'</a>',
234
+			'<code>'.__('There are no reviews yet. Be the first one to write one.', 'site-reviews').'</code>'
235
+		),
236
+		'label' => __('Enable Fallback Text', 'site-reviews'),
237
+		'type' => 'yes_no',
238
+	],
239
+	'settings.schema.type.default' => [
240
+		'default' => 'LocalBusiness',
241
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_type</code>',
242
+		'label' => __('Default Schema Type', 'site-reviews'),
243
+		'options' => [
244
+			'LocalBusiness' => __('Local Business', 'site-reviews'),
245
+			'Product' => __('Product', 'site-reviews'),
246
+			'custom' => __('Custom', 'site-reviews'),
247
+		],
248
+		'type' => 'select',
249
+	],
250
+	'settings.schema.type.custom' => [
251
+		'default' => '',
252
+		'depends_on' => [
253
+			'settings.schema.type.default' => 'custom',
254
+		],
255
+		'description' => '<a href="https://schema.org/docs/schemas.html">'.__('View more information on schema types here', 'site-reviews').'</a>',
256
+		'label' => __('Custom Schema Type', 'site-reviews'),
257
+		'type' => 'text',
258
+	],
259
+	'settings.schema.name.default' => [
260
+		'default' => 'post',
261
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_name</code>',
262
+		'label' => __('Default Name', 'site-reviews'),
263
+		'options' => [
264
+			'post' => __('Use the assigned or current page title', 'site-reviews'),
265
+			'custom' => __('Enter a custom title', 'site-reviews'),
266
+		],
267
+		'type' => 'select',
268
+	],
269
+	'settings.schema.name.custom' => [
270
+		'default' => '',
271
+		'depends_on' => [
272
+			'settings.schema.name.default' => 'custom',
273
+		],
274
+		'label' => __('Custom Name', 'site-reviews'),
275
+		'type' => 'text',
276
+	],
277
+	'settings.schema.description.default' => [
278
+		'default' => 'post',
279
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_description</code>',
280
+		'label' => __('Default Description', 'site-reviews'),
281
+		'options' => [
282
+			'post' => __('Use the assigned or current page excerpt', 'site-reviews'),
283
+			'custom' => __('Enter a custom description', 'site-reviews'),
284
+		],
285
+		'type' => 'select',
286
+	],
287
+	'settings.schema.description.custom' => [
288
+		'default' => '',
289
+		'depends_on' => [
290
+			'settings.schema.description.default' => 'custom',
291
+		],
292
+		'label' => __('Custom Description', 'site-reviews'),
293
+		'type' => 'text',
294
+	],
295
+	'settings.schema.url.default' => [
296
+		'default' => 'post',
297
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_url</code>',
298
+		'label' => __('Default URL', 'site-reviews'),
299
+		'options' => [
300
+			'post' => __('Use the assigned or current page URL', 'site-reviews'),
301
+			'custom' => __('Enter a custom URL', 'site-reviews'),
302
+		],
303
+		'type' => 'select',
304
+	],
305
+	'settings.schema.url.custom' => [
306
+		'default' => '',
307
+		'depends_on' => [
308
+			'settings.schema.url.default' => 'custom',
309
+		],
310
+		'label' => __('Custom URL', 'site-reviews'),
311
+		'type' => 'text',
312
+	],
313
+	'settings.schema.image.default' => [
314
+		'default' => 'post',
315
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_image</code>',
316
+		'label' => __('Default Image', 'site-reviews'),
317
+		'options' => [
318
+			'post' => __('Use the featured image of the assigned or current page', 'site-reviews'),
319
+			'custom' => __('Enter a custom image URL', 'site-reviews'),
320
+		],
321
+		'type' => 'select',
322
+	],
323
+	'settings.schema.image.custom' => [
324
+		'default' => '',
325
+		'depends_on' => [
326
+			'settings.schema.image.default' => 'custom',
327
+		],
328
+		'label' => __('Custom Image URL', 'site-reviews'),
329
+		'type' => 'text',
330
+	],
331
+	'settings.schema.address' => [
332
+		'default' => '',
333
+		'depends_on' => [
334
+			'settings.schema.type.default' => 'LocalBusiness',
335
+		],
336
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_address</code>',
337
+		'label' => __('Address', 'site-reviews'),
338
+		'placeholder' => '60 29th Street #343, San Francisco, CA 94110, US',
339
+		'type' => 'text',
340
+	],
341
+	'settings.schema.telephone' => [
342
+		'default' => '',
343
+		'depends_on' => [
344
+			'settings.schema.type.default' => 'LocalBusiness',
345
+		],
346
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_telephone</code>',
347
+		'label' => __('Telephone Number', 'site-reviews'),
348
+		'placeholder' => '+1 (877) 273-3049',
349
+		'type' => 'text',
350
+	],
351
+	'settings.schema.pricerange' => [
352
+		'default' => '',
353
+		'depends_on' => [
354
+			'settings.schema.type.default' => 'LocalBusiness',
355
+		],
356
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_pricerange</code>',
357
+		'label' => __('Price Range', 'site-reviews'),
358
+		'placeholder' => '$$-$$$',
359
+		'type' => 'text',
360
+	],
361
+	'settings.schema.offertype' => [
362
+		'default' => 'AggregateOffer',
363
+		'depends_on' => [
364
+			'settings.schema.type.default' => 'Product',
365
+		],
366
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_offertype</code>',
367
+		'label' => __('Offer Type', 'site-reviews'),
368
+		'options' => [
369
+			'AggregateOffer' => __('AggregateOffer', 'site-reviews'),
370
+			'Offer' => __('Offer', 'site-reviews'),
371
+		],
372
+		'type' => 'select',
373
+	],
374
+	'settings.schema.price' => [
375
+		'default' => '',
376
+		'depends_on' => [
377
+			'settings.schema.type.default' => 'Product',
378
+			'settings.schema.offertype' => 'Offer',
379
+		],
380
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_price</code>',
381
+		'label' => __('Price', 'site-reviews'),
382
+		'placeholder' => '50.00',
383
+		'type' => 'text',
384
+	],
385
+	'settings.schema.lowprice' => [
386
+		'default' => '',
387
+		'depends_on' => [
388
+			'settings.schema.type.default' => 'Product',
389
+			'settings.schema.offertype' => 'AggregateOffer',
390
+		],
391
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_lowprice</code>',
392
+		'label' => __('Low Price', 'site-reviews'),
393
+		'placeholder' => '10.00',
394
+		'type' => 'text',
395
+	],
396
+	'settings.schema.highprice' => [
397
+		'default' => '',
398
+		'depends_on' => [
399
+			'settings.schema.type.default' => 'Product',
400
+			'settings.schema.offertype' => 'AggregateOffer',
401
+		],
402
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_highprice</code>',
403
+		'label' => __('High Price', 'site-reviews'),
404
+		'placeholder' => '100.00',
405
+		'type' => 'text',
406
+	],
407
+	'settings.schema.pricecurrency' => [
408
+		'default' => '',
409
+		'depends_on' => [
410
+			'settings.schema.type.default' => 'Product',
411
+		],
412
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_pricecurrency</code>',
413
+		'label' => __('Price Currency', 'site-reviews'),
414
+		'placeholder' => 'USD',
415
+		'type' => 'text',
416
+	],
417
+	'settings.submissions.required' => [
418
+		'default' => ['content', 'email', 'name', 'rating', 'terms', 'title'],
419
+		'description' => __('Choose which fields should be required in the submission form.', 'site-reviews'),
420
+		'label' => __('Required Fields', 'site-reviews'),
421
+		'options' => [
422
+			'rating' => __('Rating', 'site-reviews'),
423
+			'title' => __('Title', 'site-reviews'),
424
+			'content' => __('Review', 'site-reviews'),
425
+			'name' => __('Name', 'site-reviews'),
426
+			'email' => __('Email', 'site-reviews'),
427
+			'terms' => __('Terms', 'site-reviews'),
428
+		],
429
+		'type' => 'checkbox',
430
+	],
431
+	'settings.submissions.limit' => [
432
+		'default' => '',
433
+		'description' => __('Limits the number of reviews that can be submitted to one-per-person. If you are assigning reviews, then the limit will be applied to the assigned page or category.', 'site-reviews'),
434
+		'label' => __('Limit Reviews', 'site-reviews'),
435
+		'options' => [
436
+			'' => __('No Limit', 'site-reviews'),
437
+			'email' => __('By Email Address', 'site-reviews'),
438
+			'ip_address' => __('By IP Address', 'site-reviews'),
439
+			'username' => __('By Username (will only work for registered users)', 'site-reviews'),
440
+		],
441
+		'type' => 'select',
442
+	],
443
+	'settings.submissions.limit_whitelist.email' => [
444
+		'default' => '',
445
+		'depends_on' => [
446
+			'settings.submissions.limit' => ['email'],
447
+		],
448
+		'description' => __('One Email per line. All emails in the whitelist will be excluded from the review submission limit.', 'site-reviews'),
449
+		'label' => __('Email Whitelist', 'site-reviews'),
450
+		'rows' => 5,
451
+		'type' => 'code',
452
+	],
453
+	'settings.submissions.limit_whitelist.ip_address' => [
454
+		'default' => '',
455
+		'depends_on' => [
456
+			'settings.submissions.limit' => ['ip_address'],
457
+		],
458
+		'description' => __('One IP Address per line. All IP Addresses in the whitelist will be excluded from the review submission limit..', 'site-reviews'),
459
+		'label' => __('IP Address Whitelist', 'site-reviews'),
460
+		'rows' => 5,
461
+		'type' => 'code',
462
+	],
463
+	'settings.submissions.limit_whitelist.username' => [
464
+		'default' => '',
465
+		'depends_on' => [
466
+			'settings.submissions.limit' => ['username'],
467
+		],
468
+		'description' => __('One Username per line. All registered users with a Username in the whitelist will be excluded from the review submission limit.', 'site-reviews'),
469
+		'label' => __('Username Whitelist', 'site-reviews'),
470
+		'rows' => 5,
471
+		'type' => 'code',
472
+	],
473
+	'settings.submissions.recaptcha.integration' => [
474
+		'default' => '',
475
+		'description' => __('Invisible reCAPTCHA is a free anti-spam service from Google. To use it, you will need to <a href="https://www.google.com/recaptcha/admin" target="_blank">sign up</a> for an API key pair for your site.', 'site-reviews'),
476
+		'label' => __('Invisible reCAPTCHA', 'site-reviews'),
477
+		'options' => [
478
+			'' => 'Do not use reCAPTCHA',
479
+			'all' => 'Use reCAPTCHA',
480
+			'guest' => 'Use reCAPTCHA only for guest users',
481
+		],
482
+		'type' => 'select',
483
+	],
484
+	'settings.submissions.recaptcha.key' => [
485
+		'default' => '',
486
+		'depends_on' => [
487
+			'settings.submissions.recaptcha.integration' => ['all', 'guest'],
488
+		],
489
+		'label' => __('Site Key', 'site-reviews'),
490
+		'type' => 'text',
491
+	],
492
+	'settings.submissions.recaptcha.secret' => [
493
+		'default' => '',
494
+		'depends_on' => [
495
+			'settings.submissions.recaptcha.integration' => ['all', 'guest'],
496
+		],
497
+		'label' => __('Site Secret', 'site-reviews'),
498
+		'type' => 'text',
499
+	],
500
+	'settings.submissions.recaptcha.position' => [
501
+		'default' => 'bottomleft',
502
+		'depends_on' => [
503
+			'settings.submissions.recaptcha.integration' => ['all', 'guest'],
504
+		],
505
+		'description' => __('This option may not work consistently if another plugin is loading reCAPTCHA on the same page as Site Reviews.', 'site-reviews'),
506
+		'label' => __('Badge Position', 'site-reviews'),
507
+		'options' => [
508
+			'bottomleft' => 'Bottom Left',
509
+			'bottomright' => 'Bottom Right',
510
+			'inline' => 'Inline',
511
+		],
512
+		'type' => 'select',
513
+	],
514
+	'settings.submissions.akismet' => [
515
+		'default' => 'no',
516
+		'description' => __('The <a href="https://akismet.com" target="_blank">Akismet plugin</a> integration provides spam-filtering for your reviews. In order for this setting to have any affect, you will need to first install and activate the Akismet plugin and set up a WordPress.com API key.', 'site-reviews'),
517
+		'label' => __('Enable Akismet Integration', 'site-reviews'),
518
+		'type' => 'yes_no',
519
+	],
520
+	'settings.submissions.blacklist.integration' => [
521
+		'default' => '',
522
+		'description' => sprintf(__('Choose which Blacklist you would prefer to use for reviews. The %s can be found in the WordPress Discussion Settings page.', 'site-reviews'),
523
+			'<a href="'.admin_url('options-discussion.php#users_can_register').'">'.__('Comment Blacklist', 'site-reviews').'</a>'
524
+		),
525
+		'label' => __('Blacklist', 'site-reviews'),
526
+		'options' => [
527
+			'' => 'Use the Site Reviews Blacklist',
528
+			'comments' => 'Use the WordPress Comment Blacklist',
529
+		],
530
+		'type' => 'select',
531
+	],
532
+	'settings.submissions.blacklist.entries' => [
533
+		'default' => '',
534
+		'depends_on' => [
535
+			'settings.submissions.blacklist.integration' => [''],
536
+		],
537
+		'description' => __('One entry or IP address per line. When a review contains any of these entries in its title, content, name, email, or IP address, it will be rejected. It is case-insensitive and will match partial words, so "press" will match "WordPress".', 'site-reviews'),
538
+		'label' => __('Review Blacklist', 'site-reviews'),
539
+		'rows' => 10,
540
+		'type' => 'code',
541
+	],
542
+	'settings.submissions.blacklist.action' => [
543
+		'default' => 'unapprove',
544
+		'description' => __('Choose the action that should be taken when a review is blacklisted.', 'site-reviews'),
545
+		'label' => __('Blacklist Action', 'site-reviews'),
546
+		'options' => [
547
+			'unapprove' => __('Require approval', 'site-reviews'),
548
+			'reject' => __('Reject submission', 'site-reviews'),
549
+		],
550
+		'type' => 'select',
551
+	],
552 552
 ];
Please login to merge, or discard this patch.
Spacing   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -3,16 +3,16 @@  discard block
 block discarded – undo
3 3
 return [
4 4
     'settings.general.style' => [
5 5
         'default' => 'default',
6
-        'description' => __('Site Reviews relies on the CSS of your theme to style the submission form. If your theme does not provide proper CSS rules for form elements and you are using a WordPress plugin/theme or CSS Framework listed here, please try selecting it, otherwise choose "Site Reviews (default)".', 'site-reviews'),
7
-        'label' => __('Plugin Style', 'site-reviews'),
6
+        'description' => __( 'Site Reviews relies on the CSS of your theme to style the submission form. If your theme does not provide proper CSS rules for form elements and you are using a WordPress plugin/theme or CSS Framework listed here, please try selecting it, otherwise choose "Site Reviews (default)".', 'site-reviews' ),
7
+        'label' => __( 'Plugin Style', 'site-reviews' ),
8 8
         'options' => [
9 9
             'bootstrap_4' => 'CSS Framework: Bootstrap 4',
10 10
             'bootstrap_4_custom' => 'CSS Framework: Bootstrap 4 (Custom Forms)',
11 11
             'contact_form_7' => 'Plugin: Contact Form 7 (v5)',
12 12
             'ninja_forms' => 'Plugin: Ninja Forms (v3)',
13 13
             'wpforms' => 'Plugin: WPForms Lite (v1)',
14
-            'default' => __('Site Reviews (default)', 'site-reviews'),
15
-            'minimal' => __('Site Reviews (minimal)', 'site-reviews'),
14
+            'default' => __( 'Site Reviews (default)', 'site-reviews' ),
15
+            'minimal' => __( 'Site Reviews (minimal)', 'site-reviews' ),
16 16
             'divi' => 'Theme: Divi (v3)',
17 17
             'materialize' => 'Theme: Materialize',
18 18
             'twentyfifteen' => 'Theme: Twenty Fifteen',
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
     ],
24 24
     'settings.general.require.approval' => [
25 25
         'default' => 'no',
26
-        'description' => __('Set the status of new review submissions to "unapproved".', 'site-reviews'),
27
-        'label' => __('Require Approval', 'site-reviews'),
26
+        'description' => __( 'Set the status of new review submissions to "unapproved".', 'site-reviews' ),
27
+        'label' => __( 'Require Approval', 'site-reviews' ),
28 28
         'type' => 'yes_no',
29 29
     ],
30 30
     'settings.general.require.login' => [
31 31
         'default' => 'no',
32
-        'description' => __('Only allow review submissions from registered users.', 'site-reviews'),
33
-        'label' => __('Require Login', 'site-reviews'),
32
+        'description' => __( 'Only allow review submissions from registered users.', 'site-reviews' ),
33
+        'label' => __( 'Require Login', 'site-reviews' ),
34 34
         'type' => 'yes_no',
35 35
     ],
36 36
     'settings.general.require.login_register' => [
@@ -38,29 +38,29 @@  discard block
 block discarded – undo
38 38
         'depends_on' => [
39 39
             'settings.general.require.login' => 'yes',
40 40
         ],
41
-        'description' => sprintf(__('Show a link for a new user to register. The %s Membership option must be enabled in General Settings for this to work.', 'site-reviews'),
42
-            '<a href="'.admin_url('options-general.php#users_can_register').'">'.__('Anyone can register', 'site-reviews').'</a>'
41
+        'description' => sprintf( __( 'Show a link for a new user to register. The %s Membership option must be enabled in General Settings for this to work.', 'site-reviews' ),
42
+            '<a href="'.admin_url( 'options-general.php#users_can_register' ).'">'.__( 'Anyone can register', 'site-reviews' ).'</a>'
43 43
         ),
44
-        'label' => __('Show Registration Link', 'site-reviews'),
44
+        'label' => __( 'Show Registration Link', 'site-reviews' ),
45 45
         'type' => 'yes_no',
46 46
     ],
47 47
     'settings.general.multilingual' => [
48 48
         'default' => '',
49
-        'description' => __('Integrate with a multilingual plugin to calculate ratings for all languages of a post.', 'site-reviews'),
50
-        'label' => __('Multilingual', 'site-reviews'),
49
+        'description' => __( 'Integrate with a multilingual plugin to calculate ratings for all languages of a post.', 'site-reviews' ),
50
+        'label' => __( 'Multilingual', 'site-reviews' ),
51 51
         'options' => [
52
-            '' => __('No Integration', 'site-reviews'),
53
-            'polylang' => __('Integrate with Polylang', 'site-reviews'),
54
-            'wpml' => __('Integrate with WPML', 'site-reviews'),
52
+            '' => __( 'No Integration', 'site-reviews' ),
53
+            'polylang' => __( 'Integrate with Polylang', 'site-reviews' ),
54
+            'wpml' => __( 'Integrate with WPML', 'site-reviews' ),
55 55
         ],
56 56
         'type' => 'select',
57 57
     ],
58 58
     'settings.general.rebusify' => [
59 59
         'default' => 'no',
60
-        'description' => sprintf(__('Integrate with the %s and validate your reviews on the blockchain to increase online reputation, trust, and transparency.', 'site-reviews'),
60
+        'description' => sprintf( __( 'Integrate with the %s and validate your reviews on the blockchain to increase online reputation, trust, and transparency.', 'site-reviews' ),
61 61
             '<a href="https://rebusify.com/plans?ref=105" target="_blank">Rebusify Confidence System</a>'
62 62
         ),
63
-        'label' => __('Blockchain Validation', 'site-reviews'),
63
+        'label' => __( 'Blockchain Validation', 'site-reviews' ),
64 64
         'type' => 'yes_no',
65 65
     ],
66 66
     'settings.general.rebusify_email' => [
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
         'depends_on' => [
69 69
             'settings.general.rebusify' => ['yes'],
70 70
         ],
71
-        'description' => __('Enter your Rebusify account email here.', 'site-reviews'),
72
-        'label' => __('Rebusify Email', 'site-reviews'),
71
+        'description' => __( 'Enter your Rebusify account email here.', 'site-reviews' ),
72
+        'label' => __( 'Rebusify Email', 'site-reviews' ),
73 73
         'type' => 'text',
74 74
     ],
75 75
     'settings.general.rebusify_serial' => [
@@ -77,18 +77,18 @@  discard block
 block discarded – undo
77 77
         'depends_on' => [
78 78
             'settings.general.rebusify' => ['yes'],
79 79
         ],
80
-        'description' => __('Enter your Rebusify account serial key here.', 'site-reviews'),
81
-        'label' => __('Rebusify Serial Key', 'site-reviews'),
80
+        'description' => __( 'Enter your Rebusify account serial key here.', 'site-reviews' ),
81
+        'label' => __( 'Rebusify Serial Key', 'site-reviews' ),
82 82
         'type' => 'password',
83 83
     ],
84 84
     'settings.general.notifications' => [
85 85
         'default' => [],
86
-        'label' => __('Notifications', 'site-reviews'),
86
+        'label' => __( 'Notifications', 'site-reviews' ),
87 87
         'options' => [
88
-            'admin' => __('Send to administrator', 'site-reviews').' <code>'.(string) get_option('admin_email').'</code>',
89
-            'author' => __('Send to author of the page that the review is assigned to', 'site-reviews'),
90
-            'custom' => __('Send to one or more email addresses', 'site-reviews'),
91
-            'slack' => __('Send to <a href="https://slack.com/">Slack</a>', 'site-reviews'),
88
+            'admin' => __( 'Send to administrator', 'site-reviews' ).' <code>'.(string)get_option( 'admin_email' ).'</code>',
89
+            'author' => __( 'Send to author of the page that the review is assigned to', 'site-reviews' ),
90
+            'custom' => __( 'Send to one or more email addresses', 'site-reviews' ),
91
+            'slack' => __( 'Send to <a href="https://slack.com/">Slack</a>', 'site-reviews' ),
92 92
         ],
93 93
         'type' => 'checkbox',
94 94
     ],
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
         'depends_on' => [
98 98
             'settings.general.notifications' => ['custom'],
99 99
         ],
100
-        'label' => __('Send Notification Emails To', 'site-reviews'),
101
-        'placeholder' => __('Separate multiple emails with a comma', 'site-reviews'),
100
+        'label' => __( 'Send Notification Emails To', 'site-reviews' ),
101
+        'placeholder' => __( 'Separate multiple emails with a comma', 'site-reviews' ),
102 102
         'type' => 'text',
103 103
     ],
104 104
     'settings.general.notification_slack' => [
@@ -106,14 +106,14 @@  discard block
 block discarded – undo
106 106
         'depends_on' => [
107 107
             'settings.general.notifications' => ['slack'],
108 108
         ],
109
-        'description' => sprintf(__('To send notifications to Slack, create a new %s and then paste the provided Webhook URL in the field above.', 'site-reviews'),
110
-            '<a href="https://api.slack.com/incoming-webhooks">'.__('Incoming WebHook', 'site-reviews').'</a>'
109
+        'description' => sprintf( __( 'To send notifications to Slack, create a new %s and then paste the provided Webhook URL in the field above.', 'site-reviews' ),
110
+            '<a href="https://api.slack.com/incoming-webhooks">'.__( 'Incoming WebHook', 'site-reviews' ).'</a>'
111 111
         ),
112
-        'label' => __('Slack Webhook URL', 'site-reviews'),
112
+        'label' => __( 'Slack Webhook URL', 'site-reviews' ),
113 113
         'type' => 'text',
114 114
     ],
115 115
     'settings.general.notification_message' => [
116
-        'default' => glsr('Modules\Html\Template')->build('templates/email-notification'),
116
+        'default' => glsr( 'Modules\Html\Template' )->build( 'templates/email-notification' ),
117 117
         'depends_on' => [
118 118
             'settings.general.notifications' => ['admin', 'author', 'custom', 'slack'],
119 119
         ],
@@ -129,42 +129,42 @@  discard block
 block discarded – undo
129 129
             '<br><code>{review_link}</code> The link to edit/view a review',
130 130
             'site-reviews'
131 131
         ),
132
-        'label' => __('Notification Template', 'site-reviews'),
132
+        'label' => __( 'Notification Template', 'site-reviews' ),
133 133
         'rows' => 10,
134 134
         'type' => 'code',
135 135
     ],
136 136
     'settings.reviews.date.format' => [
137 137
         'default' => '',
138
-        'description' => sprintf(__('The default date format is the one set in your %s.', 'site-reviews'),
139
-            '<a href="'.admin_url('options-general.php#date_format_custom').'">'.__('WordPress settings', 'site-reviews').'</a>'
138
+        'description' => sprintf( __( 'The default date format is the one set in your %s.', 'site-reviews' ),
139
+            '<a href="'.admin_url( 'options-general.php#date_format_custom' ).'">'.__( 'WordPress settings', 'site-reviews' ).'</a>'
140 140
         ),
141
-        'label' => __('Date Format', 'site-reviews'),
141
+        'label' => __( 'Date Format', 'site-reviews' ),
142 142
         'options' => [
143
-            '' => __('Use the default date format', 'site-reviews'),
144
-            'relative' => __('Use a relative date format', 'site-reviews'),
145
-            'custom' => __('Use a custom date format', 'site-reviews'),
143
+            '' => __( 'Use the default date format', 'site-reviews' ),
144
+            'relative' => __( 'Use a relative date format', 'site-reviews' ),
145
+            'custom' => __( 'Use a custom date format', 'site-reviews' ),
146 146
         ],
147 147
         'type' => 'select',
148 148
     ],
149 149
     'settings.reviews.date.custom' => [
150
-        'default' => get_option('date_format'),
150
+        'default' => get_option( 'date_format' ),
151 151
         'depends_on' => [
152 152
             'settings.reviews.date.format' => 'custom',
153 153
         ],
154
-        'description' => __('Enter a custom date format (<a href="https://codex.wordpress.org/Formatting_Date_and_Time">documentation on date and time formatting</a>).', 'site-reviews'),
155
-        'label' => __('Custom Date Format', 'site-reviews'),
154
+        'description' => __( 'Enter a custom date format (<a href="https://codex.wordpress.org/Formatting_Date_and_Time">documentation on date and time formatting</a>).', 'site-reviews' ),
155
+        'label' => __( 'Custom Date Format', 'site-reviews' ),
156 156
         'type' => 'text',
157 157
     ],
158 158
     'settings.reviews.name.format' => [
159 159
         'default' => '',
160
-        'description' => __('Choose how names are shown in your reviews.', 'site-reviews'),
161
-        'label' => __('Name Format', 'site-reviews'),
160
+        'description' => __( 'Choose how names are shown in your reviews.', 'site-reviews' ),
161
+        'label' => __( 'Name Format', 'site-reviews' ),
162 162
         'options' => [
163
-            '' => __('Use the name as given', 'site-reviews'),
164
-            'first' => __('Use the first name only', 'site-reviews'),
165
-            'first_initial' => __('Convert first name to an initial', 'site-reviews'),
166
-            'last_initial' => __('Convert last name to an initial', 'site-reviews'),
167
-            'initials' => __('Convert to all initials', 'site-reviews'),
163
+            '' => __( 'Use the name as given', 'site-reviews' ),
164
+            'first' => __( 'Use the first name only', 'site-reviews' ),
165
+            'first_initial' => __( 'Convert first name to an initial', 'site-reviews' ),
166
+            'last_initial' => __( 'Convert last name to an initial', 'site-reviews' ),
167
+            'initials' => __( 'Convert to all initials', 'site-reviews' ),
168 168
         ],
169 169
         'type' => 'select',
170 170
     ],
@@ -173,25 +173,25 @@  discard block
 block discarded – undo
173 173
         'depends_on' => [
174 174
             'settings.reviews.name.format' => ['first_initial', 'last_initial', 'initials'],
175 175
         ],
176
-        'description' => __('Choose how the initial is displayed.', 'site-reviews'),
177
-        'label' => __('Initial Format', 'site-reviews'),
176
+        'description' => __( 'Choose how the initial is displayed.', 'site-reviews' ),
177
+        'label' => __( 'Initial Format', 'site-reviews' ),
178 178
         'options' => [
179
-            '' => __('Initial with a space', 'site-reviews'),
180
-            'period' => __('Initial with a period', 'site-reviews'),
181
-            'period_space' => __('Initial with a period and a space', 'site-reviews'),
179
+            '' => __( 'Initial with a space', 'site-reviews' ),
180
+            'period' => __( 'Initial with a period', 'site-reviews' ),
181
+            'period_space' => __( 'Initial with a period and a space', 'site-reviews' ),
182 182
         ],
183 183
         'type' => 'select',
184 184
     ],
185 185
     'settings.reviews.assigned_links' => [
186 186
         'default' => 'no',
187
-        'description' => __('Display a link to the assigned post of a review.', 'site-reviews'),
188
-        'label' => __('Enable Assigned Links', 'site-reviews'),
187
+        'description' => __( 'Display a link to the assigned post of a review.', 'site-reviews' ),
188
+        'label' => __( 'Enable Assigned Links', 'site-reviews' ),
189 189
         'type' => 'yes_no',
190 190
     ],
191 191
     'settings.reviews.avatars' => [
192 192
         'default' => 'no',
193
-        'description' => __('Display reviewer avatars. These are generated from the email address of the reviewer using <a href="https://gravatar.com">Gravatar</a>.', 'site-reviews'),
194
-        'label' => __('Enable Avatars', 'site-reviews'),
193
+        'description' => __( 'Display reviewer avatars. These are generated from the email address of the reviewer using <a href="https://gravatar.com">Gravatar</a>.', 'site-reviews' ),
194
+        'label' => __( 'Enable Avatars', 'site-reviews' ),
195 195
         'type' => 'yes_no',
196 196
     ],
197 197
     'settings.reviews.avatars_regenerate' => [
@@ -199,8 +199,8 @@  discard block
 block discarded – undo
199 199
         'depends_on' => [
200 200
             'settings.reviews.avatars' => 'yes',
201 201
         ],
202
-        'description' => __('Regenerate the avatar whenever a local review is shown?', 'site-reviews'),
203
-        'label' => __('Regenerate Avatars', 'site-reviews'),
202
+        'description' => __( 'Regenerate the avatar whenever a local review is shown?', 'site-reviews' ),
203
+        'label' => __( 'Regenerate Avatars', 'site-reviews' ),
204 204
         'type' => 'yes_no',
205 205
     ],
206 206
     'settings.reviews.avatars_size' => [
@@ -208,14 +208,14 @@  discard block
 block discarded – undo
208 208
         'depends_on' => [
209 209
             'settings.reviews.avatars' => 'yes',
210 210
         ],
211
-        'description' => __('Set the avatar size in pixels.', 'site-reviews'),
212
-        'label' => __('Avatar Size', 'site-reviews'),
211
+        'description' => __( 'Set the avatar size in pixels.', 'site-reviews' ),
212
+        'label' => __( 'Avatar Size', 'site-reviews' ),
213 213
         'type' => 'number',
214 214
     ],
215 215
     'settings.reviews.excerpts' => [
216 216
         'default' => 'yes',
217
-        'description' => __('Display an excerpt instead of the full review.', 'site-reviews'),
218
-        'label' => __('Enable Excerpts', 'site-reviews'),
217
+        'description' => __( 'Display an excerpt instead of the full review.', 'site-reviews' ),
218
+        'label' => __( 'Enable Excerpts', 'site-reviews' ),
219 219
         'type' => 'yes_no',
220 220
     ],
221 221
     'settings.reviews.excerpts_length' => [
@@ -223,27 +223,27 @@  discard block
 block discarded – undo
223 223
         'depends_on' => [
224 224
             'settings.reviews.excerpts' => 'yes',
225 225
         ],
226
-        'description' => __('Set the excerpt word length.', 'site-reviews'),
227
-        'label' => __('Excerpt Length', 'site-reviews'),
226
+        'description' => __( 'Set the excerpt word length.', 'site-reviews' ),
227
+        'label' => __( 'Excerpt Length', 'site-reviews' ),
228 228
         'type' => 'number',
229 229
     ],
230 230
     'settings.reviews.fallback' => [
231 231
         'default' => 'yes',
232
-        'description' => sprintf(__('Display the fallback text when there are no reviews to display. This can be changed on the %s page. You may also override this by using the "fallback" option on the shortcode. The default fallback text is: %s', 'site-reviews'),
233
-            '<a href="'.admin_url('edit.php?post_type=site-review&page=settings#!translations').'">'.__('Translations', 'site-reviews').'</a>',
234
-            '<code>'.__('There are no reviews yet. Be the first one to write one.', 'site-reviews').'</code>'
232
+        'description' => sprintf( __( 'Display the fallback text when there are no reviews to display. This can be changed on the %s page. You may also override this by using the "fallback" option on the shortcode. The default fallback text is: %s', 'site-reviews' ),
233
+            '<a href="'.admin_url( 'edit.php?post_type=site-review&page=settings#!translations' ).'">'.__( 'Translations', 'site-reviews' ).'</a>',
234
+            '<code>'.__( 'There are no reviews yet. Be the first one to write one.', 'site-reviews' ).'</code>'
235 235
         ),
236
-        'label' => __('Enable Fallback Text', 'site-reviews'),
236
+        'label' => __( 'Enable Fallback Text', 'site-reviews' ),
237 237
         'type' => 'yes_no',
238 238
     ],
239 239
     'settings.schema.type.default' => [
240 240
         'default' => 'LocalBusiness',
241
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_type</code>',
242
-        'label' => __('Default Schema Type', 'site-reviews'),
241
+        'description' => __( 'Custom Field name', 'site-reviews' ).': <code>schema_type</code>',
242
+        'label' => __( 'Default Schema Type', 'site-reviews' ),
243 243
         'options' => [
244
-            'LocalBusiness' => __('Local Business', 'site-reviews'),
245
-            'Product' => __('Product', 'site-reviews'),
246
-            'custom' => __('Custom', 'site-reviews'),
244
+            'LocalBusiness' => __( 'Local Business', 'site-reviews' ),
245
+            'Product' => __( 'Product', 'site-reviews' ),
246
+            'custom' => __( 'Custom', 'site-reviews' ),
247 247
         ],
248 248
         'type' => 'select',
249 249
     ],
@@ -252,17 +252,17 @@  discard block
 block discarded – undo
252 252
         'depends_on' => [
253 253
             'settings.schema.type.default' => 'custom',
254 254
         ],
255
-        'description' => '<a href="https://schema.org/docs/schemas.html">'.__('View more information on schema types here', 'site-reviews').'</a>',
256
-        'label' => __('Custom Schema Type', 'site-reviews'),
255
+        'description' => '<a href="https://schema.org/docs/schemas.html">'.__( 'View more information on schema types here', 'site-reviews' ).'</a>',
256
+        'label' => __( 'Custom Schema Type', 'site-reviews' ),
257 257
         'type' => 'text',
258 258
     ],
259 259
     'settings.schema.name.default' => [
260 260
         'default' => 'post',
261
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_name</code>',
262
-        'label' => __('Default Name', 'site-reviews'),
261
+        'description' => __( 'Custom Field name', 'site-reviews' ).': <code>schema_name</code>',
262
+        'label' => __( 'Default Name', 'site-reviews' ),
263 263
         'options' => [
264
-            'post' => __('Use the assigned or current page title', 'site-reviews'),
265
-            'custom' => __('Enter a custom title', 'site-reviews'),
264
+            'post' => __( 'Use the assigned or current page title', 'site-reviews' ),
265
+            'custom' => __( 'Enter a custom title', 'site-reviews' ),
266 266
         ],
267 267
         'type' => 'select',
268 268
     ],
@@ -271,16 +271,16 @@  discard block
 block discarded – undo
271 271
         'depends_on' => [
272 272
             'settings.schema.name.default' => 'custom',
273 273
         ],
274
-        'label' => __('Custom Name', 'site-reviews'),
274
+        'label' => __( 'Custom Name', 'site-reviews' ),
275 275
         'type' => 'text',
276 276
     ],
277 277
     'settings.schema.description.default' => [
278 278
         'default' => 'post',
279
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_description</code>',
280
-        'label' => __('Default Description', 'site-reviews'),
279
+        'description' => __( 'Custom Field name', 'site-reviews' ).': <code>schema_description</code>',
280
+        'label' => __( 'Default Description', 'site-reviews' ),
281 281
         'options' => [
282
-            'post' => __('Use the assigned or current page excerpt', 'site-reviews'),
283
-            'custom' => __('Enter a custom description', 'site-reviews'),
282
+            'post' => __( 'Use the assigned or current page excerpt', 'site-reviews' ),
283
+            'custom' => __( 'Enter a custom description', 'site-reviews' ),
284 284
         ],
285 285
         'type' => 'select',
286 286
     ],
@@ -289,16 +289,16 @@  discard block
 block discarded – undo
289 289
         'depends_on' => [
290 290
             'settings.schema.description.default' => 'custom',
291 291
         ],
292
-        'label' => __('Custom Description', 'site-reviews'),
292
+        'label' => __( 'Custom Description', 'site-reviews' ),
293 293
         'type' => 'text',
294 294
     ],
295 295
     'settings.schema.url.default' => [
296 296
         'default' => 'post',
297
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_url</code>',
298
-        'label' => __('Default URL', 'site-reviews'),
297
+        'description' => __( 'Custom Field name', 'site-reviews' ).': <code>schema_url</code>',
298
+        'label' => __( 'Default URL', 'site-reviews' ),
299 299
         'options' => [
300
-            'post' => __('Use the assigned or current page URL', 'site-reviews'),
301
-            'custom' => __('Enter a custom URL', 'site-reviews'),
300
+            'post' => __( 'Use the assigned or current page URL', 'site-reviews' ),
301
+            'custom' => __( 'Enter a custom URL', 'site-reviews' ),
302 302
         ],
303 303
         'type' => 'select',
304 304
     ],
@@ -307,16 +307,16 @@  discard block
 block discarded – undo
307 307
         'depends_on' => [
308 308
             'settings.schema.url.default' => 'custom',
309 309
         ],
310
-        'label' => __('Custom URL', 'site-reviews'),
310
+        'label' => __( 'Custom URL', 'site-reviews' ),
311 311
         'type' => 'text',
312 312
     ],
313 313
     'settings.schema.image.default' => [
314 314
         'default' => 'post',
315
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_image</code>',
316
-        'label' => __('Default Image', 'site-reviews'),
315
+        'description' => __( 'Custom Field name', 'site-reviews' ).': <code>schema_image</code>',
316
+        'label' => __( 'Default Image', 'site-reviews' ),
317 317
         'options' => [
318
-            'post' => __('Use the featured image of the assigned or current page', 'site-reviews'),
319
-            'custom' => __('Enter a custom image URL', 'site-reviews'),
318
+            'post' => __( 'Use the featured image of the assigned or current page', 'site-reviews' ),
319
+            'custom' => __( 'Enter a custom image URL', 'site-reviews' ),
320 320
         ],
321 321
         'type' => 'select',
322 322
     ],
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
         'depends_on' => [
326 326
             'settings.schema.image.default' => 'custom',
327 327
         ],
328
-        'label' => __('Custom Image URL', 'site-reviews'),
328
+        'label' => __( 'Custom Image URL', 'site-reviews' ),
329 329
         'type' => 'text',
330 330
     ],
331 331
     'settings.schema.address' => [
@@ -333,8 +333,8 @@  discard block
 block discarded – undo
333 333
         'depends_on' => [
334 334
             'settings.schema.type.default' => 'LocalBusiness',
335 335
         ],
336
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_address</code>',
337
-        'label' => __('Address', 'site-reviews'),
336
+        'description' => __( 'Custom Field name', 'site-reviews' ).': <code>schema_address</code>',
337
+        'label' => __( 'Address', 'site-reviews' ),
338 338
         'placeholder' => '60 29th Street #343, San Francisco, CA 94110, US',
339 339
         'type' => 'text',
340 340
     ],
@@ -343,8 +343,8 @@  discard block
 block discarded – undo
343 343
         'depends_on' => [
344 344
             'settings.schema.type.default' => 'LocalBusiness',
345 345
         ],
346
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_telephone</code>',
347
-        'label' => __('Telephone Number', 'site-reviews'),
346
+        'description' => __( 'Custom Field name', 'site-reviews' ).': <code>schema_telephone</code>',
347
+        'label' => __( 'Telephone Number', 'site-reviews' ),
348 348
         'placeholder' => '+1 (877) 273-3049',
349 349
         'type' => 'text',
350 350
     ],
@@ -353,8 +353,8 @@  discard block
 block discarded – undo
353 353
         'depends_on' => [
354 354
             'settings.schema.type.default' => 'LocalBusiness',
355 355
         ],
356
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_pricerange</code>',
357
-        'label' => __('Price Range', 'site-reviews'),
356
+        'description' => __( 'Custom Field name', 'site-reviews' ).': <code>schema_pricerange</code>',
357
+        'label' => __( 'Price Range', 'site-reviews' ),
358 358
         'placeholder' => '$$-$$$',
359 359
         'type' => 'text',
360 360
     ],
@@ -363,11 +363,11 @@  discard block
 block discarded – undo
363 363
         'depends_on' => [
364 364
             'settings.schema.type.default' => 'Product',
365 365
         ],
366
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_offertype</code>',
367
-        'label' => __('Offer Type', 'site-reviews'),
366
+        'description' => __( 'Custom Field name', 'site-reviews' ).': <code>schema_offertype</code>',
367
+        'label' => __( 'Offer Type', 'site-reviews' ),
368 368
         'options' => [
369
-            'AggregateOffer' => __('AggregateOffer', 'site-reviews'),
370
-            'Offer' => __('Offer', 'site-reviews'),
369
+            'AggregateOffer' => __( 'AggregateOffer', 'site-reviews' ),
370
+            'Offer' => __( 'Offer', 'site-reviews' ),
371 371
         ],
372 372
         'type' => 'select',
373 373
     ],
@@ -377,8 +377,8 @@  discard block
 block discarded – undo
377 377
             'settings.schema.type.default' => 'Product',
378 378
             'settings.schema.offertype' => 'Offer',
379 379
         ],
380
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_price</code>',
381
-        'label' => __('Price', 'site-reviews'),
380
+        'description' => __( 'Custom Field name', 'site-reviews' ).': <code>schema_price</code>',
381
+        'label' => __( 'Price', 'site-reviews' ),
382 382
         'placeholder' => '50.00',
383 383
         'type' => 'text',
384 384
     ],
@@ -388,8 +388,8 @@  discard block
 block discarded – undo
388 388
             'settings.schema.type.default' => 'Product',
389 389
             'settings.schema.offertype' => 'AggregateOffer',
390 390
         ],
391
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_lowprice</code>',
392
-        'label' => __('Low Price', 'site-reviews'),
391
+        'description' => __( 'Custom Field name', 'site-reviews' ).': <code>schema_lowprice</code>',
392
+        'label' => __( 'Low Price', 'site-reviews' ),
393 393
         'placeholder' => '10.00',
394 394
         'type' => 'text',
395 395
     ],
@@ -399,8 +399,8 @@  discard block
 block discarded – undo
399 399
             'settings.schema.type.default' => 'Product',
400 400
             'settings.schema.offertype' => 'AggregateOffer',
401 401
         ],
402
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_highprice</code>',
403
-        'label' => __('High Price', 'site-reviews'),
402
+        'description' => __( 'Custom Field name', 'site-reviews' ).': <code>schema_highprice</code>',
403
+        'label' => __( 'High Price', 'site-reviews' ),
404 404
         'placeholder' => '100.00',
405 405
         'type' => 'text',
406 406
     ],
@@ -409,34 +409,34 @@  discard block
 block discarded – undo
409 409
         'depends_on' => [
410 410
             'settings.schema.type.default' => 'Product',
411 411
         ],
412
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_pricecurrency</code>',
413
-        'label' => __('Price Currency', 'site-reviews'),
412
+        'description' => __( 'Custom Field name', 'site-reviews' ).': <code>schema_pricecurrency</code>',
413
+        'label' => __( 'Price Currency', 'site-reviews' ),
414 414
         'placeholder' => 'USD',
415 415
         'type' => 'text',
416 416
     ],
417 417
     'settings.submissions.required' => [
418 418
         'default' => ['content', 'email', 'name', 'rating', 'terms', 'title'],
419
-        'description' => __('Choose which fields should be required in the submission form.', 'site-reviews'),
420
-        'label' => __('Required Fields', 'site-reviews'),
419
+        'description' => __( 'Choose which fields should be required in the submission form.', 'site-reviews' ),
420
+        'label' => __( 'Required Fields', 'site-reviews' ),
421 421
         'options' => [
422
-            'rating' => __('Rating', 'site-reviews'),
423
-            'title' => __('Title', 'site-reviews'),
424
-            'content' => __('Review', 'site-reviews'),
425
-            'name' => __('Name', 'site-reviews'),
426
-            'email' => __('Email', 'site-reviews'),
427
-            'terms' => __('Terms', 'site-reviews'),
422
+            'rating' => __( 'Rating', 'site-reviews' ),
423
+            'title' => __( 'Title', 'site-reviews' ),
424
+            'content' => __( 'Review', 'site-reviews' ),
425
+            'name' => __( 'Name', 'site-reviews' ),
426
+            'email' => __( 'Email', 'site-reviews' ),
427
+            'terms' => __( 'Terms', 'site-reviews' ),
428 428
         ],
429 429
         'type' => 'checkbox',
430 430
     ],
431 431
     'settings.submissions.limit' => [
432 432
         'default' => '',
433
-        'description' => __('Limits the number of reviews that can be submitted to one-per-person. If you are assigning reviews, then the limit will be applied to the assigned page or category.', 'site-reviews'),
434
-        'label' => __('Limit Reviews', 'site-reviews'),
433
+        'description' => __( 'Limits the number of reviews that can be submitted to one-per-person. If you are assigning reviews, then the limit will be applied to the assigned page or category.', 'site-reviews' ),
434
+        'label' => __( 'Limit Reviews', 'site-reviews' ),
435 435
         'options' => [
436
-            '' => __('No Limit', 'site-reviews'),
437
-            'email' => __('By Email Address', 'site-reviews'),
438
-            'ip_address' => __('By IP Address', 'site-reviews'),
439
-            'username' => __('By Username (will only work for registered users)', 'site-reviews'),
436
+            '' => __( 'No Limit', 'site-reviews' ),
437
+            'email' => __( 'By Email Address', 'site-reviews' ),
438
+            'ip_address' => __( 'By IP Address', 'site-reviews' ),
439
+            'username' => __( 'By Username (will only work for registered users)', 'site-reviews' ),
440 440
         ],
441 441
         'type' => 'select',
442 442
     ],
@@ -445,8 +445,8 @@  discard block
 block discarded – undo
445 445
         'depends_on' => [
446 446
             'settings.submissions.limit' => ['email'],
447 447
         ],
448
-        'description' => __('One Email per line. All emails in the whitelist will be excluded from the review submission limit.', 'site-reviews'),
449
-        'label' => __('Email Whitelist', 'site-reviews'),
448
+        'description' => __( 'One Email per line. All emails in the whitelist will be excluded from the review submission limit.', 'site-reviews' ),
449
+        'label' => __( 'Email Whitelist', 'site-reviews' ),
450 450
         'rows' => 5,
451 451
         'type' => 'code',
452 452
     ],
@@ -455,8 +455,8 @@  discard block
 block discarded – undo
455 455
         'depends_on' => [
456 456
             'settings.submissions.limit' => ['ip_address'],
457 457
         ],
458
-        'description' => __('One IP Address per line. All IP Addresses in the whitelist will be excluded from the review submission limit..', 'site-reviews'),
459
-        'label' => __('IP Address Whitelist', 'site-reviews'),
458
+        'description' => __( 'One IP Address per line. All IP Addresses in the whitelist will be excluded from the review submission limit..', 'site-reviews' ),
459
+        'label' => __( 'IP Address Whitelist', 'site-reviews' ),
460 460
         'rows' => 5,
461 461
         'type' => 'code',
462 462
     ],
@@ -465,15 +465,15 @@  discard block
 block discarded – undo
465 465
         'depends_on' => [
466 466
             'settings.submissions.limit' => ['username'],
467 467
         ],
468
-        'description' => __('One Username per line. All registered users with a Username in the whitelist will be excluded from the review submission limit.', 'site-reviews'),
469
-        'label' => __('Username Whitelist', 'site-reviews'),
468
+        'description' => __( 'One Username per line. All registered users with a Username in the whitelist will be excluded from the review submission limit.', 'site-reviews' ),
469
+        'label' => __( 'Username Whitelist', 'site-reviews' ),
470 470
         'rows' => 5,
471 471
         'type' => 'code',
472 472
     ],
473 473
     'settings.submissions.recaptcha.integration' => [
474 474
         'default' => '',
475
-        'description' => __('Invisible reCAPTCHA is a free anti-spam service from Google. To use it, you will need to <a href="https://www.google.com/recaptcha/admin" target="_blank">sign up</a> for an API key pair for your site.', 'site-reviews'),
476
-        'label' => __('Invisible reCAPTCHA', 'site-reviews'),
475
+        'description' => __( 'Invisible reCAPTCHA is a free anti-spam service from Google. To use it, you will need to <a href="https://www.google.com/recaptcha/admin" target="_blank">sign up</a> for an API key pair for your site.', 'site-reviews' ),
476
+        'label' => __( 'Invisible reCAPTCHA', 'site-reviews' ),
477 477
         'options' => [
478 478
             '' => 'Do not use reCAPTCHA',
479 479
             'all' => 'Use reCAPTCHA',
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
         'depends_on' => [
487 487
             'settings.submissions.recaptcha.integration' => ['all', 'guest'],
488 488
         ],
489
-        'label' => __('Site Key', 'site-reviews'),
489
+        'label' => __( 'Site Key', 'site-reviews' ),
490 490
         'type' => 'text',
491 491
     ],
492 492
     'settings.submissions.recaptcha.secret' => [
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
         'depends_on' => [
495 495
             'settings.submissions.recaptcha.integration' => ['all', 'guest'],
496 496
         ],
497
-        'label' => __('Site Secret', 'site-reviews'),
497
+        'label' => __( 'Site Secret', 'site-reviews' ),
498 498
         'type' => 'text',
499 499
     ],
500 500
     'settings.submissions.recaptcha.position' => [
@@ -502,8 +502,8 @@  discard block
 block discarded – undo
502 502
         'depends_on' => [
503 503
             'settings.submissions.recaptcha.integration' => ['all', 'guest'],
504 504
         ],
505
-        'description' => __('This option may not work consistently if another plugin is loading reCAPTCHA on the same page as Site Reviews.', 'site-reviews'),
506
-        'label' => __('Badge Position', 'site-reviews'),
505
+        'description' => __( 'This option may not work consistently if another plugin is loading reCAPTCHA on the same page as Site Reviews.', 'site-reviews' ),
506
+        'label' => __( 'Badge Position', 'site-reviews' ),
507 507
         'options' => [
508 508
             'bottomleft' => 'Bottom Left',
509 509
             'bottomright' => 'Bottom Right',
@@ -513,16 +513,16 @@  discard block
 block discarded – undo
513 513
     ],
514 514
     'settings.submissions.akismet' => [
515 515
         'default' => 'no',
516
-        'description' => __('The <a href="https://akismet.com" target="_blank">Akismet plugin</a> integration provides spam-filtering for your reviews. In order for this setting to have any affect, you will need to first install and activate the Akismet plugin and set up a WordPress.com API key.', 'site-reviews'),
517
-        'label' => __('Enable Akismet Integration', 'site-reviews'),
516
+        'description' => __( 'The <a href="https://akismet.com" target="_blank">Akismet plugin</a> integration provides spam-filtering for your reviews. In order for this setting to have any affect, you will need to first install and activate the Akismet plugin and set up a WordPress.com API key.', 'site-reviews' ),
517
+        'label' => __( 'Enable Akismet Integration', 'site-reviews' ),
518 518
         'type' => 'yes_no',
519 519
     ],
520 520
     'settings.submissions.blacklist.integration' => [
521 521
         'default' => '',
522
-        'description' => sprintf(__('Choose which Blacklist you would prefer to use for reviews. The %s can be found in the WordPress Discussion Settings page.', 'site-reviews'),
523
-            '<a href="'.admin_url('options-discussion.php#users_can_register').'">'.__('Comment Blacklist', 'site-reviews').'</a>'
522
+        'description' => sprintf( __( 'Choose which Blacklist you would prefer to use for reviews. The %s can be found in the WordPress Discussion Settings page.', 'site-reviews' ),
523
+            '<a href="'.admin_url( 'options-discussion.php#users_can_register' ).'">'.__( 'Comment Blacklist', 'site-reviews' ).'</a>'
524 524
         ),
525
-        'label' => __('Blacklist', 'site-reviews'),
525
+        'label' => __( 'Blacklist', 'site-reviews' ),
526 526
         'options' => [
527 527
             '' => 'Use the Site Reviews Blacklist',
528 528
             'comments' => 'Use the WordPress Comment Blacklist',
@@ -534,18 +534,18 @@  discard block
 block discarded – undo
534 534
         'depends_on' => [
535 535
             'settings.submissions.blacklist.integration' => [''],
536 536
         ],
537
-        'description' => __('One entry or IP address per line. When a review contains any of these entries in its title, content, name, email, or IP address, it will be rejected. It is case-insensitive and will match partial words, so "press" will match "WordPress".', 'site-reviews'),
538
-        'label' => __('Review Blacklist', 'site-reviews'),
537
+        'description' => __( 'One entry or IP address per line. When a review contains any of these entries in its title, content, name, email, or IP address, it will be rejected. It is case-insensitive and will match partial words, so "press" will match "WordPress".', 'site-reviews' ),
538
+        'label' => __( 'Review Blacklist', 'site-reviews' ),
539 539
         'rows' => 10,
540 540
         'type' => 'code',
541 541
     ],
542 542
     'settings.submissions.blacklist.action' => [
543 543
         'default' => 'unapprove',
544
-        'description' => __('Choose the action that should be taken when a review is blacklisted.', 'site-reviews'),
545
-        'label' => __('Blacklist Action', 'site-reviews'),
544
+        'description' => __( 'Choose the action that should be taken when a review is blacklisted.', 'site-reviews' ),
545
+        'label' => __( 'Blacklist Action', 'site-reviews' ),
546 546
         'options' => [
547
-            'unapprove' => __('Require approval', 'site-reviews'),
548
-            'reject' => __('Reject submission', 'site-reviews'),
547
+            'unapprove' => __( 'Require approval', 'site-reviews' ),
548
+            'reject' => __( 'Reject submission', 'site-reviews' ),
549 549
         ],
550 550
         'type' => 'select',
551 551
     ],
Please login to merge, or discard this patch.
views/pages/tools/sync.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,37 +1,37 @@  discard block
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3 3
 <form method="post" class="glsr-form-sync glsr-status">
4
-    <?php $selected = key($services); ?>
4
+    <?php $selected = key( $services ); ?>
5 5
     <table class="wp-list-table widefat fixed striped">
6 6
         <thead>
7 7
             <tr>
8 8
                 <td class="check-column glsr-radio-column"><span class="dashicons-before dashicons-update"></span></td>
9
-                <th scope="col" class="column-primary"><?= __('Service', 'site-reviews'); ?></th>
10
-                <th scope="col" class="column-total_fetched"><?= __('Reviews', 'site-reviews'); ?></th>
11
-                <th scope="col" class="column-last_sync"><?= __('Last Sync', 'site-reviews'); ?></th>
9
+                <th scope="col" class="column-primary"><?= __( 'Service', 'site-reviews' ); ?></th>
10
+                <th scope="col" class="column-total_fetched"><?= __( 'Reviews', 'site-reviews' ); ?></th>
11
+                <th scope="col" class="column-last_sync"><?= __( 'Last Sync', 'site-reviews' ); ?></th>
12 12
             </tr>
13 13
         </thead>
14 14
         <tbody>
15
-        <?php foreach ($services as $slug => $details) : ?>
15
+        <?php foreach( $services as $slug => $details ) : ?>
16 16
             <tr class="service-<?= $slug; ?>">
17 17
                 <th scope="row" class="check-column">
18
-                    <input type="radio" name="{{ id }}[service]" value="<?= $slug; ?>" <?php checked($slug, $selected); ?>>
18
+                    <input type="radio" name="{{ id }}[service]" value="<?= $slug; ?>" <?php checked( $slug, $selected ); ?>>
19 19
                 </th>
20 20
                 <td class="column-primary has-row-actions">
21 21
                     <strong><?= $details['name']; ?></strong>
22 22
                     <div class="row-actions">
23
-                        <span><a href="{{ base_url }}&page=settings#!addons"><?= __('Settings', 'site-reviews'); ?></a> | </span>
24
-                        <span><a href="{{ base_url }}&page=settings#!licenses"><?= __('License', 'site-reviews'); ?></a> | </span>
25
-                        <span><a href="{{ base_url }}&page=documentation#!addons"><?= __('Documentation', 'site-reviews'); ?></a></span>
23
+                        <span><a href="{{ base_url }}&page=settings#!addons"><?= __( 'Settings', 'site-reviews' ); ?></a> | </span>
24
+                        <span><a href="{{ base_url }}&page=settings#!licenses"><?= __( 'License', 'site-reviews' ); ?></a> | </span>
25
+                        <span><a href="{{ base_url }}&page=documentation#!addons"><?= __( 'Documentation', 'site-reviews' ); ?></a></span>
26 26
                     </div>
27 27
                     <button type="button" class="toggle-row">
28
-                        <span class="screen-reader-text"><?= __('Show more details', 'site-reviews'); ?></span>
28
+                        <span class="screen-reader-text"><?= __( 'Show more details', 'site-reviews' ); ?></span>
29 29
                     </button>
30 30
                 </td>
31
-                <td class="column-total_fetched" data-colname="<?= __('Reviews', 'site-reviews'); ?>">
31
+                <td class="column-total_fetched" data-colname="<?= __( 'Reviews', 'site-reviews' ); ?>">
32 32
                     <a href="<?= $details['reviews_url']; ?>"><?= $details['reviews_count']; ?></a>
33 33
                 </td>
34
-                <td class="column-last_sync" data-colname="<?= __('Last Sync', 'site-reviews'); ?>">
34
+                <td class="column-last_sync" data-colname="<?= __( 'Last Sync', 'site-reviews' ); ?>">
35 35
                     <?= $details['last_sync']; ?>
36 36
                 </td>
37 37
             </tr>
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
         <tfoot>
41 41
             <tr>
42 42
                 <td colspan="4" class="no-items" style="display:table-cell!important;">
43
-                    <div class="glsr-progress" data-active-text="<?= __('Please wait...', 'site-reviews'); ?>">
43
+                    <div class="glsr-progress" data-active-text="<?= __( 'Please wait...', 'site-reviews' ); ?>">
44 44
                         <div class="glsr-progress-bar" style="width: 0%;">
45
-                            <span class="glsr-progress-status"><?= __('Inactive', 'site-reviews'); ?></span>
45
+                            <span class="glsr-progress-status"><?= __( 'Inactive', 'site-reviews' ); ?></span>
46 46
                         </div>
47 47
                         <div class="glsr-progress-background">
48
-                            <span class="glsr-progress-status"><?= __('Inactive', 'site-reviews'); ?></span>
48
+                            <span class="glsr-progress-status"><?= __( 'Inactive', 'site-reviews' ); ?></span>
49 49
                         </div>
50 50
                     </div>
51 51
                 </td>
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     </table>
55 55
     <div class="tablenav bottom">
56 56
         <button type="submit" class="glsr-button button" id="sync-reviews">
57
-            <span data-loading="<?= __('Syncing...', 'site-reviews'); ?>"><?= __('Sync Reviews', 'site-reviews'); ?></span>
57
+            <span data-loading="<?= __( 'Syncing...', 'site-reviews' ); ?>"><?= __( 'Sync Reviews', 'site-reviews' ); ?></span>
58 58
         </button>
59 59
     </div>
60 60
 </form>
Please login to merge, or discard this patch.
plugin/Controllers/ListTableController.php 2 patches
Indentation   +325 added lines, -325 removed lines patch added patch discarded remove patch
@@ -14,348 +14,348 @@
 block discarded – undo
14 14
 
15 15
 class ListTableController extends Controller
16 16
 {
17
-    /**
18
-     * @return void
19
-     * @action admin_action_approve
20
-     */
21
-    public function approve()
22
-    {
23
-        if (Application::ID != filter_input(INPUT_GET, 'plugin')) {
24
-            return;
25
-        }
26
-        check_admin_referer('approve-review_'.($postId = $this->getPostId()));
27
-        wp_update_post([
28
-            'ID' => $postId,
29
-            'post_status' => 'publish',
30
-        ]);
31
-        wp_safe_redirect(wp_get_referer());
32
-        exit;
33
-    }
17
+	/**
18
+	 * @return void
19
+	 * @action admin_action_approve
20
+	 */
21
+	public function approve()
22
+	{
23
+		if (Application::ID != filter_input(INPUT_GET, 'plugin')) {
24
+			return;
25
+		}
26
+		check_admin_referer('approve-review_'.($postId = $this->getPostId()));
27
+		wp_update_post([
28
+			'ID' => $postId,
29
+			'post_status' => 'publish',
30
+		]);
31
+		wp_safe_redirect(wp_get_referer());
32
+		exit;
33
+	}
34 34
 
35
-    /**
36
-     * @param array $messages
37
-     * @return array
38
-     * @filter bulk_post_updated_messages
39
-     */
40
-    public function filterBulkUpdateMessages($messages, array $counts)
41
-    {
42
-        $messages = Arr::consolidateArray($messages);
43
-        $messages[Application::POST_TYPE] = [
44
-            'updated' => _n('%s review updated.', '%s reviews updated.', $counts['updated'], 'site-reviews'),
45
-            'locked' => _n('%s review not updated, somebody is editing it.', '%s reviews not updated, somebody is editing them.', $counts['locked'], 'site-reviews'),
46
-            'deleted' => _n('%s review permanently deleted.', '%s reviews permanently deleted.', $counts['deleted'], 'site-reviews'),
47
-            'trashed' => _n('%s review moved to the Trash.', '%s reviews moved to the Trash.', $counts['trashed'], 'site-reviews'),
48
-            'untrashed' => _n('%s review restored from the Trash.', '%s reviews restored from the Trash.', $counts['untrashed'], 'site-reviews'),
49
-        ];
50
-        return $messages;
51
-    }
35
+	/**
36
+	 * @param array $messages
37
+	 * @return array
38
+	 * @filter bulk_post_updated_messages
39
+	 */
40
+	public function filterBulkUpdateMessages($messages, array $counts)
41
+	{
42
+		$messages = Arr::consolidateArray($messages);
43
+		$messages[Application::POST_TYPE] = [
44
+			'updated' => _n('%s review updated.', '%s reviews updated.', $counts['updated'], 'site-reviews'),
45
+			'locked' => _n('%s review not updated, somebody is editing it.', '%s reviews not updated, somebody is editing them.', $counts['locked'], 'site-reviews'),
46
+			'deleted' => _n('%s review permanently deleted.', '%s reviews permanently deleted.', $counts['deleted'], 'site-reviews'),
47
+			'trashed' => _n('%s review moved to the Trash.', '%s reviews moved to the Trash.', $counts['trashed'], 'site-reviews'),
48
+			'untrashed' => _n('%s review restored from the Trash.', '%s reviews restored from the Trash.', $counts['untrashed'], 'site-reviews'),
49
+		];
50
+		return $messages;
51
+	}
52 52
 
53
-    /**
54
-     * @param array $columns
55
-     * @return array
56
-     * @filter manage_.Application::POST_TYPE._posts_columns
57
-     */
58
-    public function filterColumnsForPostType($columns)
59
-    {
60
-        $columns = Arr::consolidateArray($columns);
61
-        $postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
62
-        foreach ($postTypeColumns as $key => &$value) {
63
-            if (!array_key_exists($key, $columns) || !empty($value)) {
64
-                continue;
65
-            }
66
-            $value = $columns[$key];
67
-        }
68
-        if (count(glsr(Database::class)->getReviewsMeta('review_type')) < 2) {
69
-            unset($postTypeColumns['review_type']);
70
-        }
71
-        return array_filter($postTypeColumns, 'strlen');
72
-    }
53
+	/**
54
+	 * @param array $columns
55
+	 * @return array
56
+	 * @filter manage_.Application::POST_TYPE._posts_columns
57
+	 */
58
+	public function filterColumnsForPostType($columns)
59
+	{
60
+		$columns = Arr::consolidateArray($columns);
61
+		$postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
62
+		foreach ($postTypeColumns as $key => &$value) {
63
+			if (!array_key_exists($key, $columns) || !empty($value)) {
64
+				continue;
65
+			}
66
+			$value = $columns[$key];
67
+		}
68
+		if (count(glsr(Database::class)->getReviewsMeta('review_type')) < 2) {
69
+			unset($postTypeColumns['review_type']);
70
+		}
71
+		return array_filter($postTypeColumns, 'strlen');
72
+	}
73 73
 
74
-    /**
75
-     * @param string $status
76
-     * @param WP_Post $post
77
-     * @return string
78
-     * @filter post_date_column_status
79
-     */
80
-    public function filterDateColumnStatus($status, $post)
81
-    {
82
-        if (Application::POST_TYPE == Arr::get($post, 'post_type')) {
83
-            $status = __('Submitted', 'site-reviews');
84
-        }
85
-        return $status;
86
-    }
74
+	/**
75
+	 * @param string $status
76
+	 * @param WP_Post $post
77
+	 * @return string
78
+	 * @filter post_date_column_status
79
+	 */
80
+	public function filterDateColumnStatus($status, $post)
81
+	{
82
+		if (Application::POST_TYPE == Arr::get($post, 'post_type')) {
83
+			$status = __('Submitted', 'site-reviews');
84
+		}
85
+		return $status;
86
+	}
87 87
 
88
-    /**
89
-     * @param array $hidden
90
-     * @param WP_Screen $post
91
-     * @return array
92
-     * @filter default_hidden_columns
93
-     */
94
-    public function filterDefaultHiddenColumns($hidden, $screen)
95
-    {
96
-        if (Arr::get($screen, 'id') == 'edit-'.Application::POST_TYPE) {
97
-            $hidden = Arr::consolidateArray($hidden);
98
-            $hidden = array_unique(array_merge($hidden, [
99
-                'email', 'ip_address', 'response', 'reviewer',
100
-            ]));
101
-        }
102
-        return $hidden;
103
-    }
88
+	/**
89
+	 * @param array $hidden
90
+	 * @param WP_Screen $post
91
+	 * @return array
92
+	 * @filter default_hidden_columns
93
+	 */
94
+	public function filterDefaultHiddenColumns($hidden, $screen)
95
+	{
96
+		if (Arr::get($screen, 'id') == 'edit-'.Application::POST_TYPE) {
97
+			$hidden = Arr::consolidateArray($hidden);
98
+			$hidden = array_unique(array_merge($hidden, [
99
+				'email', 'ip_address', 'response', 'reviewer',
100
+			]));
101
+		}
102
+		return $hidden;
103
+	}
104 104
 
105
-    /**
106
-     * @param array $postStates
107
-     * @param WP_Post $post
108
-     * @return array
109
-     * @filter display_post_states
110
-     */
111
-    public function filterPostStates($postStates, $post)
112
-    {
113
-        $postStates = Arr::consolidateArray($postStates);
114
-        if (Application::POST_TYPE == Arr::get($post, 'post_type') && array_key_exists('pending', $postStates)) {
115
-            $postStates['pending'] = __('Unapproved', 'site-reviews');
116
-        }
117
-        return $postStates;
118
-    }
105
+	/**
106
+	 * @param array $postStates
107
+	 * @param WP_Post $post
108
+	 * @return array
109
+	 * @filter display_post_states
110
+	 */
111
+	public function filterPostStates($postStates, $post)
112
+	{
113
+		$postStates = Arr::consolidateArray($postStates);
114
+		if (Application::POST_TYPE == Arr::get($post, 'post_type') && array_key_exists('pending', $postStates)) {
115
+			$postStates['pending'] = __('Unapproved', 'site-reviews');
116
+		}
117
+		return $postStates;
118
+	}
119 119
 
120
-    /**
121
-     * @param array $actions
122
-     * @param WP_Post $post
123
-     * @return array
124
-     * @filter post_row_actions
125
-     */
126
-    public function filterRowActions($actions, $post)
127
-    {
128
-        if (Application::POST_TYPE != Arr::get($post, 'post_type') || 'trash' == $post->post_status) {
129
-            return $actions;
130
-        }
131
-        unset($actions['inline hide-if-no-js']); //Remove Quick-edit
132
-        $rowActions = [
133
-            'approve' => esc_attr__('Approve', 'site-reviews'),
134
-            'unapprove' => esc_attr__('Unapprove', 'site-reviews'),
135
-        ];
136
-        $newActions = [];
137
-        foreach ($rowActions as $key => $text) {
138
-            $newActions[$key] = glsr(Builder::class)->a($text, [
139
-                'aria-label' => sprintf(esc_attr_x('%s this review', 'Approve the review', 'site-reviews'), $text),
140
-                'class' => 'glsr-change-status',
141
-                'href' => wp_nonce_url(
142
-                    admin_url('post.php?post='.$post->ID.'&action='.$key.'&plugin='.Application::ID),
143
-                    $key.'-review_'.$post->ID
144
-                ),
145
-            ]);
146
-        }
147
-        return $newActions + Arr::consolidateArray($actions);
148
-    }
120
+	/**
121
+	 * @param array $actions
122
+	 * @param WP_Post $post
123
+	 * @return array
124
+	 * @filter post_row_actions
125
+	 */
126
+	public function filterRowActions($actions, $post)
127
+	{
128
+		if (Application::POST_TYPE != Arr::get($post, 'post_type') || 'trash' == $post->post_status) {
129
+			return $actions;
130
+		}
131
+		unset($actions['inline hide-if-no-js']); //Remove Quick-edit
132
+		$rowActions = [
133
+			'approve' => esc_attr__('Approve', 'site-reviews'),
134
+			'unapprove' => esc_attr__('Unapprove', 'site-reviews'),
135
+		];
136
+		$newActions = [];
137
+		foreach ($rowActions as $key => $text) {
138
+			$newActions[$key] = glsr(Builder::class)->a($text, [
139
+				'aria-label' => sprintf(esc_attr_x('%s this review', 'Approve the review', 'site-reviews'), $text),
140
+				'class' => 'glsr-change-status',
141
+				'href' => wp_nonce_url(
142
+					admin_url('post.php?post='.$post->ID.'&action='.$key.'&plugin='.Application::ID),
143
+					$key.'-review_'.$post->ID
144
+				),
145
+			]);
146
+		}
147
+		return $newActions + Arr::consolidateArray($actions);
148
+	}
149 149
 
150
-    /**
151
-     * @param array $columns
152
-     * @return array
153
-     * @filter manage_edit-.Application::POST_TYPE._sortable_columns
154
-     */
155
-    public function filterSortableColumns($columns)
156
-    {
157
-        $columns = Arr::consolidateArray($columns);
158
-        $postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
159
-        unset($postTypeColumns['cb']);
160
-        foreach ($postTypeColumns as $key => $value) {
161
-            if (Str::startsWith('taxonomy', $key)) {
162
-                continue;
163
-            }
164
-            $columns[$key] = $key;
165
-        }
166
-        return $columns;
167
-    }
150
+	/**
151
+	 * @param array $columns
152
+	 * @return array
153
+	 * @filter manage_edit-.Application::POST_TYPE._sortable_columns
154
+	 */
155
+	public function filterSortableColumns($columns)
156
+	{
157
+		$columns = Arr::consolidateArray($columns);
158
+		$postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
159
+		unset($postTypeColumns['cb']);
160
+		foreach ($postTypeColumns as $key => $value) {
161
+			if (Str::startsWith('taxonomy', $key)) {
162
+				continue;
163
+			}
164
+			$columns[$key] = $key;
165
+		}
166
+		return $columns;
167
+	}
168 168
 
169
-    /**
170
-     * Customize the post_type status text.
171
-     * @param string $translation
172
-     * @param string $single
173
-     * @param string $plural
174
-     * @param int $number
175
-     * @param string $domain
176
-     * @return string
177
-     * @filter ngettext
178
-     */
179
-    public function filterStatusText($translation, $single, $plural, $number, $domain)
180
-    {
181
-        if ($this->canModifyTranslation($domain)) {
182
-            $strings = [
183
-                'Published' => __('Approved', 'site-reviews'),
184
-                'Pending' => __('Unapproved', 'site-reviews'),
185
-            ];
186
-            foreach ($strings as $search => $replace) {
187
-                if (false === strpos($single, $search)) {
188
-                    continue;
189
-                }
190
-                $translation = $this->getTranslation([
191
-                    'number' => $number,
192
-                    'plural' => str_replace($search, $replace, $plural),
193
-                    'single' => str_replace($search, $replace, $single),
194
-                ]);
195
-            }
196
-        }
197
-        return $translation;
198
-    }
169
+	/**
170
+	 * Customize the post_type status text.
171
+	 * @param string $translation
172
+	 * @param string $single
173
+	 * @param string $plural
174
+	 * @param int $number
175
+	 * @param string $domain
176
+	 * @return string
177
+	 * @filter ngettext
178
+	 */
179
+	public function filterStatusText($translation, $single, $plural, $number, $domain)
180
+	{
181
+		if ($this->canModifyTranslation($domain)) {
182
+			$strings = [
183
+				'Published' => __('Approved', 'site-reviews'),
184
+				'Pending' => __('Unapproved', 'site-reviews'),
185
+			];
186
+			foreach ($strings as $search => $replace) {
187
+				if (false === strpos($single, $search)) {
188
+					continue;
189
+				}
190
+				$translation = $this->getTranslation([
191
+					'number' => $number,
192
+					'plural' => str_replace($search, $replace, $plural),
193
+					'single' => str_replace($search, $replace, $single),
194
+				]);
195
+			}
196
+		}
197
+		return $translation;
198
+	}
199 199
 
200
-    /**
201
-     * @param string $columnName
202
-     * @param string $postType
203
-     * @return void
204
-     * @action bulk_edit_custom_box
205
-     */
206
-    public function renderBulkEditFields($columnName, $postType)
207
-    {
208
-        if ('assigned_to' == $columnName && Application::POST_TYPE == $postType) {
209
-            glsr()->render('partials/editor/bulk-edit-assigned-to');
210
-        }
211
-    }
200
+	/**
201
+	 * @param string $columnName
202
+	 * @param string $postType
203
+	 * @return void
204
+	 * @action bulk_edit_custom_box
205
+	 */
206
+	public function renderBulkEditFields($columnName, $postType)
207
+	{
208
+		if ('assigned_to' == $columnName && Application::POST_TYPE == $postType) {
209
+			glsr()->render('partials/editor/bulk-edit-assigned-to');
210
+		}
211
+	}
212 212
 
213
-    /**
214
-     * @param string $postType
215
-     * @return void
216
-     * @action restrict_manage_posts
217
-     */
218
-    public function renderColumnFilters($postType)
219
-    {
220
-        glsr(Columns::class)->renderFilters($postType);
221
-    }
213
+	/**
214
+	 * @param string $postType
215
+	 * @return void
216
+	 * @action restrict_manage_posts
217
+	 */
218
+	public function renderColumnFilters($postType)
219
+	{
220
+		glsr(Columns::class)->renderFilters($postType);
221
+	}
222 222
 
223
-    /**
224
-     * @param string $column
225
-     * @param string $postId
226
-     * @return void
227
-     * @action manage_posts_custom_column
228
-     */
229
-    public function renderColumnValues($column, $postId)
230
-    {
231
-        glsr(Columns::class)->renderValues($column, $postId);
232
-    }
223
+	/**
224
+	 * @param string $column
225
+	 * @param string $postId
226
+	 * @return void
227
+	 * @action manage_posts_custom_column
228
+	 */
229
+	public function renderColumnValues($column, $postId)
230
+	{
231
+		glsr(Columns::class)->renderValues($column, $postId);
232
+	}
233 233
 
234
-    /**
235
-     * @param int $postId
236
-     * @return void
237
-     * @action save_post_.Application::POST_TYPE
238
-     */
239
-    public function saveBulkEditFields($postId)
240
-    {
241
-        if (!current_user_can('edit_posts')) {
242
-            return;
243
-        }
244
-        $assignedTo = filter_input(INPUT_GET, 'assigned_to');
245
-        if ($assignedTo && get_post($assignedTo)) {
246
-            glsr(Database::class)->update($postId, 'assigned_to', $assignedTo);
247
-        }
248
-    }
234
+	/**
235
+	 * @param int $postId
236
+	 * @return void
237
+	 * @action save_post_.Application::POST_TYPE
238
+	 */
239
+	public function saveBulkEditFields($postId)
240
+	{
241
+		if (!current_user_can('edit_posts')) {
242
+			return;
243
+		}
244
+		$assignedTo = filter_input(INPUT_GET, 'assigned_to');
245
+		if ($assignedTo && get_post($assignedTo)) {
246
+			glsr(Database::class)->update($postId, 'assigned_to', $assignedTo);
247
+		}
248
+	}
249 249
 
250
-    /**
251
-     * @return void
252
-     * @action pre_get_posts
253
-     */
254
-    public function setQueryForColumn(WP_Query $query)
255
-    {
256
-        if (!$this->hasPermission($query)) {
257
-            return;
258
-        }
259
-        $this->setMetaQuery($query, [
260
-            'rating', 'review_type',
261
-        ]);
262
-        $this->setOrderby($query);
263
-    }
250
+	/**
251
+	 * @return void
252
+	 * @action pre_get_posts
253
+	 */
254
+	public function setQueryForColumn(WP_Query $query)
255
+	{
256
+		if (!$this->hasPermission($query)) {
257
+			return;
258
+		}
259
+		$this->setMetaQuery($query, [
260
+			'rating', 'review_type',
261
+		]);
262
+		$this->setOrderby($query);
263
+	}
264 264
 
265
-    /**
266
-     * @return void
267
-     * @action admin_action_unapprove
268
-     */
269
-    public function unapprove()
270
-    {
271
-        if (Application::ID != filter_input(INPUT_GET, 'plugin')) {
272
-            return;
273
-        }
274
-        check_admin_referer('unapprove-review_'.($postId = $this->getPostId()));
275
-        wp_update_post([
276
-            'ID' => $postId,
277
-            'post_status' => 'pending',
278
-        ]);
279
-        wp_safe_redirect(wp_get_referer());
280
-        exit;
281
-    }
265
+	/**
266
+	 * @return void
267
+	 * @action admin_action_unapprove
268
+	 */
269
+	public function unapprove()
270
+	{
271
+		if (Application::ID != filter_input(INPUT_GET, 'plugin')) {
272
+			return;
273
+		}
274
+		check_admin_referer('unapprove-review_'.($postId = $this->getPostId()));
275
+		wp_update_post([
276
+			'ID' => $postId,
277
+			'post_status' => 'pending',
278
+		]);
279
+		wp_safe_redirect(wp_get_referer());
280
+		exit;
281
+	}
282 282
 
283
-    /**
284
-     * Check if the translation string can be modified.
285
-     * @param string $domain
286
-     * @return bool
287
-     */
288
-    protected function canModifyTranslation($domain = 'default')
289
-    {
290
-        $screen = glsr_current_screen();
291
-        return 'default' == $domain
292
-            && 'edit' == $screen->base
293
-            && Application::POST_TYPE == $screen->post_type;
294
-    }
283
+	/**
284
+	 * Check if the translation string can be modified.
285
+	 * @param string $domain
286
+	 * @return bool
287
+	 */
288
+	protected function canModifyTranslation($domain = 'default')
289
+	{
290
+		$screen = glsr_current_screen();
291
+		return 'default' == $domain
292
+			&& 'edit' == $screen->base
293
+			&& Application::POST_TYPE == $screen->post_type;
294
+	}
295 295
 
296
-    /**
297
-     * Get the modified translation string.
298
-     * @return string
299
-     */
300
-    protected function getTranslation(array $args)
301
-    {
302
-        $defaults = [
303
-            'number' => 0,
304
-            'plural' => '',
305
-            'single' => '',
306
-            'text' => '',
307
-        ];
308
-        $args = (object) wp_parse_args($args, $defaults);
309
-        $translations = get_translations_for_domain(Application::ID);
310
-        return $args->text
311
-            ? $translations->translate($args->text)
312
-            : $translations->translate_plural($args->single, $args->plural, $args->number);
313
-    }
296
+	/**
297
+	 * Get the modified translation string.
298
+	 * @return string
299
+	 */
300
+	protected function getTranslation(array $args)
301
+	{
302
+		$defaults = [
303
+			'number' => 0,
304
+			'plural' => '',
305
+			'single' => '',
306
+			'text' => '',
307
+		];
308
+		$args = (object) wp_parse_args($args, $defaults);
309
+		$translations = get_translations_for_domain(Application::ID);
310
+		return $args->text
311
+			? $translations->translate($args->text)
312
+			: $translations->translate_plural($args->single, $args->plural, $args->number);
313
+	}
314 314
 
315
-    /**
316
-     * @return bool
317
-     */
318
-    protected function hasPermission(WP_Query $query)
319
-    {
320
-        global $pagenow;
321
-        return is_admin()
322
-            && $query->is_main_query()
323
-            && Application::POST_TYPE == $query->get('post_type')
324
-            && 'edit.php' == $pagenow;
325
-    }
315
+	/**
316
+	 * @return bool
317
+	 */
318
+	protected function hasPermission(WP_Query $query)
319
+	{
320
+		global $pagenow;
321
+		return is_admin()
322
+			&& $query->is_main_query()
323
+			&& Application::POST_TYPE == $query->get('post_type')
324
+			&& 'edit.php' == $pagenow;
325
+	}
326 326
 
327
-    /**
328
-     * @return void
329
-     */
330
-    protected function setMetaQuery(WP_Query $query, array $metaKeys)
331
-    {
332
-        foreach ($metaKeys as $key) {
333
-            if (!($value = filter_input(INPUT_GET, $key))) {
334
-                continue;
335
-            }
336
-            $metaQuery = (array) $query->get('meta_query');
337
-            $metaQuery[] = [
338
-                'key' => Str::prefix('_', $key, '_'),
339
-                'value' => $value,
340
-            ];
341
-            $query->set('meta_query', $metaQuery);
342
-        }
343
-    }
327
+	/**
328
+	 * @return void
329
+	 */
330
+	protected function setMetaQuery(WP_Query $query, array $metaKeys)
331
+	{
332
+		foreach ($metaKeys as $key) {
333
+			if (!($value = filter_input(INPUT_GET, $key))) {
334
+				continue;
335
+			}
336
+			$metaQuery = (array) $query->get('meta_query');
337
+			$metaQuery[] = [
338
+				'key' => Str::prefix('_', $key, '_'),
339
+				'value' => $value,
340
+			];
341
+			$query->set('meta_query', $metaQuery);
342
+		}
343
+	}
344 344
 
345
-    /**
346
-     * @return void
347
-     */
348
-    protected function setOrderby(WP_Query $query)
349
-    {
350
-        $orderby = $query->get('orderby');
351
-        $columns = glsr()->postTypeColumns[Application::POST_TYPE];
352
-        unset($columns['cb'], $columns['title'], $columns['date']);
353
-        if (in_array($orderby, array_keys($columns))) {
354
-            if ('reviewer' == $orderby) {
355
-                $orderby = 'author';
356
-            }
357
-            $query->set('meta_key', Str::prefix('_', $orderby, '_'));
358
-            $query->set('orderby', 'meta_value');
359
-        }
360
-    }
345
+	/**
346
+	 * @return void
347
+	 */
348
+	protected function setOrderby(WP_Query $query)
349
+	{
350
+		$orderby = $query->get('orderby');
351
+		$columns = glsr()->postTypeColumns[Application::POST_TYPE];
352
+		unset($columns['cb'], $columns['title'], $columns['date']);
353
+		if (in_array($orderby, array_keys($columns))) {
354
+			if ('reviewer' == $orderby) {
355
+				$orderby = 'author';
356
+			}
357
+			$query->set('meta_key', Str::prefix('_', $orderby, '_'));
358
+			$query->set('orderby', 'meta_value');
359
+		}
360
+	}
361 361
 }
Please login to merge, or discard this patch.
Spacing   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -20,15 +20,15 @@  discard block
 block discarded – undo
20 20
      */
21 21
     public function approve()
22 22
     {
23
-        if (Application::ID != filter_input(INPUT_GET, 'plugin')) {
23
+        if( Application::ID != filter_input( INPUT_GET, 'plugin' ) ) {
24 24
             return;
25 25
         }
26
-        check_admin_referer('approve-review_'.($postId = $this->getPostId()));
27
-        wp_update_post([
26
+        check_admin_referer( 'approve-review_'.($postId = $this->getPostId()) );
27
+        wp_update_post( [
28 28
             'ID' => $postId,
29 29
             'post_status' => 'publish',
30
-        ]);
31
-        wp_safe_redirect(wp_get_referer());
30
+        ] );
31
+        wp_safe_redirect( wp_get_referer() );
32 32
         exit;
33 33
     }
34 34
 
@@ -37,15 +37,15 @@  discard block
 block discarded – undo
37 37
      * @return array
38 38
      * @filter bulk_post_updated_messages
39 39
      */
40
-    public function filterBulkUpdateMessages($messages, array $counts)
40
+    public function filterBulkUpdateMessages( $messages, array $counts )
41 41
     {
42
-        $messages = Arr::consolidateArray($messages);
42
+        $messages = Arr::consolidateArray( $messages );
43 43
         $messages[Application::POST_TYPE] = [
44
-            'updated' => _n('%s review updated.', '%s reviews updated.', $counts['updated'], 'site-reviews'),
45
-            'locked' => _n('%s review not updated, somebody is editing it.', '%s reviews not updated, somebody is editing them.', $counts['locked'], 'site-reviews'),
46
-            'deleted' => _n('%s review permanently deleted.', '%s reviews permanently deleted.', $counts['deleted'], 'site-reviews'),
47
-            'trashed' => _n('%s review moved to the Trash.', '%s reviews moved to the Trash.', $counts['trashed'], 'site-reviews'),
48
-            'untrashed' => _n('%s review restored from the Trash.', '%s reviews restored from the Trash.', $counts['untrashed'], 'site-reviews'),
44
+            'updated' => _n( '%s review updated.', '%s reviews updated.', $counts['updated'], 'site-reviews' ),
45
+            'locked' => _n( '%s review not updated, somebody is editing it.', '%s reviews not updated, somebody is editing them.', $counts['locked'], 'site-reviews' ),
46
+            'deleted' => _n( '%s review permanently deleted.', '%s reviews permanently deleted.', $counts['deleted'], 'site-reviews' ),
47
+            'trashed' => _n( '%s review moved to the Trash.', '%s reviews moved to the Trash.', $counts['trashed'], 'site-reviews' ),
48
+            'untrashed' => _n( '%s review restored from the Trash.', '%s reviews restored from the Trash.', $counts['untrashed'], 'site-reviews' ),
49 49
         ];
50 50
         return $messages;
51 51
     }
@@ -55,20 +55,20 @@  discard block
 block discarded – undo
55 55
      * @return array
56 56
      * @filter manage_.Application::POST_TYPE._posts_columns
57 57
      */
58
-    public function filterColumnsForPostType($columns)
58
+    public function filterColumnsForPostType( $columns )
59 59
     {
60
-        $columns = Arr::consolidateArray($columns);
60
+        $columns = Arr::consolidateArray( $columns );
61 61
         $postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
62
-        foreach ($postTypeColumns as $key => &$value) {
63
-            if (!array_key_exists($key, $columns) || !empty($value)) {
62
+        foreach( $postTypeColumns as $key => &$value ) {
63
+            if( !array_key_exists( $key, $columns ) || !empty($value) ) {
64 64
                 continue;
65 65
             }
66 66
             $value = $columns[$key];
67 67
         }
68
-        if (count(glsr(Database::class)->getReviewsMeta('review_type')) < 2) {
68
+        if( count( glsr( Database::class )->getReviewsMeta( 'review_type' ) ) < 2 ) {
69 69
             unset($postTypeColumns['review_type']);
70 70
         }
71
-        return array_filter($postTypeColumns, 'strlen');
71
+        return array_filter( $postTypeColumns, 'strlen' );
72 72
     }
73 73
 
74 74
     /**
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
      * @return string
78 78
      * @filter post_date_column_status
79 79
      */
80
-    public function filterDateColumnStatus($status, $post)
80
+    public function filterDateColumnStatus( $status, $post )
81 81
     {
82
-        if (Application::POST_TYPE == Arr::get($post, 'post_type')) {
83
-            $status = __('Submitted', 'site-reviews');
82
+        if( Application::POST_TYPE == Arr::get( $post, 'post_type' ) ) {
83
+            $status = __( 'Submitted', 'site-reviews' );
84 84
         }
85 85
         return $status;
86 86
     }
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
      * @return array
92 92
      * @filter default_hidden_columns
93 93
      */
94
-    public function filterDefaultHiddenColumns($hidden, $screen)
94
+    public function filterDefaultHiddenColumns( $hidden, $screen )
95 95
     {
96
-        if (Arr::get($screen, 'id') == 'edit-'.Application::POST_TYPE) {
97
-            $hidden = Arr::consolidateArray($hidden);
98
-            $hidden = array_unique(array_merge($hidden, [
96
+        if( Arr::get( $screen, 'id' ) == 'edit-'.Application::POST_TYPE ) {
97
+            $hidden = Arr::consolidateArray( $hidden );
98
+            $hidden = array_unique( array_merge( $hidden, [
99 99
                 'email', 'ip_address', 'response', 'reviewer',
100
-            ]));
100
+            ] ) );
101 101
         }
102 102
         return $hidden;
103 103
     }
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
      * @return array
109 109
      * @filter display_post_states
110 110
      */
111
-    public function filterPostStates($postStates, $post)
111
+    public function filterPostStates( $postStates, $post )
112 112
     {
113
-        $postStates = Arr::consolidateArray($postStates);
114
-        if (Application::POST_TYPE == Arr::get($post, 'post_type') && array_key_exists('pending', $postStates)) {
115
-            $postStates['pending'] = __('Unapproved', 'site-reviews');
113
+        $postStates = Arr::consolidateArray( $postStates );
114
+        if( Application::POST_TYPE == Arr::get( $post, 'post_type' ) && array_key_exists( 'pending', $postStates ) ) {
115
+            $postStates['pending'] = __( 'Unapproved', 'site-reviews' );
116 116
         }
117 117
         return $postStates;
118 118
     }
@@ -123,28 +123,28 @@  discard block
 block discarded – undo
123 123
      * @return array
124 124
      * @filter post_row_actions
125 125
      */
126
-    public function filterRowActions($actions, $post)
126
+    public function filterRowActions( $actions, $post )
127 127
     {
128
-        if (Application::POST_TYPE != Arr::get($post, 'post_type') || 'trash' == $post->post_status) {
128
+        if( Application::POST_TYPE != Arr::get( $post, 'post_type' ) || 'trash' == $post->post_status ) {
129 129
             return $actions;
130 130
         }
131 131
         unset($actions['inline hide-if-no-js']); //Remove Quick-edit
132 132
         $rowActions = [
133
-            'approve' => esc_attr__('Approve', 'site-reviews'),
134
-            'unapprove' => esc_attr__('Unapprove', 'site-reviews'),
133
+            'approve' => esc_attr__( 'Approve', 'site-reviews' ),
134
+            'unapprove' => esc_attr__( 'Unapprove', 'site-reviews' ),
135 135
         ];
136 136
         $newActions = [];
137
-        foreach ($rowActions as $key => $text) {
138
-            $newActions[$key] = glsr(Builder::class)->a($text, [
139
-                'aria-label' => sprintf(esc_attr_x('%s this review', 'Approve the review', 'site-reviews'), $text),
137
+        foreach( $rowActions as $key => $text ) {
138
+            $newActions[$key] = glsr( Builder::class )->a( $text, [
139
+                'aria-label' => sprintf( esc_attr_x( '%s this review', 'Approve the review', 'site-reviews' ), $text ),
140 140
                 'class' => 'glsr-change-status',
141 141
                 'href' => wp_nonce_url(
142
-                    admin_url('post.php?post='.$post->ID.'&action='.$key.'&plugin='.Application::ID),
142
+                    admin_url( 'post.php?post='.$post->ID.'&action='.$key.'&plugin='.Application::ID ),
143 143
                     $key.'-review_'.$post->ID
144 144
                 ),
145
-            ]);
145
+            ] );
146 146
         }
147
-        return $newActions + Arr::consolidateArray($actions);
147
+        return $newActions + Arr::consolidateArray( $actions );
148 148
     }
149 149
 
150 150
     /**
@@ -152,13 +152,13 @@  discard block
 block discarded – undo
152 152
      * @return array
153 153
      * @filter manage_edit-.Application::POST_TYPE._sortable_columns
154 154
      */
155
-    public function filterSortableColumns($columns)
155
+    public function filterSortableColumns( $columns )
156 156
     {
157
-        $columns = Arr::consolidateArray($columns);
157
+        $columns = Arr::consolidateArray( $columns );
158 158
         $postTypeColumns = glsr()->postTypeColumns[Application::POST_TYPE];
159 159
         unset($postTypeColumns['cb']);
160
-        foreach ($postTypeColumns as $key => $value) {
161
-            if (Str::startsWith('taxonomy', $key)) {
160
+        foreach( $postTypeColumns as $key => $value ) {
161
+            if( Str::startsWith( 'taxonomy', $key ) ) {
162 162
                 continue;
163 163
             }
164 164
             $columns[$key] = $key;
@@ -176,22 +176,22 @@  discard block
 block discarded – undo
176 176
      * @return string
177 177
      * @filter ngettext
178 178
      */
179
-    public function filterStatusText($translation, $single, $plural, $number, $domain)
179
+    public function filterStatusText( $translation, $single, $plural, $number, $domain )
180 180
     {
181
-        if ($this->canModifyTranslation($domain)) {
181
+        if( $this->canModifyTranslation( $domain ) ) {
182 182
             $strings = [
183
-                'Published' => __('Approved', 'site-reviews'),
184
-                'Pending' => __('Unapproved', 'site-reviews'),
183
+                'Published' => __( 'Approved', 'site-reviews' ),
184
+                'Pending' => __( 'Unapproved', 'site-reviews' ),
185 185
             ];
186
-            foreach ($strings as $search => $replace) {
187
-                if (false === strpos($single, $search)) {
186
+            foreach( $strings as $search => $replace ) {
187
+                if( false === strpos( $single, $search ) ) {
188 188
                     continue;
189 189
                 }
190
-                $translation = $this->getTranslation([
190
+                $translation = $this->getTranslation( [
191 191
                     'number' => $number,
192
-                    'plural' => str_replace($search, $replace, $plural),
193
-                    'single' => str_replace($search, $replace, $single),
194
-                ]);
192
+                    'plural' => str_replace( $search, $replace, $plural ),
193
+                    'single' => str_replace( $search, $replace, $single ),
194
+                ] );
195 195
             }
196 196
         }
197 197
         return $translation;
@@ -203,10 +203,10 @@  discard block
 block discarded – undo
203 203
      * @return void
204 204
      * @action bulk_edit_custom_box
205 205
      */
206
-    public function renderBulkEditFields($columnName, $postType)
206
+    public function renderBulkEditFields( $columnName, $postType )
207 207
     {
208
-        if ('assigned_to' == $columnName && Application::POST_TYPE == $postType) {
209
-            glsr()->render('partials/editor/bulk-edit-assigned-to');
208
+        if( 'assigned_to' == $columnName && Application::POST_TYPE == $postType ) {
209
+            glsr()->render( 'partials/editor/bulk-edit-assigned-to' );
210 210
         }
211 211
     }
212 212
 
@@ -215,9 +215,9 @@  discard block
 block discarded – undo
215 215
      * @return void
216 216
      * @action restrict_manage_posts
217 217
      */
218
-    public function renderColumnFilters($postType)
218
+    public function renderColumnFilters( $postType )
219 219
     {
220
-        glsr(Columns::class)->renderFilters($postType);
220
+        glsr( Columns::class )->renderFilters( $postType );
221 221
     }
222 222
 
223 223
     /**
@@ -226,9 +226,9 @@  discard block
 block discarded – undo
226 226
      * @return void
227 227
      * @action manage_posts_custom_column
228 228
      */
229
-    public function renderColumnValues($column, $postId)
229
+    public function renderColumnValues( $column, $postId )
230 230
     {
231
-        glsr(Columns::class)->renderValues($column, $postId);
231
+        glsr( Columns::class )->renderValues( $column, $postId );
232 232
     }
233 233
 
234 234
     /**
@@ -236,14 +236,14 @@  discard block
 block discarded – undo
236 236
      * @return void
237 237
      * @action save_post_.Application::POST_TYPE
238 238
      */
239
-    public function saveBulkEditFields($postId)
239
+    public function saveBulkEditFields( $postId )
240 240
     {
241
-        if (!current_user_can('edit_posts')) {
241
+        if( !current_user_can( 'edit_posts' ) ) {
242 242
             return;
243 243
         }
244
-        $assignedTo = filter_input(INPUT_GET, 'assigned_to');
245
-        if ($assignedTo && get_post($assignedTo)) {
246
-            glsr(Database::class)->update($postId, 'assigned_to', $assignedTo);
244
+        $assignedTo = filter_input( INPUT_GET, 'assigned_to' );
245
+        if( $assignedTo && get_post( $assignedTo ) ) {
246
+            glsr( Database::class )->update( $postId, 'assigned_to', $assignedTo );
247 247
         }
248 248
     }
249 249
 
@@ -251,15 +251,15 @@  discard block
 block discarded – undo
251 251
      * @return void
252 252
      * @action pre_get_posts
253 253
      */
254
-    public function setQueryForColumn(WP_Query $query)
254
+    public function setQueryForColumn( WP_Query $query )
255 255
     {
256
-        if (!$this->hasPermission($query)) {
256
+        if( !$this->hasPermission( $query ) ) {
257 257
             return;
258 258
         }
259
-        $this->setMetaQuery($query, [
259
+        $this->setMetaQuery( $query, [
260 260
             'rating', 'review_type',
261
-        ]);
262
-        $this->setOrderby($query);
261
+        ] );
262
+        $this->setOrderby( $query );
263 263
     }
264 264
 
265 265
     /**
@@ -268,15 +268,15 @@  discard block
 block discarded – undo
268 268
      */
269 269
     public function unapprove()
270 270
     {
271
-        if (Application::ID != filter_input(INPUT_GET, 'plugin')) {
271
+        if( Application::ID != filter_input( INPUT_GET, 'plugin' ) ) {
272 272
             return;
273 273
         }
274
-        check_admin_referer('unapprove-review_'.($postId = $this->getPostId()));
275
-        wp_update_post([
274
+        check_admin_referer( 'unapprove-review_'.($postId = $this->getPostId()) );
275
+        wp_update_post( [
276 276
             'ID' => $postId,
277 277
             'post_status' => 'pending',
278
-        ]);
279
-        wp_safe_redirect(wp_get_referer());
278
+        ] );
279
+        wp_safe_redirect( wp_get_referer() );
280 280
         exit;
281 281
     }
282 282
 
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
      * @param string $domain
286 286
      * @return bool
287 287
      */
288
-    protected function canModifyTranslation($domain = 'default')
288
+    protected function canModifyTranslation( $domain = 'default' )
289 289
     {
290 290
         $screen = glsr_current_screen();
291 291
         return 'default' == $domain
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
      * Get the modified translation string.
298 298
      * @return string
299 299
      */
300
-    protected function getTranslation(array $args)
300
+    protected function getTranslation( array $args )
301 301
     {
302 302
         $defaults = [
303 303
             'number' => 0,
@@ -305,57 +305,57 @@  discard block
 block discarded – undo
305 305
             'single' => '',
306 306
             'text' => '',
307 307
         ];
308
-        $args = (object) wp_parse_args($args, $defaults);
309
-        $translations = get_translations_for_domain(Application::ID);
308
+        $args = (object)wp_parse_args( $args, $defaults );
309
+        $translations = get_translations_for_domain( Application::ID );
310 310
         return $args->text
311
-            ? $translations->translate($args->text)
312
-            : $translations->translate_plural($args->single, $args->plural, $args->number);
311
+            ? $translations->translate( $args->text )
312
+            : $translations->translate_plural( $args->single, $args->plural, $args->number );
313 313
     }
314 314
 
315 315
     /**
316 316
      * @return bool
317 317
      */
318
-    protected function hasPermission(WP_Query $query)
318
+    protected function hasPermission( WP_Query $query )
319 319
     {
320 320
         global $pagenow;
321 321
         return is_admin()
322 322
             && $query->is_main_query()
323
-            && Application::POST_TYPE == $query->get('post_type')
323
+            && Application::POST_TYPE == $query->get( 'post_type' )
324 324
             && 'edit.php' == $pagenow;
325 325
     }
326 326
 
327 327
     /**
328 328
      * @return void
329 329
      */
330
-    protected function setMetaQuery(WP_Query $query, array $metaKeys)
330
+    protected function setMetaQuery( WP_Query $query, array $metaKeys )
331 331
     {
332
-        foreach ($metaKeys as $key) {
333
-            if (!($value = filter_input(INPUT_GET, $key))) {
332
+        foreach( $metaKeys as $key ) {
333
+            if( !($value = filter_input( INPUT_GET, $key )) ) {
334 334
                 continue;
335 335
             }
336
-            $metaQuery = (array) $query->get('meta_query');
336
+            $metaQuery = (array)$query->get( 'meta_query' );
337 337
             $metaQuery[] = [
338
-                'key' => Str::prefix('_', $key, '_'),
338
+                'key' => Str::prefix( '_', $key, '_' ),
339 339
                 'value' => $value,
340 340
             ];
341
-            $query->set('meta_query', $metaQuery);
341
+            $query->set( 'meta_query', $metaQuery );
342 342
         }
343 343
     }
344 344
 
345 345
     /**
346 346
      * @return void
347 347
      */
348
-    protected function setOrderby(WP_Query $query)
348
+    protected function setOrderby( WP_Query $query )
349 349
     {
350
-        $orderby = $query->get('orderby');
350
+        $orderby = $query->get( 'orderby' );
351 351
         $columns = glsr()->postTypeColumns[Application::POST_TYPE];
352 352
         unset($columns['cb'], $columns['title'], $columns['date']);
353
-        if (in_array($orderby, array_keys($columns))) {
354
-            if ('reviewer' == $orderby) {
353
+        if( in_array( $orderby, array_keys( $columns ) ) ) {
354
+            if( 'reviewer' == $orderby ) {
355 355
                 $orderby = 'author';
356 356
             }
357
-            $query->set('meta_key', Str::prefix('_', $orderby, '_'));
358
-            $query->set('orderby', 'meta_value');
357
+            $query->set( 'meta_key', Str::prefix( '_', $orderby, '_' ) );
358
+            $query->set( 'orderby', 'meta_value' );
359 359
         }
360 360
     }
361 361
 }
Please login to merge, or discard this patch.
plugin/Controllers/MainController.php 2 patches
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -10,97 +10,97 @@
 block discarded – undo
10 10
 
11 11
 class MainController extends Controller
12 12
 {
13
-    /**
14
-     * @return void
15
-     * @action init
16
-     */
17
-    public function registerPostType()
18
-    {
19
-        if (!glsr()->hasPermission()) {
20
-            return;
21
-        }
22
-        $command = new RegisterPostType([
23
-            'capabilities' => ['create_posts' => 'create_'.Application::POST_TYPE],
24
-            'columns' => [
25
-                'title' => '',
26
-                'category' => '',
27
-                'assigned_to' => __('Assigned To', 'site-reviews'),
28
-                'reviewer' => __('Author', 'site-reviews'),
29
-                'email' => __('Email', 'site-reviews'),
30
-                'ip_address' => __('IP Address', 'site-reviews'),
31
-                'response' => __('Response', 'site-reviews'),
32
-                'review_type' => __('Type', 'site-reviews'),
33
-                'rating' => __('Rating', 'site-reviews'),
34
-                'pinned' => __('Pinned', 'site-reviews'),
35
-                'date' => '',
36
-            ],
37
-            'menu_icon' => 'dashicons-star-half',
38
-            'menu_name' => glsr()->name,
39
-            'map_meta_cap' => true,
40
-            'plural' => __('Reviews', 'site-reviews'),
41
-            'post_type' => Application::POST_TYPE,
42
-            'rest_controller_class' => RestReviewController::class,
43
-            'show_in_rest' => true,
44
-            'single' => __('Review', 'site-reviews'),
45
-        ]);
46
-        $this->execute($command);
47
-    }
13
+	/**
14
+	 * @return void
15
+	 * @action init
16
+	 */
17
+	public function registerPostType()
18
+	{
19
+		if (!glsr()->hasPermission()) {
20
+			return;
21
+		}
22
+		$command = new RegisterPostType([
23
+			'capabilities' => ['create_posts' => 'create_'.Application::POST_TYPE],
24
+			'columns' => [
25
+				'title' => '',
26
+				'category' => '',
27
+				'assigned_to' => __('Assigned To', 'site-reviews'),
28
+				'reviewer' => __('Author', 'site-reviews'),
29
+				'email' => __('Email', 'site-reviews'),
30
+				'ip_address' => __('IP Address', 'site-reviews'),
31
+				'response' => __('Response', 'site-reviews'),
32
+				'review_type' => __('Type', 'site-reviews'),
33
+				'rating' => __('Rating', 'site-reviews'),
34
+				'pinned' => __('Pinned', 'site-reviews'),
35
+				'date' => '',
36
+			],
37
+			'menu_icon' => 'dashicons-star-half',
38
+			'menu_name' => glsr()->name,
39
+			'map_meta_cap' => true,
40
+			'plural' => __('Reviews', 'site-reviews'),
41
+			'post_type' => Application::POST_TYPE,
42
+			'rest_controller_class' => RestReviewController::class,
43
+			'show_in_rest' => true,
44
+			'single' => __('Review', 'site-reviews'),
45
+		]);
46
+		$this->execute($command);
47
+	}
48 48
 
49
-    /**
50
-     * @return void
51
-     * @action init
52
-     */
53
-    public function registerShortcodes()
54
-    {
55
-        $command = new RegisterShortcodes([
56
-            'site_reviews',
57
-            'site_reviews_form',
58
-            'site_reviews_summary',
59
-        ]);
60
-        $this->execute($command);
61
-    }
49
+	/**
50
+	 * @return void
51
+	 * @action init
52
+	 */
53
+	public function registerShortcodes()
54
+	{
55
+		$command = new RegisterShortcodes([
56
+			'site_reviews',
57
+			'site_reviews_form',
58
+			'site_reviews_summary',
59
+		]);
60
+		$this->execute($command);
61
+	}
62 62
 
63
-    /**
64
-     * @return void
65
-     * @action init
66
-     */
67
-    public function registerTaxonomy()
68
-    {
69
-        $command = new RegisterTaxonomy([
70
-            'hierarchical' => true,
71
-            'meta_box_cb' => [glsr(EditorController::class), 'renderTaxonomyMetabox'],
72
-            'public' => false,
73
-            'rest_controller_class' => RestCategoryController::class,
74
-            'show_admin_column' => true,
75
-            'show_in_rest' => true,
76
-            'show_ui' => true,
77
-        ]);
78
-        $this->execute($command);
79
-    }
63
+	/**
64
+	 * @return void
65
+	 * @action init
66
+	 */
67
+	public function registerTaxonomy()
68
+	{
69
+		$command = new RegisterTaxonomy([
70
+			'hierarchical' => true,
71
+			'meta_box_cb' => [glsr(EditorController::class), 'renderTaxonomyMetabox'],
72
+			'public' => false,
73
+			'rest_controller_class' => RestCategoryController::class,
74
+			'show_admin_column' => true,
75
+			'show_in_rest' => true,
76
+			'show_ui' => true,
77
+		]);
78
+		$this->execute($command);
79
+	}
80 80
 
81
-    /**
82
-     * @return void
83
-     * @action widgets_init
84
-     */
85
-    public function registerWidgets()
86
-    {
87
-        $command = new RegisterWidgets([
88
-            'site-reviews' => [
89
-                'class' => 'glsr-widget glsr-widget-site-reviews',
90
-                'description' => __('Site Reviews: Display your recent reviews.', 'site-reviews'),
91
-                'title' => __('Recent Reviews', 'site-reviews'),
92
-            ],
93
-            'site-reviews-form' => [
94
-                'class' => 'glsr-widget glsr-widget-site-reviews-form',
95
-                'description' => __('Site Reviews: Display a form to submit reviews.', 'site-reviews'),
96
-                'title' => __('Submit a Review', 'site-reviews'),
97
-            ],
98
-            'site-reviews-summary' => [
99
-                'class' => 'glsr-widget glsr-widget-site-reviews-summary',
100
-                'description' => __('Site Reviews: Display a summary of your reviews.', 'site-reviews'),
101
-                'title' => __('Summary of Reviews', 'site-reviews'),
102
-            ],
103
-        ]);
104
-        $this->execute($command);
105
-    }
81
+	/**
82
+	 * @return void
83
+	 * @action widgets_init
84
+	 */
85
+	public function registerWidgets()
86
+	{
87
+		$command = new RegisterWidgets([
88
+			'site-reviews' => [
89
+				'class' => 'glsr-widget glsr-widget-site-reviews',
90
+				'description' => __('Site Reviews: Display your recent reviews.', 'site-reviews'),
91
+				'title' => __('Recent Reviews', 'site-reviews'),
92
+			],
93
+			'site-reviews-form' => [
94
+				'class' => 'glsr-widget glsr-widget-site-reviews-form',
95
+				'description' => __('Site Reviews: Display a form to submit reviews.', 'site-reviews'),
96
+				'title' => __('Submit a Review', 'site-reviews'),
97
+			],
98
+			'site-reviews-summary' => [
99
+				'class' => 'glsr-widget glsr-widget-site-reviews-summary',
100
+				'description' => __('Site Reviews: Display a summary of your reviews.', 'site-reviews'),
101
+				'title' => __('Summary of Reviews', 'site-reviews'),
102
+			],
103
+		]);
104
+		$this->execute($command);
105
+	}
106 106
 }
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -16,34 +16,34 @@  discard block
 block discarded – undo
16 16
      */
17 17
     public function registerPostType()
18 18
     {
19
-        if (!glsr()->hasPermission()) {
19
+        if( !glsr()->hasPermission() ) {
20 20
             return;
21 21
         }
22
-        $command = new RegisterPostType([
22
+        $command = new RegisterPostType( [
23 23
             'capabilities' => ['create_posts' => 'create_'.Application::POST_TYPE],
24 24
             'columns' => [
25 25
                 'title' => '',
26 26
                 'category' => '',
27
-                'assigned_to' => __('Assigned To', 'site-reviews'),
28
-                'reviewer' => __('Author', 'site-reviews'),
29
-                'email' => __('Email', 'site-reviews'),
30
-                'ip_address' => __('IP Address', 'site-reviews'),
31
-                'response' => __('Response', 'site-reviews'),
32
-                'review_type' => __('Type', 'site-reviews'),
33
-                'rating' => __('Rating', 'site-reviews'),
34
-                'pinned' => __('Pinned', 'site-reviews'),
27
+                'assigned_to' => __( 'Assigned To', 'site-reviews' ),
28
+                'reviewer' => __( 'Author', 'site-reviews' ),
29
+                'email' => __( 'Email', 'site-reviews' ),
30
+                'ip_address' => __( 'IP Address', 'site-reviews' ),
31
+                'response' => __( 'Response', 'site-reviews' ),
32
+                'review_type' => __( 'Type', 'site-reviews' ),
33
+                'rating' => __( 'Rating', 'site-reviews' ),
34
+                'pinned' => __( 'Pinned', 'site-reviews' ),
35 35
                 'date' => '',
36 36
             ],
37 37
             'menu_icon' => 'dashicons-star-half',
38 38
             'menu_name' => glsr()->name,
39 39
             'map_meta_cap' => true,
40
-            'plural' => __('Reviews', 'site-reviews'),
40
+            'plural' => __( 'Reviews', 'site-reviews' ),
41 41
             'post_type' => Application::POST_TYPE,
42 42
             'rest_controller_class' => RestReviewController::class,
43 43
             'show_in_rest' => true,
44
-            'single' => __('Review', 'site-reviews'),
45
-        ]);
46
-        $this->execute($command);
44
+            'single' => __( 'Review', 'site-reviews' ),
45
+        ] );
46
+        $this->execute( $command );
47 47
     }
48 48
 
49 49
     /**
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
      */
53 53
     public function registerShortcodes()
54 54
     {
55
-        $command = new RegisterShortcodes([
55
+        $command = new RegisterShortcodes( [
56 56
             'site_reviews',
57 57
             'site_reviews_form',
58 58
             'site_reviews_summary',
59
-        ]);
60
-        $this->execute($command);
59
+        ] );
60
+        $this->execute( $command );
61 61
     }
62 62
 
63 63
     /**
@@ -66,16 +66,16 @@  discard block
 block discarded – undo
66 66
      */
67 67
     public function registerTaxonomy()
68 68
     {
69
-        $command = new RegisterTaxonomy([
69
+        $command = new RegisterTaxonomy( [
70 70
             'hierarchical' => true,
71
-            'meta_box_cb' => [glsr(EditorController::class), 'renderTaxonomyMetabox'],
71
+            'meta_box_cb' => [glsr( EditorController::class ), 'renderTaxonomyMetabox'],
72 72
             'public' => false,
73 73
             'rest_controller_class' => RestCategoryController::class,
74 74
             'show_admin_column' => true,
75 75
             'show_in_rest' => true,
76 76
             'show_ui' => true,
77
-        ]);
78
-        $this->execute($command);
77
+        ] );
78
+        $this->execute( $command );
79 79
     }
80 80
 
81 81
     /**
@@ -84,23 +84,23 @@  discard block
 block discarded – undo
84 84
      */
85 85
     public function registerWidgets()
86 86
     {
87
-        $command = new RegisterWidgets([
87
+        $command = new RegisterWidgets( [
88 88
             'site-reviews' => [
89 89
                 'class' => 'glsr-widget glsr-widget-site-reviews',
90
-                'description' => __('Site Reviews: Display your recent reviews.', 'site-reviews'),
91
-                'title' => __('Recent Reviews', 'site-reviews'),
90
+                'description' => __( 'Site Reviews: Display your recent reviews.', 'site-reviews' ),
91
+                'title' => __( 'Recent Reviews', 'site-reviews' ),
92 92
             ],
93 93
             'site-reviews-form' => [
94 94
                 'class' => 'glsr-widget glsr-widget-site-reviews-form',
95
-                'description' => __('Site Reviews: Display a form to submit reviews.', 'site-reviews'),
96
-                'title' => __('Submit a Review', 'site-reviews'),
95
+                'description' => __( 'Site Reviews: Display a form to submit reviews.', 'site-reviews' ),
96
+                'title' => __( 'Submit a Review', 'site-reviews' ),
97 97
             ],
98 98
             'site-reviews-summary' => [
99 99
                 'class' => 'glsr-widget glsr-widget-site-reviews-summary',
100
-                'description' => __('Site Reviews: Display a summary of your reviews.', 'site-reviews'),
101
-                'title' => __('Summary of Reviews', 'site-reviews'),
100
+                'description' => __( 'Site Reviews: Display a summary of your reviews.', 'site-reviews' ),
101
+                'title' => __( 'Summary of Reviews', 'site-reviews' ),
102 102
             ],
103
-        ]);
104
-        $this->execute($command);
103
+        ] );
104
+        $this->execute( $command );
105 105
     }
106 106
 }
Please login to merge, or discard this patch.
plugin/Controllers/ListTableController/Columns.php 2 patches
Indentation   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -10,176 +10,176 @@
 block discarded – undo
10 10
 
11 11
 class Columns
12 12
 {
13
-    /**
14
-     * @param int $postId
15
-     * @return void|string
16
-     */
17
-    public function buildColumnAssignedTo($postId)
18
-    {
19
-        $assignedPost = glsr(Database::class)->getAssignedToPost($postId);
20
-        if ($assignedPost instanceof WP_Post && 'publish' == $assignedPost->post_status) {
21
-            return glsr(Builder::class)->a(get_the_title($assignedPost->ID), [
22
-                'href' => (string) get_the_permalink($assignedPost->ID),
23
-            ]);
24
-        }
25
-    }
13
+	/**
14
+	 * @param int $postId
15
+	 * @return void|string
16
+	 */
17
+	public function buildColumnAssignedTo($postId)
18
+	{
19
+		$assignedPost = glsr(Database::class)->getAssignedToPost($postId);
20
+		if ($assignedPost instanceof WP_Post && 'publish' == $assignedPost->post_status) {
21
+			return glsr(Builder::class)->a(get_the_title($assignedPost->ID), [
22
+				'href' => (string) get_the_permalink($assignedPost->ID),
23
+			]);
24
+		}
25
+	}
26 26
 
27
-    /**
28
-     * @param int $postId
29
-     * @return void|string
30
-     */
31
-    public function buildColumnEmail($postId)
32
-    {
33
-        if ($email = glsr(Database::class)->get($postId, 'email')) {
34
-            return $email;
35
-        }
36
-    }
27
+	/**
28
+	 * @param int $postId
29
+	 * @return void|string
30
+	 */
31
+	public function buildColumnEmail($postId)
32
+	{
33
+		if ($email = glsr(Database::class)->get($postId, 'email')) {
34
+			return $email;
35
+		}
36
+	}
37 37
 
38
-    /**
39
-     * @param int $postId
40
-     * @return void|string
41
-     */
42
-    public function buildColumnIpAddress($postId)
43
-    {
44
-        if ($ipAddress = glsr(Database::class)->get($postId, 'ip_address')) {
45
-            return $ipAddress;
46
-        }
47
-    }
38
+	/**
39
+	 * @param int $postId
40
+	 * @return void|string
41
+	 */
42
+	public function buildColumnIpAddress($postId)
43
+	{
44
+		if ($ipAddress = glsr(Database::class)->get($postId, 'ip_address')) {
45
+			return $ipAddress;
46
+		}
47
+	}
48 48
 
49
-    /**
50
-     * @param int $postId
51
-     * @return string
52
-     */
53
-    public function buildColumnPinned($postId)
54
-    {
55
-        $pinned = glsr(Database::class)->get($postId, 'pinned')
56
-            ? 'pinned '
57
-            : '';
58
-        return glsr(Builder::class)->i([
59
-            'class' => $pinned.'dashicons dashicons-sticky',
60
-            'data-id' => $postId,
61
-        ]);
62
-    }
49
+	/**
50
+	 * @param int $postId
51
+	 * @return string
52
+	 */
53
+	public function buildColumnPinned($postId)
54
+	{
55
+		$pinned = glsr(Database::class)->get($postId, 'pinned')
56
+			? 'pinned '
57
+			: '';
58
+		return glsr(Builder::class)->i([
59
+			'class' => $pinned.'dashicons dashicons-sticky',
60
+			'data-id' => $postId,
61
+		]);
62
+	}
63 63
 
64
-    /**
65
-     * @param int $postId
66
-     * @return string
67
-     */
68
-    public function buildColumnResponse($postId)
69
-    {
70
-        return glsr(Database::class)->get($postId, 'response')
71
-            ? __('Yes', 'site-reviews')
72
-            : __('No', 'site-reviews');
73
-    }
64
+	/**
65
+	 * @param int $postId
66
+	 * @return string
67
+	 */
68
+	public function buildColumnResponse($postId)
69
+	{
70
+		return glsr(Database::class)->get($postId, 'response')
71
+			? __('Yes', 'site-reviews')
72
+			: __('No', 'site-reviews');
73
+	}
74 74
 
75
-    /**
76
-     * @param int $postId
77
-     * @return string
78
-     */
79
-    public function buildColumnReviewer($postId)
80
-    {
81
-        return strval(glsr(Database::class)->get($postId, 'author'));
82
-    }
75
+	/**
76
+	 * @param int $postId
77
+	 * @return string
78
+	 */
79
+	public function buildColumnReviewer($postId)
80
+	{
81
+		return strval(glsr(Database::class)->get($postId, 'author'));
82
+	}
83 83
 
84
-    /**
85
-     * @param int $postId
86
-     * @param int|null $rating
87
-     * @return string
88
-     */
89
-    public function buildColumnRating($postId)
90
-    {
91
-        return glsr_star_rating(intval(glsr(Database::class)->get($postId, 'rating')));
92
-    }
84
+	/**
85
+	 * @param int $postId
86
+	 * @param int|null $rating
87
+	 * @return string
88
+	 */
89
+	public function buildColumnRating($postId)
90
+	{
91
+		return glsr_star_rating(intval(glsr(Database::class)->get($postId, 'rating')));
92
+	}
93 93
 
94
-    /**
95
-     * @param int $postId
96
-     * @return string
97
-     */
98
-    public function buildColumnReviewType($postId)
99
-    {
100
-        $type = glsr(Database::class)->get($postId, 'review_type');
101
-        return array_key_exists($type, glsr()->reviewTypes)
102
-            ? glsr()->reviewTypes[$type]
103
-            : __('Unsupported Type', 'site-reviews');
104
-    }
94
+	/**
95
+	 * @param int $postId
96
+	 * @return string
97
+	 */
98
+	public function buildColumnReviewType($postId)
99
+	{
100
+		$type = glsr(Database::class)->get($postId, 'review_type');
101
+		return array_key_exists($type, glsr()->reviewTypes)
102
+			? glsr()->reviewTypes[$type]
103
+			: __('Unsupported Type', 'site-reviews');
104
+	}
105 105
 
106
-    /**
107
-     * @param string $postType
108
-     * @return void
109
-     */
110
-    public function renderFilters($postType)
111
-    {
112
-        if (Application::POST_TYPE !== $postType) {
113
-            return;
114
-        }
115
-        if (!($status = filter_input(INPUT_GET, 'post_status'))) {
116
-            $status = 'publish';
117
-        }
118
-        $ratings = glsr(Database::class)->getReviewsMeta('rating', $status);
119
-        $types = glsr(Database::class)->getReviewsMeta('review_type', $status);
120
-        $this->renderFilterRatings($ratings);
121
-        $this->renderFilterTypes($types);
122
-    }
106
+	/**
107
+	 * @param string $postType
108
+	 * @return void
109
+	 */
110
+	public function renderFilters($postType)
111
+	{
112
+		if (Application::POST_TYPE !== $postType) {
113
+			return;
114
+		}
115
+		if (!($status = filter_input(INPUT_GET, 'post_status'))) {
116
+			$status = 'publish';
117
+		}
118
+		$ratings = glsr(Database::class)->getReviewsMeta('rating', $status);
119
+		$types = glsr(Database::class)->getReviewsMeta('review_type', $status);
120
+		$this->renderFilterRatings($ratings);
121
+		$this->renderFilterTypes($types);
122
+	}
123 123
 
124
-    /**
125
-     * @param string $column
126
-     * @param int $postId
127
-     * @return void
128
-     */
129
-    public function renderValues($column, $postId)
130
-    {
131
-        $method = Helper::buildMethodName($column, 'buildColumn');
132
-        $value = method_exists($this, $method)
133
-            ? call_user_func([$this, $method], $postId)
134
-            : apply_filters('site-reviews/columns/'.$column, '', $postId);
135
-        if (empty($value)) {
136
-            $value = '&mdash;';
137
-        }
138
-        echo $value;
139
-    }
124
+	/**
125
+	 * @param string $column
126
+	 * @param int $postId
127
+	 * @return void
128
+	 */
129
+	public function renderValues($column, $postId)
130
+	{
131
+		$method = Helper::buildMethodName($column, 'buildColumn');
132
+		$value = method_exists($this, $method)
133
+			? call_user_func([$this, $method], $postId)
134
+			: apply_filters('site-reviews/columns/'.$column, '', $postId);
135
+		if (empty($value)) {
136
+			$value = '&mdash;';
137
+		}
138
+		echo $value;
139
+	}
140 140
 
141
-    /**
142
-     * @param array $ratings
143
-     * @return void
144
-     */
145
-    protected function renderFilterRatings($ratings)
146
-    {
147
-        if (empty($ratings)) {
148
-            return;
149
-        }
150
-        $ratings = array_flip(array_reverse($ratings));
151
-        array_walk($ratings, function (&$value, $key) {
152
-            $label = _n('%s star', '%s stars', $key, 'site-reviews');
153
-            $value = sprintf($label, $key);
154
-        });
155
-        echo glsr(Builder::class)->label(__('Filter by rating', 'site-reviews'), [
156
-            'class' => 'screen-reader-text',
157
-            'for' => 'rating',
158
-        ]);
159
-        echo glsr(Builder::class)->select([
160
-            'name' => 'rating',
161
-            'options' => ['' => __('All ratings', 'site-reviews')] + $ratings,
162
-            'value' => filter_input(INPUT_GET, 'rating'),
163
-        ]);
164
-    }
141
+	/**
142
+	 * @param array $ratings
143
+	 * @return void
144
+	 */
145
+	protected function renderFilterRatings($ratings)
146
+	{
147
+		if (empty($ratings)) {
148
+			return;
149
+		}
150
+		$ratings = array_flip(array_reverse($ratings));
151
+		array_walk($ratings, function (&$value, $key) {
152
+			$label = _n('%s star', '%s stars', $key, 'site-reviews');
153
+			$value = sprintf($label, $key);
154
+		});
155
+		echo glsr(Builder::class)->label(__('Filter by rating', 'site-reviews'), [
156
+			'class' => 'screen-reader-text',
157
+			'for' => 'rating',
158
+		]);
159
+		echo glsr(Builder::class)->select([
160
+			'name' => 'rating',
161
+			'options' => ['' => __('All ratings', 'site-reviews')] + $ratings,
162
+			'value' => filter_input(INPUT_GET, 'rating'),
163
+		]);
164
+	}
165 165
 
166
-    /**
167
-     * @param array $types
168
-     * @return void
169
-     */
170
-    protected function renderFilterTypes($types)
171
-    {
172
-        if (count(glsr()->reviewTypes) < 2) {
173
-            return;
174
-        }
175
-        echo glsr(Builder::class)->label(__('Filter by type', 'site-reviews'), [
176
-            'class' => 'screen-reader-text',
177
-            'for' => 'review_type',
178
-        ]);
179
-        echo glsr(Builder::class)->select([
180
-            'name' => 'review_type',
181
-            'options' => ['' => __('All types', 'site-reviews')] + glsr()->reviewTypes,
182
-            'value' => filter_input(INPUT_GET, 'review_type'),
183
-        ]);
184
-    }
166
+	/**
167
+	 * @param array $types
168
+	 * @return void
169
+	 */
170
+	protected function renderFilterTypes($types)
171
+	{
172
+		if (count(glsr()->reviewTypes) < 2) {
173
+			return;
174
+		}
175
+		echo glsr(Builder::class)->label(__('Filter by type', 'site-reviews'), [
176
+			'class' => 'screen-reader-text',
177
+			'for' => 'review_type',
178
+		]);
179
+		echo glsr(Builder::class)->select([
180
+			'name' => 'review_type',
181
+			'options' => ['' => __('All types', 'site-reviews')] + glsr()->reviewTypes,
182
+			'value' => filter_input(INPUT_GET, 'review_type'),
183
+		]);
184
+	}
185 185
 }
Please login to merge, or discard this patch.
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
      * @param int $postId
15 15
      * @return void|string
16 16
      */
17
-    public function buildColumnAssignedTo($postId)
17
+    public function buildColumnAssignedTo( $postId )
18 18
     {
19
-        $assignedPost = glsr(Database::class)->getAssignedToPost($postId);
20
-        if ($assignedPost instanceof WP_Post && 'publish' == $assignedPost->post_status) {
21
-            return glsr(Builder::class)->a(get_the_title($assignedPost->ID), [
22
-                'href' => (string) get_the_permalink($assignedPost->ID),
23
-            ]);
19
+        $assignedPost = glsr( Database::class )->getAssignedToPost( $postId );
20
+        if( $assignedPost instanceof WP_Post && 'publish' == $assignedPost->post_status ) {
21
+            return glsr( Builder::class )->a( get_the_title( $assignedPost->ID ), [
22
+                'href' => (string)get_the_permalink( $assignedPost->ID ),
23
+            ] );
24 24
         }
25 25
     }
26 26
 
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
      * @param int $postId
29 29
      * @return void|string
30 30
      */
31
-    public function buildColumnEmail($postId)
31
+    public function buildColumnEmail( $postId )
32 32
     {
33
-        if ($email = glsr(Database::class)->get($postId, 'email')) {
33
+        if( $email = glsr( Database::class )->get( $postId, 'email' ) ) {
34 34
             return $email;
35 35
         }
36 36
     }
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
      * @param int $postId
40 40
      * @return void|string
41 41
      */
42
-    public function buildColumnIpAddress($postId)
42
+    public function buildColumnIpAddress( $postId )
43 43
     {
44
-        if ($ipAddress = glsr(Database::class)->get($postId, 'ip_address')) {
44
+        if( $ipAddress = glsr( Database::class )->get( $postId, 'ip_address' ) ) {
45 45
             return $ipAddress;
46 46
         }
47 47
     }
@@ -50,35 +50,35 @@  discard block
 block discarded – undo
50 50
      * @param int $postId
51 51
      * @return string
52 52
      */
53
-    public function buildColumnPinned($postId)
53
+    public function buildColumnPinned( $postId )
54 54
     {
55
-        $pinned = glsr(Database::class)->get($postId, 'pinned')
55
+        $pinned = glsr( Database::class )->get( $postId, 'pinned' )
56 56
             ? 'pinned '
57 57
             : '';
58
-        return glsr(Builder::class)->i([
58
+        return glsr( Builder::class )->i( [
59 59
             'class' => $pinned.'dashicons dashicons-sticky',
60 60
             'data-id' => $postId,
61
-        ]);
61
+        ] );
62 62
     }
63 63
 
64 64
     /**
65 65
      * @param int $postId
66 66
      * @return string
67 67
      */
68
-    public function buildColumnResponse($postId)
68
+    public function buildColumnResponse( $postId )
69 69
     {
70
-        return glsr(Database::class)->get($postId, 'response')
71
-            ? __('Yes', 'site-reviews')
72
-            : __('No', 'site-reviews');
70
+        return glsr( Database::class )->get( $postId, 'response' )
71
+            ? __( 'Yes', 'site-reviews' )
72
+            : __( 'No', 'site-reviews' );
73 73
     }
74 74
 
75 75
     /**
76 76
      * @param int $postId
77 77
      * @return string
78 78
      */
79
-    public function buildColumnReviewer($postId)
79
+    public function buildColumnReviewer( $postId )
80 80
     {
81
-        return strval(glsr(Database::class)->get($postId, 'author'));
81
+        return strval( glsr( Database::class )->get( $postId, 'author' ) );
82 82
     }
83 83
 
84 84
     /**
@@ -86,39 +86,39 @@  discard block
 block discarded – undo
86 86
      * @param int|null $rating
87 87
      * @return string
88 88
      */
89
-    public function buildColumnRating($postId)
89
+    public function buildColumnRating( $postId )
90 90
     {
91
-        return glsr_star_rating(intval(glsr(Database::class)->get($postId, 'rating')));
91
+        return glsr_star_rating( intval( glsr( Database::class )->get( $postId, 'rating' ) ) );
92 92
     }
93 93
 
94 94
     /**
95 95
      * @param int $postId
96 96
      * @return string
97 97
      */
98
-    public function buildColumnReviewType($postId)
98
+    public function buildColumnReviewType( $postId )
99 99
     {
100
-        $type = glsr(Database::class)->get($postId, 'review_type');
101
-        return array_key_exists($type, glsr()->reviewTypes)
100
+        $type = glsr( Database::class )->get( $postId, 'review_type' );
101
+        return array_key_exists( $type, glsr()->reviewTypes )
102 102
             ? glsr()->reviewTypes[$type]
103
-            : __('Unsupported Type', 'site-reviews');
103
+            : __( 'Unsupported Type', 'site-reviews' );
104 104
     }
105 105
 
106 106
     /**
107 107
      * @param string $postType
108 108
      * @return void
109 109
      */
110
-    public function renderFilters($postType)
110
+    public function renderFilters( $postType )
111 111
     {
112
-        if (Application::POST_TYPE !== $postType) {
112
+        if( Application::POST_TYPE !== $postType ) {
113 113
             return;
114 114
         }
115
-        if (!($status = filter_input(INPUT_GET, 'post_status'))) {
115
+        if( !($status = filter_input( INPUT_GET, 'post_status' )) ) {
116 116
             $status = 'publish';
117 117
         }
118
-        $ratings = glsr(Database::class)->getReviewsMeta('rating', $status);
119
-        $types = glsr(Database::class)->getReviewsMeta('review_type', $status);
120
-        $this->renderFilterRatings($ratings);
121
-        $this->renderFilterTypes($types);
118
+        $ratings = glsr( Database::class )->getReviewsMeta( 'rating', $status );
119
+        $types = glsr( Database::class )->getReviewsMeta( 'review_type', $status );
120
+        $this->renderFilterRatings( $ratings );
121
+        $this->renderFilterTypes( $types );
122 122
     }
123 123
 
124 124
     /**
@@ -126,13 +126,13 @@  discard block
 block discarded – undo
126 126
      * @param int $postId
127 127
      * @return void
128 128
      */
129
-    public function renderValues($column, $postId)
129
+    public function renderValues( $column, $postId )
130 130
     {
131
-        $method = Helper::buildMethodName($column, 'buildColumn');
132
-        $value = method_exists($this, $method)
133
-            ? call_user_func([$this, $method], $postId)
134
-            : apply_filters('site-reviews/columns/'.$column, '', $postId);
135
-        if (empty($value)) {
131
+        $method = Helper::buildMethodName( $column, 'buildColumn' );
132
+        $value = method_exists( $this, $method )
133
+            ? call_user_func( [$this, $method], $postId )
134
+            : apply_filters( 'site-reviews/columns/'.$column, '', $postId );
135
+        if( empty($value) ) {
136 136
             $value = '&mdash;';
137 137
         }
138 138
         echo $value;
@@ -142,44 +142,44 @@  discard block
 block discarded – undo
142 142
      * @param array $ratings
143 143
      * @return void
144 144
      */
145
-    protected function renderFilterRatings($ratings)
145
+    protected function renderFilterRatings( $ratings )
146 146
     {
147
-        if (empty($ratings)) {
147
+        if( empty($ratings) ) {
148 148
             return;
149 149
         }
150
-        $ratings = array_flip(array_reverse($ratings));
151
-        array_walk($ratings, function (&$value, $key) {
152
-            $label = _n('%s star', '%s stars', $key, 'site-reviews');
153
-            $value = sprintf($label, $key);
150
+        $ratings = array_flip( array_reverse( $ratings ) );
151
+        array_walk( $ratings, function( &$value, $key ) {
152
+            $label = _n( '%s star', '%s stars', $key, 'site-reviews' );
153
+            $value = sprintf( $label, $key );
154 154
         });
155
-        echo glsr(Builder::class)->label(__('Filter by rating', 'site-reviews'), [
155
+        echo glsr( Builder::class )->label( __( 'Filter by rating', 'site-reviews' ), [
156 156
             'class' => 'screen-reader-text',
157 157
             'for' => 'rating',
158
-        ]);
159
-        echo glsr(Builder::class)->select([
158
+        ] );
159
+        echo glsr( Builder::class )->select( [
160 160
             'name' => 'rating',
161
-            'options' => ['' => __('All ratings', 'site-reviews')] + $ratings,
162
-            'value' => filter_input(INPUT_GET, 'rating'),
163
-        ]);
161
+            'options' => ['' => __( 'All ratings', 'site-reviews' )] + $ratings,
162
+            'value' => filter_input( INPUT_GET, 'rating' ),
163
+        ] );
164 164
     }
165 165
 
166 166
     /**
167 167
      * @param array $types
168 168
      * @return void
169 169
      */
170
-    protected function renderFilterTypes($types)
170
+    protected function renderFilterTypes( $types )
171 171
     {
172
-        if (count(glsr()->reviewTypes) < 2) {
172
+        if( count( glsr()->reviewTypes ) < 2 ) {
173 173
             return;
174 174
         }
175
-        echo glsr(Builder::class)->label(__('Filter by type', 'site-reviews'), [
175
+        echo glsr( Builder::class )->label( __( 'Filter by type', 'site-reviews' ), [
176 176
             'class' => 'screen-reader-text',
177 177
             'for' => 'review_type',
178
-        ]);
179
-        echo glsr(Builder::class)->select([
178
+        ] );
179
+        echo glsr( Builder::class )->select( [
180 180
             'name' => 'review_type',
181
-            'options' => ['' => __('All types', 'site-reviews')] + glsr()->reviewTypes,
182
-            'value' => filter_input(INPUT_GET, 'review_type'),
183
-        ]);
181
+            'options' => ['' => __( 'All types', 'site-reviews' )] + glsr()->reviewTypes,
182
+            'value' => filter_input( INPUT_GET, 'review_type' ),
183
+        ] );
184 184
     }
185 185
 }
Please login to merge, or discard this patch.