Passed
Push — master ( a9546d...6aabd8 )
by Paul
05:58
created
plugin/Actions.php 1 patch
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -40,24 +40,24 @@  discard block
 block discarded – undo
40 40
     protected $trustalyze;
41 41
     protected $welcome;
42 42
 
43
-    public function __construct(Application $app ) {
43
+    public function __construct( Application $app ) {
44 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);
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 61
     }
62 62
 
63 63
     /**
@@ -65,67 +65,67 @@  discard block
 block discarded – undo
65 65
      */
66 66
     public function run()
67 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']);
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 130
     }
131 131
 }
Please login to merge, or discard this patch.
plugin/Filters.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -26,18 +26,18 @@  discard block
 block discarded – undo
26 26
     protected $trustalyze;
27 27
     protected $welcome;
28 28
 
29
-    public function __construct(Application $app)
29
+    public function __construct( Application $app )
30 30
     {
31 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);
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 41
     }
42 42
 
43 43
     /**
@@ -45,42 +45,42 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function run()
47 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']);
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 85
     }
86 86
 }
Please login to merge, or discard this patch.
plugin/Controllers/TrustalyzeController.php 1 patch
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -21,16 +21,16 @@  discard block
 block discarded – undo
21 21
      * @return array
22 22
      * @filter site-reviews/settings/callback
23 23
      */
24
-    public function filterSettingsCallback(array $settings)
24
+    public function filterSettingsCallback( array $settings )
25 25
     {
26
-        if ('yes' !== Arr::get($settings, $this->enabledKey)) {
26
+        if( 'yes' !== Arr::get( $settings, $this->enabledKey ) ) {
27 27
             return $settings;
28 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);
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 34
         }
35 35
         return $settings;
36 36
     }
@@ -40,21 +40,21 @@  discard block
 block discarded – undo
40 40
      * @return array
41 41
      * @filter site-reviews/interpolate/partials/form/table-row-multiple
42 42
      */
