Passed
Push — master ( b19f24...47cb12 )
by Paul
04:18
created
plugin/Modules/Html/Partials/Pagination.php 2 patches
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -11,74 +11,74 @@
 block discarded – undo
11 11
 
12 12
 class Pagination implements PartialContract
13 13
 {
14
-    /**
15
-     * @var array
16
-     */
17
-    protected $args;
14
+	/**
15
+	 * @var array
16
+	 */
17
+	protected $args;
18 18
 
19
-    /**
20
-     * @return string
21
-     */
22
-    public function build(array $args = [])
23
-    {
24
-        $this->args = $this->normalize($args);
25
-        if ($this->args['total'] < 2) {
26
-            return '';
27
-        }
28
-        return glsr(Template::class)->build('templates/pagination', [
29
-            'context' => [
30
-                'links' => apply_filters('site-reviews/paginate_links', $this->buildLinks(), $this->args),
31
-                'loader' => '<div class="glsr-loader"></div>',
32
-                'screen_reader_text' => __('Site Reviews navigation', 'site-reviews'),
33
-            ],
34
-        ]);
35
-    }
19
+	/**
20
+	 * @return string
21
+	 */
22
+	public function build(array $args = [])
23
+	{
24
+		$this->args = $this->normalize($args);
25
+		if ($this->args['total'] < 2) {
26
+			return '';
27
+		}
28
+		return glsr(Template::class)->build('templates/pagination', [
29
+			'context' => [
30
+				'links' => apply_filters('site-reviews/paginate_links', $this->buildLinks(), $this->args),
31
+				'loader' => '<div class="glsr-loader"></div>',
32
+				'screen_reader_text' => __('Site Reviews navigation', 'site-reviews'),
33
+			],
34
+		]);
35
+	}
36 36
 
37
-    /**
38
-     * @return string
39
-     */
40
-    protected function buildFauxLinks()
41
-    {
42
-        $links = paginate_links(wp_parse_args(['type' => 'array'], $this->args));
43
-        $pattern = '/(href=["\'])([^"\']*?)(["\'])/i';
44
-        foreach ($links as &$link) {
45
-            if (!preg_match($pattern, $link, $matches)) {
46
-                continue;
47
-            }
48
-            parse_str(parse_url(Arr::get($matches, 2), PHP_URL_QUERY), $urlQuery);
49
-            $page = (int) Arr::get($urlQuery, glsr()->constant('PAGED_QUERY_VAR'), 1);
50
-            $replacement = sprintf('data-page="%d" href="#"', $page);
51
-            $link = str_replace(Arr::get($matches, 0), $replacement, $link);
52
-        }
53
-        return implode("\n", $links);
54
-    }
37
+	/**
38
+	 * @return string
39
+	 */
40
+	protected function buildFauxLinks()
41
+	{
42
+		$links = paginate_links(wp_parse_args(['type' => 'array'], $this->args));
43
+		$pattern = '/(href=["\'])([^"\']*?)(["\'])/i';
44
+		foreach ($links as &$link) {
45
+			if (!preg_match($pattern, $link, $matches)) {
46
+				continue;
47
+			}
48
+			parse_str(parse_url(Arr::get($matches, 2), PHP_URL_QUERY), $urlQuery);
49
+			$page = (int) Arr::get($urlQuery, glsr()->constant('PAGED_QUERY_VAR'), 1);
50
+			$replacement = sprintf('data-page="%d" href="#"', $page);
51
+			$link = str_replace(Arr::get($matches, 0), $replacement, $link);
52
+		}
53
+		return implode("\n", $links);
54
+	}
55 55
 
56
-    /**
57
-     * @return string
58
-     */
59
-    protected function buildLinks()
60
-    {
61
-        return glsr(OptionManager::class)->getBool('settings.reviews.pagination.url_parameter')
62
-            ? paginate_links($this->args)
63
-            : $this->buildFauxLinks();
64
-    }
56
+	/**
57
+	 * @return string
58
+	 */
59
+	protected function buildLinks()
60
+	{
61
+		return glsr(OptionManager::class)->getBool('settings.reviews.pagination.url_parameter')
62
+			? paginate_links($this->args)
63
+			: $this->buildFauxLinks();
64
+	}
65 65
 
66
-    /**
67
-     * @return array
68
-     */
69
-    protected function normalize(array $args)
70
-    {
71
-        if ($baseUrl = Arr::get($args, 'baseUrl')) {
72
-            $args['base'] = $baseUrl.'%_%';
73
-        }
74
-        $args = wp_parse_args(array_filter($args), [
75
-            'current' => glsr(QueryBuilder::class)->getPaged(),
76
-            'total' => 1,
77
-        ]);
78
-        $args = glsr(Style::class)->paginationArgs($args);
79
-        if ('array' == $args['type']) {
80
-            $args['type'] = 'plain';
81
-        }
82
-        return $args;
83
-    }
66
+	/**
67
+	 * @return array
68
+	 */
69
+	protected function normalize(array $args)
70
+	{
71
+		if ($baseUrl = Arr::get($args, 'baseUrl')) {
72
+			$args['base'] = $baseUrl.'%_%';
73
+		}
74
+		$args = wp_parse_args(array_filter($args), [
75
+			'current' => glsr(QueryBuilder::class)->getPaged(),
76
+			'total' => 1,
77
+		]);
78
+		$args = glsr(Style::class)->paginationArgs($args);
79
+		if ('array' == $args['type']) {
80
+			$args['type'] = 'plain';
81
+		}
82
+		return $args;
83
+	}
84 84
 }
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -19,19 +19,19 @@  discard block
 block discarded – undo
