Passed
Push — master ( 078281...45cbff )
by Paul
03:42
created
plugin/Handlers/EnqueueAdminAssets.php 1 patch
Indentation   +146 added lines, -146 removed lines patch added patch discarded remove patch
@@ -10,158 +10,158 @@
 block discarded – undo
10 10
 
11 11
 class EnqueueAdminAssets
12 12
 {
13
-    /**
14
-     * @var array
15
-     */
16
-    protected $pointers;
13
+	/**
14
+	 * @var array
15
+	 */
16
+	protected $pointers;
17 17
 
18
-    /**
19
-     * @return void
20
-     */
21
-    public function handle(Command $command)
22
-    {
23
-        $this->generatePointers($command->pointers);
24
-        $this->enqueueAssets();
25
-        $this->localizeAssets();
26
-    }
18
+	/**
19
+	 * @return void
20
+	 */
21
+	public function handle(Command $command)
22
+	{
23
+		$this->generatePointers($command->pointers);
24
+		$this->enqueueAssets();
25
+		$this->localizeAssets();
26
+	}
27 27
 
28
-    /**
29
-     * @return void
30
-     */
31
-    public function enqueueAssets()
32
-    {
33
-        wp_enqueue_style(
34
-            Application::ID,
35
-            glsr()->url('assets/styles/'.Application::ID.'-admin.css'),
36
-            [],
37
-            glsr()->version
38
-        );
39
-        if (!$this->isCurrentScreen()) {
40
-            return;
41
-        }
42
-        wp_enqueue_script(
43
-            Application::ID,
44
-            glsr()->url('assets/scripts/'.Application::ID.'-admin.js'),
45
-            $this->getDependencies(),
46
-            glsr()->version,
47
-            true
48
-        );
49
-        if (!empty($this->pointers)) {
50
-            wp_enqueue_style('wp-pointer');
51
-            wp_enqueue_script('wp-pointer');
52
-        }
53
-    }
28
+	/**
29
+	 * @return void
30
+	 */
31
+	public function enqueueAssets()
32
+	{
33
+		wp_enqueue_style(
34
+			Application::ID,
35
+			glsr()->url('assets/styles/'.Application::ID.'-admin.css'),
36
+			[],
37
+			glsr()->version
38
+		);
39
+		if (!$this->isCurrentScreen()) {
40
+			return;
41
+		}
42
+		wp_enqueue_script(
43
+			Application::ID,
44
+			glsr()->url('assets/scripts/'.Application::ID.'-admin.js'),
45
+			$this->getDependencies(),
46
+			glsr()->version,
47
+			true
48
+		);
49
+		if (!empty($this->pointers)) {
50
+			wp_enqueue_style('wp-pointer');
51
+			wp_enqueue_script('wp-pointer');
52
+		}
53
+	}
54 54
 
55
-    /**
56
-     * @return void
57
-     */
58
-    public function localizeAssets()
59
-    {
60
-        $variables = [
61
-            'action' => Application::PREFIX.'action',
62
-            'addons' => [],
63
-            'ajaxurl' => admin_url('admin-ajax.php'),
64
-            'hideoptions' => [
65
-                'site_reviews' => glsr(SiteReviewsShortcode::class)->getHideOptions(),
66
-                'site_reviews_form' => glsr(SiteReviewsFormShortcode::class)->getHideOptions(),
67
-                'site_reviews_summary' => glsr(SiteReviewsSummaryShortcode::class)->getHideOptions(),
68
-            ],
69
-            'nameprefix' => Application::ID,
70
-            'nonce' => [
71
-                'change-status' => wp_create_nonce('change-status'),
72
-                'clear-console' => wp_create_nonce('clear-console'),
73
-                'count-reviews' => wp_create_nonce('count-reviews'),
74
-                'fetch-console' => wp_create_nonce('fetch-console'),
75
-                'mce-shortcode' => wp_create_nonce('mce-shortcode'),
76
-                'sync-reviews' => wp_create_nonce('sync-reviews'),
77
-                'toggle-pinned' => wp_create_nonce('toggle-pinned'),
78
-            ],
79
-            'pointers' => $this->pointers,
80
-            'shortcodes' => [],
81
-            'tinymce' => [
82
-                'glsr_shortcode' => glsr()->url('assets/scripts/mce-plugin.js'),
83
-            ],
84
-        ];
85
-        if (user_can_richedit()) {
86
-            $variables['shortcodes'] = $this->localizeShortcodes();
87
-        }
88
-        $variables = apply_filters('site-reviews/enqueue/admin/localize', $variables);
89
-        wp_localize_script(Application::ID, 'GLSR', $variables);
90
-    }
55
+	/**
56
+	 * @return void
57
+	 */
58
+	public function localizeAssets()
59
+	{
60
+		$variables = [
61
+			'action' => Application::PREFIX.'action',
62
+			'addons' => [],
63
+			'ajaxurl' => admin_url('admin-ajax.php'),
64
+			'hideoptions' => [
65
+				'site_reviews' => glsr(SiteReviewsShortcode::class)->getHideOptions(),
66
+				'site_reviews_form' => glsr(SiteReviewsFormShortcode::class)->getHideOptions(),
67
+				'site_reviews_summary' => glsr(SiteReviewsSummaryShortcode::class)->getHideOptions(),
68
+			],
69
+			'nameprefix' => Application::ID,
70
+			'nonce' => [
71
+				'change-status' => wp_create_nonce('change-status'),
72
+				'clear-console' => wp_create_nonce('clear-console'),
73
+				'count-reviews' => wp_create_nonce('count-reviews'),
74
+				'fetch-console' => wp_create_nonce('fetch-console'),
75
+				'mce-shortcode' => wp_create_nonce('mce-shortcode'),
76
+				'sync-reviews' => wp_create_nonce('sync-reviews'),
77
+				'toggle-pinned' => wp_create_nonce('toggle-pinned'),
78
+			],
79
+			'pointers' => $this->pointers,
80
+			'shortcodes' => [],
81
+			'tinymce' => [
82
+				'glsr_shortcode' => glsr()->url('assets/scripts/mce-plugin.js'),
83
+			],
84
+		];
85
+		if (user_can_richedit()) {
86
+			$variables['shortcodes'] = $this->localizeShortcodes();
87
+		}
88
+		$variables = apply_filters('site-reviews/enqueue/admin/localize', $variables);
89
+		wp_localize_script(Application::ID, 'GLSR', $variables);
90
+	}
91 91
 
92
-    /**
93
-     * @return array
94
-     */
95
-    protected function getDependencies()
96
-    {
97
-        $dependencies = apply_filters('site-reviews/enqueue/admin/dependencies', []);
98
-        $dependencies = array_merge($dependencies, [
99
-            'jquery', 'jquery-ui-sortable', 'underscore', 'wp-util',
100
-        ]);
101
-        return $dependencies;
102
-    }
92
+	/**
93
+	 * @return array
94
+	 */
95
+	protected function getDependencies()
96
+	{
97
+		$dependencies = apply_filters('site-reviews/enqueue/admin/dependencies', []);
98
+		$dependencies = array_merge($dependencies, [
99
+			'jquery', 'jquery-ui-sortable', 'underscore', 'wp-util',
100
+		]);
101
+		return $dependencies;
102
+	}
103 103
 
104
-    /**
105
-     * @return array
106
-     */
107
-    protected function generatePointer(array $pointer)
108
-    {
109
-        return [
110
-            'id' => $pointer['id'],
111
-            'options' => [
112
-                'content' => '<h3>'.$pointer['title'].'</h3><p>'.$pointer['content'].'</p>',
113
-                'position' => $pointer['position'],
114
-            ],
115
-            'screen' => $pointer['screen'],
116
-            'target' => $pointer['target'],
117
-        ];
118
-    }
104
+	/**
105
+	 * @return array
106
+	 */
107
+	protected function generatePointer(array $pointer)
108
+	{
109
+		return [
110
+			'id' => $pointer['id'],
111
+			'options' => [
112
+				'content' => '<h3>'.$pointer['title'].'</h3><p>'.$pointer['content'].'</p>',
113
+				'position' => $pointer['position'],
114
+			],
115
+			'screen' => $pointer['screen'],
116
+			'target' => $pointer['target'],
117
+		];
118
+	}
119 119
 
120
-    /**
121
-     * @return void
122
-     */
123
-    protected function generatePointers(array $pointers)
124
-    {
125
-        $dismissedPointers = get_user_meta(get_current_user_id(), 'dismissed_wp_pointers', true);
126
-        $dismissedPointers = explode(',', (string) $dismissedPointers);
127
-        $generatedPointers = [];
128
-        foreach ($pointers as $pointer) {
129
-            if ($pointer['screen'] != glsr_current_screen()->id) {
130
-                continue;
131
-            }
132
-            if (in_array($pointer['id'], $dismissedPointers)) {
133
-                continue;
134
-            }
135
-            $generatedPointers[] = $this->generatePointer($pointer);
136
-        }
137
-        $this->pointers = $generatedPointers;
138
-    }
120
+	/**
121
+	 * @return void
122
+	 */
123
+	protected function generatePointers(array $pointers)
124
+	{
125
+		$dismissedPointers = get_user_meta(get_current_user_id(), 'dismissed_wp_pointers', true);
126
+		$dismissedPointers = explode(',', (string) $dismissedPointers);
127
+		$generatedPointers = [];
128
+		foreach ($pointers as $pointer) {
129
+			if ($pointer['screen'] != glsr_current_screen()->id) {
130
+				continue;
131
+			}
132
+			if (in_array($pointer['id'], $dismissedPointers)) {
133
+				continue;
134
+			}
135
+			$generatedPointers[] = $this->generatePointer($pointer);
136
+		}
137
+		$this->pointers = $generatedPointers;
138
+	}
139 139
 
140
-    /**
141
-     * @return bool
142
-     */
143
-    protected function isCurrentScreen()
144
-    {
145
-        $screen = glsr_current_screen();
146
-        return Application::POST_TYPE == $screen->post_type
147
-            || 'dashboard' == $screen->id
148
-            || 'plugins_page_'.Application::ID == $screen->id
149
-            || 'post' == $screen->base
150
-            || 'widgets' == $screen->id;
151
-    }
140
+	/**
141
+	 * @return bool
142
+	 */
143
+	protected function isCurrentScreen()
144
+	{
145
+		$screen = glsr_current_screen();
146
+		return Application::POST_TYPE == $screen->post_type
147
+			|| 'dashboard' == $screen->id
148
+			|| 'plugins_page_'.Application::ID == $screen->id
149
+			|| 'post' == $screen->base
150
+			|| 'widgets' == $screen->id;
151
+	}
152 152
 
153
-    /**
154
-     * @return array
155
-     */
156
-    protected function localizeShortcodes()
157
-    {
158
-        $variables = [];
159
-        foreach (glsr()->mceShortcodes as $tag => $args) {
160
-            if (empty($args['required'])) {
161
-                continue;
162
-            }
163
-            $variables[$tag] = $args['required'];
164
-        }
165
-        return $variables;
166
-    }
153
+	/**
154
+	 * @return array
155
+	 */
156
+	protected function localizeShortcodes()
157
+	{
158
+		$variables = [];
159
+		foreach (glsr()->mceShortcodes as $tag => $args) {
160
+			if (empty($args['required'])) {
161
+				continue;
162
+			}
163
+			$variables[$tag] = $args['required'];
164
+		}
165
+		return $variables;
166
+	}
167 167
 }