43
-    public function filterSettingsTableRow(array $context, $template, array $data)
43
+    public function filterSettingsTableRow( array $context, $template, array $data )
44 44
     {
45
-        if ($this->enabledKey !== Arr::get($data, 'field.path')) {
45
+        if( $this->enabledKey !== Arr::get( $data, 'field.path' ) ) {
46 46
             return $context;
47 47
         }
48
-        $trustalyzeProductType = glsr(OptionManager::class)->getWP($this->trustalyzeKey);
49
-        if ('P' === $trustalyzeProductType) {
48
+        $trustalyzeProductType = glsr( OptionManager::class )->getWP( $this->trustalyzeKey );
49
+        if( 'P' === $trustalyzeProductType ) {
50 50
             return $context;
51 51
         }
52
-        if ('F' === $trustalyzeProductType && 'yes' === glsr_get_option('general.trustalyze')) {
52
+        if( 'F' === $trustalyzeProductType && 'yes' === glsr_get_option( 'general.trustalyze' ) ) {
53 53
             $button = $this->buildUpgradeButton();
54 54
         } else {
55 55
             $button = $this->buildCreateButton();
56 56
         }
57
-        $context['field'].= $button;
57
+        $context['field'] .= $button;
58 58
         return $context;
59 59
     }
60 60
 
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
      * @return void
64 64
      * @action site-reviews/review/created
65 65
      */
66
-    public function onCreated(Review $review)
66
+    public function onCreated( Review $review )
67 67
     {
68
-        if (!$this->canPostReview($review)) {
68
+        if( !$this->canPostReview( $review ) ) {
69 69
             return;
70 70
         }
71
-        $trustalyze = glsr(Trustalyze::class)->sendReview($review);
72
-        if ($trustalyze->success) {
73
-            glsr(Database::class)->set($review->ID, 'trustalyze', $trustalyze->review_id);
71
+        $trustalyze = glsr( Trustalyze::class )->sendReview( $review );
72
+        if( $trustalyze->success ) {
73
+            glsr( Database::class )->set( $review->ID, 'trustalyze', $trustalyze->review_id );
74 74
         }
75 75
     }
76 76
 
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
      * @return void
80 80
      * @action site-reviews/review/reverted
81 81
      */
82
-    public function onReverted(Review $review)
82
+    public function onReverted( Review $review )
83 83
     {
84
-        if (!$this->canPostReview($review)) {
84
+        if( !$this->canPostReview( $review ) ) {
85 85
             return;
86 86
         }
87
-        $trustalyze = glsr(Trustalyze::class)->sendReview($review);
88
-        if ($trustalyze->success) {
89
-            glsr(Database::class)->set($review->ID, 'trustalyze', $trustalyze->review_id);
87
+        $trustalyze = glsr( Trustalyze::class )->sendReview( $review );
88
+        if( $trustalyze->success ) {
89
+            glsr( Database::class )->set( $review->ID, 'trustalyze', $trustalyze->review_id );
90 90
         }
91 91
     }
92 92
 
@@ -95,14 +95,14 @@  discard block
 block discarded – undo
95 95
      * @return void
96 96
      * @action site-reviews/review/saved
97 97
      */
98
-    public function onSaved(Review $review)
98
+    public function onSaved( Review $review )
99 99
     {
100
-        if (!$this->canPostReview($review)) {
100
+        if( !$this->canPostReview( $review ) ) {
101 101
             return;
102 102
         }
103
-        $trustalyze = glsr(Trustalyze::class)->sendReview($review);
104
-        if ($trustalyze->success) {
105
-            glsr(Database::class)->set($review->ID, 'trustalyze', $trustalyze->review_id);
103
+        $trustalyze = glsr( Trustalyze::class )->sendReview( $review );
104
+        if( $trustalyze->success ) {
105
+            glsr( Database::class )->set( $review->ID, 'trustalyze', $trustalyze->review_id );
106 106
         }
107 107
     }
108 108
 
@@ -114,15 +114,15 @@  discard block
 block discarded – undo
114 114
      * @return void
115 115
      * @action updated_postmeta
116 116
      */
117
-    public function onUpdatedMeta($metaId, $postId, $metaKey)
117
+    public function onUpdatedMeta( $metaId, $postId, $metaKey )
118 118
     {
119
-        $review = glsr_get_review($postId);
120
-        if (!$this->canPostResponse($review) || '_response' !== $metaKey) {
119
+        $review = glsr_get_review( $postId );
120
+        if( !$this->canPostResponse( $review ) || '_response' !== $metaKey ) {
121 121
             return;
122 122
         }
123
-        $trustalyze = glsr(Trustalyze::class)->sendReviewResponse($review);
124
-        if ($trustalyze->success) {
125
-            glsr(Database::class)->set($review->ID, 'trustalyze_response', true);
123
+        $trustalyze = glsr( Trustalyze::class )->sendReviewResponse( $review );
124
+        if( $trustalyze->success ) {
125
+            glsr( Database::class )->set( $review->ID, 'trustalyze_response', true );
126 126
         }
127 127
     }
128 128
 
@@ -131,11 +131,11 @@  discard block
 block discarded – undo
131 131
      */
132 132
     protected function buildCreateButton()
133 133
     {
134
-        return glsr(Builder::class)->a(__('Create Your Trustalyze Account', 'site-reviews'), [
134
+        return glsr( Builder::class )->a( __( 'Create Your Trustalyze Account', 'site-reviews' ), [
135 135
             'class' => 'button',
136 136
             'href' => Trustalyze::WEB_URL,
137 137
             'target' => '_blank',
138
-        ]);
138
+        ] );
139 139
     }
140 140
 
141 141
     /**
@@ -143,37 +143,37 @@  discard block
 block discarded – undo
143 143
      */
144 144
     protected function buildUpgradeButton()
145 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'), [
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 149
             'class' => 'button',
150 150
             'href' => Trustalyze::WEB_URL,
151 151
             'target' => '_blank',
152
-        ]);
153
-        return $build->div($notice.$button, [
152
+        ] );
153
+        return $build->div( $notice.$button, [
154 154
             'class' => 'glsr-notice-inline notice inline notice-info',
155
-        ]);
155
+        ] );
156 156
     }
157 157
 
158 158
     /**
159 159
      * @return bool
160 160
      */
161
-    protected function canPostResponse(Review $review)
161
+    protected function canPostResponse( Review $review )
162 162
     {
163 163
         $requiredValues = [
164
-            glsr(Database::class)->get($review->ID, 'trustalyze'),
164
+            glsr( Database::class )->get( $review->ID, 'trustalyze' ),
165 165
             $review->response,
166 166
             $review->review_id,
167 167
         ];
168
-        return $this->canProceed($review, 'trustalyze_response')
168
+        return $this->canProceed( $review, 'trustalyze_response' )
169 169
             && 'publish' === $review->status
170
-            && 3 === count(array_filter($requiredValues));
170
+            && 3 === count( array_filter( $requiredValues ) );
171 171
     }
172 172
 
173 173
     /**
174 174
      * @return bool
175 175
      */
176
-    protected function canPostReview(Review $review)
176
+    protected function canPostReview( Review $review )
177 177
     {
178 178
         $requiredValues = [
179 179
             $review->author,
@@ -182,60 +182,60 @@  discard block
 block discarded – undo
182 182
             $review->review_id,
183 183
             $review->title,
184 184
         ];
185
-        return $this->canProceed($review)
185
+        return $this->canProceed( $review )
186 186
             && 'publish' === $review->status
187
-            && 5 === count(array_filter($requiredValues));
187
+            && 5 === count( array_filter( $requiredValues ) );
188 188
     }
189 189
 
190 190
     /**
191 191
      * @param string $metaKey
192 192
      * @return bool
193 193
      */
194
-    protected function canProceed(Review $review, $metaKey = 'trustalyze')
194
+    protected function canProceed( Review $review, $metaKey = 'trustalyze' )
195 195
     {
196
-        return glsr(OptionManager::class)->getBool($this->enabledKey)
197
-            && $this->isReviewPostId($review->ID)
198
-            && !$this->hasMetaKey($review, $metaKey);
196
+        return glsr( OptionManager::class )->getBool( $this->enabledKey )
197
+            && $this->isReviewPostId( $review->ID )
198
+            && !$this->hasMetaKey( $review, $metaKey );
199 199
     }
200 200
 
201 201
     /**
202 202
      * @param string $metaKey
203 203
      * @return bool
204 204
      */
205
-    protected function hasMetaKey(Review $review, $metaKey = 'trustalyze')
205
+    protected function hasMetaKey( Review $review, $metaKey = 'trustalyze' )
206 206
     {
207
-        return '' !== glsr(Database::class)->get($review->ID, $metaKey);
207
+        return '' !== glsr( Database::class )->get( $review->ID, $metaKey );
208 208
     }
209 209
 
210 210
     /**
211 211
      * @param string $key
212 212
      * @return bool
213 213
      */
214
-    protected function isEmptyOrModified($key, array $settings)
214
+    protected function isEmptyOrModified( $key, array $settings )
215 215
     {
216
-        $oldValue = glsr_get_option($key);
217
-        $newValue = Arr::get($settings, $key);
216
+        $oldValue = glsr_get_option( $key );
217
+        $newValue = Arr::get( $settings, $key );
218 218
         return empty($newValue) || $newValue !== $oldValue;
219 219
     }
220 220
 
221 221
     /**
222 222
      * @return array
223 223
      */
224
-    protected function sanitizeTrustalyzeSettings(array $settings)
224
+    protected function sanitizeTrustalyzeSettings( array $settings )
225 225
     {
226
-        $trustalyze = glsr(Trustalyze::class)->activateKey(
227
-            Arr::get($settings, $this->apiKey),
228
-            Arr::get($settings, $this->emailKey)
226
+        $trustalyze = glsr( Trustalyze::class )->activateKey(
227
+            Arr::get( $settings, $this->apiKey ),
228
+            Arr::get( $settings, $this->emailKey )
229 229
         );
230
-        if ($trustalyze->success) {
231
-            update_option($this->trustalyzeKey, Arr::get($trustalyze->response, 'producttype'));
230
+        if( $trustalyze->success ) {
231
+            update_option( $this->trustalyzeKey, Arr::get( $trustalyze->response, 'producttype' ) );
232 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'),
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 237
                 '('.$trustalyze->message.')'
238
-            ));
238
+            ) );
239 239
         }
240 240
         return $settings;
241 241
     }
Please login to merge, or discard this patch.
plugin/Controllers/NoticeController.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
     public function __construct()
21 21
     {
22 22
         $this->dismissValuesMap = [
23
-            'trustalyze' => glsr()->version('major'),
24
-            'welcome' => glsr()->version('minor'),
23
+            'trustalyze' => glsr()->version( 'major' ),
24
+            'welcome' => glsr()->version( 'minor' ),
25 25
         ];
26 26
     }
27 27
 
@@ -32,17 +32,17 @@  discard block
 block discarded – undo
32 32
     public function filterAdminNotices()
33 33
     {
34 34
         $screen = glsr_current_screen();
35
-        $this->renderWelcomeNotice($screen->post_type);
36
-        $this->renderTrustalyzeNotice($screen->post_type);
35
+        $this->renderWelcomeNotice( $screen->post_type );
36
+        $this->renderTrustalyzeNotice( $screen->post_type );
37 37
     }
38 38
 
39 39
     /**
40 40
      * @return void
41 41
      */
42
-    public function routerDismissNotice(array $request)
42
+    public function routerDismissNotice( array $request )
43 43
     {
44
-        if ($key = Arr::get($request, 'notice')) {
45
-            $this->dismissNotice($key);
44
+        if( $key = Arr::get( $request, 'notice' ) ) {
45
+            $this->dismissNotice( $key );
46 46
         }
47 47
     }
48 48
 
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
      * @param string $key
51 51
      * @return void
52 52
      */
53
-    protected function dismissNotice($key)
53
+    protected function dismissNotice( $key )
54 54
     {
55
-        $this->setUserMeta($key, $this->getVersionFor($key));
55
+        $this->setUserMeta( $key, $this->getVersionFor( $key ) );
56 56
     }
57 57
 
58 58
     /**
@@ -60,32 +60,32 @@  discard block
 block discarded – undo
60 60
      * @param mixed $fallback
61 61
      * @return mixed
62 62
      */
63
-    protected function getUserMeta($key, $fallback)
63
+    protected function getUserMeta( $key, $fallback )
64 64
     {
65
-        $meta = get_user_meta(get_current_user_id(), static::USER_META_KEY, true);
66
-        return Arr::get($meta, $key, $fallback);
65
+        $meta = get_user_meta( get_current_user_id(), static::USER_META_KEY, true );
66
+        return Arr::get( $meta, $key, $fallback );
67 67
     }
68 68
 
69 69
     /**
70 70
      * @param string $noticeKey
71 71
      * @return string
72 72
      */
73
-    protected function getVersionFor($noticeKey)
73
+    protected function getVersionFor( $noticeKey )
74 74
     {
75
-        return Arr::get($this->dismissValuesMap, $noticeKey, glsr()->version('major'));
75
+        return Arr::get( $this->dismissValuesMap, $noticeKey, glsr()->version( 'major' ) );
76 76
     }
77 77
 
78 78
     /**
79 79
      * @param string $screenPostType
80 80
      * @return void
81 81
      */
82
-    protected function renderTrustalyzeNotice($screenPostType)
82
+    protected function renderTrustalyzeNotice( $screenPostType )
83 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');
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 89
         }
90 90
     }
91 91
 
@@ -93,17 +93,17 @@  discard block
 block discarded – undo
93 93
      * @param string $screenPostType
94 94
      * @return void
95 95
      */
96
-    protected function renderWelcomeNotice($screenPostType)
96
+    protected function renderWelcomeNotice( $screenPostType )
97 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
-            ]);
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 107
         }
