Passed
Push — master ( ff717e...ba0f3b )
by Paul
08:41 queued 04:33
created
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.
config/settings.php 1 patch
Indentation   +548 added lines, -548 removed lines patch added patch discarded remove patch
@@ -1,552 +1,552 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 return [
4
-    'settings.general.style' => [
5
-        'default' => 'default',
6
-        'description' => __('Site Reviews relies on the CSS of your theme to style the submission form. If your theme does not provide proper CSS rules for form elements and you are using a WordPress plugin/theme or CSS Framework listed here, please try selecting it, otherwise choose "Site Reviews (default)".', 'site-reviews'),
7
-        'label' => __('Plugin Style', 'site-reviews'),
8
-        'options' => [
9
-            'bootstrap_4' => 'CSS Framework: Bootstrap 4',
10
-            'bootstrap_4_custom' => 'CSS Framework: Bootstrap 4 (Custom Forms)',
11
-            'contact_form_7' => 'Plugin: Contact Form 7 (v5)',
12
-            'ninja_forms' => 'Plugin: Ninja Forms (v3)',
13
-            'wpforms' => 'Plugin: WPForms Lite (v1)',
14
-            'default' => __('Site Reviews (default)', 'site-reviews'),
15
-            'minimal' => __('Site Reviews (minimal)', 'site-reviews'),
16
-            'divi' => 'Theme: Divi (v3)',
17
-            'materialize' => 'Theme: Materialize',
18
-            'twentyfifteen' => 'Theme: Twenty Fifteen',
19
-            'twentyseventeen' => 'Theme: Twenty Seventeen',
20
-            'twentynineteen' => 'Theme: Twenty Nineteen',
21
-        ],
22
-        'type' => 'select',
23
-    ],
24
-    'settings.general.require.approval' => [
25
-        'default' => 'no',
26
-        'description' => __('Set the status of new review submissions to "unapproved".', 'site-reviews'),
27
-        'label' => __('Require Approval', 'site-reviews'),
28
-        'type' => 'yes_no',
29
-    ],
30
-    'settings.general.require.login' => [
31
-        'default' => 'no',
32
-        'description' => __('Only allow review submissions from registered users.', 'site-reviews'),
33
-        'label' => __('Require Login', 'site-reviews'),
34
-        'type' => 'yes_no',
35
-    ],
36
-    'settings.general.require.login_register' => [
37
-        'default' => 'no',
38
-        'depends_on' => [
39
-            'settings.general.require.login' => 'yes',
40
-        ],
41
-        'description' => sprintf(__('Show a link for a new user to register. The %s Membership option must be enabled in General Settings for this to work.', 'site-reviews'),
42
-            '<a href="'.admin_url('options-general.php#users_can_register').'">'.__('Anyone can register', 'site-reviews').'</a>'
43
-        ),
44
-        'label' => __('Show Registration Link', 'site-reviews'),
45
-        'type' => 'yes_no',
46
-    ],
47
-    'settings.general.multilingual' => [
48
-        'default' => '',
49
-        'description' => __('Integrate with a multilingual plugin to calculate ratings for all languages of a post.', 'site-reviews'),
50
-        'label' => __('Multilingual', 'site-reviews'),
51
-        'options' => [
52
-            '' => __('No Integration', 'site-reviews'),
53
-            'polylang' => __('Integrate with Polylang', 'site-reviews'),
54
-            'wpml' => __('Integrate with WPML', 'site-reviews'),
55
-        ],
56
-        'type' => 'select',
57
-    ],
58
-    'settings.general.rebusify' => [
59
-        'default' => 'no',
60
-        'description' => sprintf(__('Integrate with the %s and validate your reviews on the blockchain to increase online reputation, trust, and transparency.', 'site-reviews'),
61
-            '<a href="https://rebusify.com/plans?ref=105" target="_blank">Rebusify Confidence System</a>'
62
-        ),
63
-        'label' => __('Blockchain Validation', 'site-reviews'),
64
-        'type' => 'yes_no',
65
-    ],
66
-    'settings.general.rebusify_email' => [
67
-        'default' => '',
68
-        'depends_on' => [
69
-            'settings.general.rebusify' => ['yes'],
70
-        ],
71
-        'description' => __('Enter your Rebusify account email here.', 'site-reviews'),
72
-        'label' => __('Rebusify Email', 'site-reviews'),
73
-        'type' => 'email',
74
-    ],
75
-    'settings.general.rebusify_serial' => [
76
-        'default' => '',
77
-        'depends_on' => [
78
-            'settings.general.rebusify' => ['yes'],
79
-        ],
80
-        'description' => __('Enter your Rebusify account serial key here.', 'site-reviews'),
81
-        'label' => __('Rebusify Serial Key', 'site-reviews'),
82
-        'type' => 'password',
83
-    ],
84
-    'settings.general.notifications' => [
85
-        'default' => [],
86
-        'label' => __('Notifications', 'site-reviews'),
87
-        'options' => [
88
-            'admin' => __('Send to administrator', 'site-reviews').' <code>'.(string) get_option('admin_email').'</code>',
89
-            'author' => __('Send to author of the page that the review is assigned to', 'site-reviews'),
90
-            'custom' => __('Send to one or more email addresses', 'site-reviews'),
91
-            'slack' => __('Send to <a href="https://slack.com/">Slack</a>', 'site-reviews'),
92
-        ],
93
-        'type' => 'checkbox',
94
-    ],
95
-    'settings.general.notification_email' => [
96
-        'default' => '',
97
-        'depends_on' => [
98
-            'settings.general.notifications' => ['custom'],
99
-        ],
100
-        'label' => __('Send Notification Emails To', 'site-reviews'),
101
-        'placeholder' => __('Separate multiple emails with a comma', 'site-reviews'),
102
-        'type' => 'text',
103
-    ],
104
-    'settings.general.notification_slack' => [
105
-        'default' => '',
106
-        'depends_on' => [
107
-            'settings.general.notifications' => ['slack'],
108
-        ],
109
-        'description' => sprintf(__('To send notifications to Slack, create a new %s and then paste the provided Webhook URL in the field above.', 'site-reviews'),
110
-            '<a href="https://api.slack.com/incoming-webhooks">'.__('Incoming WebHook', 'site-reviews').'</a>'
111
-        ),
112
-        'label' => __('Slack Webhook URL', 'site-reviews'),
113
-        'type' => 'text',
114
-    ],
115
-    'settings.general.notification_message' => [
116
-        'default' => glsr('Modules\Html\Template')->build('templates/email-notification'),
117
-        'depends_on' => [
118
-            'settings.general.notifications' => ['admin', 'author', 'custom', 'slack'],
119
-        ],
120
-        'description' => __(
121
-            'To restore the default text, save an empty template. '.
122
-            'If you are sending notifications to Slack then this template will only be used as a fallback in the event that <a href="https://api.slack.com/docs/attachments">Message Attachments</a> have been disabled. Available template tags:'.
123
-            '<br><code>{review_rating}</code> The review rating number (1-5)'.
124
-            '<br><code>{review_title}</code> The review title'.
125
-            '<br><code>{review_content}</code> The review content'.
126
-            '<br><code>{review_author}</code> The review author'.
127
-            '<br><code>{review_email}</code> The email of the review author'.
128
-            '<br><code>{review_ip}</code> The IP address of the review author'.
129
-            '<br><code>{review_link}</code> The link to edit/view a review',
130
-            'site-reviews'
131
-        ),
132
-        'label' => __('Notification Template', 'site-reviews'),
133
-        'rows' => 10,
134
-        'type' => 'code',
135
-    ],
136
-    'settings.reviews.date.format' => [
137
-        'default' => '',
138
-        'description' => sprintf(__('The default date format is the one set in your %s.', 'site-reviews'),
139
-            '<a href="'.admin_url('options-general.php#date_format_custom').'">'.__('WordPress settings', 'site-reviews').'</a>'
140
-        ),
141
-        'label' => __('Date Format', 'site-reviews'),
142
-        'options' => [
143
-            '' => __('Use the default date format', 'site-reviews'),
144
-            'relative' => __('Use a relative date format', 'site-reviews'),
145
-            'custom' => __('Use a custom date format', 'site-reviews'),
146
-        ],
147
-        'type' => 'select',
148
-    ],
149
-    'settings.reviews.date.custom' => [
150
-        'default' => get_option('date_format'),
151
-        'depends_on' => [
152
-            'settings.reviews.date.format' => 'custom',
153
-        ],
154
-        'description' => __('Enter a custom date format (<a href="https://codex.wordpress.org/Formatting_Date_and_Time">documentation on date and time formatting</a>).', 'site-reviews'),
155
-        'label' => __('Custom Date Format', 'site-reviews'),
156
-        'type' => 'text',
157
-    ],
158
-    'settings.reviews.name.format' => [
159
-        'default' => '',
160
-        'description' => __('Choose how names are shown in your reviews.', 'site-reviews'),
161
-        'label' => __('Name Format', 'site-reviews'),
162
-        'options' => [
163
-            '' => __('Use the name as given', 'site-reviews'),
164
-            'first' => __('Use the first name only', 'site-reviews'),
165
-            'first_initial' => __('Convert first name to an initial', 'site-reviews'),
166
-            'last_initial' => __('Convert last name to an initial', 'site-reviews'),
167
-            'initials' => __('Convert to all initials', 'site-reviews'),
168
-        ],
169
-        'type' => 'select',
170
-    ],
171
-    'settings.reviews.name.initial' => [
172
-        'default' => '',
173
-        'depends_on' => [
174
-            'settings.reviews.name.format' => ['first_initial', 'last_initial', 'initials'],
175
-        ],
176
-        'description' => __('Choose how the initial is displayed.', 'site-reviews'),
177
-        'label' => __('Initial Format', 'site-reviews'),
178
-        'options' => [
179
-            '' => __('Initial with a space', 'site-reviews'),
180
-            'period' => __('Initial with a period', 'site-reviews'),
181
-            'period_space' => __('Initial with a period and a space', 'site-reviews'),
182
-        ],
183
-        'type' => 'select',
184
-    ],
185
-    'settings.reviews.assigned_links' => [
186
-        'default' => 'no',
187
-        'description' => __('Display a link to the assigned post of a review.', 'site-reviews'),
188
-        'label' => __('Enable Assigned Links', 'site-reviews'),
189
-        'type' => 'yes_no',
190
-    ],
191
-    'settings.reviews.avatars' => [
192
-        'default' => 'no',
193
-        'description' => __('Display reviewer avatars. These are generated from the email address of the reviewer using <a href="https://gravatar.com">Gravatar</a>.', 'site-reviews'),
194
-        'label' => __('Enable Avatars', 'site-reviews'),
195
-        'type' => 'yes_no',
196
-    ],
197
-    'settings.reviews.avatars_regenerate' => [
198
-        'default' => 'no',
199
-        'depends_on' => [
200
-            'settings.reviews.avatars' => 'yes',
201
-        ],
202
-        'description' => __('Regenerate the avatar whenever a local review is shown?', 'site-reviews'),
203
-        'label' => __('Regenerate Avatars', 'site-reviews'),
204
-        'type' => 'yes_no',
205
-    ],
206
-    'settings.reviews.avatars_size' => [
207
-        'default' => 40,
208
-        'depends_on' => [
209
-            'settings.reviews.avatars' => 'yes',
210
-        ],
211
-        'description' => __('Set the avatar size in pixels.', 'site-reviews'),
212
-        'label' => __('Avatar Size', 'site-reviews'),
213
-        'type' => 'number',
214
-    ],
215
-    'settings.reviews.excerpts' => [
216
-        'default' => 'yes',
217
-        'description' => __('Display an excerpt instead of the full review.', 'site-reviews'),
218
-        'label' => __('Enable Excerpts', 'site-reviews'),
219
-        'type' => 'yes_no',
220
-    ],
221
-    'settings.reviews.excerpts_length' => [
222
-        'default' => 55,
223
-        'depends_on' => [
224
-            'settings.reviews.excerpts' => 'yes',
225
-        ],
226
-        'description' => __('Set the excerpt word length.', 'site-reviews'),
227
-        'label' => __('Excerpt Length', 'site-reviews'),
228
-        'type' => 'number',
229
-    ],
230
-    'settings.reviews.fallback' => [
231
-        'default' => 'yes',
232
-        'description' => sprintf(__('Display the fallback text when there are no reviews to display. This can be changed on the %s page. You may also override this by using the "fallback" option on the shortcode. The default fallback text is: %s', 'site-reviews'),
233
-            '<a href="'.admin_url('edit.php?post_type=site-review&page=settings#!translations').'">'.__('Translations', 'site-reviews').'</a>',
234
-            '<code>'.__('There are no reviews yet. Be the first one to write one.', 'site-reviews').'</code>'
235
-        ),
236
-        'label' => __('Enable Fallback Text', 'site-reviews'),
237
-        'type' => 'yes_no',
238
-    ],
239
-    'settings.schema.type.default' => [
240
-        'default' => 'LocalBusiness',
241
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_type</code>',
242
-        'label' => __('Default Schema Type', 'site-reviews'),
243
-        'options' => [
244
-            'LocalBusiness' => __('Local Business', 'site-reviews'),
245
-            'Product' => __('Product', 'site-reviews'),
246
-            'custom' => __('Custom', 'site-reviews'),
247
-        ],
248
-        'type' => 'select',
249
-    ],
250
-    'settings.schema.type.custom' => [
251
-        'default' => '',
252
-        'depends_on' => [
253
-            'settings.schema.type.default' => 'custom',
254
-        ],
255
-        'description' => '<a href="https://schema.org/docs/schemas.html">'.__('View more information on schema types here', 'site-reviews').'</a>',
256
-        'label' => __('Custom Schema Type', 'site-reviews'),
257
-        'type' => 'text',
258
-    ],
259
-    'settings.schema.name.default' => [
260
-        'default' => 'post',
261
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_name</code>',
262
-        'label' => __('Default Name', 'site-reviews'),
263
-        'options' => [
264
-            'post' => __('Use the assigned or current page title', 'site-reviews'),
265
-            'custom' => __('Enter a custom title', 'site-reviews'),
266
-        ],
267
-        'type' => 'select',
268
-    ],
269
-    'settings.schema.name.custom' => [
270
-        'default' => '',
271
-        'depends_on' => [
272
-            'settings.schema.name.default' => 'custom',
273
-        ],
274
-        'label' => __('Custom Name', 'site-reviews'),
275
-        'type' => 'text',
276
-    ],
277
-    'settings.schema.description.default' => [
278
-        'default' => 'post',
279
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_description</code>',
280
-        'label' => __('Default Description', 'site-reviews'),
281
-        'options' => [
282
-            'post' => __('Use the assigned or current page excerpt', 'site-reviews'),
283
-            'custom' => __('Enter a custom description', 'site-reviews'),
284
-        ],
285
-        'type' => 'select',
286
-    ],
287
-    'settings.schema.description.custom' => [
288
-        'default' => '',
289
-        'depends_on' => [
290
-            'settings.schema.description.default' => 'custom',
291
-        ],
292
-        'label' => __('Custom Description', 'site-reviews'),
293
-        'type' => 'text',
294
-    ],
295
-    'settings.schema.url.default' => [
296
-        'default' => 'post',
297
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_url</code>',
298
-        'label' => __('Default URL', 'site-reviews'),
299
-        'options' => [
300
-            'post' => __('Use the assigned or current page URL', 'site-reviews'),
301
-            'custom' => __('Enter a custom URL', 'site-reviews'),
302
-        ],
303
-        'type' => 'select',
304
-    ],
305
-    'settings.schema.url.custom' => [
306
-        'default' => '',
307
-        'depends_on' => [
308
-            'settings.schema.url.default' => 'custom',
309
-        ],
310
-        'label' => __('Custom URL', 'site-reviews'),
311
-        'type' => 'text',
312
-    ],
313
-    'settings.schema.image.default' => [
314
-        'default' => 'post',
315
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_image</code>',
316
-        'label' => __('Default Image', 'site-reviews'),
317
-        'options' => [
318
-            'post' => __('Use the featured image of the assigned or current page', 'site-reviews'),
319
-            'custom' => __('Enter a custom image URL', 'site-reviews'),
320
-        ],
321
-        'type' => 'select',
322
-    ],
323
-    'settings.schema.image.custom' => [
324
-        'default' => '',
325
-        'depends_on' => [
326
-            'settings.schema.image.default' => 'custom',
327
-        ],
328
-        'label' => __('Custom Image URL', 'site-reviews'),
329
-        'type' => 'text',
330
-    ],
331
-    'settings.schema.address' => [
332
-        'default' => '',
333
-        'depends_on' => [
334
-            'settings.schema.type.default' => 'LocalBusiness',
335
-        ],
336
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_address</code>',
337
-        'label' => __('Address', 'site-reviews'),
338
-        'placeholder' => '60 29th Street #343, San Francisco, CA 94110, US',
339
-        'type' => 'text',
340
-    ],
341
-    'settings.schema.telephone' => [
342
-        'default' => '',
343
-        'depends_on' => [
344
-            'settings.schema.type.default' => 'LocalBusiness',
345
-        ],
346
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_telephone</code>',
347
-        'label' => __('Telephone Number', 'site-reviews'),
348
-        'placeholder' => '+1 (877) 273-3049',
349
-        'type' => 'text',
350
-    ],
351
-    'settings.schema.pricerange' => [
352
-        'default' => '',
353
-        'depends_on' => [
354
-            'settings.schema.type.default' => 'LocalBusiness',
355
-        ],
356
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_pricerange</code>',
357
-        'label' => __('Price Range', 'site-reviews'),
358
-        'placeholder' => '$$-$$$',
359
-        'type' => 'text',
360
-    ],
361
-    'settings.schema.offertype' => [
362
-        'default' => 'AggregateOffer',
363
-        'depends_on' => [
364
-            'settings.schema.type.default' => 'Product',
365
-        ],
366
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_offertype</code>',
367
-        'label' => __('Offer Type', 'site-reviews'),
368
-        'options' => [
369
-            'AggregateOffer' => __('AggregateOffer', 'site-reviews'),
370
-            'Offer' => __('Offer', 'site-reviews'),
371
-        ],
372
-        'type' => 'select',
373
-    ],
374
-    'settings.schema.price' => [
375
-        'default' => '',
376
-        'depends_on' => [
377
-            'settings.schema.type.default' => 'Product',
378
-            'settings.schema.offertype' => 'Offer',
379
-        ],
380
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_price</code>',
381
-        'label' => __('Price', 'site-reviews'),
382
-        'placeholder' => '50.00',
383
-        'type' => 'text',
384
-    ],
385
-    'settings.schema.lowprice' => [
386
-        'default' => '',
387
-        'depends_on' => [
388
-            'settings.schema.type.default' => 'Product',
389
-            'settings.schema.offertype' => 'AggregateOffer',
390
-        ],
391
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_lowprice</code>',
392
-        'label' => __('Low Price', 'site-reviews'),
393
-        'placeholder' => '10.00',
394
-        'type' => 'text',
395
-    ],
396
-    'settings.schema.highprice' => [
397
-        'default' => '',
398
-        'depends_on' => [
399
-            'settings.schema.type.default' => 'Product',
400
-            'settings.schema.offertype' => 'AggregateOffer',
401
-        ],
402
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_highprice</code>',
403
-        'label' => __('High Price', 'site-reviews'),
404
-        'placeholder' => '100.00',
405
-        'type' => 'text',
406
-    ],
407
-    'settings.schema.pricecurrency' => [
408
-        'default' => '',
409
-        'depends_on' => [
410
-            'settings.schema.type.default' => 'Product',
411
-        ],
412
-        'description' => __('Custom Field name', 'site-reviews').': <code>schema_pricecurrency</code>',
413
-        'label' => __('Price Currency', 'site-reviews'),
414
-        'placeholder' => 'USD',
415
-        'type' => 'text',
416
-    ],
417
-    'settings.submissions.required' => [
418
-        'default' => ['content', 'email', 'name', 'rating', 'terms', 'title'],
419
-        'description' => __('Choose which fields should be required in the submission form.', 'site-reviews'),
420
-        'label' => __('Required Fields', 'site-reviews'),
421
-        'options' => [
422
-            'rating' => __('Rating', 'site-reviews'),
423
-            'title' => __('Title', 'site-reviews'),
424
-            'content' => __('Review', 'site-reviews'),
425
-            'name' => __('Name', 'site-reviews'),
426
-            'email' => __('Email', 'site-reviews'),
427
-            'terms' => __('Terms', 'site-reviews'),
428
-        ],
429
-        'type' => 'checkbox',
430
-    ],
431
-    'settings.submissions.limit' => [
432
-        'default' => '',
433
-        'description' => __('Limits the number of reviews that can be submitted to one-per-person. If you are assigning reviews, then the limit will be applied to the assigned page or category.', 'site-reviews'),
434
-        'label' => __('Limit Reviews', 'site-reviews'),
435
-        'options' => [
436
-            '' => __('No Limit', 'site-reviews'),
437
-            'email' => __('By Email Address', 'site-reviews'),
438
-            'ip_address' => __('By IP Address', 'site-reviews'),
439
-            'username' => __('By Username (will only work for registered users)', 'site-reviews'),
440
-        ],
441
-        'type' => 'select',
442
-    ],
443
-    'settings.submissions.limit_whitelist.email' => [
444
-        'default' => '',
445
-        'depends_on' => [
446
-            'settings.submissions.limit' => ['email'],
447
-        ],
448
-        'description' => __('One Email per line. All emails in the whitelist will be excluded from the review submission limit.', 'site-reviews'),
449
-        'label' => __('Email Whitelist', 'site-reviews'),
450
-        'rows' => 5,
451
-        'type' => 'code',
452
-    ],
453
-    'settings.submissions.limit_whitelist.ip_address' => [
454
-        'default' => '',
455
-        'depends_on' => [
456
-            'settings.submissions.limit' => ['ip_address'],
457
-        ],
458
-        'description' => __('One IP Address per line. All IP Addresses in the whitelist will be excluded from the review submission limit..', 'site-reviews'),
459
-        'label' => __('IP Address Whitelist', 'site-reviews'),
460
-        'rows' => 5,
461
-        'type' => 'code',
462
-    ],
463
-    'settings.submissions.limit_whitelist.username' => [
464
-        'default' => '',
465
-        'depends_on' => [
466
-            'settings.submissions.limit' => ['username'],
467
-        ],
468
-        'description' => __('One Username per line. All registered users with a Username in the whitelist will be excluded from the review submission limit.', 'site-reviews'),
469
-        'label' => __('Username Whitelist', 'site-reviews'),
470
-        'rows' => 5,
471
-        'type' => 'code',
472
-    ],
473
-    'settings.submissions.recaptcha.integration' => [
474
-        'default' => '',
475
-        'description' => __('Invisible reCAPTCHA is a free anti-spam service from Google. To use it, you will need to <a href="https://www.google.com/recaptcha/admin" target="_blank">sign up</a> for an API key pair for your site.', 'site-reviews'),
476
-        'label' => __('Invisible reCAPTCHA', 'site-reviews'),
477
-        'options' => [
478
-            '' => 'Do not use reCAPTCHA',
479
-            'all' => 'Use reCAPTCHA',
480
-            'guest' => 'Use reCAPTCHA only for guest users',
481
-        ],
482
-        'type' => 'select',
483
-    ],
484
-    'settings.submissions.recaptcha.key' => [
485
-        'default' => '',
486
-        'depends_on' => [
487
-            'settings.submissions.recaptcha.integration' => ['all', 'guest'],
488
-        ],
489
-        'label' => __('Site Key', 'site-reviews'),
490
-        'type' => 'text',
491
-    ],
492
-    'settings.submissions.recaptcha.secret' => [
493
-        'default' => '',
494
-        'depends_on' => [
495
-            'settings.submissions.recaptcha.integration' => ['all', 'guest'],
496
-        ],
497
-        'label' => __('Site Secret', 'site-reviews'),
498
-        'type' => 'text',
499
-    ],
500
-    'settings.submissions.recaptcha.position' => [
501
-        'default' => 'bottomleft',
502
-        'depends_on' => [
503
-            'settings.submissions.recaptcha.integration' => ['all', 'guest'],
504
-        ],
505
-        'description' => __('This option may not work consistently if another plugin is loading reCAPTCHA on the same page as Site Reviews.', 'site-reviews'),
506
-        'label' => __('Badge Position', 'site-reviews'),
507
-        'options' => [
508
-            'bottomleft' => 'Bottom Left',
509
-            'bottomright' => 'Bottom Right',
510
-            'inline' => 'Inline',
511
-        ],
512
-        'type' => 'select',
513
-    ],
514
-    'settings.submissions.akismet' => [
515
-        'default' => 'no',
516
-        'description' => __('The <a href="https://akismet.com" target="_blank">Akismet plugin</a> integration provides spam-filtering for your reviews. In order for this setting to have any affect, you will need to first install and activate the Akismet plugin and set up a WordPress.com API key.', 'site-reviews'),
517
-        'label' => __('Enable Akismet Integration', 'site-reviews'),
518
-        'type' => 'yes_no',
519
-    ],
520
-    'settings.submissions.blacklist.integration' => [
521
-        'default' => '',
522
-        'description' => sprintf(__('Choose which Blacklist you would prefer to use for reviews. The %s can be found in the WordPress Discussion Settings page.', 'site-reviews'),
523
-            '<a href="'.admin_url('options-discussion.php#users_can_register').'">'.__('Comment Blacklist', 'site-reviews').'</a>'
524
-        ),
525
-        'label' => __('Blacklist', 'site-reviews'),
526
-        'options' => [
527
-            '' => 'Use the Site Reviews Blacklist',
528
-            'comments' => 'Use the WordPress Comment Blacklist',
529
-        ],
530
-        'type' => 'select',
531
-    ],
532
-    'settings.submissions.blacklist.entries' => [
533
-        'default' => '',
534
-        'depends_on' => [
535
-            'settings.submissions.blacklist.integration' => [''],
536
-        ],
537
-        'description' => __('One entry or IP address per line. When a review contains any of these entries in its title, content, name, email, or IP address, it will be rejected. It is case-insensitive and will match partial words, so "press" will match "WordPress".', 'site-reviews'),
538
-        'label' => __('Review Blacklist', 'site-reviews'),
539
-        'rows' => 10,
540
-        'type' => 'code',
541
-    ],
542
-    'settings.submissions.blacklist.action' => [
543
-        'default' => 'unapprove',
544
-        'description' => __('Choose the action that should be taken when a review is blacklisted.', 'site-reviews'),
545
-        'label' => __('Blacklist Action', 'site-reviews'),
546
-        'options' => [
547
-            'unapprove' => __('Require approval', 'site-reviews'),
548
-            'reject' => __('Reject submission', 'site-reviews'),
549
-        ],
550
-        'type' => 'select',
551
-    ],
4
+	'settings.general.style' => [
5
+		'default' => 'default',
6
+		'description' => __('Site Reviews relies on the CSS of your theme to style the submission form. If your theme does not provide proper CSS rules for form elements and you are using a WordPress plugin/theme or CSS Framework listed here, please try selecting it, otherwise choose "Site Reviews (default)".', 'site-reviews'),
7
+		'label' => __('Plugin Style', 'site-reviews'),
8
+		'options' => [
9
+			'bootstrap_4' => 'CSS Framework: Bootstrap 4',
10
+			'bootstrap_4_custom' => 'CSS Framework: Bootstrap 4 (Custom Forms)',
11
+			'contact_form_7' => 'Plugin: Contact Form 7 (v5)',
12
+			'ninja_forms' => 'Plugin: Ninja Forms (v3)',
13
+			'wpforms' => 'Plugin: WPForms Lite (v1)',
14
+			'default' => __('Site Reviews (default)', 'site-reviews'),
15
+			'minimal' => __('Site Reviews (minimal)', 'site-reviews'),
16
+			'divi' => 'Theme: Divi (v3)',
17
+			'materialize' => 'Theme: Materialize',
18
+			'twentyfifteen' => 'Theme: Twenty Fifteen',
19
+			'twentyseventeen' => 'Theme: Twenty Seventeen',
20
+			'twentynineteen' => 'Theme: Twenty Nineteen',
21
+		],
22
+		'type' => 'select',
23
+	],
24
+	'settings.general.require.approval' => [
25
+		'default' => 'no',
26
+		'description' => __('Set the status of new review submissions to "unapproved".', 'site-reviews'),
27
+		'label' => __('Require Approval', 'site-reviews'),
28
+		'type' => 'yes_no',
29
+	],
30
+	'settings.general.require.login' => [
31
+		'default' => 'no',
32
+		'description' => __('Only allow review submissions from registered users.', 'site-reviews'),
33
+		'label' => __('Require Login', 'site-reviews'),
34
+		'type' => 'yes_no',
35
+	],
36
+	'settings.general.require.login_register' => [
37
+		'default' => 'no',
38
+		'depends_on' => [
39
+			'settings.general.require.login' => 'yes',
40
+		],
41
+		'description' => sprintf(__('Show a link for a new user to register. The %s Membership option must be enabled in General Settings for this to work.', 'site-reviews'),
42
+			'<a href="'.admin_url('options-general.php#users_can_register').'">'.__('Anyone can register', 'site-reviews').'</a>'
43
+		),
44
+		'label' => __('Show Registration Link', 'site-reviews'),
45
+		'type' => 'yes_no',
46
+	],
47
+	'settings.general.multilingual' => [
48
+		'default' => '',
49
+		'description' => __('Integrate with a multilingual plugin to calculate ratings for all languages of a post.', 'site-reviews'),
50
+		'label' => __('Multilingual', 'site-reviews'),
51
+		'options' => [
52
+			'' => __('No Integration', 'site-reviews'),
53
+			'polylang' => __('Integrate with Polylang', 'site-reviews'),
54
+			'wpml' => __('Integrate with WPML', 'site-reviews'),
55
+		],
56
+		'type' => 'select',
57
+	],
58
+	'settings.general.rebusify' => [
59
+		'default' => 'no',
60
+		'description' => sprintf(__('Integrate with the %s and validate your reviews on the blockchain to increase online reputation, trust, and transparency.', 'site-reviews'),
61
+			'<a href="https://rebusify.com/plans?ref=105" target="_blank">Rebusify Confidence System</a>'
62
+		),
63
+		'label' => __('Blockchain Validation', 'site-reviews'),
64
+		'type' => 'yes_no',
65
+	],
66
+	'settings.general.rebusify_email' => [
67
+		'default' => '',
68
+		'depends_on' => [
69
+			'settings.general.rebusify' => ['yes'],
70
+		],
71
+		'description' => __('Enter your Rebusify account email here.', 'site-reviews'),
72
+		'label' => __('Rebusify Email', 'site-reviews'),
73
+		'type' => 'email',
74
+	],
75
+	'settings.general.rebusify_serial' => [
76
+		'default' => '',
77
+		'depends_on' => [
78
+			'settings.general.rebusify' => ['yes'],
79
+		],
80
+		'description' => __('Enter your Rebusify account serial key here.', 'site-reviews'),
81
+		'label' => __('Rebusify Serial Key', 'site-reviews'),
82
+		'type' => 'password',
83
+	],
84
+	'settings.general.notifications' => [
85
+		'default' => [],
86
+		'label' => __('Notifications', 'site-reviews'),
87
+		'options' => [
88
+			'admin' => __('Send to administrator', 'site-reviews').' <code>'.(string) get_option('admin_email').'</code>',
89
+			'author' => __('Send to author of the page that the review is assigned to', 'site-reviews'),
90
+			'custom' => __('Send to one or more email addresses', 'site-reviews'),
91
+			'slack' => __('Send to <a href="https://slack.com/">Slack</a>', 'site-reviews'),
92
+		],
93
+		'type' => 'checkbox',
94
+	],
95
+	'settings.general.notification_email' => [
96
+		'default' => '',
97
+		'depends_on' => [
98
+			'settings.general.notifications' => ['custom'],
99
+		],
100
+		'label' => __('Send Notification Emails To', 'site-reviews'),
101
+		'placeholder' => __('Separate multiple emails with a comma', 'site-reviews'),
102
+		'type' => 'text',
103
+	],
104
+	'settings.general.notification_slack' => [
105
+		'default' => '',
106
+		'depends_on' => [
107
+			'settings.general.notifications' => ['slack'],
108
+		],
109
+		'description' => sprintf(__('To send notifications to Slack, create a new %s and then paste the provided Webhook URL in the field above.', 'site-reviews'),
110
+			'<a href="https://api.slack.com/incoming-webhooks">'.__('Incoming WebHook', 'site-reviews').'</a>'
111
+		),
112
+		'label' => __('Slack Webhook URL', 'site-reviews'),
113
+		'type' => 'text',
114
+	],
115
+	'settings.general.notification_message' => [
116
+		'default' => glsr('Modules\Html\Template')->build('templates/email-notification'),
117
+		'depends_on' => [
118
+			'settings.general.notifications' => ['admin', 'author', 'custom', 'slack'],
119
+		],
120
+		'description' => __(
121
+			'To restore the default text, save an empty template. '.
122
+			'If you are sending notifications to Slack then this template will only be used as a fallback in the event that <a href="https://api.slack.com/docs/attachments">Message Attachments</a> have been disabled. Available template tags:'.
123
+			'<br><code>{review_rating}</code> The review rating number (1-5)'.
124
+			'<br><code>{review_title}</code> The review title'.
125
+			'<br><code>{review_content}</code> The review content'.
126
+			'<br><code>{review_author}</code> The review author'.
127
+			'<br><code>{review_email}</code> The email of the review author'.
128
+			'<br><code>{review_ip}</code> The IP address of the review author'.
129
+			'<br><code>{review_link}</code> The link to edit/view a review',
130
+			'site-reviews'
131
+		),
132
+		'label' => __('Notification Template', 'site-reviews'),
133
+		'rows' => 10,
134
+		'type' => 'code',
135
+	],
136
+	'settings.reviews.date.format' => [
137
+		'default' => '',
138
+		'description' => sprintf(__('The default date format is the one set in your %s.', 'site-reviews'),
139
+			'<a href="'.admin_url('options-general.php#date_format_custom').'">'.__('WordPress settings', 'site-reviews').'</a>'
140
+		),
141
+		'label' => __('Date Format', 'site-reviews'),
142
+		'options' => [
143
+			'' => __('Use the default date format', 'site-reviews'),
144
+			'relative' => __('Use a relative date format', 'site-reviews'),
145
+			'custom' => __('Use a custom date format', 'site-reviews'),
146
+		],
147
+		'type' => 'select',
148
+	],
149
+	'settings.reviews.date.custom' => [
150
+		'default' => get_option('date_format'),
151
+		'depends_on' => [
152
+			'settings.reviews.date.format' => 'custom',
153
+		],
154
+		'description' => __('Enter a custom date format (<a href="https://codex.wordpress.org/Formatting_Date_and_Time">documentation on date and time formatting</a>).', 'site-reviews'),
155
+		'label' => __('Custom Date Format', 'site-reviews'),
156
+		'type' => 'text',
157
+	],
158
+	'settings.reviews.name.format' => [
159
+		'default' => '',
160
+		'description' => __('Choose how names are shown in your reviews.', 'site-reviews'),
161
+		'label' => __('Name Format', 'site-reviews'),
162
+		'options' => [
163
+			'' => __('Use the name as given', 'site-reviews'),
164
+			'first' => __('Use the first name only', 'site-reviews'),
165
+			'first_initial' => __('Convert first name to an initial', 'site-reviews'),
166
+			'last_initial' => __('Convert last name to an initial', 'site-reviews'),
167
+			'initials' => __('Convert to all initials', 'site-reviews'),
168
+		],
169
+		'type' => 'select',
170
+	],
171
+	'settings.reviews.name.initial' => [
172
+		'default' => '',
173
+		'depends_on' => [
174
+			'settings.reviews.name.format' => ['first_initial', 'last_initial', 'initials'],
175
+		],
176
+		'description' => __('Choose how the initial is displayed.', 'site-reviews'),
177
+		'label' => __('Initial Format', 'site-reviews'),
178
+		'options' => [
179
+			'' => __('Initial with a space', 'site-reviews'),
180
+			'period' => __('Initial with a period', 'site-reviews'),
181
+			'period_space' => __('Initial with a period and a space', 'site-reviews'),
182
+		],
183
+		'type' => 'select',
184
+	],
185
+	'settings.reviews.assigned_links' => [
186
+		'default' => 'no',
187
+		'description' => __('Display a link to the assigned post of a review.', 'site-reviews'),
188
+		'label' => __('Enable Assigned Links', 'site-reviews'),
189
+		'type' => 'yes_no',
190
+	],
191
+	'settings.reviews.avatars' => [
192
+		'default' => 'no',
193
+		'description' => __('Display reviewer avatars. These are generated from the email address of the reviewer using <a href="https://gravatar.com">Gravatar</a>.', 'site-reviews'),
194
+		'label' => __('Enable Avatars', 'site-reviews'),
195
+		'type' => 'yes_no',
196
+	],
197
+	'settings.reviews.avatars_regenerate' => [
198
+		'default' => 'no',
199
+		'depends_on' => [
200
+			'settings.reviews.avatars' => 'yes',
201
+		],
202
+		'description' => __('Regenerate the avatar whenever a local review is shown?', 'site-reviews'),
203
+		'label' => __('Regenerate Avatars', 'site-reviews'),
204
+		'type' => 'yes_no',
205
+	],
206
+	'settings.reviews.avatars_size' => [
207
+		'default' => 40,
208
+		'depends_on' => [
209
+			'settings.reviews.avatars' => 'yes',
210
+		],
211
+		'description' => __('Set the avatar size in pixels.', 'site-reviews'),
212
+		'label' => __('Avatar Size', 'site-reviews'),
213
+		'type' => 'number',
214
+	],
215
+	'settings.reviews.excerpts' => [
216
+		'default' => 'yes',
217
+		'description' => __('Display an excerpt instead of the full review.', 'site-reviews'),
218
+		'label' => __('Enable Excerpts', 'site-reviews'),
219
+		'type' => 'yes_no',
220
+	],
221
+	'settings.reviews.excerpts_length' => [
222
+		'default' => 55,
223
+		'depends_on' => [
224
+			'settings.reviews.excerpts' => 'yes',
225
+		],
226
+		'description' => __('Set the excerpt word length.', 'site-reviews'),
227
+		'label' => __('Excerpt Length', 'site-reviews'),
228
+		'type' => 'number',
229
+	],
230
+	'settings.reviews.fallback' => [
231
+		'default' => 'yes',
232
+		'description' => sprintf(__('Display the fallback text when there are no reviews to display. This can be changed on the %s page. You may also override this by using the "fallback" option on the shortcode. The default fallback text is: %s', 'site-reviews'),
233
+			'<a href="'.admin_url('edit.php?post_type=site-review&page=settings#!translations').'">'.__('Translations', 'site-reviews').'</a>',
234
+			'<code>'.__('There are no reviews yet. Be the first one to write one.', 'site-reviews').'</code>'
235
+		),
236
+		'label' => __('Enable Fallback Text', 'site-reviews'),
237
+		'type' => 'yes_no',
238
+	],
239
+	'settings.schema.type.default' => [
240
+		'default' => 'LocalBusiness',
241
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_type</code>',
242
+		'label' => __('Default Schema Type', 'site-reviews'),
243
+		'options' => [
244
+			'LocalBusiness' => __('Local Business', 'site-reviews'),
245
+			'Product' => __('Product', 'site-reviews'),
246
+			'custom' => __('Custom', 'site-reviews'),
247
+		],
248
+		'type' => 'select',
249
+	],
250
+	'settings.schema.type.custom' => [
251
+		'default' => '',
252
+		'depends_on' => [
253
+			'settings.schema.type.default' => 'custom',
254
+		],
255
+		'description' => '<a href="https://schema.org/docs/schemas.html">'.__('View more information on schema types here', 'site-reviews').'</a>',
256
+		'label' => __('Custom Schema Type', 'site-reviews'),
257
+		'type' => 'text',
258
+	],
259
+	'settings.schema.name.default' => [
260
+		'default' => 'post',
261
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_name</code>',
262
+		'label' => __('Default Name', 'site-reviews'),
263
+		'options' => [
264
+			'post' => __('Use the assigned or current page title', 'site-reviews'),
265
+			'custom' => __('Enter a custom title', 'site-reviews'),
266
+		],
267
+		'type' => 'select',
268
+	],
269
+	'settings.schema.name.custom' => [
270
+		'default' => '',
271
+		'depends_on' => [
272
+			'settings.schema.name.default' => 'custom',
273
+		],
274
+		'label' => __('Custom Name', 'site-reviews'),
275
+		'type' => 'text',
276
+	],
277
+	'settings.schema.description.default' => [
278
+		'default' => 'post',
279
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_description</code>',
280
+		'label' => __('Default Description', 'site-reviews'),
281
+		'options' => [
282
+			'post' => __('Use the assigned or current page excerpt', 'site-reviews'),
283
+			'custom' => __('Enter a custom description', 'site-reviews'),
284
+		],
285
+		'type' => 'select',
286
+	],
287
+	'settings.schema.description.custom' => [
288
+		'default' => '',
289
+		'depends_on' => [
290
+			'settings.schema.description.default' => 'custom',
291
+		],
292
+		'label' => __('Custom Description', 'site-reviews'),
293
+		'type' => 'text',
294
+	],
295
+	'settings.schema.url.default' => [
296
+		'default' => 'post',
297
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_url</code>',
298
+		'label' => __('Default URL', 'site-reviews'),
299
+		'options' => [
300
+			'post' => __('Use the assigned or current page URL', 'site-reviews'),
301
+			'custom' => __('Enter a custom URL', 'site-reviews'),
302
+		],
303
+		'type' => 'select',
304
+	],
305
+	'settings.schema.url.custom' => [
306
+		'default' => '',
307
+		'depends_on' => [
308
+			'settings.schema.url.default' => 'custom',
309
+		],
310
+		'label' => __('Custom URL', 'site-reviews'),
311
+		'type' => 'text',
312
+	],
313
+	'settings.schema.image.default' => [
314
+		'default' => 'post',
315
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_image</code>',
316
+		'label' => __('Default Image', 'site-reviews'),
317
+		'options' => [
318
+			'post' => __('Use the featured image of the assigned or current page', 'site-reviews'),
319
+			'custom' => __('Enter a custom image URL', 'site-reviews'),
320
+		],
321
+		'type' => 'select',
322
+	],
323
+	'settings.schema.image.custom' => [
324
+		'default' => '',
325
+		'depends_on' => [
326
+			'settings.schema.image.default' => 'custom',
327
+		],
328
+		'label' => __('Custom Image URL', 'site-reviews'),
329
+		'type' => 'text',
330
+	],
331
+	'settings.schema.address' => [
332
+		'default' => '',
333
+		'depends_on' => [
334
+			'settings.schema.type.default' => 'LocalBusiness',
335
+		],
336
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_address</code>',
337
+		'label' => __('Address', 'site-reviews'),
338
+		'placeholder' => '60 29th Street #343, San Francisco, CA 94110, US',
339
+		'type' => 'text',
340
+	],
341
+	'settings.schema.telephone' => [
342
+		'default' => '',
343
+		'depends_on' => [
344
+			'settings.schema.type.default' => 'LocalBusiness',
345
+		],
346
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_telephone</code>',
347
+		'label' => __('Telephone Number', 'site-reviews'),
348
+		'placeholder' => '+1 (877) 273-3049',
349
+		'type' => 'text',
350
+	],
351
+	'settings.schema.pricerange' => [
352
+		'default' => '',
353
+		'depends_on' => [
354
+			'settings.schema.type.default' => 'LocalBusiness',
355
+		],
356
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_pricerange</code>',
357
+		'label' => __('Price Range', 'site-reviews'),
358
+		'placeholder' => '$$-$$$',
359
+		'type' => 'text',
360
+	],
361
+	'settings.schema.offertype' => [
362
+		'default' => 'AggregateOffer',
363
+		'depends_on' => [
364
+			'settings.schema.type.default' => 'Product',
365
+		],
366
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_offertype</code>',
367
+		'label' => __('Offer Type', 'site-reviews'),
368
+		'options' => [
369
+			'AggregateOffer' => __('AggregateOffer', 'site-reviews'),
370
+			'Offer' => __('Offer', 'site-reviews'),
371
+		],
372
+		'type' => 'select',
373
+	],
374
+	'settings.schema.price' => [
375
+		'default' => '',
376
+		'depends_on' => [
377
+			'settings.schema.type.default' => 'Product',
378
+			'settings.schema.offertype' => 'Offer',
379
+		],
380
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_price</code>',
381
+		'label' => __('Price', 'site-reviews'),
382
+		'placeholder' => '50.00',
383
+		'type' => 'text',
384
+	],
385
+	'settings.schema.lowprice' => [
386
+		'default' => '',
387
+		'depends_on' => [
388
+			'settings.schema.type.default' => 'Product',
389
+			'settings.schema.offertype' => 'AggregateOffer',
390
+		],
391
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_lowprice</code>',
392
+		'label' => __('Low Price', 'site-reviews'),
393
+		'placeholder' => '10.00',
394
+		'type' => 'text',
395
+	],
396
+	'settings.schema.highprice' => [
397
+		'default' => '',
398
+		'depends_on' => [
399
+			'settings.schema.type.default' => 'Product',
400
+			'settings.schema.offertype' => 'AggregateOffer',
401
+		],
402
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_highprice</code>',
403
+		'label' => __('High Price', 'site-reviews'),
404
+		'placeholder' => '100.00',
405
+		'type' => 'text',
406
+	],
407
+	'settings.schema.pricecurrency' => [
408
+		'default' => '',
409
+		'depends_on' => [
410
+			'settings.schema.type.default' => 'Product',
411
+		],
412
+		'description' => __('Custom Field name', 'site-reviews').': <code>schema_pricecurrency</code>',
413
+		'label' => __('Price Currency', 'site-reviews'),
414
+		'placeholder' => 'USD',
415
+		'type' => 'text',
416
+	],
417
+	'settings.submissions.required' => [
418
+		'default' => ['content', 'email', 'name', 'rating', 'terms', 'title'],
419
+		'description' => __('Choose which fields should be required in the submission form.', 'site-reviews'),
420
+		'label' => __('Required Fields', 'site-reviews'),
421
+		'options' => [
422
+			'rating' => __('Rating', 'site-reviews'),
423
+			'title' => __('Title', 'site-reviews'),
424
+			'content' => __('Review', 'site-reviews'),
425
+			'name' => __('Name', 'site-reviews'),
426
+			'email' => __('Email', 'site-reviews'),
427
+			'terms' => __('Terms', 'site-reviews'),
428
+		],
429
+		'type' => 'checkbox',
430
+	],
431
+	'settings.submissions.limit' => [
432
+		'default' => '',
433
+		'description' => __('Limits the number of reviews that can be submitted to one-per-person. If you are assigning reviews, then the limit will be applied to the assigned page or category.', 'site-reviews'),
434
+		'label' => __('Limit Reviews', 'site-reviews'),
435
+		'options' => [
436
+			'' => __('No Limit', 'site-reviews'),
437
+			'email' => __('By Email Address', 'site-reviews'),
438
+			'ip_address' => __('By IP Address', 'site-reviews'),
439
+			'username' => __('By Username (will only work for registered users)', 'site-reviews'),
440
+		],
441
+		'type' => 'select',
442
+	],
443
+	'settings.submissions.limit_whitelist.email' => [
444
+		'default' => '',
445
+		'depends_on' => [
446
+			'settings.submissions.limit' => ['email'],
447
+		],
448
+		'description' => __('One Email per line. All emails in the whitelist will be excluded from the review submission limit.', 'site-reviews'),
449
+		'label' => __('Email Whitelist', 'site-reviews'),
450
+		'rows' => 5,
451
+		'type' => 'code',
452
+	],
453
+	'settings.submissions.limit_whitelist.ip_address' => [
454
+		'default' => '',
455
+		'depends_on' => [
456
+			'settings.submissions.limit' => ['ip_address'],
457
+		],
458
+		'description' => __('One IP Address per line. All IP Addresses in the whitelist will be excluded from the review submission limit..', 'site-reviews'),
459
+		'label' => __('IP Address Whitelist', 'site-reviews'),
460
+		'rows' => 5,
461
+		'type' => 'code',
462
+	],
463
+	'settings.submissions.limit_whitelist.username' => [
464
+		'default' => '',
465
+		'depends_on' => [
466
+			'settings.submissions.limit' => ['username'],
467
+		],
468
+		'description' => __('One Username per line. All registered users with a Username in the whitelist will be excluded from the review submission limit.', 'site-reviews'),
469
+		'label' => __('Username Whitelist', 'site-reviews'),
470
+		'rows' => 5,
471
+		'type' => 'code',
472
+	],
473
+	'settings.submissions.recaptcha.integration' => [
474
+		'default' => '',
475
+		'description' => __('Invisible reCAPTCHA is a free anti-spam service from Google. To use it, you will need to <a href="https://www.google.com/recaptcha/admin" target="_blank">sign up</a> for an API key pair for your site.', 'site-reviews'),
476
+		'label' => __('Invisible reCAPTCHA', 'site-reviews'),
477
+		'options' => [
478
+			'' => 'Do not use reCAPTCHA',
479
+			'all' => 'Use reCAPTCHA',
480
+			'guest' => 'Use reCAPTCHA only for guest users',
481
+		],
482
+		'type' => 'select',
483
+	],
484
+	'settings.submissions.recaptcha.key' => [
485
+		'default' => '',
486
+		'depends_on' => [
487
+			'settings.submissions.recaptcha.integration' => ['all', 'guest'],
488
+		],
489
+		'label' => __('Site Key', 'site-reviews'),
490
+		'type' => 'text',
491
+	],
492
+	'settings.submissions.recaptcha.secret' => [
493
+		'default' => '',
494
+		'depends_on' => [
495
+			'settings.submissions.recaptcha.integration' => ['all', 'guest'],
496
+		],
497
+		'label' => __('Site Secret', 'site-reviews'),
498
+		'type' => 'text',
499
+	],
500
+	'settings.submissions.recaptcha.position' => [
501
+		'default' => 'bottomleft',
502
+		'depends_on' => [
503
+			'settings.submissions.recaptcha.integration' => ['all', 'guest'],
504
+		],
505
+		'description' => __('This option may not work consistently if another plugin is loading reCAPTCHA on the same page as Site Reviews.', 'site-reviews'),
506
+		'label' => __('Badge Position', 'site-reviews'),
507
+		'options' => [
508
+			'bottomleft' => 'Bottom Left',
509
+			'bottomright' => 'Bottom Right',
510
+			'inline' => 'Inline',
511
+		],
512
+		'type' => 'select',
513
+	],
514
+	'settings.submissions.akismet' => [
515
+		'default' => 'no',
516
+		'description' => __('The <a href="https://akismet.com" target="_blank">Akismet plugin</a> integration provides spam-filtering for your reviews. In order for this setting to have any affect, you will need to first install and activate the Akismet plugin and set up a WordPress.com API key.', 'site-reviews'),
517
+		'label' => __('Enable Akismet Integration', 'site-reviews'),
518
+		'type' => 'yes_no',
519
+	],
520
+	'settings.submissions.blacklist.integration' => [
521
+		'default' => '',
522
+		'description' => sprintf(__('Choose which Blacklist you would prefer to use for reviews. The %s can be found in the WordPress Discussion Settings page.', 'site-reviews'),
523
+			'<a href="'.admin_url('options-discussion.php#users_can_register').'">'.__('Comment Blacklist', 'site-reviews').'</a>'
524
+		),
525
+		'label' => __('Blacklist', 'site-reviews'),
526
+		'options' => [
527
+			'' => 'Use the Site Reviews Blacklist',
528
+			'comments' => 'Use the WordPress Comment Blacklist',
529
+		],
530
+		'type' => 'select',
531
+	],
532
+	'settings.submissions.blacklist.entries' => [
533
+		'default' => '',
534
+		'depends_on' => [
535
+			'settings.submissions.blacklist.integration' => [''],
536
+		],
537
+		'description' => __('One entry or IP address per line. When a review contains any of these entries in its title, content, name, email, or IP address, it will be rejected. It is case-insensitive and will match partial words, so "press" will match "WordPress".', 'site-reviews'),
538
+		'label' => __('Review Blacklist', 'site-reviews'),
539
+		'rows' => 10,
540
+		'type' => 'code',
541
+	],
542
+	'settings.submissions.blacklist.action' => [
543
+		'default' => 'unapprove',
544
+		'description' => __('Choose the action that should be taken when a review is blacklisted.', 'site-reviews'),
545
+		'label' => __('Blacklist Action', 'site-reviews'),
546
+		'options' => [
547
+			'unapprove' => __('Require approval', 'site-reviews'),
548
+			'reject' => __('Reject submission', 'site-reviews'),
549
+		],
550
+		'type' => 'select',
551
+	],
552 552
 ];
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.
plugin/Controllers/WelcomeController.php 1 patch
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -8,99 +8,99 @@
 block discarded – undo
