Passed
Push — master ( 876108...8633df )
by Paul
06:37
created
plugin/Modules/Notification.php 2 patches
Indentation   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -8,164 +8,164 @@
 block discarded – undo
8 8
 
9 9
 class Notification
10 10
 {
11
-    /**
12
-     * @var bool
13
-     */
14
-    protected $email;
11
+	/**
12
+	 * @var bool
13
+	 */
14
+	protected $email;
15 15
 
16
-    /**
17
-     * @var Review
18
-     */
19
-    protected $review;
16
+	/**
17
+	 * @var Review
18
+	 */
19
+	protected $review;
20 20
 
21
-    /**
22
-     * @var bool
23
-     */
24
-    protected $slack;
21
+	/**
22
+	 * @var bool
23
+	 */
24
+	protected $slack;
25 25
 
26
-    /**
27
-     * @var array
28
-     */
29
-    protected $types;
26
+	/**
27
+	 * @var array
28
+	 */
29
+	protected $types;
30 30
 
31
-    public function __construct()
32
-    {
33
-        $types = glsr(OptionManager::class)->get('settings.general.notifications', []);
34
-        $this->email = count(array_intersect(['admin', 'custom'], $types)) > 0;
35
-        $this->slack = in_array('slack', $types);
36
-        $this->types = $types;
37
-    }
31
+	public function __construct()
32
+	{
33
+		$types = glsr(OptionManager::class)->get('settings.general.notifications', []);
34
+		$this->email = count(array_intersect(['admin', 'custom'], $types)) > 0;
35
+		$this->slack = in_array('slack', $types);
36
+		$this->types = $types;
37
+	}
38 38
 
39
-    /**
40
-     * @return void
41
-     */
42
-    public function send(Review $review)
43
-    {
44
-        if (empty($this->types)) {
45
-            return;
46
-        }
47
-        $this->review = $review;
48
-        $args = [
49
-            'link' => $this->getLink(),
50
-            'title' => $this->getTitle(),
51
-        ];
52
-        $this->sendToEmail($args);
53
-        $this->sendToSlack($args);
54
-    }
39
+	/**
40
+	 * @return void
41
+	 */
42
+	public function send(Review $review)
43
+	{
44
+		if (empty($this->types)) {
45
+			return;
46
+		}
47
+		$this->review = $review;
48
+		$args = [
49
+			'link' => $this->getLink(),
50
+			'title' => $this->getTitle(),
51
+		];
52
+		$this->sendToEmail($args);
53
+		$this->sendToSlack($args);
54
+	}
55 55
 
56
-    /**
57
-     * @return Email
58
-     */
59
-    protected function buildEmail(array $args)
60
-    {
61
-        return glsr(Email::class)->compose([
62
-            'to' => $this->getEmailAddresses(),
63
-            'subject' => $args['title'],
64
-            'template' => 'email-notification',
65
-            'template-tags' => [
66
-                'review_author' => $this->review->author ?: __('Anonymous', 'site-reviews'),
67
-                'review_content' => $this->review->content,
68
-                'review_email' => $this->review->email,
69
-                'review_ip' => $this->review->ip_address,
70
-                'review_link' => sprintf('<a href="%1$s">%1$s</a>', $args['link']),
71
-                'review_rating' => $this->review->rating,
72
-                'review_title' => $this->review->title,
73
-            ],
74
-        ]);
75
-    }
56
+	/**
57
+	 * @return Email
58
+	 */
59
+	protected function buildEmail(array $args)
60
+	{
61
+		return glsr(Email::class)->compose([
62
+			'to' => $this->getEmailAddresses(),
63
+			'subject' => $args['title'],
64
+			'template' => 'email-notification',
65
+			'template-tags' => [
66
+				'review_author' => $this->review->author ?: __('Anonymous', 'site-reviews'),
67
+				'review_content' => $this->review->content,
68
+				'review_email' => $this->review->email,
69
+				'review_ip' => $this->review->ip_address,
70
+				'review_link' => sprintf('<a href="%1$s">%1$s</a>', $args['link']),
71
+				'review_rating' => $this->review->rating,
72
+				'review_title' => $this->review->title,
73
+			],
74
+		]);
75
+	}
76 76
 
77
-    /**
78
-     * @return Slack
79
-     */
80
-    protected function buildSlackNotification(array $args)
81
-    {
82
-        return glsr(Slack::class)->compose($this->review, [
83
-            'button_url' => $args['link'],
84
-            'fallback' => $this->buildEmail($args)->read('plaintext'),
85
-            'pretext' => $args['title'],
86
-        ]);
87
-    }
77
+	/**
78
+	 * @return Slack
79
+	 */
80
+	protected function buildSlackNotification(array $args)
81
+	{
82
+		return glsr(Slack::class)->compose($this->review, [
83
+			'button_url' => $args['link'],
84
+			'fallback' => $this->buildEmail($args)->read('plaintext'),
85
+			'pretext' => $args['title'],
86
+		]);
87
+	}
88 88
 
89
-    /**
90
-     * @return array
91
-     */
92
-    protected function getEmailAddresses()
93
-    {
94
-        $emails = [];
95
-        if (in_array('admin', $this->types)) {
96
-            $emails[] = glsr(OptionManager::class)->getWP('admin_email');
97
-        }
98
-        if (in_array('author', $this->types)) {
99
-            $assignedPost = get_post(intval($this->review->assigned_to));
100
-            if ($assignedPost instanceof WP_Post) {
101
-                $this->email = true;
102
-                $emails[] = get_the_author_meta('user_email', intval($assignedPost->post_author));
103
-            }
104
-        }
105
-        if (in_array('custom', $this->types)) {
106
-            $customEmails = glsr(OptionManager::class)->get('settings.general.notification_email');
107
-            $customEmails = str_replace([' ', ',', ';'], ',', $customEmails);
108
-            $customEmails = explode(',', $customEmails);
109
-            $emails = array_merge($emails, $customEmails);
110
-        }
111
-        $emails = array_filter(array_keys(array_flip($emails)));
112
-        return apply_filters('site-reviews/notification/emails', $emails, $this->review);
113
-    }
89
+	/**
90
+	 * @return array
91
+	 */
92
+	protected function getEmailAddresses()
93
+	{
94
+		$emails = [];
95
+		if (in_array('admin', $this->types)) {
96
+			$emails[] = glsr(OptionManager::class)->getWP('admin_email');
97
+		}
98
+		if (in_array('author', $this->types)) {
99
+			$assignedPost = get_post(intval($this->review->assigned_to));
100
+			if ($assignedPost instanceof WP_Post) {
101
+				$this->email = true;
102
+				$emails[] = get_the_author_meta('user_email', intval($assignedPost->post_author));
103
+			}
104
+		}
105
+		if (in_array('custom', $this->types)) {
106
+			$customEmails = glsr(OptionManager::class)->get('settings.general.notification_email');
107
+			$customEmails = str_replace([' ', ',', ';'], ',', $customEmails);
108
+			$customEmails = explode(',', $customEmails);
109
+			$emails = array_merge($emails, $customEmails);
110
+		}
111
+		$emails = array_filter(array_keys(array_flip($emails)));
112
+		return apply_filters('site-reviews/notification/emails', $emails, $this->review);
113
+	}
114 114
 
115
-    /**
116
-     * @return string
117
-     */
118
-    protected function getLink()
119
-    {
120
-        return admin_url('post.php?post='.$this->review->ID.'&action=edit');
121
-    }
115
+	/**
116
+	 * @return string
117
+	 */
118
+	protected function getLink()
119
+	{
120
+		return admin_url('post.php?post='.$this->review->ID.'&action=edit');
121
+	}
122 122
 
123
-    /**
124
-     * @return string
125
-     */
126
-    protected function getTitle()
127
-    {
128
-        $assignedTitle = get_the_title(intval($this->review->assigned_to));
129
-        $title = _nx(
130
-            'New %s-star review',
131
-            'New %s-star review of: %s',
132
-            intval(empty($assignedTitle)),
133
-            'This string differs depending on whether or not the review has been assigned to a post.',
134
-            'site-reviews'
135
-        );
136
-        $title = sprintf('[%s] %s',
137
-            wp_specialchars_decode(glsr(OptionManager::class)->getWP('blogname'), ENT_QUOTES),
138
-            sprintf($title, $this->review->rating, $assignedTitle)
139
-        );
140
-        return apply_filters('site-reviews/notification/title', $title, $this->review);
141
-    }
123
+	/**
124
+	 * @return string
125
+	 */
126
+	protected function getTitle()
127
+	{
128
+		$assignedTitle = get_the_title(intval($this->review->assigned_to));
129
+		$title = _nx(
130
+			'New %s-star review',
131
+			'New %s-star review of: %s',
132
+			intval(empty($assignedTitle)),
133
+			'This string differs depending on whether or not the review has been assigned to a post.',
134
+			'site-reviews'
135
+		);
136
+		$title = sprintf('[%s] %s',
137
+			wp_specialchars_decode(glsr(OptionManager::class)->getWP('blogname'), ENT_QUOTES),
138
+			sprintf($title, $this->review->rating, $assignedTitle)
139
+		);
140
+		return apply_filters('site-reviews/notification/title', $title, $this->review);
141
+	}
142 142
 
143
-    /**
144
-     * @return void
145
-     */
146
-    protected function sendToEmail(array $args)
147
-    {
148
-        $email = $this->buildEmail($args);
149
-        if (empty($email->to)) {
150
-            glsr_log()->error('Email notification was not sent (missing email address)');
151
-            return;
152
-        }
153
-        $email->send();
154
-    }
143
+	/**
144
+	 * @return void
145
+	 */
146
+	protected function sendToEmail(array $args)
147
+	{
148
+		$email = $this->buildEmail($args);
149
+		if (empty($email->to)) {
150
+			glsr_log()->error('Email notification was not sent (missing email address)');
151
+			return;
152
+		}
153
+		$email->send();
154
+	}
155 155
 
156
-    /**
157
-     * @return void
158
-     */
159
-    protected function sendToSlack(array $args)
160
-    {
161
-        if (!$this->slack) {
162
-            return;
163
-        }
164
-        $notification = $this->buildSlackNotification($args);
165
-        $result = $notification->send();
166
-        if (is_wp_error($result)) {
167
-            $notification->review = null;
168
-            glsr_log()->error($result->get_error_message())->debug($notification);
169
-        }
170
-    }
156
+	/**
157
+	 * @return void
158
+	 */
159
+	protected function sendToSlack(array $args)
160
+	{
161
+		if (!$this->slack) {
162
+			return;
163
+		}
164
+		$notification = $this->buildSlackNotification($args);
165
+		$result = $notification->send();
166
+		if (is_wp_error($result)) {
167
+			$notification->review = null;
168
+			glsr_log()->error($result->get_error_message())->debug($notification);
169
+		}
170
+	}
171 171
 }
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
 