108 108
     }
109 109
 
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
      * @param mixed $fallback
113 113
      * @return mixed
114 114
      */
115
-    protected function setUserMeta($key, $value)
115
+    protected function setUserMeta( $key, $value )
116 116
     {
117 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, []));
118
+        $meta = (array)get_user_meta( $userId, static::USER_META_KEY, true );
119
+        $meta = array_filter( wp_parse_args( $meta, [] ) );
120 120
         $meta[$key] = $value;
121
-        update_user_meta($userId, static::USER_META_KEY, $meta);
121
+        update_user_meta( $userId, static::USER_META_KEY, $meta );
122 122
     }
123 123
 }
Please login to merge, or discard this patch.
plugin/Modules/Trustalyze.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -20,25 +20,25 @@  discard block
 block discarded – undo
20 20
     /**
21 21
      * @return mixed
22 22
      */
23
-    public function __get($key)
23
+    public function __get( $key )
24 24
     {
25
-        return property_exists($this, $key)
25
+        return property_exists( $this, $key )
26 26
             ? $this->$key
27
-            : Arr::get($this->response, $key, null);
27
+            : Arr::get( $this->response, $key, null );
28 28
     }
29 29
 
30 30
     /**
31 31
      * @return self
32 32
      */
33
-    public function activateKey($apiKey = '', $email = '')
33
+    public function activateKey( $apiKey = '', $email = '' )
34 34
     {
35
-        $this->send('api_key_activation.php', [
35
+        $this->send( 'api_key_activation.php', [
36 36
             'body' => [
37 37
                 'apikey' => $apiKey ?: 0,
38 38
                 'domain' => get_home_url(),
39 39
                 'email' => $email ?: 0,
40 40
             ],
41
-        ]);
41
+        ] );
42 42
         return $this;
43 43
     }