8 8
 
9 9
 class WelcomeController extends Controller
10 10
 {
11
-    /**
12
-     * @return array
13
-     * @filter plugin_action_links_site-reviews/site-reviews.php
14
-     */
15
-    public function filterActionLinks(array $links)
16
-    {
17
-        $links['welcome'] = glsr(Builder::class)->a(__('About', 'site-reviews'), [
18
-            'href' => admin_url('edit.php?post_type='.Application::POST_TYPE.'&page=welcome'),
19
-        ]);
20
-        return $links;
21
-    }
11
+	/**
12
+	 * @return array
13
+	 * @filter plugin_action_links_site-reviews/site-reviews.php
14
+	 */
15
+	public function filterActionLinks(array $links)
16
+	{
17
+		$links['welcome'] = glsr(Builder::class)->a(__('About', 'site-reviews'), [
18
+			'href' => admin_url('edit.php?post_type='.Application::POST_TYPE.'&page=welcome'),
19
+		]);
20
+		return $links;
21
+	}
22 22
 
23
-    /**
24
-     * @return string
25
-     * @filter admin_title
26
-     */
27
-    public function filterAdminTitle($title)
28
-    {
29
-        return Application::POST_TYPE.'_page_welcome' == glsr_current_screen()->id
30
-            ? sprintf(__('Welcome to %s &#8212; WordPress', 'site-reviews'), glsr()->name)
31
-            : $title;
32
-    }
23
+	/**
24
+	 * @return string
25
+	 * @filter admin_title
26
+	 */
27
+	public function filterAdminTitle($title)
28
+	{
29
+		return Application::POST_TYPE.'_page_welcome' == glsr_current_screen()->id
30
+			? sprintf(__('Welcome to %s &#8212; WordPress', 'site-reviews'), glsr()->name)
31
+			: $title;
32
+	}
33 33
 
34
-    /**
35
-     * @param string $text
36
-     * @return string
37
-     * @filter admin_footer_text
38
-     */
39
-    public function filterFooterText($text)
40
-    {
41
-        if (Application::POST_TYPE.'_page_welcome' != glsr_current_screen()->id) {
42
-            return $text;
43
-        }
44
-        $url = 'https://wordpress.org/support/view/plugin-reviews/site-reviews?filter=5#new-post';
45
-        return wp_kses_post(sprintf(
46
-            __('Please rate %s on %s and help us spread the word. Thank you so much!', 'site-reviews'),
47
-            '<strong>'.glsr()->name.'</strong> <a href="'.$url.'" target="_blank">&#9733;&#9733;&#9733;&#9733;&#9733;</a>',
48
-            '<a href="'.$url.'" target="_blank">wordpress.org</a>'
49
-        ));
50
-    }
34
+	/**
35
+	 * @param string $text
36
+	 * @return string
37
+	 * @filter admin_footer_text
38
+	 */
39
+	public function filterFooterText($text)
40
+	{
41
+		if (Application::POST_TYPE.'_page_welcome' != glsr_current_screen()->id) {
42
+			return $text;
43
+		}
44
+		$url = 'https://wordpress.org/support/view/plugin-reviews/site-reviews?filter=5#new-post';
45
+		return wp_kses_post(sprintf(
46
+			__('Please rate %s on %s and help us spread the word. Thank you so much!', 'site-reviews'),
47
+			'<strong>'.glsr()->name.'</strong> <a href="'.$url.'" target="_blank">&#9733;&#9733;&#9733;&#9733;&#9733;</a>',
48
+			'<a href="'.$url.'" target="_blank">wordpress.org</a>'
49
+		));
50
+	}
51 51
 
52
-    /**
53
-     * @param string $plugin
54
-     * @param bool $isNetworkActivation
55
-     * @return void
56
-     * @action activated_plugin
57
-     */
58
-    public function redirectOnActivation($plugin, $isNetworkActivation)
59
-    {
60
-        if (!$isNetworkActivation
61
-            && 'cli' !== php_sapi_name()
62
-            && $plugin === plugin_basename(glsr()->file)) {
63
-            wp_safe_redirect(admin_url('edit.php?post_type='.Application::POST_TYPE.'&page=welcome'));
64
-            exit;
65
-        }
66
-    }
52
+	/**
53
+	 * @param string $plugin
54
+	 * @param bool $isNetworkActivation
55
+	 * @return void
56
+	 * @action activated_plugin
57
+	 */
58
+	public function redirectOnActivation($plugin, $isNetworkActivation)
59
+	{
60
+		if (!$isNetworkActivation
61
+			&& 'cli' !== php_sapi_name()
62
+			&& $plugin === plugin_basename(glsr()->file)) {
63
+			wp_safe_redirect(admin_url('edit.php?post_type='.Application::POST_TYPE.'&page=welcome'));
64
+			exit;
65
+		}
66
+	}
67 67
 
68
-    /**
69
-     * @return void
70
-     * @action admin_menu
71
-     */
72
-    public function registerPage()
73
-    {
74
-        add_submenu_page('edit.php?post_type='.Application::POST_TYPE,
75
-            sprintf(__('Welcome to %s', 'site-reviews'), glsr()->name),
76
-            glsr()->name,
77
-            glsr()->getPermission('welcome'),
78
-            'welcome',
79
-            [$this, 'renderPage']
80
-        );
81
-        remove_submenu_page('edit.php?post_type='.Application::POST_TYPE, 'welcome');
82
-    }
68
+	/**
69
+	 * @return void
70
+	 * @action admin_menu
71
+	 */
72
+	public function registerPage()
73
+	{
74
+		add_submenu_page('edit.php?post_type='.Application::POST_TYPE,
75
+			sprintf(__('Welcome to %s', 'site-reviews'), glsr()->name),
76
+			glsr()->name,
77
+			glsr()->getPermission('welcome'),
78
+			'welcome',
79
+			[$this, 'renderPage']
80
+		);
81
+		remove_submenu_page('edit.php?post_type='.Application::POST_TYPE, 'welcome');
82
+	}
83 83
 
84
-    /**
85
-     * @return void
86
-     * @see $this->registerPage()
87
-     * @callback add_submenu_page
88
-     */
89
-    public function renderPage()
90
-    {
91
-        $tabs = apply_filters('site-reviews/addon/welcome/tabs', [
92
-            'getting-started' => __('Getting Started', 'site-reviews'),
93
-            'whatsnew' => __('What\'s New', 'site-reviews'),
94
-            'upgrade-guide' => __('Upgrade Guide', 'site-reviews'),
95
-            'support' => __('Support', 'site-reviews'),
96
-        ]);
97
-        glsr()->render('pages/welcome/index', [
98
-            'data' => [
99
-                'context' => [],
100
-            ],
101
-            'http_referer' => (string) wp_get_referer(),
102
-            'tabs' => $tabs,
103
-            'template' => glsr(Template::class),
104
-        ]);
105
-    }
84
+	/**
85
+	 * @return void
86
+	 * @see $this->registerPage()
87
+	 * @callback add_submenu_page
88
+	 */
89
+	public function renderPage()
90
+	{
91
+		$tabs = apply_filters('site-reviews/addon/welcome/tabs', [
92
+			'getting-started' => __('Getting Started', 'site-reviews'),
93
+			'whatsnew' => __('What\'s New', 'site-reviews'),
94
+			'upgrade-guide' => __('Upgrade Guide', 'site-reviews'),
95
+			'support' => __('Support', 'site-reviews'),
96
+		]);
97
+		glsr()->render('pages/welcome/index', [
98
+			'data' => [
99
+				'context' => [],
100
+			],
101
+			'http_referer' => (string) wp_get_referer(),
102
+			'tabs' => $tabs,
103
+			'template' => glsr(Template::class),
104
+		]);
105
+	}
106 106
 }
