Passed
Push — master ( ccb079...7906b4 )
by Paul
04:39
created
plugin/Router.php 2 patches
Indentation   +147 added lines, -147 removed lines patch added patch discarded remove patch
@@ -7,162 +7,162 @@
 block discarded – undo
7 7
 
8 8
 class Router
9 9
 {
10
-    /**
11
-     * @var array
12
-     */
13
-    protected $unguardedActions = [];
10
+	/**
11
+	 * @var array
12
+	 */
13
+	protected $unguardedActions = [];
14 14
 
15
-    public function __construct()
16
-    {
17
-        $this->unguardedActions = apply_filters('site-reviews/router/unguarded-actions', [
18
-            'dismiss-notice',
19
-            'fetch-paged-reviews',
20
-        ]);
21
-    }
15
+	public function __construct()
16
+	{
17
+		$this->unguardedActions = apply_filters('site-reviews/router/unguarded-actions', [
18
+			'dismiss-notice',
19
+			'fetch-paged-reviews',
20
+		]);
21
+	}
22 22
 
23
-    /**
24
-     * @return void
25
-     */
26
-    public function routeAdminPostRequest()
27
-    {
28
-        $request = $this->getRequest();
29
-        if (!$this->isValidPostRequest($request)) {
30
-            return;
31
-        }
32
-        check_admin_referer($request['_action']);
33
-        $this->routeRequest('admin', $request['_action'], $request);
34
-    }
23
+	/**
24
+	 * @return void
25
+	 */
26
+	public function routeAdminPostRequest()
27
+	{
28
+		$request = $this->getRequest();
29
+		if (!$this->isValidPostRequest($request)) {
30
+			return;
31
+		}
32
+		check_admin_referer($request['_action']);
33
+		$this->routeRequest('admin', $request['_action'], $request);
34
+	}
35 35
 
36
-    /**
37
-     * @return void
38
-     */
39
-    public function routeAjaxRequest()
40
-    {
41
-        $request = $this->getRequest();
42
-        $this->checkAjaxRequest($request);
43
-        $this->checkAjaxNonce($request);
44
-        $this->routeRequest('ajax', $request['_action'], $request);
45
-        wp_die();
46
-    }
36
+	/**
37
+	 * @return void
38
+	 */
39
+	public function routeAjaxRequest()
40
+	{
41
+		$request = $this->getRequest();
42
+		$this->checkAjaxRequest($request);
43
+		$this->checkAjaxNonce($request);
44
+		$this->routeRequest('ajax', $request['_action'], $request);
45
+		wp_die();
46
+	}
47 47
 
48
-    /**
49
-     * @return void
50
-     */
51
-    public function routePublicPostRequest()
52
-    {
53
-        if (is_admin()) {
54
-            return;
55
-        }
56
-        $request = $this->getRequest();
57
-        if (!$this->isValidPostRequest($request)) {
58
-            return;
59
-        }
60
-        if (!$this->isValidPublicNonce($request)) {
61
-            return;
62
-        }
63
-        $this->routeRequest('public', $request['_action'], $request);
64
-    }
48
+	/**
49
+	 * @return void
50
+	 */
51
+	public function routePublicPostRequest()
52
+	{
53
+		if (is_admin()) {
54
+			return;
55
+		}
56
+		$request = $this->getRequest();
57
+		if (!$this->isValidPostRequest($request)) {
58
+			return;
59
+		}
60
+		if (!$this->isValidPublicNonce($request)) {
61
+			return;
62
+		}
63
+		$this->routeRequest('public', $request['_action'], $request);
64
+	}
65 65
 
66
-    /**
67
-     * @return void
68
-     */
69
-    protected function checkAjaxNonce(array $request)
70
-    {
71
-        if (!is_user_logged_in() || in_array(Arr::get($request, '_action'), $this->unguardedActions)) {
72
-            return;
73
-        }
74
-        if (!isset($request['_nonce'])) {
75
-            $this->sendAjaxError('request is missing a nonce', $request);
76
-        }
77
-        if (!wp_verify_nonce($request['_nonce'], $request['_action'])) {
78
-            $this->sendAjaxError('request failed the nonce check', $request, 403);
79
-        }
80
-    }
66
+	/**
67
+	 * @return void
68
+	 */
69
+	protected function checkAjaxNonce(array $request)
70
+	{
71
+		if (!is_user_logged_in() || in_array(Arr::get($request, '_action'), $this->unguardedActions)) {
72
+			return;
73
+		}
74
+		if (!isset($request['_nonce'])) {
75
+			$this->sendAjaxError('request is missing a nonce', $request);
76
+		}
77
+		if (!wp_verify_nonce($request['_nonce'], $request['_action'])) {
78
+			$this->sendAjaxError('request failed the nonce check', $request, 403);
79
+		}
80
+	}
81 81
 
82
-    /**
83
-     * @return void
84
-     */
85
-    protected function checkAjaxRequest(array $request)
86
-    {
87
-        if (!isset($request['_action'])) {
88
-            $this->sendAjaxError('request must include an action', $request);
89
-        }
90
-        if (empty($request['_ajax_request'])) {
91
-            $this->sendAjaxError('request is invalid', $request);
92
-        }
93
-    }
82
+	/**
83
+	 * @return void
84
+	 */
85
+	protected function checkAjaxRequest(array $request)
86
+	{
87
+		if (!isset($request['_action'])) {
88
+			$this->sendAjaxError('request must include an action', $request);
89
+		}
90
+		if (empty($request['_ajax_request'])) {
91
+			$this->sendAjaxError('request is invalid', $request);
92
+		}
93
+	}
94 94
 
95
-    /**
96
-     * All ajax requests in the plugin are triggered by a single action hook: glsr_action,
97
-     * while each ajax route is determined by $_POST[request][_action].
98
-     * @return array
99
-     */
100
-    protected function getRequest()
101
-    {
102
-        $request = Helper::filterInputArray(Application::ID);
103
-        if (Helper::filterInput('action') == Application::PREFIX.'action') {
104
-            $request['_ajax_request'] = true;
105
-        }
106
-        if ('submit-review' == Helper::filterInput('_action', $request)) {
107
-            $request['_recaptcha-token'] = Helper::filterInput('g-recaptcha-response');
108
-        }
109
-        return $request;
110
-    }
95
+	/**
96
+	 * All ajax requests in the plugin are triggered by a single action hook: glsr_action,
97
+	 * while each ajax route is determined by $_POST[request][_action].
98
+	 * @return array
99
+	 */
100
+	protected function getRequest()
101
+	{
102
+		$request = Helper::filterInputArray(Application::ID);
103
+		if (Helper::filterInput('action') == Application::PREFIX.'action') {
104
+			$request['_ajax_request'] = true;
105
+		}
106
+		if ('submit-review' == Helper::filterInput('_action', $request)) {
107
+			$request['_recaptcha-token'] = Helper::filterInput('g-recaptcha-response');
108
+		}
109
+		return $request;
110
+	}
111 111
 
112
-    /**
113
-     * @return bool
114
-     */
115
-    protected function isValidPostRequest(array $request = [])
116
-    {
117
-        return !empty($request['_action']) && empty($request['_ajax_request']);
118
-    }
112
+	/**
113
+	 * @return bool
114
+	 */
115
+	protected function isValidPostRequest(array $request = [])
116
+	{
117
+		return !empty($request['_action']) && empty($request['_ajax_request']);
118
+	}
119 119
 
120
-    /**
121
-     * @return bool
122
-     */
123
-    protected function isValidPublicNonce(array $request)
124
-    {
125
-        if (is_user_logged_in() && !wp_verify_nonce($request['_nonce'], $request['_action'])) {
126
-            glsr_log()->error('nonce check failed for public request')->debug($request);
127
-            return false;
128
-        }
129
-        return true;
130
-    }
120
+	/**
121
+	 * @return bool
122
+	 */
123
+	protected function isValidPublicNonce(array $request)
124
+	{
125
+		if (is_user_logged_in() && !wp_verify_nonce($request['_nonce'], $request['_action'])) {
126
+			glsr_log()->error('nonce check failed for public request')->debug($request);
127
+			return false;
128
+		}
129
+		return true;
130
+	}
131 131
 
132
-    /**
133
-     * @param string $type
134
-     * @param string $action
135
-     * @return void
136
-     */
137
-    protected function routeRequest($type, $action, array $request = [])
138
-    {
139
-        $actionHook = 'site-reviews/route/'.$type.'/request';
140
-        $controller = glsr(Helper::buildClassName($type.'-controller', 'Controllers'));
141
-        $method = Helper::buildMethodName($action, 'router');
142
-        $request = apply_filters('site-reviews/route/request', $request, $action, $type);
143
-        do_action($actionHook, $action, $request);
144
-        if (is_callable([$controller, $method])) {
145
-            call_user_func([$controller, $method], $request);
146
-            return;
147
-        }
148
-        if (0 === did_action($actionHook)) {
149
-            glsr_log('Unknown '.$type.' router request: '.$action);
150
-        }
151
-    }
132
+	/**
133
+	 * @param string $type
134
+	 * @param string $action
135
+	 * @return void
136
+	 */
137
+	protected function routeRequest($type, $action, array $request = [])
138
+	{
139
+		$actionHook = 'site-reviews/route/'.$type.'/request';
140
+		$controller = glsr(Helper::buildClassName($type.'-controller', 'Controllers'));
141
+		$method = Helper::buildMethodName($action, 'router');
142
+		$request = apply_filters('site-reviews/route/request', $request, $action, $type);
143
+		do_action($actionHook, $action, $request);
144
+		if (is_callable([$controller, $method])) {
145
+			call_user_func([$controller, $method], $request);
146
+			return;
147
+		}
148
+		if (0 === did_action($actionHook)) {
149
+			glsr_log('Unknown '.$type.' router request: '.$action);
150
+		}
151
+	}
152 152
 
153
-    /**
154
-     * @param string $error
155
-     * @param int $statusCode
156
-     * @return void
157
-     */
158
-    protected function sendAjaxError($error, array $request, $statusCode = 400)
159
-    {
160
-        glsr_log()->error($error)->debug($request);
161
-        glsr(Notice::class)->addError(__('There was an error (try reloading the page).', 'site-reviews').' <code>'.$error.'</code>');
162
-        wp_send_json_error([
163
-            'message' => __('The form could not be submitted. Please notify the site administrator.', 'site-reviews'),
164
-            'notices' => glsr(Notice::class)->get(),
165
-            'error' => $error,
166
-        ]);
167
-    }
153
+	/**
154
+	 * @param string $error
155
+	 * @param int $statusCode
156
+	 * @return void
157
+	 */
158
+	protected function sendAjaxError($error, array $request, $statusCode = 400)
159
+	{
160
+		glsr_log()->error($error)->debug($request);
161
+		glsr(Notice::class)->addError(__('There was an error (try reloading the page).', 'site-reviews').' <code>'.$error.'</code>');
162
+		wp_send_json_error([
163
+			'message' => __('The form could not be submitted. Please notify the site administrator.', 'site-reviews'),
164
+			'notices' => glsr(Notice::class)->get(),
165
+			'error' => $error,
166
+		]);
167
+	}
168 168
 }
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -14,10 +14,10 @@  discard block
 block discarded – undo