44 44
 
@@ -56,77 +56,77 @@  discard block
 block discarded – undo
56 56
     /**
57 57
      * @return self
58 58
      */
59
-    public function sendReview(Review $review)
59
+    public function sendReview( Review $review )
60 60
     {
61
-        $this->send('index.php', [
62
-            'body' => $this->getBodyForReview($review),
61
+        $this->send( 'index.php', [
62
+            'body' => $this->getBodyForReview( $review ),
63 63
             'timeout' => 120,
64
-        ]);
64
+        ] );
65 65
         return $this;
66 66
     }
67 67
 
68 68
     /**
69 69
      * @return self
70 70
      */
71
-    public function sendReviewResponse(Review $review)
71
+    public function sendReviewResponse( Review $review )
72 72
     {
73
-        $this->send('fetch_customer_reply.php', [
74
-            'body' => $this->getBodyForResponse($review),
75
-        ]);
73
+        $this->send( 'fetch_customer_reply.php', [
74
+            'body' => $this->getBodyForResponse( $review ),
75
+        ] );
76 76
         return $this;
77 77
     }
78 78
 
79 79
     /**
80 80
      * @return array
81 81
      */
82
-    protected function getBodyForResponse(Review $review)
82
+    protected function getBodyForResponse( Review $review )
83 83
     {
84 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
85
+            'reply' => Str::truncate( $review->response, 300 ),
86
+            'review_id' => glsr( Database::class )->get( $review->ID, 'trustalyze' ), // this is the trustalyze review ID
87 87
             'review_transaction_id' => $review->review_id,
88 88
             'type' => 'M',
89 89
         ];
90
-        return apply_filters('site-reviews/trustalyze/response', $trustalyzeResponse, $review);
90
+        return apply_filters( 'site-reviews/trustalyze/response', $trustalyzeResponse, $review );
91 91
     }
92 92
 
93 93
     /**
94 94
      * @return array
95 95
      */
96
-    protected function getBodyForReview(Review $review)
96
+    protected function getBodyForReview( Review $review )
97 97
     {
98 98
         $trustalyzeReview = [
99 99
             'domain' => get_home_url(),
100
-            'firstname' => Str::truncate(Str::convertName($review->author, 'first'), 25),
100
+            'firstname' => Str::truncate( Str::convertName( $review->author, 'first' ), 25 ),
101 101
             'rate' => $review->rating,
102 102
             'review_transaction_id' => $review->review_id,
103
-            'reviews' => Str::truncate($review->content, 280),
104
-            'title' => Str::truncate($review->title, 35),
103
+            'reviews' => Str::truncate( $review->content, 280 ),
104
+            'title' => Str::truncate( $review->title, 35 ),
105 105
             'transaction' => Application::ID, // woocommerce field, not needed for Site Reviews
106 106
         ];
107
-        return apply_filters('site-reviews/trustalyze/review', $trustalyzeReview, $review);
107
+        return apply_filters( 'site-reviews/trustalyze/review', $trustalyzeReview, $review );
108 108
     }