Please login to merge, or discard this patch.
plugin/Actions.php 1 patch
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -20,108 +20,108 @@
 block discarded – undo
20 20
 
21 21
 class Actions implements HooksContract
22 22
 {
23
-    protected $about;
24
-    protected $admin;
25
-    protected $app;
26
-    protected $blocks;
27
-    protected $console;
28
-    protected $editor;
29
-    protected $listtable;
30
-    protected $menu;
31
-    protected $main;
32
-    protected $notices;
33
-    protected $public;
34
-    protected $rebusify;
35
-    protected $review;
36
-    protected $router;
37
-    protected $settings;
38
-    protected $taxonomy;
39
-    protected $welcome;
23
+	protected $about;
24
+	protected $admin;
25
+	protected $app;
26
+	protected $blocks;
27
+	protected $console;
28
+	protected $editor;
29
+	protected $listtable;
30
+	protected $menu;
31
+	protected $main;
32
+	protected $notices;
33
+	protected $public;
34
+	protected $rebusify;
35
+	protected $review;
36
+	protected $router;
37
+	protected $settings;
38
+	protected $taxonomy;
39
+	protected $welcome;
40 40
 
41
-    public function __construct(Application $app ) {
42
-        $this->app = $app;
43
-        $this->admin = $app->make(AdminController::class);
44
-        $this->blocks = $app->make(BlocksController::class);
45
-        $this->console = $app->make(Console::class);
46
-        $this->editor = $app->make(EditorController::class);
47
-        $this->listtable = $app->make(ListTableController::class);
48
-        $this->main = $app->make(MainController::class);
49
-        $this->menu = $app->make(MenuController::class);
50
-        $this->notices = $app->make(NoticeController::class);
51
-        $this->public = $app->make(PublicController::class);
52
-        $this->rebusify = $app->make(RebusifyController::class);
53
-        $this->review = $app->make(ReviewController::class);
54
-        $this->router = $app->make(Router::class);
55
-        $this->settings = $app->make(SettingsController::class);
56
-        $this->taxonomy = $app->make(TaxonomyController::class);
57
-        $this->welcome = $app->make(WelcomeController::class);
58
-    }
41
+	public function __construct(Application $app ) {
42
+		$this->app = $app;
43
+		$this->admin = $app->make(AdminController::class);
44
+		$this->blocks = $app->make(BlocksController::class);
45
+		$this->console = $app->make(Console::class);
46
+		$this->editor = $app->make(EditorController::class);
47
+		$this->listtable = $app->make(ListTableController::class);
48
+		$this->main = $app->make(MainController::class);
49
+		$this->menu = $app->make(MenuController::class);
50
+		$this->notices = $app->make(NoticeController::class);
51
+		$this->public = $app->make(PublicController::class);
52
+		$this->rebusify = $app->make(RebusifyController::class);
53
+		$this->review = $app->make(ReviewController::class);
54
+		$this->router = $app->make(Router::class);
55
+		$this->settings = $app->make(SettingsController::class);
56
+		$this->taxonomy = $app->make(TaxonomyController::class);
57
+		$this->welcome = $app->make(WelcomeController::class);
58
+	}
59 59
 
60
-    /**
61
-     * @return void
62
-     */
63
-    public function run()
64
-    {
65
-        add_action('admin_enqueue_scripts',                                 [$this->admin, 'enqueueAssets']);
66
-        add_action('admin_init',                                            [$this->admin, 'registerTinymcePopups']);
67
-        add_action('media_buttons',                                         [$this->admin, 'renderTinymceButton'], 11);
68
-        add_action('plugins_loaded',                                        [$this->app, 'getDefaults'], 11);
69
-        add_action('plugins_loaded',                                        [$this->app, 'registerAddons']);
70
-        add_action('plugins_loaded',                                        [$this->app, 'registerLanguages']);
71
-        add_action('plugins_loaded',                                        [$this->app, 'registerReviewTypes']);
72
-        add_action('upgrader_process_complete',                             [$this->app, 'upgraded'], 10, 2);
73
-        add_action('init',                                                  [$this->blocks, 'registerAssets'], 9);
74
-        add_action('init',                                                  [$this->blocks, 'registerBlocks']);
75
-        add_action('admin_footer',                                          [$this->console, 'logOnce']);
76
-        add_action('wp_footer',                                             [$this->console, 'logOnce']);
77
-        add_action('admin_enqueue_scripts',                                 [$this->editor, 'customizePostStatusLabels']);
78
-        add_action('add_meta_boxes_'.Application::POST_TYPE,                [$this->editor, 'registerMetaBoxes']);
79
-        add_action('admin_print_scripts',                                   [$this->editor, 'removeAutosave'], 999);
80
-        add_action('admin_menu',                                            [$this->editor, 'removeMetaBoxes']);
81
-        add_action('current_screen',                                        [$this->editor, 'removePostTypeSupport']);
82
-        add_action('post_submitbox_misc_actions',                           [$this->editor, 'renderPinnedInPublishMetaBox']);
83
-        add_action('admin_head',                                            [$this->editor, 'renderReviewFields']);
84
-        add_action('admin_action_revert',                                   [$this->editor, 'revertReview']);
85
-        add_action('save_post_'.Application::POST_TYPE,                     [$this->editor, 'saveMetaboxes'], 10, 3);
86
-        add_action('admin_action_approve',                                  [$this->listtable, 'approve']);
87
-        add_action('bulk_edit_custom_box',                                  [$this->listtable, 'renderBulkEditFields'], 10, 2);
88
-        add_action('restrict_manage_posts',                                 [$this->listtable, 'renderColumnFilters']);
89
-        add_action('manage_'.Application::POST_TYPE.'_posts_custom_column', [$this->listtable, 'renderColumnValues'], 10, 2);
90
-        add_action('save_post_'.Application::POST_TYPE,                     [$this->listtable, 'saveBulkEditFields']);
91
-        add_action('pre_get_posts',                                         [$this->listtable, 'setQueryForColumn']);
92
-        add_action('admin_action_unapprove',                                [$this->listtable, 'unapprove']);
93
-        add_action('init',                                                  [$this->main, 'registerPostType'], 8);
94
-        add_action('init',                                                  [$this->main, 'registerShortcodes']);
95
-        add_action('init',                                                  [$this->main, 'registerTaxonomy']);
96
-        add_action('widgets_init',                                          [$this->main, 'registerWidgets']);
97
-        add_action('admin_menu',                                            [$this->menu, 'registerMenuCount']);
98
-        add_action('admin_menu',                                            [$this->menu, 'registerSubMenus']);
99
-        add_action('admin_init',                                            [$this->menu, 'setCustomPermissions'], 999);
100
-        add_action('admin_notices',                                         [$this->notices, 'filterAdminNotices']);
101
-        add_action('wp_enqueue_scripts',                                    [$this->public, 'enqueueAssets'], 999);
102
-        add_filter('site-reviews/builder',                                  [$this->public, 'modifyBuilder']);
103
-        add_action('wp_footer',                                             [$this->public, 'renderSchema']);
104
-        add_action('site-reviews/review/created',                           [$this->rebusify, 'onCreated']);
105
-        add_action('site-reviews/review/reverted',                          [$this->rebusify, 'onReverted']);
106
-        add_action('site-reviews/review/saved',                             [$this->rebusify, 'onSaved']);
107
-        add_action('updated_postmeta',                                      [$this->rebusify, 'onUpdatedMeta'], 10, 3);
108
-        add_action('set_object_terms',                                      [$this->review, 'onAfterChangeCategory'], 10, 6);
109
-        add_action('transition_post_status',                                [$this->review, 'onAfterChangeStatus'], 10, 3);
110
-        add_action('site-reviews/review/created',                           [$this->review, 'onAfterCreate']);
111
-        add_action('before_delete_post',                                    [$this->review, 'onBeforeDelete']);
112
-        add_action('update_postmeta',                                       [$this->review, 'onBeforeUpdate'], 10, 4);
113
-        add_action('admin_init',                                            [$this->router, 'routeAdminPostRequest']);
114
-        add_action('wp_ajax_'.Application::PREFIX.'action',                 [$this->router, 'routeAjaxRequest']);
115
-        add_action('wp_ajax_nopriv_'.Application::PREFIX.'action',          [$this->router, 'routeAjaxRequest']);
116
-        add_action('init',                                                  [$this->router, 'routePublicPostRequest']);
117
-        add_action('admin_init',                                            [$this->settings, 'registerSettings']);
118
-        add_action(Application::TAXONOMY.'_term_edit_form_top',             [$this->taxonomy, 'disableParents']);
119
-        add_action(Application::TAXONOMY.'_term_new_form_tag',              [$this->taxonomy, 'disableParents']);
120
-        add_action(Application::TAXONOMY.'_add_form_fields',                [$this->taxonomy, 'enableParents']);
121
-        add_action(Application::TAXONOMY.'_edit_form',                      [$this->taxonomy, 'enableParents']);
122
-        add_action('restrict_manage_posts',                                 [$this->taxonomy, 'renderTaxonomyFilter'], 9);
123
-        add_action('set_object_terms',                                      [$this->taxonomy, 'restrictTermSelection'], 9, 6);
124
-        add_action('activated_plugin',                                      [$this->welcome, 'redirectOnActivation'], 10, 2);
125
-        add_action('admin_menu',                                            [$this->welcome, 'registerPage']);
126
-    }
60
+	/**
61
+	 * @return void
62
+	 */
63
+	public function run()
64
+	{
65
+		add_action('admin_enqueue_scripts',                                 [$this->admin, 'enqueueAssets']);
66
+		add_action('admin_init',                                            [$this->admin, 'registerTinymcePopups']);
67
+		add_action('media_buttons',                                         [$this->admin, 'renderTinymceButton'], 11);
68
+		add_action('plugins_loaded',                                        [$this->app, 'getDefaults'], 11);
69
+		add_action('plugins_loaded',                                        [$this->app, 'registerAddons']);
70
+		add_action('plugins_loaded',                                        [$this->app, 'registerLanguages']);
71
+		add_action('plugins_loaded',                                        [$this->app, 'registerReviewTypes']);
72
+		add_action('upgrader_process_complete',                             [$this->app, 'upgraded'], 10, 2);
73
+		add_action('init',                                                  [$this->blocks, 'registerAssets'], 9);
74
+		add_action('init',                                                  [$this->blocks, 'registerBlocks']);
75
+		add_action('admin_footer',                                          [$this->console, 'logOnce']);
76
+		add_action('wp_footer',                                             [$this->console, 'logOnce']);
77
+		add_action('admin_enqueue_scripts',                                 [$this->editor, 'customizePostStatusLabels']);
78
+		add_action('add_meta_boxes_'.Application::POST_TYPE,                [$this->editor, 'registerMetaBoxes']);
79
+		add_action('admin_print_scripts',                                   [$this->editor, 'removeAutosave'], 999);
80
+		add_action('admin_menu',                                            [$this->editor, 'removeMetaBoxes']);
81
+		add_action('current_screen',                                        [$this->editor, 'removePostTypeSupport']);
82
+		add_action('post_submitbox_misc_actions',                           [$this->editor, 'renderPinnedInPublishMetaBox']);
83
+		add_action('admin_head',                                            [$this->editor, 'renderReviewFields']);
84
+		add_action('admin_action_revert',                                   [$this->editor, 'revertReview']);
85
+		add_action('save_post_'.Application::POST_TYPE,                     [$this->editor, 'saveMetaboxes'], 10, 3);
86
+		add_action('admin_action_approve',                                  [$this->listtable, 'approve']);
87
+		add_action('bulk_edit_custom_box',                                  [$this->listtable, 'renderBulkEditFields'], 10, 2);
88
+		add_action('restrict_manage_posts',                                 [$this->listtable, 'renderColumnFilters']);
89
+		add_action('manage_'.Application::POST_TYPE.'_posts_custom_column', [$this->listtable, 'renderColumnValues'], 10, 2);
90
+		add_action('save_post_'.Application::POST_TYPE,                     [$this->listtable, 'saveBulkEditFields']);
91
+		add_action('pre_get_posts',                                         [$this->listtable, 'setQueryForColumn']);
92
+		add_action('admin_action_unapprove',                                [$this->listtable, 'unapprove']);
93
+		add_action('init',                                                  [$this->main, 'registerPostType'], 8);
94
+		add_action('init',                                                  [$this->main, 'registerShortcodes']);
95
+		add_action('init',                                                  [$this->main, 'registerTaxonomy']);
96
+		add_action('widgets_init',                                          [$this->main, 'registerWidgets']);
97
+		add_action('admin_menu',                                            [$this->menu, 'registerMenuCount']);
98
+		add_action('admin_menu',                                            [$this->menu, 'registerSubMenus']);
99
+		add_action('admin_init',                                            [$this->menu, 'setCustomPermissions'], 999);
100
+		add_action('admin_notices',                                         [$this->notices, 'filterAdminNotices']);
101
+		add_action('wp_enqueue_scripts',                                    [$this->public, 'enqueueAssets'], 999);
102
+		add_filter('site-reviews/builder',                                  [$this->public, 'modifyBuilder']);
103
+		add_action('wp_footer',                                             [$this->public, 'renderSchema']);
104
+		add_action('site-reviews/review/created',                           [$this->rebusify, 'onCreated']);
105
+		add_action('site-reviews/review/reverted',                          [$this->rebusify, 'onReverted']);
106
+		add_action('site-reviews/review/saved',                             [$this->rebusify, 'onSaved']);
107
+		add_action('updated_postmeta',                                      [$this->rebusify, 'onUpdatedMeta'], 10, 3);
108
+		add_action('set_object_terms',                                      [$this->review, 'onAfterChangeCategory'], 10, 6);
109
+		add_action('transition_post_status',                                [$this->review, 'onAfterChangeStatus'], 10, 3);
110
+		add_action('site-reviews/review/created',                           [$this->review, 'onAfterCreate']);
111
+		add_action('before_delete_post',                                    [$this->review, 'onBeforeDelete']);
112
+		add_action('update_postmeta',                                       [$this->review, 'onBeforeUpdate'], 10, 4);
113
+		add_action('admin_init',                                            [$this->router, 'routeAdminPostRequest']);
114
+		add_action('wp_ajax_'.Application::PREFIX.'action',                 [$this->router, 'routeAjaxRequest']);
115
+		add_action('wp_ajax_nopriv_'.Application::PREFIX.'action',          [$this->router, 'routeAjaxRequest']);
116
+		add_action('init',                                                  [$this->router, 'routePublicPostRequest']);
117
+		add_action('admin_init',                                            [$this->settings, 'registerSettings']);
118
+		add_action(Application::TAXONOMY.'_term_edit_form_top',             [$this->taxonomy, 'disableParents']);
119
+		add_action(Application::TAXONOMY.'_term_new_form_tag',              [$this->taxonomy, 'disableParents']);
120
+		add_action(Application::TAXONOMY.'_add_form_fields',                [$this->taxonomy, 'enableParents']);
121
+		add_action(Application::TAXONOMY.'_edit_form',                      [$this->taxonomy, 'enableParents']);
122
+		add_action('restrict_manage_posts',                                 [$this->taxonomy, 'renderTaxonomyFilter'], 9);
123
+		add_action('set_object_terms',                                      [$this->taxonomy, 'restrictTermSelection'], 9, 6);
124
+		add_action('activated_plugin',                                      [$this->welcome, 'redirectOnActivation'], 10, 2);
125
+		add_action('admin_menu',                                            [$this->welcome, 'registerPage']);
126
+	}
127 127
 }