14 14
 
15 15
     public function __construct()
16 16
     {
17
-        $this->unguardedActions = apply_filters('site-reviews/router/unguarded-actions', [
17
+        $this->unguardedActions = apply_filters( 'site-reviews/router/unguarded-actions', [
18 18
             'dismiss-notice',
19 19
             'fetch-paged-reviews',
20
-        ]);
20
+        ] );
21 21
     }
22 22
 
23 23
     /**
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
     public function routeAdminPostRequest()
27 27
     {
28 28
         $request = $this->getRequest();
29
-        if (!$this->isValidPostRequest($request)) {
29
+        if( !$this->isValidPostRequest( $request ) ) {
30 30
             return;
31 31
         }
32
-        check_admin_referer($request['_action']);
33
-        $this->routeRequest('admin', $request['_action'], $request);
32
+        check_admin_referer( $request['_action'] );
33
+        $this->routeRequest( 'admin', $request['_action'], $request );
34 34
     }
35 35
 
36 36
     /**
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
     public function routeAjaxRequest()
40 40
     {
41 41
         $request = $this->getRequest();
42
-        $this->checkAjaxRequest($request);
43
-        $this->checkAjaxNonce($request);
44
-        $this->routeRequest('ajax', $request['_action'], $request);
42
+        $this->checkAjaxRequest( $request );
43
+        $this->checkAjaxNonce( $request );
44
+        $this->routeRequest( 'ajax', $request['_action'], $request );
45 45
         wp_die();
46 46
     }
47 47
 
@@ -50,45 +50,45 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public function routePublicPostRequest()
52 52
     {
53
-        if (is_admin()) {
53
+        if( is_admin() ) {
54 54
             return;
55 55
         }
56 56
         $request = $this->getRequest();
57
-        if (!$this->isValidPostRequest($request)) {
57
+        if( !$this->isValidPostRequest( $request ) ) {
58 58
             return;
59 59
         }
60
-        if (!$this->isValidPublicNonce($request)) {
60
+        if( !$this->isValidPublicNonce( $request ) ) {
61 61
             return;
62 62
         }
63
-        $this->routeRequest('public', $request['_action'], $request);
63
+        $this->routeRequest( 'public', $request['_action'], $request );
64 64
     }
65 65
 
66 66
     /**
67 67
      * @return void
68 68
      */