19 19
     /**
20 20
      * @return string
21 21
      */
22
-    public function build(array $args = [])
22
+    public function build( array $args = [] )
23 23
     {
24
-        $this->args = $this->normalize($args);
25
-        if ($this->args['total'] < 2) {
24
+        $this->args = $this->normalize( $args );
25
+        if( $this->args['total'] < 2 ) {
26 26
             return '';
27 27
         }
28
-        return glsr(Template::class)->build('templates/pagination', [
28
+        return glsr( Template::class )->build( 'templates/pagination', [
29 29
             'context' => [
30
-                'links' => apply_filters('site-reviews/paginate_links', $this->buildLinks(), $this->args),
30
+                'links' => apply_filters( 'site-reviews/paginate_links', $this->buildLinks(), $this->args ),
31 31
                 'loader' => '<div class="glsr-loader"></div>',
32
-                'screen_reader_text' => __('Site Reviews navigation', 'site-reviews'),
32
+                'screen_reader_text' => __( 'Site Reviews navigation', 'site-reviews' ),
33 33
             ],
34
-        ]);
34
+        ] );
35 35
     }
36 36
 
37 37
     /**
@@ -39,18 +39,18 @@  discard block
 block discarded – undo
39 39
      */
40 40
     protected function buildFauxLinks()
41 41
     {
42
-        $links = paginate_links(wp_parse_args(['type' => 'array'], $this->args));
42
+        $links = paginate_links( wp_parse_args( ['type' => 'array'], $this->args ) );
43 43
         $pattern = '/(href=["\'])([^"\']*?)(["\'])/i';
44
-        foreach ($links as &$link) {
45
-            if (!preg_match($pattern, $link, $matches)) {
44
+        foreach( $links as &$link ) {
45
+            if( !preg_match( $pattern, $link, $matches ) ) {
46 46
                 continue;
47 47
             }
48
-            parse_str(parse_url(Arr::get($matches, 2), PHP_URL_QUERY), $urlQuery);
49
-            $page = (int) Arr::get($urlQuery, glsr()->constant('PAGED_QUERY_VAR'), 1);
50
-            $replacement = sprintf('data-page="%d" href="#"', $page);
51
-            $link = str_replace(Arr::get($matches, 0), $replacement, $link);
48
+            parse_str( parse_url( Arr::get( $matches, 2 ), PHP_URL_QUERY ), $urlQuery );
49
+            $page = (int)Arr::get( $urlQuery, glsr()->constant( 'PAGED_QUERY_VAR' ), 1 );
50
+            $replacement = sprintf( 'data-page="%d" href="#"', $page );
51
+            $link = str_replace( Arr::get( $matches, 0 ), $replacement, $link );
52 52
         }
53
-        return implode("\n", $links);
53
+        return implode( "\n", $links );
54 54
     }
55 55
 
56 56
     /**
@@ -58,25 +58,25 @@  discard block
 block discarded – undo
58 58
      */
59 59
     protected function buildLinks()
60 60
     {
61
-        return glsr(OptionManager::class)->getBool('settings.reviews.pagination.url_parameter')
62
-            ? paginate_links($this->args)
61
+        return glsr( OptionManager::class )->getBool( 'settings.reviews.pagination.url_parameter' )
62
+            ? paginate_links( $this->args )
63 63
             : $this->buildFauxLinks();
64 64
     }
65 65
 
66 66
     /**
67 67
      * @return array
68 68
      */
69
-    protected function normalize(array $args)
69
+    protected function normalize( array $args )
70 70
     {
71
-        if ($baseUrl = Arr::get($args, 'baseUrl')) {
71
+        if( $baseUrl = Arr::get( $args, 'baseUrl' ) ) {
72 72
             $args['base'] = $baseUrl.'%_%';
73 73
         }
74
-        $args = wp_parse_args(array_filter($args), [
75
-            'current' => glsr(QueryBuilder::class)->getPaged(),
74
+        $args = wp_parse_args( array_filter( $args ), [
75
+            'current' => glsr( QueryBuilder::class )->getPaged(),
76 76
             'total' => 1,
77
-        ]);
78
-        $args = glsr(Style::class)->paginationArgs($args);
79
-        if ('array' == $args['type']) {
77
+        ] );
78
+        $args = glsr( Style::class )->paginationArgs( $args );
79
+        if( 'array' == $args['type'] ) {
80 80
             $args['type'] = 'plain';
81 81
         }
82 82
         return $args;
Please login to merge, or discard this patch.
plugin/Controllers/AjaxController.php 2 patches
Indentation   +179 added lines, -179 removed lines patch added patch discarded remove patch
@@ -15,195 +15,195 @@
 block discarded – undo
15 15
 
16 16
 class AjaxController extends Controller
17 17
 {
18
-    /**
19
-     * @return void
20
-     */
21
-    public function routerChangeStatus(array $request)
22
-    {
23
-        wp_send_json_success($this->execute(new ChangeStatus($request)));
24
-    }
18
+	/**
19
+	 * @return void
20
+	 */
21
+	public function routerChangeStatus(array $request)
22
+	{
23
+		wp_send_json_success($this->execute(new ChangeStatus($request)));
24
+	}
25 25
 
26
-    /**
27
-     * @return void
28
-     */
29
-    public function routerClearConsole()
30
-    {
31
-        glsr(AdminController::class)->routerClearConsole();
32
-        wp_send_json_success([
33
-            'console' => glsr(Console::class)->get(),
34
-            'notices' => glsr(Notice::class)->get(),
35
-        ]);
36
-    }
26
+	/**
27
+	 * @return void
28
+	 */
29
+	public function routerClearConsole()
30
+	{
31
+		glsr(AdminController::class)->routerClearConsole();
32
+		wp_send_json_success([
33
+			'console' => glsr(Console::class)->get(),
34
+			'notices' => glsr(Notice::class)->get(),
35
+		]);
36
+	}
37 37
 
38
-    /**
39
-     * @return void
40
-     */
41
-    public function routerCountReviews()
42
-    {
43
-        glsr(AdminController::class)->routerCountReviews();
44
-        wp_send_json_success([
45
-            'notices' => glsr(Notice::class)->get(),
46
-        ]);
47
-    }
38
+	/**
39
+	 * @return void
40
+	 */
41
+	public function routerCountReviews()
42
+	{
43
+		glsr(AdminController::class)->routerCountReviews();
44
+		wp_send_json_success([
45
+			'notices' => glsr(Notice::class)->get(),
46
+		]);
47
+	}
48 48
 
49
-    /**
50
-     * @return void
51
-     */
52
-    public function routerMigrateReviews()
53
-    {
54
-        glsr(AdminController::class)->routerMigrateReviews();
55
-        wp_send_json_success([
56
-            'notices' => glsr(Notice::class)->get(),
57
-        ]);
58
-    }
49
+	/**
50
+	 * @return void
51
+	 */
52
+	public function routerMigrateReviews()
53
+	{
54
+		glsr(AdminController::class)->routerMigrateReviews();
55
+		wp_send_json_success([
56
+			'notices' => glsr(Notice::class)->get(),
57
+		]);
58
+	}
59 59
 
60
-    /**
61
-     * @return void
62
-     */
63
-    public function routerDismissNotice(array $request)
64
-    {
65
-        glsr(NoticeController::class)->routerDismissNotice($request);
66
-        wp_send_json_success();
67
-    }
60
+	/**
61
+	 * @return void
62
+	 */
63
+	public function routerDismissNotice(array $request)
64
+	{
65
+		glsr(NoticeController::class)->routerDismissNotice($request);
66
+		wp_send_json_success();
67
+	}
68 68
 
69
-    /**
70
-     * @return void
71
-     */
72
-    public function routerMceShortcode(array $request)
73
-    {
74
-        $shortcode = $request['shortcode'];
75
-        $response = false;
76
-        if (array_key_exists($shortcode, glsr()->mceShortcodes)) {
77
-            $data = glsr()->mceShortcodes[$shortcode];
78
-            if (!empty($data['errors'])) {
79
-                $data['btn_okay'] = [esc_html__('Okay', 'site-reviews')];
80
-            }
81
-            $response = [
82
-                'body' => $data['fields'],
83
-                'close' => $data['btn_close'],
84
-                'ok' => $data['btn_okay'],
85
-                'shortcode' => $shortcode,
86
-                'title' => $data['title'],
87
-            ];
88
-        }
89
-        wp_send_json_success($response);
90
-    }
69
+	/**
70
+	 * @return void
71
+	 */
72
+	public function routerMceShortcode(array $request)
73
+	{
74
+		$shortcode = $request['shortcode'];
75
+		$response = false;
76
+		if (array_key_exists($shortcode, glsr()->mceShortcodes)) {
77
+			$data = glsr()->mceShortcodes[$shortcode];
78
+			if (!empty($data['errors'])) {
79
+				$data['btn_okay'] = [esc_html__('Okay', 'site-reviews')];
80
+			}
81
+			$response = [
82
+				'body' => $data['fields'],
83
+				'close' => $data['btn_close'],
84
+				'ok' => $data['btn_okay'],
85
+				'shortcode' => $shortcode,
86
+				'title' => $data['title'],
87
+			];
88
+		}
89
+		wp_send_json_success($response);
90
+	}
91 91
 
92
-    /**
93
-     * @return void
94
-     */
95
-    public function routerFetchConsole()
96
-    {
97
-        glsr(AdminController::class)->routerFetchConsole();
98
-        wp_send_json_success([
99
-            'console' => glsr(Console::class)->get(),
100
-            'notices' => glsr(Notice::class)->get(),
101
-        ]);
102
-    }
92
+	/**
93
+	 * @return void
94
+	 */
95
+	public function routerFetchConsole()
96
+	{
97
+		glsr(AdminController::class)->routerFetchConsole();
98
+		wp_send_json_success([
99
+			'console' => glsr(Console::class)->get(),
100
+			'notices' => glsr(Notice::class)->get(),
101
+		]);
102
+	}
103 103
 
104
-    /**
105
-     * @return void
106
-     */
107
-    public function routerResetPermissions()
108
-    {
109
-        glsr(Role::class)->resetAll();
110
-        glsr(Notice::class)->clear()->addSuccess(__('The permissions have been reset, please reload the page for them to take effect.', 'site-reviews'));
111
-        wp_send_json_success([
112
-            'notices' => glsr(Notice::class)->get(),
113
-        ]);
114
-    }
104
+	/**
105
+	 * @return void
106
+	 */
107
+	public function routerResetPermissions()
108
+	{
109
+		glsr(Role::class)->resetAll();
110
+		glsr(Notice::class)->clear()->addSuccess(__('The permissions have been reset, please reload the page for them to take effect.', 'site-reviews'));
111
+		wp_send_json_success([
112
+			'notices' => glsr(Notice::class)->get(),
113
+		]);
114
+	}
115 115
 
116
-    /**
117
-     * @return void
118
-     */
119
-    public function routerSearchPosts(array $request)
120
-    {
121
-        $results = glsr(Database::class)->searchPosts($request['search']);
122
-        wp_send_json_success([
123
-            'empty' => '<div>'.__('Nothing found.', 'site-reviews').'</div>',
124
-            'items' => $results,
125
-        ]);
126
-    }
116
+	/**
117
+	 * @return void
118
+	 */
119
+	public function routerSearchPosts(array $request)
120
+	{
121
+		$results = glsr(Database::class)->searchPosts($request['search']);
122
+		wp_send_json_success([
123
+			'empty' => '<div>'.__('Nothing found.', 'site-reviews').'</div>',
124
+			'items' => $results,
125
+		]);
126
+	}
127 127
 
128
-    /**
129
-     * @return void
130
-     */
131
-    public function routerSearchTranslations(array $request)
132
-    {
133
-        if (empty($request['exclude'])) {
134
-            $request['exclude'] = [];
135
-        }
136
-        $results = glsr(Translation::class)
137
-            ->search($request['search'])
138
-            ->exclude()
139
-            ->exclude($request['exclude'])
140
-            ->renderResults();
141
-        wp_send_json_success([
142
-            'empty' => '<div>'.__('Nothing found.', 'site-reviews').'</div>',
143
-            'items' => $results,
144
-        ]);
145
-    }
128
+	/**
129
+	 * @return void
130
+	 */
131
+	public function routerSearchTranslations(array $request)
132
+	{
133
+		if (empty($request['exclude'])) {
134
+			$request['exclude'] = [];
135
+		}
136
+		$results = glsr(Translation::class)
137
+			->search($request['search'])
138
+			->exclude()
139
+			->exclude($request['exclude'])
140
+			->renderResults();
141
+		wp_send_json_success([
142
+			'empty' => '<div>'.__('Nothing found.', 'site-reviews').'</div>',
143
+			'items' => $results,
144
+		]);
145
+	}
146 146
 
147
-    /**
148
-     * @return void
149
-     */
150
-    public function routerSubmitReview(array $request)
151
-    {
152
-        $command = glsr(PublicController::class)->routerSubmitReview($request);
153
-        $redirect = trim(strval(get_post_meta($command->post_id, 'redirect_to', true)));
154
-        $redirect = apply_filters('site-reviews/review/redirect', $redirect, $command);
155
-        $data = [
156
-            'errors' => glsr()->sessionGet($command->form_id.'errors', false),
157
-            'message' => glsr()->sessionGet($command->form_id.'message', ''),
158
-            'recaptcha' => glsr()->sessionGet($command->form_id.'recaptcha', false),
159
-            'redirect' => $redirect,
160
-        ];
161
-        if (false === $data['errors']) {
162
-            glsr()->sessionClear();
163
-            wp_send_json_success($data);
164
-        }
165
-        wp_send_json_error($data);
166
-    }
147
+	/**
148
+	 * @return void
149
+	 */
150
+	public function routerSubmitReview(array $request)
151
+	{
152
+		$command = glsr(PublicController::class)->routerSubmitReview($request);
153
+		$redirect = trim(strval(get_post_meta($command->post_id, 'redirect_to', true)));
154
+		$redirect = apply_filters('site-reviews/review/redirect', $redirect, $command);
155
+		$data = [
156
+			'errors' => glsr()->sessionGet($command->form_id.'errors', false),
157
+			'message' => glsr()->sessionGet($command->form_id.'message', ''),
158
+			'recaptcha' => glsr()->sessionGet($command->form_id.'recaptcha', false),
159
+			'redirect' => $redirect,
160
+		];
161
+		if (false === $data['errors']) {
162
+			glsr()->sessionClear();
163
+			wp_send_json_success($data);
164
+		}
165
+		wp_send_json_error($data);
166
+	}
167 167
 
168
-    /**
169
-     * @return void
170
-     */
171
-    public function routerFetchPagedReviews(array $request)
172
-    {
173
-        $args = [
174
-            'paged' => Arr::get($request, 'page', false),
175
-            'pagedUrl' => '',
176
-            'pagination' => 'ajax',
177
-            'schema' => false,
178
-        ];
179
-        if (!$args['paged']) {
180
-            $homePath = untrailingslashit(parse_url(home_url(), PHP_URL_PATH));
181
-            $urlPath = untrailingslashit(parse_url(Arr::get($request, 'url'), PHP_URL_PATH));
182
-            $urlQuery = [];
183
-            parse_str(parse_url(Arr::get($request, 'url'), PHP_URL_QUERY), $urlQuery);
184
-            $args['paged'] = (int) Arr::get($urlQuery, glsr()->constant('PAGED_QUERY_VAR'), 1);
185
-            $args['pagedUrl'] = $homePath === $urlPath
186
-                ? trailingslashit(home_url())
187
-                : trailingslashit(home_url($urlPath));
188
-        }
189
-        $atts = (array) json_decode(Arr::get($request, 'atts'));
190
-        $atts = glsr(SiteReviewsShortcode::class)->normalizeAtts($atts);
191
-        $html = glsr(SiteReviewsPartial::class)->build(wp_parse_args($args, $atts));
192
-        return wp_send_json_success([
193
-            'pagination' => $html->getPagination(),
194
-            'reviews' => $html->getReviews(),
195
-        ]);
196
-    }
168
+	/**
169
+	 * @return void
170
+	 */
171
+	public function routerFetchPagedReviews(array $request)
172
+	{
173
+		$args = [
174
+			'paged' => Arr::get($request, 'page', false),
175
+			'pagedUrl' => '',
176
+			'pagination' => 'ajax',
177
+			'schema' => false,
178
+		];
179
+		if (!$args['paged']) {
180
+			$homePath = untrailingslashit(parse_url(home_url(), PHP_URL_PATH));
181
+			$urlPath = untrailingslashit(parse_url(Arr::get($request, 'url'), PHP_URL_PATH));
182
+			$urlQuery = [];
183
+			parse_str(parse_url(Arr::get($request, 'url'), PHP_URL_QUERY), $urlQuery);
184
+			$args['paged'] = (int) Arr::get($urlQuery, glsr()->constant('PAGED_QUERY_VAR'), 1);
185
+			$args['pagedUrl'] = $homePath === $urlPath
186
+				? trailingslashit(home_url())
187
+				: trailingslashit(home_url($urlPath));
188
+		}
189
+		$atts = (array) json_decode(Arr::get($request, 'atts'));
190
+		$atts = glsr(SiteReviewsShortcode::class)->normalizeAtts($atts);
191
+		$html = glsr(SiteReviewsPartial::class)->build(wp_parse_args($args, $atts));
192
+		return wp_send_json_success([
193
+			'pagination' => $html->getPagination(),
194
+			'reviews' => $html->getReviews(),
195
+		]);
196
+	}
197 197
 
198
-    /**
199
-     * @return void
200
-     */
201
-    public function routerTogglePinned(array $request)
202
-    {
203
-        $isPinned = $this->execute(new TogglePinned($request));
204
-        wp_send_json_success([
205
-            'notices' => glsr(Notice::class)->get(),
206
-            'pinned' => $isPinned,
207
-        ]);
208
-    }
198
+	/**
199
+	 * @return void
200
+	 */
201
+	public function routerTogglePinned(array $request)
202
+	{
203
+		$isPinned = $this->execute(new TogglePinned($request));
204
+		wp_send_json_success([
205
+			'notices' => glsr(Notice::class)->get(),
206
+			'pinned' => $isPinned,
207
+		]);
208
+	}
209 209
 }
Please login to merge, or discard this patch.
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
     /**
19 19
      * @return void
20 20
      */
21
-    public function routerChangeStatus(array $request)
21
+    public function routerChangeStatus( array $request )
22 22
     {
23
-        wp_send_json_success($this->execute(new ChangeStatus($request)));
23
+        wp_send_json_success( $this->execute( new ChangeStatus( $request ) ) );
24 24
     }
25 25
 
26 26
     /**
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public function routerClearConsole()
30 30
     {
31
-        glsr(AdminController::class)->routerClearConsole();
32
-        wp_send_json_success([
33
-            'console' => glsr(Console::class)->get(),
34
-            'notices' => glsr(Notice::class)->get(),
35
-        ]);
31
+        glsr( AdminController::class )->routerClearConsole();
32
+        wp_send_json_success( [
33
+            'console' => glsr( Console::class )->get(),
34
+            'notices' => glsr( Notice::class )->get(),
35
+        ] );
36 36
     }
37 37
 
38 38
     /**
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public function routerCountReviews()
42 42
     {
43
-        glsr(AdminController::class)->routerCountReviews();
44
-        wp_send_json_success([
45
-            'notices' => glsr(Notice::class)->get(),
46
-        ]);
43
+        glsr( AdminController::class )->routerCountReviews();
44
+        wp_send_json_success( [
45
+            'notices' => glsr( Notice::class )->get(),
46
+        ] );
47 47
     }
48 48
 
49 49
     /**
@@ -51,32 +51,32 @@  discard block
 block discarded – undo
51 51
      */
52 52
     public function routerMigrateReviews()
53 53
     {
54
-        glsr(AdminController::class)->routerMigrateReviews();
55
-        wp_send_json_success([
56
-            'notices' => glsr(Notice::class)->get(),
57
-        ]);
54
+        glsr( AdminController::class )->routerMigrateReviews();
55
+        wp_send_json_success( [
56
+            'notices' => glsr( Notice::class )->get(),
57
+        ] );
58 58
     }
59 59
 
60 60
     /**
61 61
      * @return void
62 62
      */
63
-    public function routerDismissNotice(array $request)
63
+    public function routerDismissNotice( array $request )
64 64
     {
65
-        glsr(NoticeController::class)->routerDismissNotice($request);
65
+        glsr( NoticeController::class )->routerDismissNotice( $request );
66 66
         wp_send_json_success();
67 67
     }
68 68
 
69 69
     /**
70 70
      * @return void
71 71
      */
72
-    public function routerMceShortcode(array $request)
72
+    public function routerMceShortcode( array $request )
73 73
     {
74 74
         $shortcode = $request['shortcode'];
75 75
         $response = false;
76
-        if (array_key_exists($shortcode, glsr()->mceShortcodes)) {
76
+        if( array_key_exists( $shortcode, glsr()->mceShortcodes ) ) {
77 77
             $data = glsr()->mceShortcodes[$shortcode];
78
-            if (!empty($data['errors'])) {
79
-                $data['btn_okay'] = [esc_html__('Okay', 'site-reviews')];
78
+            if( !empty($data['errors']) ) {
79
+                $data['btn_okay'] = [esc_html__( 'Okay', 'site-reviews' )];
80 80
             }
81 81
             $response = [
82 82
                 'body' => $data['fields'],
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
                 'title' => $data['title'],
87 87
             ];
88 88
         }
89
-        wp_send_json_success($response);
89
+        wp_send_json_success( $response );
90 90
     }
91 91
 
92 92
     /**
@@ -94,11 +94,11 @@  discard block
 block discarded – undo
94 94
      */
95 95
     public function routerFetchConsole()
96 96
     {
97
-        glsr(AdminController::class)->routerFetchConsole();
98
-        wp_send_json_success([
99
-            'console' => glsr(Console::class)->get(),
100
-            'notices' => glsr(Notice::class)->get(),
101
-        ]);
97
+        glsr( AdminController::class )->routerFetchConsole();
98
+        wp_send_json_success( [
99
+            'console' => glsr( Console::class )->get(),
100
+            'notices' => glsr( Notice::class )->get(),
101
+        ] );
102 102
     }
103 103
 
104 104
     /**
@@ -106,104 +106,104 @@  discard block
 block discarded – undo
106 106
      */
107 107
     public function routerResetPermissions()
108 108
     {
109
-        glsr(Role::class)->resetAll();
110
-        glsr(Notice::class)->clear()->addSuccess(__('The permissions have been reset, please reload the page for them to take effect.', 'site-reviews'));
111
-        wp_send_json_success([
112
-            'notices' => glsr(Notice::class)->get(),
113
-        ]);
109
+        glsr( Role::class )->resetAll();
110
+        glsr( Notice::class )->clear()->addSuccess( __( 'The permissions have been reset, please reload the page for them to take effect.', 'site-reviews' ) );
111
+        wp_send_json_success( [
112
+            'notices' => glsr( Notice::class )->get(),
113
+        ] );
114 114
     }
115 115
 
116 116
     /**
117 117
      * @return void
118 118
      */
119
-    public function routerSearchPosts(array $request)
119
+    public function routerSearchPosts( array $request )
120 120
     {
121
-        $results = glsr(Database::class)->searchPosts($request['search']);
122
-        wp_send_json_success([
123
-            'empty' => '<div>'.__('Nothing found.', 'site-reviews').'</div>',
121
+        $results = glsr( Database::class )->searchPosts( $request['search'] );
122
+        wp_send_json_success( [
123
+            'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>',
124 124
             'items' => $results,
125
-        ]);
125
+        ] );
126 126
     }
127 127
 
128 128
     /**
129 129
      * @return void
130 130
      */
131
-    public function routerSearchTranslations(array $request)
131
+    public function routerSearchTranslations( array $request )
132 132
     {
133
-        if (empty($request['exclude'])) {
133
+        if( empty($request['exclude']) ) {
134 134
             $request['exclude'] = [];
135 135
         }
136
-        $results = glsr(Translation::class)
137
-            ->search($request['search'])
136
+        $results = glsr( Translation::class )
137
+            ->search( $request['search'] )
138 138
             ->exclude()
139
-            ->exclude($request['exclude'])
139
+            ->exclude( $request['exclude'] )
140 140
             ->renderResults();
141
-        wp_send_json_success([
142
-            'empty' => '<div>'.__('Nothing found.', 'site-reviews').'</div>',
141
+        wp_send_json_success( [
142
+            'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>',
143 143
             'items' => $results,
144
-        ]);
144
+        ] );
145 145
     }
146 146
 
147 147
     /**
148 148
      * @return void
149 149
      */
150
-    public function routerSubmitReview(array $request)
150
+    public function routerSubmitReview( array $request )
151 151
     {
152
-        $command = glsr(PublicController::class)->routerSubmitReview($request);
153
-        $redirect = trim(strval(get_post_meta($command->post_id, 'redirect_to', true)));
154
-        $redirect = apply_filters('site-reviews/review/redirect', $redirect, $command);
152
+        $command = glsr( PublicController::class )->routerSubmitReview( $request );
153
+        $redirect = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ) ) );
154
+        $redirect = apply_filters( 'site-reviews/review/redirect', $redirect, $command );
155 155
         $data = [
156
-            'errors' => glsr()->sessionGet($command->form_id.'errors', false),
157
-            'message' => glsr()->sessionGet($command->form_id.'message', ''),
158
-            'recaptcha' => glsr()->sessionGet($command->form_id.'recaptcha', false),
156
+            'errors' => glsr()->sessionGet( $command->form_id.'errors', false ),
157
+            'message' => glsr()->sessionGet( $command->form_id.'message', '' ),
158
+            'recaptcha' => glsr()->sessionGet( $command->form_id.'recaptcha', false ),
159 159
             'redirect' => $redirect,
160 160
         ];
161
-        if (false === $data['errors']) {
161
+        if( false === $data['errors'] ) {
162 162
             glsr()->sessionClear();
163
-            wp_send_json_success($data);
163
+            wp_send_json_success( $data );
164 164
         }
165
-        wp_send_json_error($data);
165
+        wp_send_json_error( $data );
166 166
     }
167 167
 
168 168
     /**
169 169
      * @return void
170 170
      */
171
-    public function routerFetchPagedReviews(array $request)
171
+    public function routerFetchPagedReviews( array $request )
172 172
     {
173 173
         $args = [
174
-            'paged' => Arr::get($request, 'page', false),
174
+            'paged' => Arr::get( $request, 'page', false ),
175 175
             'pagedUrl' => '',
176 176
             'pagination' => 'ajax',
177 177
             'schema' => false,
178 178
         ];
179
-        if (!$args['paged']) {
180
-            $homePath = untrailingslashit(parse_url(home_url(), PHP_URL_PATH));
181
-            $urlPath = untrailingslashit(parse_url(Arr::get($request, 'url'), PHP_URL_PATH));
179
+        if( !$args['paged'] ) {
180
+            $homePath = untrailingslashit( parse_url( home_url(), PHP_URL_PATH ) );
181
+            $urlPath = untrailingslashit( parse_url( Arr::get( $request, 'url' ), PHP_URL_PATH ) );
182 182
             $urlQuery = [];
183
-            parse_str(parse_url(Arr::get($request, 'url'), PHP_URL_QUERY), $urlQuery);
184
-            $args['paged'] = (int) Arr::get($urlQuery, glsr()->constant('PAGED_QUERY_VAR'), 1);
183
+            parse_str( parse_url( Arr::get( $request, 'url' ), PHP_URL_QUERY ), $urlQuery );
184
+            $args['paged'] = (int)Arr::get( $urlQuery, glsr()->constant( 'PAGED_QUERY_VAR' ), 1 );
185 185
             $args['pagedUrl'] = $homePath === $urlPath
186
-                ? trailingslashit(home_url())
187
-                : trailingslashit(home_url($urlPath));
186
+                ? trailingslashit( home_url() )
187
+                : trailingslashit( home_url( $urlPath ) );
188 188
         }
189
-        $atts = (array) json_decode(Arr::get($request, 'atts'));
190
-        $atts = glsr(SiteReviewsShortcode::class)->normalizeAtts($atts);
191
-        $html = glsr(SiteReviewsPartial::class)->build(wp_parse_args($args, $atts));
192
-        return wp_send_json_success([
189
+        $atts = (array)json_decode( Arr::get( $request, 'atts' ) );
190
+        $atts = glsr( SiteReviewsShortcode::class )->normalizeAtts( $atts );
191
+        $html = glsr( SiteReviewsPartial::class )->build( wp_parse_args( $args, $atts ) );
192
+        return wp_send_json_success( [
193 193
             'pagination' => $html->getPagination(),
194 194
             'reviews' => $html->getReviews(),
195
-        ]);
195
+        ] );
196 196
     }
197 197
 
198 198
     /**
199 199
      * @return void
200 200
      */
201
-    public function routerTogglePinned(array $request)
201
+    public function routerTogglePinned( array $request )
202 202
     {
203
-        $isPinned = $this->execute(new TogglePinned($request));
204
-        wp_send_json_success([
205
-            'notices' => glsr(Notice::class)->get(),
203
+        $isPinned = $this->execute( new TogglePinned( $request ) );
204
+        wp_send_json_success( [
205
+            'notices' => glsr( Notice::class )->get(),
206 206
             'pinned' => $isPinned,
207
-        ]);
207
+        ] );
208 208
     }
209 209
 }
Please login to merge, or discard this patch.