109 109
 
110 110
     /**
111 111
      * @param \WP_Error|array $response
112 112
      * @return void
113 113
      */
114
-    protected function handleResponse($response)
114
+    protected function handleResponse( $response )
115 115
     {
116
-        if (is_wp_error($response)) {
116
+        if( is_wp_error( $response ) ) {
117 117
             $this->message = $response->get_error_message();
118 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.']');
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 127
             }
128
-            if (!$this->success) {
129
-                glsr_log()->error($this->message);
128
+            if( !$this->success ) {
129
+                glsr_log()->error( $this->message );
130 130
             }
131 131
         }
132 132
     }
@@ -135,18 +135,18 @@  discard block
 block discarded – undo
135 135
      * @param string $endpoint
136 136
      * @return void
137 137
      */
138
-    protected function send($endpoint, array $args = [])
138
+    protected function send( $endpoint, array $args = [] )
139 139
     {
140
-        $args = wp_parse_args($args, [
140
+        $args = wp_parse_args( $args, [
141 141
             'body' => null,
142 142
             'headers' => ['Content-Type' => 'application/x-www-form-urlencoded'],
143 143
             'redirection' => 5,
144 144
             'sslverify' => false,
145 145
             'timeout' => 5,
146
-        ]);
146
+        ] );
147 147
         $this->reset();
148 148
         $this->handleResponse(
149
-            wp_remote_post(trailingslashit(static::API_URL).$endpoint, $args)
149
+            wp_remote_post( trailingslashit( static::API_URL ).$endpoint, $args )
150 150
         );
151 151
     }
152 152
 }
Please login to merge, or discard this patch.
plugin/Modules/Migrations/Migrate_4_5_0.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -13,9 +13,9 @@  discard block
 block discarded – undo
13 13
      */
14 14
     public function migrateOptions()
15 15
     {
16
-        $isAccountVerified = glsr(OptionManager::class)->getWP('_glsr_rebusify', false);
17
-        update_option('_glsr_trustalyze', $isAccountVerified);
18
-        delete_option('_glsr_rebusify');
16
+        $isAccountVerified = glsr( OptionManager::class )->getWP( '_glsr_rebusify', false );
17
+        update_option( '_glsr_trustalyze', $isAccountVerified );
18
+        delete_option( '_glsr_rebusify' );
19 19
     }
20 20
 
21 21
     /**
@@ -23,20 +23,20 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public function migrateSettings()
25 25
     {
26
-        if ($settings = get_option(OptionManager::databaseKey(4))) {
27
-            $settings = Arr::set($settings, 'settings.general.trustalyze',
28
-                Arr::get($settings, 'settings.general.rebusify')
26
+        if( $settings = get_option( OptionManager::databaseKey( 4 ) ) ) {
27
+            $settings = Arr::set( $settings, 'settings.general.trustalyze',
28
+                Arr::get( $settings, 'settings.general.rebusify' )
29 29
             );
30
-            $settings = Arr::set($settings, 'settings.general.trustalyze_email',
31
-                Arr::get($settings, 'settings.general.rebusify_email')
30
+            $settings = Arr::set( $settings, 'settings.general.trustalyze_email',
31
+                Arr::get( $settings, 'settings.general.rebusify_email' )
32 32
             );
33
-            $settings = Arr::set($settings, 'settings.general.trustalyze_serial',
34
-                Arr::get($settings, 'settings.general.rebusify_serial')
33
+            $settings = Arr::set( $settings, 'settings.general.trustalyze_serial',
34
+                Arr::get( $settings, 'settings.general.rebusify_serial' )
35 35
             );
36 36
             unset($settings['settings']['general']['rebusify']);
37 37
             unset($settings['settings']['general']['rebusify_email']);
38 38
             unset($settings['settings']['general']['rebusify_serial']);
39
-            update_option(OptionManager::databaseKey(4), $settings);
39
+            update_option( OptionManager::databaseKey( 4 ), $settings );
40 40
         }
41 41
     }
42 42
 
@@ -46,17 +46,17 @@  discard block
 block discarded – undo
46 46
     public function migrateUserMeta()
47 47
     {
48 48
         $metaKey = NoticeController::USER_META_KEY;
49
-        $userIds = get_users([
49
+        $userIds = get_users( [
50 50
             'fields' => 'ID',
51 51
             'meta_compare' => 'EXISTS',
52 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)) {
53
+        ] );
54
+        foreach( $userIds as $userId ) {
55
+            $meta = get_user_meta( $userId, $metaKey, true );
56
+            if( array_key_exists( 'rebusify', $meta ) ) {
57 57
                 $meta['trustalyze'] = $meta['rebusify'];
58 58
                 unset($meta['rebusify']);
59
-                update_user_meta($userId, $metaKey, $meta);
59
+                update_user_meta( $userId, $metaKey, $meta );
60 60
             }
61 61
         }
62 62
     }
Please login to merge, or discard this patch.
plugin/Modules/System.php 1 patch
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -42,17 +42,17 @@  discard block
 block discarded – undo
42 42
             'setting' => 'Plugin Settings',
43 43
             'reviews' => 'Review Counts',
44 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()) {
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 48
                 return $carry.$this->implode(
49
-                    strtoupper($details[$key]),
50
-                    apply_filters('site-reviews/system/'.$key, $systemDetails)
49
+                    strtoupper( $details[$key] ),
50
+                    apply_filters( 'site-reviews/system/'.$key, $systemDetails )
51 51
                 );
52 52
             }
53 53
             return $carry;
54 54
         });
55
-        return trim($systemInfo);
55
+        return trim( $systemInfo );
56 56
     }
57 57
 
58 58
     /**
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
     public function getActivePluginDetails()
62 62
     {
63 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));
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 67
     }
68 68
 
69 69
     /**
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function getAddonDetails()
73 73
     {
74
-        $details = apply_filters('site-reviews/addon/system-info', []);
75
-        ksort($details);
74
+        $details = apply_filters( 'site-reviews/addon/system-info', [] );
75
+        ksort( $details );
76 76
         return $details;
77 77
     }
78 78
 
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
     public function getBrowserDetails()
83 83
     {
84 84
         $browser = new Browser();
85
-        $name = esc_attr($browser->getName());
86
-        $userAgent = esc_attr($browser->getUserAgent()->getUserAgentString());
87
-        $version = esc_attr($browser->getVersion());
85
+        $name = esc_attr( $browser->getName() );
86
+        $userAgent = esc_attr( $browser->getUserAgent()->getUserAgentString() );
87
+        $version = esc_attr( $browser->getVersion() );
88 88
         return [
89
-            'Browser Name' => sprintf('%s %s', $name, $version),
89
+            'Browser Name' => sprintf( '%s %s', $name, $version ),
90 90
             'Browser UA' => $userAgent,
91 91
         ];
92 92
     }
@@ -96,12 +96,12 @@  discard block
 block discarded – undo
96 96
      */