Please login to merge, or discard this patch.
plugin/Defaults/EmailDefaults.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -7,40 +7,40 @@
 block discarded – undo
7 7
 
8 8
 class EmailDefaults extends Defaults
9 9
 {
10
-    /**
11
-     * @return array
12
-     */
13
-    protected function defaults()
14
-    {
15
-        return [
16
-            'after' => '',
17
-            'attachments' => [],
18
-            'bcc' => '',
19
-            'before' => '',
20
-            'cc' => '',
21
-            'from' => $this->getFromName().' <'.$this->getFromEmail().'>',
22
-            'message' => '',
23
-            'reply-to' => '',
24
-            'subject' => '',
25
-            'template' => '',
26
-            'template-tags' => [],
27
-            'to' => '',
28
-        ];
29
-    }
10
+	/**
11
+	 * @return array
12
+	 */
13
+	protected function defaults()
14
+	{
15
+		return [
16
+			'after' => '',
17
+			'attachments' => [],
18
+			'bcc' => '',
19
+			'before' => '',
20
+			'cc' => '',
21
+			'from' => $this->getFromName().' <'.$this->getFromEmail().'>',
22
+			'message' => '',
23
+			'reply-to' => '',
24
+			'subject' => '',
25
+			'template' => '',
26
+			'template-tags' => [],
27
+			'to' => '',
28
+		];
29
+	}
30 30
 
31
-    /**
32
-     * @return string
33
-     */
34
-    protected function getFromEmail()
35
-    {
36
-        return glsr(OptionManager::class)->getWP('admin_email');
37
-    }
31
+	/**
32
+	 * @return string
33
+	 */
34
+	protected function getFromEmail()
35
+	{
36
+		return glsr(OptionManager::class)->getWP('admin_email');
37
+	}
38 38
 
39
-    /**
40
-     * @return string
41
-     */
42
-    protected function getFromName()
43
-    {
44
-        return wp_specialchars_decode(glsr(OptionManager::class)->getWP('blogname'), ENT_QUOTES);
45
-    }
39
+	/**
40
+	 * @return string
41
+	 */
42
+	protected function getFromName()
43
+	{
44
+		return wp_specialchars_decode(glsr(OptionManager::class)->getWP('blogname'), ENT_QUOTES);
45
+	}
46 46
 }