Please login to merge, or discard this patch.
plugin/Widgets/Widget.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -7,54 +7,54 @@
 block discarded – undo
7 7
 
8 8
 abstract class Widget extends WP_Widget
9 9
 {
10
-    /**
11
-     * @var array
12
-     */
13
-    protected $widgetArgs;
10
+	/**
11
+	 * @var array
12
+	 */
13
+	protected $widgetArgs;
14 14
 
15
-    public function __construct($idBase, $name, $values)
16
-    {
17
-        $controlOptions = $widgetOptions = [];
18
-        if (isset($values['class'])) {
19
-            $widgetOptions['classname'] = $values['class'];
20
-        }
21
-        if (isset($values['description'])) {
22
-            $widgetOptions['description'] = $values['description'];
23
-        }
24
-        if (isset($values['width'])) {
25
-            $controlOptions['width'] = $values['width'];
26
-        }
27
-        parent::__construct($idBase, $name, $widgetOptions, $controlOptions);
28
-    }
15
+	public function __construct($idBase, $name, $values)
16
+	{
17
+		$controlOptions = $widgetOptions = [];
18
+		if (isset($values['class'])) {
19
+			$widgetOptions['classname'] = $values['class'];
20
+		}
21
+		if (isset($values['description'])) {
22
+			$widgetOptions['description'] = $values['description'];
23
+		}
24
+		if (isset($values['width'])) {
25
+			$controlOptions['width'] = $values['width'];
26
+		}
27
+		parent::__construct($idBase, $name, $widgetOptions, $controlOptions);
28
+	}
29 29
 
30
-    /**
31
-     * @param string $tag
32
-     * @return void
33
-     */
34
-    protected function renderField($tag, array $args = [])
35
-    {
36
-        $args = $this->normalizeFieldAttributes($tag, $args);
37
-        $field = glsr(Builder::class)->$tag($args['name'], $args);
38
-        echo glsr(Builder::class)->div($field, [
39
-            'class' => 'glsr-field',
40
-        ]);
41
-    }
30
+	/**
31
+	 * @param string $tag
32
+	 * @return void
33
+	 */
34
+	protected function renderField($tag, array $args = [])
35
+	{
36
+		$args = $this->normalizeFieldAttributes($tag, $args);
37
+		$field = glsr(Builder::class)->$tag($args['name'], $args);
38
+		echo glsr(Builder::class)->div($field, [
39
+			'class' => 'glsr-field',
40
+		]);
41
+	}
42 42
 
43
-    /**
44
-     * @param string $tag
45
-     * @return array
46
-     */
47
-    protected function normalizeFieldAttributes($tag, array $args)
48
-    {
49
-        if (empty($args['value'])) {
50
-            $args['value'] = $this->widgetArgs[$args['name']];
51
-        }
52
-        if (empty($this->widgetArgs['options']) && in_array($tag, ['checkbox', 'radio'])) {
53
-            $args['checked'] = in_array($args['value'], (array) $this->widgetArgs[$args['name']]);
54
-        }
55
-        $args['id'] = $this->get_field_id($args['name']);
56
-        $args['name'] = $this->get_field_name($args['name']);
57
-        $args['is_widget'] = true;
58
-        return $args;
59
-    }
43
+	/**
44
+	 * @param string $tag
45
+	 * @return array
46
+	 */
47
+	protected function normalizeFieldAttributes($tag, array $args)
48
+	{
49
+		if (empty($args['value'])) {
50
+			$args['value'] = $this->widgetArgs[$args['name']];
51
+		}
52
+		if (empty($this->widgetArgs['options']) && in_array($tag, ['checkbox', 'radio'])) {
53
+			$args['checked'] = in_array($args['value'], (array) $this->widgetArgs[$args['name']]);
54
+		}
55
+		$args['id'] = $this->get_field_id($args['name']);
56
+		$args['name'] = $this->get_field_name($args['name']);
57
+		$args['is_widget'] = true;
58
+		return $args;
59
+	}
60 60
 }