31 31
     public function __construct()
32 32
     {
33
-        $types = glsr(OptionManager::class)->get('settings.general.notifications', []);
34
-        $this->email = count(array_intersect(['admin', 'custom'], $types)) > 0;
35
-        $this->slack = in_array('slack', $types);
33
+        $types = glsr( OptionManager::class )->get( 'settings.general.notifications', [] );
34
+        $this->email = count( array_intersect( ['admin', 'custom'], $types ) ) > 0;
35
+        $this->slack = in_array( 'slack', $types );
36 36
         $this->types = $types;
37 37
     }
38 38
 
39 39
     /**
40 40
      * @return void
41 41
      */
42
-    public function send(Review $review)
42
+    public function send( Review $review )
43 43
     {
44
-        if (empty($this->types)) {
44
+        if( empty($this->types) ) {
45 45
             return;
46 46
         }
47 47
         $this->review = $review;
@@ -49,41 +49,41 @@  discard block
 block discarded – undo
49 49
             'link' => $this->getLink(),
50 50
             'title' => $this->getTitle(),
51 51
         ];
52
-        $this->sendToEmail($args);
53
-        $this->sendToSlack($args);
52
+        $this->sendToEmail( $args );
53
+        $this->sendToSlack( $args );
54 54
     }
55 55
 
56 56
     /**
57 57
      * @return Email
58 58
      */
59
-    protected function buildEmail(array $args)
59
+    protected function buildEmail( array $args )
60 60
     {
61
-        return glsr(Email::class)->compose([
61
+        return glsr( Email::class )->compose( [
62 62
             'to' => $this->getEmailAddresses(),
63 63
             'subject' => $args['title'],
64 64
             'template' => 'email-notification',
65 65
             'template-tags' => [
66
-                'review_author' => $this->review->author ?: __('Anonymous', 'site-reviews'),
66
+                'review_author' => $this->review->author ?: __( 'Anonymous', 'site-reviews' ),
67 67
                 'review_content' => $this->review->content,
68 68
                 'review_email' => $this->review->email,
69 69
                 'review_ip' => $this->review->ip_address,
70
-                'review_link' => sprintf('<a href="%1$s">%1$s</a>', $args['link']),
70
+                'review_link' => sprintf( '<a href="%1$s">%1$s</a>', $args['link'] ),
71 71
                 'review_rating' => $this->review->rating,
72 72
                 'review_title' => $this->review->title,
73 73
             ],
74
-        ]);
74
+        ] );
75 75
     }
76 76
 
77 77
     /**
78 78
      * @return Slack
79 79
      */
80
-    protected function buildSlackNotification(array $args)
80
+    protected function buildSlackNotification( array $args )
81 81
     {
82
-        return glsr(Slack::class)->compose($this->review, [
82
+        return glsr( Slack::class )->compose( $this->review, [
83 83
             'button_url' => $args['link'],
84
-            'fallback' => $this->buildEmail($args)->read('plaintext'),
84
+            'fallback' => $this->buildEmail( $args )->read( 'plaintext' ),
85 85
             'pretext' => $args['title'],
86
-        ]);
86
+        ] );
87 87
     }
88 88
 
89 89
     /**
@@ -92,24 +92,24 @@  discard block
 block discarded – undo
92 92
     protected function getEmailAddresses()
93 93
     {
94 94
         $emails = [];
95
-        if (in_array('admin', $this->types)) {
96
-            $emails[] = glsr(OptionManager::class)->getWP('admin_email');
95
+        if( in_array( 'admin', $this->types ) ) {
96
+            $emails[] = glsr( OptionManager::class )->getWP( 'admin_email' );
97 97
         }
98
-        if (in_array('author', $this->types)) {
99
-            $assignedPost = get_post(intval($this->review->assigned_to));
100
-            if ($assignedPost instanceof WP_Post) {
98
+        if( in_array( 'author', $this->types ) ) {
99
+            $assignedPost = get_post( intval( $this->review->assigned_to ) );
100
+            if( $assignedPost instanceof WP_Post ) {
101 101
                 $this->email = true;
102
-                $emails[] = get_the_author_meta('user_email', intval($assignedPost->post_author));
102
+                $emails[] = get_the_author_meta( 'user_email', intval( $assignedPost->post_author ) );
103 103
             }
104 104
         }
105
-        if (in_array('custom', $this->types)) {
106
-            $customEmails = glsr(OptionManager::class)->get('settings.general.notification_email');
107
-            $customEmails = str_replace([' ', ',', ';'], ',', $customEmails);
108
-            $customEmails = explode(',', $customEmails);
109
-            $emails = array_merge($emails, $customEmails);
105
+        if( in_array( 'custom', $this->types ) ) {
106
+            $customEmails = glsr( OptionManager::class )->get( 'settings.general.notification_email' );
107
+            $customEmails = str_replace( [' ', ',', ';'], ',', $customEmails );
108
+            $customEmails = explode( ',', $customEmails );
109
+            $emails = array_merge( $emails, $customEmails );
110 110
         }
111
-        $emails = array_filter(array_keys(array_flip($emails)));
112
-        return apply_filters('site-reviews/notification/emails', $emails, $this->review);
111
+        $emails = array_filter( array_keys( array_flip( $emails ) ) );
112
+        return apply_filters( 'site-reviews/notification/emails', $emails, $this->review );
113 113
     }
114 114
 
115 115
     /**
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      */
118 118
     protected function getLink()
119 119
     {
120
-        return admin_url('post.php?post='.$this->review->ID.'&action=edit');
120
+        return admin_url( 'post.php?post='.$this->review->ID.'&action=edit' );
121 121
     }
122 122
 
123 123
     /**
@@ -125,29 +125,29 @@  discard block
 block discarded – undo
125 125
      */
126 126
     protected function getTitle()