Please login to merge, or discard this patch.
plugin/Controllers/MainController.php 1 patch
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -10,94 +10,94 @@
 block discarded – undo
10 10
 
11 11
 class MainController extends Controller
12 12
 {
13
-    /**
14
-     * @return void
15
-     * @action init
16
-     */
17
-    public function registerPostType()
18
-    {
19
-        if (!glsr()->hasPermission()) {
20
-            return;
21
-        }
22
-        $command = new RegisterPostType([
23
-            'capabilities' => ['create_posts' => 'create_'.Application::POST_TYPE],
24
-            'columns' => [
25
-                'title' => '',
26
-                'category' => '',
27
-                'assigned_to' => __('Assigned To', 'site-reviews'),
28
-                'reviewer' => __('Author', 'site-reviews'),
29
-                'review_type' => __('Type', 'site-reviews'),
30
-                'rating' => __('Rating', 'site-reviews'),
31
-                'pinned' => __('Pinned', 'site-reviews'),
32
-                'date' => '',
33
-            ],
34
-            'menu_icon' => 'dashicons-star-half',
35
-            'menu_name' => glsr()->name,
36
-            'map_meta_cap' => true,
37
-            'plural' => __('Reviews', 'site-reviews'),
38
-            'post_type' => Application::POST_TYPE,
39
-            'rest_controller_class' => RestReviewController::class,
40
-            'show_in_rest' => true,
41
-            'single' => __('Review', 'site-reviews'),
42
-        ]);
43
-        $this->execute($command);
44
-    }
13
+	/**
14
+	 * @return void
15
+	 * @action init
16
+	 */
17
+	public function registerPostType()
18
+	{
19
+		if (!glsr()->hasPermission()) {
20
+			return;
21
+		}
22
+		$command = new RegisterPostType([
23
+			'capabilities' => ['create_posts' => 'create_'.Application::POST_TYPE],
24
+			'columns' => [
25
+				'title' => '',
26
+				'category' => '',
27
+				'assigned_to' => __('Assigned To', 'site-reviews'),
28
+				'reviewer' => __('Author', 'site-reviews'),
29
+				'review_type' => __('Type', 'site-reviews'),
30
+				'rating' => __('Rating', 'site-reviews'),
31
+				'pinned' => __('Pinned', 'site-reviews'),
32
+				'date' => '',
33
+			],
34
+			'menu_icon' => 'dashicons-star-half',
35
+			'menu_name' => glsr()->name,
36
+			'map_meta_cap' => true,
37
+			'plural' => __('Reviews', 'site-reviews'),
38
+			'post_type' => Application::POST_TYPE,
39
+			'rest_controller_class' => RestReviewController::class,
40
+			'show_in_rest' => true,
41
+			'single' => __('Review', 'site-reviews'),
42
+		]);
43
+		$this->execute($command);
44
+	}
45 45
 
46
-    /**
47
-     * @return void
48
-     * @action init
49
-     */
50
-    public function registerShortcodes()
51
-    {
52
-        $command = new RegisterShortcodes([
53
-            'site_reviews',
54
-            'site_reviews_form',
55
-            'site_reviews_summary',
56
-        ]);
57
-        $this->execute($command);
58
-    }
46
+	/**
47
+	 * @return void
48
+	 * @action init
49
+	 */
50
+	public function registerShortcodes()
51
+	{
52
+		$command = new RegisterShortcodes([
53
+			'site_reviews',
54
+			'site_reviews_form',
55
+			'site_reviews_summary',
56
+		]);
57
+		$this->execute($command);
58
+	}
59 59
 
60
-    /**
61
-     * @return void
62
-     * @action init
63
-     */
64
-    public function registerTaxonomy()
65
-    {
66
-        $command = new RegisterTaxonomy([
67
-            'hierarchical' => true,
68
-            'meta_box_cb' => [glsr(EditorController::class), 'renderTaxonomyMetabox'],
69
-            'public' => false,
70
-            'rest_controller_class' => RestCategoryController::class,
71
-            'show_admin_column' => true,
72
-            'show_in_rest' => true,
73
-            'show_ui' => true,
74
-        ]);
75
-        $this->execute($command);
76
-    }
60
+	/**
61
+	 * @return void
62
+	 * @action init
63
+	 */
64
+	public function registerTaxonomy()
65
+	{
66
+		$command = new RegisterTaxonomy([
67
+			'hierarchical' => true,
68
+			'meta_box_cb' => [glsr(EditorController::class), 'renderTaxonomyMetabox'],
69
+			'public' => false,
70
+			'rest_controller_class' => RestCategoryController::class,
71
+			'show_admin_column' => true,
72
+			'show_in_rest' => true,
73
+			'show_ui' => true,
74
+		]);
75
+		$this->execute($command);
76
+	}
77 77
 
78
-    /**
79
-     * @return void
80
-     * @action widgets_init
81
-     */
82
-    public function registerWidgets()
83
-    {
84
-        $command = new RegisterWidgets([
85
-            'site-reviews' => [
86
-                'class' => 'glsr-widget glsr-widget-site-reviews',
87
-                'description' => __('Site Reviews: Display your recent reviews.', 'site-reviews'),
88
-                'title' => __('Recent Reviews', 'site-reviews'),
89
-            ],
90
-            'site-reviews-form' => [
91
-                'class' => 'glsr-widget glsr-widget-site-reviews-form',
92
-                'description' => __('Site Reviews: Display a form to submit reviews.', 'site-reviews'),
93
-                'title' => __('Submit a Review', 'site-reviews'),
94
-            ],
95
-            'site-reviews-summary' => [
96
-                'class' => 'glsr-widget glsr-widget-site-reviews-summary',
97
-                'description' => __('Site Reviews: Display a summary of your reviews.', 'site-reviews'),
98
-                'title' => __('Summary of Reviews', 'site-reviews'),
99
-            ],
100
-        ]);
101
-        $this->execute($command);
102
-    }
78
+	/**
79
+	 * @return void
80
+	 * @action widgets_init
81
+	 */
82
+	public function registerWidgets()
83
+	{
84
+		$command = new RegisterWidgets([
85
+			'site-reviews' => [
86
+				'class' => 'glsr-widget glsr-widget-site-reviews',
87
+				'description' => __('Site Reviews: Display your recent reviews.', 'site-reviews'),
88
+				'title' => __('Recent Reviews', 'site-reviews'),
89
+			],
90
+			'site-reviews-form' => [
91
+				'class' => 'glsr-widget glsr-widget-site-reviews-form',
92
+				'description' => __('Site Reviews: Display a form to submit reviews.', 'site-reviews'),
93
+				'title' => __('Submit a Review', 'site-reviews'),
94
+			],
95
+			'site-reviews-summary' => [
96
+				'class' => 'glsr-widget glsr-widget-site-reviews-summary',
97
+				'description' => __('Site Reviews: Display a summary of your reviews.', 'site-reviews'),
98
+				'title' => __('Summary of Reviews', 'site-reviews'),
99
+			],
100
+		]);
101
+		$this->execute($command);
102
+	}
103 103
 }