97 97
     public function getInactivePluginDetails()
98 98
     {
99
-        $activePlugins = glsr(OptionManager::class)->getWP('active_plugins', [], 'array');
100
-        $inactivePlugins = $this->normalizePluginList(array_diff_key(get_plugins(), array_flip($activePlugins)));
99
+        $activePlugins = glsr( OptionManager::class )->getWP( 'active_plugins', [], 'array' );
100
+        $inactivePlugins = $this->normalizePluginList( array_diff_key( get_plugins(), array_flip( $activePlugins ) ) );
101 101
         $multisitePlugins = $this->getMultisitePluginDetails();
102 102
         return empty($multisitePlugins)
103 103
             ? $inactivePlugins
104
-            : array_diff($inactivePlugins, $multisitePlugins);
104
+            : array_diff( $inactivePlugins, $multisitePlugins );
105 105
     }
106 106
 
107 107
     /**
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function getMuPluginDetails()
111 111
     {
112
-        if (empty($plugins = get_mu_plugins())) {
112
+        if( empty($plugins = get_mu_plugins()) ) {
113 113
             return [];
114 114
         }
115
-        return $this->normalizePluginList($plugins);
115
+        return $this->normalizePluginList( $plugins );
116 116
     }
117 117
 
118 118
     /**
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
      */
121 121
     public function getMultisitePluginDetails()
122 122
     {
123
-        $activePlugins = (array) get_site_option('active_sitewide_plugins', []);
124
-        if (!is_multisite() || empty($activePlugins)) {
123
+        $activePlugins = (array)get_site_option( 'active_sitewide_plugins', [] );
124
+        if( !is_multisite() || empty($activePlugins) ) {
125 125
             return [];
126 126
         }
127
-        return $this->normalizePluginList(array_intersect_key(get_plugins(), $activePlugins));
127
+        return $this->normalizePluginList( array_intersect_key( get_plugins(), $activePlugins ) );
128 128
     }
129 129
 
130 130
     /**
@@ -132,31 +132,31 @@  discard block
 block discarded – undo
132 132
      */
133 133
     public function getPhpDetails()
134 134
     {
135
-        $displayErrors = $this->getINI('display_errors', null)
136
-            ? 'On ('.$this->getINI('display_errors').')'
135
+        $displayErrors = $this->getINI( 'display_errors', null )
136
+            ? 'On ('.$this->getINI( 'display_errors' ).')'
137 137
             : 'N/A';
138
-        $intlSupport = extension_loaded('intl')
139
-            ? phpversion('intl')
138
+        $intlSupport = extension_loaded( 'intl' )
139
+            ? phpversion( 'intl' )
140 140
             : 'false';
141 141
         return [
142
-            'cURL' => var_export(function_exists('curl_init'), true),
143
-            'Default Charset' => $this->getINI('default_charset'),
142
+            'cURL' => var_export( function_exists( 'curl_init' ), true ),
143
+            'Default Charset' => $this->getINI( 'default_charset' ),
144 144
             'Display Errors' => $displayErrors,
145
-            'fsockopen' => var_export(function_exists('fsockopen'), true),
145
+            'fsockopen' => var_export( function_exists( 'fsockopen' ), true ),
146 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'),
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 160
         ];
161 161
     }
162 162
 
@@ -165,19 +165,19 @@  discard block
 block discarded – undo
165 165
      */
166 166
     public function getReviewsDetails()
167 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).')';
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 173
                 return;
