Passed
Push — feature/rebusify ( 816514...289185 )
by Paul
07:17
created
plugin/Controllers/AdminController.php 2 patches
Indentation   +215 added lines, -215 removed lines patch added patch discarded remove patch
@@ -15,219 +15,219 @@
 block discarded – undo
15 15
 
16 16
 class AdminController extends Controller
17 17
 {
18
-    /**
19
-     * @return void
20
-     * @action admin_enqueue_scripts
21
-     */
22
-    public function enqueueAssets()
23
-    {
24
-        $command = new EnqueueAdminAssets([
25
-            'pointers' => [[
26
-                'content' => __('You can pin exceptional reviews so that they are always shown first.', 'site-reviews'),
27
-                'id' => 'glsr-pointer-pinned',
28
-                'position' => [
29
-                    'edge' => 'right',
30
-                    'align' => 'middle',
31
-                ],
32
-                'screen' => Application::POST_TYPE,
33
-                'target' => '#misc-pub-pinned',
34
-                'title' => __('Pin Your Reviews', 'site-reviews'),
35
-            ]],
36
-        ]);
37
-        $this->execute($command);
38
-    }
39
-
40
-    /**
41
-     * @return array
42
-     * @filter plugin_action_links_site-reviews/site-reviews.php
43
-     */
44
-    public function filterActionLinks(array $links)
45
-    {
46
-        $links['settings'] = glsr(Builder::class)->a(__('Settings', 'site-reviews'), [
47
-            'href' => admin_url('edit.php?post_type='.Application::POST_TYPE.'&page=settings'),
48
-        ]);
49
-        return $links;
50
-    }
51
-
52
-    /**
53
-     * @param array $capabilities
54
-     * @param string $capability
55
-     * @return array
56
-     * @filter map_meta_cap
57
-     */
58
-    public function filterCreateCapability($capabilities, $capability)
59
-    {
60
-        if ($capability == 'create_'.Application::POST_TYPE) {
61
-            $capabilities[] = 'do_not_allow';
62
-        }
63
-        return $capabilities;
64
-    }
65
-
66
-    /**
67
-     * @param array $items
68
-     * @return array
69
-     * @filter dashboard_glance_items
70
-     */
71
-    public function filterDashboardGlanceItems($items)
72
-    {
73
-        $postCount = wp_count_posts(Application::POST_TYPE);
74
-        if (empty($postCount->publish)) {
75
-            return $items;
76
-        }
77
-        $text = _n('%s Review', '%s Reviews', $postCount->publish, 'site-reviews');
78
-        $text = sprintf($text, number_format_i18n($postCount->publish));
79
-        $items = glsr(Helper::class)->consolidateArray($items);
80
-        $items[] = current_user_can(get_post_type_object(Application::POST_TYPE)->cap->edit_posts)
81
-            ? glsr(Builder::class)->a($text, [
82
-                'class' => 'glsr-review-count',
83
-                'href' => 'edit.php?post_type='.Application::POST_TYPE,
84
-            ])
85
-            : glsr(Builder::class)->span($text, [
86
-                'class' => 'glsr-review-count',
87
-            ]);
88
-        return $items;
89
-    }
90
-
91
-    /**
92
-     * @param array $plugins
93
-     * @return array
94
-     * @filter mce_external_plugins
95
-     */
96
-    public function filterTinymcePlugins($plugins)
97
-    {
98
-        if (current_user_can('edit_posts') || current_user_can('edit_pages')) {
99
-            $plugins = glsr(Helper::class)->consolidateArray($plugins);
100
-            $plugins['glsr_shortcode'] = glsr()->url('assets/scripts/mce-plugin.js');
101
-        }
102
-        return $plugins;
103
-    }
104
-
105
-    /**
106
-     * @return void
107
-     * @action admin_init
108
-     */
109
-    public function registerTinymcePopups()
110
-    {
111
-        $command = new RegisterTinymcePopups([
112
-            'site_reviews' => esc_html__('Recent Reviews', 'site-reviews'),
113
-            'site_reviews_form' => esc_html__('Submit a Review', 'site-reviews'),
114
-            'site_reviews_summary' => esc_html__('Summary of Reviews', 'site-reviews'),
115
-        ]);
116
-        $this->execute($command);
117
-    }
118
-
119
-    /**
120
-     * @param string $editorId
121
-     * @return void|null
122
-     * @action media_buttons
123
-     */
124
-    public function renderTinymceButton($editorId)
125
-    {
126
-        $allowedEditors = apply_filters('site-reviews/tinymce/editor-ids', ['content'], $editorId);
127
-        if ('post' != glsr_current_screen()->base || !in_array($editorId, $allowedEditors)) {
128
-            return;
129
-        }
130
-        $shortcodes = [];
131
-        foreach (glsr()->mceShortcodes as $shortcode => $values) {
132
-            $shortcodes[$shortcode] = $values;
133
-        }
134
-        if (empty($shortcodes)) {
135
-            return;
136
-        }
137
-        glsr()->render('partials/editor/tinymce', [
138
-            'shortcodes' => $shortcodes,
139
-        ]);
140
-    }
141
-
142
-    /**
143
-     * @return void
144
-     */
145
-    public function routerClearConsole()
146
-    {
147
-        glsr(Console::class)->clear();
148
-        glsr(Notice::class)->addSuccess(__('Console cleared.', 'site-reviews'));
149
-    }
150
-
151
-    /**
152
-     * @return void
153
-     */
154
-    public function routerFetchConsole()
155
-    {
156
-        glsr(Notice::class)->addSuccess(__('Console reloaded.', 'site-reviews'));
157
-    }
158
-
159
-    /**
160
-     * @param bool $showNotice
161
-     * @return void
162
-     */
163
-    public function routerCountReviews($showNotice = true)
164
-    {
165
-        glsr(CountsManager::class)->countAll();
166
-        glsr(OptionManager::class)->set('last_review_count', current_time('timestamp'));
167
-        if ($showNotice) {
168
-            glsr(Notice::class)->clear()->addSuccess(__('Recalculated rating counts.', 'site-reviews'));
169
-        }
170
-    }
171
-
172
-    /**
173
-     * @return void
174
-     */
175
-    public function routerDownloadConsole()
176
-    {
177
-        $this->download(Application::ID.'-console.txt', glsr(Console::class)->get());
178
-    }
179
-
180
-    /**
181
-     * @return void
182
-     */
183
-    public function routerDownloadSystemInfo()
184
-    {
185
-        $this->download(Application::ID.'-system-info.txt', glsr(System::class)->get());
186
-    }
187
-
188
-    /**
189
-     * @return void
190
-     */
191
-    public function routerExportSettings()
192
-    {
193
-        $this->download(Application::ID.'-settings.json', glsr(OptionManager::class)->json());
194
-    }
195
-
196
-    /**
197
-     * @return void
198
-     */
199
-    public function routerImportSettings()
200
-    {
201
-        $file = $_FILES['import-file'];
202
-        if (UPLOAD_ERR_OK !== $file['error']) {
203
-            return glsr(Notice::class)->addError($this->getUploadError($file['error']));
204
-        }
205
-        if ('application/json' !== $file['type'] || !glsr(Helper::class)->endsWith('.json', $file['name'])) {
206
-            return glsr(Notice::class)->addError(__('Please use a valid Site Reviews settings file.', 'site-reviews'));
207
-        }
208
-        $settings = json_decode(file_get_contents($file['tmp_name']), true);
209
-        if (empty($settings)) {
210
-            return glsr(Notice::class)->addWarning(__('There were no settings found to import.', 'site-reviews'));
211
-        }
212
-        glsr(OptionManager::class)->set(glsr(OptionManager::class)->normalize($settings));
213
-        glsr(Notice::class)->addSuccess(__('Settings imported.', 'site-reviews'));
214
-    }
215
-
216
-    /**
217
-     * @param int $errorCode
218
-     * @return string
219
-     */
220
-    protected function getUploadError($errorCode)
221
-    {
222
-        $errors = [
223
-            UPLOAD_ERR_INI_SIZE => __('The uploaded file exceeds the upload_max_filesize directive in php.ini.', 'site-reviews'),
224
-            UPLOAD_ERR_FORM_SIZE => __('The uploaded file is too big.', 'site-reviews'),
225
-            UPLOAD_ERR_PARTIAL => __('The uploaded file was only partially uploaded.', 'site-reviews'),
226
-            UPLOAD_ERR_NO_FILE => __('No file was uploaded.', 'site-reviews'),
227
-            UPLOAD_ERR_NO_TMP_DIR => __('Missing a temporary folder.', 'site-reviews'),
228
-            UPLOAD_ERR_CANT_WRITE => __('Failed to write file to disk.', 'site-reviews'),
229
-            UPLOAD_ERR_EXTENSION => __('A PHP extension stopped the file upload.', 'site-reviews'),
230
-        ];
231
-        return glsr_get($errors, $errorCode, __('Unknown upload error.', 'site-reviews'));
232
-    }
18
+	/**
19
+	 * @return void
20
+	 * @action admin_enqueue_scripts
21
+	 */
22
+	public function enqueueAssets()
23
+	{
24
+		$command = new EnqueueAdminAssets([
25
+			'pointers' => [[
26
+				'content' => __('You can pin exceptional reviews so that they are always shown first.', 'site-reviews'),
27
+				'id' => 'glsr-pointer-pinned',
28
+				'position' => [
29
+					'edge' => 'right',
30
+					'align' => 'middle',
31
+				],
32
+				'screen' => Application::POST_TYPE,
33
+				'target' => '#misc-pub-pinned',
34
+				'title' => __('Pin Your Reviews', 'site-reviews'),
35
+			]],
36
+		]);
37
+		$this->execute($command);
38
+	}
39
+
40
+	/**
41
+	 * @return array
42
+	 * @filter plugin_action_links_site-reviews/site-reviews.php
43
+	 */
44
+	public function filterActionLinks(array $links)
45
+	{
46
+		$links['settings'] = glsr(Builder::class)->a(__('Settings', 'site-reviews'), [
47
+			'href' => admin_url('edit.php?post_type='.Application::POST_TYPE.'&page=settings'),
48
+		]);
49
+		return $links;
50
+	}
51
+
52
+	/**
53
+	 * @param array $capabilities
54
+	 * @param string $capability
55
+	 * @return array
56
+	 * @filter map_meta_cap
57
+	 */
58
+	public function filterCreateCapability($capabilities, $capability)
59
+	{
60
+		if ($capability == 'create_'.Application::POST_TYPE) {
61
+			$capabilities[] = 'do_not_allow';
62
+		}
63
+		return $capabilities;
64
+	}
65
+
66
+	/**
67
+	 * @param array $items
68
+	 * @return array
69
+	 * @filter dashboard_glance_items
70
+	 */
71
+	public function filterDashboardGlanceItems($items)
72
+	{
73
+		$postCount = wp_count_posts(Application::POST_TYPE);
74
+		if (empty($postCount->publish)) {
75
+			return $items;
76
+		}
77
+		$text = _n('%s Review', '%s Reviews', $postCount->publish, 'site-reviews');
78
+		$text = sprintf($text, number_format_i18n($postCount->publish));
79
+		$items = glsr(Helper::class)->consolidateArray($items);
80
+		$items[] = current_user_can(get_post_type_object(Application::POST_TYPE)->cap->edit_posts)
81
+			? glsr(Builder::class)->a($text, [
82
+				'class' => 'glsr-review-count',
83
+				'href' => 'edit.php?post_type='.Application::POST_TYPE,
84
+			])
85
+			: glsr(Builder::class)->span($text, [
86
+				'class' => 'glsr-review-count',
87
+			]);
88
+		return $items;
89
+	}
90
+
91
+	/**
92
+	 * @param array $plugins
93
+	 * @return array
94
+	 * @filter mce_external_plugins
95
+	 */
96
+	public function filterTinymcePlugins($plugins)
97
+	{
98
+		if (current_user_can('edit_posts') || current_user_can('edit_pages')) {
99
+			$plugins = glsr(Helper::class)->consolidateArray($plugins);
100
+			$plugins['glsr_shortcode'] = glsr()->url('assets/scripts/mce-plugin.js');
101
+		}
102
+		return $plugins;
103
+	}
104
+
105
+	/**
106
+	 * @return void
107
+	 * @action admin_init
108
+	 */
109
+	public function registerTinymcePopups()
110
+	{
111
+		$command = new RegisterTinymcePopups([
112
+			'site_reviews' => esc_html__('Recent Reviews', 'site-reviews'),
113
+			'site_reviews_form' => esc_html__('Submit a Review', 'site-reviews'),
114
+			'site_reviews_summary' => esc_html__('Summary of Reviews', 'site-reviews'),
115
+		]);
116
+		$this->execute($command);
117
+	}
118
+
119
+	/**
120
+	 * @param string $editorId
121
+	 * @return void|null
122
+	 * @action media_buttons
123
+	 */
124
+	public function renderTinymceButton($editorId)
125
+	{
126
+		$allowedEditors = apply_filters('site-reviews/tinymce/editor-ids', ['content'], $editorId);
127
+		if ('post' != glsr_current_screen()->base || !in_array($editorId, $allowedEditors)) {
128
+			return;
129
+		}
130
+		$shortcodes = [];
131
+		foreach (glsr()->mceShortcodes as $shortcode => $values) {
132
+			$shortcodes[$shortcode] = $values;
133
+		}
134
+		if (empty($shortcodes)) {
135
+			return;
136
+		}
137
+		glsr()->render('partials/editor/tinymce', [
138
+			'shortcodes' => $shortcodes,
139
+		]);
140
+	}
141
+
142
+	/**
143
+	 * @return void
144
+	 */
145
+	public function routerClearConsole()
146
+	{
147
+		glsr(Console::class)->clear();
148
+		glsr(Notice::class)->addSuccess(__('Console cleared.', 'site-reviews'));
149
+	}
150
+
151
+	/**
152
+	 * @return void
153
+	 */
154
+	public function routerFetchConsole()
155
+	{
156
+		glsr(Notice::class)->addSuccess(__('Console reloaded.', 'site-reviews'));
157
+	}
158
+
159
+	/**
160
+	 * @param bool $showNotice
161
+	 * @return void
162
+	 */
163
+	public function routerCountReviews($showNotice = true)
164
+	{
165
+		glsr(CountsManager::class)->countAll();
166
+		glsr(OptionManager::class)->set('last_review_count', current_time('timestamp'));
167
+		if ($showNotice) {
168
+			glsr(Notice::class)->clear()->addSuccess(__('Recalculated rating counts.', 'site-reviews'));
169
+		}
170
+	}
171
+
172
+	/**
173
+	 * @return void
174
+	 */
175
+	public function routerDownloadConsole()
176
+	{
177
+		$this->download(Application::ID.'-console.txt', glsr(Console::class)->get());
178
+	}
179
+
180
+	/**
181
+	 * @return void
182
+	 */
183
+	public function routerDownloadSystemInfo()
184
+	{
185
+		$this->download(Application::ID.'-system-info.txt', glsr(System::class)->get());
186
+	}
187
+
188
+	/**
189
+	 * @return void
190
+	 */
191
+	public function routerExportSettings()
192
+	{
193
+		$this->download(Application::ID.'-settings.json', glsr(OptionManager::class)->json());
194
+	}
195
+
196
+	/**
197
+	 * @return void
198
+	 */
199
+	public function routerImportSettings()
200
+	{
201
+		$file = $_FILES['import-file'];
202
+		if (UPLOAD_ERR_OK !== $file['error']) {
203
+			return glsr(Notice::class)->addError($this->getUploadError($file['error']));
204
+		}
205
+		if ('application/json' !== $file['type'] || !glsr(Helper::class)->endsWith('.json', $file['name'])) {
206
+			return glsr(Notice::class)->addError(__('Please use a valid Site Reviews settings file.', 'site-reviews'));
207
+		}
208
+		$settings = json_decode(file_get_contents($file['tmp_name']), true);
209
+		if (empty($settings)) {
210
+			return glsr(Notice::class)->addWarning(__('There were no settings found to import.', 'site-reviews'));
211
+		}
212
+		glsr(OptionManager::class)->set(glsr(OptionManager::class)->normalize($settings));
213
+		glsr(Notice::class)->addSuccess(__('Settings imported.', 'site-reviews'));
214
+	}
215
+
216
+	/**
217
+	 * @param int $errorCode
218
+	 * @return string
219
+	 */
220
+	protected function getUploadError($errorCode)
221
+	{
222
+		$errors = [
223
+			UPLOAD_ERR_INI_SIZE => __('The uploaded file exceeds the upload_max_filesize directive in php.ini.', 'site-reviews'),
224
+			UPLOAD_ERR_FORM_SIZE => __('The uploaded file is too big.', 'site-reviews'),
225
+			UPLOAD_ERR_PARTIAL => __('The uploaded file was only partially uploaded.', 'site-reviews'),
226
+			UPLOAD_ERR_NO_FILE => __('No file was uploaded.', 'site-reviews'),
227
+			UPLOAD_ERR_NO_TMP_DIR => __('Missing a temporary folder.', 'site-reviews'),
228
+			UPLOAD_ERR_CANT_WRITE => __('Failed to write file to disk.', 'site-reviews'),
229
+			UPLOAD_ERR_EXTENSION => __('A PHP extension stopped the file upload.', 'site-reviews'),
230
+		];
231
+		return glsr_get($errors, $errorCode, __('Unknown upload error.', 'site-reviews'));
232
+	}
233 233
 }