Please login to merge, or discard this patch.
site-reviews.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@
 block discarded – undo
18 18
 defined('WPINC') || die;
19 19
 
20 20
 if (!class_exists('GL_Plugin_Check_v3')) {
21
-    require_once __DIR__.'/activate.php';
21
+	require_once __DIR__.'/activate.php';
22 22
 }
23 23
 $check = new GL_Plugin_Check_v3(__FILE__);
24 24
 if (!$check->canProceed()) {
25
-    return;
25
+	return;
26 26
 }
27 27
 require_once __DIR__.'/autoload.php';
28 28
 require_once __DIR__.'/compatibility.php';
Please login to merge, or discard this patch.
plugin/Modules/Notice.php 1 patch
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -8,112 +8,112 @@
 block discarded – undo
8 8
 
9 9
 class Notice
10 10
 {
11
-    /**
12
-     * @param string $type
13
-     * @param string|array|WP_Error $message
14
-     * @return void
15
-     */
16
-    public function add($type, $message, array $args = [])
17
-    {
18
-        if (empty(array_filter([$message, $type]))) {
19
-            return;
20
-        }
21
-        $args['message'] = $message;
22
-        $args['type'] = $type;
23
-        add_settings_error(Application::ID, '', json_encode($this->normalize($args)));
24
-    }
11
+	/**
12
+	 * @param string $type
13
+	 * @param string|array|WP_Error $message
14
+	 * @return void
15
+	 */
16
+	public function add($type, $message, array $args = [])
17
+	{
18
+		if (empty(array_filter([$message, $type]))) {
19
+			return;
20
+		}
21
+		$args['message'] = $message;
22
+		$args['type'] = $type;
23
+		add_settings_error(Application::ID, '', json_encode($this->normalize($args)));
24
+	}
25 25
 
26
-    /**
27
-     * @param string|array|WP_Error $message
28
-     * @return void
29
-     */
30
-    public function addError($message, array $args = [])
31
-    {
32
-        $this->add('error', $message, $args);
33
-    }
26
+	/**
27
+	 * @param string|array|WP_Error $message
28
+	 * @return void
29
+	 */
30
+	public function addError($message, array $args = [])
31
+	{
32
+		$this->add('error', $message, $args);
33
+	}
34 34
 
35
-    /**
36
-     * @param string|array|WP_Error $message
37
-     * @return void
38
-     */
39
-    public function addSuccess($message, array $args = [])
40
-    {
41
-        $this->add('success', $message, $args);
42
-    }
35
+	/**
36
+	 * @param string|array|WP_Error $message
37
+	 * @return void
38
+	 */
39
+	public function addSuccess($message, array $args = [])
40
+	{
41
+		$this->add('success', $message, $args);
42
+	}
43 43
 
44
-    /**
45
-     * @param string|array|WP_Error $message
46
-     * @return void
47
-     */
48
-    public function addWarning($message, array $args = [])
49
-    {
50
-        $this->add('warning', $message, $args);
51
-    }
44
+	/**
45
+	 * @param string|array|WP_Error $message
46
+	 * @return void
47
+	 */
48
+	public function addWarning($message, array $args = [])
49
+	{
50
+		$this->add('warning', $message, $args);
51
+	}
52 52
 
53
-    /**
54
-     * @return static
55
-     */
56
-    public function clear()
57
-    {
58
-        global $wp_settings_errors;
59
-        $wp_settings_errors = [];
60
-        delete_transient('settings_errors');
61
-        return $this;
62
-    }
53
+	/**
54
+	 * @return static
55
+	 */
56
+	public function clear()
57
+	{
58
+		global $wp_settings_errors;
59
+		$wp_settings_errors = [];
60
+		delete_transient('settings_errors');
61
+		return $this;
62
+	}
63 63
 
64
-    /**
65
-     * @return string
66
-     */
67
-    public function get()
68
-    {
69
-        $notices = array_map('unserialize',
70
-            array_unique(array_map('serialize', get_settings_errors(Application::ID)))
71
-        );
72
-        $notices = array_reduce($notices, function ($carry, $notice) {
73
-            return $carry.$this->buildNotice(json_decode($notice['message'], true));
74
-        });
75
-        return apply_filters('site-reviews/notices', $notices);
76
-    }
64
+	/**
65
+	 * @return string
66
+	 */
67
+	public function get()
68
+	{
69
+		$notices = array_map('unserialize',
70
+			array_unique(array_map('serialize', get_settings_errors(Application::ID)))
71
+		);
72
+		$notices = array_reduce($notices, function ($carry, $notice) {
73
+			return $carry.$this->buildNotice(json_decode($notice['message'], true));
74
+		});
75
+		return apply_filters('site-reviews/notices', $notices);
76
+	}
77 77
 
78
-    /**
79
-     * @return string
80
-     */
81
-    protected function buildNotice(array $args)
82
-    {
83
-        $messages = array_reduce($args['messages'], function ($carry, $message) {
84
-            return $carry.glsr(Builder::class)->p($message);
85
-        });
86
-        $class = 'notice notice-'.$args['type'];
87
-        if ($args['inline']) {
88
-            $class.= ' inline';
89
-        }
90
-        if ($args['dismissible']) {
91
-            $class.= ' is-dismissible';
92
-        }
93
-        return glsr(Builder::class)->div($messages, [
94
-            'class' => $class,
95
-        ]);
96
-    }
78
+	/**
79
+	 * @return string
80
+	 */
81
+	protected function buildNotice(array $args)
82
+	{
83
+		$messages = array_reduce($args['messages'], function ($carry, $message) {
84
+			return $carry.glsr(Builder::class)->p($message);
85
+		});
86
+		$class = 'notice notice-'.$args['type'];
87
+		if ($args['inline']) {
88
+			$class.= ' inline';
89
+		}
90
+		if ($args['dismissible']) {
91
+			$class.= ' is-dismissible';
92
+		}
93
+		return glsr(Builder::class)->div($messages, [
94
+			'class' => $class,
95
+		]);
96
+	}
97 97
 
98
-    /**
99
-     * @return array
100
-     */
101
-    protected function normalize(array $args)
102
-    {
103
-        $defaults = [
104
-            'dismissible' => true,
105
-            'inline' => true,
106
-            'message' => '',
107
-            'type' => '',
108
-        ];
109
-        $args = shortcode_atts($defaults, $args);
110
-        if (!in_array($args['type'], ['error', 'warning', 'success'])) {
111
-            $args['type'] = 'success';
112
-        }
113
-        $args['messages'] = is_wp_error($args['message'])
114
-            ? (array) $args['message']->get_error_message()
115
-            : (array) $args['message'];
116
-        unset($args['message']);
117
-        return $args;
118
-    }
98
+	/**
99
+	 * @return array
100
+	 */
101
+	protected function normalize(array $args)
102
+	{
103
+		$defaults = [
104
+			'dismissible' => true,
105
+			'inline' => true,
106
+			'message' => '',
107
+			'type' => '',
108
+		];
109
+		$args = shortcode_atts($defaults, $args);
110
+		if (!in_array($args['type'], ['error', 'warning', 'success'])) {
111
+			$args['type'] = 'success';
112
+		}
113
+		$args['messages'] = is_wp_error($args['message'])
114
+			? (array) $args['message']->get_error_message()
115
+			: (array) $args['message'];
116
+		unset($args['message']);
117
+		return $args;
118
+	}
119 119
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/Fields/Password.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -4,13 +4,13 @@
 block discarded – undo
4 4
 
5 5
 class Password extends Field
6 6
 {
7
-    /**
8
-     * @return array
9
-     */
10
-    public static function defaults()
11
-    {
12
-        return [
13
-            'class' => 'regular-text',
14
-        ];
15
-    }
7
+	/**
8
+	 * @return array
9
+	 */
10
+	public static function defaults()
11
+	{
12
+		return [
13
+			'class' => 'regular-text',
14
+		];
15
+	}
16 16
 }
Please login to merge, or discard this patch.
plugin/Defaults/SiteReviewsDefaults.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -6,33 +6,33 @@
 block discarded – undo
6 6
 
7 7
 class SiteReviewsDefaults extends Defaults
8 8
 {
9
-    /**
10
-     * @var array
11
-     */
12
-    protected $guarded = [
13
-        'fallback',
14
-        'title',
15
-    ];
9
+	/**
10
+	 * @var array
11
+	 */
12
+	protected $guarded = [
13
+		'fallback',
14
+		'title',
15
+	];
16 16
 
17
-    /**
18
-     * @return array
19
-     */
20
-    protected function defaults()
21
-    {
22
-        return [
23
-            'assigned_to' => '',
24
-            'category' => '',
25
-            'class' => '',
26
-            'count' => 5,
27
-            'fallback' => '',
28
-            'hide' => [],
29
-            'id' => '',
30
-            'offset' => '',
31
-            'pagination' => false,
32
-            'rating' => 0,
33
-            'schema' => false,
34
-            'title' => '',
35
-            'type' => 'local',
36
-        ];
37
-    }
17
+	/**
18
+	 * @return array
19
+	 */
20
+	protected function defaults()
21
+	{
22
+		return [
23
+			'assigned_to' => '',
24
+			'category' => '',
25
+			'class' => '',
26
+			'count' => 5,
27
+			'fallback' => '',
28
+			'hide' => [],
29
+			'id' => '',
30
+			'offset' => '',
31
+			'pagination' => false,
32
+			'rating' => 0,
33
+			'schema' => false,
34
+			'title' => '',
35
+			'type' => 'local',
36
+		];
37
+	}
38 38
 }
Please login to merge, or discard this patch.
plugin/Filters.php 1 patch
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -14,69 +14,69 @@
 block discarded – undo
14 14
 
15 15
 class Filters implements HooksContract
16 16
 {
17
-    protected $admin;
18
-    protected $app;
19
-    protected $basename;
20
-    protected $blocks;
21
-    protected $editor;
22
-    protected $listtable;
23
-    protected $public;
24
-    protected $rebusify;
25
-    protected $translator;
26
-    protected $welcome;
17
+	protected $admin;
18
+	protected $app;
19
+	protected $basename;
20
+	protected $blocks;
21
+	protected $editor;
22
+	protected $listtable;
23
+	protected $public;
24
+	protected $rebusify;
25
+	protected $translator;
26
+	protected $welcome;
27 27
 
28
-    public function __construct(Application $app)
29
-    {
30
-        $this->app = $app;
31
-        $this->admin = $app->make(AdminController::class);
32
-        $this->basename = plugin_basename($app->file);
33
-        $this->blocks = $app->make(BlocksController::class);
34
-        $this->editor = $app->make(EditorController::class);
35
-        $this->listtable = $app->make(ListTableController::class);
36
-        $this->public = $app->make(PublicController::class);
37
-        $this->rebusify = $app->make(RebusifyController::class);
38
-        $this->translator = $app->make(Translator::class);
39
-        $this->welcome = $app->make(WelcomeController::class);
40
-    }
28
+	public function __construct(Application $app)
29
+	{
30
+		$this->app = $app;
31
+		$this->admin = $app->make(AdminController::class);
32
+		$this->basename = plugin_basename($app->file);
33
+		$this->blocks = $app->make(BlocksController::class);
34
+		$this->editor = $app->make(EditorController::class);
35
+		$this->listtable = $app->make(ListTableController::class);
36
+		$this->public = $app->make(PublicController::class);
37
+		$this->rebusify = $app->make(RebusifyController::class);
38
+		$this->translator = $app->make(Translator::class);
39
+		$this->welcome = $app->make(WelcomeController::class);
40
+	}
41 41
 
42
-    /**
43
-     * @return void
44
-     */
45
-    public function run()
46
-    {
47
-        add_filter('map_meta_cap',                                              [$this->admin, 'filterCreateCapability'], 10, 2);
48
-        add_filter('mce_external_plugins',                                      [$this->admin, 'filterTinymcePlugins'], 15);
49
-        add_filter('plugin_action_links_'.$this->basename,                      [$this->admin, 'filterActionLinks']);
50
-        add_filter('dashboard_glance_items',                                    [$this->admin, 'filterDashboardGlanceItems']);
51
-        add_filter('block_categories',                                          [$this->blocks, 'filterBlockCategories']);
52
-        add_filter('classic_editor_enabled_editors_for_post_type',              [$this->blocks, 'filterEnabledEditors'], 10, 2);
53
-        add_filter('use_block_editor_for_post_type',                            [$this->blocks, 'filterUseBlockEditor'], 10, 2);
54
-        add_filter('wp_editor_settings',                                        [$this->editor, 'filterEditorSettings']);
55
-        add_filter('the_editor',                                                [$this->editor, 'filterEditorTextarea']);
56
-        add_filter('is_protected_meta',                                         [$this->editor, 'filterIsProtectedMeta'], 10, 3);
57
-        add_filter('gettext',                                                   [$this->editor, 'filterPostStatusLabels'], 10, 3);
58
-        add_filter('gettext_with_context',                                      [$this->editor, 'filterPostStatusLabelsWithContext'], 10, 4);
59
-        add_filter('post_updated_messages',                                     [$this->editor, 'filterUpdateMessages']);
60
-        add_filter('bulk_post_updated_messages',                                [$this->listtable, 'filterBulkUpdateMessages'], 10, 2);
61
-        add_filter('manage_'.Application::POST_TYPE.'_posts_columns',           [$this->listtable, 'filterColumnsForPostType']);
62
-        add_filter('post_date_column_status',                                   [$this->listtable, 'filterDateColumnStatus'], 10, 2);
63
-        add_filter('default_hidden_columns',                                    [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2);
64
-        add_filter('display_post_states',                                       [$this->listtable, 'filterPostStates'], 10, 2);
65
-        add_filter('post_row_actions',                                          [$this->listtable, 'filterRowActions'], 10, 2);
66
-        add_filter('manage_edit-'.Application::POST_TYPE.'_sortable_columns',   [$this->listtable, 'filterSortableColumns']);
67
-        add_filter('ngettext',                                                  [$this->listtable, 'filterStatusText'], 10, 5);
68
-        add_filter('script_loader_tag',                                         [$this->public, 'filterEnqueuedScripts'], 10, 2);
69
-        add_filter('site-reviews/config/forms/submission-form',                 [$this->public, 'filterFieldOrder'], 11);
70
-        add_filter('query_vars',                                                [$this->public, 'filterQueryVars']);
71
-        add_filter('site-reviews/render/view',                                  [$this->public, 'filterRenderView']);
72
-        add_filter('site-reviews/settings/callback',                            [$this->rebusify, 'filterSettingsCallback']);
73
-        add_filter('site-reviews/interpolate/partials/form/table-row-multiple', [$this->rebusify, 'filterSettingsTableRow'], 10, 3);
74
-        add_filter('gettext',                                                   [$this->translator, 'filterGettext'], 10, 3);
75
-        add_filter('gettext_with_context',                                      [$this->translator, 'filterGettextWithContext'], 10, 4);
76
-        add_filter('ngettext',                                                  [$this->translator, 'filterNgettext'], 10, 5);
77
-        add_filter('ngettext_with_context',                                     [$this->translator, 'filterNgettextWithContext'], 10, 6);
78
-        add_filter('plugin_action_links_'.$this->basename,                      [$this->welcome, 'filterActionLinks'], 9);
79
-        add_filter('admin_title',                                               [$this->welcome, 'filterAdminTitle']);
80
-        add_filter('admin_footer_text',                                         [$this->welcome, 'filterFooterText']);
81
-    }
42
+	/**
43
+	 * @return void
44
+	 */
45
+	public function run()
46
+	{
47
+		add_filter('map_meta_cap',                                              [$this->admin, 'filterCreateCapability'], 10, 2);
48
+		add_filter('mce_external_plugins',                                      [$this->admin, 'filterTinymcePlugins'], 15);
49
+		add_filter('plugin_action_links_'.$this->basename,                      [$this->admin, 'filterActionLinks']);
50
+		add_filter('dashboard_glance_items',                                    [$this->admin, 'filterDashboardGlanceItems']);
51
+		add_filter('block_categories',                                          [$this->blocks, 'filterBlockCategories']);
52
+		add_filter('classic_editor_enabled_editors_for_post_type',              [$this->blocks, 'filterEnabledEditors'], 10, 2);
53
+		add_filter('use_block_editor_for_post_type',                            [$this->blocks, 'filterUseBlockEditor'], 10, 2);
54
+		add_filter('wp_editor_settings',                                        [$this->editor, 'filterEditorSettings']);
55
+		add_filter('the_editor',                                                [$this->editor, 'filterEditorTextarea']);
56
+		add_filter('is_protected_meta',                                         [$this->editor, 'filterIsProtectedMeta'], 10, 3);
57
+		add_filter('gettext',                                                   [$this->editor, 'filterPostStatusLabels'], 10, 3);
58
+		add_filter('gettext_with_context',                                      [$this->editor, 'filterPostStatusLabelsWithContext'], 10, 4);
59
+		add_filter('post_updated_messages',                                     [$this->editor, 'filterUpdateMessages']);
60
+		add_filter('bulk_post_updated_messages',                                [$this->listtable, 'filterBulkUpdateMessages'], 10, 2);
61
+		add_filter('manage_'.Application::POST_TYPE.'_posts_columns',           [$this->listtable, 'filterColumnsForPostType']);
62
+		add_filter('post_date_column_status',                                   [$this->listtable, 'filterDateColumnStatus'], 10, 2);
63
+		add_filter('default_hidden_columns',                                    [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2);
64
+		add_filter('display_post_states',                                       [$this->listtable, 'filterPostStates'], 10, 2);
65
+		add_filter('post_row_actions',                                          [$this->listtable, 'filterRowActions'], 10, 2);
66
+		add_filter('manage_edit-'.Application::POST_TYPE.'_sortable_columns',   [$this->listtable, 'filterSortableColumns']);
67
+		add_filter('ngettext',                                                  [$this->listtable, 'filterStatusText'], 10, 5);
68
+		add_filter('script_loader_tag',                                         [$this->public, 'filterEnqueuedScripts'], 10, 2);
69
+		add_filter('site-reviews/config/forms/submission-form',                 [$this->public, 'filterFieldOrder'], 11);
70
+		add_filter('query_vars',                                                [$this->public, 'filterQueryVars']);
71
+		add_filter('site-reviews/render/view',                                  [$this->public, 'filterRenderView']);
72
+		add_filter('site-reviews/settings/callback',                            [$this->rebusify, 'filterSettingsCallback']);
73
+		add_filter('site-reviews/interpolate/partials/form/table-row-multiple', [$this->rebusify, 'filterSettingsTableRow'], 10, 3);
74
+		add_filter('gettext',                                                   [$this->translator, 'filterGettext'], 10, 3);
75
+		add_filter('gettext_with_context',                                      [$this->translator, 'filterGettextWithContext'], 10, 4);
76
+		add_filter('ngettext',                                                  [$this->translator, 'filterNgettext'], 10, 5);
77
+		add_filter('ngettext_with_context',                                     [$this->translator, 'filterNgettextWithContext'], 10, 6);
78
+		add_filter('plugin_action_links_'.$this->basename,                      [$this->welcome, 'filterActionLinks'], 9);
79
+		add_filter('admin_title',                                               [$this->welcome, 'filterAdminTitle']);
80
+		add_filter('admin_footer_text',                                         [$this->welcome, 'filterFooterText']);
81
+	}
82 82
 }
Please login to merge, or discard this patch.
plugin/Reviews.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -9,65 +9,65 @@
 block discarded – undo
9 9
 
10 10
 class Reviews extends ArrayObject
11 11
 {
12
-    /**
13
-     * @var array
14
-     */
15
-    public $args;
12
+	/**
13
+	 * @var array
14
+	 */
15
+	public $args;
16 16
 
17
-    /**
18
-     * @var int
19
-     */
20
-    public $max_num_pages;
17
+	/**
18
+	 * @var int
19
+	 */
20
+	public $max_num_pages;
21 21
 
22
-    /**
23
-     * @var array
24
-     */
25
-    public $reviews;
22
+	/**
23
+	 * @var array
24
+	 */
25
+	public $reviews;
26 26
 
27
-    public function __construct(array $reviews, $maxPageCount, array $args)
28
-    {
29
-        $this->args = $args;
30
-        $this->max_num_pages = $maxPageCount;
31
-        $this->reviews = $reviews;
32
-        parent::__construct($reviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS);
33
-    }
27
+	public function __construct(array $reviews, $maxPageCount, array $args)
28
+	{
29
+		$this->args = $args;
30
+		$this->max_num_pages = $maxPageCount;
31
+		$this->reviews = $reviews;
32
+		parent::__construct($reviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS);
33
+	}
34 34
 
35
-    /**
36
-     * @return string
37
-     */
38
-    public function __toString()
39
-    {
40
-        return (string) $this->build();
41
-    }
35
+	/**
36
+	 * @return string
37
+	 */
38
+	public function __toString()
39
+	{
40
+		return (string) $this->build();
41
+	}
42 42
 
43
-    /**
44
-     * @return ReviewsHtml
45
-     */
46
-    public function build()
47
-    {
48
-        $args = glsr(SiteReviewsDefaults::class)->merge($this->args);
49
-        return glsr(SiteReviewsPartial::class)->build($args, $this);
50
-    }
43
+	/**
44
+	 * @return ReviewsHtml
45
+	 */
46
+	public function build()
47
+	{
48
+		$args = glsr(SiteReviewsDefaults::class)->merge($this->args);
49
+		return glsr(SiteReviewsPartial::class)->build($args, $this);
50
+	}
51 51
 
52
-    /**
53
-     * @param mixed $key
54
-     * @return mixed
55
-     */
56
-    public function offsetGet($key)
57
-    {
58
-        if (property_exists($this, $key)) {
59
-            return $this->$key;
60
-        }
61
-        return array_key_exists($key, $this->reviews)
62
-            ? $this->reviews[$key]
63
-            : null;
64
-    }
52
+	/**
53
+	 * @param mixed $key
54
+	 * @return mixed
55
+	 */
56
+	public function offsetGet($key)
57
+	{
58
+		if (property_exists($this, $key)) {
59
+			return $this->$key;
60
+		}
61
+		return array_key_exists($key, $this->reviews)
62
+			? $this->reviews[$key]
63
+			: null;
64
+	}
65 65
 
66
-    /**
67
-     * @return void
68
-     */
69
-    public function render()
70
-    {
71
-        echo $this->build();
72
-    }
66
+	/**
67
+	 * @return void
68
+	 */
69
+	public function render()
70
+	{
71
+		echo $this->build();
72
+	}
73 73
 }
Please login to merge, or discard this patch.