Please login to merge, or discard this patch.
plugin/Modules/Html/ReviewHtml.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -7,48 +7,48 @@
 block discarded – undo
7 7
 
8 8
 class ReviewHtml extends ArrayObject
9 9
 {
10
-    /**
11
-     * @var Review
12
-     */
13
-    public $review;
10
+	/**
11
+	 * @var Review
12
+	 */
13
+	public $review;
14 14
 
15
-    /**
16
-     * @var array
17
-     */
18
-    public $values;
15
+	/**
16
+	 * @var array
17
+	 */
18
+	public $values;
19 19
 
20
-    public function __construct(Review $review, array $values = [])
21
-    {
22
-        $this->review = $review;
23
-        $this->values = $values;
24
-        parent::__construct($values, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS);
25
-    }
20
+	public function __construct(Review $review, array $values = [])
21
+	{
22
+		$this->review = $review;
23
+		$this->values = $values;
24
+		parent::__construct($values, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS);
25
+	}
26 26
 
27
-    /**
28
-     * @return string|void
29
-     */
30
-    public function __toString()
31
-    {
32
-        if (empty($this->values)) {
33
-            return;
34
-        }
35
-        return glsr(Template::class)->build('templates/review', [
36
-            'context' => $this->values,
37
-            'review' => $this->review,
38
-        ]);
39
-    }
27
+	/**
28
+	 * @return string|void
29
+	 */
30
+	public function __toString()
31
+	{
32
+		if (empty($this->values)) {
33
+			return;
34
+		}
35
+		return glsr(Template::class)->build('templates/review', [
36
+			'context' => $this->values,
37
+			'review' => $this->review,
38
+		]);
39
+	}
40 40
 
41
-    /**
42
-     * @param mixed $key
43
-     * @return mixed
44
-     */
45
-    public function offsetGet($key)
46
-    {
47
-        if (property_exists($this, $key)) {
48
-            return $this->$key;
49
-        }
50
-        return array_key_exists($key, $this->values)
51
-            ? $this->values[$key]
52
-            : null;
53
-    }
41
+	/**
42
+	 * @param mixed $key
43
+	 * @return mixed
44
+	 */
45
+	public function offsetGet($key)
46
+	{
47
+		if (property_exists($this, $key)) {
48
+			return $this->$key;
49
+		}
50
+		return array_key_exists($key, $this->values)
51
+			? $this->values[$key]
52
+			: null;
53
+	}
54 54
 }