174 174
             }
175 175
             glsr_log()
176
-                ->error('$ratings is not an array, possibly due to incorrectly imported reviews.')
177
-                ->debug($ratings)
178
-                ->debug($counts);
176
+                ->error( '$ratings is not an array, possibly due to incorrectly imported reviews.' )
177
+                ->debug( $ratings )
178
+                ->debug( $counts );
179 179
         });
180
-        ksort($counts);
180
+        ksort( $counts );
181 181
         return $counts;
182 182
     }
183 183
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
             'Host Name' => $this->getHostName(),
192 192
             'MySQL Version' => $wpdb->db_version(),
193 193
             'PHP Version' => PHP_VERSION,
194
-            'Server Software' => filter_input(INPUT_SERVER, 'SERVER_SOFTWARE'),
194
+            'Server Software' => filter_input( INPUT_SERVER, 'SERVER_SOFTWARE' ),
195 195
         ];
196 196
     }
197 197
 
@@ -200,16 +200,16 @@  discard block
 block discarded – undo
200 200
      */
201 201
     public function getSettingDetails()
202 202
     {
203
-        $settings = glsr(OptionManager::class)->get('settings', []);
204
-        $settings = Arr::flattenArray($settings, true);
205
-        $settings = $this->purgeSensitiveData($settings);
206
-        ksort($settings);
203
+        $settings = glsr( OptionManager::class )->get( 'settings', [] );
204
+        $settings = Arr::flattenArray( $settings, true );
205
+        $settings = $this->purgeSensitiveData( $settings );
206
+        ksort( $settings );
207 207
         $details = [];
208
-        foreach ($settings as $key => $value) {
209
-            if (Str::startsWith('strings', $key) && Str::endsWith('id', $key)) {
208
+        foreach( $settings as $key => $value ) {
209
+            if( Str::startsWith( 'strings', $key ) && Str::endsWith( 'id', $key ) ) {
210 210
                 continue;
211 211
             }
212
-            $value = htmlspecialchars(trim(preg_replace('/\s\s+/', '\\n', $value)), ENT_QUOTES, 'UTF-8');
212
+            $value = htmlspecialchars( trim( preg_replace( '/\s\s+/', '\\n', $value ) ), ENT_QUOTES, 'UTF-8' );
213 213
             $details[$key] = $value;
214 214
         }
215 215
         return $details;
@@ -221,12 +221,12 @@  discard block
 block discarded – undo
221 221
     public function getPluginDetails()
222 222
     {
223 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'),
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 228
             'Version (current)' => glsr()->version,
229
-            'Version (previous)' => glsr(OptionManager::class)->get('version_upgraded_from'),
229
+            'Version (previous)' => glsr( OptionManager::class )->get( 'version_upgraded_from' ),
230 230
         ];
231 231
     }
232 232
 
@@ -238,23 +238,23 @@  discard block
 block discarded – undo
238 238
         global $wpdb;
239 239
         $theme = wp_get_theme();
240 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),
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 243
             'Home URL' => home_url(),
244 244
             'Language' => get_locale(),
245 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'),
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 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()),
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 258
             'WP Memory Limit' => WP_MEMORY_LIMIT,
259 259
         ];
260 260
     }
@@ -284,13 +284,13 @@  discard block
 block discarded – undo
284 284
             'secureserver.net' => 'GoDaddy',
285 285
             'WPE_APIKEY' => 'WP Engine',
286 286
         ];
287
-        foreach ($checks as $key => $value) {
288
-            if (!$this->isWebhostCheckValid($key)) {
287
+        foreach( $checks as $key => $value ) {
288
+            if( !$this->isWebhostCheckValid( $key ) ) {
289 289
                 continue;
290 290
             }
291 291
             return $value;
292 292
         }
293
-        return implode(',', array_filter([DB_HOST, filter_input(INPUT_SERVER, 'SERVER_NAME')]));
293
+        return implode( ',', array_filter( [DB_HOST, filter_input( INPUT_SERVER, 'SERVER_NAME' )] ) );
294 294
     }
295 295
 
296 296
     /**
@@ -298,16 +298,16 @@  discard block
 block discarded – undo
298 298
      */
299 299
     protected function getHostName()
300 300
     {
301
-        return sprintf('%s (%s)',
301
+        return sprintf( '%s (%s)',
302 302
             $this->detectWebhostProvider(),
303 303
             Helper::getIpAddress()
304 304
         );
305 305
     }
306 306
 
307
-    protected function getINI($name, $disabledValue = 'ini_get() is disabled.')
307
+    protected function getINI( $name, $disabledValue = 'ini_get() is disabled.' )
308 308
     {
309
-        return function_exists('ini_get')
310
-            ? ini_get($name)
309
+        return function_exists( 'ini_get' )
310
+            ? ini_get( $name )
311 311
             : $disabledValue;
312 312
     }
313 313
 
@@ -317,9 +317,9 @@  discard block
 block discarded – undo
317 317
     protected function getWordpressPlugins()
318 318
     {
319 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));
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 323
         return $active + $inactive;
324 324
     }
