@@ -21,111 +21,111 @@ |
||
21 | 21 | |
22 | 22 | class Actions implements HooksContract |
23 | 23 | { |
24 | - protected $about; |
|
25 | - protected $admin; |
|
26 | - protected $app; |
|
27 | - protected $blocks; |
|
28 | - protected $console; |
|
29 | - protected $editor; |
|
30 | - protected $listtable; |
|
31 | - protected $menu; |
|
32 | - protected $main; |
|
33 | - protected $notices; |
|
34 | - protected $public; |
|
35 | - protected $review; |
|
36 | - protected $router; |
|
37 | - protected $settings; |
|
38 | - protected $taxonomy; |
|
39 | - protected $translator; |
|
40 | - protected $trustalyze; |
|
41 | - protected $welcome; |
|
24 | + protected $about; |
|
25 | + protected $admin; |
|
26 | + protected $app; |
|
27 | + protected $blocks; |
|
28 | + protected $console; |
|
29 | + protected $editor; |
|
30 | + protected $listtable; |
|
31 | + protected $menu; |
|
32 | + protected $main; |
|
33 | + protected $notices; |
|
34 | + protected $public; |
|
35 | + protected $review; |
|
36 | + protected $router; |
|
37 | + protected $settings; |
|
38 | + protected $taxonomy; |
|
39 | + protected $translator; |
|
40 | + protected $trustalyze; |
|
41 | + protected $welcome; |
|
42 | 42 | |
43 | - public function __construct(Application $app ) { |
|
44 | - $this->app = $app; |
|
45 | - $this->admin = $app->make(AdminController::class); |
|
46 | - $this->blocks = $app->make(BlocksController::class); |
|
47 | - $this->console = $app->make(Console::class); |
|
48 | - $this->editor = $app->make(EditorController::class); |
|
49 | - $this->listtable = $app->make(ListTableController::class); |
|
50 | - $this->main = $app->make(MainController::class); |
|
51 | - $this->menu = $app->make(MenuController::class); |
|
52 | - $this->notices = $app->make(NoticeController::class); |
|
53 | - $this->public = $app->make(PublicController::class); |
|
54 | - $this->review = $app->make(ReviewController::class); |
|
55 | - $this->router = $app->make(Router::class); |
|
56 | - $this->settings = $app->make(SettingsController::class); |
|
57 | - $this->taxonomy = $app->make(TaxonomyController::class); |
|
58 | - $this->translator = $app->make(TranslationController::class); |
|
59 | - $this->trustalyze = $app->make(TrustalyzeController::class); |
|
60 | - $this->welcome = $app->make(WelcomeController::class); |
|
61 | - } |
|
43 | + public function __construct(Application $app ) { |
|
44 | + $this->app = $app; |
|
45 | + $this->admin = $app->make(AdminController::class); |
|
46 | + $this->blocks = $app->make(BlocksController::class); |
|
47 | + $this->console = $app->make(Console::class); |
|
48 | + $this->editor = $app->make(EditorController::class); |
|
49 | + $this->listtable = $app->make(ListTableController::class); |
|
50 | + $this->main = $app->make(MainController::class); |
|
51 | + $this->menu = $app->make(MenuController::class); |
|
52 | + $this->notices = $app->make(NoticeController::class); |
|
53 | + $this->public = $app->make(PublicController::class); |
|
54 | + $this->review = $app->make(ReviewController::class); |
|
55 | + $this->router = $app->make(Router::class); |
|
56 | + $this->settings = $app->make(SettingsController::class); |
|
57 | + $this->taxonomy = $app->make(TaxonomyController::class); |
|
58 | + $this->translator = $app->make(TranslationController::class); |
|
59 | + $this->trustalyze = $app->make(TrustalyzeController::class); |
|
60 | + $this->welcome = $app->make(WelcomeController::class); |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * @return void |
|
65 | - */ |
|
66 | - public function run() |
|
67 | - { |
|
68 | - add_action('admin_enqueue_scripts', [$this->admin, 'enqueueAssets']); |
|
69 | - add_action('admin_init', [$this->admin, 'registerTinymcePopups']); |
|
70 | - add_action('media_buttons', [$this->admin, 'renderTinymceButton'], 11); |
|
71 | - add_action('admin_init', [$this->admin, 'runMigrations']); |
|
72 | - add_action('plugins_loaded', [$this->app, 'getDefaults'], 11); |
|
73 | - add_action('plugins_loaded', [$this->app, 'registerAddons']); |
|
74 | - add_action('plugins_loaded', [$this->app, 'registerLanguages']); |
|
75 | - add_action('plugins_loaded', [$this->app, 'registerReviewTypes']); |
|
76 | - add_action('admin_init', [$this->app, 'setDefaults']); |
|
77 | - add_action('init', [$this->blocks, 'registerAssets'], 9); |
|
78 | - add_action('init', [$this->blocks, 'registerBlocks']); |
|
79 | - add_action('admin_footer', [$this->console, 'logOnce']); |
|
80 | - add_action('wp_footer', [$this->console, 'logOnce']); |
|
81 | - add_action('add_meta_boxes_'.Application::POST_TYPE, [$this->editor, 'registerMetaBoxes']); |
|
82 | - add_action('admin_print_scripts', [$this->editor, 'removeAutosave'], 999); |
|
83 | - add_action('admin_menu', [$this->editor, 'removeMetaBoxes']); |
|
84 | - add_action('current_screen', [$this->editor, 'removePostTypeSupport']); |
|
85 | - add_action('post_submitbox_misc_actions', [$this->editor, 'renderPinnedInPublishMetaBox']); |
|
86 | - add_action('admin_head', [$this->editor, 'renderReviewFields']); |
|
87 | - add_action('admin_action_revert', [$this->editor, 'revertReview']); |
|
88 | - add_action('save_post_'.Application::POST_TYPE, [$this->editor, 'saveMetaboxes'], 10, 3); |
|
89 | - add_action('admin_action_approve', [$this->listtable, 'approve']); |
|
90 | - add_action('bulk_edit_custom_box', [$this->listtable, 'renderBulkEditFields'], 10, 2); |
|
91 | - add_action('restrict_manage_posts', [$this->listtable, 'renderColumnFilters']); |
|
92 | - add_action('manage_'.Application::POST_TYPE.'_posts_custom_column', [$this->listtable, 'renderColumnValues'], 10, 2); |
|
93 | - add_action('save_post_'.Application::POST_TYPE, [$this->listtable, 'saveBulkEditFields']); |
|
94 | - add_action('pre_get_posts', [$this->listtable, 'setQueryForColumn']); |
|
95 | - add_action('admin_action_unapprove', [$this->listtable, 'unapprove']); |
|
96 | - add_action('init', [$this->main, 'registerPostType'], 8); |
|
97 | - add_action('init', [$this->main, 'registerShortcodes']); |
|
98 | - add_action('init', [$this->main, 'registerTaxonomy']); |
|
99 | - add_action('widgets_init', [$this->main, 'registerWidgets']); |
|
100 | - add_action('admin_menu', [$this->menu, 'registerMenuCount']); |
|
101 | - add_action('admin_menu', [$this->menu, 'registerSubMenus']); |
|
102 | - add_action('admin_init', [$this->menu, 'setCustomPermissions'], 999); |
|
103 | - add_action('admin_notices', [$this->notices, 'filterAdminNotices']); |
|
104 | - add_action('wp_enqueue_scripts', [$this->public, 'enqueueAssets'], 999); |
|
105 | - add_filter('site-reviews/builder', [$this->public, 'modifyBuilder']); |
|
106 | - add_action('wp_footer', [$this->public, 'renderSchema']); |
|
107 | - add_action('set_object_terms', [$this->review, 'onAfterChangeCategory'], 10, 6); |
|
108 | - add_action('transition_post_status', [$this->review, 'onAfterChangeStatus'], 10, 3); |
|
109 | - add_action('site-reviews/review/created', [$this->review, 'onAfterCreate']); |
|
110 | - add_action('before_delete_post', [$this->review, 'onBeforeDelete']); |
|
111 | - add_action('update_postmeta', [$this->review, 'onBeforeUpdate'], 10, 4); |
|
112 | - add_action('admin_init', [$this->router, 'routeAdminPostRequest']); |
|
113 | - add_action('wp_ajax_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest']); |
|
114 | - add_action('wp_ajax_nopriv_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest']); |
|
115 | - add_action('init', [$this->router, 'routePublicPostRequest']); |
|
116 | - add_action('admin_init', [$this->settings, 'registerSettings']); |
|
117 | - add_action(Application::TAXONOMY.'_term_edit_form_top', [$this->taxonomy, 'disableParents']); |
|
118 | - add_action(Application::TAXONOMY.'_term_new_form_tag', [$this->taxonomy, 'disableParents']); |
|
119 | - add_action(Application::TAXONOMY.'_add_form_fields', [$this->taxonomy, 'enableParents']); |
|
120 | - add_action(Application::TAXONOMY.'_edit_form', [$this->taxonomy, 'enableParents']); |
|
121 | - add_action('restrict_manage_posts', [$this->taxonomy, 'renderTaxonomyFilter'], 9); |
|
122 | - add_action('set_object_terms', [$this->taxonomy, 'restrictTermSelection'], 9, 6); |
|
123 | - add_action('admin_enqueue_scripts', [$this->translator, 'translatePostStatusLabels']); |
|
124 | - add_action('site-reviews/review/created', [$this->trustalyze, 'onCreated']); |
|
125 | - add_action('site-reviews/review/reverted', [$this->trustalyze, 'onReverted']); |
|
126 | - add_action('site-reviews/review/saved', [$this->trustalyze, 'onSaved']); |
|
127 | - add_action('updated_postmeta', [$this->trustalyze, 'onUpdatedMeta'], 10, 3); |
|
128 | - add_action('activated_plugin', [$this->welcome, 'redirectOnActivation'], 10, 2); |
|
129 | - add_action('admin_menu', [$this->welcome, 'registerPage']); |
|
130 | - } |
|
63 | + /** |
|
64 | + * @return void |
|
65 | + */ |
|
66 | + public function run() |
|
67 | + { |
|
68 | + add_action('admin_enqueue_scripts', [$this->admin, 'enqueueAssets']); |
|
69 | + add_action('admin_init', [$this->admin, 'registerTinymcePopups']); |
|
70 | + add_action('media_buttons', [$this->admin, 'renderTinymceButton'], 11); |
|
71 | + add_action('admin_init', [$this->admin, 'runMigrations']); |
|
72 | + add_action('plugins_loaded', [$this->app, 'getDefaults'], 11); |
|
73 | + add_action('plugins_loaded', [$this->app, 'registerAddons']); |
|
74 | + add_action('plugins_loaded', [$this->app, 'registerLanguages']); |
|
75 | + add_action('plugins_loaded', [$this->app, 'registerReviewTypes']); |
|
76 | + add_action('admin_init', [$this->app, 'setDefaults']); |
|
77 | + add_action('init', [$this->blocks, 'registerAssets'], 9); |
|
78 | + add_action('init', [$this->blocks, 'registerBlocks']); |
|
79 | + add_action('admin_footer', [$this->console, 'logOnce']); |
|
80 | + add_action('wp_footer', [$this->console, 'logOnce']); |
|
81 | + add_action('add_meta_boxes_'.Application::POST_TYPE, [$this->editor, 'registerMetaBoxes']); |
|
82 | + add_action('admin_print_scripts', [$this->editor, 'removeAutosave'], 999); |
|
83 | + add_action('admin_menu', [$this->editor, 'removeMetaBoxes']); |
|
84 | + add_action('current_screen', [$this->editor, 'removePostTypeSupport']); |
|
85 | + add_action('post_submitbox_misc_actions', [$this->editor, 'renderPinnedInPublishMetaBox']); |
|
86 | + add_action('admin_head', [$this->editor, 'renderReviewFields']); |
|
87 | + add_action('admin_action_revert', [$this->editor, 'revertReview']); |
|
88 | + add_action('save_post_'.Application::POST_TYPE, [$this->editor, 'saveMetaboxes'], 10, 3); |
|
89 | + add_action('admin_action_approve', [$this->listtable, 'approve']); |
|
90 | + add_action('bulk_edit_custom_box', [$this->listtable, 'renderBulkEditFields'], 10, 2); |
|
91 | + add_action('restrict_manage_posts', [$this->listtable, 'renderColumnFilters']); |
|
92 | + add_action('manage_'.Application::POST_TYPE.'_posts_custom_column', [$this->listtable, 'renderColumnValues'], 10, 2); |
|
93 | + add_action('save_post_'.Application::POST_TYPE, [$this->listtable, 'saveBulkEditFields']); |
|
94 | + add_action('pre_get_posts', [$this->listtable, 'setQueryForColumn']); |
|
95 | + add_action('admin_action_unapprove', [$this->listtable, 'unapprove']); |
|
96 | + add_action('init', [$this->main, 'registerPostType'], 8); |
|
97 | + add_action('init', [$this->main, 'registerShortcodes']); |
|
98 | + add_action('init', [$this->main, 'registerTaxonomy']); |
|
99 | + add_action('widgets_init', [$this->main, 'registerWidgets']); |
|
100 | + add_action('admin_menu', [$this->menu, 'registerMenuCount']); |
|
101 | + add_action('admin_menu', [$this->menu, 'registerSubMenus']); |
|
102 | + add_action('admin_init', [$this->menu, 'setCustomPermissions'], 999); |
|
103 | + add_action('admin_notices', [$this->notices, 'filterAdminNotices']); |
|
104 | + add_action('wp_enqueue_scripts', [$this->public, 'enqueueAssets'], 999); |
|
105 | + add_filter('site-reviews/builder', [$this->public, 'modifyBuilder']); |
|
106 | + add_action('wp_footer', [$this->public, 'renderSchema']); |
|
107 | + add_action('set_object_terms', [$this->review, 'onAfterChangeCategory'], 10, 6); |
|
108 | + add_action('transition_post_status', [$this->review, 'onAfterChangeStatus'], 10, 3); |
|
109 | + add_action('site-reviews/review/created', [$this->review, 'onAfterCreate']); |
|
110 | + add_action('before_delete_post', [$this->review, 'onBeforeDelete']); |
|
111 | + add_action('update_postmeta', [$this->review, 'onBeforeUpdate'], 10, 4); |
|
112 | + add_action('admin_init', [$this->router, 'routeAdminPostRequest']); |
|
113 | + add_action('wp_ajax_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest']); |
|
114 | + add_action('wp_ajax_nopriv_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest']); |
|
115 | + add_action('init', [$this->router, 'routePublicPostRequest']); |
|
116 | + add_action('admin_init', [$this->settings, 'registerSettings']); |
|
117 | + add_action(Application::TAXONOMY.'_term_edit_form_top', [$this->taxonomy, 'disableParents']); |
|
118 | + add_action(Application::TAXONOMY.'_term_new_form_tag', [$this->taxonomy, 'disableParents']); |
|
119 | + add_action(Application::TAXONOMY.'_add_form_fields', [$this->taxonomy, 'enableParents']); |
|
120 | + add_action(Application::TAXONOMY.'_edit_form', [$this->taxonomy, 'enableParents']); |
|
121 | + add_action('restrict_manage_posts', [$this->taxonomy, 'renderTaxonomyFilter'], 9); |
|
122 | + add_action('set_object_terms', [$this->taxonomy, 'restrictTermSelection'], 9, 6); |
|
123 | + add_action('admin_enqueue_scripts', [$this->translator, 'translatePostStatusLabels']); |
|
124 | + add_action('site-reviews/review/created', [$this->trustalyze, 'onCreated']); |
|
125 | + add_action('site-reviews/review/reverted', [$this->trustalyze, 'onReverted']); |
|
126 | + add_action('site-reviews/review/saved', [$this->trustalyze, 'onSaved']); |
|
127 | + add_action('updated_postmeta', [$this->trustalyze, 'onUpdatedMeta'], 10, 3); |
|
128 | + add_action('activated_plugin', [$this->welcome, 'redirectOnActivation'], 10, 2); |
|
129 | + add_action('admin_menu', [$this->welcome, 'registerPage']); |
|
130 | + } |
|
131 | 131 | } |
@@ -15,72 +15,72 @@ |
||
15 | 15 | |
16 | 16 | class Filters implements HooksContract |
17 | 17 | { |
18 | - protected $admin; |
|
19 | - protected $app; |
|
20 | - protected $basename; |
|
21 | - protected $blocks; |
|
22 | - protected $editor; |
|
23 | - protected $listtable; |
|
24 | - protected $public; |
|
25 | - protected $translator; |
|
26 | - protected $trustalyze; |
|
27 | - protected $welcome; |
|
18 | + protected $admin; |
|
19 | + protected $app; |
|
20 | + protected $basename; |
|
21 | + protected $blocks; |
|
22 | + protected $editor; |
|
23 | + protected $listtable; |
|
24 | + protected $public; |
|
25 | + protected $translator; |
|
26 | + protected $trustalyze; |
|
27 | + protected $welcome; |
|
28 | 28 | |
29 | - public function __construct(Application $app) |
|
30 | - { |
|
31 | - $this->app = $app; |
|
32 | - $this->admin = $app->make(AdminController::class); |
|
33 | - $this->basename = plugin_basename($app->file); |
|
34 | - $this->blocks = $app->make(BlocksController::class); |
|
35 | - $this->editor = $app->make(EditorController::class); |
|
36 | - $this->listtable = $app->make(ListTableController::class); |
|
37 | - $this->public = $app->make(PublicController::class); |
|
38 | - $this->translator = $app->make(TranslationController::class); |
|
39 | - $this->trustalyze = $app->make(TrustalyzeController::class); |
|
40 | - $this->welcome = $app->make(WelcomeController::class); |
|
41 | - } |
|
29 | + public function __construct(Application $app) |
|
30 | + { |
|
31 | + $this->app = $app; |
|
32 | + $this->admin = $app->make(AdminController::class); |
|
33 | + $this->basename = plugin_basename($app->file); |
|
34 | + $this->blocks = $app->make(BlocksController::class); |
|
35 | + $this->editor = $app->make(EditorController::class); |
|
36 | + $this->listtable = $app->make(ListTableController::class); |
|
37 | + $this->public = $app->make(PublicController::class); |
|
38 | + $this->translator = $app->make(TranslationController::class); |
|
39 | + $this->trustalyze = $app->make(TrustalyzeController::class); |
|
40 | + $this->welcome = $app->make(WelcomeController::class); |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @return void |
|
45 | - */ |
|
46 | - public function run() |
|
47 | - { |
|
48 | - add_filter('map_meta_cap', [$this->admin, 'filterCreateCapability'], 10, 2); |
|
49 | - add_filter('mce_external_plugins', [$this->admin, 'filterTinymcePlugins'], 15); |
|
50 | - add_filter('plugin_action_links_'.$this->basename, [$this->admin, 'filterActionLinks']); |
|
51 | - add_filter('dashboard_glance_items', [$this->admin, 'filterDashboardGlanceItems']); |
|
52 | - add_filter('block_categories', [$this->blocks, 'filterBlockCategories']); |
|
53 | - add_filter('classic_editor_enabled_editors_for_post_type', [$this->blocks, 'filterEnabledEditors'], 10, 2); |
|
54 | - add_filter('use_block_editor_for_post_type', [$this->blocks, 'filterUseBlockEditor'], 10, 2); |
|
55 | - add_filter('wp_editor_settings', [$this->editor, 'filterEditorSettings']); |
|
56 | - add_filter('the_editor', [$this->editor, 'filterEditorTextarea']); |
|
57 | - add_filter('is_protected_meta', [$this->editor, 'filterIsProtectedMeta'], 10, 3); |
|
58 | - add_filter('post_updated_messages', [$this->editor, 'filterUpdateMessages']); |
|
59 | - add_filter('manage_'.Application::POST_TYPE.'_posts_columns', [$this->listtable, 'filterColumnsForPostType']); |
|
60 | - add_filter('post_date_column_status', [$this->listtable, 'filterDateColumnStatus'], 10, 2); |
|
61 | - add_filter('default_hidden_columns', [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2); |
|
62 | - add_filter('post_row_actions', [$this->listtable, 'filterRowActions'], 10, 2); |
|
63 | - add_filter('manage_edit-'.Application::POST_TYPE.'_sortable_columns', [$this->listtable, 'filterSortableColumns']); |
|
64 | - add_filter('script_loader_tag', [$this->public, 'filterEnqueuedScripts'], 10, 2); |
|
65 | - add_filter('site-reviews/config/forms/submission-form', [$this->public, 'filterFieldOrder'], 11); |
|
66 | - add_filter('site-reviews/render/view', [$this->public, 'filterRenderView']); |
|
67 | - add_filter('bulk_post_updated_messages', [$this->translator, 'filterBulkUpdateMessages'], 10, 2); |
|
68 | - add_filter('gettext', [$this->translator, 'filterGettext'], 9, 3); |
|
69 | - add_filter('site-reviews/gettext/site-reviews', [$this->translator, 'filterGettextSiteReviews'], 10, 2); |
|
70 | - add_filter('gettext_with_context', [$this->translator, 'filterGettextWithContext'], 9, 4); |
|
71 | - add_filter('site-reviews/gettext_with_context/site-reviews', [$this->translator, 'filterGettextWithContextSiteReviews'], 10, 3); |
|
72 | - add_filter('ngettext', [$this->translator, 'filterNgettext'], 9, 5); |
|
73 | - add_filter('site-reviews/ngettext/site-reviews', [$this->translator, 'filterNgettextSiteReviews'], 10, 4); |
|
74 | - add_filter('ngettext_with_context', [$this->translator, 'filterNgettextWithContext'], 9, 6); |
|
75 | - add_filter('site-reviews/ngettext_with_context/site-reviews', [$this->translator, 'filterNgettextWithContextSiteReviews'], 10, 5); |
|
76 | - add_filter('display_post_states', [$this->translator, 'filterPostStates'], 10, 2); |
|
77 | - add_filter('site-reviews/gettext/default', [$this->translator, 'filterPostStatusLabels'], 10, 2); |
|
78 | - add_filter('site-reviews/gettext_with_context/default', [$this->translator, 'filterPostStatusLabels'], 10, 2); |
|
79 | - add_filter('site-reviews/ngettext/default', [$this->translator, 'filterPostStatusText'], 10, 4); |
|
80 | - add_filter('site-reviews/settings/callback', [$this->trustalyze, 'filterSettingsCallback']); |
|
81 | - add_filter('site-reviews/interpolate/partials/form/table-row-multiple', [$this->trustalyze, 'filterSettingsTableRow'], 10, 3); |
|
82 | - add_filter('plugin_action_links_'.$this->basename, [$this->welcome, 'filterActionLinks'], 9); |
|
83 | - add_filter('admin_title', [$this->welcome, 'filterAdminTitle']); |
|
84 | - add_filter('admin_footer_text', [$this->welcome, 'filterFooterText']); |
|
85 | - } |
|
43 | + /** |
|
44 | + * @return void |
|
45 | + */ |
|
46 | + public function run() |
|
47 | + { |
|
48 | + add_filter('map_meta_cap', [$this->admin, 'filterCreateCapability'], 10, 2); |
|
49 | + add_filter('mce_external_plugins', [$this->admin, 'filterTinymcePlugins'], 15); |
|
50 | + add_filter('plugin_action_links_'.$this->basename, [$this->admin, 'filterActionLinks']); |
|
51 | + add_filter('dashboard_glance_items', [$this->admin, 'filterDashboardGlanceItems']); |
|
52 | + add_filter('block_categories', [$this->blocks, 'filterBlockCategories']); |
|
53 | + add_filter('classic_editor_enabled_editors_for_post_type', [$this->blocks, 'filterEnabledEditors'], 10, 2); |
|
54 | + add_filter('use_block_editor_for_post_type', [$this->blocks, 'filterUseBlockEditor'], 10, 2); |
|
55 | + add_filter('wp_editor_settings', [$this->editor, 'filterEditorSettings']); |
|
56 | + add_filter('the_editor', [$this->editor, 'filterEditorTextarea']); |
|
57 | + add_filter('is_protected_meta', [$this->editor, 'filterIsProtectedMeta'], 10, 3); |
|
58 | + add_filter('post_updated_messages', [$this->editor, 'filterUpdateMessages']); |
|
59 | + add_filter('manage_'.Application::POST_TYPE.'_posts_columns', [$this->listtable, 'filterColumnsForPostType']); |
|
60 | + add_filter('post_date_column_status', [$this->listtable, 'filterDateColumnStatus'], 10, 2); |
|
61 | + add_filter('default_hidden_columns', [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2); |
|
62 | + add_filter('post_row_actions', [$this->listtable, 'filterRowActions'], 10, 2); |
|
63 | + add_filter('manage_edit-'.Application::POST_TYPE.'_sortable_columns', [$this->listtable, 'filterSortableColumns']); |
|
64 | + add_filter('script_loader_tag', [$this->public, 'filterEnqueuedScripts'], 10, 2); |
|
65 | + add_filter('site-reviews/config/forms/submission-form', [$this->public, 'filterFieldOrder'], 11); |
|
66 | + add_filter('site-reviews/render/view', [$this->public, 'filterRenderView']); |
|
67 | + add_filter('bulk_post_updated_messages', [$this->translator, 'filterBulkUpdateMessages'], 10, 2); |
|
68 | + add_filter('gettext', [$this->translator, 'filterGettext'], 9, 3); |
|
69 | + add_filter('site-reviews/gettext/site-reviews', [$this->translator, 'filterGettextSiteReviews'], 10, 2); |
|
70 | + add_filter('gettext_with_context', [$this->translator, 'filterGettextWithContext'], 9, 4); |
|
71 | + add_filter('site-reviews/gettext_with_context/site-reviews', [$this->translator, 'filterGettextWithContextSiteReviews'], 10, 3); |
|
72 | + add_filter('ngettext', [$this->translator, 'filterNgettext'], 9, 5); |
|
73 | + add_filter('site-reviews/ngettext/site-reviews', [$this->translator, 'filterNgettextSiteReviews'], 10, 4); |
|
74 | + add_filter('ngettext_with_context', [$this->translator, 'filterNgettextWithContext'], 9, 6); |
|
75 | + add_filter('site-reviews/ngettext_with_context/site-reviews', [$this->translator, 'filterNgettextWithContextSiteReviews'], 10, 5); |
|
76 | + add_filter('display_post_states', [$this->translator, 'filterPostStates'], 10, 2); |
|
77 | + add_filter('site-reviews/gettext/default', [$this->translator, 'filterPostStatusLabels'], 10, 2); |
|
78 | + add_filter('site-reviews/gettext_with_context/default', [$this->translator, 'filterPostStatusLabels'], 10, 2); |
|
79 | + add_filter('site-reviews/ngettext/default', [$this->translator, 'filterPostStatusText'], 10, 4); |
|
80 | + add_filter('site-reviews/settings/callback', [$this->trustalyze, 'filterSettingsCallback']); |
|
81 | + add_filter('site-reviews/interpolate/partials/form/table-row-multiple', [$this->trustalyze, 'filterSettingsTableRow'], 10, 3); |
|
82 | + add_filter('plugin_action_links_'.$this->basename, [$this->welcome, 'filterActionLinks'], 9); |
|
83 | + add_filter('admin_title', [$this->welcome, 'filterAdminTitle']); |
|
84 | + add_filter('admin_footer_text', [$this->welcome, 'filterFooterText']); |
|
85 | + } |
|
86 | 86 | } |
@@ -12,231 +12,231 @@ |
||
12 | 12 | |
13 | 13 | class TrustalyzeController extends Controller |
14 | 14 | { |
15 | - protected $apiKey = 'settings.general.trustalyze_serial'; |
|
16 | - protected $emailKey = 'settings.general.trustalyze_email'; |
|
17 | - protected $enabledKey = 'settings.general.trustalyze'; |
|
18 | - protected $trustalyzeKey = '_glsr_trustalyze'; |
|
19 | - |
|
20 | - /** |
|
21 | - * @return array |
|
22 | - * @filter site-reviews/settings/callback |
|
23 | - */ |
|
24 | - public function filterSettingsCallback(array $settings) |
|
25 | - { |
|
26 | - if ('yes' !== Arr::get($settings, $this->enabledKey)) { |
|
27 | - return $settings; |
|
28 | - } |
|
29 | - $isApiKeyModified = $this->isEmptyOrModified($this->apiKey, $settings); |
|
30 | - $isEmailModified = $this->isEmptyOrModified($this->emailKey, $settings); |
|
31 | - $isAccountVerified = glsr(OptionManager::class)->getWP($this->trustalyzeKey, false); |
|
32 | - if (!$isAccountVerified || $isApiKeyModified || $isEmailModified) { |
|
33 | - $settings = $this->sanitizeTrustalyzeSettings($settings); |
|
34 | - } |
|
35 | - return $settings; |
|
36 | - } |
|
37 | - |
|
38 | - /** |
|
39 | - * @param string $template |
|
40 | - * @return array |
|
41 | - * @filter site-reviews/interpolate/partials/form/table-row-multiple |
|
42 | - */ |
|
43 | - public function filterSettingsTableRow(array $context, $template, array $data) |
|
44 | - { |
|
45 | - if ($this->enabledKey !== Arr::get($data, 'field.path')) { |
|
46 | - return $context; |
|
47 | - } |
|
48 | - $trustalyzeProductType = glsr(OptionManager::class)->getWP($this->trustalyzeKey); |
|
49 | - if ('P' === $trustalyzeProductType) { |
|
50 | - return $context; |
|
51 | - } |
|
52 | - if ('F' === $trustalyzeProductType && 'yes' === glsr_get_option('general.trustalyze')) { |
|
53 | - $button = $this->buildUpgradeButton(); |
|
54 | - } else { |
|
55 | - $button = $this->buildCreateButton(); |
|
56 | - } |
|
57 | - $context['field'].= $button; |
|
58 | - return $context; |
|
59 | - } |
|
60 | - |
|
61 | - /** |
|
62 | - * Triggered when a review is created. |
|
63 | - * @return void |
|
64 | - * @action site-reviews/review/created |
|
65 | - */ |
|
66 | - public function onCreated(Review $review) |
|
67 | - { |
|
68 | - if (!$this->canPostReview($review)) { |
|
69 | - return; |
|
70 | - } |
|
71 | - $trustalyze = glsr(Trustalyze::class)->sendReview($review); |
|
72 | - if ($trustalyze->success) { |
|
73 | - glsr(Database::class)->set($review->ID, 'trustalyze', $trustalyze->review_id); |
|
74 | - } |
|
75 | - } |
|
76 | - |
|
77 | - /** |
|
78 | - * Triggered when a review is reverted to its original title/content/date_timestamp. |
|
79 | - * @return void |
|
80 | - * @action site-reviews/review/reverted |
|
81 | - */ |
|
82 | - public function onReverted(Review $review) |
|
83 | - { |
|
84 | - if (!$this->canPostReview($review)) { |
|
85 | - return; |
|
86 | - } |
|
87 | - $trustalyze = glsr(Trustalyze::class)->sendReview($review); |
|
88 | - if ($trustalyze->success) { |
|
89 | - glsr(Database::class)->set($review->ID, 'trustalyze', $trustalyze->review_id); |
|
90 | - } |
|
91 | - } |
|
92 | - |
|
93 | - /** |
|
94 | - * Triggered when an existing review is updated. |
|
95 | - * @return void |
|
96 | - * @action site-reviews/review/saved |
|
97 | - */ |
|
98 | - public function onSaved(Review $review) |
|
99 | - { |
|
100 | - if (!$this->canPostReview($review)) { |
|
101 | - return; |
|
102 | - } |
|
103 | - $trustalyze = glsr(Trustalyze::class)->sendReview($review); |
|
104 | - if ($trustalyze->success) { |
|
105 | - glsr(Database::class)->set($review->ID, 'trustalyze', $trustalyze->review_id); |
|
106 | - } |
|
107 | - } |
|
108 | - |
|
109 | - /** |
|
110 | - * Triggered when a review's response is added or updated. |
|
111 | - * @param int $metaId |
|
112 | - * @param int $postId |
|
113 | - * @param string $metaKey |
|
114 | - * @return void |
|
115 | - * @action updated_postmeta |
|
116 | - */ |
|
117 | - public function onUpdatedMeta($metaId, $postId, $metaKey) |
|
118 | - { |
|
119 | - $review = glsr_get_review($postId); |
|
120 | - if (!$this->canPostResponse($review) || '_response' !== $metaKey) { |
|
121 | - return; |
|
122 | - } |
|
123 | - $trustalyze = glsr(Trustalyze::class)->sendReviewResponse($review); |
|
124 | - if ($trustalyze->success) { |
|
125 | - glsr(Database::class)->set($review->ID, 'trustalyze_response', true); |
|
126 | - } |
|
127 | - } |
|
128 | - |
|
129 | - /** |
|
130 | - * @return string |
|
131 | - */ |
|
132 | - protected function buildCreateButton() |
|
133 | - { |
|
134 | - return glsr(Builder::class)->a(__('Create Your Trustalyze Account', 'site-reviews'), [ |
|
135 | - 'class' => 'button', |
|
136 | - 'href' => Trustalyze::WEB_URL, |
|
137 | - 'target' => '_blank', |
|
138 | - ]); |
|
139 | - } |
|
140 | - |
|
141 | - /** |
|
142 | - * @return string |
|
143 | - */ |
|
144 | - protected function buildUpgradeButton() |
|
145 | - { |
|
146 | - $build = glsr(Builder::class); |
|
147 | - $notice = $build->p(__('Free Trustalyze accounts are limited to 500 blockchain transactions per year.', 'site-reviews')); |
|
148 | - $button = $build->a(__('Upgrade Your Trustalyze Plan', 'site-reviews'), [ |
|
149 | - 'class' => 'button', |
|
150 | - 'href' => Trustalyze::WEB_URL, |
|
151 | - 'target' => '_blank', |
|
152 | - ]); |
|
153 | - return $build->div($notice.$button, [ |
|
154 | - 'class' => 'glsr-notice-inline notice inline notice-info', |
|
155 | - ]); |
|
156 | - } |
|
157 | - |
|
158 | - /** |
|
159 | - * @return bool |
|
160 | - */ |
|
161 | - protected function canPostResponse(Review $review) |
|
162 | - { |
|
163 | - $requiredValues = [ |
|
164 | - glsr(Database::class)->get($review->ID, 'trustalyze'), |
|
165 | - $review->response, |
|
166 | - $review->review_id, |
|
167 | - ]; |
|
168 | - return $this->canProceed($review, 'trustalyze_response') |
|
169 | - && 'publish' === $review->status |
|
170 | - && 3 === count(array_filter($requiredValues)); |
|
171 | - } |
|
172 | - |
|
173 | - /** |
|
174 | - * @return bool |
|
175 | - */ |
|
176 | - protected function canPostReview(Review $review) |
|
177 | - { |
|
178 | - $requiredValues = [ |
|
179 | - $review->author, |
|
180 | - $review->content, |
|
181 | - $review->rating, |
|
182 | - $review->review_id, |
|
183 | - $review->title, |
|
184 | - ]; |
|
185 | - return $this->canProceed($review) |
|
186 | - && 'publish' === $review->status |
|
187 | - && 5 === count(array_filter($requiredValues)); |
|
188 | - } |
|
189 | - |
|
190 | - /** |
|
191 | - * @param string $metaKey |
|
192 | - * @return bool |
|
193 | - */ |
|
194 | - protected function canProceed(Review $review, $metaKey = 'trustalyze') |
|
195 | - { |
|
196 | - return glsr(OptionManager::class)->getBool($this->enabledKey) |
|
197 | - && $this->isReviewPostId($review->ID) |
|
198 | - && !$this->hasMetaKey($review, $metaKey); |
|
199 | - } |
|
200 | - |
|
201 | - /** |
|
202 | - * @param string $metaKey |
|
203 | - * @return bool |
|
204 | - */ |
|
205 | - protected function hasMetaKey(Review $review, $metaKey = 'trustalyze') |
|
206 | - { |
|
207 | - return '' !== glsr(Database::class)->get($review->ID, $metaKey); |
|
208 | - } |
|
209 | - |
|
210 | - /** |
|
211 | - * @param string $key |
|
212 | - * @return bool |
|
213 | - */ |
|
214 | - protected function isEmptyOrModified($key, array $settings) |
|
215 | - { |
|
216 | - $oldValue = glsr_get_option($key); |
|
217 | - $newValue = Arr::get($settings, $key); |
|
218 | - return empty($newValue) || $newValue !== $oldValue; |
|
219 | - } |
|
220 | - |
|
221 | - /** |
|
222 | - * @return array |
|
223 | - */ |
|
224 | - protected function sanitizeTrustalyzeSettings(array $settings) |
|
225 | - { |
|
226 | - $trustalyze = glsr(Trustalyze::class)->activateKey( |
|
227 | - Arr::get($settings, $this->apiKey), |
|
228 | - Arr::get($settings, $this->emailKey) |
|
229 | - ); |
|
230 | - if ($trustalyze->success) { |
|
231 | - update_option($this->trustalyzeKey, Arr::get($trustalyze->response, 'producttype')); |
|
232 | - } else { |
|
233 | - delete_option($this->trustalyzeKey); |
|
234 | - $settings = Arr::set($settings, $this->enabledKey, 'no'); |
|
235 | - glsr(Notice::class)->addError(sprintf( |
|
236 | - __('Your Trustalyze account details could not be verified, please try again. %s', 'site-reviews'), |
|
237 | - '('.$trustalyze->message.')' |
|
238 | - )); |
|
239 | - } |
|
240 | - return $settings; |
|
241 | - } |
|
15 | + protected $apiKey = 'settings.general.trustalyze_serial'; |
|
16 | + protected $emailKey = 'settings.general.trustalyze_email'; |
|
17 | + protected $enabledKey = 'settings.general.trustalyze'; |
|
18 | + protected $trustalyzeKey = '_glsr_trustalyze'; |
|
19 | + |
|
20 | + /** |
|
21 | + * @return array |
|
22 | + * @filter site-reviews/settings/callback |
|
23 | + */ |
|
24 | + public function filterSettingsCallback(array $settings) |
|
25 | + { |
|
26 | + if ('yes' !== Arr::get($settings, $this->enabledKey)) { |
|
27 | + return $settings; |
|
28 | + } |
|
29 | + $isApiKeyModified = $this->isEmptyOrModified($this->apiKey, $settings); |
|
30 | + $isEmailModified = $this->isEmptyOrModified($this->emailKey, $settings); |
|
31 | + $isAccountVerified = glsr(OptionManager::class)->getWP($this->trustalyzeKey, false); |
|
32 | + if (!$isAccountVerified || $isApiKeyModified || $isEmailModified) { |
|
33 | + $settings = $this->sanitizeTrustalyzeSettings($settings); |
|
34 | + } |
|
35 | + return $settings; |
|
36 | + } |
|
37 | + |
|
38 | + /** |
|
39 | + * @param string $template |
|
40 | + * @return array |
|
41 | + * @filter site-reviews/interpolate/partials/form/table-row-multiple |
|
42 | + */ |
|
43 | + public function filterSettingsTableRow(array $context, $template, array $data) |
|
44 | + { |
|
45 | + if ($this->enabledKey !== Arr::get($data, 'field.path')) { |
|
46 | + return $context; |
|
47 | + } |
|
48 | + $trustalyzeProductType = glsr(OptionManager::class)->getWP($this->trustalyzeKey); |
|
49 | + if ('P' === $trustalyzeProductType) { |
|
50 | + return $context; |
|
51 | + } |
|
52 | + if ('F' === $trustalyzeProductType && 'yes' === glsr_get_option('general.trustalyze')) { |
|
53 | + $button = $this->buildUpgradeButton(); |
|
54 | + } else { |
|
55 | + $button = $this->buildCreateButton(); |
|
56 | + } |
|
57 | + $context['field'].= $button; |
|
58 | + return $context; |
|
59 | + } |
|
60 | + |
|
61 | + /** |
|
62 | + * Triggered when a review is created. |
|
63 | + * @return void |
|
64 | + * @action site-reviews/review/created |
|
65 | + */ |
|
66 | + public function onCreated(Review $review) |
|
67 | + { |
|
68 | + if (!$this->canPostReview($review)) { |
|
69 | + return; |
|
70 | + } |
|
71 | + $trustalyze = glsr(Trustalyze::class)->sendReview($review); |
|
72 | + if ($trustalyze->success) { |
|
73 | + glsr(Database::class)->set($review->ID, 'trustalyze', $trustalyze->review_id); |
|
74 | + } |
|
75 | + } |
|
76 | + |
|
77 | + /** |
|
78 | + * Triggered when a review is reverted to its original title/content/date_timestamp. |
|
79 | + * @return void |
|
80 | + * @action site-reviews/review/reverted |
|
81 | + */ |
|
82 | + public function onReverted(Review $review) |
|
83 | + { |
|
84 | + if (!$this->canPostReview($review)) { |
|
85 | + return; |
|
86 | + } |
|
87 | + $trustalyze = glsr(Trustalyze::class)->sendReview($review); |
|
88 | + if ($trustalyze->success) { |
|
89 | + glsr(Database::class)->set($review->ID, 'trustalyze', $trustalyze->review_id); |
|
90 | + } |
|
91 | + } |
|
92 | + |
|
93 | + /** |
|
94 | + * Triggered when an existing review is updated. |
|
95 | + * @return void |
|
96 | + * @action site-reviews/review/saved |
|
97 | + */ |
|
98 | + public function onSaved(Review $review) |
|
99 | + { |
|
100 | + if (!$this->canPostReview($review)) { |
|
101 | + return; |
|
102 | + } |
|
103 | + $trustalyze = glsr(Trustalyze::class)->sendReview($review); |
|
104 | + if ($trustalyze->success) { |
|
105 | + glsr(Database::class)->set($review->ID, 'trustalyze', $trustalyze->review_id); |
|
106 | + } |
|
107 | + } |
|
108 | + |
|
109 | + /** |
|
110 | + * Triggered when a review's response is added or updated. |
|
111 | + * @param int $metaId |
|
112 | + * @param int $postId |
|
113 | + * @param string $metaKey |
|
114 | + * @return void |
|
115 | + * @action updated_postmeta |
|
116 | + */ |
|
117 | + public function onUpdatedMeta($metaId, $postId, $metaKey) |
|
118 | + { |
|
119 | + $review = glsr_get_review($postId); |
|
120 | + if (!$this->canPostResponse($review) || '_response' !== $metaKey) { |
|
121 | + return; |
|
122 | + } |
|
123 | + $trustalyze = glsr(Trustalyze::class)->sendReviewResponse($review); |
|
124 | + if ($trustalyze->success) { |
|
125 | + glsr(Database::class)->set($review->ID, 'trustalyze_response', true); |
|
126 | + } |
|
127 | + } |
|
128 | + |
|
129 | + /** |
|
130 | + * @return string |
|
131 | + */ |
|
132 | + protected function buildCreateButton() |
|
133 | + { |
|
134 | + return glsr(Builder::class)->a(__('Create Your Trustalyze Account', 'site-reviews'), [ |
|
135 | + 'class' => 'button', |
|
136 | + 'href' => Trustalyze::WEB_URL, |
|
137 | + 'target' => '_blank', |
|
138 | + ]); |
|
139 | + } |
|
140 | + |
|
141 | + /** |
|
142 | + * @return string |
|
143 | + */ |
|
144 | + protected function buildUpgradeButton() |
|
145 | + { |
|
146 | + $build = glsr(Builder::class); |
|
147 | + $notice = $build->p(__('Free Trustalyze accounts are limited to 500 blockchain transactions per year.', 'site-reviews')); |
|
148 | + $button = $build->a(__('Upgrade Your Trustalyze Plan', 'site-reviews'), [ |
|
149 | + 'class' => 'button', |
|
150 | + 'href' => Trustalyze::WEB_URL, |
|
151 | + 'target' => '_blank', |
|
152 | + ]); |
|
153 | + return $build->div($notice.$button, [ |
|
154 | + 'class' => 'glsr-notice-inline notice inline notice-info', |
|
155 | + ]); |
|
156 | + } |
|
157 | + |
|
158 | + /** |
|
159 | + * @return bool |
|
160 | + */ |
|
161 | + protected function canPostResponse(Review $review) |
|
162 | + { |
|
163 | + $requiredValues = [ |
|
164 | + glsr(Database::class)->get($review->ID, 'trustalyze'), |
|
165 | + $review->response, |
|
166 | + $review->review_id, |
|
167 | + ]; |
|
168 | + return $this->canProceed($review, 'trustalyze_response') |
|
169 | + && 'publish' === $review->status |
|
170 | + && 3 === count(array_filter($requiredValues)); |
|
171 | + } |
|
172 | + |
|
173 | + /** |
|
174 | + * @return bool |
|
175 | + */ |
|
176 | + protected function canPostReview(Review $review) |
|
177 | + { |
|
178 | + $requiredValues = [ |
|
179 | + $review->author, |
|
180 | + $review->content, |
|
181 | + $review->rating, |
|
182 | + $review->review_id, |
|
183 | + $review->title, |
|
184 | + ]; |
|
185 | + return $this->canProceed($review) |
|
186 | + && 'publish' === $review->status |
|
187 | + && 5 === count(array_filter($requiredValues)); |
|
188 | + } |
|
189 | + |
|
190 | + /** |
|
191 | + * @param string $metaKey |
|
192 | + * @return bool |
|
193 | + */ |
|
194 | + protected function canProceed(Review $review, $metaKey = 'trustalyze') |
|
195 | + { |
|
196 | + return glsr(OptionManager::class)->getBool($this->enabledKey) |
|
197 | + && $this->isReviewPostId($review->ID) |
|
198 | + && !$this->hasMetaKey($review, $metaKey); |
|
199 | + } |
|
200 | + |
|
201 | + /** |
|
202 | + * @param string $metaKey |
|
203 | + * @return bool |
|
204 | + */ |
|
205 | + protected function hasMetaKey(Review $review, $metaKey = 'trustalyze') |
|
206 | + { |
|
207 | + return '' !== glsr(Database::class)->get($review->ID, $metaKey); |
|
208 | + } |
|
209 | + |
|
210 | + /** |
|
211 | + * @param string $key |
|
212 | + * @return bool |
|
213 | + */ |
|
214 | + protected function isEmptyOrModified($key, array $settings) |
|
215 | + { |
|
216 | + $oldValue = glsr_get_option($key); |
|
217 | + $newValue = Arr::get($settings, $key); |
|
218 | + return empty($newValue) || $newValue !== $oldValue; |
|
219 | + } |
|
220 | + |
|
221 | + /** |
|
222 | + * @return array |
|
223 | + */ |
|
224 | + protected function sanitizeTrustalyzeSettings(array $settings) |
|
225 | + { |
|
226 | + $trustalyze = glsr(Trustalyze::class)->activateKey( |
|
227 | + Arr::get($settings, $this->apiKey), |
|
228 | + Arr::get($settings, $this->emailKey) |
|
229 | + ); |
|
230 | + if ($trustalyze->success) { |
|
231 | + update_option($this->trustalyzeKey, Arr::get($trustalyze->response, 'producttype')); |
|
232 | + } else { |
|
233 | + delete_option($this->trustalyzeKey); |
|
234 | + $settings = Arr::set($settings, $this->enabledKey, 'no'); |
|
235 | + glsr(Notice::class)->addError(sprintf( |
|
236 | + __('Your Trustalyze account details could not be verified, please try again. %s', 'site-reviews'), |
|
237 | + '('.$trustalyze->message.')' |
|
238 | + )); |
|
239 | + } |
|
240 | + return $settings; |
|
241 | + } |
|
242 | 242 | } |
@@ -10,114 +10,114 @@ |
||
10 | 10 | |
11 | 11 | class NoticeController extends Controller |
12 | 12 | { |
13 | - const USER_META_KEY = '_glsr_notices'; |
|
13 | + const USER_META_KEY = '_glsr_notices'; |
|
14 | 14 | |
15 | - /** |
|
16 | - * @var array |
|
17 | - */ |
|
18 | - protected $dismissValuesMap; |
|
15 | + /** |
|
16 | + * @var array |
|
17 | + */ |
|
18 | + protected $dismissValuesMap; |
|
19 | 19 | |
20 | - public function __construct() |
|
21 | - { |
|
22 | - $this->dismissValuesMap = [ |
|
23 | - 'trustalyze' => glsr()->version('major'), |
|
24 | - 'welcome' => glsr()->version('minor'), |
|
25 | - ]; |
|
26 | - } |
|
20 | + public function __construct() |
|
21 | + { |
|
22 | + $this->dismissValuesMap = [ |
|
23 | + 'trustalyze' => glsr()->version('major'), |
|
24 | + 'welcome' => glsr()->version('minor'), |
|
25 | + ]; |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * @return void |
|
30 | - * @action admin_notices |
|
31 | - */ |
|
32 | - public function filterAdminNotices() |
|
33 | - { |
|
34 | - $screen = glsr_current_screen(); |
|
35 | - $this->renderWelcomeNotice($screen->post_type); |
|
36 | - $this->renderTrustalyzeNotice($screen->post_type); |
|
37 | - } |
|
28 | + /** |
|
29 | + * @return void |
|
30 | + * @action admin_notices |
|
31 | + */ |
|
32 | + public function filterAdminNotices() |
|
33 | + { |
|
34 | + $screen = glsr_current_screen(); |
|
35 | + $this->renderWelcomeNotice($screen->post_type); |
|
36 | + $this->renderTrustalyzeNotice($screen->post_type); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * @return void |
|
41 | - */ |
|
42 | - public function routerDismissNotice(array $request) |
|
43 | - { |
|
44 | - if ($key = Arr::get($request, 'notice')) { |
|
45 | - $this->dismissNotice($key); |
|
46 | - } |
|
47 | - } |
|
39 | + /** |
|
40 | + * @return void |
|
41 | + */ |
|
42 | + public function routerDismissNotice(array $request) |
|
43 | + { |
|
44 | + if ($key = Arr::get($request, 'notice')) { |
|
45 | + $this->dismissNotice($key); |
|
46 | + } |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * @param string $key |
|
51 | - * @return void |
|
52 | - */ |
|
53 | - protected function dismissNotice($key) |
|
54 | - { |
|
55 | - $this->setUserMeta($key, $this->getVersionFor($key)); |
|
56 | - } |
|
49 | + /** |
|
50 | + * @param string $key |
|
51 | + * @return void |
|
52 | + */ |
|
53 | + protected function dismissNotice($key) |
|
54 | + { |
|
55 | + $this->setUserMeta($key, $this->getVersionFor($key)); |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * @param string $key |
|
60 | - * @param mixed $fallback |
|
61 | - * @return mixed |
|
62 | - */ |
|
63 | - protected function getUserMeta($key, $fallback) |
|
64 | - { |
|
65 | - $meta = get_user_meta(get_current_user_id(), static::USER_META_KEY, true); |
|
66 | - return Arr::get($meta, $key, $fallback); |
|
67 | - } |
|
58 | + /** |
|
59 | + * @param string $key |
|
60 | + * @param mixed $fallback |
|
61 | + * @return mixed |
|
62 | + */ |
|
63 | + protected function getUserMeta($key, $fallback) |
|
64 | + { |
|
65 | + $meta = get_user_meta(get_current_user_id(), static::USER_META_KEY, true); |
|
66 | + return Arr::get($meta, $key, $fallback); |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * @param string $noticeKey |
|
71 | - * @return string |
|
72 | - */ |
|
73 | - protected function getVersionFor($noticeKey) |
|
74 | - { |
|
75 | - return Arr::get($this->dismissValuesMap, $noticeKey, glsr()->version('major')); |
|
76 | - } |
|
69 | + /** |
|
70 | + * @param string $noticeKey |
|
71 | + * @return string |
|
72 | + */ |
|
73 | + protected function getVersionFor($noticeKey) |
|
74 | + { |
|
75 | + return Arr::get($this->dismissValuesMap, $noticeKey, glsr()->version('major')); |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * @param string $screenPostType |
|
80 | - * @return void |
|
81 | - */ |
|
82 | - protected function renderTrustalyzeNotice($screenPostType) |
|
83 | - { |
|
84 | - if (Application::POST_TYPE == $screenPostType |
|
85 | - && Helper::isGreaterThan($this->getVersionFor('trustalyze'), $this->getUserMeta('trustalyze', 0)) |
|
86 | - && !glsr(OptionManager::class)->getBool('settings.general.trustalyze') |
|
87 | - && glsr()->can('manage_options')) { |
|
88 | - glsr()->render('partials/notices/trustalyze'); |
|
89 | - } |
|
90 | - } |
|
78 | + /** |
|
79 | + * @param string $screenPostType |
|
80 | + * @return void |
|
81 | + */ |
|
82 | + protected function renderTrustalyzeNotice($screenPostType) |
|
83 | + { |
|
84 | + if (Application::POST_TYPE == $screenPostType |
|
85 | + && Helper::isGreaterThan($this->getVersionFor('trustalyze'), $this->getUserMeta('trustalyze', 0)) |
|
86 | + && !glsr(OptionManager::class)->getBool('settings.general.trustalyze') |
|
87 | + && glsr()->can('manage_options')) { |
|
88 | + glsr()->render('partials/notices/trustalyze'); |
|
89 | + } |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
93 | - * @param string $screenPostType |
|
94 | - * @return void |
|
95 | - */ |
|
96 | - protected function renderWelcomeNotice($screenPostType) |
|
97 | - { |
|
98 | - if (Application::POST_TYPE == $screenPostType |
|
99 | - && Helper::isGreaterThan($this->getVersionFor('welcome'), $this->getUserMeta('welcome', 0)) |
|
100 | - && glsr()->can('edit_others_posts')) { |
|
101 | - $welcomeText = '0.0.0' == glsr(OptionManager::class)->get('version_upgraded_from') |
|
102 | - ? __('Thanks for installing Site Reviews v%s, we hope you love it!', 'site-reviews') |
|
103 | - : __('Thanks for updating to Site Reviews v%s, we hope you love the changes!', 'site-reviews'); |
|
104 | - glsr()->render('partials/notices/welcome', [ |
|
105 | - 'text' => sprintf($welcomeText, glsr()->version), |
|
106 | - ]); |
|
107 | - } |
|
108 | - } |
|
92 | + /** |
|
93 | + * @param string $screenPostType |
|
94 | + * @return void |
|
95 | + */ |
|
96 | + protected function renderWelcomeNotice($screenPostType) |
|
97 | + { |
|
98 | + if (Application::POST_TYPE == $screenPostType |
|
99 | + && Helper::isGreaterThan($this->getVersionFor('welcome'), $this->getUserMeta('welcome', 0)) |
|
100 | + && glsr()->can('edit_others_posts')) { |
|
101 | + $welcomeText = '0.0.0' == glsr(OptionManager::class)->get('version_upgraded_from') |
|
102 | + ? __('Thanks for installing Site Reviews v%s, we hope you love it!', 'site-reviews') |
|
103 | + : __('Thanks for updating to Site Reviews v%s, we hope you love the changes!', 'site-reviews'); |
|
104 | + glsr()->render('partials/notices/welcome', [ |
|
105 | + 'text' => sprintf($welcomeText, glsr()->version), |
|
106 | + ]); |
|
107 | + } |
|
108 | + } |
|
109 | 109 | |
110 | - /** |
|
111 | - * @param string $key |
|
112 | - * @param mixed $fallback |
|
113 | - * @return mixed |
|
114 | - */ |
|
115 | - protected function setUserMeta($key, $value) |
|
116 | - { |
|
117 | - $userId = get_current_user_id(); |
|
118 | - $meta = (array) get_user_meta($userId, static::USER_META_KEY, true); |
|
119 | - $meta = array_filter(wp_parse_args($meta, [])); |
|
120 | - $meta[$key] = $value; |
|
121 | - update_user_meta($userId, static::USER_META_KEY, $meta); |
|
122 | - } |
|
110 | + /** |
|
111 | + * @param string $key |
|
112 | + * @param mixed $fallback |
|
113 | + * @return mixed |
|
114 | + */ |
|
115 | + protected function setUserMeta($key, $value) |
|
116 | + { |
|
117 | + $userId = get_current_user_id(); |
|
118 | + $meta = (array) get_user_meta($userId, static::USER_META_KEY, true); |
|
119 | + $meta = array_filter(wp_parse_args($meta, [])); |
|
120 | + $meta[$key] = $value; |
|
121 | + update_user_meta($userId, static::USER_META_KEY, $meta); |
|
122 | + } |
|
123 | 123 | } |
@@ -10,143 +10,143 @@ |
||
10 | 10 | |
11 | 11 | class Trustalyze |
12 | 12 | { |
13 | - const API_URL = 'https://www.trustalyze.com/api/rbs/'; |
|
14 | - const WEB_URL = 'https://trustalyze.com/plans?ref=105'; |
|
13 | + const API_URL = 'https://www.trustalyze.com/api/rbs/'; |
|
14 | + const WEB_URL = 'https://trustalyze.com/plans?ref=105'; |
|
15 | 15 | |
16 | - public $message; |
|
17 | - public $response; |
|
18 | - public $success; |
|
16 | + public $message; |
|
17 | + public $response; |
|
18 | + public $success; |
|
19 | 19 | |
20 | - /** |
|
21 | - * @return mixed |
|
22 | - */ |
|
23 | - public function __get($key) |
|
24 | - { |
|
25 | - return property_exists($this, $key) |
|
26 | - ? $this->$key |
|
27 | - : Arr::get($this->response, $key, null); |
|
28 | - } |
|
20 | + /** |
|
21 | + * @return mixed |
|
22 | + */ |
|
23 | + public function __get($key) |
|
24 | + { |
|
25 | + return property_exists($this, $key) |
|
26 | + ? $this->$key |
|
27 | + : Arr::get($this->response, $key, null); |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * @return self |
|
32 | - */ |
|
33 | - public function activateKey($apiKey = '', $email = '') |
|
34 | - { |
|
35 | - $this->send('api_key_activation.php', [ |
|
36 | - 'body' => [ |
|
37 | - 'apikey' => $apiKey ?: 0, |
|
38 | - 'domain' => get_home_url(), |
|
39 | - 'email' => $email ?: 0, |
|
40 | - ], |
|
41 | - ]); |
|
42 | - return $this; |
|
43 | - } |
|
30 | + /** |
|
31 | + * @return self |
|
32 | + */ |
|
33 | + public function activateKey($apiKey = '', $email = '') |
|
34 | + { |
|
35 | + $this->send('api_key_activation.php', [ |
|
36 | + 'body' => [ |
|
37 | + 'apikey' => $apiKey ?: 0, |
|
38 | + 'domain' => get_home_url(), |
|
39 | + 'email' => $email ?: 0, |
|
40 | + ], |
|
41 | + ]); |
|
42 | + return $this; |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * @return self |
|
47 | - */ |
|
48 | - public function reset() |
|
49 | - { |
|
50 | - $this->message = ''; |
|
51 | - $this->response = []; |
|
52 | - $this->success = false; |
|
53 | - return $this; |
|
54 | - } |
|
45 | + /** |
|
46 | + * @return self |
|
47 | + */ |
|
48 | + public function reset() |
|
49 | + { |
|
50 | + $this->message = ''; |
|
51 | + $this->response = []; |
|
52 | + $this->success = false; |
|
53 | + return $this; |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @return self |
|
58 | - */ |
|
59 | - public function sendReview(Review $review) |
|
60 | - { |
|
61 | - $this->send('index.php', [ |
|
62 | - 'body' => $this->getBodyForReview($review), |
|
63 | - 'timeout' => 120, |
|
64 | - ]); |
|
65 | - return $this; |
|
66 | - } |
|
56 | + /** |
|
57 | + * @return self |
|
58 | + */ |
|
59 | + public function sendReview(Review $review) |
|
60 | + { |
|
61 | + $this->send('index.php', [ |
|
62 | + 'body' => $this->getBodyForReview($review), |
|
63 | + 'timeout' => 120, |
|
64 | + ]); |
|
65 | + return $this; |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * @return self |
|
70 | - */ |
|
71 | - public function sendReviewResponse(Review $review) |
|
72 | - { |
|
73 | - $this->send('fetch_customer_reply.php', [ |
|
74 | - 'body' => $this->getBodyForResponse($review), |
|
75 | - ]); |
|
76 | - return $this; |
|
77 | - } |
|
68 | + /** |
|
69 | + * @return self |
|
70 | + */ |
|
71 | + public function sendReviewResponse(Review $review) |
|
72 | + { |
|
73 | + $this->send('fetch_customer_reply.php', [ |
|
74 | + 'body' => $this->getBodyForResponse($review), |
|
75 | + ]); |
|
76 | + return $this; |
|
77 | + } |
|
78 | 78 | |
79 | - /** |
|
80 | - * @return array |
|
81 | - */ |
|
82 | - protected function getBodyForResponse(Review $review) |
|
83 | - { |
|
84 | - $trustalyzeResponse = [ |
|
85 | - 'reply' => Str::truncate($review->response, 300), |
|
86 | - 'review_id' => glsr(Database::class)->get($review->ID, 'trustalyze'), // this is the trustalyze review ID |
|
87 | - 'review_transaction_id' => $review->review_id, |
|
88 | - 'type' => 'M', |
|
89 | - ]; |
|
90 | - return apply_filters('site-reviews/trustalyze/response', $trustalyzeResponse, $review); |
|
91 | - } |
|
79 | + /** |
|
80 | + * @return array |
|
81 | + */ |
|
82 | + protected function getBodyForResponse(Review $review) |
|
83 | + { |
|
84 | + $trustalyzeResponse = [ |
|
85 | + 'reply' => Str::truncate($review->response, 300), |
|
86 | + 'review_id' => glsr(Database::class)->get($review->ID, 'trustalyze'), // this is the trustalyze review ID |
|
87 | + 'review_transaction_id' => $review->review_id, |
|
88 | + 'type' => 'M', |
|
89 | + ]; |
|
90 | + return apply_filters('site-reviews/trustalyze/response', $trustalyzeResponse, $review); |
|
91 | + } |
|
92 | 92 | |
93 | - /** |
|
94 | - * @return array |
|
95 | - */ |
|
96 | - protected function getBodyForReview(Review $review) |
|
97 | - { |
|
98 | - $trustalyzeReview = [ |
|
99 | - 'domain' => get_home_url(), |
|
100 | - 'firstname' => Str::truncate(Str::convertName($review->author, 'first'), 25), |
|
101 | - 'rate' => $review->rating, |
|
102 | - 'review_transaction_id' => $review->review_id, |
|
103 | - 'reviews' => Str::truncate($review->content, 280), |
|
104 | - 'title' => Str::truncate($review->title, 35), |
|
105 | - 'transaction' => Application::ID, // woocommerce field, not needed for Site Reviews |
|
106 | - ]; |
|
107 | - return apply_filters('site-reviews/trustalyze/review', $trustalyzeReview, $review); |
|
108 | - } |
|
93 | + /** |
|
94 | + * @return array |
|
95 | + */ |
|
96 | + protected function getBodyForReview(Review $review) |
|
97 | + { |
|
98 | + $trustalyzeReview = [ |
|
99 | + 'domain' => get_home_url(), |
|
100 | + 'firstname' => Str::truncate(Str::convertName($review->author, 'first'), 25), |
|
101 | + 'rate' => $review->rating, |
|
102 | + 'review_transaction_id' => $review->review_id, |
|
103 | + 'reviews' => Str::truncate($review->content, 280), |
|
104 | + 'title' => Str::truncate($review->title, 35), |
|
105 | + 'transaction' => Application::ID, // woocommerce field, not needed for Site Reviews |
|
106 | + ]; |
|
107 | + return apply_filters('site-reviews/trustalyze/review', $trustalyzeReview, $review); |
|
108 | + } |
|
109 | 109 | |
110 | - /** |
|
111 | - * @param \WP_Error|array $response |
|
112 | - * @return void |
|
113 | - */ |
|
114 | - protected function handleResponse($response) |
|
115 | - { |
|
116 | - if (is_wp_error($response)) { |
|
117 | - $this->message = $response->get_error_message(); |
|
118 | - } else { |
|
119 | - $responseBody = wp_remote_retrieve_body($response); |
|
120 | - $responseCode = wp_remote_retrieve_response_code($response); |
|
121 | - $responseData = (array) json_decode($responseBody, true); |
|
122 | - $this->response = array_shift($responseData); |
|
123 | - $this->message = Arr::get($this->response, 'msg'); |
|
124 | - $this->success = 'success' === Arr::get($this->response, 'result') || 'yes' === Arr::get($this->response, 'success'); // @todo remove this ugly hack! |
|
125 | - if (200 !== $responseCode) { |
|
126 | - glsr_log()->error('Bad response code ['.$responseCode.']'); |
|
127 | - } |
|
128 | - if (!$this->success) { |
|
129 | - glsr_log()->error($this->message); |
|
130 | - } |
|
131 | - } |
|
132 | - } |
|
110 | + /** |
|
111 | + * @param \WP_Error|array $response |
|
112 | + * @return void |
|
113 | + */ |
|
114 | + protected function handleResponse($response) |
|
115 | + { |
|
116 | + if (is_wp_error($response)) { |
|
117 | + $this->message = $response->get_error_message(); |
|
118 | + } else { |
|
119 | + $responseBody = wp_remote_retrieve_body($response); |
|
120 | + $responseCode = wp_remote_retrieve_response_code($response); |
|
121 | + $responseData = (array) json_decode($responseBody, true); |
|
122 | + $this->response = array_shift($responseData); |
|
123 | + $this->message = Arr::get($this->response, 'msg'); |
|
124 | + $this->success = 'success' === Arr::get($this->response, 'result') || 'yes' === Arr::get($this->response, 'success'); // @todo remove this ugly hack! |
|
125 | + if (200 !== $responseCode) { |
|
126 | + glsr_log()->error('Bad response code ['.$responseCode.']'); |
|
127 | + } |
|
128 | + if (!$this->success) { |
|
129 | + glsr_log()->error($this->message); |
|
130 | + } |
|
131 | + } |
|
132 | + } |
|
133 | 133 | |
134 | - /** |
|
135 | - * @param string $endpoint |
|
136 | - * @return void |
|
137 | - */ |
|
138 | - protected function send($endpoint, array $args = []) |
|
139 | - { |
|
140 | - $args = wp_parse_args($args, [ |
|
141 | - 'body' => null, |
|
142 | - 'headers' => ['Content-Type' => 'application/x-www-form-urlencoded'], |
|
143 | - 'redirection' => 5, |
|
144 | - 'sslverify' => false, |
|
145 | - 'timeout' => 5, |
|
146 | - ]); |
|
147 | - $this->reset(); |
|
148 | - $this->handleResponse( |
|
149 | - wp_remote_post(trailingslashit(static::API_URL).$endpoint, $args) |
|
150 | - ); |
|
151 | - } |
|
134 | + /** |
|
135 | + * @param string $endpoint |
|
136 | + * @return void |
|
137 | + */ |
|
138 | + protected function send($endpoint, array $args = []) |
|
139 | + { |
|
140 | + $args = wp_parse_args($args, [ |
|
141 | + 'body' => null, |
|
142 | + 'headers' => ['Content-Type' => 'application/x-www-form-urlencoded'], |
|
143 | + 'redirection' => 5, |
|
144 | + 'sslverify' => false, |
|
145 | + 'timeout' => 5, |
|
146 | + ]); |
|
147 | + $this->reset(); |
|
148 | + $this->handleResponse( |
|
149 | + wp_remote_post(trailingslashit(static::API_URL).$endpoint, $args) |
|
150 | + ); |
|
151 | + } |
|
152 | 152 | } |
@@ -8,66 +8,66 @@ |
||
8 | 8 | |
9 | 9 | class Migrate_4_5_0 |
10 | 10 | { |
11 | - /** |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function migrateOptions() |
|
15 | - { |
|
16 | - $isAccountVerified = glsr(OptionManager::class)->getWP('_glsr_rebusify', false); |
|
17 | - update_option('_glsr_trustalyze', $isAccountVerified); |
|
18 | - delete_option('_glsr_rebusify'); |
|
19 | - } |
|
11 | + /** |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function migrateOptions() |
|
15 | + { |
|
16 | + $isAccountVerified = glsr(OptionManager::class)->getWP('_glsr_rebusify', false); |
|
17 | + update_option('_glsr_trustalyze', $isAccountVerified); |
|
18 | + delete_option('_glsr_rebusify'); |
|
19 | + } |
|
20 | 20 | |
21 | - /** |
|
22 | - * @return void |
|
23 | - */ |
|
24 | - public function migrateSettings() |
|
25 | - { |
|
26 | - if ($settings = get_option(OptionManager::databaseKey(4))) { |
|
27 | - $settings = Arr::set($settings, 'settings.general.trustalyze', |
|
28 | - Arr::get($settings, 'settings.general.rebusify') |
|
29 | - ); |
|
30 | - $settings = Arr::set($settings, 'settings.general.trustalyze_email', |
|
31 | - Arr::get($settings, 'settings.general.rebusify_email') |
|
32 | - ); |
|
33 | - $settings = Arr::set($settings, 'settings.general.trustalyze_serial', |
|
34 | - Arr::get($settings, 'settings.general.rebusify_serial') |
|
35 | - ); |
|
36 | - unset($settings['settings']['general']['rebusify']); |
|
37 | - unset($settings['settings']['general']['rebusify_email']); |
|
38 | - unset($settings['settings']['general']['rebusify_serial']); |
|
39 | - update_option(OptionManager::databaseKey(4), $settings); |
|
40 | - } |
|
41 | - } |
|
21 | + /** |
|
22 | + * @return void |
|
23 | + */ |
|
24 | + public function migrateSettings() |
|
25 | + { |
|
26 | + if ($settings = get_option(OptionManager::databaseKey(4))) { |
|
27 | + $settings = Arr::set($settings, 'settings.general.trustalyze', |
|
28 | + Arr::get($settings, 'settings.general.rebusify') |
|
29 | + ); |
|
30 | + $settings = Arr::set($settings, 'settings.general.trustalyze_email', |
|
31 | + Arr::get($settings, 'settings.general.rebusify_email') |
|
32 | + ); |
|
33 | + $settings = Arr::set($settings, 'settings.general.trustalyze_serial', |
|
34 | + Arr::get($settings, 'settings.general.rebusify_serial') |
|
35 | + ); |
|
36 | + unset($settings['settings']['general']['rebusify']); |
|
37 | + unset($settings['settings']['general']['rebusify_email']); |
|
38 | + unset($settings['settings']['general']['rebusify_serial']); |
|
39 | + update_option(OptionManager::databaseKey(4), $settings); |
|
40 | + } |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @return void |
|
45 | - */ |
|
46 | - public function migrateUserMeta() |
|
47 | - { |
|
48 | - $metaKey = NoticeController::USER_META_KEY; |
|
49 | - $userIds = get_users([ |
|
50 | - 'fields' => 'ID', |
|
51 | - 'meta_compare' => 'EXISTS', |
|
52 | - 'meta_key' => $metaKey, |
|
53 | - ]); |
|
54 | - foreach ($userIds as $userId) { |
|
55 | - $meta = get_user_meta($userId, $metaKey, true); |
|
56 | - if (array_key_exists('rebusify', $meta)) { |
|
57 | - $meta['trustalyze'] = $meta['rebusify']; |
|
58 | - unset($meta['rebusify']); |
|
59 | - update_user_meta($userId, $metaKey, $meta); |
|
60 | - } |
|
61 | - } |
|
62 | - } |
|
43 | + /** |
|
44 | + * @return void |
|
45 | + */ |
|
46 | + public function migrateUserMeta() |
|
47 | + { |
|
48 | + $metaKey = NoticeController::USER_META_KEY; |
|
49 | + $userIds = get_users([ |
|
50 | + 'fields' => 'ID', |
|
51 | + 'meta_compare' => 'EXISTS', |
|
52 | + 'meta_key' => $metaKey, |
|
53 | + ]); |
|
54 | + foreach ($userIds as $userId) { |
|
55 | + $meta = get_user_meta($userId, $metaKey, true); |
|
56 | + if (array_key_exists('rebusify', $meta)) { |
|
57 | + $meta['trustalyze'] = $meta['rebusify']; |
|
58 | + unset($meta['rebusify']); |
|
59 | + update_user_meta($userId, $metaKey, $meta); |
|
60 | + } |
|
61 | + } |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * @return void |
|
66 | - */ |
|
67 | - public function run() |
|
68 | - { |
|
69 | - $this->migrateOptions(); |
|
70 | - $this->migrateSettings(); |
|
71 | - $this->migrateUserMeta(); |
|
72 | - } |
|
64 | + /** |
|
65 | + * @return void |
|
66 | + */ |
|
67 | + public function run() |
|
68 | + { |
|
69 | + $this->migrateOptions(); |
|
70 | + $this->migrateSettings(); |
|
71 | + $this->migrateUserMeta(); |
|
72 | + } |
|
73 | 73 | } |
@@ -13,378 +13,378 @@ |
||
13 | 13 | |
14 | 14 | class System |
15 | 15 | { |
16 | - const PAD = 40; |
|
16 | + const PAD = 40; |
|
17 | 17 | |
18 | - /** |
|
19 | - * @return string |
|
20 | - */ |
|
21 | - public function __toString() |
|
22 | - { |
|
23 | - return $this->get(); |
|
24 | - } |
|
18 | + /** |
|
19 | + * @return string |
|
20 | + */ |
|
21 | + public function __toString() |
|
22 | + { |
|
23 | + return $this->get(); |
|
24 | + } |
|
25 | 25 | |
26 | - /** |
|
27 | - * @return string |
|
28 | - */ |
|
29 | - public function get() |
|
30 | - { |
|
31 | - $details = [ |
|
32 | - 'plugin' => 'Plugin Details', |
|
33 | - 'addon' => 'Addon Details', |
|
34 | - 'browser' => 'Browser Details', |
|
35 | - 'server' => 'Server Details', |
|
36 | - 'php' => 'PHP Configuration', |
|
37 | - 'wordpress' => 'WordPress Configuration', |
|
38 | - 'mu-plugin' => 'Must-Use Plugins', |
|
39 | - 'multisite-plugin' => 'Network Active Plugins', |
|
40 | - 'active-plugin' => 'Active Plugins', |
|
41 | - 'inactive-plugin' => 'Inactive Plugins', |
|
42 | - 'setting' => 'Plugin Settings', |
|
43 | - 'reviews' => 'Review Counts', |
|
44 | - ]; |
|
45 | - $systemInfo = array_reduce(array_keys($details), function ($carry, $key) use ($details) { |
|
46 | - $methodName = Helper::buildMethodName('get-'.$key.'-details'); |
|
47 | - if (method_exists($this, $methodName) && $systemDetails = $this->$methodName()) { |
|
48 | - return $carry.$this->implode( |
|
49 | - strtoupper($details[$key]), |
|
50 | - apply_filters('site-reviews/system/'.$key, $systemDetails) |
|
51 | - ); |
|
52 | - } |
|
53 | - return $carry; |
|
54 | - }); |
|
55 | - return trim($systemInfo); |
|
56 | - } |
|
26 | + /** |
|
27 | + * @return string |
|
28 | + */ |
|
29 | + public function get() |
|
30 | + { |
|
31 | + $details = [ |
|
32 | + 'plugin' => 'Plugin Details', |
|
33 | + 'addon' => 'Addon Details', |
|
34 | + 'browser' => 'Browser Details', |
|
35 | + 'server' => 'Server Details', |
|
36 | + 'php' => 'PHP Configuration', |
|
37 | + 'wordpress' => 'WordPress Configuration', |
|
38 | + 'mu-plugin' => 'Must-Use Plugins', |
|
39 | + 'multisite-plugin' => 'Network Active Plugins', |
|
40 | + 'active-plugin' => 'Active Plugins', |
|
41 | + 'inactive-plugin' => 'Inactive Plugins', |
|
42 | + 'setting' => 'Plugin Settings', |
|
43 | + 'reviews' => 'Review Counts', |
|
44 | + ]; |
|
45 | + $systemInfo = array_reduce(array_keys($details), function ($carry, $key) use ($details) { |
|
46 | + $methodName = Helper::buildMethodName('get-'.$key.'-details'); |
|
47 | + if (method_exists($this, $methodName) && $systemDetails = $this->$methodName()) { |
|
48 | + return $carry.$this->implode( |
|
49 | + strtoupper($details[$key]), |
|
50 | + apply_filters('site-reviews/system/'.$key, $systemDetails) |
|
51 | + ); |
|
52 | + } |
|
53 | + return $carry; |
|
54 | + }); |
|
55 | + return trim($systemInfo); |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * @return array |
|
60 | - */ |
|
61 | - public function getActivePluginDetails() |
|
62 | - { |
|
63 | - $plugins = get_plugins(); |
|
64 | - $activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array'); |
|
65 | - $inactive = array_diff_key($plugins, array_flip($activePlugins)); |
|
66 | - return $this->normalizePluginList(array_diff_key($plugins, $inactive)); |
|
67 | - } |
|
58 | + /** |
|
59 | + * @return array |
|
60 | + */ |
|
61 | + public function getActivePluginDetails() |
|
62 | + { |
|
63 | + $plugins = get_plugins(); |
|
64 | + $activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array'); |
|
65 | + $inactive = array_diff_key($plugins, array_flip($activePlugins)); |
|
66 | + return $this->normalizePluginList(array_diff_key($plugins, $inactive)); |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * @return array |
|
71 | - */ |
|
72 | - public function getAddonDetails() |
|
73 | - { |
|
74 | - $details = apply_filters('site-reviews/addon/system-info', []); |
|
75 | - ksort($details); |
|
76 | - return $details; |
|
77 | - } |
|
69 | + /** |
|
70 | + * @return array |
|
71 | + */ |
|
72 | + public function getAddonDetails() |
|
73 | + { |
|
74 | + $details = apply_filters('site-reviews/addon/system-info', []); |
|
75 | + ksort($details); |
|
76 | + return $details; |
|
77 | + } |
|
78 | 78 | |
79 | - /** |
|
80 | - * @return array |
|
81 | - */ |
|
82 | - public function getBrowserDetails() |
|
83 | - { |
|
84 | - $browser = new Browser(); |
|
85 | - $name = esc_attr($browser->getName()); |
|
86 | - $userAgent = esc_attr($browser->getUserAgent()->getUserAgentString()); |
|
87 | - $version = esc_attr($browser->getVersion()); |
|
88 | - return [ |
|
89 | - 'Browser Name' => sprintf('%s %s', $name, $version), |
|
90 | - 'Browser UA' => $userAgent, |
|
91 | - ]; |
|
92 | - } |
|
79 | + /** |
|
80 | + * @return array |
|
81 | + */ |
|
82 | + public function getBrowserDetails() |
|
83 | + { |
|
84 | + $browser = new Browser(); |
|
85 | + $name = esc_attr($browser->getName()); |
|
86 | + $userAgent = esc_attr($browser->getUserAgent()->getUserAgentString()); |
|
87 | + $version = esc_attr($browser->getVersion()); |
|
88 | + return [ |
|
89 | + 'Browser Name' => sprintf('%s %s', $name, $version), |
|
90 | + 'Browser UA' => $userAgent, |
|
91 | + ]; |
|
92 | + } |
|
93 | 93 | |
94 | - /** |
|
95 | - * @return array |
|
96 | - */ |
|
97 | - public function getInactivePluginDetails() |
|
98 | - { |
|
99 | - $activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array'); |
|
100 | - $inactivePlugins = $this->normalizePluginList(array_diff_key(get_plugins(), array_flip($activePlugins))); |
|
101 | - $multisitePlugins = $this->getMultisitePluginDetails(); |
|
102 | - return empty($multisitePlugins) |
|
103 | - ? $inactivePlugins |
|
104 | - : array_diff($inactivePlugins, $multisitePlugins); |
|
105 | - } |
|
94 | + /** |
|
95 | + * @return array |
|
96 | + */ |
|
97 | + public function getInactivePluginDetails() |
|
98 | + { |
|
99 | + $activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array'); |
|
100 | + $inactivePlugins = $this->normalizePluginList(array_diff_key(get_plugins(), array_flip($activePlugins))); |
|
101 | + $multisitePlugins = $this->getMultisitePluginDetails(); |
|
102 | + return empty($multisitePlugins) |
|
103 | + ? $inactivePlugins |
|
104 | + : array_diff($inactivePlugins, $multisitePlugins); |
|
105 | + } |
|
106 | 106 | |
107 | - /** |
|
108 | - * @return array |
|
109 | - */ |
|
110 | - public function getMuPluginDetails() |
|
111 | - { |
|
112 | - if (empty($plugins = get_mu_plugins())) { |
|
113 | - return []; |
|
114 | - } |
|
115 | - return $this->normalizePluginList($plugins); |
|
116 | - } |
|
107 | + /** |
|
108 | + * @return array |
|
109 | + */ |
|
110 | + public function getMuPluginDetails() |
|
111 | + { |
|
112 | + if (empty($plugins = get_mu_plugins())) { |
|
113 | + return []; |
|
114 | + } |
|
115 | + return $this->normalizePluginList($plugins); |
|
116 | + } |
|
117 | 117 | |
118 | - /** |
|
119 | - * @return array |
|
120 | - */ |
|
121 | - public function getMultisitePluginDetails() |
|
122 | - { |
|
123 | - $activePlugins = (array) get_site_option('active_sitewide_plugins', []); |
|
124 | - if (!is_multisite() || empty($activePlugins)) { |
|
125 | - return []; |
|
126 | - } |
|
127 | - return $this->normalizePluginList(array_intersect_key(get_plugins(), $activePlugins)); |
|
128 | - } |
|
118 | + /** |
|
119 | + * @return array |
|
120 | + */ |
|
121 | + public function getMultisitePluginDetails() |
|
122 | + { |
|
123 | + $activePlugins = (array) get_site_option('active_sitewide_plugins', []); |
|
124 | + if (!is_multisite() || empty($activePlugins)) { |
|
125 | + return []; |
|
126 | + } |
|
127 | + return $this->normalizePluginList(array_intersect_key(get_plugins(), $activePlugins)); |
|
128 | + } |
|
129 | 129 | |
130 | - /** |
|
131 | - * @return array |
|
132 | - */ |
|
133 | - public function getPhpDetails() |
|
134 | - { |
|
135 | - $displayErrors = $this->getINI('display_errors', null) |
|
136 | - ? 'On ('.$this->getINI('display_errors').')' |
|
137 | - : 'N/A'; |
|
138 | - $intlSupport = extension_loaded('intl') |
|
139 | - ? phpversion('intl') |
|
140 | - : 'false'; |
|
141 | - return [ |
|
142 | - 'cURL' => var_export(function_exists('curl_init'), true), |
|
143 | - 'Default Charset' => $this->getINI('default_charset'), |
|
144 | - 'Display Errors' => $displayErrors, |
|
145 | - 'fsockopen' => var_export(function_exists('fsockopen'), true), |
|
146 | - 'Intl' => $intlSupport, |
|
147 | - 'IPv6' => var_export(defined('AF_INET6'), true), |
|
148 | - 'Max Execution Time' => $this->getINI('max_execution_time'), |
|
149 | - 'Max Input Nesting Level' => $this->getINI('max_input_nesting_level'), |
|
150 | - 'Max Input Vars' => $this->getINI('max_input_vars'), |
|
151 | - 'Memory Limit' => $this->getINI('memory_limit'), |
|
152 | - 'Post Max Size' => $this->getINI('post_max_size'), |
|
153 | - 'Sendmail Path' => $this->getINI('sendmail_path'), |
|
154 | - 'Session Cookie Path' => esc_html($this->getINI('session.cookie_path')), |
|
155 | - 'Session Name' => esc_html($this->getINI('session.name')), |
|
156 | - 'Session Save Path' => esc_html($this->getINI('session.save_path')), |
|
157 | - 'Session Use Cookies' => var_export(wp_validate_boolean($this->getINI('session.use_cookies', false)), true), |
|
158 | - 'Session Use Only Cookies' => var_export(wp_validate_boolean($this->getINI('session.use_only_cookies', false)), true), |
|
159 | - 'Upload Max Filesize' => $this->getINI('upload_max_filesize'), |
|
160 | - ]; |
|
161 | - } |
|
130 | + /** |
|
131 | + * @return array |
|
132 | + */ |
|
133 | + public function getPhpDetails() |
|
134 | + { |
|
135 | + $displayErrors = $this->getINI('display_errors', null) |
|
136 | + ? 'On ('.$this->getINI('display_errors').')' |
|
137 | + : 'N/A'; |
|
138 | + $intlSupport = extension_loaded('intl') |
|
139 | + ? phpversion('intl') |
|
140 | + : 'false'; |
|
141 | + return [ |
|
142 | + 'cURL' => var_export(function_exists('curl_init'), true), |
|
143 | + 'Default Charset' => $this->getINI('default_charset'), |
|
144 | + 'Display Errors' => $displayErrors, |
|
145 | + 'fsockopen' => var_export(function_exists('fsockopen'), true), |
|
146 | + 'Intl' => $intlSupport, |
|
147 | + 'IPv6' => var_export(defined('AF_INET6'), true), |
|
148 | + 'Max Execution Time' => $this->getINI('max_execution_time'), |
|
149 | + 'Max Input Nesting Level' => $this->getINI('max_input_nesting_level'), |
|
150 | + 'Max Input Vars' => $this->getINI('max_input_vars'), |
|
151 | + 'Memory Limit' => $this->getINI('memory_limit'), |
|
152 | + 'Post Max Size' => $this->getINI('post_max_size'), |
|
153 | + 'Sendmail Path' => $this->getINI('sendmail_path'), |
|
154 | + 'Session Cookie Path' => esc_html($this->getINI('session.cookie_path')), |
|
155 | + 'Session Name' => esc_html($this->getINI('session.name')), |
|
156 | + 'Session Save Path' => esc_html($this->getINI('session.save_path')), |
|
157 | + 'Session Use Cookies' => var_export(wp_validate_boolean($this->getINI('session.use_cookies', false)), true), |
|
158 | + 'Session Use Only Cookies' => var_export(wp_validate_boolean($this->getINI('session.use_only_cookies', false)), true), |
|
159 | + 'Upload Max Filesize' => $this->getINI('upload_max_filesize'), |
|
160 | + ]; |
|
161 | + } |
|
162 | 162 | |
163 | - /** |
|
164 | - * @return array |
|
165 | - */ |
|
166 | - public function getReviewsDetails() |
|
167 | - { |
|
168 | - $counts = glsr(CountsManager::class)->getCounts(); |
|
169 | - $counts = Arr::flattenArray($counts); |
|
170 | - array_walk($counts, function (&$ratings) use ($counts) { |
|
171 | - if (is_array($ratings)) { |
|
172 | - $ratings = array_sum($ratings).' ('.implode(', ', $ratings).')'; |
|
173 | - return; |
|
174 | - } |
|
175 | - glsr_log() |
|
176 | - ->error('$ratings is not an array, possibly due to incorrectly imported reviews.') |
|
177 | - ->debug($ratings) |
|
178 | - ->debug($counts); |
|
179 | - }); |
|
180 | - ksort($counts); |
|
181 | - return $counts; |
|
182 | - } |
|
163 | + /** |
|
164 | + * @return array |
|
165 | + */ |
|
166 | + public function getReviewsDetails() |
|
167 | + { |
|
168 | + $counts = glsr(CountsManager::class)->getCounts(); |
|
169 | + $counts = Arr::flattenArray($counts); |
|
170 | + array_walk($counts, function (&$ratings) use ($counts) { |
|
171 | + if (is_array($ratings)) { |
|
172 | + $ratings = array_sum($ratings).' ('.implode(', ', $ratings).')'; |
|
173 | + return; |
|
174 | + } |
|
175 | + glsr_log() |
|
176 | + ->error('$ratings is not an array, possibly due to incorrectly imported reviews.') |
|
177 | + ->debug($ratings) |
|
178 | + ->debug($counts); |
|
179 | + }); |
|
180 | + ksort($counts); |
|
181 | + return $counts; |
|
182 | + } |
|
183 | 183 | |
184 | - /** |
|
185 | - * @return array |
|
186 | - */ |
|
187 | - public function getServerDetails() |
|
188 | - { |
|
189 | - global $wpdb; |
|
190 | - return [ |
|
191 | - 'Host Name' => $this->getHostName(), |
|
192 | - 'MySQL Version' => $wpdb->db_version(), |
|
193 | - 'PHP Version' => PHP_VERSION, |
|
194 | - 'Server Software' => filter_input(INPUT_SERVER, 'SERVER_SOFTWARE'), |
|
195 | - ]; |
|
196 | - } |
|
184 | + /** |
|
185 | + * @return array |
|
186 | + */ |
|
187 | + public function getServerDetails() |
|
188 | + { |
|
189 | + global $wpdb; |
|
190 | + return [ |
|
191 | + 'Host Name' => $this->getHostName(), |
|
192 | + 'MySQL Version' => $wpdb->db_version(), |
|
193 | + 'PHP Version' => PHP_VERSION, |
|
194 | + 'Server Software' => filter_input(INPUT_SERVER, 'SERVER_SOFTWARE'), |
|
195 | + ]; |
|
196 | + } |
|
197 | 197 | |
198 | - /** |
|
199 | - * @return array |
|
200 | - */ |
|
201 | - public function getSettingDetails() |
|
202 | - { |
|
203 | - $settings = glsr(OptionManager::class)->get('settings', []); |
|
204 | - $settings = Arr::flattenArray($settings, true); |
|
205 | - $settings = $this->purgeSensitiveData($settings); |
|
206 | - ksort($settings); |
|
207 | - $details = []; |
|
208 | - foreach ($settings as $key => $value) { |
|
209 | - if (Str::startsWith('strings', $key) && Str::endsWith('id', $key)) { |
|
210 | - continue; |
|
211 | - } |
|
212 | - $value = htmlspecialchars(trim(preg_replace('/\s\s+/', '\\n', $value)), ENT_QUOTES, 'UTF-8'); |
|
213 | - $details[$key] = $value; |
|
214 | - } |
|
215 | - return $details; |
|
216 | - } |
|
198 | + /** |
|
199 | + * @return array |
|
200 | + */ |
|
201 | + public function getSettingDetails() |
|
202 | + { |
|
203 | + $settings = glsr(OptionManager::class)->get('settings', []); |
|
204 | + $settings = Arr::flattenArray($settings, true); |
|
205 | + $settings = $this->purgeSensitiveData($settings); |
|
206 | + ksort($settings); |
|
207 | + $details = []; |
|
208 | + foreach ($settings as $key => $value) { |
|
209 | + if (Str::startsWith('strings', $key) && Str::endsWith('id', $key)) { |
|
210 | + continue; |
|
211 | + } |
|
212 | + $value = htmlspecialchars(trim(preg_replace('/\s\s+/', '\\n', $value)), ENT_QUOTES, 'UTF-8'); |
|
213 | + $details[$key] = $value; |
|
214 | + } |
|
215 | + return $details; |
|
216 | + } |
|
217 | 217 | |
218 | - /** |
|
219 | - * @return array |
|
220 | - */ |
|
221 | - public function getPluginDetails() |
|
222 | - { |
|
223 | - return [ |
|
224 | - 'Console level' => glsr(Console::class)->humanLevel(), |
|
225 | - 'Console size' => glsr(Console::class)->humanSize('0'), |
|
226 | - 'Last Migration Run' => glsr(Date::class)->localized(glsr(OptionManager::class)->get('last_migration_run'), 'unknown'), |
|
227 | - 'Last Rating Count' => glsr(Date::class)->localized(glsr(OptionManager::class)->get('last_review_count'), 'unknown'), |
|
228 | - 'Version (current)' => glsr()->version, |
|
229 | - 'Version (previous)' => glsr(OptionManager::class)->get('version_upgraded_from'), |
|
230 | - ]; |
|
231 | - } |
|
218 | + /** |
|
219 | + * @return array |
|
220 | + */ |
|
221 | + public function getPluginDetails() |
|
222 | + { |
|
223 | + return [ |
|
224 | + 'Console level' => glsr(Console::class)->humanLevel(), |
|
225 | + 'Console size' => glsr(Console::class)->humanSize('0'), |
|
226 | + 'Last Migration Run' => glsr(Date::class)->localized(glsr(OptionManager::class)->get('last_migration_run'), 'unknown'), |
|
227 | + 'Last Rating Count' => glsr(Date::class)->localized(glsr(OptionManager::class)->get('last_review_count'), 'unknown'), |
|
228 | + 'Version (current)' => glsr()->version, |
|
229 | + 'Version (previous)' => glsr(OptionManager::class)->get('version_upgraded_from'), |
|
230 | + ]; |
|
231 | + } |
|
232 | 232 | |
233 | - /** |
|
234 | - * @return array |
|
235 | - */ |
|
236 | - public function getWordpressDetails() |
|
237 | - { |
|
238 | - global $wpdb; |
|
239 | - $theme = wp_get_theme(); |
|
240 | - return [ |
|
241 | - 'Active Theme' => sprintf('%s v%s', (string) $theme->Name, (string) $theme->Version), |
|
242 | - 'Email Domain' => substr(strrchr(glsr(OptionManager::class)->getWP('admin_email'), '@'), 1), |
|
243 | - 'Home URL' => home_url(), |
|
244 | - 'Language' => get_locale(), |
|
245 | - 'Memory Limit' => WP_MEMORY_LIMIT, |
|
246 | - 'Multisite' => var_export(is_multisite(), true), |
|
247 | - 'Page For Posts ID' => glsr(OptionManager::class)->getWP('page_for_posts'), |
|
248 | - 'Page On Front ID' => glsr(OptionManager::class)->getWP('page_on_front'), |
|
249 | - 'Permalink Structure' => glsr(OptionManager::class)->getWP('permalink_structure', 'default'), |
|
250 | - 'Post Stati' => implode(', ', get_post_stati()), |
|
251 | - 'Remote Post' => glsr(Cache::class)->getRemotePostTest(), |
|
252 | - 'Show On Front' => glsr(OptionManager::class)->getWP('show_on_front'), |
|
253 | - 'Site URL' => site_url(), |
|
254 | - 'Timezone' => glsr(OptionManager::class)->getWP('timezone_string', $this->getINI('date.timezone').' (PHP)'), |
|
255 | - 'Version' => get_bloginfo('version'), |
|
256 | - 'WP Debug' => var_export(defined('WP_DEBUG'), true), |
|
257 | - 'WP Max Upload Size' => size_format(wp_max_upload_size()), |
|
258 | - 'WP Memory Limit' => WP_MEMORY_LIMIT, |
|
259 | - ]; |
|
260 | - } |
|
233 | + /** |
|
234 | + * @return array |
|
235 | + */ |
|
236 | + public function getWordpressDetails() |
|
237 | + { |
|
238 | + global $wpdb; |
|
239 | + $theme = wp_get_theme(); |
|
240 | + return [ |
|
241 | + 'Active Theme' => sprintf('%s v%s', (string) $theme->Name, (string) $theme->Version), |
|
242 | + 'Email Domain' => substr(strrchr(glsr(OptionManager::class)->getWP('admin_email'), '@'), 1), |
|
243 | + 'Home URL' => home_url(), |
|
244 | + 'Language' => get_locale(), |
|
245 | + 'Memory Limit' => WP_MEMORY_LIMIT, |
|
246 | + 'Multisite' => var_export(is_multisite(), true), |
|
247 | + 'Page For Posts ID' => glsr(OptionManager::class)->getWP('page_for_posts'), |
|
248 | + 'Page On Front ID' => glsr(OptionManager::class)->getWP('page_on_front'), |
|
249 | + 'Permalink Structure' => glsr(OptionManager::class)->getWP('permalink_structure', 'default'), |
|
250 | + 'Post Stati' => implode(', ', get_post_stati()), |
|
251 | + 'Remote Post' => glsr(Cache::class)->getRemotePostTest(), |
|
252 | + 'Show On Front' => glsr(OptionManager::class)->getWP('show_on_front'), |
|
253 | + 'Site URL' => site_url(), |
|
254 | + 'Timezone' => glsr(OptionManager::class)->getWP('timezone_string', $this->getINI('date.timezone').' (PHP)'), |
|
255 | + 'Version' => get_bloginfo('version'), |
|
256 | + 'WP Debug' => var_export(defined('WP_DEBUG'), true), |
|
257 | + 'WP Max Upload Size' => size_format(wp_max_upload_size()), |
|
258 | + 'WP Memory Limit' => WP_MEMORY_LIMIT, |
|
259 | + ]; |
|
260 | + } |
|
261 | 261 | |
262 | - /** |
|
263 | - * @return string |
|
264 | - */ |
|
265 | - protected function detectWebhostProvider() |
|
266 | - { |
|
267 | - $checks = [ |
|
268 | - '.accountservergroup.com' => 'Site5', |
|
269 | - '.gridserver.com' => 'MediaTemple Grid', |
|
270 | - '.inmotionhosting.com' => 'InMotion Hosting', |
|
271 | - '.ovh.net' => 'OVH', |
|
272 | - '.pair.com' => 'pair Networks', |
|
273 | - '.stabletransit.com' => 'Rackspace Cloud', |
|
274 | - '.stratoserver.net' => 'STRATO', |
|
275 | - '.sysfix.eu' => 'SysFix.eu Power Hosting', |
|
276 | - 'bluehost.com' => 'Bluehost', |
|
277 | - 'DH_USER' => 'DreamHost', |
|
278 | - 'Flywheel' => 'Flywheel', |
|
279 | - 'ipagemysql.com' => 'iPage', |
|
280 | - 'ipowermysql.com' => 'IPower', |
|
281 | - 'localhost:/tmp/mysql5.sock' => 'ICDSoft', |
|
282 | - 'mysqlv5' => 'NetworkSolutions', |
|
283 | - 'PAGELYBIN' => 'Pagely', |
|
284 | - 'secureserver.net' => 'GoDaddy', |
|
285 | - 'WPE_APIKEY' => 'WP Engine', |
|
286 | - ]; |
|
287 | - foreach ($checks as $key => $value) { |
|
288 | - if (!$this->isWebhostCheckValid($key)) { |
|
289 | - continue; |
|
290 | - } |
|
291 | - return $value; |
|
292 | - } |
|
293 | - return implode(',', array_filter([DB_HOST, filter_input(INPUT_SERVER, 'SERVER_NAME')])); |
|
294 | - } |
|
262 | + /** |
|
263 | + * @return string |
|
264 | + */ |
|
265 | + protected function detectWebhostProvider() |
|
266 | + { |
|
267 | + $checks = [ |
|
268 | + '.accountservergroup.com' => 'Site5', |
|
269 | + '.gridserver.com' => 'MediaTemple Grid', |
|
270 | + '.inmotionhosting.com' => 'InMotion Hosting', |
|
271 | + '.ovh.net' => 'OVH', |
|
272 | + '.pair.com' => 'pair Networks', |
|
273 | + '.stabletransit.com' => 'Rackspace Cloud', |
|
274 | + '.stratoserver.net' => 'STRATO', |
|
275 | + '.sysfix.eu' => 'SysFix.eu Power Hosting', |
|
276 | + 'bluehost.com' => 'Bluehost', |
|
277 | + 'DH_USER' => 'DreamHost', |
|
278 | + 'Flywheel' => 'Flywheel', |
|
279 | + 'ipagemysql.com' => 'iPage', |
|
280 | + 'ipowermysql.com' => 'IPower', |
|
281 | + 'localhost:/tmp/mysql5.sock' => 'ICDSoft', |
|
282 | + 'mysqlv5' => 'NetworkSolutions', |
|
283 | + 'PAGELYBIN' => 'Pagely', |
|
284 | + 'secureserver.net' => 'GoDaddy', |
|
285 | + 'WPE_APIKEY' => 'WP Engine', |
|
286 | + ]; |
|
287 | + foreach ($checks as $key => $value) { |
|
288 | + if (!$this->isWebhostCheckValid($key)) { |
|
289 | + continue; |
|
290 | + } |
|
291 | + return $value; |
|
292 | + } |
|
293 | + return implode(',', array_filter([DB_HOST, filter_input(INPUT_SERVER, 'SERVER_NAME')])); |
|
294 | + } |
|
295 | 295 | |
296 | - /** |
|
297 | - * @return string |
|
298 | - */ |
|
299 | - protected function getHostName() |
|
300 | - { |
|
301 | - return sprintf('%s (%s)', |
|
302 | - $this->detectWebhostProvider(), |
|
303 | - Helper::getIpAddress() |
|
304 | - ); |
|
305 | - } |
|
296 | + /** |
|
297 | + * @return string |
|
298 | + */ |
|
299 | + protected function getHostName() |
|
300 | + { |
|
301 | + return sprintf('%s (%s)', |
|
302 | + $this->detectWebhostProvider(), |
|
303 | + Helper::getIpAddress() |
|
304 | + ); |
|
305 | + } |
|
306 | 306 | |
307 | - protected function getINI($name, $disabledValue = 'ini_get() is disabled.') |
|
308 | - { |
|
309 | - return function_exists('ini_get') |
|
310 | - ? ini_get($name) |
|
311 | - : $disabledValue; |
|
312 | - } |
|
307 | + protected function getINI($name, $disabledValue = 'ini_get() is disabled.') |
|
308 | + { |
|
309 | + return function_exists('ini_get') |
|
310 | + ? ini_get($name) |
|
311 | + : $disabledValue; |
|
312 | + } |
|
313 | 313 | |
314 | - /** |
|
315 | - * @return array |
|
316 | - */ |
|
317 | - protected function getWordpressPlugins() |
|
318 | - { |
|
319 | - $plugins = get_plugins(); |
|
320 | - $activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array'); |
|
321 | - $inactive = $this->normalizePluginList(array_diff_key($plugins, array_flip($activePlugins))); |
|
322 | - $active = $this->normalizePluginList(array_diff_key($plugins, $inactive)); |
|
323 | - return $active + $inactive; |
|
324 | - } |
|
314 | + /** |
|
315 | + * @return array |
|
316 | + */ |
|
317 | + protected function getWordpressPlugins() |
|
318 | + { |
|
319 | + $plugins = get_plugins(); |
|
320 | + $activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array'); |
|
321 | + $inactive = $this->normalizePluginList(array_diff_key($plugins, array_flip($activePlugins))); |
|
322 | + $active = $this->normalizePluginList(array_diff_key($plugins, $inactive)); |
|
323 | + return $active + $inactive; |
|
324 | + } |
|
325 | 325 | |
326 | - /** |
|
327 | - * @param string $title |
|
328 | - * @return string |
|
329 | - */ |
|
330 | - protected function implode($title, array $details) |
|
331 | - { |
|
332 | - $strings = ['['.$title.']']; |
|
333 | - $padding = max(array_map('strlen', array_keys($details))); |
|
334 | - $padding = max([$padding, static::PAD]); |
|
335 | - foreach ($details as $key => $value) { |
|
336 | - $strings[] = is_string($key) |
|
337 | - ? sprintf('%s : %s', str_pad($key, $padding, '.'), $value) |
|
338 | - : ' - '.$value; |
|
339 | - } |
|
340 | - return implode(PHP_EOL, $strings).PHP_EOL.PHP_EOL; |
|
341 | - } |
|
326 | + /** |
|
327 | + * @param string $title |
|
328 | + * @return string |
|
329 | + */ |
|
330 | + protected function implode($title, array $details) |
|
331 | + { |
|
332 | + $strings = ['['.$title.']']; |
|
333 | + $padding = max(array_map('strlen', array_keys($details))); |
|
334 | + $padding = max([$padding, static::PAD]); |
|
335 | + foreach ($details as $key => $value) { |
|
336 | + $strings[] = is_string($key) |
|
337 | + ? sprintf('%s : %s', str_pad($key, $padding, '.'), $value) |
|
338 | + : ' - '.$value; |
|
339 | + } |
|
340 | + return implode(PHP_EOL, $strings).PHP_EOL.PHP_EOL; |
|
341 | + } |
|
342 | 342 | |
343 | - /** |
|
344 | - * @param string $key |
|
345 | - * @return bool |
|
346 | - */ |
|
347 | - protected function isWebhostCheckValid($key) |
|
348 | - { |
|
349 | - return defined($key) |
|
350 | - || filter_input(INPUT_SERVER, $key) |
|
351 | - || Str::contains(filter_input(INPUT_SERVER, 'SERVER_NAME'), $key) |
|
352 | - || Str::contains(DB_HOST, $key) |
|
353 | - || Str::contains(php_uname(), $key); |
|
354 | - } |
|
343 | + /** |
|
344 | + * @param string $key |
|
345 | + * @return bool |
|
346 | + */ |
|
347 | + protected function isWebhostCheckValid($key) |
|
348 | + { |
|
349 | + return defined($key) |
|
350 | + || filter_input(INPUT_SERVER, $key) |
|
351 | + || Str::contains(filter_input(INPUT_SERVER, 'SERVER_NAME'), $key) |
|
352 | + || Str::contains(DB_HOST, $key) |
|
353 | + || Str::contains(php_uname(), $key); |
|
354 | + } |
|
355 | 355 | |
356 | - /** |
|
357 | - * @return array |
|
358 | - */ |
|
359 | - protected function normalizePluginList(array $plugins) |
|
360 | - { |
|
361 | - $plugins = array_map(function ($plugin) { |
|
362 | - return sprintf('%s v%s', Arr::get($plugin, 'Name'), Arr::get($plugin, 'Version')); |
|
363 | - }, $plugins); |
|
364 | - natcasesort($plugins); |
|
365 | - return array_flip($plugins); |
|
366 | - } |
|
356 | + /** |
|
357 | + * @return array |
|
358 | + */ |
|
359 | + protected function normalizePluginList(array $plugins) |
|
360 | + { |
|
361 | + $plugins = array_map(function ($plugin) { |
|
362 | + return sprintf('%s v%s', Arr::get($plugin, 'Name'), Arr::get($plugin, 'Version')); |
|
363 | + }, $plugins); |
|
364 | + natcasesort($plugins); |
|
365 | + return array_flip($plugins); |
|
366 | + } |
|
367 | 367 | |
368 | - /** |
|
369 | - * @return array |
|
370 | - */ |
|
371 | - protected function purgeSensitiveData(array $settings) |
|
372 | - { |
|
373 | - $keys = [ |
|
374 | - 'general.trustalyze_serial', |
|
375 | - 'licenses.', |
|
376 | - 'submissions.recaptcha.key', |
|
377 | - 'submissions.recaptcha.secret', |
|
378 | - ]; |
|
379 | - array_walk($settings, function (&$value, $setting) use ($keys) { |
|
380 | - foreach ($keys as $key) { |
|
381 | - if (!Str::startsWith($key, $setting) || empty($value)) { |
|
382 | - continue; |
|
383 | - } |
|
384 | - $value = str_repeat('•', 13); |
|
385 | - return; |
|
386 | - } |
|
387 | - }); |
|
388 | - return $settings; |
|
389 | - } |
|
368 | + /** |
|
369 | + * @return array |
|
370 | + */ |
|
371 | + protected function purgeSensitiveData(array $settings) |
|
372 | + { |
|
373 | + $keys = [ |
|
374 | + 'general.trustalyze_serial', |
|
375 | + 'licenses.', |
|
376 | + 'submissions.recaptcha.key', |
|
377 | + 'submissions.recaptcha.secret', |
|
378 | + ]; |
|
379 | + array_walk($settings, function (&$value, $setting) use ($keys) { |
|
380 | + foreach ($keys as $key) { |
|
381 | + if (!Str::startsWith($key, $setting) || empty($value)) { |
|
382 | + continue; |
|
383 | + } |
|
384 | + $value = str_repeat('•', 13); |
|
385 | + return; |
|
386 | + } |
|
387 | + }); |
|
388 | + return $settings; |
|
389 | + } |
|
390 | 390 | } |
@@ -1,552 +1,552 @@ |
||
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.trustalyze' => [ |
|
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://trustalyze.com/plans?ref=105" target="_blank">Trustalyze Confidence System</a>' |
|
62 | - ), |
|
63 | - 'label' => __('Blockchain Validation', 'site-reviews'), |
|
64 | - 'type' => 'yes_no', |
|
65 | - ], |
|
66 | - 'settings.general.trustalyze_email' => [ |
|
67 | - 'default' => '', |
|
68 | - 'depends_on' => [ |
|
69 | - 'settings.general.trustalyze' => ['yes'], |
|
70 | - ], |
|
71 | - 'description' => __('Enter your Trustalyze account email here.', 'site-reviews'), |
|
72 | - 'label' => __('Trustalyze Email', 'site-reviews'), |
|
73 | - 'type' => 'text', |
|
74 | - ], |
|
75 | - 'settings.general.trustalyze_serial' => [ |
|
76 | - 'default' => '', |
|
77 | - 'depends_on' => [ |
|
78 | - 'settings.general.trustalyze' => ['yes'], |
|
79 | - ], |
|
80 | - 'description' => __('Enter your Trustalyze account serial key here.', 'site-reviews'), |
|
81 | - 'label' => __('Trustalyze 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='.glsr()->post_type.'&page=settings#tab-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.trustalyze' => [ |
|
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://trustalyze.com/plans?ref=105" target="_blank">Trustalyze Confidence System</a>' |
|
62 | + ), |
|
63 | + 'label' => __('Blockchain Validation', 'site-reviews'), |
|
64 | + 'type' => 'yes_no', |
|
65 | + ], |
|
66 | + 'settings.general.trustalyze_email' => [ |
|
67 | + 'default' => '', |
|
68 | + 'depends_on' => [ |
|
69 | + 'settings.general.trustalyze' => ['yes'], |
|
70 | + ], |
|
71 | + 'description' => __('Enter your Trustalyze account email here.', 'site-reviews'), |
|
72 | + 'label' => __('Trustalyze Email', 'site-reviews'), |
|
73 | + 'type' => 'text', |
|
74 | + ], |
|
75 | + 'settings.general.trustalyze_serial' => [ |
|
76 | + 'default' => '', |
|
77 | + 'depends_on' => [ |
|
78 | + 'settings.general.trustalyze' => ['yes'], |
|
79 | + ], |
|
80 | + 'description' => __('Enter your Trustalyze account serial key here.', 'site-reviews'), |
|
81 | + 'label' => __('Trustalyze 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='.glsr()->post_type.'&page=settings#tab-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 | ]; |