Please login to merge, or discard this patch.
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
      */
22 22
     public function enqueueAssets()
23 23
     {
24
-        $command = new EnqueueAdminAssets([
24
+        $command = new EnqueueAdminAssets( [
25 25
             'pointers' => [[
26
-                'content' => __('You can pin exceptional reviews so that they are always shown first.', 'site-reviews'),
26
+                'content' => __( 'You can pin exceptional reviews so that they are always shown first.', 'site-reviews' ),
27 27
                 'id' => 'glsr-pointer-pinned',
28 28
                 'position' => [
29 29
                     'edge' => 'right',
@@ -31,21 +31,21 @@  discard block
 block discarded – undo
31 31
                 ],
32 32
                 'screen' => Application::POST_TYPE,
33 33
                 'target' => '#misc-pub-pinned',
34
-                'title' => __('Pin Your Reviews', 'site-reviews'),
34
+                'title' => __( 'Pin Your Reviews', 'site-reviews' ),
35 35
             ]],
36
-        ]);
37
-        $this->execute($command);
36
+        ] );
37
+        $this->execute( $command );
38 38
     }
39 39
 
40 40
     /**
41 41
      * @return array
42 42
      * @filter plugin_action_links_site-reviews/site-reviews.php
43 43
      */
44
-    public function filterActionLinks(array $links)
44
+    public function filterActionLinks( array $links )
45 45
     {
46
-        $links['settings'] = glsr(Builder::class)->a(__('Settings', 'site-reviews'), [
47
-            'href' => admin_url('edit.php?post_type='.Application::POST_TYPE.'&page=settings'),
48
-        ]);
46
+        $links['settings'] = glsr( Builder::class )->a( __( 'Settings', 'site-reviews' ), [
47
+            'href' => admin_url( 'edit.php?post_type='.Application::POST_TYPE.'&page=settings' ),
48
+        ] );
49 49
         return $links;
50 50
     }
51 51
 
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
      * @return array
56 56
      * @filter map_meta_cap
57 57
      */