127 127
     {
128
-        $assignedTitle = get_the_title(intval($this->review->assigned_to));
128
+        $assignedTitle = get_the_title( intval( $this->review->assigned_to ) );
129 129
         $title = _nx(
130 130
             'New %s-star review',
131 131
             'New %s-star review of: %s',
132
-            intval(empty($assignedTitle)),
132
+            intval( empty($assignedTitle) ),
133 133
             'This string differs depending on whether or not the review has been assigned to a post.',
134 134
             'site-reviews'
135 135
         );
136
-        $title = sprintf('[%s] %s',
137
-            wp_specialchars_decode(glsr(OptionManager::class)->getWP('blogname'), ENT_QUOTES),
138
-            sprintf($title, $this->review->rating, $assignedTitle)
136
+        $title = sprintf( '[%s] %s',
137
+            wp_specialchars_decode( glsr( OptionManager::class )->getWP( 'blogname' ), ENT_QUOTES ),
138
+            sprintf( $title, $this->review->rating, $assignedTitle )
139 139
         );
140
-        return apply_filters('site-reviews/notification/title', $title, $this->review);
140
+        return apply_filters( 'site-reviews/notification/title', $title, $this->review );
141 141
     }
142 142
 
143 143
     /**
144 144
      * @return void
145 145
      */
146
-    protected function sendToEmail(array $args)
146
+    protected function sendToEmail( array $args )
147 147
     {
148
-        $email = $this->buildEmail($args);
149
-        if (empty($email->to)) {
150
-            glsr_log()->error('Email notification was not sent (missing email address)');
148
+        $email = $this->buildEmail( $args );
149
+        if( empty($email->to) ) {
150
+            glsr_log()->error( 'Email notification was not sent (missing email address)' );
151 151
             return;
152 152
         }
153 153
         $email->send();
@@ -156,16 +156,16 @@  discard block
 block discarded – undo
156 156
     /**
157 157
      * @return void
158 158
      */
159
-    protected function sendToSlack(array $args)
159
+    protected function sendToSlack( array $args )
160 160
     {
161
-        if (!$this->slack) {
161
+        if( !$this->slack ) {
162 162
             return;
163 163
         }
164
-        $notification = $this->buildSlackNotification($args);
164
+        $notification = $this->buildSlackNotification( $args );
165 165
         $result = $notification->send();
166
-        if (is_wp_error($result)) {
166
+        if( is_wp_error( $result ) ) {
167 167
             $notification->review = null;
168
-            glsr_log()->error($result->get_error_message())->debug($notification);
168
+            glsr_log()->error( $result->get_error_message() )->debug( $notification );
169 169
         }
170 170
     }
171 171
 }
Please login to merge, or discard this patch.
plugin/Controllers/EditorController/Customization.php 2 patches
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -7,84 +7,84 @@
 block discarded – undo
7 7
 
8 8
 class Customization
9 9
 {
10
-    /**
11
-     * @return array
12
-     */
13
-    public function filterEditorSettings(array $settings)
14
-    {
15
-        if ($this->isReviewEditable()) {
16
-            $settings = [
17
-                'media_buttons' => false,
18
-                'quicktags' => false,
19
-                'textarea_rows' => 12,
20
-                'tinymce' => false,
21
-            ];
22
-        }
23
-        return $settings;
24
-    }
10
+	/**
11
+	 * @return array
12
+	 */
13
+	public function filterEditorSettings(array $settings)
14
+	{
15
+		if ($this->isReviewEditable()) {
16
+			$settings = [
17
+				'media_buttons' => false,
18
+				'quicktags' => false,
19
+				'textarea_rows' => 12,
20
+				'tinymce' => false,
21
+			];
22
+		}
23
+		return $settings;
24
+	}
25 25
 
26
-    /**
27
-     * @param string $html
28
-     * @return string
29
-     */
30
-    public function filterEditorTextarea($html)
31
-    {
32
-        if ($this->isReviewEditable()) {
33
-            $html = str_replace('<textarea', '<div id="ed_toolbar"></div><textarea', $html);
34
-        }
35
-        return $html;
36
-    }
26
+	/**
27
+	 * @param string $html
28
+	 * @return string
29
+	 */
30
+	public function filterEditorTextarea($html)
31
+	{
32
+		if ($this->isReviewEditable()) {
33
+			$html = str_replace('<textarea', '<div id="ed_toolbar"></div><textarea', $html);
34
+		}
35
+		return $html;
36
+	}
37 37
 
38
-    /**
39
-     * @return void
40
-     */
41
-    public function removeAutosave()
42
-    {
43
-        if (!$this->isReviewEditor() || $this->isReviewEditable()) {
44
-            return;
45
-        }
46
-        wp_deregister_script('autosave');
47
-    }
38
+	/**
39
+	 * @return void
40
+	 */
41
+	public function removeAutosave()
42
+	{
43
+		if (!$this->isReviewEditor() || $this->isReviewEditable()) {
44
+			return;
45
+		}
46
+		wp_deregister_script('autosave');
47
+	}
48 48
 
49
-    /**
50
-     * @return void
51
-     */
52
-    public function removeMetaBoxes()
53
-    {
54
-        remove_meta_box('slugdiv', Application::POST_TYPE, 'advanced');
55
-    }
49
+	/**
50
+	 * @return void
51
+	 */
52
+	public function removeMetaBoxes()
53
+	{
54
+		remove_meta_box('slugdiv', Application::POST_TYPE, 'advanced');
55
+	}
56 56
 
57
-    /**
58
-     * @return void
59
-     */
60
-    public function removePostTypeSupport()
61
-    {
62
-        if (!$this->isReviewEditor() || $this->isReviewEditable()) {
63
-            return;
64
-        }
65
-        remove_post_type_support(Application::POST_TYPE, 'title');
66
-        remove_post_type_support(Application::POST_TYPE, 'editor');
67
-    }
57
+	/**
58
+	 * @return void
59
+	 */
60
+	public function removePostTypeSupport()
61
+	{
62
+		if (!$this->isReviewEditor() || $this->isReviewEditable()) {
63
+			return;
64
+		}
65
+		remove_post_type_support(Application::POST_TYPE, 'title');
66
+		remove_post_type_support(Application::POST_TYPE, 'editor');
67
+	}
68 68
 
69
-    /**
70
-     * @return bool
71
-     */
72
-    protected function isReviewEditable()
73
-    {
74
-        $postId = intval(filter_input(INPUT_GET, 'post'));
75
-        return $postId > 0
76
-            && 'local' == glsr(Database::class)->get($postId, 'review_type')
77
-            && $this->isReviewEditor();
78
-    }
69
+	/**
70
+	 * @return bool
71
+	 */
72
+	protected function isReviewEditable()
73
+	{
74
+		$postId = intval(filter_input(INPUT_GET, 'post'));
75
+		return $postId > 0
76
+			&& 'local' == glsr(Database::class)->get($postId, 'review_type')
77
+			&& $this->isReviewEditor();
78
+	}
79 79
 
80
-    /**
81
-     * @return bool
82
-     */
83
-    protected function isReviewEditor()
84
-    {
85
-        $screen = glsr_current_screen();
86
-        return 'post' == $screen->base
87
-            && Application::POST_TYPE == $screen->id
88
-            && Application::POST_TYPE == $screen->post_type;
89
-    }
80
+	/**
81
+	 * @return bool
82
+	 */
83
+	protected function isReviewEditor()
84
+	{
85
+		$screen = glsr_current_screen();
86
+		return 'post' == $screen->base
87
+			&& Application::POST_TYPE == $screen->id
88
+			&& Application::POST_TYPE == $screen->post_type;
89
+	}
90 90
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -10,9 +10,9 @@  discard block
 block discarded – undo
10 10
     /**
11 11
      * @return array
12 12
      */
13
-    public function filterEditorSettings(array $settings)
13
+    public function filterEditorSettings( array $settings )
14 14
     {
15
-        if ($this->isReviewEditable()) {
15
+        if( $this->isReviewEditable() ) {
16 16
             $settings = [
17 17
                 'media_buttons' => false,
18 18
                 'quicktags' => false,
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
      * @param string $html
28 28
      * @return string
29 29
      */
30
-    public function filterEditorTextarea($html)
30
+    public function filterEditorTextarea( $html )
31 31
     {
32
-        if ($this->isReviewEditable()) {
33
-            $html = str_replace('<textarea', '<div id="ed_toolbar"></div><textarea', $html);
32
+        if( $this->isReviewEditable() ) {
33
+            $html = str_replace( '<textarea', '<div id="ed_toolbar"></div><textarea', $html );
34 34
         }
35 35
         return $html;
36 36
     }
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public function removeAutosave()
42 42
     {
43
-        if (!$this->isReviewEditor() || $this->isReviewEditable()) {
43
+        if( !$this->isReviewEditor() || $this->isReviewEditable() ) {
44 44
             return;
45 45
         }
46
-        wp_deregister_script('autosave');
46
+        wp_deregister_script( 'autosave' );
47 47
     }
48 48
 
49 49
     /**
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      */
52 52
     public function removeMetaBoxes()
53 53
     {
54
-        remove_meta_box('slugdiv', Application::POST_TYPE, 'advanced');
54
+        remove_meta_box( 'slugdiv', Application::POST_TYPE, 'advanced' );
55 55
     }
56 56
 
57 57
     /**
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
      */
60 60
     public function removePostTypeSupport()
61 61
     {
62
-        if (!$this->isReviewEditor() || $this->isReviewEditable()) {
62
+        if( !$this->isReviewEditor() || $this->isReviewEditable() ) {
63 63
             return;
64 64
         }
65
-        remove_post_type_support(Application::POST_TYPE, 'title');
66
-        remove_post_type_support(Application::POST_TYPE, 'editor');
65
+        remove_post_type_support( Application::POST_TYPE, 'title' );
66
+        remove_post_type_support( Application::POST_TYPE, 'editor' );
67 67
     }
68 68
 
69 69
     /**
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
      */
72 72
     protected function isReviewEditable()
73 73
     {
74
-        $postId = intval(filter_input(INPUT_GET, 'post'));
74
+        $postId = intval( filter_input( INPUT_GET, 'post' ) );
75 75
         return $postId > 0
76
-            && 'local' == glsr(Database::class)->get($postId, 'review_type')
76
+            && 'local' == glsr( Database::class )->get( $postId, 'review_type' )
77 77
             && $this->isReviewEditor();
78 78
     }
79 79
 
Please login to merge, or discard this patch.
plugin/Controllers/SettingsController.php 3 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -108,7 +108,8 @@
 block discarded – undo
108 108
                 constant($integrationClass.'::PLUGIN_NAME')
109 109
             ));
110 110
             return false;
111
-        } elseif (!glsr($integrationClass)->isSupported()) {
111
+        }
112
+        elseif (!glsr($integrationClass)->isSupported()) {
112 113
             glsr(Notice::class)->addError(sprintf(
113 114
                 __('Please update the %s plugin to v%s or greater to enable integration.', 'site-reviews'),
114 115
                 constant($integrationClass.'::PLUGIN_NAME'),
Please login to merge, or discard this patch.
Indentation   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -9,120 +9,120 @@
 block discarded – undo
9 9
 
10 10
 class SettingsController extends Controller
11 11
 {
12
-    /**
13
-     * @param mixed $input
14
-     * @return array
15
-     * @callback register_setting
16
-     */
17
-    public function callbackRegisterSettings($input)
18
-    {
19
-        $settings = Arr::consolidateArray($input);
20
-        if (1 === count($settings) && array_key_exists('settings', $settings)) {
21
-            $options = array_replace_recursive(glsr(OptionManager::class)->all(), $input);
22
-            $options = $this->sanitizeGeneral($input, $options);
23
-            $options = $this->sanitizeSubmissions($input, $options);
24
-            $options = $this->sanitizeTranslations($input, $options);
25
-            $options = apply_filters('site-reviews/settings/callback', $options, $settings);
26
-            if (filter_input(INPUT_POST, 'option_page') == Application::ID.'-settings') {
27
-                glsr(Notice::class)->addSuccess(__('Settings updated.', 'site-reviews'));
28
-            }
29
-            return $options;
30
-        }
31
-        return $input;
32
-    }
12
+	/**
13
+	 * @param mixed $input
14
+	 * @return array
15
+	 * @callback register_setting
16
+	 */
17
+	public function callbackRegisterSettings($input)
18
+	{
19
+		$settings = Arr::consolidateArray($input);
20
+		if (1 === count($settings) && array_key_exists('settings', $settings)) {
21
+			$options = array_replace_recursive(glsr(OptionManager::class)->all(), $input);
22
+			$options = $this->sanitizeGeneral($input, $options);
23
+			$options = $this->sanitizeSubmissions($input, $options);
24
+			$options = $this->sanitizeTranslations($input, $options);
25
+			$options = apply_filters('site-reviews/settings/callback', $options, $settings);
26
+			if (filter_input(INPUT_POST, 'option_page') == Application::ID.'-settings') {
27
+				glsr(Notice::class)->addSuccess(__('Settings updated.', 'site-reviews'));
28
+			}
29
+			return $options;
30
+		}
31
+		return $input;
32
+	}
33 33
 
34
-    /**
35
-     * @return void
36
-     * @action admin_init
37
-     */
38
-    public function registerSettings()
39
-    {
40
-        register_setting(Application::ID.'-settings', OptionManager::databaseKey(), [
41
-            'sanitize_callback' => [$this, 'callbackRegisterSettings'],
42
-        ]);
43
-    }
34
+	/**
35
+	 * @return void
36
+	 * @action admin_init
37
+	 */
38
+	public function registerSettings()
39
+	{
40
+		register_setting(Application::ID.'-settings', OptionManager::databaseKey(), [
41
+			'sanitize_callback' => [$this, 'callbackRegisterSettings'],
42
+		]);
43
+	}
44 44
 
45
-    /**
46
-     * @return array
47
-     */
48
-    protected function sanitizeGeneral(array $input, array $options)
49
-    {
50
-        $key = 'settings.general';
51
-        $inputForm = Arr::get($input, $key);
52
-        if (!$this->hasMultilingualIntegration(Arr::get($inputForm, 'multilingual'))) {
53
-            $options = Arr::set($options, $key.'.multilingual', '');
54
-        }
55
-        if ('' == trim(Arr::get($inputForm, 'notification_message'))) {
56
-            $defaultValue = Arr::get(glsr()->defaults, $key.'.notification_message');
57
-            $options = Arr::set($options, $key.'.notification_message', $defaultValue);
58
-        }
59
-        $defaultValue = Arr::get($inputForm, 'notifications', []);
60
-        $options = Arr::set($options, $key.'.notifications', $defaultValue);
61
-        return $options;
62
-    }
45
+	/**
46
+	 * @return array
47
+	 */
48
+	protected function sanitizeGeneral(array $input, array $options)
49
+	{
50
+		$key = 'settings.general';
51
+		$inputForm = Arr::get($input, $key);
52
+		if (!$this->hasMultilingualIntegration(Arr::get($inputForm, 'multilingual'))) {
53
+			$options = Arr::set($options, $key.'.multilingual', '');
54
+		}
55
+		if ('' == trim(Arr::get($inputForm, 'notification_message'))) {
56
+			$defaultValue = Arr::get(glsr()->defaults, $key.'.notification_message');
57
+			$options = Arr::set($options, $key.'.notification_message', $defaultValue);
58
+		}
59
+		$defaultValue = Arr::get($inputForm, 'notifications', []);
60
+		$options = Arr::set($options, $key.'.notifications', $defaultValue);
61
+		return $options;
62
+	}
63 63
 
64
-    /**
65
-     * @return array
66
-     */
67
-    protected function sanitizeSubmissions(array $input, array $options)
68
-    {
69
-        $key = 'settings.submissions';
70
-        $inputForm = Arr::get($input, $key);
71
-        $defaultValue = isset($inputForm['required'])
72
-            ? $inputForm['required']
73
-            : [];
74
-        $options = Arr::set($options, $key.'.required', $defaultValue);
75
-        return $options;
76
-    }
64
+	/**
65
+	 * @return array
66
+	 */
67
+	protected function sanitizeSubmissions(array $input, array $options)
68
+	{
69
+		$key = 'settings.submissions';
70
+		$inputForm = Arr::get($input, $key);
71
+		$defaultValue = isset($inputForm['required'])
72
+			? $inputForm['required']
73
+			: [];
74
+		$options = Arr::set($options, $key.'.required', $defaultValue);
75
+		return $options;
76
+	}
77 77
 
78
-    /**
79
-     * @return array
80
-     */
81
-    protected function sanitizeTranslations(array $input, array $options)
82
-    {
83
-        $key = 'settings.strings';
84
-        $inputForm = Arr::consolidateArray(Arr::get($input, $key));
85
-        if (!empty($inputForm)) {
86
-            $options = Arr::set($options, $key, array_values(array_filter($inputForm)));
87
-            $allowedTags = [
88
-                'a' => ['class' => [], 'href' => [], 'target' => []],
89
-                'span' => ['class' => []],
90
-            ];
91
-            array_walk($options['settings']['strings'], function (&$string) use ($allowedTags) {
92
-                if (isset($string['s2'])) {
93
-                    $string['s2'] = wp_kses($string['s2'], $allowedTags);
94
-                }
95
-                if (isset($string['p2'])) {
96
-                    $string['p2'] = wp_kses($string['p2'], $allowedTags);
97
-                }
98
-            });
99
-        }
100
-        return $options;
101
-    }
78
+	/**
79
+	 * @return array
80
+	 */
81
+	protected function sanitizeTranslations(array $input, array $options)
82
+	{
83
+		$key = 'settings.strings';
84
+		$inputForm = Arr::consolidateArray(Arr::get($input, $key));
85
+		if (!empty($inputForm)) {
86
+			$options = Arr::set($options, $key, array_values(array_filter($inputForm)));
87
+			$allowedTags = [
88
+				'a' => ['class' => [], 'href' => [], 'target' => []],
89
+				'span' => ['class' => []],
90
+			];
91
+			array_walk($options['settings']['strings'], function (&$string) use ($allowedTags) {
92
+				if (isset($string['s2'])) {
93
+					$string['s2'] = wp_kses($string['s2'], $allowedTags);
94
+				}
95
+				if (isset($string['p2'])) {
96
+					$string['p2'] = wp_kses($string['p2'], $allowedTags);
97
+				}
98
+			});
99
+		}
100
+		return $options;
101
+	}
102 102
 
103
-    /**
104
-     * @return bool
105
-     */
106
-    protected function hasMultilingualIntegration($integration)
107
-    {
108
-        if (!in_array($integration, ['polylang', 'wpml'])) {
109
-            return false;
110
-        }
111
-        $integrationClass = 'GeminiLabs\SiteReviews\Modules\\'.ucfirst($integration);
112
-        if (!glsr($integrationClass)->isActive()) {
113
-            glsr(Notice::class)->addError(sprintf(
114
-                __('Please install/activate the %s plugin to enable integration.', 'site-reviews'),
115
-                constant($integrationClass.'::PLUGIN_NAME')
116
-            ));
117
-            return false;
118
-        } elseif (!glsr($integrationClass)->isSupported()) {
119
-            glsr(Notice::class)->addError(sprintf(
120
-                __('Please update the %s plugin to v%s or greater to enable integration.', 'site-reviews'),
121
-                constant($integrationClass.'::PLUGIN_NAME'),
122
-                constant($integrationClass.'::SUPPORTED_VERSION')
123
-            ));
124
-            return false;
125
-        }
126
-        return true;
127
-    }
103
+	/**
104
+	 * @return bool
105
+	 */
106
+	protected function hasMultilingualIntegration($integration)
107
+	{
108
+		if (!in_array($integration, ['polylang', 'wpml'])) {
109
+			return false;
110
+		}
111
+		$integrationClass = 'GeminiLabs\SiteReviews\Modules\\'.ucfirst($integration);
112
+		if (!glsr($integrationClass)->isActive()) {
113
+			glsr(Notice::class)->addError(sprintf(
114
+				__('Please install/activate the %s plugin to enable integration.', 'site-reviews'),
115
+				constant($integrationClass.'::PLUGIN_NAME')
116
+			));
117
+			return false;
118
+		} elseif (!glsr($integrationClass)->isSupported()) {
119
+			glsr(Notice::class)->addError(sprintf(
120
+				__('Please update the %s plugin to v%s or greater to enable integration.', 'site-reviews'),
121
+				constant($integrationClass.'::PLUGIN_NAME'),
122
+				constant($integrationClass.'::SUPPORTED_VERSION')
123
+			));
124
+			return false;
125
+		}
126
+		return true;
127
+	}
128 128
 }
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -14,17 +14,17 @@  discard block
 block discarded – undo
14 14
      * @return array
15 15
      * @callback register_setting
16 16
      */
17
-    public function callbackRegisterSettings($input)
17
+    public function callbackRegisterSettings( $input )
18 18
     {
19
-        $settings = Arr::consolidateArray($input);
20
-        if (1 === count($settings) && array_key_exists('settings', $settings)) {
21
-            $options = array_replace_recursive(glsr(OptionManager::class)->all(), $input);
22
-            $options = $this->sanitizeGeneral($input, $options);
23
-            $options = $this->sanitizeSubmissions($input, $options);
24
-            $options = $this->sanitizeTranslations($input, $options);
25
-            $options = apply_filters('site-reviews/settings/callback', $options, $settings);
26
-            if (filter_input(INPUT_POST, 'option_page') == Application::ID.'-settings') {
27
-                glsr(Notice::class)->addSuccess(__('Settings updated.', 'site-reviews'));
19
+        $settings = Arr::consolidateArray( $input );
20
+        if( 1 === count( $settings ) && array_key_exists( 'settings', $settings ) ) {
21
+            $options = array_replace_recursive( glsr( OptionManager::class )->all(), $input );
22
+            $options = $this->sanitizeGeneral( $input, $options );
23
+            $options = $this->sanitizeSubmissions( $input, $options );
24
+            $options = $this->sanitizeTranslations( $input, $options );
25
+            $options = apply_filters( 'site-reviews/settings/callback', $options, $settings );
26
+            if( filter_input( INPUT_POST, 'option_page' ) == Application::ID.'-settings' ) {
27
+                glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ) );
28 28
             }
29 29
             return $options;
30 30
         }
@@ -37,63 +37,63 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function registerSettings()
39 39
     {
40
-        register_setting(Application::ID.'-settings', OptionManager::databaseKey(), [
40
+        register_setting( Application::ID.'-settings', OptionManager::databaseKey(), [
41 41
             'sanitize_callback' => [$this, 'callbackRegisterSettings'],
42
-        ]);
42
+        ] );
43 43
     }
44 44
 
45 45
     /**
46 46
      * @return array
47 47
      */
48
-    protected function sanitizeGeneral(array $input, array $options)
48
+    protected function sanitizeGeneral( array $input, array $options )
49 49
     {
50 50
         $key = 'settings.general';
51
-        $inputForm = Arr::get($input, $key);
52
-        if (!$this->hasMultilingualIntegration(Arr::get($inputForm, 'multilingual'))) {
53
-            $options = Arr::set($options, $key.'.multilingual', '');
51
+        $inputForm = Arr::get( $input, $key );
52
+        if( !$this->hasMultilingualIntegration( Arr::get( $inputForm, 'multilingual' ) ) ) {
53
+            $options = Arr::set( $options, $key.'.multilingual', '' );
54 54
         }
55
-        if ('' == trim(Arr::get($inputForm, 'notification_message'))) {
56
-            $defaultValue = Arr::get(glsr()->defaults, $key.'.notification_message');
57
-            $options = Arr::set($options, $key.'.notification_message', $defaultValue);
55
+        if( '' == trim( Arr::get( $inputForm, 'notification_message' ) ) ) {
56
+            $defaultValue = Arr::get( glsr()->defaults, $key.'.notification_message' );
57
+            $options = Arr::set( $options, $key.'.notification_message', $defaultValue );
58 58
         }
59
-        $defaultValue = Arr::get($inputForm, 'notifications', []);
60
-        $options = Arr::set($options, $key.'.notifications', $defaultValue);
59
+        $defaultValue = Arr::get( $inputForm, 'notifications', [] );
60
+        $options = Arr::set( $options, $key.'.notifications', $defaultValue );
61 61
         return $options;
62 62
     }
63 63
 
64 64
     /**
65 65
      * @return array
66 66
      */
67
-    protected function sanitizeSubmissions(array $input, array $options)
67
+    protected function sanitizeSubmissions( array $input, array $options )
68 68
     {
69 69
         $key = 'settings.submissions';
70
-        $inputForm = Arr::get($input, $key);
70
+        $inputForm = Arr::get( $input, $key );
71 71
         $defaultValue = isset($inputForm['required'])
72 72
             ? $inputForm['required']
73 73
             : [];
74
-        $options = Arr::set($options, $key.'.required', $defaultValue);
74
+        $options = Arr::set( $options, $key.'.required', $defaultValue );
75 75
         return $options;
76 76
     }
77 77
 
78 78
     /**
79 79
      * @return array
80 80
      */
81
-    protected function sanitizeTranslations(array $input, array $options)
81
+    protected function sanitizeTranslations( array $input, array $options )
82 82
     {
83 83
         $key = 'settings.strings';
84
-        $inputForm = Arr::consolidateArray(Arr::get($input, $key));
85
-        if (!empty($inputForm)) {
86
-            $options = Arr::set($options, $key, array_values(array_filter($inputForm)));
84
+        $inputForm = Arr::consolidateArray( Arr::get( $input, $key ) );
85
+        if( !empty($inputForm) ) {
86
+            $options = Arr::set( $options, $key, array_values( array_filter( $inputForm ) ) );
87 87
             $allowedTags = [
88 88
                 'a' => ['class' => [], 'href' => [], 'target' => []],
89 89
                 'span' => ['class' => []],
90 90
             ];
91
-            array_walk($options['settings']['strings'], function (&$string) use ($allowedTags) {
92
-                if (isset($string['s2'])) {
93
-                    $string['s2'] = wp_kses($string['s2'], $allowedTags);
91
+            array_walk( $options['settings']['strings'], function( &$string ) use ($allowedTags) {
92
+                if( isset($string['s2']) ) {
93
+                    $string['s2'] = wp_kses( $string['s2'], $allowedTags );
94 94
                 }
95
-                if (isset($string['p2'])) {
96
-                    $string['p2'] = wp_kses($string['p2'], $allowedTags);
95
+                if( isset($string['p2']) ) {
96
+                    $string['p2'] = wp_kses( $string['p2'], $allowedTags );
97 97
                 }
98 98
             });
99 99
         }
@@ -103,24 +103,24 @@  discard block
 block discarded – undo
103 103
     /**
104 104
      * @return bool
105 105
      */
106
-    protected function hasMultilingualIntegration($integration)
106
+    protected function hasMultilingualIntegration( $integration )
107 107
     {
108
-        if (!in_array($integration, ['polylang', 'wpml'])) {
108
+        if( !in_array( $integration, ['polylang', 'wpml'] ) ) {
109 109
             return false;
110 110
         }
111
-        $integrationClass = 'GeminiLabs\SiteReviews\Modules\\'.ucfirst($integration);
112
-        if (!glsr($integrationClass)->isActive()) {
113
-            glsr(Notice::class)->addError(sprintf(
114
-                __('Please install/activate the %s plugin to enable integration.', 'site-reviews'),
115
-                constant($integrationClass.'::PLUGIN_NAME')
116
-            ));
111
+        $integrationClass = 'GeminiLabs\SiteReviews\Modules\\'.ucfirst( $integration );
112
+        if( !glsr( $integrationClass )->isActive() ) {
113
+            glsr( Notice::class )->addError( sprintf(
114
+                __( 'Please install/activate the %s plugin to enable integration.', 'site-reviews' ),
115
+                constant( $integrationClass.'::PLUGIN_NAME' )
116
+            ) );
117 117
             return false;
118
-        } elseif (!glsr($integrationClass)->isSupported()) {
119
-            glsr(Notice::class)->addError(sprintf(
120
-                __('Please update the %s plugin to v%s or greater to enable integration.', 'site-reviews'),
121
-                constant($integrationClass.'::PLUGIN_NAME'),
122
-                constant($integrationClass.'::SUPPORTED_VERSION')
123
-            ));
118
+        } elseif( !glsr( $integrationClass )->isSupported() ) {
119
+            glsr( Notice::class )->addError( sprintf(
120
+                __( 'Please update the %s plugin to v%s or greater to enable integration.', 'site-reviews' ),
121
+                constant( $integrationClass.'::PLUGIN_NAME' ),
122
+                constant( $integrationClass.'::SUPPORTED_VERSION' )
123
+            ) );
124 124
             return false;
125 125
         }
126 126
         return true;
Please login to merge, or discard this patch.
plugin/Contracts/MultilingualContract.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -4,29 +4,29 @@
 block discarded – undo
4 4
 
5 5
 interface MultilingualContract
6 6
 {
7
-    /**
8
-     * @param int|string $postId
9
-     * @return \WP_Post|void|null
10
-     */
11
-    public function getPost($postId);
7
+	/**
8
+	 * @param int|string $postId
9
+	 * @return \WP_Post|void|null
10
+	 */
11
+	public function getPost($postId);
12 12
 
13
-    /**
14
-     * @return array
15
-     */
16
-    public function getPostIds(array $postIds);
13
+	/**
14
+	 * @return array
15
+	 */
16
+	public function getPostIds(array $postIds);
17 17
 
18
-    /**
19
-     * @return bool
20
-     */
21
-    public function isActive();
18
+	/**
19
+	 * @return bool
20
+	 */
21
+	public function isActive();
22 22
 
23
-    /**
24
-     * @return bool
25
-     */
26
-    public function isEnabled();
23
+	/**
24
+	 * @return bool
25
+	 */
26
+	public function isEnabled();
27 27
 
28
-    /**
29
-     * @return bool
30
-     */
31
-    public function isSupported();
28
+	/**
29
+	 * @return bool
30
+	 */
31
+	public function isSupported();
32 32
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@
 block discarded – undo
8 8
      * @param int|string $postId
9 9
      * @return \WP_Post|void|null
10 10
      */
11
-    public function getPost($postId);
11
+    public function getPost( $postId );
12 12
 
13 13
     /**
14 14
      * @return array
15 15
      */
16
-    public function getPostIds(array $postIds);
16
+    public function getPostIds( array $postIds );
17 17
 
18 18
     /**
19 19
      * @return bool
Please login to merge, or discard this patch.
plugin/Modules/Wpml.php 2 patches
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -7,83 +7,83 @@
 block discarded – undo
7 7
 
8 8
 class Wpml implements Contract
9 9
 {
10
-    const PLUGIN_NAME = 'WPML';
11
-    const SUPPORTED_VERSION = '3.3.5';
10
+	const PLUGIN_NAME = 'WPML';
11
+	const SUPPORTED_VERSION = '3.3.5';
12 12
 
13
-    /**
14
-     * {@inheritdoc}
15
-     */
16
-    public function getPost($postId)
17
-    {
18
-        $postId = trim($postId);
19
-        if (!is_numeric($postId)) {
20
-            return;
21
-        }
22
-        if ($this->isEnabled()) {
23
-            $postId = apply_filters('wpml_object_id', $postId, 'any', true);
24
-        }
25
-        return get_post(intval($postId));
26
-    }
13
+	/**
14
+	 * {@inheritdoc}
15
+	 */
16
+	public function getPost($postId)
17
+	{
18
+		$postId = trim($postId);
19
+		if (!is_numeric($postId)) {
20
+			return;
21
+		}
22
+		if ($this->isEnabled()) {
23
+			$postId = apply_filters('wpml_object_id', $postId, 'any', true);
24
+		}
25
+		return get_post(intval($postId));
26
+	}
27 27
 
28
-    /**
29
-     * {@inheritdoc}
30
-     */
31
-    public function getPostIds(array $postIds)
32
-    {
33
-        if (!$this->isEnabled()) {
34
-            return $postIds;
35
-        }
36
-        $newPostIds = [];
37
-        foreach ($this->cleanIds($postIds) as $postId) {
38
-            $postType = get_post_type($postId);
39
-            if (!$postType) {
40
-                continue;
41
-            }
42
-            $elementType = 'post_'.$postType;
43
-            $trid = apply_filters('wpml_element_trid', null, $postId, $elementType);
44
-            $translations = apply_filters('wpml_get_element_translations', null, $trid, $elementType);
45
-            if (!is_array($translations)) {
46
-                $translations = [];
47
-            }
48
-            $newPostIds = array_merge(
49
-                $newPostIds,
50
-                array_column($translations, 'element_id')
51
-            );
52
-        }
53
-        return $this->cleanIds($newPostIds);
54
-    }
28
+	/**
29
+	 * {@inheritdoc}
30
+	 */
31
+	public function getPostIds(array $postIds)
32
+	{
33
+		if (!$this->isEnabled()) {
34
+			return $postIds;
35
+		}
36
+		$newPostIds = [];
37
+		foreach ($this->cleanIds($postIds) as $postId) {
38
+			$postType = get_post_type($postId);
39
+			if (!$postType) {
40
+				continue;
41
+			}
42
+			$elementType = 'post_'.$postType;
43
+			$trid = apply_filters('wpml_element_trid', null, $postId, $elementType);
44
+			$translations = apply_filters('wpml_get_element_translations', null, $trid, $elementType);
45
+			if (!is_array($translations)) {
46
+				$translations = [];
47
+			}
48
+			$newPostIds = array_merge(
49
+				$newPostIds,
50
+				array_column($translations, 'element_id')
51
+			);
52
+		}
53
+		return $this->cleanIds($newPostIds);
54
+	}
55 55
 
56
-    /**
57
-     * {@inheritdoc}
58
-     */
59
-    public function isActive()
60
-    {
61
-        return defined('ICL_SITEPRESS_VERSION');
62
-    }
56
+	/**
57
+	 * {@inheritdoc}
58
+	 */
59
+	public function isActive()
60
+	{
61
+		return defined('ICL_SITEPRESS_VERSION');
62
+	}
63 63
 
64
-    /**
65
-     * {@inheritdoc}
66
-     */
67
-    public function isEnabled()
68
-    {
69
-        return $this->isActive()
70
-            && 'wpml' == glsr(OptionManager::class)->get('settings.general.multilingual');
71
-    }
64
+	/**
65
+	 * {@inheritdoc}
66
+	 */
67
+	public function isEnabled()
68
+	{
69
+		return $this->isActive()
70
+			&& 'wpml' == glsr(OptionManager::class)->get('settings.general.multilingual');
71
+	}
72 72
 
73
-    /**
74
-     * {@inheritdoc}
75
-     */
76
-    public function isSupported()
77
-    {
78
-        return $this->isActive()
79
-            && version_compare(ICL_SITEPRESS_VERSION, static::SUPPORTED_VERSION, '>=');
80
-    }
73
+	/**
74
+	 * {@inheritdoc}
75
+	 */
76
+	public function isSupported()
77
+	{
78
+		return $this->isActive()
79
+			&& version_compare(ICL_SITEPRESS_VERSION, static::SUPPORTED_VERSION, '>=');
80
+	}
81 81
 
82
-    /**
83
-     * @return array
84
-     */
85
-    protected function cleanIds(array $postIds)
86
-    {
87
-        return array_filter(array_unique($postIds));
88
-    }
82
+	/**
83
+	 * @return array
84
+	 */
85
+	protected function cleanIds(array $postIds)
86
+	{
87
+		return array_filter(array_unique($postIds));
88
+	}
89 89
 }
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -13,44 +13,44 @@  discard block
 block discarded – undo
13 13
     /**
14 14
      * {@inheritdoc}
15 15
      */
16
-    public function getPost($postId)
16
+    public function getPost( $postId )
17 17
     {
18
-        $postId = trim($postId);
19
-        if (!is_numeric($postId)) {
18
+        $postId = trim( $postId );
19
+        if( !is_numeric( $postId ) ) {
20 20
             return;
21 21
         }
22
-        if ($this->isEnabled()) {
23
-            $postId = apply_filters('wpml_object_id', $postId, 'any', true);
22
+        if( $this->isEnabled() ) {
23
+            $postId = apply_filters( 'wpml_object_id', $postId, 'any', true );
24 24
         }
25
-        return get_post(intval($postId));
25
+        return get_post( intval( $postId ) );
26 26
     }
27 27
 
28 28
     /**
29 29
      * {@inheritdoc}
30 30
      */
31
-    public function getPostIds(array $postIds)
31
+    public function getPostIds( array $postIds )
32 32
     {
33
-        if (!$this->isEnabled()) {
33
+        if( !$this->isEnabled() ) {
34 34
             return $postIds;
35 35
         }
36 36
         $newPostIds = [];
37
-        foreach ($this->cleanIds($postIds) as $postId) {
38
-            $postType = get_post_type($postId);
39
-            if (!$postType) {
37
+        foreach( $this->cleanIds( $postIds ) as $postId ) {
38
+            $postType = get_post_type( $postId );
39
+            if( !$postType ) {
40 40
                 continue;
41 41
             }
42 42
             $elementType = 'post_'.$postType;
43
-            $trid = apply_filters('wpml_element_trid', null, $postId, $elementType);
44
-            $translations = apply_filters('wpml_get_element_translations', null, $trid, $elementType);
45
-            if (!is_array($translations)) {
43
+            $trid = apply_filters( 'wpml_element_trid', null, $postId, $elementType );
44
+            $translations = apply_filters( 'wpml_get_element_translations', null, $trid, $elementType );
45
+            if( !is_array( $translations ) ) {
46 46
                 $translations = [];
47 47
             }
48 48
             $newPostIds = array_merge(
49 49
                 $newPostIds,
50
-                array_column($translations, 'element_id')
50
+                array_column( $translations, 'element_id' )
51 51
             );
52 52
         }
53
-        return $this->cleanIds($newPostIds);
53
+        return $this->cleanIds( $newPostIds );
54 54
     }
55 55
 
56 56
     /**
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      */
59 59
     public function isActive()
60 60
     {
61
-        return defined('ICL_SITEPRESS_VERSION');
61
+        return defined( 'ICL_SITEPRESS_VERSION' );
62 62
     }
63 63
 
64 64
     /**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     public function isEnabled()
68 68
     {
69 69
         return $this->isActive()
70
-            && 'wpml' == glsr(OptionManager::class)->get('settings.general.multilingual');
70
+            && 'wpml' == glsr( OptionManager::class )->get( 'settings.general.multilingual' );
71 71
     }
72 72
 
73 73
     /**
@@ -76,14 +76,14 @@  discard block
 block discarded – undo
76 76
     public function isSupported()
77 77
     {
78 78
         return $this->isActive()
79
-            && version_compare(ICL_SITEPRESS_VERSION, static::SUPPORTED_VERSION, '>=');
79
+            && version_compare( ICL_SITEPRESS_VERSION, static::SUPPORTED_VERSION, '>=' );
80 80
     }
81 81
 
82 82
     /**
83 83
      * @return array
84 84
      */
85
-    protected function cleanIds(array $postIds)
85
+    protected function cleanIds( array $postIds )
86 86
     {
87
-        return array_filter(array_unique($postIds));
87
+        return array_filter( array_unique( $postIds ) );
88 88
     }
89 89
 }
Please login to merge, or discard this patch.
plugin/Modules/Polylang.php 2 patches
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -7,79 +7,79 @@
 block discarded – undo
7 7
 
8 8
 class Polylang implements Contract
9 9
 {
10
-    const PLUGIN_NAME = 'Polylang';
11
-    const SUPPORTED_VERSION = '2.3';
10
+	const PLUGIN_NAME = 'Polylang';
11
+	const SUPPORTED_VERSION = '2.3';
12 12
 
13
-    /**
14
-     * {@inheritdoc}
15
-     */
16
-    public function getPost($postId)
17
-    {
18
-        $postId = trim($postId);
19
-        if (!is_numeric($postId)) {
20
-            return;
21
-        }
22
-        if ($this->isEnabled()) {
23
-            $polylangPostId = pll_get_post($postId, pll_get_post_language(get_the_ID()));
24
-        }
25
-        if (!empty($polylangPostId)) {
26
-            $postId = $polylangPostId;
27
-        }
28
-        return get_post(intval($postId));
29
-    }
13
+	/**
14
+	 * {@inheritdoc}
15
+	 */
16
+	public function getPost($postId)
17
+	{
18
+		$postId = trim($postId);
19
+		if (!is_numeric($postId)) {
20
+			return;
21
+		}
22
+		if ($this->isEnabled()) {
23
+			$polylangPostId = pll_get_post($postId, pll_get_post_language(get_the_ID()));
24
+		}
25
+		if (!empty($polylangPostId)) {
26
+			$postId = $polylangPostId;
27
+		}
28
+		return get_post(intval($postId));
29
+	}
30 30
 
31
-    /**
32
-     * {@inheritdoc}
33
-     */
34
-    public function getPostIds(array $postIds)
35
-    {
36
-        if (!$this->isEnabled()) {
37
-            return $postIds;
38
-        }
39
-        $newPostIds = [];
40
-        foreach ($this->cleanIds($postIds) as $postId) {
41
-            $newPostIds = array_merge(
42
-                $newPostIds,
43
-                array_values(pll_get_post_translations($postId))
44
-            );
45
-        }
46
-        return $this->cleanIds($newPostIds);
47
-    }
31
+	/**
32
+	 * {@inheritdoc}
33
+	 */
34
+	public function getPostIds(array $postIds)
35
+	{
36
+		if (!$this->isEnabled()) {
37
+			return $postIds;
38
+		}
39
+		$newPostIds = [];
40
+		foreach ($this->cleanIds($postIds) as $postId) {
41
+			$newPostIds = array_merge(
42
+				$newPostIds,
43
+				array_values(pll_get_post_translations($postId))
44
+			);
45
+		}
46
+		return $this->cleanIds($newPostIds);
47
+	}
48 48
 
49
-    /**
50
-     * {@inheritdoc}
51
-     */
52
-    public function isActive()
53
-    {
54
-        return function_exists('PLL')
55
-            && function_exists('pll_get_post')
56
-            && function_exists('pll_get_post_language')
57
-            && function_exists('pll_get_post_translations');
58
-    }
49
+	/**
50
+	 * {@inheritdoc}
51
+	 */
52
+	public function isActive()
53
+	{
54
+		return function_exists('PLL')
55
+			&& function_exists('pll_get_post')
56
+			&& function_exists('pll_get_post_language')
57
+			&& function_exists('pll_get_post_translations');
58
+	}
59 59
 
60
-    /**
61
-     * {@inheritdoc}
62
-     */
63
-    public function isEnabled()
64
-    {
65
-        return $this->isActive()
66
-            && 'polylang' == glsr(OptionManager::class)->get('settings.general.multilingual');
67
-    }
60
+	/**
61
+	 * {@inheritdoc}
62
+	 */
63
+	public function isEnabled()
64
+	{
65
+		return $this->isActive()
66
+			&& 'polylang' == glsr(OptionManager::class)->get('settings.general.multilingual');
67
+	}
68 68
 
69
-    /**
70
-     * {@inheritdoc}
71
-     */
72
-    public function isSupported()
73
-    {
74
-        return defined('POLYLANG_VERSION')
75
-            && version_compare(POLYLANG_VERSION, static::SUPPORTED_VERSION, '>=');
76
-    }
69
+	/**
70
+	 * {@inheritdoc}
71
+	 */
72
+	public function isSupported()
73
+	{
74
+		return defined('POLYLANG_VERSION')
75
+			&& version_compare(POLYLANG_VERSION, static::SUPPORTED_VERSION, '>=');
76
+	}
77 77
 
78
-    /**
79
-     * @return array
80
-     */
81
-    protected function cleanIds(array $postIds)
82
-    {
83
-        return array_filter(array_unique($postIds));
84
-    }
78
+	/**
79
+	 * @return array
80
+	 */
81
+	protected function cleanIds(array $postIds)
82
+	{
83
+		return array_filter(array_unique($postIds));
84
+	}
85 85
 }
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -13,37 +13,37 @@  discard block
 block discarded – undo
13 13
     /**
14 14
      * {@inheritdoc}
15 15
      */
16
-    public function getPost($postId)
16
+    public function getPost( $postId )
17 17
     {
18
-        $postId = trim($postId);
19
-        if (!is_numeric($postId)) {
18
+        $postId = trim( $postId );
19
+        if( !is_numeric( $postId ) ) {
20 20
             return;
21 21
         }
22
-        if ($this->isEnabled()) {
23
-            $polylangPostId = pll_get_post($postId, pll_get_post_language(get_the_ID()));
22
+        if( $this->isEnabled() ) {
23
+            $polylangPostId = pll_get_post( $postId, pll_get_post_language( get_the_ID() ) );
24 24
         }
25
-        if (!empty($polylangPostId)) {
25
+        if( !empty($polylangPostId) ) {
26 26
             $postId = $polylangPostId;
27 27
         }
28
-        return get_post(intval($postId));
28
+        return get_post( intval( $postId ) );
29 29
     }
30 30
 
31 31
     /**
32 32
      * {@inheritdoc}
33 33
      */
34
-    public function getPostIds(array $postIds)
34
+    public function getPostIds( array $postIds )
35 35
     {
36
-        if (!$this->isEnabled()) {
36
+        if( !$this->isEnabled() ) {
37 37
             return $postIds;
38 38
         }
39 39
         $newPostIds = [];
40
-        foreach ($this->cleanIds($postIds) as $postId) {
40
+        foreach( $this->cleanIds( $postIds ) as $postId ) {
41 41
             $newPostIds = array_merge(
42 42
                 $newPostIds,
43
-                array_values(pll_get_post_translations($postId))
43
+                array_values( pll_get_post_translations( $postId ) )
44 44
             );
45 45
         }
46
-        return $this->cleanIds($newPostIds);
46
+        return $this->cleanIds( $newPostIds );
47 47
     }
48 48
 
49 49
     /**
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
      */
52 52
     public function isActive()
53 53
     {
54
-        return function_exists('PLL')
55
-            && function_exists('pll_get_post')
56
-            && function_exists('pll_get_post_language')
57
-            && function_exists('pll_get_post_translations');
54
+        return function_exists( 'PLL' )
55
+            && function_exists( 'pll_get_post' )
56
+            && function_exists( 'pll_get_post_language' )
57
+            && function_exists( 'pll_get_post_translations' );
58 58
     }
59 59
 
60 60
     /**
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     public function isEnabled()
64 64
     {
65 65
         return $this->isActive()
66
-            && 'polylang' == glsr(OptionManager::class)->get('settings.general.multilingual');
66
+            && 'polylang' == glsr( OptionManager::class )->get( 'settings.general.multilingual' );
67 67
     }
68 68
 
69 69
     /**
@@ -71,15 +71,15 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function isSupported()
73 73
     {
74
-        return defined('POLYLANG_VERSION')
75
-            && version_compare(POLYLANG_VERSION, static::SUPPORTED_VERSION, '>=');
74
+        return defined( 'POLYLANG_VERSION' )
75
+            && version_compare( POLYLANG_VERSION, static::SUPPORTED_VERSION, '>=' );
76 76
     }
77 77
 
78 78
     /**
79 79
      * @return array
80 80
      */
81
-    protected function cleanIds(array $postIds)
81
+    protected function cleanIds( array $postIds )
82 82
     {
83
-        return array_filter(array_unique($postIds));
83
+        return array_filter( array_unique( $postIds ) );
84 84
     }
85 85
 }
Please login to merge, or discard this patch.
plugin/Defaults/EmailDefaults.php 2 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -7,40 +7,40 @@
 block discarded – undo
7 7
 
8 8
 class EmailDefaults extends Defaults
9 9
 {
10
-    /**
11
-     * @return array
12
-     */
13
-    protected function defaults()
14
-    {
15
-        return [
16
-            'after' => '',
17
-            'attachments' => [],
18
-            'bcc' => '',
19
-            'before' => '',
20
-            'cc' => '',
21
-            'from' => $this->getFromName().' <'.$this->getFromEmail().'>',
22
-            'message' => '',
23
-            'reply-to' => '',
24
-            'subject' => '',
25
-            'template' => '',
26
-            'template-tags' => [],
27
-            'to' => '',
28
-        ];
29
-    }
10
+	/**
11
+	 * @return array
12
+	 */
13
+	protected function defaults()
14
+	{
15
+		return [
16
+			'after' => '',
17
+			'attachments' => [],
18
+			'bcc' => '',
19
+			'before' => '',
20
+			'cc' => '',
21
+			'from' => $this->getFromName().' <'.$this->getFromEmail().'>',
22
+			'message' => '',
23
+			'reply-to' => '',
24
+			'subject' => '',
25
+			'template' => '',
26
+			'template-tags' => [],
27
+			'to' => '',
28
+		];
29
+	}
30 30
 
31
-    /**
32
-     * @return string
33
-     */
34
-    protected function getFromEmail()
35
-    {
36
-        return glsr(OptionManager::class)->getWP('admin_email');
37
-    }
31
+	/**
32
+	 * @return string
33
+	 */
34
+	protected function getFromEmail()
35
+	{
36
+		return glsr(OptionManager::class)->getWP('admin_email');
37
+	}
38 38
 
39
-    /**
40
-     * @return string
41
-     */
42
-    protected function getFromName()
43
-    {
44
-        return wp_specialchars_decode(glsr(OptionManager::class)->getWP('blogname'), ENT_QUOTES);
45
-    }
39
+	/**
40
+	 * @return string
41
+	 */
42
+	protected function getFromName()
43
+	{
44
+		return wp_specialchars_decode(glsr(OptionManager::class)->getWP('blogname'), ENT_QUOTES);
45
+	}
46 46
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      */
34 34
     protected function getFromEmail()
35 35
     {
36
-        return glsr(OptionManager::class)->getWP('admin_email');
36
+        return glsr( OptionManager::class )->getWP( 'admin_email' );
37 37
     }
38 38
 
39 39
     /**
@@ -41,6 +41,6 @@  discard block
 block discarded – undo
41 41
      */
42 42
     protected function getFromName()
43 43
     {
44
-        return wp_specialchars_decode(glsr(OptionManager::class)->getWP('blogname'), ENT_QUOTES);
44
+        return wp_specialchars_decode( glsr( OptionManager::class )->getWP( 'blogname' ), ENT_QUOTES );
45 45
     }
46 46
 }
Please login to merge, or discard this patch.
views/pages/welcome/whatsnew.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3 3
 <p class="about-description">We think you'll love the changes in this new release!</p>
4 4
 <div class="is-fullwidth">
Please login to merge, or discard this patch.
views/pages/welcome/index.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,23 +1,23 @@
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3 3
 <div class="glsr-welcome wrap about-wrap about-wrap-content">
4 4
     <h1>Welcome to <?= glsr()->name; ?></h1>
5 5
     <div class="about-text">Site Reviews is a free WordPress review plugin with advanced features that makes it easy to manage reviews on your website. Follow the instructions below to get started!</div>
6 6
     <div class="wp-badge">Version <?= glsr()->version; ?></div>
7 7
     <p class="about-buttons">
8
-        <a class="button" href="<?= admin_url('edit.php?post_type=site-review&page=documentation'); ?>">Documentation</a>
8
+        <a class="button" href="<?= admin_url( 'edit.php?post_type=site-review&page=documentation' ); ?>">Documentation</a>
9 9
         <a class="button" href="https://wordpress.org/support/plugin/site-reviews/">Support</a>
10 10
         <a target="_blank" class="button" href="https://www.facebook.com/sharer/sharer.php?u=https%3A//geminilabs.io/site-reviews"><span class="dashicons dashicons-facebook-alt"></span> Share</a>
11 11
         <a target="_blank" class="button" href="https://twitter.com/intent/tweet?text=Site Reviews is a fantastic WordPress review plugin with advanced features that makes it easy to manage reviews on your website.&url=https://geminilabs.io/site-reviews&hashtags=WordPress,reviewplugins,"><span class="dashicons dashicons-twitter"></span> Tweet</a>
12 12
     </p>
13 13
     <nav class="glsr-nav-tab-wrapper nav-tab-wrapper">
14
-        <?php foreach ($tabs as $id => $title) : ?>
14
+        <?php foreach( $tabs as $id => $title ) : ?>
15 15
         <a class="glsr-nav-tab nav-tab" href="#<?= $id; ?>"><?= $title; ?></a>
16 16
         <?php endforeach; ?>
17 17
     </nav>
18
-    <?php foreach ($tabs as $id => $title) : ?>
18
+    <?php foreach( $tabs as $id => $title ) : ?>
19 19
     <div class="glsr-nav-view ui-tabs-hide" id="<?= $id; ?>">
20
-        <?php $template->render('pages/welcome/'.$id, $data); ?>
20
+        <?php $template->render( 'pages/welcome/'.$id, $data ); ?>
21 21
     </div>
22 22
     <?php endforeach; ?>
23 23
     <input type="hidden" name="_active_tab">
Please login to merge, or discard this patch.