69
-    protected function checkAjaxNonce(array $request)
69
+    protected function checkAjaxNonce( array $request )
70 70
     {
71
-        if (!is_user_logged_in() || in_array(Arr::get($request, '_action'), $this->unguardedActions)) {
71
+        if( !is_user_logged_in() || in_array( Arr::get( $request, '_action' ), $this->unguardedActions ) ) {
72 72
             return;
73 73
         }
74
-        if (!isset($request['_nonce'])) {
75
-            $this->sendAjaxError('request is missing a nonce', $request);
74
+        if( !isset($request['_nonce']) ) {
75
+            $this->sendAjaxError( 'request is missing a nonce', $request );
76 76
         }
77
-        if (!wp_verify_nonce($request['_nonce'], $request['_action'])) {
78
-            $this->sendAjaxError('request failed the nonce check', $request, 403);
77
+        if( !wp_verify_nonce( $request['_nonce'], $request['_action'] ) ) {
78
+            $this->sendAjaxError( 'request failed the nonce check', $request, 403 );
79 79
         }
80 80
     }
81 81
 
82 82
     /**
83 83
      * @return void
84 84
      */
85
-    protected function checkAjaxRequest(array $request)
85
+    protected function checkAjaxRequest( array $request )
86 86
     {
87
-        if (!isset($request['_action'])) {
88
-            $this->sendAjaxError('request must include an action', $request);
87
+        if( !isset($request['_action']) ) {
88
+            $this->sendAjaxError( 'request must include an action', $request );
89 89
         }
90
-        if (empty($request['_ajax_request'])) {
91
-            $this->sendAjaxError('request is invalid', $request);
90
+        if( empty($request['_ajax_request']) ) {
91
+            $this->sendAjaxError( 'request is invalid', $request );
92 92
         }
93 93
     }
94 94
 
@@ -99,12 +99,12 @@  discard block
 block discarded – undo
99 99
      */
100 100
     protected function getRequest()
101 101
     {
102
-        $request = Helper::filterInputArray(Application::ID);
103
-        if (Helper::filterInput('action') == Application::PREFIX.'action') {
102
+        $request = Helper::filterInputArray( Application::ID );
103
+        if( Helper::filterInput( 'action' ) == Application::PREFIX.'action' ) {
104 104
             $request['_ajax_request'] = true;
105 105
         }
106
-        if ('submit-review' == Helper::filterInput('_action', $request)) {
107
-            $request['_recaptcha-token'] = Helper::filterInput('g-recaptcha-response');
106
+        if( 'submit-review' == Helper::filterInput( '_action', $request ) ) {
107
+            $request['_recaptcha-token'] = Helper::filterInput( 'g-recaptcha-response' );
108 108
         }
109 109
         return $request;
110 110
     }
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     /**
113 113
      * @return bool
114 114
      */
115
-    protected function isValidPostRequest(array $request = [])
115
+    protected function isValidPostRequest( array $request = [] )
116 116
     {
117 117
         return !empty($request['_action']) && empty($request['_ajax_request']);
118 118
     }
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
     /**
121 121
      * @return bool
122 122
      */
123
-    protected function isValidPublicNonce(array $request)
123
+    protected function isValidPublicNonce( array $request )
124 124
     {
125
-        if (is_user_logged_in() && !wp_verify_nonce($request['_nonce'], $request['_action'])) {
126
-            glsr_log()->error('nonce check failed for public request')->debug($request);
125
+        if( is_user_logged_in() && !wp_verify_nonce( $request['_nonce'], $request['_action'] ) ) {
126
+            glsr_log()->error( 'nonce check failed for public request' )->debug( $request );
127 127
             return false;
128 128
         }
129 129
         return true;
@@ -134,19 +134,19 @@  discard block
 block discarded – undo
134 134
      * @param string $action
135 135
      * @return void
136 136
      */
137
-    protected function routeRequest($type, $action, array $request = [])
137
+    protected function routeRequest( $type, $action, array $request = [] )
138 138
     {
139 139
         $actionHook = 'site-reviews/route/'.$type.'/request';
140
-        $controller = glsr(Helper::buildClassName($type.'-controller', 'Controllers'));
141
-        $method = Helper::buildMethodName($action, 'router');
142
-        $request = apply_filters('site-reviews/route/request', $request, $action, $type);
143
-        do_action($actionHook, $action, $request);
144
-        if (is_callable([$controller, $method])) {
145
-            call_user_func([$controller, $method], $request);
140
+        $controller = glsr( Helper::buildClassName( $type.'-controller', 'Controllers' ) );
141
+        $method = Helper::buildMethodName( $action, 'router' );
142
+        $request = apply_filters( 'site-reviews/route/request', $request, $action, $type );
143
+        do_action( $actionHook, $action, $request );
144
+        if( is_callable( [$controller, $method] ) ) {
145
+            call_user_func( [$controller, $method], $request );
146 146
             return;
147 147
         }
148
-        if (0 === did_action($actionHook)) {
149
-            glsr_log('Unknown '.$type.' router request: '.$action);
148
+        if( 0 === did_action( $actionHook ) ) {
149
+            glsr_log( 'Unknown '.$type.' router request: '.$action );
150 150
         }
151 151
     }
152 152
 
@@ -155,14 +155,14 @@  discard block
 block discarded – undo
155 155
      * @param int $statusCode
156 156
      * @return void
157 157
      */
158
-    protected function sendAjaxError($error, array $request, $statusCode = 400)
158
+    protected function sendAjaxError( $error, array $request, $statusCode = 400 )
159 159
     {
160
-        glsr_log()->error($error)->debug($request);
161
-        glsr(Notice::class)->addError(__('There was an error (try reloading the page).', 'site-reviews').' <code>'.$error.'</code>');
162
-        wp_send_json_error([
163
-            'message' => __('The form could not be submitted. Please notify the site administrator.', 'site-reviews'),
164
-            'notices' => glsr(Notice::class)->get(),
160
+        glsr_log()->error( $error )->debug( $request );
161
+        glsr( Notice::class )->addError( __( 'There was an error (try reloading the page).', 'site-reviews' ).' <code>'.$error.'</code>' );
162
+        wp_send_json_error( [
163
+            'message' => __( 'The form could not be submitted. Please notify the site administrator.', 'site-reviews' ),
164
+            'notices' => glsr( Notice::class )->get(),
165 165
             'error' => $error,
166
-        ]);
166
+        ] );
167 167
     }
168 168
 }
Please login to merge, or discard this patch.
plugin/Controllers/TaxonomyController.php 2 patches
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -8,97 +8,97 @@
 block discarded – undo
8 8
 
9 9
 class TaxonomyController
10 10
 {
11
-    /**
12
-     * @return void
13
-     * @action Application::TAXONOMY._add_form_fields
14
-     * @action Application::TAXONOMY._edit_form
15
-     */
16
-    public function disableParents()
17
-    {
18
-        global $wp_taxonomies;
19
-        $wp_taxonomies[Application::TAXONOMY]->hierarchical = false;
20
-    }
11
+	/**
12
+	 * @return void
13
+	 * @action Application::TAXONOMY._add_form_fields
14
+	 * @action Application::TAXONOMY._edit_form
15
+	 */
16
+	public function disableParents()
17
+	{
18
+		global $wp_taxonomies;
19
+		$wp_taxonomies[Application::TAXONOMY]->hierarchical = false;
20
+	}
21 21
 
22
-    /**
23
-     * @return void
24
-     * @action Application::TAXONOMY._term_edit_form_top
25
-     * @action Application::TAXONOMY._term_new_form_tag
26
-     */
27
-    public function enableParents()
28
-    {
29
-        global $wp_taxonomies;
30
-        $wp_taxonomies[Application::TAXONOMY]->hierarchical = true;
31
-    }
22
+	/**
23
+	 * @return void
24
+	 * @action Application::TAXONOMY._term_edit_form_top
25
+	 * @action Application::TAXONOMY._term_new_form_tag
26
+	 */
27
+	public function enableParents()
28
+	{
29
+		global $wp_taxonomies;
30
+		$wp_taxonomies[Application::TAXONOMY]->hierarchical = true;
31
+	}
32 32
 
33
-    /**
34
-     * @return void
35
-     * @action restrict_manage_posts
36
-     */
37
-    public function renderTaxonomyFilter()
38
-    {
39
-        if (!is_object_in_taxonomy(glsr_current_screen()->post_type, Application::TAXONOMY)) {
40
-            return;
41
-        }
42
-        echo glsr(Builder::class)->label(__('Filter by category', 'site-reviews'), [
43
-            'class' => 'screen-reader-text',
44
-            'for' => Application::TAXONOMY,
45
-        ]);
46
-        wp_dropdown_categories([
47
-            'depth' => 3,
48
-            'hide_empty' => true,
49
-            'hide_if_empty' => true,
50
-            'hierarchical' => true,
51
-            'name' => Application::TAXONOMY,
52
-            'orderby' => 'name',
53
-            'selected' => $this->getSelected(),
54
-            'show_count' => false,
55
-            'show_option_all' => $this->getShowOptionAll(),
56
-            'taxonomy' => Application::TAXONOMY,
57
-            'value_field' => 'slug',
58
-        ]);
59
-    }
33
+	/**
34
+	 * @return void
35
+	 * @action restrict_manage_posts
36
+	 */
37
+	public function renderTaxonomyFilter()
38
+	{
39
+		if (!is_object_in_taxonomy(glsr_current_screen()->post_type, Application::TAXONOMY)) {
40
+			return;
41
+		}
42
+		echo glsr(Builder::class)->label(__('Filter by category', 'site-reviews'), [
43
+			'class' => 'screen-reader-text',
44
+			'for' => Application::TAXONOMY,
45
+		]);
46
+		wp_dropdown_categories([
47
+			'depth' => 3,
48
+			'hide_empty' => true,
49
+			'hide_if_empty' => true,
50
+			'hierarchical' => true,
51
+			'name' => Application::TAXONOMY,
52
+			'orderby' => 'name',
53
+			'selected' => $this->getSelected(),
54
+			'show_count' => false,
55
+			'show_option_all' => $this->getShowOptionAll(),
56
+			'taxonomy' => Application::TAXONOMY,
57
+			'value_field' => 'slug',
58
+		]);
59
+	}
60 60
 
61
-    /**
62
-     * @param int $postId
63
-     * @param array $terms
64
-     * @param array $newTTIds
65
-     * @param string $taxonomy
66
-     * @param bool $append
67
-     * @param array $oldTTIds
68
-     * @return void
69
-     * @action set_object_terms
70
-     */
71
-    public function restrictTermSelection($postId, $terms, $newTTIds, $taxonomy, $append, $oldTTIds)
72
-    {
73
-        if (Application::TAXONOMY != $taxonomy || count($newTTIds) <= 1) {
74
-            return;
75
-        }
76
-        $diff = array_diff($newTTIds, $oldTTIds);
77
-        if (empty($newTerm = array_shift($diff))) {
78
-            $newTerm = array_shift($newTTIds);
79
-        }
80
-        if ($newTerm) {
81
-            wp_set_object_terms($postId, intval($newTerm), $taxonomy);
82
-        }
83
-    }
61
+	/**
62
+	 * @param int $postId
63
+	 * @param array $terms
64
+	 * @param array $newTTIds
65
+	 * @param string $taxonomy
66
+	 * @param bool $append
67
+	 * @param array $oldTTIds
68
+	 * @return void
69
+	 * @action set_object_terms
70
+	 */
71
+	public function restrictTermSelection($postId, $terms, $newTTIds, $taxonomy, $append, $oldTTIds)
72
+	{
73
+		if (Application::TAXONOMY != $taxonomy || count($newTTIds) <= 1) {
74
+			return;
75
+		}
76
+		$diff = array_diff($newTTIds, $oldTTIds);
77
+		if (empty($newTerm = array_shift($diff))) {
78
+			$newTerm = array_shift($newTTIds);
79
+		}
80
+		if ($newTerm) {
81
+			wp_set_object_terms($postId, intval($newTerm), $taxonomy);
82
+		}
83
+	}
84 84
 
85
-    /**
86
-     * @return string
87
-     */
88
-    protected function getSelected()
89
-    {
90
-        global $wp_query;
91
-        return Arr::get($wp_query->query, Application::TAXONOMY);
92
-    }
85
+	/**
86
+	 * @return string
87
+	 */
88
+	protected function getSelected()
89
+	{
90
+		global $wp_query;
91
+		return Arr::get($wp_query->query, Application::TAXONOMY);
92
+	}
93 93
 
94
-    /**
95
-     * @return string
96
-     */
97
-    protected function getShowOptionAll()
98
-    {
99
-        $taxonomy = get_taxonomy(Application::TAXONOMY);
100
-        return $taxonomy
101
-            ? ucfirst(strtolower($taxonomy->labels->all_items))
102
-            : '';
103
-    }
94
+	/**
95
+	 * @return string
96
+	 */
97
+	protected function getShowOptionAll()
98
+	{
99
+		$taxonomy = get_taxonomy(Application::TAXONOMY);
100
+		return $taxonomy
101
+			? ucfirst(strtolower($taxonomy->labels->all_items))
102
+			: '';
103
+	}
104 104
 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -36,14 +36,14 @@  discard block
 block discarded – undo
36 36
      */
37 37
     public function renderTaxonomyFilter()
38 38
     {
39
-        if (!is_object_in_taxonomy(glsr_current_screen()->post_type, Application::TAXONOMY)) {
39
+        if( !is_object_in_taxonomy( glsr_current_screen()->post_type, Application::TAXONOMY ) ) {
40 40
             return;
41 41
         }
42
-        echo glsr(Builder::class)->label(__('Filter by category', 'site-reviews'), [
42
+        echo glsr( Builder::class )->label( __( 'Filter by category', 'site-reviews' ), [
43 43
             'class' => 'screen-reader-text',
44 44
             'for' => Application::TAXONOMY,
45
-        ]);
46
-        wp_dropdown_categories([
45
+        ] );
46
+        wp_dropdown_categories( [
47 47
             'depth' => 3,
48 48
             'hide_empty' => true,
49 49
             'hide_if_empty' => true,
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
             'show_option_all' => $this->getShowOptionAll(),
56 56
             'taxonomy' => Application::TAXONOMY,
57 57
             'value_field' => 'slug',
58
-        ]);
58
+        ] );
59 59
     }
60 60
 
61 61
     /**
@@ -68,17 +68,17 @@  discard block
 block discarded – undo
68 68
      * @return void
69 69
      * @action set_object_terms
70 70
      */
71
-    public function restrictTermSelection($postId, $terms, $newTTIds, $taxonomy, $append, $oldTTIds)
71
+    public function restrictTermSelection( $postId, $terms, $newTTIds, $taxonomy, $append, $oldTTIds )
72 72
     {
73
-        if (Application::TAXONOMY != $taxonomy || count($newTTIds) <= 1) {
73
+        if( Application::TAXONOMY != $taxonomy || count( $newTTIds ) <= 1 ) {
74 74
             return;
75 75
         }
76
-        $diff = array_diff($newTTIds, $oldTTIds);
77
-        if (empty($newTerm = array_shift($diff))) {
78
-            $newTerm = array_shift($newTTIds);
76
+        $diff = array_diff( $newTTIds, $oldTTIds );
77
+        if( empty($newTerm = array_shift( $diff )) ) {
78
+            $newTerm = array_shift( $newTTIds );
79 79
         }
80
-        if ($newTerm) {
81
-            wp_set_object_terms($postId, intval($newTerm), $taxonomy);
80
+        if( $newTerm ) {
81
+            wp_set_object_terms( $postId, intval( $newTerm ), $taxonomy );
82 82
         }
83 83
     }
84 84
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     protected function getSelected()
89 89
     {
90 90
         global $wp_query;
91
-        return Arr::get($wp_query->query, Application::TAXONOMY);
91
+        return Arr::get( $wp_query->query, Application::TAXONOMY );
92 92
     }
93 93
 
94 94
     /**
@@ -96,9 +96,9 @@  discard block
 block discarded – undo
96 96
      */
97 97
     protected function getShowOptionAll()
98 98
     {
99
-        $taxonomy = get_taxonomy(Application::TAXONOMY);
99
+        $taxonomy = get_taxonomy( Application::TAXONOMY );
100 100
         return $taxonomy
101
-            ? ucfirst(strtolower($taxonomy->labels->all_items))
101
+            ? ucfirst( strtolower( $taxonomy->labels->all_items ) )
102 102
             : '';
103 103
     }
104 104
 }
Please login to merge, or discard this patch.
plugin/Modules/Schema/BaseType.php 2 patches
Indentation   +221 added lines, -221 removed lines patch added patch discarded remove patch
@@ -13,248 +13,248 @@
 block discarded – undo
13 13
 
14 14
 abstract class BaseType implements ArrayAccess, JsonSerializable, Type
15 15
 {
16
-    /**
17
-     * @var array
18
-     */
19
-    public $allowed = [];
16
+	/**
17
+	 * @var array
18
+	 */
19
+	public $allowed = [];
20 20
 
21
-    /**
22
-     * @var array
23
-     */
24
-    public $parents = [];
21
+	/**
22
+	 * @var array
23
+	 */
24
+	public $parents = [];
25 25
 
26
-    /**
27
-     * @var array
28
-     */
29
-    protected $properties = [];
26
+	/**
27
+	 * @var array
28
+	 */
29
+	protected $properties = [];
30 30
 
31
-    /**
32
-     * @var string
33
-     */
34
-    protected $type;
31
+	/**
32
+	 * @var string
33
+	 */
34
+	protected $type;
35 35
 
36
-    /**
37
-     * @param string $method
38
-     * @return static
39
-     */
40
-    public function __call($method, array $arguments)
41
-    {
42
-        return $this->setProperty($method, Arr::get($arguments, 0));
43
-    }
36
+	/**
37
+	 * @param string $method
38
+	 * @return static
39
+	 */
40
+	public function __call($method, array $arguments)
41
+	{
42
+		return $this->setProperty($method, Arr::get($arguments, 0));
43
+	}
44 44
 
45
-    /**
46
-     * @param string $type
47
-     */
48
-    public function __construct($type = null)
49
-    {
50
-        $this->type = !is_string($type)
51
-            ? (new ReflectionClass($this))->getShortName()
52
-            : $type;
53
-        $this->setAllowedProperties();
54
-    }
45
+	/**
46
+	 * @param string $type
47
+	 */
48
+	public function __construct($type = null)
49
+	{
50
+		$this->type = !is_string($type)
51
+			? (new ReflectionClass($this))->getShortName()
52
+			: $type;
53
+		$this->setAllowedProperties();
54
+	}
55 55
 
56
-    /**
57
-     * @return string
58
-     */
59
-    public function __toString()
60
-    {
61
-        return $this->toScript();
62
-    }
56
+	/**
57
+	 * @return string
58
+	 */
59
+	public function __toString()
60
+	{
61
+		return $this->toScript();
62
+	}
63 63
 
64
-    /**
65
-     * @return static
66
-     */
67
-    public function addProperties(array $properties)
68
-    {
69
-        foreach ($properties as $property => $value) {
70
-            $this->setProperty($property, $value);
71
-        }
72
-        return $this;
73
-    }
64
+	/**
65
+	 * @return static
66
+	 */
67
+	public function addProperties(array $properties)
68
+	{
69
+		foreach ($properties as $property => $value) {
70
+			$this->setProperty($property, $value);
71
+		}
72
+		return $this;
73
+	}
74 74
 
75
-    /**
76
-     * @return string
77
-     */
78
-    public function getContext()
79
-    {
80
-        return 'https://schema.org';
81
-    }
75
+	/**
76
+	 * @return string
77
+	 */
78
+	public function getContext()
79
+	{
80
+		return 'https://schema.org';
81
+	}
82 82
 
83
-    /**
84
-     * @return array
85
-     */
86
-    public function getProperties()
87
-    {
88
-        return $this->properties;
89
-    }
83
+	/**
84
+	 * @return array
85
+	 */
86
+	public function getProperties()
87
+	{
88
+		return $this->properties;
89
+	}
90 90
 
91
-    /**
92
-     * @param string $property
93
-     * @param mixed $default
94
-     * @return mixed
95
-     */
96
-    public function getProperty($property, $default = null)
97
-    {
98
-        return Arr::get($this->properties, $property, $default);
99
-    }
91
+	/**
92
+	 * @param string $property
93
+	 * @param mixed $default
94
+	 * @return mixed
95
+	 */
96
+	public function getProperty($property, $default = null)
97
+	{
98
+		return Arr::get($this->properties, $property, $default);
99
+	}
100 100
 
101
-    /**
102
-     * @return string
103
-     */
104
-    public function getType()
105
-    {
106
-        return $this->type;
107
-    }
101
+	/**
102
+	 * @return string
103
+	 */
104
+	public function getType()
105
+	{
106
+		return $this->type;
107
+	}
108 108
 
109
-    /**
110
-     * @param bool $condition
111
-     * @param mixed $callback
112
-     * @return static
113
-     */
114
-    public function doIf($condition, $callback)
115
-    {
116
-        if ($condition) {
117
-            $callback($this);
118
-        }
119
-        return $this;
120
-    }
109
+	/**
110
+	 * @param bool $condition
111
+	 * @param mixed $callback
112
+	 * @return static
113
+	 */
114
+	public function doIf($condition, $callback)
115
+	{
116
+		if ($condition) {
117
+			$callback($this);
118
+		}
119
+		return $this;
120
+	}
121 121
 
122
-    /**
123
-     * @return array
124
-     */
125
-    public function jsonSerialize()
126
-    {
127
-        return $this->toArray();
128
-    }
122
+	/**
123
+	 * @return array
124
+	 */
125
+	public function jsonSerialize()
126
+	{
127
+		return $this->toArray();
128
+	}
129 129
 
130
-    /**
131
-     * @param mixed $offset
132
-     * @return bool
133
-     */
134
-    public function offsetExists($offset)
135
-    {
136
-        return array_key_exists($offset, $this->properties);
137
-    }
130
+	/**
131
+	 * @param mixed $offset
132
+	 * @return bool
133
+	 */
134
+	public function offsetExists($offset)
135
+	{
136
+		return array_key_exists($offset, $this->properties);
137
+	}
138 138
 
139
-    /**
140
-     * @param string $offset
141
-     * @return mixed
142
-     */
143
-    public function offsetGet($offset)
144
-    {
145
-        return $this->getProperty($offset);
146
-    }
139
+	/**
140
+	 * @param string $offset
141
+	 * @return mixed
142
+	 */
143
+	public function offsetGet($offset)
144
+	{
145
+		return $this->getProperty($offset);
146
+	}
147 147
 
148
-    /**
149
-     * @param string $offset
150
-     * @param mixed $value
151
-     * @return void
152
-     */
153
-    public function offsetSet($offset, $value)
154
-    {
155
-        $this->setProperty($offset, $value);
156
-    }
148
+	/**
149
+	 * @param string $offset
150
+	 * @param mixed $value
151
+	 * @return void
152
+	 */
153
+	public function offsetSet($offset, $value)
154
+	{
155
+		$this->setProperty($offset, $value);
156
+	}
157 157
 
158
-    /**
159
-     * @param string $offset
160
-     * @return void
161
-     */
162
-    public function offsetUnset($offset)
163
-    {
164
-        unset($this->properties[$offset]);
165
-    }
158
+	/**
159
+	 * @param string $offset
160
+	 * @return void
161
+	 */
162
+	public function offsetUnset($offset)
163
+	{
164
+		unset($this->properties[$offset]);
165
+	}
166 166
 
167
-    /**
168
-     * @param string $property
169
-     * @param mixed $value
170
-     * @return static
171
-     */
172
-    public function setProperty($property, $value)
173
-    {
174
-        if (!in_array($property, $this->allowed)
175
-            && 'UnknownType' != (new ReflectionClass($this))->getShortName()) {
176
-            glsr_log()->warning($this->getType().' does not allow the "'.$property.'" property');
177
-            return $this;
178
-        }
179
-        $this->properties[$property] = $value;
180
-        return $this;
181
-    }
167
+	/**
168
+	 * @param string $property
169
+	 * @param mixed $value
170
+	 * @return static
171
+	 */
172
+	public function setProperty($property, $value)
173
+	{
174
+		if (!in_array($property, $this->allowed)
175
+			&& 'UnknownType' != (new ReflectionClass($this))->getShortName()) {
176
+			glsr_log()->warning($this->getType().' does not allow the "'.$property.'" property');
177
+			return $this;
178
+		}
179
+		$this->properties[$property] = $value;
180
+		return $this;
181
+	}
182 182
 
183
-    /**
184
-     * @return array
185
-     */
186
-    public function toArray()
187
-    {
188
-        return [
189
-            '@context' => $this->getContext(),
190
-            '@type' => $this->getType(),
191
-        ] + $this->serializeProperty($this->getProperties());
192
-    }
183
+	/**
184
+	 * @return array
185
+	 */
186
+	public function toArray()
187
+	{
188
+		return [
189
+			'@context' => $this->getContext(),
190
+			'@type' => $this->getType(),
191
+		] + $this->serializeProperty($this->getProperties());
192
+	}
193 193
 
194
-    /**
195
-     * @return string
196
-     */
197
-    public function toScript()
198
-    {
199
-        return sprintf('<script type="application/ld+json">%s</script>',
200
-            json_encode($this->toArray(), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)
201
-        );
202
-    }
194
+	/**
195
+	 * @return string
196
+	 */
197
+	public function toScript()
198
+	{
199
+		return sprintf('<script type="application/ld+json">%s</script>',
200
+			json_encode($this->toArray(), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)
201
+		);
202
+	}
203 203
 
204
-    /**
205
-     * @param array|null $parents
206
-     * @return array
207
-     */
208
-    protected function getParents($parents = null)
209
-    {
210
-        if (!isset($parents)) {
211
-            $parents = $this->parents;
212
-        }
213
-        $newParents = $parents;
214
-        foreach ($parents as $parent) {
215
-            $parentClass = Helper::buildClassName($parent, __NAMESPACE__);
216
-            if (!class_exists($parentClass)) {
217
-                continue;
218
-            }
219
-            $newParents = array_merge($newParents, $this->getParents((new $parentClass())->parents));
220
-        }
221
-        return array_values(array_unique($newParents));
222
-    }
204
+	/**
205
+	 * @param array|null $parents
206
+	 * @return array
207
+	 */
208
+	protected function getParents($parents = null)
209
+	{
210
+		if (!isset($parents)) {
211
+			$parents = $this->parents;
212
+		}
213
+		$newParents = $parents;
214
+		foreach ($parents as $parent) {
215
+			$parentClass = Helper::buildClassName($parent, __NAMESPACE__);
216
+			if (!class_exists($parentClass)) {
217
+				continue;
218
+			}
219
+			$newParents = array_merge($newParents, $this->getParents((new $parentClass())->parents));
220
+		}
221
+		return array_values(array_unique($newParents));
222
+	}
223 223
 
224
-    /**
225
-     * @return void
226
-     */
227
-    protected function setAllowedProperties()
228
-    {
229
-        $parents = $this->getParents();
230
-        foreach ($parents as $parent) {
231
-            $parentClass = Helper::buildClassName($parent, __NAMESPACE__);
232
-            if (!class_exists($parentClass)) {
233
-                continue;
234
-            }
235
-            $this->allowed = array_values(array_unique(array_merge((new $parentClass())->allowed, $this->allowed)));
236
-        }
237
-    }
224
+	/**
225
+	 * @return void
226
+	 */
227
+	protected function setAllowedProperties()
228
+	{
229
+		$parents = $this->getParents();
230
+		foreach ($parents as $parent) {
231
+			$parentClass = Helper::buildClassName($parent, __NAMESPACE__);
232
+			if (!class_exists($parentClass)) {
233
+				continue;
234
+			}
235
+			$this->allowed = array_values(array_unique(array_merge((new $parentClass())->allowed, $this->allowed)));
236
+		}
237
+	}
238 238
 
239
-    /**
240
-     * @param mixed $property
241
-     * @return array|string
242
-     */
243
-    protected function serializeProperty($property)
244
-    {
245
-        if (is_array($property)) {
246
-            return array_map([$this, 'serializeProperty'], $property);
247
-        }
248
-        if ($property instanceof Type) {
249
-            $property = $property->toArray();
250
-            unset($property['@context']);
251
-        }
252
-        if ($property instanceof DateTimeInterface) {
253
-            $property = $property->format(DateTime::ATOM);
254
-        }
255
-        if (is_object($property)) {
256
-            throw new InvalidProperty();
257
-        }
258
-        return $property;
259
-    }
239
+	/**
240
+	 * @param mixed $property
241
+	 * @return array|string
242
+	 */
243
+	protected function serializeProperty($property)
244
+	{
245
+		if (is_array($property)) {
246
+			return array_map([$this, 'serializeProperty'], $property);
247
+		}
248
+		if ($property instanceof Type) {
249
+			$property = $property->toArray();
250
+			unset($property['@context']);
251
+		}
252
+		if ($property instanceof DateTimeInterface) {
253
+			$property = $property->format(DateTime::ATOM);
254
+		}
255
+		if (is_object($property)) {
256
+			throw new InvalidProperty();
257
+		}
258
+		return $property;
259
+	}
260 260
 }
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -37,18 +37,18 @@  discard block
 block discarded – undo
37 37
      * @param string $method
38 38
      * @return static
39 39
      */
40
-    public function __call($method, array $arguments)
40
+    public function __call( $method, array $arguments )
41 41
     {
42
-        return $this->setProperty($method, Arr::get($arguments, 0));
42
+        return $this->setProperty( $method, Arr::get( $arguments, 0 ) );
43 43
     }
44 44
 
45 45
     /**
46 46
      * @param string $type
47 47
      */
48
-    public function __construct($type = null)
48
+    public function __construct( $type = null )
49 49
     {
50
-        $this->type = !is_string($type)
51
-            ? (new ReflectionClass($this))->getShortName()
50
+        $this->type = !is_string( $type )
51
+            ? (new ReflectionClass( $this ))->getShortName()
52 52
             : $type;
53 53
         $this->setAllowedProperties();
54 54
     }
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
     /**
65 65
      * @return static
66 66
      */
67
-    public function addProperties(array $properties)
67
+    public function addProperties( array $properties )
68 68
     {
69
-        foreach ($properties as $property => $value) {
70
-            $this->setProperty($property, $value);
69
+        foreach( $properties as $property => $value ) {
70
+            $this->setProperty( $property, $value );
71 71
         }
72 72
         return $this;
73 73
     }
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
      * @param mixed $default
94 94
      * @return mixed
95 95
      */
96
-    public function getProperty($property, $default = null)
96
+    public function getProperty( $property, $default = null )
97 97
     {
98
-        return Arr::get($this->properties, $property, $default);
98
+        return Arr::get( $this->properties, $property, $default );
99 99
     }
100 100
 
101 101
     /**
@@ -111,10 +111,10 @@  discard block
 block discarded – undo
111 111
      * @param mixed $callback
112 112
      * @return static
113 113
      */
114
-    public function doIf($condition, $callback)
114
+    public function doIf( $condition, $callback )
115 115
     {
116
-        if ($condition) {
117
-            $callback($this);
116
+        if( $condition ) {
117
+            $callback( $this );
118 118
         }
119 119
         return $this;
120 120
     }
@@ -131,18 +131,18 @@  discard block
 block discarded – undo
131 131
      * @param mixed $offset
132 132
      * @return bool
133 133
      */
134
-    public function offsetExists($offset)
134
+    public function offsetExists( $offset )
135 135
     {
136
-        return array_key_exists($offset, $this->properties);
136
+        return array_key_exists( $offset, $this->properties );
137 137
     }
138 138
 
139 139
     /**
140 140
      * @param string $offset
141 141
      * @return mixed
142 142
      */
143
-    public function offsetGet($offset)
143
+    public function offsetGet( $offset )
144 144
     {
145
-        return $this->getProperty($offset);
145
+        return $this->getProperty( $offset );
146 146
     }
147 147
 
148 148
     /**
@@ -150,16 +150,16 @@  discard block
 block discarded – undo
150 150
      * @param mixed $value
151 151
      * @return void
152 152
      */
153
-    public function offsetSet($offset, $value)
153
+    public function offsetSet( $offset, $value )
154 154
     {
155
-        $this->setProperty($offset, $value);
155
+        $this->setProperty( $offset, $value );
156 156
     }
157 157
 
158 158
     /**
159 159
      * @param string $offset
160 160
      * @return void
161 161
      */
162
-    public function offsetUnset($offset)
162
+    public function offsetUnset( $offset )
163 163
     {
164 164
         unset($this->properties[$offset]);
165 165
     }
@@ -169,11 +169,11 @@  discard block
 block discarded – undo
169 169
      * @param mixed $value
170 170
      * @return static
171 171
      */
172
-    public function setProperty($property, $value)
172
+    public function setProperty( $property, $value )
173 173
     {
174
-        if (!in_array($property, $this->allowed)
175
-            && 'UnknownType' != (new ReflectionClass($this))->getShortName()) {
176
-            glsr_log()->warning($this->getType().' does not allow the "'.$property.'" property');
174
+        if( !in_array( $property, $this->allowed )
175
+            && 'UnknownType' != (new ReflectionClass( $this ))->getShortName() ) {
176
+            glsr_log()->warning( $this->getType().' does not allow the "'.$property.'" property' );
177 177
             return $this;
178 178
         }
179 179
         $this->properties[$property] = $value;
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         return [
189 189
             '@context' => $this->getContext(),
190 190
             '@type' => $this->getType(),
191
-        ] + $this->serializeProperty($this->getProperties());
191
+        ] + $this->serializeProperty( $this->getProperties() );
192 192
     }
193 193
 
194 194
     /**
@@ -196,8 +196,8 @@  discard block
 block discarded – undo
196 196
      */
197 197
     public function toScript()
198 198
     {
199
-        return sprintf('<script type="application/ld+json">%s</script>',
200
-            json_encode($this->toArray(), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)
199
+        return sprintf( '<script type="application/ld+json">%s</script>',
200
+            json_encode( $this->toArray(), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES )
201 201
         );
202 202
     }
203 203
 
@@ -205,20 +205,20 @@  discard block
 block discarded – undo
205 205
      * @param array|null $parents
206 206
      * @return array
207 207
      */
208
-    protected function getParents($parents = null)
208
+    protected function getParents( $parents = null )
209 209
     {
210
-        if (!isset($parents)) {
210
+        if( !isset($parents) ) {
211 211
             $parents = $this->parents;
212 212
         }
213 213
         $newParents = $parents;
214
-        foreach ($parents as $parent) {
215
-            $parentClass = Helper::buildClassName($parent, __NAMESPACE__);
216
-            if (!class_exists($parentClass)) {
214
+        foreach( $parents as $parent ) {
215
+            $parentClass = Helper::buildClassName( $parent, __NAMESPACE__ );
216
+            if( !class_exists( $parentClass ) ) {
217 217
                 continue;
218 218
             }
219
-            $newParents = array_merge($newParents, $this->getParents((new $parentClass())->parents));
219
+            $newParents = array_merge( $newParents, $this->getParents( (new $parentClass())->parents ) );
220 220
         }
221
-        return array_values(array_unique($newParents));
221
+        return array_values( array_unique( $newParents ) );
222 222
     }
223 223
 
224 224
     /**
@@ -227,12 +227,12 @@  discard block
 block discarded – undo
227 227
     protected function setAllowedProperties()
228 228
     {
229 229
         $parents = $this->getParents();
230
-        foreach ($parents as $parent) {
231
-            $parentClass = Helper::buildClassName($parent, __NAMESPACE__);
232
-            if (!class_exists($parentClass)) {
230
+        foreach( $parents as $parent ) {
231
+            $parentClass = Helper::buildClassName( $parent, __NAMESPACE__ );
232
+            if( !class_exists( $parentClass ) ) {
233 233
                 continue;
234 234
             }
235
-            $this->allowed = array_values(array_unique(array_merge((new $parentClass())->allowed, $this->allowed)));
235
+            $this->allowed = array_values( array_unique( array_merge( (new $parentClass())->allowed, $this->allowed ) ) );
236 236
         }
237 237
     }
238 238
 
@@ -240,19 +240,19 @@  discard block
 block discarded – undo
240 240
      * @param mixed $property
241 241
      * @return array|string
242 242
      */
243
-    protected function serializeProperty($property)
243
+    protected function serializeProperty( $property )
244 244
     {
245
-        if (is_array($property)) {
246
-            return array_map([$this, 'serializeProperty'], $property);
245
+        if( is_array( $property ) ) {
246
+            return array_map( [$this, 'serializeProperty'], $property );
247 247
         }
248
-        if ($property instanceof Type) {
248
+        if( $property instanceof Type ) {
249 249
             $property = $property->toArray();
250 250
             unset($property['@context']);
251 251
         }
252
-        if ($property instanceof DateTimeInterface) {
253
-            $property = $property->format(DateTime::ATOM);
252
+        if( $property instanceof DateTimeInterface ) {
253
+            $property = $property->format( DateTime::ATOM );
254 254
         }
255
-        if (is_object($property)) {
255
+        if( is_object( $property ) ) {
256 256
             throw new InvalidProperty();
257 257
         }
258 258
         return $property;
Please login to merge, or discard this patch.
plugin/Modules/Html/Fields/Field.php 2 patches
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -7,73 +7,73 @@
 block discarded – undo
7 7
 
8 8
 abstract class Field
9 9
 {
10
-    /**
11
-     * @var Builder
12
-     */
13
-    protected $builder;
10
+	/**
11
+	 * @var Builder
12
+	 */
13
+	protected $builder;
14 14
 
15
-    public function __construct(Builder $builder)
16
-    {
17
-        $this->builder = $builder;
18
-    }
15
+	public function __construct(Builder $builder)
16
+	{
17
+		$this->builder = $builder;
18
+	}
19 19
 
20
-    /**
21
-     * @return string|void
22
-     */
23
-    public function build()
24
-    {
25
-        glsr_log()->error('Build method is not implemented for '.get_class($this));
26
-    }
20
+	/**
21
+	 * @return string|void
22
+	 */
23
+	public function build()
24
+	{
25
+		glsr_log()->error('Build method is not implemented for '.get_class($this));
26
+	}
27 27
 
28
-    /**
29
-     * @return array
30
-     */
31
-    public static function defaults()
32
-    {
33
-        return [];
34
-    }
28
+	/**
29
+	 * @return array
30
+	 */
31
+	public static function defaults()
32
+	{
33
+		return [];
34
+	}
35 35
 
36
-    /**
37
-     * @return array
38
-     */
39
-    public static function merge(array $args)
40
-    {
41
-        $merged = array_merge(
42
-            wp_parse_args($args, static::defaults()),
43
-            static::required()
44
-        );
45
-        $merged['class'] = implode(' ', static::mergedAttribute('class', ' ', $args));
46
-        $merged['style'] = implode(';', static::mergedAttribute('style', ';', $args));
47
-        return $merged;
48
-    }
36
+	/**
37
+	 * @return array
38
+	 */
39
+	public static function merge(array $args)
40
+	{
41
+		$merged = array_merge(
42
+			wp_parse_args($args, static::defaults()),
43
+			static::required()
44
+		);
45
+		$merged['class'] = implode(' ', static::mergedAttribute('class', ' ', $args));
46
+		$merged['style'] = implode(';', static::mergedAttribute('style', ';', $args));
47
+		return $merged;
48
+	}
49 49
 
50
-    /**
51
-     * @param string $delimiter
52
-     * @param string $key
53
-     * @return array
54
-     */
55
-    public static function mergedAttribute($key, $delimiter, array $args)
56
-    {
57
-        return array_filter(array_merge(
58
-            explode($delimiter, Arr::get($args, $key)),
59
-            explode($delimiter, Arr::get(static::defaults(), $key)),
60
-            explode($delimiter, Arr::get(static::required(), $key))
61
-        ));
62
-    }
50
+	/**
51
+	 * @param string $delimiter
52
+	 * @param string $key
53
+	 * @return array
54
+	 */
55
+	public static function mergedAttribute($key, $delimiter, array $args)
56
+	{
57
+		return array_filter(array_merge(
58
+			explode($delimiter, Arr::get($args, $key)),
59
+			explode($delimiter, Arr::get(static::defaults(), $key)),
60
+			explode($delimiter, Arr::get(static::required(), $key))
61
+		));
62
+	}
63 63
 
64
-    /**
65
-     * @return array
66
-     */
67
-    public static function required()
68
-    {
69
-        return [];
70
-    }
64
+	/**
65
+	 * @return array
66
+	 */
67
+	public static function required()
68
+	{
69
+		return [];
70
+	}
71 71
 
72
-    /**
73
-     * @return void
74
-     */
75
-    protected function mergeFieldArgs()
76
-    {
77
-        $this->builder->args = static::merge($this->builder->args);
78
-    }
72
+	/**
73
+	 * @return void
74
+	 */
75
+	protected function mergeFieldArgs()
76
+	{
77
+		$this->builder->args = static::merge($this->builder->args);
78
+	}
79 79
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
      */
13 13
     protected $builder;
14 14
 
15
-    public function __construct(Builder $builder)
15
+    public function __construct( Builder $builder )
16 16
     {
17 17
         $this->builder = $builder;
18 18
     }
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      */
23 23
     public function build()
24 24
     {
25
-        glsr_log()->error('Build method is not implemented for '.get_class($this));
25
+        glsr_log()->error( 'Build method is not implemented for '.get_class( $this ) );
26 26
     }
27 27
 
28 28
     /**
@@ -36,14 +36,14 @@  discard block
 block discarded – undo
36 36
     /**
37 37
      * @return array
38 38
      */
39
-    public static function merge(array $args)
39
+    public static function merge( array $args )
40 40
     {
41 41
         $merged = array_merge(
42
-            wp_parse_args($args, static::defaults()),
42
+            wp_parse_args( $args, static::defaults() ),
43 43
             static::required()
44 44
         );
45
-        $merged['class'] = implode(' ', static::mergedAttribute('class', ' ', $args));
46
-        $merged['style'] = implode(';', static::mergedAttribute('style', ';', $args));
45
+        $merged['class'] = implode( ' ', static::mergedAttribute( 'class', ' ', $args ) );
46
+        $merged['style'] = implode( ';', static::mergedAttribute( 'style', ';', $args ) );
47 47
         return $merged;
48 48
     }
49 49
 
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
      * @param string $key
53 53
      * @return array
54 54
      */
55
-    public static function mergedAttribute($key, $delimiter, array $args)
55
+    public static function mergedAttribute( $key, $delimiter, array $args )
56 56
     {
57
-        return array_filter(array_merge(
58
-            explode($delimiter, Arr::get($args, $key)),
59
-            explode($delimiter, Arr::get(static::defaults(), $key)),
60
-            explode($delimiter, Arr::get(static::required(), $key))
61
-        ));
57
+        return array_filter( array_merge(
58
+            explode( $delimiter, Arr::get( $args, $key ) ),
59
+            explode( $delimiter, Arr::get( static::defaults(), $key ) ),
60
+            explode( $delimiter, Arr::get( static::required(), $key ) )
61
+        ) );
62 62
     }
63 63
 
64 64
     /**
@@ -74,6 +74,6 @@  discard block
 block discarded – undo
74 74
      */
75 75
     protected function mergeFieldArgs()
76 76
     {
77
-        $this->builder->args = static::merge($this->builder->args);
77
+        $this->builder->args = static::merge( $this->builder->args );
78 78
     }
79 79
 }
Please login to merge, or discard this patch.
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('&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
-    }
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/Shortcodes/SiteReviewsPopup.php 2 patches
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -4,84 +4,84 @@
 block discarded – undo
4 4
 
5 5
 class SiteReviewsPopup extends TinymcePopupGenerator
6 6
 {
7
-    /**
8
-     * @return array
9
-     */
10
-    public function fields()
11
-    {
12
-        return [[
13
-            'html' => sprintf('<p class="strong">%s</p>', esc_html__('All settings are optional.', 'site-reviews')),
14
-            'minWidth' => 320,
15
-            'type' => 'container',
16
-        ], [
17
-            'label' => esc_html__('Title', 'site-reviews'),
18
-            'name' => 'title',
19
-            'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
20
-            'type' => 'textbox',
21
-        ], [
22
-            'label' => esc_html__('Display', 'site-reviews'),
23
-            'maxLength' => 5,
24
-            'name' => 'display',
25
-            'size' => 3,
26
-            'text' => '10',
27
-            'tooltip' => __('How many reviews would you like to display (default: 10)?', 'site-reviews'),
28
-            'type' => 'textbox',
29
-        ], [
30
-            'label' => esc_html__('Rating', 'site-reviews'),
31
-            'name' => 'rating',
32
-            'options' => [
33
-                '5' => esc_html(sprintf(_n('%s star', '%s stars', 5, 'site-reviews'), 5)),
34
-                '4' => esc_html(sprintf(_n('%s star', '%s stars', 4, 'site-reviews'), 4)),
35
-                '3' => esc_html(sprintf(_n('%s star', '%s stars', 3, 'site-reviews'), 3)),
36
-                '2' => esc_html(sprintf(_n('%s star', '%s stars', 2, 'site-reviews'), 2)),
37
-                '1' => esc_html(sprintf(_n('%s star', '%s stars', 1, 'site-reviews'), 1)),
38
-                '0' => esc_html(__('Unrated', 'site-reviews')),
39
-            ],
40
-            'tooltip' => __('What is the minimum rating to display (default: 1 star)?', 'site-reviews'),
41
-            'type' => 'listbox',
42
-        ], [
43
-            'label' => esc_html__('Pagination', 'site-reviews'),
44
-            'name' => 'pagination',
45
-            'options' => [
46
-                'true' => esc_html__('Enable', 'site-reviews'),
47
-                'ajax' => esc_html__('Enable (using ajax)', 'site-reviews'),
48
-                'false' => esc_html__('Disable', 'site-reviews'),
49
-            ],
50
-            'tooltip' => __('When using pagination this shortcode can only be used once on a page. (default: disable)', 'site-reviews'),
51
-            'type' => 'listbox',
52
-        ],
53
-        $this->getTypes(__('Which type of review would you like to display?', 'site-reviews')),
54
-        $this->getCategories(__('Limit reviews to this category.', 'site-reviews')),
55
-        [
56
-            'label' => esc_html__('Assigned To', 'site-reviews'),
57
-            'name' => 'assigned_to',
58
-            'tooltip' => __('Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page, or "parent_id" to use the ID of the parent page.', 'site-reviews'),
59
-            'type' => 'textbox',
60
-        ], [
61
-            'label' => esc_html__('Schema', 'site-reviews'),
62
-            'name' => 'schema',
63
-            'options' => [
64
-                'true' => esc_html__('Enable rich snippets', 'site-reviews'),
65
-                'false' => esc_html__('Disable rich snippets', 'site-reviews'),
66
-            ],
67
-            'tooltip' => __('Rich snippets are disabled by default.', 'site-reviews'),
68
-            'type' => 'listbox',
69
-        ], [
70
-            'label' => esc_html__('Classes', 'site-reviews'),
71
-            'name' => 'class',
72
-            'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
73
-            'type' => 'textbox',
74
-        ], [
75
-            'columns' => 2,
76
-            'items' => $this->getHideOptions(),
77
-            'label' => esc_html__('Hide', 'site-reviews'),
78
-            'layout' => 'grid',
79
-            'spacing' => 5,
80
-            'type' => 'container',
81
-        ], [
82
-            'hidden' => true,
83
-            'name' => 'id',
84
-            'type' => 'textbox',
85
-        ], ];
86
-    }
7
+	/**
8
+	 * @return array
9
+	 */
10
+	public function fields()
11
+	{
12
+		return [[
13
+			'html' => sprintf('<p class="strong">%s</p>', esc_html__('All settings are optional.', 'site-reviews')),
14
+			'minWidth' => 320,
15
+			'type' => 'container',
16
+		], [
17
+			'label' => esc_html__('Title', 'site-reviews'),
18
+			'name' => 'title',
19
+			'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
20
+			'type' => 'textbox',
21
+		], [
22
+			'label' => esc_html__('Display', 'site-reviews'),
23
+			'maxLength' => 5,
24
+			'name' => 'display',
25
+			'size' => 3,
26
+			'text' => '10',
27
+			'tooltip' => __('How many reviews would you like to display (default: 10)?', 'site-reviews'),
28
+			'type' => 'textbox',
29
+		], [
30
+			'label' => esc_html__('Rating', 'site-reviews'),
31
+			'name' => 'rating',
32
+			'options' => [
33
+				'5' => esc_html(sprintf(_n('%s star', '%s stars', 5, 'site-reviews'), 5)),
34
+				'4' => esc_html(sprintf(_n('%s star', '%s stars', 4, 'site-reviews'), 4)),
35
+				'3' => esc_html(sprintf(_n('%s star', '%s stars', 3, 'site-reviews'), 3)),
36
+				'2' => esc_html(sprintf(_n('%s star', '%s stars', 2, 'site-reviews'), 2)),
37
+				'1' => esc_html(sprintf(_n('%s star', '%s stars', 1, 'site-reviews'), 1)),
38
+				'0' => esc_html(__('Unrated', 'site-reviews')),
39
+			],
40
+			'tooltip' => __('What is the minimum rating to display (default: 1 star)?', 'site-reviews'),
41
+			'type' => 'listbox',
42
+		], [
43
+			'label' => esc_html__('Pagination', 'site-reviews'),
44
+			'name' => 'pagination',
45
+			'options' => [
46
+				'true' => esc_html__('Enable', 'site-reviews'),
47
+				'ajax' => esc_html__('Enable (using ajax)', 'site-reviews'),
48
+				'false' => esc_html__('Disable', 'site-reviews'),
49
+			],
50
+			'tooltip' => __('When using pagination this shortcode can only be used once on a page. (default: disable)', 'site-reviews'),
51
+			'type' => 'listbox',
52
+		],
53
+		$this->getTypes(__('Which type of review would you like to display?', 'site-reviews')),
54
+		$this->getCategories(__('Limit reviews to this category.', 'site-reviews')),
55
+		[
56
+			'label' => esc_html__('Assigned To', 'site-reviews'),
57
+			'name' => 'assigned_to',
58
+			'tooltip' => __('Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page, or "parent_id" to use the ID of the parent page.', 'site-reviews'),
59
+			'type' => 'textbox',
60
+		], [
61
+			'label' => esc_html__('Schema', 'site-reviews'),
62
+			'name' => 'schema',
63
+			'options' => [
64
+				'true' => esc_html__('Enable rich snippets', 'site-reviews'),
65
+				'false' => esc_html__('Disable rich snippets', 'site-reviews'),
66
+			],
67
+			'tooltip' => __('Rich snippets are disabled by default.', 'site-reviews'),
68
+			'type' => 'listbox',
69
+		], [
70
+			'label' => esc_html__('Classes', 'site-reviews'),
71
+			'name' => 'class',
72
+			'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
73
+			'type' => 'textbox',
74
+		], [
75
+			'columns' => 2,
76
+			'items' => $this->getHideOptions(),
77
+			'label' => esc_html__('Hide', 'site-reviews'),
78
+			'layout' => 'grid',
79
+			'spacing' => 5,
80
+			'type' => 'container',
81
+		], [
82
+			'hidden' => true,
83
+			'name' => 'id',
84
+			'type' => 'textbox',
85
+		], ];
86
+	}
87 87
 }
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -10,71 +10,71 @@
 block discarded – undo
10 10
     public function fields()
11 11
     {
12 12
         return [[
13
-            'html' => sprintf('<p class="strong">%s</p>', esc_html__('All settings are optional.', 'site-reviews')),
13
+            'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' ) ),
14 14
             'minWidth' => 320,
15 15
             'type' => 'container',
16 16
         ], [
17
-            'label' => esc_html__('Title', 'site-reviews'),
17
+            'label' => esc_html__( 'Title', 'site-reviews' ),
18 18
             'name' => 'title',
19
-            'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
19
+            'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ),
20 20
             'type' => 'textbox',
21 21
         ], [
22
-            'label' => esc_html__('Display', 'site-reviews'),
22
+            'label' => esc_html__( 'Display', 'site-reviews' ),
23 23
             'maxLength' => 5,
24 24
             'name' => 'display',
25 25
             'size' => 3,
26 26
             'text' => '10',
27
-            'tooltip' => __('How many reviews would you like to display (default: 10)?', 'site-reviews'),
27
+            'tooltip' => __( 'How many reviews would you like to display (default: 10)?', 'site-reviews' ),
28 28
             'type' => 'textbox',
29 29
         ], [
30
-            'label' => esc_html__('Rating', 'site-reviews'),
30
+            'label' => esc_html__( 'Rating', 'site-reviews' ),
31 31
             'name' => 'rating',
32 32
             'options' => [
33
-                '5' => esc_html(sprintf(_n('%s star', '%s stars', 5, 'site-reviews'), 5)),
34
-                '4' => esc_html(sprintf(_n('%s star', '%s stars', 4, 'site-reviews'), 4)),
35
-                '3' => esc_html(sprintf(_n('%s star', '%s stars', 3, 'site-reviews'), 3)),
36
-                '2' => esc_html(sprintf(_n('%s star', '%s stars', 2, 'site-reviews'), 2)),
37
-                '1' => esc_html(sprintf(_n('%s star', '%s stars', 1, 'site-reviews'), 1)),
38
-                '0' => esc_html(__('Unrated', 'site-reviews')),
33
+                '5' => esc_html( sprintf( _n( '%s star', '%s stars', 5, 'site-reviews' ), 5 ) ),
34
+                '4' => esc_html( sprintf( _n( '%s star', '%s stars', 4, 'site-reviews' ), 4 ) ),
35
+                '3' => esc_html( sprintf( _n( '%s star', '%s stars', 3, 'site-reviews' ), 3 ) ),
36
+                '2' => esc_html( sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 ) ),
37
+                '1' => esc_html( sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 ) ),
38
+                '0' => esc_html( __( 'Unrated', 'site-reviews' ) ),
39 39
             ],
40
-            'tooltip' => __('What is the minimum rating to display (default: 1 star)?', 'site-reviews'),
40
+            'tooltip' => __( 'What is the minimum rating to display (default: 1 star)?', 'site-reviews' ),
41 41
             'type' => 'listbox',
42 42
         ], [
43
-            'label' => esc_html__('Pagination', 'site-reviews'),
43
+            'label' => esc_html__( 'Pagination', 'site-reviews' ),
44 44
             'name' => 'pagination',
45 45
             'options' => [
46
-                'true' => esc_html__('Enable', 'site-reviews'),
47
-                'ajax' => esc_html__('Enable (using ajax)', 'site-reviews'),
48
-                'false' => esc_html__('Disable', 'site-reviews'),
46
+                'true' => esc_html__( 'Enable', 'site-reviews' ),
47
+                'ajax' => esc_html__( 'Enable (using ajax)', 'site-reviews' ),
48
+                'false' => esc_html__( 'Disable', 'site-reviews' ),
49 49
             ],
50
-            'tooltip' => __('When using pagination this shortcode can only be used once on a page. (default: disable)', 'site-reviews'),
50
+            'tooltip' => __( 'When using pagination this shortcode can only be used once on a page. (default: disable)', 'site-reviews' ),
51 51
             'type' => 'listbox',
52 52
         ],
53
-        $this->getTypes(__('Which type of review would you like to display?', 'site-reviews')),
54
-        $this->getCategories(__('Limit reviews to this category.', 'site-reviews')),
53
+        $this->getTypes( __( 'Which type of review would you like to display?', 'site-reviews' ) ),
54
+        $this->getCategories( __( 'Limit reviews to this category.', 'site-reviews' ) ),
55 55
         [
56
-            'label' => esc_html__('Assigned To', 'site-reviews'),
56
+            'label' => esc_html__( 'Assigned To', 'site-reviews' ),
57 57
             'name' => 'assigned_to',
58
-            'tooltip' => __('Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page, or "parent_id" to use the ID of the parent page.', 'site-reviews'),
58
+            'tooltip' => __( 'Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page, or "parent_id" to use the ID of the parent page.', 'site-reviews' ),
59 59
             'type' => 'textbox',
60 60
         ], [
61
-            'label' => esc_html__('Schema', 'site-reviews'),
61
+            'label' => esc_html__( 'Schema', 'site-reviews' ),
62 62
             'name' => 'schema',
63 63
             'options' => [
64
-                'true' => esc_html__('Enable rich snippets', 'site-reviews'),
65
-                'false' => esc_html__('Disable rich snippets', 'site-reviews'),
64
+                'true' => esc_html__( 'Enable rich snippets', 'site-reviews' ),
65
+                'false' => esc_html__( 'Disable rich snippets', 'site-reviews' ),
66 66
             ],
67
-            'tooltip' => __('Rich snippets are disabled by default.', 'site-reviews'),
67
+            'tooltip' => __( 'Rich snippets are disabled by default.', 'site-reviews' ),
68 68
             'type' => 'listbox',
69 69
         ], [
70
-            'label' => esc_html__('Classes', 'site-reviews'),
70
+            'label' => esc_html__( 'Classes', 'site-reviews' ),
71 71
             'name' => 'class',
72
-            'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
72
+            'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ),
73 73
             'type' => 'textbox',
74 74
         ], [
75 75
             'columns' => 2,
76 76
             'items' => $this->getHideOptions(),
77
-            'label' => esc_html__('Hide', 'site-reviews'),
77
+            'label' => esc_html__( 'Hide', 'site-reviews' ),
78 78
             'layout' => 'grid',
79 79
             'spacing' => 5,
80 80
             'type' => 'container',
Please login to merge, or discard this patch.
plugin/Controllers/WelcomeController.php 2 patches
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -8,97 +8,97 @@
 block discarded – undo
8 8
 
9 9
 class WelcomeController extends Controller
10 10
 {
11
-    /**
12
-     * @return array
13
-     * @filter plugin_action_links_site-reviews/site-reviews.php
14
-     */
15
-    public function filterActionLinks(array $links)
16
-    {
17
-        $links['welcome'] = glsr(Builder::class)->a(__('About', 'site-reviews'), [
18
-            'href' => admin_url('edit.php?post_type='.Application::POST_TYPE.'&page=welcome'),
19
-        ]);
20
-        return $links;
21
-    }
11
+	/**
12
+	 * @return array
13
+	 * @filter plugin_action_links_site-reviews/site-reviews.php
14
+	 */
15
+	public function filterActionLinks(array $links)
16
+	{
17
+		$links['welcome'] = glsr(Builder::class)->a(__('About', 'site-reviews'), [
18
+			'href' => admin_url('edit.php?post_type='.Application::POST_TYPE.'&page=welcome'),
19
+		]);
20
+		return $links;
21
+	}
22 22
 
23
-    /**
24
-     * @return string
25
-     * @filter admin_title
26
-     */
27
-    public function filterAdminTitle($title)
28
-    {
29
-        return Application::POST_TYPE.'_page_welcome' == glsr_current_screen()->id
30
-            ? sprintf(__('Welcome to %s &#8212; WordPress', 'site-reviews'), glsr()->name)
31
-            : $title;
32
-    }
23
+	/**
24
+	 * @return string
25
+	 * @filter admin_title
26
+	 */
27
+	public function filterAdminTitle($title)
28
+	{
29
+		return Application::POST_TYPE.'_page_welcome' == glsr_current_screen()->id
30
+			? sprintf(__('Welcome to %s &#8212; WordPress', 'site-reviews'), glsr()->name)
31
+			: $title;
32
+	}
33 33
 
34
-    /**
35
-     * @param string $text
36
-     * @return string
37
-     * @filter admin_footer_text
38
-     */
39
-    public function filterFooterText($text)
40
-    {
41
-        if (Application::POST_TYPE.'_page_welcome' != glsr_current_screen()->id) {
42
-            return $text;
43
-        }
44
-        $url = 'https://wordpress.org/support/view/plugin-reviews/site-reviews?filter=5#new-post';
45
-        return wp_kses_post(sprintf(
46
-            __('Please rate %s on %s and help us spread the word. Thank you so much!', 'site-reviews'),
47
-            '<strong>'.glsr()->name.'</strong> <a href="'.$url.'" target="_blank">&#9733;&#9733;&#9733;&#9733;&#9733;</a>',
48
-            '<a href="'.$url.'" target="_blank">wordpress.org</a>'
49
-        ));
50
-    }
34
+	/**
35
+	 * @param string $text
36
+	 * @return string
37
+	 * @filter admin_footer_text
38
+	 */
39
+	public function filterFooterText($text)
40
+	{
41
+		if (Application::POST_TYPE.'_page_welcome' != glsr_current_screen()->id) {
42
+			return $text;
43
+		}
44
+		$url = 'https://wordpress.org/support/view/plugin-reviews/site-reviews?filter=5#new-post';
45
+		return wp_kses_post(sprintf(
46
+			__('Please rate %s on %s and help us spread the word. Thank you so much!', 'site-reviews'),
47
+			'<strong>'.glsr()->name.'</strong> <a href="'.$url.'" target="_blank">&#9733;&#9733;&#9733;&#9733;&#9733;</a>',
48
+			'<a href="'.$url.'" target="_blank">wordpress.org</a>'
49
+		));
50
+	}
51 51
 
52
-    /**
53
-     * @param string $plugin
54
-     * @param bool $isNetworkActivation
55
-     * @return void
56
-     * @action activated_plugin
57
-     */
58
-    public function redirectOnActivation($plugin, $isNetworkActivation)
59
-    {
60
-        if (!$isNetworkActivation
61
-            && 'cli' !== php_sapi_name()
62
-            && $plugin === plugin_basename(glsr()->file)) {
63
-            wp_safe_redirect(admin_url('edit.php?post_type='.Application::POST_TYPE.'&page=welcome'));
64
-            exit;
65
-        }
66
-    }
52
+	/**
53
+	 * @param string $plugin
54
+	 * @param bool $isNetworkActivation
55
+	 * @return void
56
+	 * @action activated_plugin
57
+	 */
58
+	public function redirectOnActivation($plugin, $isNetworkActivation)
59
+	{
60
+		if (!$isNetworkActivation
61
+			&& 'cli' !== php_sapi_name()
62
+			&& $plugin === plugin_basename(glsr()->file)) {
63
+			wp_safe_redirect(admin_url('edit.php?post_type='.Application::POST_TYPE.'&page=welcome'));
64
+			exit;
65
+		}
66
+	}
67 67
 
68
-    /**
69
-     * @return void
70
-     * @action admin_menu
71
-     */
72
-    public function registerPage()
73
-    {
74
-        add_submenu_page('edit.php?post_type='.Application::POST_TYPE,
75
-            sprintf(__('Welcome to %s', 'site-reviews'), glsr()->name),
76
-            glsr()->name,
77
-            glsr()->getPermission('welcome'),
78
-            'welcome',
79
-            [$this, 'renderPage']
80
-        );
81
-        remove_submenu_page('edit.php?post_type='.Application::POST_TYPE, 'welcome');
82
-    }
68
+	/**
69
+	 * @return void
70
+	 * @action admin_menu
71
+	 */
72
+	public function registerPage()
73
+	{
74
+		add_submenu_page('edit.php?post_type='.Application::POST_TYPE,
75
+			sprintf(__('Welcome to %s', 'site-reviews'), glsr()->name),
76
+			glsr()->name,
77
+			glsr()->getPermission('welcome'),
78
+			'welcome',
79
+			[$this, 'renderPage']
80
+		);
81
+		remove_submenu_page('edit.php?post_type='.Application::POST_TYPE, 'welcome');
82
+	}
83 83
 
84
-    /**
85
-     * @return void
86
-     * @see $this->registerPage()
87
-     * @callback add_submenu_page
88
-     */
89
-    public function renderPage()
90
-    {
91
-        $tabs = apply_filters('site-reviews/addon/welcome/tabs', [
92
-            'getting-started' => __('Getting Started', 'site-reviews'),
93
-            'whatsnew' => __('What\'s New', 'site-reviews'),
94
-            'upgrade-guide' => __('Upgrade Guide', 'site-reviews'),
95
-            'support' => __('Support', 'site-reviews'),
96
-        ]);
97
-        glsr()->render('pages/welcome/index', [
98
-            'data' => ['context' => []],
99
-            'http_referer' => (string) wp_get_referer(),
100
-            'tabs' => $tabs,
101
-            'template' => glsr(Template::class),
102
-        ]);
103
-    }
84
+	/**
85
+	 * @return void
86
+	 * @see $this->registerPage()
87
+	 * @callback add_submenu_page
88
+	 */
89
+	public function renderPage()
90
+	{
91
+		$tabs = apply_filters('site-reviews/addon/welcome/tabs', [
92
+			'getting-started' => __('Getting Started', 'site-reviews'),
93
+			'whatsnew' => __('What\'s New', 'site-reviews'),
94
+			'upgrade-guide' => __('Upgrade Guide', 'site-reviews'),
95
+			'support' => __('Support', 'site-reviews'),
96
+		]);
97
+		glsr()->render('pages/welcome/index', [
98
+			'data' => ['context' => []],
99
+			'http_referer' => (string) wp_get_referer(),
100
+			'tabs' => $tabs,
101
+			'template' => glsr(Template::class),
102
+		]);
103
+	}
104 104
 }
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@  discard block
 block discarded – undo
12 12
      * @return array
13 13
      * @filter plugin_action_links_site-reviews/site-reviews.php
14 14
      */
15
-    public function filterActionLinks(array $links)
15
+    public function filterActionLinks( array $links )
16 16
     {
17
-        $links['welcome'] = glsr(Builder::class)->a(__('About', 'site-reviews'), [
18
-            'href' => admin_url('edit.php?post_type='.Application::POST_TYPE.'&page=welcome'),
19
-        ]);
17
+        $links['welcome'] = glsr( Builder::class )->a( __( 'About', 'site-reviews' ), [
18
+            'href' => admin_url( 'edit.php?post_type='.Application::POST_TYPE.'&page=welcome' ),
19
+        ] );
20 20
         return $links;
21 21
     }
22 22
 
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
      * @return string
25 25
      * @filter admin_title
26 26
      */
27
-    public function filterAdminTitle($title)
27
+    public function filterAdminTitle( $title )
28 28
     {
29 29
         return Application::POST_TYPE.'_page_welcome' == glsr_current_screen()->id
30
-            ? sprintf(__('Welcome to %s &#8212; WordPress', 'site-reviews'), glsr()->name)
30
+            ? sprintf( __( 'Welcome to %s &#8212; WordPress', 'site-reviews' ), glsr()->name )
31 31
             : $title;
32 32
     }
33 33
 
@@ -36,17 +36,17 @@  discard block
 block discarded – undo
36 36
      * @return string
37 37
      * @filter admin_footer_text
38 38
      */
39
-    public function filterFooterText($text)
39
+    public function filterFooterText( $text )
40 40
     {
41
-        if (Application::POST_TYPE.'_page_welcome' != glsr_current_screen()->id) {
41
+        if( Application::POST_TYPE.'_page_welcome' != glsr_current_screen()->id ) {
42 42
             return $text;
43 43
         }
44 44
         $url = 'https://wordpress.org/support/view/plugin-reviews/site-reviews?filter=5#new-post';
45
-        return wp_kses_post(sprintf(
46
-            __('Please rate %s on %s and help us spread the word. Thank you so much!', 'site-reviews'),
45
+        return wp_kses_post( sprintf(
46
+            __( 'Please rate %s on %s and help us spread the word. Thank you so much!', 'site-reviews' ),
47 47
             '<strong>'.glsr()->name.'</strong> <a href="'.$url.'" target="_blank">&#9733;&#9733;&#9733;&#9733;&#9733;</a>',
48 48
             '<a href="'.$url.'" target="_blank">wordpress.org</a>'
49
-        ));
49
+        ) );
50 50
     }
51 51
 
52 52
     /**
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
      * @return void
56 56
      * @action activated_plugin
57 57
      */
58
-    public function redirectOnActivation($plugin, $isNetworkActivation)
58
+    public function redirectOnActivation( $plugin, $isNetworkActivation )
59 59
     {
60
-        if (!$isNetworkActivation
60
+        if( !$isNetworkActivation
61 61
             && 'cli' !== php_sapi_name()
62
-            && $plugin === plugin_basename(glsr()->file)) {
63
-            wp_safe_redirect(admin_url('edit.php?post_type='.Application::POST_TYPE.'&page=welcome'));
62
+            && $plugin === plugin_basename( glsr()->file ) ) {
63
+            wp_safe_redirect( admin_url( 'edit.php?post_type='.Application::POST_TYPE.'&page=welcome' ) );
64 64
             exit;
65 65
         }
66 66
     }
@@ -71,14 +71,14 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function registerPage()
73 73
     {
74
-        add_submenu_page('edit.php?post_type='.Application::POST_TYPE,
75
-            sprintf(__('Welcome to %s', 'site-reviews'), glsr()->name),
74
+        add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE,
75
+            sprintf( __( 'Welcome to %s', 'site-reviews' ), glsr()->name ),
76 76
             glsr()->name,
77
-            glsr()->getPermission('welcome'),
77
+            glsr()->getPermission( 'welcome' ),
78 78
             'welcome',
79 79
             [$this, 'renderPage']
80 80
         );
81
-        remove_submenu_page('edit.php?post_type='.Application::POST_TYPE, 'welcome');
81
+        remove_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, 'welcome' );
82 82
     }
83 83
 
84 84
     /**
@@ -88,17 +88,17 @@  discard block
 block discarded – undo
88 88
      */
89 89
     public function renderPage()
90 90
     {
91
-        $tabs = apply_filters('site-reviews/addon/welcome/tabs', [
92
-            'getting-started' => __('Getting Started', 'site-reviews'),
93
-            'whatsnew' => __('What\'s New', 'site-reviews'),
94
-            'upgrade-guide' => __('Upgrade Guide', 'site-reviews'),
95
-            'support' => __('Support', 'site-reviews'),
96
-        ]);
97
-        glsr()->render('pages/welcome/index', [
91
+        $tabs = apply_filters( 'site-reviews/addon/welcome/tabs', [
92
+            'getting-started' => __( 'Getting Started', 'site-reviews' ),
93
+            'whatsnew' => __( 'What\'s New', 'site-reviews' ),
94
+            'upgrade-guide' => __( 'Upgrade Guide', 'site-reviews' ),
95
+            'support' => __( 'Support', 'site-reviews' ),
96
+        ] );
97
+        glsr()->render( 'pages/welcome/index', [
98 98
             'data' => ['context' => []],
99
-            'http_referer' => (string) wp_get_referer(),
99
+            'http_referer' => (string)wp_get_referer(),
100 100
             'tabs' => $tabs,
101
-            'template' => glsr(Template::class),
102
-        ]);
101
+            'template' => glsr( Template::class ),
102
+        ] );
103 103
     }
104 104
 }
Please login to merge, or discard this patch.
plugin/Defaults/SiteReviewsDefaults.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -6,41 +6,41 @@
 block discarded – undo
6 6
 
7 7
 class SiteReviewsDefaults extends Defaults
8 8
 {
9
-    /**
10
-     * @var array
11
-     */
12
-    protected $guarded = [
13
-        'fallback',
14
-        'title',
15
-    ];
9
+	/**
10
+	 * @var array
11
+	 */
12
+	protected $guarded = [
13
+		'fallback',
14
+		'title',
15
+	];
16 16
 
17
-    /**
18
-     * @var array
19
-     */
20
-    protected $mapped = [
21
-        'count' => 'display', // @deprecated since v4.1.0
22
-        'per_page' => 'display',
23
-    ];
17
+	/**
18
+	 * @var array
19
+	 */
20
+	protected $mapped = [
21
+		'count' => 'display', // @deprecated since v4.1.0
22
+		'per_page' => 'display',
23
+	];
24 24
 
25
-    /**
26
-     * @return array
27
-     */
28
-    protected function defaults()
29
-    {
30
-        return [
31
-            'assigned_to' => '',
32
-            'category' => '',
33
-            'class' => '',
34
-            'display' => 5,
35
-            'fallback' => '',
36
-            'hide' => [],
37
-            'id' => '',
38
-            'offset' => '',
39
-            'pagination' => false,
40
-            'rating' => 0,
41
-            'schema' => false,
42
-            'title' => '',
43
-            'type' => 'local',
44
-        ];
45
-    }
25
+	/**
26
+	 * @return array
27
+	 */
28
+	protected function defaults()
29
+	{
30
+		return [
31
+			'assigned_to' => '',
32
+			'category' => '',
33
+			'class' => '',
34
+			'display' => 5,
35
+			'fallback' => '',
36
+			'hide' => [],
37
+			'id' => '',
38
+			'offset' => '',
39
+			'pagination' => false,
40
+			'rating' => 0,
41
+			'schema' => false,
42
+			'title' => '',
43
+			'type' => 'local',
44
+		];
45
+	}
46 46
 }
Please login to merge, or discard this patch.
plugin/Defaults/ReviewsDefaults.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -6,31 +6,31 @@
 block discarded – undo
6 6
 
7 7
 class ReviewsDefaults extends Defaults
8 8
 {
9
-    /**
10
-     * @var array
11
-     */
12
-    protected $mapped = [
13
-        'count' => 'per_page', // @deprecated since v4.1.0
14
-        'display' => 'per_page',
15
-    ];
9
+	/**
10
+	 * @var array
11
+	 */
12
+	protected $mapped = [
13
+		'count' => 'per_page', // @deprecated since v4.1.0
14
+		'display' => 'per_page',
15
+	];
16 16
 
17
-    /**
18
-     * @return array
19
-     */
20
-    protected function defaults()
21
-    {
22
-        return [
23
-            'assigned_to' => '',
24
-            'category' => '',
25
-            'offset' => '',
26
-            'order' => 'DESC',
27
-            'orderby' => 'date',
28
-            'pagination' => false,
29
-            'per_page' => 10,
30
-            'post__in' => [],
31
-            'post__not_in' => [],
32
-            'rating' => '',
33
-            'type' => '',
34
-        ];
35
-    }
17
+	/**
18
+	 * @return array
19
+	 */
20
+	protected function defaults()
21
+	{
22
+		return [
23
+			'assigned_to' => '',
24
+			'category' => '',
25
+			'offset' => '',
26
+			'order' => 'DESC',
27
+			'orderby' => 'date',
28
+			'pagination' => false,
29
+			'per_page' => 10,
30
+			'post__in' => [],
31
+			'post__not_in' => [],
32
+			'rating' => '',
33
+			'type' => '',
34
+		];
35
+	}
36 36
 }
Please login to merge, or discard this patch.