58
-    public function filterCreateCapability($capabilities, $capability)
58
+    public function filterCreateCapability( $capabilities, $capability )
59 59
     {
60
-        if ($capability == 'create_'.Application::POST_TYPE) {
60
+        if( $capability == 'create_'.Application::POST_TYPE ) {
61 61
             $capabilities[] = 'do_not_allow';
62 62
         }
63 63
         return $capabilities;
@@ -68,23 +68,23 @@  discard block
 block discarded – undo
68 68
      * @return array
69 69
      * @filter dashboard_glance_items
70 70
      */
71
-    public function filterDashboardGlanceItems($items)
71
+    public function filterDashboardGlanceItems( $items )
72 72
     {
73
-        $postCount = wp_count_posts(Application::POST_TYPE);
74
-        if (empty($postCount->publish)) {
73
+        $postCount = wp_count_posts( Application::POST_TYPE );
74
+        if( empty($postCount->publish) ) {
75 75
             return $items;
76 76
         }
77
-        $text = _n('%s Review', '%s Reviews', $postCount->publish, 'site-reviews');
78
-        $text = sprintf($text, number_format_i18n($postCount->publish));
79
-        $items = glsr(Helper::class)->consolidateArray($items);
80
-        $items[] = current_user_can(get_post_type_object(Application::POST_TYPE)->cap->edit_posts)
81
-            ? glsr(Builder::class)->a($text, [
77
+        $text = _n( '%s Review', '%s Reviews', $postCount->publish, 'site-reviews' );
78
+        $text = sprintf( $text, number_format_i18n( $postCount->publish ) );
79
+        $items = glsr( Helper::class )->consolidateArray( $items );
80
+        $items[] = current_user_can( get_post_type_object( Application::POST_TYPE )->cap->edit_posts )
81
+            ? glsr( Builder::class )->a( $text, [
82 82
                 'class' => 'glsr-review-count',
83 83
                 'href' => 'edit.php?post_type='.Application::POST_TYPE,
84
-            ])
85
-            : glsr(Builder::class)->span($text, [
84
+            ] )
85
+            : glsr( Builder::class )->span( $text, [
86 86
                 'class' => 'glsr-review-count',
87
-            ]);
87
+            ] );
88 88
         return $items;
89 89
     }
90 90
 
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
      * @return array
94 94
      * @filter mce_external_plugins
95 95
      */
96
-    public function filterTinymcePlugins($plugins)
96
+    public function filterTinymcePlugins( $plugins )
97 97
     {
98
-        if (current_user_can('edit_posts') || current_user_can('edit_pages')) {
99
-            $plugins = glsr(Helper::class)->consolidateArray($plugins);
100
-            $plugins['glsr_shortcode'] = glsr()->url('assets/scripts/mce-plugin.js');
98
+        if( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ) ) {
99
+            $plugins = glsr( Helper::class )->consolidateArray( $plugins );
100
+            $plugins['glsr_shortcode'] = glsr()->url( 'assets/scripts/mce-plugin.js' );
101 101
         }
102 102
         return $plugins;
103 103
     }
@@ -108,12 +108,12 @@  discard block
 block discarded – undo
108 108
      */
109 109
     public function registerTinymcePopups()
110 110
     {
111
-        $command = new RegisterTinymcePopups([
112
-            'site_reviews' => esc_html__('Recent Reviews', 'site-reviews'),
113
-            'site_reviews_form' => esc_html__('Submit a Review', 'site-reviews'),
114
-            'site_reviews_summary' => esc_html__('Summary of Reviews', 'site-reviews'),
115
-        ]);
116
-        $this->execute($command);
111
+        $command = new RegisterTinymcePopups( [
112
+            'site_reviews' => esc_html__( 'Recent Reviews', 'site-reviews' ),
113
+            'site_reviews_form' => esc_html__( 'Submit a Review', 'site-reviews' ),
114
+            'site_reviews_summary' => esc_html__( 'Summary of Reviews', 'site-reviews' ),
115
+        ] );
116
+        $this->execute( $command );
117 117
     }
118 118
 
119 119
     /**
@@ -121,22 +121,22 @@  discard block
 block discarded – undo
121 121
      * @return void|null
122 122
      * @action media_buttons
123 123
      */
124
-    public function renderTinymceButton($editorId)
124
+    public function renderTinymceButton( $editorId )
125 125
     {
126
-        $allowedEditors = apply_filters('site-reviews/tinymce/editor-ids', ['content'], $editorId);
127
-        if ('post' != glsr_current_screen()->base || !in_array($editorId, $allowedEditors)) {
126
+        $allowedEditors = apply_filters( 'site-reviews/tinymce/editor-ids', ['content'], $editorId );
127
+        if( 'post' != glsr_current_screen()->base || !in_array( $editorId, $allowedEditors ) ) {
128 128
             return;
129 129
         }
130 130
         $shortcodes = [];
131
-        foreach (glsr()->mceShortcodes as $shortcode => $values) {
131
+        foreach( glsr()->mceShortcodes as $shortcode => $values ) {
132 132
             $shortcodes[$shortcode] = $values;
133 133
         }
134
-        if (empty($shortcodes)) {
134
+        if( empty($shortcodes) ) {
135 135
             return;
136 136
         }
137
-        glsr()->render('partials/editor/tinymce', [
137
+        glsr()->render( 'partials/editor/tinymce', [
138 138
             'shortcodes' => $shortcodes,
139
-        ]);
139
+        ] );
140 140
     }
141 141
 
142 142
     /**
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
      */
145 145
     public function routerClearConsole()
146 146
     {
147
-        glsr(Console::class)->clear();
148
-        glsr(Notice::class)->addSuccess(__('Console cleared.', 'site-reviews'));
147
+        glsr( Console::class )->clear();
148
+        glsr( Notice::class )->addSuccess( __( 'Console cleared.', 'site-reviews' ) );
149 149
     }
150 150
 
151 151
     /**
@@ -153,19 +153,19 @@  discard block
 block discarded – undo
153 153
      */
154 154
     public function routerFetchConsole()
155 155
     {
156
-        glsr(Notice::class)->addSuccess(__('Console reloaded.', 'site-reviews'));
156
+        glsr( Notice::class )->addSuccess( __( 'Console reloaded.', 'site-reviews' ) );
157 157
     }
158 158
 
159 159
     /**
160 160
      * @param bool $showNotice
161 161
      * @return void
162 162
      */
163
-    public function routerCountReviews($showNotice = true)
163
+    public function routerCountReviews( $showNotice = true )
164 164
     {
165
-        glsr(CountsManager::class)->countAll();
166
-        glsr(OptionManager::class)->set('last_review_count', current_time('timestamp'));
167
-        if ($showNotice) {
168
-            glsr(Notice::class)->clear()->addSuccess(__('Recalculated rating counts.', 'site-reviews'));
165
+        glsr( CountsManager::class )->countAll();
166
+        glsr( OptionManager::class )->set( 'last_review_count', current_time( 'timestamp' ) );
167
+        if( $showNotice ) {
168
+            glsr( Notice::class )->clear()->addSuccess( __( 'Recalculated rating counts.', 'site-reviews' ) );
169 169
         }
170 170
     }
171 171
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
      */
175 175
     public function routerDownloadConsole()
176 176
     {
177
-        $this->download(Application::ID.'-console.txt', glsr(Console::class)->get());
177
+        $this->download( Application::ID.'-console.txt', glsr( Console::class )->get() );
178 178
     }
179 179
 
180 180
     /**
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
      */
183 183
     public function routerDownloadSystemInfo()
184 184
     {
185
-        $this->download(Application::ID.'-system-info.txt', glsr(System::class)->get());
185
+        $this->download( Application::ID.'-system-info.txt', glsr( System::class )->get() );
186 186
     }
187 187
 
188 188
     /**
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
      */
191 191
     public function routerExportSettings()
192 192
     {
193
-        $this->download(Application::ID.'-settings.json', glsr(OptionManager::class)->json());
193
+        $this->download( Application::ID.'-settings.json', glsr( OptionManager::class )->json() );
194 194
     }
195 195
 
196 196
     /**
@@ -199,35 +199,35 @@  discard block
 block discarded – undo
199 199
     public function routerImportSettings()
200 200
     {
201 201
         $file = $_FILES['import-file'];
202
-        if (UPLOAD_ERR_OK !== $file['error']) {
203
-            return glsr(Notice::class)->addError($this->getUploadError($file['error']));
202
+        if( UPLOAD_ERR_OK !== $file['error'] ) {
203
+            return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] ) );
204 204
         }
205
-        if ('application/json' !== $file['type'] || !glsr(Helper::class)->endsWith('.json', $file['name'])) {
206
-            return glsr(Notice::class)->addError(__('Please use a valid Site Reviews settings file.', 'site-reviews'));
205
+        if( 'application/json' !== $file['type'] || !glsr( Helper::class )->endsWith( '.json', $file['name'] ) ) {
206
+            return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' ) );
207 207
         }
208
-        $settings = json_decode(file_get_contents($file['tmp_name']), true);
209
-        if (empty($settings)) {
210
-            return glsr(Notice::class)->addWarning(__('There were no settings found to import.', 'site-reviews'));
208
+        $settings = json_decode( file_get_contents( $file['tmp_name'] ), true );
209
+        if( empty($settings) ) {
210
+            return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' ) );
211 211
         }
212
-        glsr(OptionManager::class)->set(glsr(OptionManager::class)->normalize($settings));
213
-        glsr(Notice::class)->addSuccess(__('Settings imported.', 'site-reviews'));
212
+        glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings ) );
213
+        glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' ) );
214 214
     }
215 215
 
216 216
     /**
217 217
      * @param int $errorCode
218 218
      * @return string
219 219
      */
220
-    protected function getUploadError($errorCode)
220
+    protected function getUploadError( $errorCode )
221 221
     {
222 222
         $errors = [
223
-            UPLOAD_ERR_INI_SIZE => __('The uploaded file exceeds the upload_max_filesize directive in php.ini.', 'site-reviews'),
224
-            UPLOAD_ERR_FORM_SIZE => __('The uploaded file is too big.', 'site-reviews'),
225
-            UPLOAD_ERR_PARTIAL => __('The uploaded file was only partially uploaded.', 'site-reviews'),
226
-            UPLOAD_ERR_NO_FILE => __('No file was uploaded.', 'site-reviews'),
227
-            UPLOAD_ERR_NO_TMP_DIR => __('Missing a temporary folder.', 'site-reviews'),
228
-            UPLOAD_ERR_CANT_WRITE => __('Failed to write file to disk.', 'site-reviews'),
229
-            UPLOAD_ERR_EXTENSION => __('A PHP extension stopped the file upload.', 'site-reviews'),
223
+            UPLOAD_ERR_INI_SIZE => __( 'The uploaded file exceeds the upload_max_filesize directive in php.ini.', 'site-reviews' ),
224
+            UPLOAD_ERR_FORM_SIZE => __( 'The uploaded file is too big.', 'site-reviews' ),
225
+            UPLOAD_ERR_PARTIAL => __( 'The uploaded file was only partially uploaded.', 'site-reviews' ),
226
+            UPLOAD_ERR_NO_FILE => __( 'No file was uploaded.', 'site-reviews' ),
227
+            UPLOAD_ERR_NO_TMP_DIR => __( 'Missing a temporary folder.', 'site-reviews' ),
228
+            UPLOAD_ERR_CANT_WRITE => __( 'Failed to write file to disk.', 'site-reviews' ),
229
+            UPLOAD_ERR_EXTENSION => __( 'A PHP extension stopped the file upload.', 'site-reviews' ),
230 230
         ];
231
-        return glsr_get($errors, $errorCode, __('Unknown upload error.', 'site-reviews'));
231
+        return glsr_get( $errors, $errorCode, __( 'Unknown upload error.', 'site-reviews' ) );
232 232
     }
233 233
 }
Please login to merge, or discard this patch.
plugin/Controllers/Controller.php 3 patches
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -10,55 +10,55 @@
 block discarded – undo
10 10
 
11 11
 abstract class Controller
12 12
 {
13
-    /**
14
-     * @return void
15
-     */
16
-    public function download($filename, $content)
17
-    {
18
-        if (!current_user_can(glsr()->constant('CAPABILITY'))) {
19
-            return;
20
-        }
21
-        nocache_headers();
22
-        header('Content-Type: text/plain');
23
-        header('Content-Disposition: attachment; filename="'.$filename.'"');
24
-        echo html_entity_decode($content);
25
-        exit;
26
-    }
13
+	/**
14
+	 * @return void
15
+	 */
16
+	public function download($filename, $content)
17
+	{
18
+		if (!current_user_can(glsr()->constant('CAPABILITY'))) {
19
+			return;
20
+		}
21
+		nocache_headers();
22
+		header('Content-Type: text/plain');
23
+		header('Content-Disposition: attachment; filename="'.$filename.'"');
24
+		echo html_entity_decode($content);
25
+		exit;
26
+	}
27 27
 
28
-    /**
29
-     * @param object $command
30
-     * @return mixed
31
-     * @throws InvalidArgumentException
32
-     */
33
-    public function execute($command)
34
-    {
35
-        $handlerClass = str_replace('Commands', 'Handlers', get_class($command));
36
-        if (!class_exists($handlerClass)) {
37
-            throw new InvalidArgumentException('Handler '.$handlerClass.' not found.');
38
-        }
39
-        try {
40
-            return glsr($handlerClass)->handle($command);
41
-        } catch (Exception $e) {
42
-            status_header(400);
43
-            glsr(Notice::class)->addError(new WP_Error('site_reviews_error', $e->getMessage()));
44
-            glsr_log()->error($e->getMessage());
45
-        }
46
-    }
28
+	/**
29
+	 * @param object $command
30
+	 * @return mixed
31
+	 * @throws InvalidArgumentException
32
+	 */
33
+	public function execute($command)
34
+	{
35
+		$handlerClass = str_replace('Commands', 'Handlers', get_class($command));
36
+		if (!class_exists($handlerClass)) {
37
+			throw new InvalidArgumentException('Handler '.$handlerClass.' not found.');
38
+		}
39
+		try {
40
+			return glsr($handlerClass)->handle($command);
41
+		} catch (Exception $e) {
42
+			status_header(400);
43
+			glsr(Notice::class)->addError(new WP_Error('site_reviews_error', $e->getMessage()));
44
+			glsr_log()->error($e->getMessage());
45
+		}
46
+	}
47 47
 
48
-    /**
49
-     * @return int
50
-     */
51
-    protected function getPostId()
52
-    {
53
-        return intval(filter_input(INPUT_GET, 'post'));
54
-    }
48
+	/**
49
+	 * @return int
50
+	 */
51
+	protected function getPostId()
52
+	{
53
+		return intval(filter_input(INPUT_GET, 'post'));
54
+	}
55 55
 
56
-    /**
57
-     * @param int $postId
58
-     * @return bool
59
-     */
60
-    protected function isReviewPostId($postId)
61
-    {
62
-        return Application::POST_TYPE == get_post_field('post_type', $postId);
63
-    }
56
+	/**
57
+	 * @param int $postId
58
+	 * @return bool
59
+	 */
60
+	protected function isReviewPostId($postId)
61
+	{
62
+		return Application::POST_TYPE == get_post_field('post_type', $postId);
63
+	}
64 64
 }
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -13,15 +13,15 @@  discard block
 block discarded – undo
13 13
     /**
14 14
      * @return void
15 15
      */
16
-    public function download($filename, $content)
16
+    public function download( $filename, $content )
17 17
     {
18
-        if (!current_user_can(glsr()->constant('CAPABILITY'))) {
18
+        if( !current_user_can( glsr()->constant( 'CAPABILITY' ) ) ) {
19 19
             return;
20 20
         }
21 21
         nocache_headers();
22
-        header('Content-Type: text/plain');
23
-        header('Content-Disposition: attachment; filename="'.$filename.'"');
24
-        echo html_entity_decode($content);
22
+        header( 'Content-Type: text/plain' );
23
+        header( 'Content-Disposition: attachment; filename="'.$filename.'"' );
24
+        echo html_entity_decode( $content );
25 25
         exit;
26 26
     }
27 27
 
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
      * @return mixed
31 31
      * @throws InvalidArgumentException
32 32
      */
33
-    public function execute($command)
33
+    public function execute( $command )
34 34
     {
35
-        $handlerClass = str_replace('Commands', 'Handlers', get_class($command));
36
-        if (!class_exists($handlerClass)) {
37
-            throw new InvalidArgumentException('Handler '.$handlerClass.' not found.');
35
+        $handlerClass = str_replace( 'Commands', 'Handlers', get_class( $command ) );
36
+        if( !class_exists( $handlerClass ) ) {
37
+            throw new InvalidArgumentException( 'Handler '.$handlerClass.' not found.' );
38 38
         }
39 39
         try {
40
-            return glsr($handlerClass)->handle($command);
41
-        } catch (Exception $e) {
42
-            status_header(400);
43
-            glsr(Notice::class)->addError(new WP_Error('site_reviews_error', $e->getMessage()));
44
-            glsr_log()->error($e->getMessage());
40
+            return glsr( $handlerClass )->handle( $command );
41
+        } catch( Exception $e ) {
42
+            status_header( 400 );
43
+            glsr( Notice::class )->addError( new WP_Error( 'site_reviews_error', $e->getMessage() ) );
44
+            glsr_log()->error( $e->getMessage() );
45 45
         }
46 46
     }
47 47
 
@@ -50,15 +50,15 @@  discard block
 block discarded – undo
50 50
      */
51 51
     protected function getPostId()
52 52
     {
53
-        return intval(filter_input(INPUT_GET, 'post'));
53
+        return intval( filter_input( INPUT_GET, 'post' ) );
54 54
     }
55 55
 
56 56
     /**
57 57
      * @param int $postId
58 58
      * @return bool
59 59
      */
60
-    protected function isReviewPostId($postId)
60
+    protected function isReviewPostId( $postId )
61 61
     {
62
-        return Application::POST_TYPE == get_post_field('post_type', $postId);
62
+        return Application::POST_TYPE == get_post_field( 'post_type', $postId );
63 63
     }
64 64
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,8 @@
 block discarded – undo
38 38
         }
39 39
         try {
40 40
             return glsr($handlerClass)->handle($command);
41
-        } catch (Exception $e) {
41
+        }
42
+        catch (Exception $e) {
42 43
             status_header(400);
43 44
             glsr(Notice::class)->addError(new WP_Error('site_reviews_error', $e->getMessage()));
44 45
             glsr_log()->error($e->getMessage());
Please login to merge, or discard this patch.
plugin/Controllers/RestReviewController.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 {
15 15
     public function __construct()
16 16
     {
17
-        $this->meta = new WP_REST_Post_Meta_Fields(Application::POST_TYPE);
17
+        $this->meta = new WP_REST_Post_Meta_Fields( Application::POST_TYPE );
18 18
         $this->namespace = Application::ID.'/v1';
19 19
         $this->post_type = Application::POST_TYPE;
20 20
         $this->rest_base = 'reviews';
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
         //  ['callback' => [$this, 'createReview'], 'methods' => Server::CREATABLE],
30 30
         //  ['callback' => [$this, 'getReviews'], 'methods' => Server::READABLE],
31 31
         // ]);
32
-        register_rest_route($this->namespace, '/types', [
32
+        register_rest_route( $this->namespace, '/types', [
33 33
             ['callback' => [$this, 'getReviewTypes'], 'methods' => Server::READABLE],
34
-        ]);
34
+        ] );
35 35
     }
36 36
 
37 37
     /**
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     public function createReview()
41 41
     {
42 42
         $response = [];
43
-        return rest_ensure_response($response);
43
+        return rest_ensure_response( $response );
44 44
     }
45 45
 
46 46
     /**
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     public function getReviews()
50 50
     {
51 51
         $response = [];
52
-        return rest_ensure_response($response);
52
+        return rest_ensure_response( $response );
53 53
     }
54 54
 
55 55
     /**
@@ -58,12 +58,12 @@  discard block
 block discarded – undo
58 58
     public function getReviewTypes()
59 59
     {
60 60
         $response = [];
61
-        foreach (glsr()->reviewTypes as $slug => $name) {
61
+        foreach( glsr()->reviewTypes as $slug => $name ) {
62 62
             $response[] = [
63 63
                 'name' => $name,
64 64
                 'slug' => $slug,
65 65
             ];
66 66
         }
67
-        return rest_ensure_response($response);
67
+        return rest_ensure_response( $response );
68 68
     }
69 69
 }
Please login to merge, or discard this patch.
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -12,58 +12,58 @@
 block discarded – undo
12 12
 
13 13
 class RestReviewController extends RestController
14 14
 {
15
-    public function __construct()
16
-    {
17
-        $this->meta = new WP_REST_Post_Meta_Fields(Application::POST_TYPE);
18
-        $this->namespace = Application::ID.'/v1';
19
-        $this->post_type = Application::POST_TYPE;
20
-        $this->rest_base = 'reviews';
21
-    }
15
+	public function __construct()
16
+	{
17
+		$this->meta = new WP_REST_Post_Meta_Fields(Application::POST_TYPE);
18
+		$this->namespace = Application::ID.'/v1';
19
+		$this->post_type = Application::POST_TYPE;
20
+		$this->rest_base = 'reviews';
21
+	}
22 22
 
23
-    /**
24
-     * @return void
25
-     */
26
-    public function register_routes()
27
-    {
28
-        // register_rest_route($this->namespace, '/'.$this->rest_base, [
29
-        //  ['callback' => [$this, 'createReview'], 'methods' => Server::CREATABLE],
30
-        //  ['callback' => [$this, 'getReviews'], 'methods' => Server::READABLE],
31
-        // ]);
32
-        register_rest_route($this->namespace, '/types', [
33
-            ['callback' => [$this, 'getReviewTypes'], 'methods' => Server::READABLE],
34
-        ]);
35
-    }
23
+	/**
24
+	 * @return void
25
+	 */
26
+	public function register_routes()
27
+	{
28
+		// register_rest_route($this->namespace, '/'.$this->rest_base, [
29
+		//  ['callback' => [$this, 'createReview'], 'methods' => Server::CREATABLE],
30
+		//  ['callback' => [$this, 'getReviews'], 'methods' => Server::READABLE],
31
+		// ]);
32
+		register_rest_route($this->namespace, '/types', [
33
+			['callback' => [$this, 'getReviewTypes'], 'methods' => Server::READABLE],
34
+		]);
35
+	}
36 36
 
37
-    /**
38
-     * @return WP_Error|Response|mixed
39
-     */
40
-    public function createReview()
41
-    {
42
-        $response = [];
43
-        return rest_ensure_response($response);
44
-    }
37
+	/**
38
+	 * @return WP_Error|Response|mixed
39
+	 */
40
+	public function createReview()
41
+	{
42
+		$response = [];
43
+		return rest_ensure_response($response);
44
+	}
45 45
 
46
-    /**
47
-     * @return WP_Error|Response|mixed
48
-     */
49
-    public function getReviews()
50
-    {
51
-        $response = [];
52
-        return rest_ensure_response($response);
53
-    }
46
+	/**
47
+	 * @return WP_Error|Response|mixed
48
+	 */
49
+	public function getReviews()
50
+	{
51
+		$response = [];
52
+		return rest_ensure_response($response);
53
+	}
54 54
 
55
-    /**
56
-     * @return WP_Error|Response|mixed
57
-     */
58
-    public function getReviewTypes()
59
-    {
60
-        $response = [];
61
-        foreach (glsr()->reviewTypes as $slug => $name) {
62
-            $response[] = [
63
-                'name' => $name,
64
-                'slug' => $slug,
65
-            ];
66
-        }
67
-        return rest_ensure_response($response);
68
-    }
55
+	/**
56
+	 * @return WP_Error|Response|mixed
57
+	 */
58
+	public function getReviewTypes()
59
+	{
60
+		$response = [];
61
+		foreach (glsr()->reviewTypes as $slug => $name) {
62
+			$response[] = [
63
+				'name' => $name,
64
+				'slug' => $slug,
65
+			];
66
+		}
67
+		return rest_ensure_response($response);
68
+	}
69 69
 }
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
@@ -7,97 +7,97 @@
 block discarded – undo
7 7
 
8 8
 class TaxonomyController
9 9
 {
10
-    /**
11
-     * @return void
12
-     * @action Application::TAXONOMY._add_form_fields
13
-     * @action Application::TAXONOMY._edit_form
14
-     */
15
-    public function disableParents()
16
-    {
17
-        global $wp_taxonomies;
18
-        $wp_taxonomies[Application::TAXONOMY]->hierarchical = false;
19
-    }
10
+	/**
11
+	 * @return void
12
+	 * @action Application::TAXONOMY._add_form_fields
13
+	 * @action Application::TAXONOMY._edit_form
14
+	 */
15
+	public function disableParents()
16
+	{
17
+		global $wp_taxonomies;
18
+		$wp_taxonomies[Application::TAXONOMY]->hierarchical = false;
19
+	}
20 20
 
21
-    /**
22
-     * @return void
23
-     * @action Application::TAXONOMY._term_edit_form_top
24
-     * @action Application::TAXONOMY._term_new_form_tag
25
-     */
26
-    public function enableParents()
27
-    {
28
-        global $wp_taxonomies;
29
-        $wp_taxonomies[Application::TAXONOMY]->hierarchical = true;
30
-    }
21
+	/**
22
+	 * @return void
23
+	 * @action Application::TAXONOMY._term_edit_form_top
24
+	 * @action Application::TAXONOMY._term_new_form_tag
25
+	 */
26
+	public function enableParents()
27
+	{
28
+		global $wp_taxonomies;
29
+		$wp_taxonomies[Application::TAXONOMY]->hierarchical = true;
30
+	}
31 31
 
32
-    /**
33
-     * @return void
34
-     * @action restrict_manage_posts
35
-     */
36
-    public function renderTaxonomyFilter()
37
-    {
38
-        if (!is_object_in_taxonomy(glsr_current_screen()->post_type, Application::TAXONOMY)) {
39
-            return;
40
-        }
41
-        echo glsr(Builder::class)->label(__('Filter by category', 'site-reviews'), [
42
-            'class' => 'screen-reader-text',
43
-            'for' => Application::TAXONOMY,
44
-        ]);
45
-        wp_dropdown_categories([
46
-            'depth' => 3,
47
-            'hide_empty' => true,
48
-            'hide_if_empty' => true,
49
-            'hierarchical' => true,
50
-            'name' => Application::TAXONOMY,
51
-            'orderby' => 'name',
52
-            'selected' => $this->getSelected(),
53
-            'show_count' => false,
54
-            'show_option_all' => $this->getShowOptionAll(),
55
-            'taxonomy' => Application::TAXONOMY,
56
-            'value_field' => 'slug',
57
-        ]);
58
-    }
32
+	/**
33
+	 * @return void
34
+	 * @action restrict_manage_posts
35
+	 */
36
+	public function renderTaxonomyFilter()
37
+	{
38
+		if (!is_object_in_taxonomy(glsr_current_screen()->post_type, Application::TAXONOMY)) {
39
+			return;
40
+		}
41
+		echo glsr(Builder::class)->label(__('Filter by category', 'site-reviews'), [
42
+			'class' => 'screen-reader-text',
43
+			'for' => Application::TAXONOMY,
44
+		]);
45
+		wp_dropdown_categories([
46
+			'depth' => 3,
47
+			'hide_empty' => true,
48
+			'hide_if_empty' => true,
49
+			'hierarchical' => true,
50
+			'name' => Application::TAXONOMY,
51
+			'orderby' => 'name',
52
+			'selected' => $this->getSelected(),
53
+			'show_count' => false,
54
+			'show_option_all' => $this->getShowOptionAll(),
55
+			'taxonomy' => Application::TAXONOMY,
56
+			'value_field' => 'slug',
57
+		]);
58
+	}
59 59
 
60
-    /**
61
-     * @param int $postId
62
-     * @param array $terms
63
-     * @param array $newTTIds
64
-     * @param string $taxonomy
65
-     * @param bool $append
66
-     * @param array $oldTTIds
67
-     * @return void
68
-     * @action set_object_terms
69
-     */
70
-    public function restrictTermSelection($postId, $terms, $newTTIds, $taxonomy, $append, $oldTTIds)
71
-    {
72
-        if (Application::TAXONOMY != $taxonomy || count($newTTIds) <= 1) {
73
-            return;
74
-        }
75
-        $diff = array_diff($newTTIds, $oldTTIds);
76
-        if (empty($newTerm = array_shift($diff))) {
77
-            $newTerm = array_shift($newTTIds);
78
-        }
79
-        if ($newTerm) {
80
-            wp_set_object_terms($postId, intval($newTerm), $taxonomy);
81
-        }
82
-    }
60
+	/**
61
+	 * @param int $postId
62
+	 * @param array $terms
63
+	 * @param array $newTTIds
64
+	 * @param string $taxonomy
65
+	 * @param bool $append
66
+	 * @param array $oldTTIds
67
+	 * @return void
68
+	 * @action set_object_terms
69
+	 */
70
+	public function restrictTermSelection($postId, $terms, $newTTIds, $taxonomy, $append, $oldTTIds)
71
+	{
72
+		if (Application::TAXONOMY != $taxonomy || count($newTTIds) <= 1) {
73
+			return;
74
+		}
75
+		$diff = array_diff($newTTIds, $oldTTIds);
76
+		if (empty($newTerm = array_shift($diff))) {
77
+			$newTerm = array_shift($newTTIds);
78
+		}
79
+		if ($newTerm) {
80
+			wp_set_object_terms($postId, intval($newTerm), $taxonomy);
81
+		}
82
+	}
83 83
 
84
-    /**
85
-     * @return string
86
-     */
87
-    protected function getSelected()
88
-    {
89
-        global $wp_query;
90
-        return glsr_get($wp_query->query, Application::TAXONOMY);
91
-    }
84
+	/**
85
+	 * @return string
86
+	 */
87
+	protected function getSelected()
88
+	{
89
+		global $wp_query;
90
+		return glsr_get($wp_query->query, Application::TAXONOMY);
91
+	}
92 92
 
93
-    /**
94
-     * @return string
95
-     */
96
-    protected function getShowOptionAll()
97
-    {
98
-        $taxonomy = get_taxonomy(Application::TAXONOMY);
99
-        return $taxonomy
100
-            ? ucfirst(strtolower($taxonomy->labels->all_items))
101
-            : '';
102
-    }
93
+	/**
94
+	 * @return string
95
+	 */
96
+	protected function getShowOptionAll()
97
+	{
98
+		$taxonomy = get_taxonomy(Application::TAXONOMY);
99
+		return $taxonomy
100
+			? ucfirst(strtolower($taxonomy->labels->all_items))
101
+			: '';
102
+	}
103 103
 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function renderTaxonomyFilter()
37 37
     {
38
-        if (!is_object_in_taxonomy(glsr_current_screen()->post_type, Application::TAXONOMY)) {
38
+        if( !is_object_in_taxonomy( glsr_current_screen()->post_type, Application::TAXONOMY ) ) {
39 39
             return;
40 40
         }
41
-        echo glsr(Builder::class)->label(__('Filter by category', 'site-reviews'), [
41
+        echo glsr( Builder::class )->label( __( 'Filter by category', 'site-reviews' ), [
42 42
             'class' => 'screen-reader-text',
43 43
             'for' => Application::TAXONOMY,
44
-        ]);
45
-        wp_dropdown_categories([
44
+        ] );
45
+        wp_dropdown_categories( [
46 46
             'depth' => 3,
47 47
             'hide_empty' => true,
48 48
             'hide_if_empty' => true,
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
             'show_option_all' => $this->getShowOptionAll(),
55 55
             'taxonomy' => Application::TAXONOMY,
56 56
             'value_field' => 'slug',
57
-        ]);
57
+        ] );
58 58
     }
59 59
 
60 60
     /**
@@ -67,17 +67,17 @@  discard block
 block discarded – undo
67 67
      * @return void
68 68
      * @action set_object_terms
69 69
      */
70
-    public function restrictTermSelection($postId, $terms, $newTTIds, $taxonomy, $append, $oldTTIds)
70
+    public function restrictTermSelection( $postId, $terms, $newTTIds, $taxonomy, $append, $oldTTIds )
71 71
     {
72
-        if (Application::TAXONOMY != $taxonomy || count($newTTIds) <= 1) {
72
+        if( Application::TAXONOMY != $taxonomy || count( $newTTIds ) <= 1 ) {
73 73
             return;
74 74
         }
75
-        $diff = array_diff($newTTIds, $oldTTIds);
76
-        if (empty($newTerm = array_shift($diff))) {
77
-            $newTerm = array_shift($newTTIds);
75
+        $diff = array_diff( $newTTIds, $oldTTIds );
76
+        if( empty($newTerm = array_shift( $diff )) ) {
77
+            $newTerm = array_shift( $newTTIds );
78 78
         }
79
-        if ($newTerm) {
80
-            wp_set_object_terms($postId, intval($newTerm), $taxonomy);
79
+        if( $newTerm ) {
80
+            wp_set_object_terms( $postId, intval( $newTerm ), $taxonomy );
81 81
         }
82 82
     }
83 83
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     protected function getSelected()
88 88
     {
89 89
         global $wp_query;
90
-        return glsr_get($wp_query->query, Application::TAXONOMY);
90
+        return glsr_get( $wp_query->query, Application::TAXONOMY );
91 91
     }
92 92
 
93 93
     /**
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
      */
96 96
     protected function getShowOptionAll()
97 97
     {
98
-        $taxonomy = get_taxonomy(Application::TAXONOMY);
98
+        $taxonomy = get_taxonomy( Application::TAXONOMY );
99 99
         return $taxonomy
100
-            ? ucfirst(strtolower($taxonomy->labels->all_items))
100
+            ? ucfirst( strtolower( $taxonomy->labels->all_items ) )
101 101
             : '';
102 102
     }
103 103
 }
Please login to merge, or discard this patch.
plugin/Controllers/SettingsController.php 3 patches
Indentation   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -9,103 +9,103 @@
 block discarded – undo
9 9
 
10 10
 class SettingsController extends Controller
11 11
 {
12
-    /**
13
-     * @param mixed $input
14
-     * @return array
15
-     * @callback register_setting
16
-     */
17
-    public function callbackRegisterSettings($input)
18
-    {
19
-        if (!is_array($input)) {
20
-            $input = ['settings' => []];
21
-        }
22
-        if ('settings' == key($input)) {
23
-            $options = array_replace_recursive(glsr(OptionManager::class)->all(), $input);
24
-            $options = $this->sanitizeGeneral($input, $options);
25
-            $options = $this->sanitizeSubmissions($input, $options);
26
-            $options = $this->sanitizeTranslations($input, $options);
27
-            if (filter_input(INPUT_POST, 'option_page') == Application::ID.'-settings') {
28
-                glsr(Notice::class)->addSuccess(__('Settings updated.', 'site-reviews'));
29
-            }
30
-            return $options;
31
-        }
32
-        return $input;
33
-    }
12
+	/**
13
+	 * @param mixed $input
14
+	 * @return array
15
+	 * @callback register_setting
16
+	 */
17
+	public function callbackRegisterSettings($input)
18
+	{
19
+		if (!is_array($input)) {
20
+			$input = ['settings' => []];
21
+		}
22
+		if ('settings' == key($input)) {
23
+			$options = array_replace_recursive(glsr(OptionManager::class)->all(), $input);
24
+			$options = $this->sanitizeGeneral($input, $options);
25
+			$options = $this->sanitizeSubmissions($input, $options);
26
+			$options = $this->sanitizeTranslations($input, $options);
27
+			if (filter_input(INPUT_POST, 'option_page') == Application::ID.'-settings') {
28
+				glsr(Notice::class)->addSuccess(__('Settings updated.', 'site-reviews'));
29
+			}
30
+			return $options;
31
+		}
32
+		return $input;
33
+	}
34 34
 
35
-    /**
36
-     * @return void
37
-     * @action admin_init
38
-     */
39
-    public function registerSettings()
40
-    {
41
-        register_setting(Application::ID.'-settings', OptionManager::databaseKey(), [
42
-            'sanitize_callback' => [$this, 'callbackRegisterSettings'],
43
-        ]);
44
-    }
35
+	/**
36
+	 * @return void
37
+	 * @action admin_init
38
+	 */
39
+	public function registerSettings()
40
+	{
41
+		register_setting(Application::ID.'-settings', OptionManager::databaseKey(), [
42
+			'sanitize_callback' => [$this, 'callbackRegisterSettings'],
43
+		]);
44
+	}
45 45
 
46
-    /**
47
-     * @return array
48
-     */
49
-    protected function sanitizeGeneral(array $input, array $options)
50
-    {
51
-        $inputForm = $input['settings']['general'];
52
-        if ('yes' == $inputForm['support']['polylang'] && !$this->isPolylangActiveAndSupported()) {
53
-            $options['settings']['general']['support']['polylang'] = 'no';
54
-        }
55
-        if ('' == trim($inputForm['notification_message'])) {
56
-            $options['settings']['general']['notification_message'] = glsr()->defaults['settings']['general']['notification_message'];
57
-        }
58
-        $options['settings']['general']['notifications'] = glsr_get($inputForm, 'notifications', []);
59
-        return $options;
60
-    }
46
+	/**
47
+	 * @return array
48
+	 */
49
+	protected function sanitizeGeneral(array $input, array $options)
50
+	{
51
+		$inputForm = $input['settings']['general'];
52
+		if ('yes' == $inputForm['support']['polylang'] && !$this->isPolylangActiveAndSupported()) {
53
+			$options['settings']['general']['support']['polylang'] = 'no';
54
+		}
55
+		if ('' == trim($inputForm['notification_message'])) {
56
+			$options['settings']['general']['notification_message'] = glsr()->defaults['settings']['general']['notification_message'];
57
+		}
58
+		$options['settings']['general']['notifications'] = glsr_get($inputForm, 'notifications', []);
59
+		return $options;
60
+	}
61 61
 
62
-    /**
63
-     * @return array
64
-     */
65
-    protected function sanitizeSubmissions(array $input, array $options)
66
-    {
67
-        $inputForm = $input['settings']['submissions'];
68
-        $options['settings']['submissions']['required'] = isset($inputForm['required'])
69
-            ? $inputForm['required']
70
-            : [];
71
-        return $options;
72
-    }
62
+	/**
63
+	 * @return array
64
+	 */
65
+	protected function sanitizeSubmissions(array $input, array $options)
66
+	{
67
+		$inputForm = $input['settings']['submissions'];
68
+		$options['settings']['submissions']['required'] = isset($inputForm['required'])
69
+			? $inputForm['required']
70
+			: [];
71
+		return $options;
72
+	}
73 73
 
74
-    /**
75
-     * @return array
76
-     */
77
-    protected function sanitizeTranslations(array $input, array $options)
78
-    {
79
-        if (isset($input['settings']['strings'])) {
80
-            $options['settings']['strings'] = array_values(array_filter($input['settings']['strings']));
81
-            $allowedTags = [
82
-                'a' => ['class' => [], 'href' => [], 'target' => []],
83
-                'span' => ['class' => []],
84
-            ];
85
-            array_walk($options['settings']['strings'], function (&$string) use ($allowedTags) {
86
-                if (isset($string['s2'])) {
87
-                    $string['s2'] = wp_kses($string['s2'], $allowedTags);
88
-                }
89
-                if (isset($string['p2'])) {
90
-                    $string['p2'] = wp_kses($string['p2'], $allowedTags);
91
-                }
92
-            });
93
-        }
94
-        return $options;
95
-    }
74
+	/**
75
+	 * @return array
76
+	 */
77
+	protected function sanitizeTranslations(array $input, array $options)
78
+	{
79
+		if (isset($input['settings']['strings'])) {
80
+			$options['settings']['strings'] = array_values(array_filter($input['settings']['strings']));
81
+			$allowedTags = [
82
+				'a' => ['class' => [], 'href' => [], 'target' => []],
83
+				'span' => ['class' => []],
84
+			];
85
+			array_walk($options['settings']['strings'], function (&$string) use ($allowedTags) {
86
+				if (isset($string['s2'])) {
87
+					$string['s2'] = wp_kses($string['s2'], $allowedTags);
88
+				}
89
+				if (isset($string['p2'])) {
90
+					$string['p2'] = wp_kses($string['p2'], $allowedTags);
91
+				}
92
+			});
93
+		}
94
+		return $options;
95
+	}
96 96
 
97
-    /**
98
-     * @return bool
99
-     */
100
-    protected function isPolylangActiveAndSupported()
101
-    {
102
-        if (!glsr(Polylang::class)->isActive()) {
103
-            glsr(Notice::class)->addError(__('Please install/activate the Polylang plugin to enable integration.', 'site-reviews'));
104
-            return false;
105
-        } elseif (!glsr(Polylang::class)->isSupported()) {
106
-            glsr(Notice::class)->addError(__('Please update the Polylang plugin to v2.3.0 or greater to enable integration.', 'site-reviews'));
107
-            return false;
108
-        }
109
-        return true;
110
-    }
97
+	/**
98
+	 * @return bool
99
+	 */
100
+	protected function isPolylangActiveAndSupported()
101
+	{
102
+		if (!glsr(Polylang::class)->isActive()) {
103
+			glsr(Notice::class)->addError(__('Please install/activate the Polylang plugin to enable integration.', 'site-reviews'));
104
+			return false;
105
+		} elseif (!glsr(Polylang::class)->isSupported()) {
106
+			glsr(Notice::class)->addError(__('Please update the Polylang plugin to v2.3.0 or greater to enable integration.', 'site-reviews'));
107
+			return false;
108
+		}
109
+		return true;
110
+	}
111 111
 }
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -14,18 +14,18 @@  discard block
 block discarded – undo
14 14
      * @return array
15 15
      * @callback register_setting
16 16
      */
17
-    public function callbackRegisterSettings($input)
17
+    public function callbackRegisterSettings( $input )
18 18
     {
19
-        if (!is_array($input)) {
19
+        if( !is_array( $input ) ) {
20 20
             $input = ['settings' => []];
21 21
         }
22
-        if ('settings' == key($input)) {
23
-            $options = array_replace_recursive(glsr(OptionManager::class)->all(), $input);
24
-            $options = $this->sanitizeGeneral($input, $options);
25
-            $options = $this->sanitizeSubmissions($input, $options);
26
-            $options = $this->sanitizeTranslations($input, $options);
27
-            if (filter_input(INPUT_POST, 'option_page') == Application::ID.'-settings') {
28
-                glsr(Notice::class)->addSuccess(__('Settings updated.', 'site-reviews'));
22
+        if( 'settings' == key( $input ) ) {
23
+            $options = array_replace_recursive( glsr( OptionManager::class )->all(), $input );
24
+            $options = $this->sanitizeGeneral( $input, $options );
25
+            $options = $this->sanitizeSubmissions( $input, $options );
26
+            $options = $this->sanitizeTranslations( $input, $options );
27
+            if( filter_input( INPUT_POST, 'option_page' ) == Application::ID.'-settings' ) {
28
+                glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ) );
29 29
             }
30 30
             return $options;
31 31
         }
@@ -38,31 +38,31 @@  discard block
 block discarded – undo
38 38
      */
39 39
     public function registerSettings()
40 40
     {
41
-        register_setting(Application::ID.'-settings', OptionManager::databaseKey(), [
41
+        register_setting( Application::ID.'-settings', OptionManager::databaseKey(), [
42 42
             'sanitize_callback' => [$this, 'callbackRegisterSettings'],
43
-        ]);
43
+        ] );
44 44
     }
45 45
 
46 46
     /**
47 47
      * @return array
48 48
      */
49
-    protected function sanitizeGeneral(array $input, array $options)
49
+    protected function sanitizeGeneral( array $input, array $options )
50 50
     {
51 51
         $inputForm = $input['settings']['general'];
52
-        if ('yes' == $inputForm['support']['polylang'] && !$this->isPolylangActiveAndSupported()) {
52
+        if( 'yes' == $inputForm['support']['polylang'] && !$this->isPolylangActiveAndSupported() ) {
53 53
             $options['settings']['general']['support']['polylang'] = 'no';
54 54
         }
55
-        if ('' == trim($inputForm['notification_message'])) {
55
+        if( '' == trim( $inputForm['notification_message'] ) ) {
56 56
             $options['settings']['general']['notification_message'] = glsr()->defaults['settings']['general']['notification_message'];
57 57
         }
58
-        $options['settings']['general']['notifications'] = glsr_get($inputForm, 'notifications', []);
58
+        $options['settings']['general']['notifications'] = glsr_get( $inputForm, 'notifications', [] );
59 59
         return $options;
60 60
     }
61 61
 
62 62
     /**
63 63
      * @return array
64 64
      */
65
-    protected function sanitizeSubmissions(array $input, array $options)
65
+    protected function sanitizeSubmissions( array $input, array $options )
66 66
     {
67 67
         $inputForm = $input['settings']['submissions'];
68 68
         $options['settings']['submissions']['required'] = isset($inputForm['required'])
@@ -74,20 +74,20 @@  discard block
 block discarded – undo
74 74
     /**
75 75
      * @return array
76 76
      */
77
-    protected function sanitizeTranslations(array $input, array $options)
77
+    protected function sanitizeTranslations( array $input, array $options )
78 78
     {
79
-        if (isset($input['settings']['strings'])) {
80
-            $options['settings']['strings'] = array_values(array_filter($input['settings']['strings']));
79
+        if( isset($input['settings']['strings']) ) {
80
+            $options['settings']['strings'] = array_values( array_filter( $input['settings']['strings'] ) );
81 81
             $allowedTags = [
82 82
                 'a' => ['class' => [], 'href' => [], 'target' => []],
83 83
                 'span' => ['class' => []],
84 84
             ];
85
-            array_walk($options['settings']['strings'], function (&$string) use ($allowedTags) {
86
-                if (isset($string['s2'])) {
87
-                    $string['s2'] = wp_kses($string['s2'], $allowedTags);
85
+            array_walk( $options['settings']['strings'], function( &$string ) use ($allowedTags) {
86
+                if( isset($string['s2']) ) {
87
+                    $string['s2'] = wp_kses( $string['s2'], $allowedTags );
88 88
                 }
89
-                if (isset($string['p2'])) {
90
-                    $string['p2'] = wp_kses($string['p2'], $allowedTags);
89
+                if( isset($string['p2']) ) {
90
+                    $string['p2'] = wp_kses( $string['p2'], $allowedTags );
91 91
                 }
92 92
             });
93 93
         }
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
      */
100 100
     protected function isPolylangActiveAndSupported()
101 101
     {
102
-        if (!glsr(Polylang::class)->isActive()) {
103
-            glsr(Notice::class)->addError(__('Please install/activate the Polylang plugin to enable integration.', 'site-reviews'));
102
+        if( !glsr( Polylang::class )->isActive() ) {
103
+            glsr( Notice::class )->addError( __( 'Please install/activate the Polylang plugin to enable integration.', 'site-reviews' ) );
104 104
             return false;
105
-        } elseif (!glsr(Polylang::class)->isSupported()) {
106
-            glsr(Notice::class)->addError(__('Please update the Polylang plugin to v2.3.0 or greater to enable integration.', 'site-reviews'));
105
+        } elseif( !glsr( Polylang::class )->isSupported() ) {
106
+            glsr( Notice::class )->addError( __( 'Please update the Polylang plugin to v2.3.0 or greater to enable integration.', 'site-reviews' ) );
107 107
             return false;
108 108
         }
109 109
         return true;
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,8 @@
 block discarded – undo
102 102
         if (!glsr(Polylang::class)->isActive()) {
103 103
             glsr(Notice::class)->addError(__('Please install/activate the Polylang plugin to enable integration.', 'site-reviews'));
104 104
             return false;
105
-        } elseif (!glsr(Polylang::class)->isSupported()) {
105
+        }
106
+        elseif (!glsr(Polylang::class)->isSupported()) {
106 107
             glsr(Notice::class)->addError(__('Please update the Polylang plugin to v2.3.0 or greater to enable integration.', 'site-reviews'));
107 108
             return false;
108 109
         }
Please login to merge, or discard this patch.
plugin/Controllers/BlocksController.php 2 patches
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -7,85 +7,85 @@
 block discarded – undo
7 7
 
8 8
 class BlocksController extends Controller
9 9
 {
10
-    /**
11
-     * @param array $categories
12
-     * @return array
13
-     * @filter block_categories
14
-     */
15
-    public function filterBlockCategories($categories)
16
-    {
17
-        $categories = glsr(Helper::class)->consolidateArray($categories);
18
-        $categories[] = [
19
-            'icon' => null,
20
-            'slug' => Application::ID,
21
-            'title' => glsr()->name,
22
-        ];
23
-        return $categories;
24
-    }
10
+	/**
11
+	 * @param array $categories
12
+	 * @return array
13
+	 * @filter block_categories
14
+	 */
15
+	public function filterBlockCategories($categories)
16
+	{
17
+		$categories = glsr(Helper::class)->consolidateArray($categories);
18
+		$categories[] = [
19
+			'icon' => null,
20
+			'slug' => Application::ID,
21
+			'title' => glsr()->name,
22
+		];
23
+		return $categories;
24
+	}
25 25
 
26
-    /**
27
-     * @param array $editors
28
-     * @param string $postType
29
-     * @return array
30
-     * @filter classic_editor_enabled_editors_for_post_type
31
-     * @plugin classic-editor/classic-editor.php
32
-     */
33
-    public function filterEnabledEditors($editors, $postType)
34
-    {
35
-        return Application::POST_TYPE == $postType
36
-            ? ['block_editor' => false, 'classic_editor' => false]
37
-            : $editors;
38
-    }
26
+	/**
27
+	 * @param array $editors
28
+	 * @param string $postType
29
+	 * @return array
30
+	 * @filter classic_editor_enabled_editors_for_post_type
31
+	 * @plugin classic-editor/classic-editor.php
32
+	 */
33
+	public function filterEnabledEditors($editors, $postType)
34
+	{
35
+		return Application::POST_TYPE == $postType
36
+			? ['block_editor' => false, 'classic_editor' => false]
37
+			: $editors;
38
+	}
39 39
 
40
-    /**
41
-     * @param bool $bool
42
-     * @param string $postType
43
-     * @return bool
44
-     * @filter use_block_editor_for_post_type
45
-     */
46
-    public function filterUseBlockEditor($bool, $postType)
47
-    {
48
-        return Application::POST_TYPE == $postType
49
-            ? false
50
-            : $bool;
51
-    }
40
+	/**
41
+	 * @param bool $bool
42
+	 * @param string $postType
43
+	 * @return bool
44
+	 * @filter use_block_editor_for_post_type
45
+	 */
46
+	public function filterUseBlockEditor($bool, $postType)
47
+	{
48
+		return Application::POST_TYPE == $postType
49
+			? false
50
+			: $bool;
51
+	}
52 52
 
53
-    /**
54
-     * @return void
55
-     */
56
-    public function registerAssets()
57
-    {
58
-        wp_register_style(
59
-            Application::ID.'/blocks',
60
-            glsr()->url('assets/styles/'.Application::ID.'-blocks.css'),
61
-            ['wp-edit-blocks'],
62
-            glsr()->version
63
-        );
64
-        wp_register_script(
65
-            Application::ID.'/blocks',
66
-            glsr()->url('assets/scripts/'.Application::ID.'-blocks.js'),
67
-            ['wp-api-fetch', 'wp-blocks', 'wp-i18n', 'wp-editor', 'wp-element', Application::ID],
68
-            glsr()->version
69
-        );
70
-    }
53
+	/**
54
+	 * @return void
55
+	 */
56
+	public function registerAssets()
57
+	{
58
+		wp_register_style(
59
+			Application::ID.'/blocks',
60
+			glsr()->url('assets/styles/'.Application::ID.'-blocks.css'),
61
+			['wp-edit-blocks'],
62
+			glsr()->version
63
+		);
64
+		wp_register_script(
65
+			Application::ID.'/blocks',
66
+			glsr()->url('assets/scripts/'.Application::ID.'-blocks.js'),
67
+			['wp-api-fetch', 'wp-blocks', 'wp-i18n', 'wp-editor', 'wp-element', Application::ID],
68
+			glsr()->version
69
+		);
70
+	}
71 71
 
72
-    /**
73
-     * @return void
74
-     * @action init
75
-     */
76
-    public function registerBlocks()
77
-    {
78
-        $blocks = [
79
-            'form', 'reviews', 'summary',
80
-        ];
81
-        foreach ($blocks as $block) {
82
-            $id = str_replace('_reviews', '', Application::ID.'_'.$block);
83
-            $blockClass = glsr(Helper::class)->buildClassName($id.'-block', 'Blocks');
84
-            if (!class_exists($blockClass)) {
85
-                glsr_log()->error(sprintf('Class missing (%s)', $blockClass));
86
-                continue;
87
-            }
88
-            glsr($blockClass)->register($block);
89
-        }
90
-    }
72
+	/**
73
+	 * @return void
74
+	 * @action init
75
+	 */
76
+	public function registerBlocks()
77
+	{
78
+		$blocks = [
79
+			'form', 'reviews', 'summary',
80
+		];
81
+		foreach ($blocks as $block) {
82
+			$id = str_replace('_reviews', '', Application::ID.'_'.$block);
83
+			$blockClass = glsr(Helper::class)->buildClassName($id.'-block', 'Blocks');
84
+			if (!class_exists($blockClass)) {
85
+				glsr_log()->error(sprintf('Class missing (%s)', $blockClass));
86
+				continue;
87
+			}
88
+			glsr($blockClass)->register($block);
89
+		}
90
+	}
91 91
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
      * @return array
13 13
      * @filter block_categories
14 14
      */
15
-    public function filterBlockCategories($categories)
15
+    public function filterBlockCategories( $categories )
16 16
     {
17
-        $categories = glsr(Helper::class)->consolidateArray($categories);
17
+        $categories = glsr( Helper::class )->consolidateArray( $categories );
18 18
         $categories[] = [
19 19
             'icon' => null,
20 20
             'slug' => Application::ID,
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      * @filter classic_editor_enabled_editors_for_post_type
31 31
      * @plugin classic-editor/classic-editor.php
32 32
      */
33
-    public function filterEnabledEditors($editors, $postType)
33
+    public function filterEnabledEditors( $editors, $postType )
34 34
     {
35 35
         return Application::POST_TYPE == $postType
36 36
             ? ['block_editor' => false, 'classic_editor' => false]
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      * @return bool
44 44
      * @filter use_block_editor_for_post_type
45 45
      */
46
-    public function filterUseBlockEditor($bool, $postType)
46
+    public function filterUseBlockEditor( $bool, $postType )
47 47
     {
48 48
         return Application::POST_TYPE == $postType
49 49
             ? false
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
     {
58 58
         wp_register_style(
59 59
             Application::ID.'/blocks',
60
-            glsr()->url('assets/styles/'.Application::ID.'-blocks.css'),
60
+            glsr()->url( 'assets/styles/'.Application::ID.'-blocks.css' ),
61 61
             ['wp-edit-blocks'],
62 62
             glsr()->version
63 63
         );
64 64
         wp_register_script(
65 65
             Application::ID.'/blocks',
66
-            glsr()->url('assets/scripts/'.Application::ID.'-blocks.js'),
66
+            glsr()->url( 'assets/scripts/'.Application::ID.'-blocks.js' ),
67 67
             ['wp-api-fetch', 'wp-blocks', 'wp-i18n', 'wp-editor', 'wp-element', Application::ID],
68 68
             glsr()->version
69 69
         );
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
         $blocks = [
79 79
             'form', 'reviews', 'summary',
80 80
         ];
81
-        foreach ($blocks as $block) {
82
-            $id = str_replace('_reviews', '', Application::ID.'_'.$block);
83
-            $blockClass = glsr(Helper::class)->buildClassName($id.'-block', 'Blocks');
84
-            if (!class_exists($blockClass)) {
85
-                glsr_log()->error(sprintf('Class missing (%s)', $blockClass));
81
+        foreach( $blocks as $block ) {
82
+            $id = str_replace( '_reviews', '', Application::ID.'_'.$block );
83
+            $blockClass = glsr( Helper::class )->buildClassName( $id.'-block', 'Blocks' );
84
+            if( !class_exists( $blockClass ) ) {
85
+                glsr_log()->error( sprintf( 'Class missing (%s)', $blockClass ) );
86 86
                 continue;
87 87
             }
88
-            glsr($blockClass)->register($block);
88
+            glsr( $blockClass )->register( $block );
89 89
         }
90 90
     }
91 91
 }
Please login to merge, or discard this patch.
plugin/Actions.php 3 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,8 @@
 block discarded – undo
33 33
     protected $settings;
34 34
     protected $taxonomy;
35 35
 
36
-    public function __construct(Application $app ) {
36
+    public function __construct(Application $app )
37
+    {
37 38
         $this->app = $app;
38 39
         $this->admin = $app->make(AdminController::class);
39 40
         $this->blocks = $app->make(BlocksController::class);
Please login to merge, or discard this patch.
Indentation   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -18,100 +18,100 @@
 block discarded – undo
18 18
 
19 19
 class Actions implements HooksContract
20 20
 {
21
-    protected $admin;
22
-    protected $app;
23
-    protected $blocks;
24
-    protected $console;
25
-    protected $editor;
26
-    protected $listtable;
27
-    protected $menu;
28
-    protected $main;
29
-    protected $public;
30
-    protected $rebusify;
31
-    protected $review;
32
-    protected $router;
33
-    protected $settings;
34
-    protected $taxonomy;
21
+	protected $admin;
22
+	protected $app;
23
+	protected $blocks;
24
+	protected $console;
25
+	protected $editor;
26
+	protected $listtable;
27
+	protected $menu;
28
+	protected $main;
29
+	protected $public;
30
+	protected $rebusify;
31
+	protected $review;
32
+	protected $router;
33
+	protected $settings;
34
+	protected $taxonomy;
35 35
 
36
-    public function __construct(Application $app ) {
37
-        $this->app = $app;
38
-        $this->admin = $app->make(AdminController::class);
39
-        $this->blocks = $app->make(BlocksController::class);
40
-        $this->console = $app->make(Console::class);
41
-        $this->editor = $app->make(EditorController::class);
42
-        $this->listtable = $app->make(ListTableController::class);
43
-        $this->main = $app->make(MainController::class);
44
-        $this->menu = $app->make(MenuController::class);
45
-        $this->public = $app->make(PublicController::class);
46
-        $this->rebusify = $app->make(RebusifyController::class);
47
-        $this->review = $app->make(ReviewController::class);
48
-        $this->router = $app->make(Router::class);
49
-        $this->settings = $app->make(SettingsController::class);
50
-        $this->taxonomy = $app->make(TaxonomyController::class);
51
-    }
36
+	public function __construct(Application $app ) {
37
+		$this->app = $app;
38
+		$this->admin = $app->make(AdminController::class);
39
+		$this->blocks = $app->make(BlocksController::class);
40
+		$this->console = $app->make(Console::class);
41
+		$this->editor = $app->make(EditorController::class);
42
+		$this->listtable = $app->make(ListTableController::class);
43
+		$this->main = $app->make(MainController::class);
44
+		$this->menu = $app->make(MenuController::class);
45
+		$this->public = $app->make(PublicController::class);
46
+		$this->rebusify = $app->make(RebusifyController::class);
47
+		$this->review = $app->make(ReviewController::class);
48
+		$this->router = $app->make(Router::class);
49
+		$this->settings = $app->make(SettingsController::class);
50
+		$this->taxonomy = $app->make(TaxonomyController::class);
51
+	}
52 52
 
53
-    /**
54
-     * @return void
55
-     */
56
-    public function run()
57
-    {
58
-        add_action('admin_enqueue_scripts',                                 [$this->admin, 'enqueueAssets']);
59
-        add_action('admin_init',                                            [$this->admin, 'registerTinymcePopups']);
60
-        add_action('media_buttons',                                         [$this->admin, 'renderTinymceButton'], 11);
61
-        add_action('plugins_loaded',                                        [$this->app, 'getDefaults'], 11);
62
-        add_action('plugins_loaded',                                        [$this->app, 'registerAddons']);
63
-        add_action('plugins_loaded',                                        [$this->app, 'registerLanguages']);
64
-        add_action('plugins_loaded',                                        [$this->app, 'registerReviewTypes']);
65
-        add_action('upgrader_process_complete',                             [$this->app, 'upgraded'], 10, 2);
66
-        add_action('init',                                                  [$this->blocks, 'registerAssets'], 9);
67
-        add_action('init',                                                  [$this->blocks, 'registerBlocks']);
68
-        add_action('admin_footer',                                          [$this->console, 'logOnce']);
69
-        add_action('wp_footer',                                             [$this->console, 'logOnce']);
70
-        add_action('admin_enqueue_scripts',                                 [$this->editor, 'customizePostStatusLabels']);
71
-        add_action('add_meta_boxes_'.Application::POST_TYPE,                [$this->editor, 'registerMetaBoxes']);
72
-        add_action('admin_print_scripts',                                   [$this->editor, 'removeAutosave'], 999);
73
-        add_action('admin_menu',                                            [$this->editor, 'removeMetaBoxes']);
74
-        add_action('current_screen',                                        [$this->editor, 'removePostTypeSupport']);
75
-        add_action('post_submitbox_misc_actions',                           [$this->editor, 'renderPinnedInPublishMetaBox']);
76
-        add_action('admin_head',                                            [$this->editor, 'renderReviewFields']);
77
-        add_action('admin_action_revert',                                   [$this->editor, 'revertReview']);
78
-        add_action('save_post_'.Application::POST_TYPE,                     [$this->editor, 'saveMetaboxes']);
79
-        add_action('admin_action_approve',                                  [$this->listtable, 'approve']);
80
-        add_action('bulk_edit_custom_box',                                  [$this->listtable, 'renderBulkEditFields'], 10, 2);
81
-        add_action('restrict_manage_posts',                                 [$this->listtable, 'renderColumnFilters']);
82
-        add_action('manage_'.Application::POST_TYPE.'_posts_custom_column', [$this->listtable, 'renderColumnValues'], 10, 2);
83
-        add_action('save_post_'.Application::POST_TYPE,                     [$this->listtable, 'saveBulkEditFields']);
84
-        add_action('pre_get_posts',                                         [$this->listtable, 'setQueryForColumn']);
85
-        add_action('admin_action_unapprove',                                [$this->listtable, 'unapprove']);
86
-        add_action('init',                                                  [$this->main, 'registerPostType'], 8);
87
-        add_action('init',                                                  [$this->main, 'registerShortcodes']);
88
-        add_action('init',                                                  [$this->main, 'registerTaxonomy']);
89
-        add_action('widgets_init',                                          [$this->main, 'registerWidgets']);
90
-        add_action('admin_menu',                                            [$this->menu, 'registerMenuCount']);
91
-        add_action('admin_menu',                                            [$this->menu, 'registerSubMenus']);
92
-        add_action('admin_init',                                            [$this->menu, 'setCustomPermissions'], 999);
93
-        add_action('wp_enqueue_scripts',                                    [$this->public, 'enqueueAssets'], 999);
94
-        add_filter('site-reviews/builder',                                  [$this->public, 'modifyBuilder']);
95
-        add_action('wp_footer',                                             [$this->public, 'renderSchema']);
96
-        add_action('site-reviews/review/created',                           [$this->rebusify, 'onCreated']);
97
-        add_action('site-reviews/review/reverted',                          [$this->rebusify, 'onReverted']);
98
-        add_action('site-reviews/review/saved',                             [$this->rebusify, 'onSaved']);
99
-        add_action('updated_postmeta',                                      [$this->rebusify, 'onUpdatedMeta'], 10, 4);
100
-        add_action('set_object_terms',                                      [$this->review, 'onAfterChangeCategory'], 10, 6);
101
-        add_action('transition_post_status',                                [$this->review, 'onAfterChangeStatus'], 10, 3);
102
-        add_action('site-reviews/review/created',                           [$this->review, 'onAfterCreate']);
103
-        add_action('before_delete_post',                                    [$this->review, 'onBeforeDelete']);
104
-        add_action('update_postmeta',                                       [$this->review, 'onBeforeUpdate'], 10, 4);
105
-        add_action('admin_init',                                            [$this->router, 'routeAdminPostRequest']);
106
-        add_action('wp_ajax_'.Application::PREFIX.'action',                 [$this->router, 'routeAjaxRequest']);
107
-        add_action('wp_ajax_nopriv_'.Application::PREFIX.'action',          [$this->router, 'routeAjaxRequest']);
108
-        add_action('init',                                                  [$this->router, 'routePublicPostRequest']);
109
-        add_action('admin_init',                                            [$this->settings, 'registerSettings']);
110
-        add_action(Application::TAXONOMY.'_term_edit_form_top',             [$this->taxonomy, 'disableParents']);
111
-        add_action(Application::TAXONOMY.'_term_new_form_tag',              [$this->taxonomy, 'disableParents']);
112
-        add_action(Application::TAXONOMY.'_add_form_fields',                [$this->taxonomy, 'enableParents']);
113
-        add_action(Application::TAXONOMY.'_edit_form',                      [$this->taxonomy, 'enableParents']);
114
-        add_action('restrict_manage_posts',                                 [$this->taxonomy, 'renderTaxonomyFilter'], 9);
115
-        add_action('set_object_terms',                                      [$this->taxonomy, 'restrictTermSelection'], 9, 6);
116
-    }
53
+	/**
54
+	 * @return void
55
+	 */
56
+	public function run()
57
+	{
58
+		add_action('admin_enqueue_scripts',                                 [$this->admin, 'enqueueAssets']);
59
+		add_action('admin_init',                                            [$this->admin, 'registerTinymcePopups']);
60
+		add_action('media_buttons',                                         [$this->admin, 'renderTinymceButton'], 11);
61
+		add_action('plugins_loaded',                                        [$this->app, 'getDefaults'], 11);
62
+		add_action('plugins_loaded',                                        [$this->app, 'registerAddons']);
63
+		add_action('plugins_loaded',                                        [$this->app, 'registerLanguages']);
64
+		add_action('plugins_loaded',                                        [$this->app, 'registerReviewTypes']);
65
+		add_action('upgrader_process_complete',                             [$this->app, 'upgraded'], 10, 2);
66
+		add_action('init',                                                  [$this->blocks, 'registerAssets'], 9);
67
+		add_action('init',                                                  [$this->blocks, 'registerBlocks']);
68
+		add_action('admin_footer',                                          [$this->console, 'logOnce']);
69
+		add_action('wp_footer',                                             [$this->console, 'logOnce']);
70
+		add_action('admin_enqueue_scripts',                                 [$this->editor, 'customizePostStatusLabels']);
71
+		add_action('add_meta_boxes_'.Application::POST_TYPE,                [$this->editor, 'registerMetaBoxes']);
72
+		add_action('admin_print_scripts',                                   [$this->editor, 'removeAutosave'], 999);
73
+		add_action('admin_menu',                                            [$this->editor, 'removeMetaBoxes']);
74
+		add_action('current_screen',                                        [$this->editor, 'removePostTypeSupport']);
75
+		add_action('post_submitbox_misc_actions',                           [$this->editor, 'renderPinnedInPublishMetaBox']);
76
+		add_action('admin_head',                                            [$this->editor, 'renderReviewFields']);
77
+		add_action('admin_action_revert',                                   [$this->editor, 'revertReview']);
78
+		add_action('save_post_'.Application::POST_TYPE,                     [$this->editor, 'saveMetaboxes']);
79
+		add_action('admin_action_approve',                                  [$this->listtable, 'approve']);
80
+		add_action('bulk_edit_custom_box',                                  [$this->listtable, 'renderBulkEditFields'], 10, 2);
81
+		add_action('restrict_manage_posts',                                 [$this->listtable, 'renderColumnFilters']);
82
+		add_action('manage_'.Application::POST_TYPE.'_posts_custom_column', [$this->listtable, 'renderColumnValues'], 10, 2);
83
+		add_action('save_post_'.Application::POST_TYPE,                     [$this->listtable, 'saveBulkEditFields']);
84
+		add_action('pre_get_posts',                                         [$this->listtable, 'setQueryForColumn']);
85
+		add_action('admin_action_unapprove',                                [$this->listtable, 'unapprove']);
86
+		add_action('init',                                                  [$this->main, 'registerPostType'], 8);
87
+		add_action('init',                                                  [$this->main, 'registerShortcodes']);
88
+		add_action('init',                                                  [$this->main, 'registerTaxonomy']);
89
+		add_action('widgets_init',                                          [$this->main, 'registerWidgets']);
90
+		add_action('admin_menu',                                            [$this->menu, 'registerMenuCount']);
91
+		add_action('admin_menu',                                            [$this->menu, 'registerSubMenus']);
92
+		add_action('admin_init',                                            [$this->menu, 'setCustomPermissions'], 999);
93
+		add_action('wp_enqueue_scripts',                                    [$this->public, 'enqueueAssets'], 999);
94
+		add_filter('site-reviews/builder',                                  [$this->public, 'modifyBuilder']);
95
+		add_action('wp_footer',                                             [$this->public, 'renderSchema']);
96
+		add_action('site-reviews/review/created',                           [$this->rebusify, 'onCreated']);
97
+		add_action('site-reviews/review/reverted',                          [$this->rebusify, 'onReverted']);
98
+		add_action('site-reviews/review/saved',                             [$this->rebusify, 'onSaved']);
99
+		add_action('updated_postmeta',                                      [$this->rebusify, 'onUpdatedMeta'], 10, 4);
100
+		add_action('set_object_terms',                                      [$this->review, 'onAfterChangeCategory'], 10, 6);
101
+		add_action('transition_post_status',                                [$this->review, 'onAfterChangeStatus'], 10, 3);
102
+		add_action('site-reviews/review/created',                           [$this->review, 'onAfterCreate']);
103
+		add_action('before_delete_post',                                    [$this->review, 'onBeforeDelete']);
104
+		add_action('update_postmeta',                                       [$this->review, 'onBeforeUpdate'], 10, 4);
105
+		add_action('admin_init',                                            [$this->router, 'routeAdminPostRequest']);
106
+		add_action('wp_ajax_'.Application::PREFIX.'action',                 [$this->router, 'routeAjaxRequest']);
107
+		add_action('wp_ajax_nopriv_'.Application::PREFIX.'action',          [$this->router, 'routeAjaxRequest']);
108
+		add_action('init',                                                  [$this->router, 'routePublicPostRequest']);
109
+		add_action('admin_init',                                            [$this->settings, 'registerSettings']);
110
+		add_action(Application::TAXONOMY.'_term_edit_form_top',             [$this->taxonomy, 'disableParents']);
111
+		add_action(Application::TAXONOMY.'_term_new_form_tag',              [$this->taxonomy, 'disableParents']);
112
+		add_action(Application::TAXONOMY.'_add_form_fields',                [$this->taxonomy, 'enableParents']);
113
+		add_action(Application::TAXONOMY.'_edit_form',                      [$this->taxonomy, 'enableParents']);
114
+		add_action('restrict_manage_posts',                                 [$this->taxonomy, 'renderTaxonomyFilter'], 9);
115
+		add_action('set_object_terms',                                      [$this->taxonomy, 'restrictTermSelection'], 9, 6);
116
+	}
117 117
 }
Please login to merge, or discard this patch.
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -33,21 +33,21 @@  discard block
 block discarded – undo
33 33
     protected $settings;
34 34
     protected $taxonomy;
35 35
 
36
-    public function __construct(Application $app ) {
36
+    public function __construct( Application $app ) {
37 37
         $this->app = $app;
38
-        $this->admin = $app->make(AdminController::class);
39
-        $this->blocks = $app->make(BlocksController::class);
40
-        $this->console = $app->make(Console::class);
41
-        $this->editor = $app->make(EditorController::class);
42
-        $this->listtable = $app->make(ListTableController::class);
43
-        $this->main = $app->make(MainController::class);
44
-        $this->menu = $app->make(MenuController::class);
45
-        $this->public = $app->make(PublicController::class);
46
-        $this->rebusify = $app->make(RebusifyController::class);
47
-        $this->review = $app->make(ReviewController::class);
48
-        $this->router = $app->make(Router::class);
49
-        $this->settings = $app->make(SettingsController::class);
50
-        $this->taxonomy = $app->make(TaxonomyController::class);
38
+        $this->admin = $app->make( AdminController::class );
39
+        $this->blocks = $app->make( BlocksController::class );
40
+        $this->console = $app->make( Console::class );
41
+        $this->editor = $app->make( EditorController::class );
42
+        $this->listtable = $app->make( ListTableController::class );
43
+        $this->main = $app->make( MainController::class );
44
+        $this->menu = $app->make( MenuController::class );
45
+        $this->public = $app->make( PublicController::class );
46
+        $this->rebusify = $app->make( RebusifyController::class );
47
+        $this->review = $app->make( ReviewController::class );
48
+        $this->router = $app->make( Router::class );
49
+        $this->settings = $app->make( SettingsController::class );
50
+        $this->taxonomy = $app->make( TaxonomyController::class );
51 51
     }
52 52
 
53 53
     /**
@@ -55,63 +55,63 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function run()
57 57
     {
58
-        add_action('admin_enqueue_scripts',                                 [$this->admin, 'enqueueAssets']);
59
-        add_action('admin_init',                                            [$this->admin, 'registerTinymcePopups']);
60
-        add_action('media_buttons',                                         [$this->admin, 'renderTinymceButton'], 11);
61
-        add_action('plugins_loaded',                                        [$this->app, 'getDefaults'], 11);
62
-        add_action('plugins_loaded',                                        [$this->app, 'registerAddons']);
63
-        add_action('plugins_loaded',                                        [$this->app, 'registerLanguages']);
64
-        add_action('plugins_loaded',                                        [$this->app, 'registerReviewTypes']);
65
-        add_action('upgrader_process_complete',                             [$this->app, 'upgraded'], 10, 2);
66
-        add_action('init',                                                  [$this->blocks, 'registerAssets'], 9);
67
-        add_action('init',                                                  [$this->blocks, 'registerBlocks']);
68
-        add_action('admin_footer',                                          [$this->console, 'logOnce']);
69
-        add_action('wp_footer',                                             [$this->console, 'logOnce']);
70
-        add_action('admin_enqueue_scripts',                                 [$this->editor, 'customizePostStatusLabels']);
71
-        add_action('add_meta_boxes_'.Application::POST_TYPE,                [$this->editor, 'registerMetaBoxes']);
72
-        add_action('admin_print_scripts',                                   [$this->editor, 'removeAutosave'], 999);
73
-        add_action('admin_menu',                                            [$this->editor, 'removeMetaBoxes']);
74
-        add_action('current_screen',                                        [$this->editor, 'removePostTypeSupport']);
75
-        add_action('post_submitbox_misc_actions',                           [$this->editor, 'renderPinnedInPublishMetaBox']);
76
-        add_action('admin_head',                                            [$this->editor, 'renderReviewFields']);
77
-        add_action('admin_action_revert',                                   [$this->editor, 'revertReview']);
78
-        add_action('save_post_'.Application::POST_TYPE,                     [$this->editor, 'saveMetaboxes']);
79
-        add_action('admin_action_approve',                                  [$this->listtable, 'approve']);
80
-        add_action('bulk_edit_custom_box',                                  [$this->listtable, 'renderBulkEditFields'], 10, 2);
81
-        add_action('restrict_manage_posts',                                 [$this->listtable, 'renderColumnFilters']);
82
-        add_action('manage_'.Application::POST_TYPE.'_posts_custom_column', [$this->listtable, 'renderColumnValues'], 10, 2);
83
-        add_action('save_post_'.Application::POST_TYPE,                     [$this->listtable, 'saveBulkEditFields']);
84
-        add_action('pre_get_posts',                                         [$this->listtable, 'setQueryForColumn']);
85
-        add_action('admin_action_unapprove',                                [$this->listtable, 'unapprove']);
86
-        add_action('init',                                                  [$this->main, 'registerPostType'], 8);
87
-        add_action('init',                                                  [$this->main, 'registerShortcodes']);
88
-        add_action('init',                                                  [$this->main, 'registerTaxonomy']);
89
-        add_action('widgets_init',                                          [$this->main, 'registerWidgets']);
90
-        add_action('admin_menu',                                            [$this->menu, 'registerMenuCount']);
91
-        add_action('admin_menu',                                            [$this->menu, 'registerSubMenus']);
92
-        add_action('admin_init',                                            [$this->menu, 'setCustomPermissions'], 999);
93
-        add_action('wp_enqueue_scripts',                                    [$this->public, 'enqueueAssets'], 999);
94
-        add_filter('site-reviews/builder',                                  [$this->public, 'modifyBuilder']);
95
-        add_action('wp_footer',                                             [$this->public, 'renderSchema']);
96
-        add_action('site-reviews/review/created',                           [$this->rebusify, 'onCreated']);
97
-        add_action('site-reviews/review/reverted',                          [$this->rebusify, 'onReverted']);
98
-        add_action('site-reviews/review/saved',                             [$this->rebusify, 'onSaved']);
99
-        add_action('updated_postmeta',                                      [$this->rebusify, 'onUpdatedMeta'], 10, 4);
100
-        add_action('set_object_terms',                                      [$this->review, 'onAfterChangeCategory'], 10, 6);
101
-        add_action('transition_post_status',                                [$this->review, 'onAfterChangeStatus'], 10, 3);
102
-        add_action('site-reviews/review/created',                           [$this->review, 'onAfterCreate']);
103
-        add_action('before_delete_post',                                    [$this->review, 'onBeforeDelete']);
104
-        add_action('update_postmeta',                                       [$this->review, 'onBeforeUpdate'], 10, 4);
105
-        add_action('admin_init',                                            [$this->router, 'routeAdminPostRequest']);
106
-        add_action('wp_ajax_'.Application::PREFIX.'action',                 [$this->router, 'routeAjaxRequest']);
107
-        add_action('wp_ajax_nopriv_'.Application::PREFIX.'action',          [$this->router, 'routeAjaxRequest']);
108
-        add_action('init',                                                  [$this->router, 'routePublicPostRequest']);
109
-        add_action('admin_init',                                            [$this->settings, 'registerSettings']);
110
-        add_action(Application::TAXONOMY.'_term_edit_form_top',             [$this->taxonomy, 'disableParents']);
111
-        add_action(Application::TAXONOMY.'_term_new_form_tag',              [$this->taxonomy, 'disableParents']);
112
-        add_action(Application::TAXONOMY.'_add_form_fields',                [$this->taxonomy, 'enableParents']);
113
-        add_action(Application::TAXONOMY.'_edit_form',                      [$this->taxonomy, 'enableParents']);
114
-        add_action('restrict_manage_posts',                                 [$this->taxonomy, 'renderTaxonomyFilter'], 9);
115
-        add_action('set_object_terms',                                      [$this->taxonomy, 'restrictTermSelection'], 9, 6);
58
+        add_action( 'admin_enqueue_scripts', [$this->admin, 'enqueueAssets'] );
59
+        add_action( 'admin_init', [$this->admin, 'registerTinymcePopups'] );
60
+        add_action( 'media_buttons', [$this->admin, 'renderTinymceButton'], 11 );
61
+        add_action( 'plugins_loaded', [$this->app, 'getDefaults'], 11 );
62
+        add_action( 'plugins_loaded', [$this->app, 'registerAddons'] );
63
+        add_action( 'plugins_loaded', [$this->app, 'registerLanguages'] );
64
+        add_action( 'plugins_loaded', [$this->app, 'registerReviewTypes'] );
65
+        add_action( 'upgrader_process_complete', [$this->app, 'upgraded'], 10, 2 );
66
+        add_action( 'init', [$this->blocks, 'registerAssets'], 9 );
67
+        add_action( 'init', [$this->blocks, 'registerBlocks'] );
68
+        add_action( 'admin_footer', [$this->console, 'logOnce'] );
69
+        add_action( 'wp_footer', [$this->console, 'logOnce'] );
70
+        add_action( 'admin_enqueue_scripts', [$this->editor, 'customizePostStatusLabels'] );
71
+        add_action( 'add_meta_boxes_'.Application::POST_TYPE, [$this->editor, 'registerMetaBoxes'] );
72
+        add_action( 'admin_print_scripts', [$this->editor, 'removeAutosave'], 999 );
73
+        add_action( 'admin_menu', [$this->editor, 'removeMetaBoxes'] );
74
+        add_action( 'current_screen', [$this->editor, 'removePostTypeSupport'] );
75
+        add_action( 'post_submitbox_misc_actions', [$this->editor, 'renderPinnedInPublishMetaBox'] );
76
+        add_action( 'admin_head', [$this->editor, 'renderReviewFields'] );
77
+        add_action( 'admin_action_revert', [$this->editor, 'revertReview'] );
78
+        add_action( 'save_post_'.Application::POST_TYPE, [$this->editor, 'saveMetaboxes'] );
79
+        add_action( 'admin_action_approve', [$this->listtable, 'approve'] );
80
+        add_action( 'bulk_edit_custom_box', [$this->listtable, 'renderBulkEditFields'], 10, 2 );
81
+        add_action( 'restrict_manage_posts', [$this->listtable, 'renderColumnFilters'] );
82
+        add_action( 'manage_'.Application::POST_TYPE.'_posts_custom_column', [$this->listtable, 'renderColumnValues'], 10, 2 );
83
+        add_action( 'save_post_'.Application::POST_TYPE, [$this->listtable, 'saveBulkEditFields'] );
84
+        add_action( 'pre_get_posts', [$this->listtable, 'setQueryForColumn'] );
85
+        add_action( 'admin_action_unapprove', [$this->listtable, 'unapprove'] );
86
+        add_action( 'init', [$this->main, 'registerPostType'], 8 );
87
+        add_action( 'init', [$this->main, 'registerShortcodes'] );
88
+        add_action( 'init', [$this->main, 'registerTaxonomy'] );
89
+        add_action( 'widgets_init', [$this->main, 'registerWidgets'] );
90
+        add_action( 'admin_menu', [$this->menu, 'registerMenuCount'] );
91
+        add_action( 'admin_menu', [$this->menu, 'registerSubMenus'] );
92
+        add_action( 'admin_init', [$this->menu, 'setCustomPermissions'], 999 );
93
+        add_action( 'wp_enqueue_scripts', [$this->public, 'enqueueAssets'], 999 );
94
+        add_filter( 'site-reviews/builder', [$this->public, 'modifyBuilder'] );
95
+        add_action( 'wp_footer', [$this->public, 'renderSchema'] );
96
+        add_action( 'site-reviews/review/created', [$this->rebusify, 'onCreated'] );
97
+        add_action( 'site-reviews/review/reverted', [$this->rebusify, 'onReverted'] );
98
+        add_action( 'site-reviews/review/saved', [$this->rebusify, 'onSaved'] );
99
+        add_action( 'updated_postmeta', [$this->rebusify, 'onUpdatedMeta'], 10, 4 );
100
+        add_action( 'set_object_terms', [$this->review, 'onAfterChangeCategory'], 10, 6 );
101
+        add_action( 'transition_post_status', [$this->review, 'onAfterChangeStatus'], 10, 3 );
102
+        add_action( 'site-reviews/review/created', [$this->review, 'onAfterCreate'] );
103
+        add_action( 'before_delete_post', [$this->review, 'onBeforeDelete'] );
104
+        add_action( 'update_postmeta', [$this->review, 'onBeforeUpdate'], 10, 4 );
105
+        add_action( 'admin_init', [$this->router, 'routeAdminPostRequest'] );
106
+        add_action( 'wp_ajax_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] );
107
+        add_action( 'wp_ajax_nopriv_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] );
108
+        add_action( 'init', [$this->router, 'routePublicPostRequest'] );
109
+        add_action( 'admin_init', [$this->settings, 'registerSettings'] );
110
+        add_action( Application::TAXONOMY.'_term_edit_form_top', [$this->taxonomy, 'disableParents'] );
111
+        add_action( Application::TAXONOMY.'_term_new_form_tag', [$this->taxonomy, 'disableParents'] );
112
+        add_action( Application::TAXONOMY.'_add_form_fields', [$this->taxonomy, 'enableParents'] );
113
+        add_action( Application::TAXONOMY.'_edit_form', [$this->taxonomy, 'enableParents'] );
114
+        add_action( 'restrict_manage_posts', [$this->taxonomy, 'renderTaxonomyFilter'], 9 );
115
+        add_action( 'set_object_terms', [$this->taxonomy, 'restrictTermSelection'], 9, 6 );
116 116
     }
117 117
 }
Please login to merge, or discard this patch.
plugin/Commands/TogglePinned.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -4,14 +4,14 @@
 block discarded – undo
4 4
 
5 5
 class TogglePinned
6 6
 {
7
-    public $id;
8
-    public $pinned;
7
+	public $id;
8
+	public $pinned;
9 9
 
10
-    public function __construct($input)
11
-    {
12
-        $this->id = $input['id'];
13
-        $this->pinned = isset($input['pinned'])
14
-            ? wp_validate_boolean($input['pinned'])
15
-            : null;
16
-    }
10
+	public function __construct($input)
11
+	{
12
+		$this->id = $input['id'];
13
+		$this->pinned = isset($input['pinned'])
14
+			? wp_validate_boolean($input['pinned'])
15
+			: null;
16
+	}
17 17
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,11 +7,11 @@
 block discarded – undo
7 7
     public $id;
8 8
     public $pinned;
9 9
 
10
-    public function __construct($input)
10
+    public function __construct( $input )
11 11
     {
12 12
         $this->id = $input['id'];
13 13
         $this->pinned = isset($input['pinned'])
14
-            ? wp_validate_boolean($input['pinned'])
14
+            ? wp_validate_boolean( $input['pinned'] )
15 15
             : null;
16 16
     }
17 17
 }
Please login to merge, or discard this patch.
plugin/Commands/RegisterWidgets.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -4,10 +4,10 @@
 block discarded – undo
4 4
 
5 5
 class RegisterWidgets
6 6
 {
7
-    public $widgets;
7
+	public $widgets;
8 8
 
9
-    public function __construct($input)
10
-    {
11
-        $this->widgets = $input;
12
-    }
9
+	public function __construct($input)
10
+	{
11
+		$this->widgets = $input;
12
+	}
13 13
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 {
7 7
     public $widgets;
8 8
 
9
-    public function __construct($input)
9
+    public function __construct( $input )
10 10
     {
11 11
         $this->widgets = $input;
12 12
     }
Please login to merge, or discard this patch.