Please login to merge, or discard this patch.
plugin/Shortcodes/Shortcode.php 1 patch
Indentation   +219 added lines, -219 removed lines patch added patch discarded remove patch
@@ -11,223 +11,223 @@
 block discarded – undo
11 11
 
12 12
 abstract class Shortcode implements ShortcodeContract
13 13
 {
14
-    /**
15
-     * @var string
16
-     */
17
-    protected $partialName;
18
-
19
-    /**
20
-     * @var string
21
-     */
22
-    protected $shortcodeName;
23
-
24
-    /**
25
-     * @param string|array $atts
26
-     * @param string $type
27
-     * @return string
28
-     */
29
-    public function build($atts, array $args = [], $type = 'shortcode')
30
-    {
31
-        $this->partialName = $this->getShortcodePartialName();
32
-        $this->shortcodeName = $this->getShortcodeName();
33
-        $args = $this->normalizeArgs($args, $type);
34
-        $atts = $this->normalizeAtts($atts, $type);
35
-        $partial = glsr(Partial::class)->build($this->partialName, $atts);
36
-        $title = !empty($atts['title'])
37
-            ? $args['before_title'].$atts['title'].$args['after_title']
38
-            : '';
39
-        $debug = sprintf('<glsr-%1$s hidden data-atts=\'%2$s\'></glsr-%1$s>', $type, $atts['json']);
40
-        return $args['before_widget'].$title.$partial.$debug.$args['after_widget'];
41
-    }
42
-
43
-    /**
44
-     * @param string|array $atts
45
-     * @return string
46
-     */
47
-    public function buildShortcode($atts = [])
48
-    {
49
-        return $this->build($atts);
50
-    }
51
-
52
-    /**
53
-     * @return array
54
-     */
55
-    public function getDefaults($atts)
56
-    {
57
-        return glsr($this->getShortcodeDefaultsClassName())->restrict(wp_parse_args($atts));
58
-    }
59
-
60
-    /**
61
-     * @return array
62
-     */
63
-    public function getHideOptions()
64
-    {
65
-        $options = $this->hideOptions();
66
-        return apply_filters('site-reviews/shortcode/hide-options', $options, $this->shortcodeName);
67
-    }
68
-
69
-    /**
70
-     * @return string
71
-     */
72
-    public function getShortcodeClassName($replace = '', $search = 'Shortcode')
73
-    {
74
-        return str_replace($search, $replace, (new ReflectionClass($this))->getShortName());
75
-    }
76
-
77
-    /**
78
-     * @return string
79
-     */
80
-    public function getShortcodeDefaultsClassName()
81
-    {
82
-        return Helper::buildClassName(
83
-            $this->getShortcodeClassName('Defaults'),
84
-            'Defaults'
85
-        );
86
-    }
87
-
88
-    /**
89
-     * @return string
90
-     */
91
-    public function getShortcodeName()
92
-    {
93
-        return Str::snakeCase($this->getShortcodeClassName());
94
-    }
95
-
96
-    /**
97
-     * @return string
98
-     */
99
-    public function getShortcodePartialName()
100
-    {
101
-        return Str::dashCase($this->getShortcodeClassName());
102
-    }
103
-
104
-    /**
105
-     * @param array|string $args
106
-     * @param string $type
107
-     * @return array
108
-     */
109
-    public function normalizeArgs($args, $type = 'shortcode')
110
-    {
111
-        $args = wp_parse_args($args, [
112
-            'before_widget' => '<div class="glsr-'.$type.' '.$type.'-'.$this->partialName.'">',
113
-            'after_widget' => '</div>',
114
-            'before_title' => '<h3 class="glsr-'.$type.'-title">',
115
-            'after_title' => '</h3>',
116
-        ]);
117
-        return apply_filters('site-reviews/shortcode/args', $args, $type, $this->partialName);
118
-    }
119
-
120
-    /**
121
-     * @param array|string $atts
122
-     * @param string $type
123
-     * @return array
124
-     */
125
-    public function normalizeAtts($atts, $type = 'shortcode')
126
-    {
127
-        $atts = apply_filters('site-reviews/shortcode/atts', $atts, $type, $this->partialName);
128
-        $atts = $this->getDefaults($atts);
129
-        array_walk($atts, function (&$value, $key) {
130
-            $methodName = Helper::buildMethodName($key, 'normalize');
131
-            if (!method_exists($this, $methodName)) {
132
-                return;
133
-            }
134
-            $value = $this->$methodName($value);
135
-        });
136
-        return $atts;
137
-    }
138
-
139
-    /**
140
-     * @return array
141
-     */
142
-    abstract protected function hideOptions();
143
-
144
-    /**
145
-     * @param string $postId
146
-     * @return int|string
147
-     */
148
-    protected function normalizeAssignedTo($postId)
149
-    {
150
-        if ('parent_id' == $postId) {
151
-            $postId = intval(wp_get_post_parent_id(intval(get_the_ID())));
152
-        } elseif ('post_id' == $postId) {
153
-            $postId = intval(get_the_ID());
154
-        }
155
-        return $postId;
156
-    }
157
-
158
-    /**
159
-     * @param string $postId
160
-     * @return int|string
161
-     */
162
-    protected function normalizeAssignTo($postId)
163
-    {
164
-        return $this->normalizeAssignedTo($postId);
165
-    }
166
-
167
-    /**
168
-     * @param string|array $hide
169
-     * @return array
170
-     */
171
-    protected function normalizeHide($hide)
172
-    {
173
-        if (is_string($hide)) {
174
-            $hide = explode(',', $hide);
175
-        }
176
-        $hideKeys = array_keys($this->getHideOptions());
177
-        return array_filter(array_map('trim', $hide), function ($value) use ($hideKeys) {
178
-            return in_array($value, $hideKeys);
179
-        });
180
-    }
181
-
182
-    /**
183
-     * @param string $id
184
-     * @return string
185
-     */
186
-    protected function normalizeId($id)
187
-    {
188
-        return sanitize_title($id);
189
-    }
190
-
191
-    /**
192
-     * @param string $labels
193
-     * @return array
194
-     */
195
-    protected function normalizeLabels($labels)
196
-    {
197
-        $defaults = [
198
-            __('Excellent', 'site-reviews'),
199
-            __('Very good', 'site-reviews'),
200
-            __('Average', 'site-reviews'),
201
-            __('Poor', 'site-reviews'),
202
-            __('Terrible', 'site-reviews'),
203
-        ];
204
-        $maxRating = glsr()->constant('MAX_RATING', Rating::class);
205
-        $defaults = array_pad(array_slice($defaults, 0, $maxRating), $maxRating, '');
206
-        $labels = array_map('trim', explode(',', $labels));
207
-        foreach ($defaults as $i => $label) {
208
-            if (empty($labels[$i])) {
209
-                continue;
210
-            }
211
-            $defaults[$i] = $labels[$i];
212
-        }
213
-        return array_combine(range($maxRating, 1), $defaults);
214
-    }
215
-
216
-    /**
217
-     * @param string $schema
218
-     * @return bool
219
-     */
220
-    protected function normalizeSchema($schema)
221
-    {
222
-        return wp_validate_boolean($schema);
223
-    }
224
-
225
-    /**
226
-     * @param string $text
227
-     * @return string
228
-     */
229
-    protected function normalizeText($text)
230
-    {
231
-        return trim($text);
232
-    }
14
+	/**
15
+	 * @var string
16
+	 */
17
+	protected $partialName;
18
+
19
+	/**
20
+	 * @var string
21
+	 */
22
+	protected $shortcodeName;
23
+
24
+	/**
25
+	 * @param string|array $atts
26
+	 * @param string $type
27
+	 * @return string
28
+	 */
29
+	public function build($atts, array $args = [], $type = 'shortcode')
30
+	{
31
+		$this->partialName = $this->getShortcodePartialName();
32
+		$this->shortcodeName = $this->getShortcodeName();
33
+		$args = $this->normalizeArgs($args, $type);
34
+		$atts = $this->normalizeAtts($atts, $type);
35
+		$partial = glsr(Partial::class)->build($this->partialName, $atts);
36
+		$title = !empty($atts['title'])
37
+			? $args['before_title'].$atts['title'].$args['after_title']
38
+			: '';
39
+		$debug = sprintf('<glsr-%1$s hidden data-atts=\'%2$s\'></glsr-%1$s>', $type, $atts['json']);
40
+		return $args['before_widget'].$title.$partial.$debug.$args['after_widget'];
41
+	}
42
+
43
+	/**
44
+	 * @param string|array $atts
45
+	 * @return string
46
+	 */
47
+	public function buildShortcode($atts = [])
48
+	{
49
+		return $this->build($atts);
50
+	}
51
+
52
+	/**
53
+	 * @return array
54
+	 */
55
+	public function getDefaults($atts)
56
+	{
57
+		return glsr($this->getShortcodeDefaultsClassName())->restrict(wp_parse_args($atts));
58
+	}
59
+
60
+	/**
61
+	 * @return array
62
+	 */
63
+	public function getHideOptions()
64
+	{
65
+		$options = $this->hideOptions();
66
+		return apply_filters('site-reviews/shortcode/hide-options', $options, $this->shortcodeName);
67
+	}
68
+
69
+	/**
70
+	 * @return string
71
+	 */
72
+	public function getShortcodeClassName($replace = '', $search = 'Shortcode')
73
+	{
74
+		return str_replace($search, $replace, (new ReflectionClass($this))->getShortName());
75
+	}
76
+
77
+	/**
78
+	 * @return string
79
+	 */
80
+	public function getShortcodeDefaultsClassName()
81
+	{
82
+		return Helper::buildClassName(
83
+			$this->getShortcodeClassName('Defaults'),
84
+			'Defaults'
85
+		);
86
+	}
87
+
88
+	/**
89
+	 * @return string
90
+	 */
91
+	public function getShortcodeName()
92
+	{
93
+		return Str::snakeCase($this->getShortcodeClassName());
94
+	}
95
+
96
+	/**
97
+	 * @return string
98
+	 */
99
+	public function getShortcodePartialName()
100
+	{
101
+		return Str::dashCase($this->getShortcodeClassName());
102
+	}
103
+
104
+	/**
105
+	 * @param array|string $args
106
+	 * @param string $type
107
+	 * @return array
108
+	 */
109
+	public function normalizeArgs($args, $type = 'shortcode')
110
+	{
111
+		$args = wp_parse_args($args, [
112
+			'before_widget' => '<div class="glsr-'.$type.' '.$type.'-'.$this->partialName.'">',
113
+			'after_widget' => '</div>',
114
+			'before_title' => '<h3 class="glsr-'.$type.'-title">',
115
+			'after_title' => '</h3>',
116
+		]);
117
+		return apply_filters('site-reviews/shortcode/args', $args, $type, $this->partialName);
118
+	}
119
+
120
+	/**
121
+	 * @param array|string $atts
122
+	 * @param string $type
123
+	 * @return array
124
+	 */
125
+	public function normalizeAtts($atts, $type = 'shortcode')
126
+	{
127
+		$atts = apply_filters('site-reviews/shortcode/atts', $atts, $type, $this->partialName);
128
+		$atts = $this->getDefaults($atts);
129
+		array_walk($atts, function (&$value, $key) {
130
+			$methodName = Helper::buildMethodName($key, 'normalize');
131
+			if (!method_exists($this, $methodName)) {
132
+				return;
133
+			}
134
+			$value = $this->$methodName($value);
135
+		});
136
+		return $atts;
137
+	}
138
+
139
+	/**
140
+	 * @return array
141
+	 */
142
+	abstract protected function hideOptions();
143
+
144
+	/**
145
+	 * @param string $postId
146
+	 * @return int|string
147
+	 */
148
+	protected function normalizeAssignedTo($postId)
149
+	{
150
+		if ('parent_id' == $postId) {
151
+			$postId = intval(wp_get_post_parent_id(intval(get_the_ID())));
152
+		} elseif ('post_id' == $postId) {
153
+			$postId = intval(get_the_ID());
154
+		}
155
+		return $postId;
156
+	}
157
+
158
+	/**
159
+	 * @param string $postId
160
+	 * @return int|string
161
+	 */
162
+	protected function normalizeAssignTo($postId)
163
+	{
164
+		return $this->normalizeAssignedTo($postId);
165
+	}
166
+
167
+	/**
168
+	 * @param string|array $hide
169
+	 * @return array
170
+	 */
171
+	protected function normalizeHide($hide)
172
+	{
173
+		if (is_string($hide)) {
174
+			$hide = explode(',', $hide);
175
+		}
176
+		$hideKeys = array_keys($this->getHideOptions());
177
+		return array_filter(array_map('trim', $hide), function ($value) use ($hideKeys) {
178
+			return in_array($value, $hideKeys);
179
+		});
180
+	}
181
+
182
+	/**
183
+	 * @param string $id
184
+	 * @return string
185
+	 */
186
+	protected function normalizeId($id)
187
+	{
188
+		return sanitize_title($id);
189
+	}
190
+
191
+	/**
192
+	 * @param string $labels
193
+	 * @return array
194
+	 */
195
+	protected function normalizeLabels($labels)
196
+	{
197
+		$defaults = [
198
+			__('Excellent', 'site-reviews'),
199
+			__('Very good', 'site-reviews'),
200
+			__('Average', 'site-reviews'),
201
+			__('Poor', 'site-reviews'),
202
+			__('Terrible', 'site-reviews'),
203
+		];
204
+		$maxRating = glsr()->constant('MAX_RATING', Rating::class);
205
+		$defaults = array_pad(array_slice($defaults, 0, $maxRating), $maxRating, '');
206
+		$labels = array_map('trim', explode(',', $labels));
207
+		foreach ($defaults as $i => $label) {
208
+			if (empty($labels[$i])) {
209
+				continue;
210
+			}
211
+			$defaults[$i] = $labels[$i];
212
+		}
213
+		return array_combine(range($maxRating, 1), $defaults);
214
+	}
215
+
216
+	/**
217
+	 * @param string $schema
218
+	 * @return bool
219
+	 */
220
+	protected function normalizeSchema($schema)
221
+	{
222
+		return wp_validate_boolean($schema);
223
+	}
224
+
225
+	/**
226
+	 * @param string $text
227
+	 * @return string
228
+	 */
229
+	protected function normalizeText($text)
230
+	{
231
+		return trim($text);
232
+	}
233 233
 }
Please login to merge, or discard this patch.