325 325
 
@@ -327,48 +327,48 @@  discard block
 block discarded – undo
327 327
      * @param string $title
328 328
      * @return string
329 329
      */
330
-    protected function implode($title, array $details)
330
+    protected function implode( $title, array $details )
331 331
     {
332 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)
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 338
                 : ' - '.$value;
339 339
         }
340
-        return implode(PHP_EOL, $strings).PHP_EOL.PHP_EOL;
340
+        return implode( PHP_EOL, $strings ).PHP_EOL.PHP_EOL;
341 341
     }
342 342
 
343 343
     /**
344 344
      * @param string $key
345 345
      * @return bool
346 346
      */
347
-    protected function isWebhostCheckValid($key)
347
+    protected function isWebhostCheckValid( $key )
348 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);
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 354
     }
355 355
 
356 356
     /**
357 357
      * @return array
358 358
      */
359
-    protected function normalizePluginList(array $plugins)
359
+    protected function normalizePluginList( array $plugins )
360 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);
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 366
     }
367 367
 
368 368
     /**
369 369
      * @return array
370 370
      */
371
-    protected function purgeSensitiveData(array $settings)
371
+    protected function purgeSensitiveData( array $settings )
372 372
     {
373 373
         $keys = [
374 374
             'general.trustalyze_serial',
@@ -376,12 +376,12 @@  discard block
 block discarded – undo
376 376
             'submissions.recaptcha.key',
377 377
             'submissions.recaptcha.secret',
378 378
         ];
379
-        array_walk($settings, function (&$value, $setting) use ($keys) {
380
-            foreach ($keys as $key) {
381
-                if (!Str::startsWith($key, $setting) || empty($value)) {
379
+        array_walk( $settings, function( &$value, $setting ) use ($keys) {
380
+            foreach( $keys as $key ) {
381
+                if( !Str::startsWith( $key, $setting ) || empty($value) ) {
382 382
                     continue;
383 383
                 }
384
-                $value = str_repeat('•', 13);
384
+                $value = str_repeat( '•', 13 );
385 385
                 return;
386 386
             }
387 387
         });
Please login to merge, or discard this patch.
uninstall.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,23 +1,23 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-defined('WP_UNINSTALL_PLUGIN') || die;
3
+defined( 'WP_UNINSTALL_PLUGIN' ) || die;
4 4
 
5 5
 $file = __DIR__.'/site-reviews.php';
6 6
 require_once $file;
7 7
 
8
-if (!(new GL_Plugin_Check_v4($file))->isValid()) {
8
+if( !(new GL_Plugin_Check_v4( $file ))->isValid() ) {
9 9
     return;
10 10
 }
11
-delete_option(GeminiLabs\SiteReviews\Database\OptionManager::databaseKey(3));
12
-delete_option(GeminiLabs\SiteReviews\Database\OptionManager::databaseKey(4));
13
-delete_option('_glsr_trustalyze');
14
-delete_option('widget_'.glsr()->id.'_site-reviews');
15
-delete_option('widget_'.glsr()->id.'_site-reviews-form');
16
-delete_option('widget_'.glsr()->id.'_site-reviews-summary');
17
-delete_transient(glsr()->id.'_cloudflare_ips');
18
-delete_transient(glsr()->id.'_remote_post_test');
19
-wp_cache_delete(glsr()->id);
11
+delete_option( GeminiLabs\SiteReviews\Database\OptionManager::databaseKey( 3 ) );
12
+delete_option( GeminiLabs\SiteReviews\Database\OptionManager::databaseKey( 4 ) );
13
+delete_option( '_glsr_trustalyze' );
14
+delete_option( 'widget_'.glsr()->id.'_site-reviews' );
15
+delete_option( 'widget_'.glsr()->id.'_site-reviews-form' );
16
+delete_option( 'widget_'.glsr()->id.'_site-reviews-summary' );
17
+delete_transient( glsr()->id.'_cloudflare_ips' );
18
+delete_transient( glsr()->id.'_remote_post_test' );
19
+wp_cache_delete( glsr()->id );
20 20
 
21 21
 global $wpdb;
22 22
 
23
-$wpdb->query("DELETE FROM {$wpdb->usermeta} WHERE meta_key = '_glsr_notices'");
23
+$wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE meta_key = '_glsr_notices'" );
Please login to merge, or discard this patch.
views/pages/welcome/support.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3 3
 <p class="about-description">
4
-    Still need help with <?= glsr()->name; ?>? We offer excellent support, but don't forget to check our <a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=documentation#tab-shortcodes'); ?>">documentation</a> first.
4
+    Still need help with <?= glsr()->name; ?>? We offer excellent support, but don't forget to check our <a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=documentation#tab-shortcodes' ); ?>">documentation</a> first.
5 5
 </p>
6 6
 <div class="is-fullwidth">
7 7
     <div class="glsr-flex-row glsr-has-2-columns">
Please login to merge, or discard this patch.