Passed
Push — master ( f48539...8e7eaf )
by Paul
04:07
created
plugin/Filters.php 2 patches
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -15,64 +15,64 @@
 block discarded – undo
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('display_post_states',                                       [$this->translator, 'filterPostStates'], 10, 2);
69
-        add_filter('site-reviews/gettext/default',                              [$this->translator, 'filterPostStatusLabels'], 10, 2);
70
-        add_filter('site-reviews/gettext_with_context/default',                 [$this->translator, 'filterPostStatusLabels'], 10, 2);
71
-        add_filter('site-reviews/ngettext/default',                             [$this->translator, 'filterPostStatusText'], 10, 4);
72
-        add_filter('site-reviews/settings/callback',                            [$this->trustalyze, 'filterSettingsCallback']);
73
-        add_filter('site-reviews/interpolate/partials/form/table-row-multiple', [$this->trustalyze, 'filterSettingsTableRow'], 10, 3);
74
-        add_filter('plugin_action_links_'.$this->basename,                      [$this->welcome, 'filterActionLinks'], 9);
75
-        add_filter('admin_title',                                               [$this->welcome, 'filterAdminTitle']);
76
-        add_filter('admin_footer_text',                                         [$this->welcome, 'filterFooterText']);
77
-    }
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('display_post_states',                                       [$this->translator, 'filterPostStates'], 10, 2);
69
+		add_filter('site-reviews/gettext/default',                              [$this->translator, 'filterPostStatusLabels'], 10, 2);
70
+		add_filter('site-reviews/gettext_with_context/default',                 [$this->translator, 'filterPostStatusLabels'], 10, 2);
71
+		add_filter('site-reviews/ngettext/default',                             [$this->translator, 'filterPostStatusText'], 10, 4);
72
+		add_filter('site-reviews/settings/callback',                            [$this->trustalyze, 'filterSettingsCallback']);
73
+		add_filter('site-reviews/interpolate/partials/form/table-row-multiple', [$this->trustalyze, 'filterSettingsTableRow'], 10, 3);
74
+		add_filter('plugin_action_links_'.$this->basename,                      [$this->welcome, 'filterActionLinks'], 9);
75
+		add_filter('admin_title',                                               [$this->welcome, 'filterAdminTitle']);
76
+		add_filter('admin_footer_text',                                         [$this->welcome, 'filterFooterText']);
77
+	}
78 78
 }
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 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,34 +45,34 @@  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('display_post_states',                                       [$this->translator, 'filterPostStates'], 10, 2);
69
-        add_filter('site-reviews/gettext/default',                              [$this->translator, 'filterPostStatusLabels'], 10, 2);
70
-        add_filter('site-reviews/gettext_with_context/default',                 [$this->translator, 'filterPostStatusLabels'], 10, 2);
71
-        add_filter('site-reviews/ngettext/default',                             [$this->translator, 'filterPostStatusText'], 10, 4);
72
-        add_filter('site-reviews/settings/callback',                            [$this->trustalyze, 'filterSettingsCallback']);
73
-        add_filter('site-reviews/interpolate/partials/form/table-row-multiple', [$this->trustalyze, 'filterSettingsTableRow'], 10, 3);
74
-        add_filter('plugin_action_links_'.$this->basename,                      [$this->welcome, 'filterActionLinks'], 9);
75
-        add_filter('admin_title',                                               [$this->welcome, 'filterAdminTitle']);
76
-        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( 'display_post_states', [$this->translator, 'filterPostStates'], 10, 2 );
69
+        add_filter( 'site-reviews/gettext/default', [$this->translator, 'filterPostStatusLabels'], 10, 2 );
70
+        add_filter( 'site-reviews/gettext_with_context/default', [$this->translator, 'filterPostStatusLabels'], 10, 2 );
71
+        add_filter( 'site-reviews/ngettext/default', [$this->translator, 'filterPostStatusText'], 10, 4 );
72
+        add_filter( 'site-reviews/settings/callback', [$this->trustalyze, 'filterSettingsCallback'] );
73
+        add_filter( 'site-reviews/interpolate/partials/form/table-row-multiple', [$this->trustalyze, 'filterSettingsTableRow'], 10, 3 );
74
+        add_filter( 'plugin_action_links_'.$this->basename, [$this->welcome, 'filterActionLinks'], 9 );
75
+        add_filter( 'admin_title', [$this->welcome, 'filterAdminTitle'] );
76
+        add_filter( 'admin_footer_text', [$this->welcome, 'filterFooterText'] );
77 77
     }
78 78
 }
Please login to merge, or discard this patch.
plugin/Controllers/ListTableController/Columns.php 2 patches
Indentation   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -10,184 +10,184 @@
 block discarded – undo
10 10
 
11 11
 class Columns
12 12
 {
13
-    /**
14
-     * @param int $postId
15
-     * @return void|string
16
-     */
17
-    public function buildColumnAssignedTo($postId)
18
-    {
19
-        $assignedPost = glsr(Database::class)->getAssignedToPost($postId);
20
-        if ($assignedPost instanceof WP_Post && 'publish' == $assignedPost->post_status) {
21
-            return glsr(Builder::class)->a(get_the_title($assignedPost->ID), [
22
-                'href' => (string) get_the_permalink($assignedPost->ID),
23
-            ]);
24
-        }
25
-    }
13
+	/**
14
+	 * @param int $postId
15
+	 * @return void|string
16
+	 */
17
+	public function buildColumnAssignedTo($postId)
18
+	{
19
+		$assignedPost = glsr(Database::class)->getAssignedToPost($postId);
20
+		if ($assignedPost instanceof WP_Post && 'publish' == $assignedPost->post_status) {
21
+			return glsr(Builder::class)->a(get_the_title($assignedPost->ID), [
22
+				'href' => (string) get_the_permalink($assignedPost->ID),
23
+			]);
24
+		}
25
+	}
26 26
 
27
-    /**
28
-     * @param int $postId
29
-     * @return void|string
30
-     */
31
-    public function buildColumnEmail($postId)
32
-    {
33
-        if ($email = glsr(Database::class)->get($postId, 'email')) {
34
-            return $email;
35
-        }
36
-    }
27
+	/**
28
+	 * @param int $postId
29
+	 * @return void|string
30
+	 */
31
+	public function buildColumnEmail($postId)
32
+	{
33
+		if ($email = glsr(Database::class)->get($postId, 'email')) {
34
+			return $email;
35
+		}
36
+	}
37 37
 
38
-    /**
39
-     * @param int $postId
40
-     * @return void|string
41
-     */
42
-    public function buildColumnIpAddress($postId)
43
-    {
44
-        if ($ipAddress = glsr(Database::class)->get($postId, 'ip_address')) {
45
-            return $ipAddress;
46
-        }
47
-    }
38
+	/**
39
+	 * @param int $postId
40
+	 * @return void|string
41
+	 */
42
+	public function buildColumnIpAddress($postId)
43
+	{
44
+		if ($ipAddress = glsr(Database::class)->get($postId, 'ip_address')) {
45
+			return $ipAddress;
46
+		}
47
+	}
48 48
 
49
-    /**
50
-     * @param int $postId
51
-     * @return string
52
-     */
53
-    public function buildColumnPinned($postId)
54
-    {
55
-        $pinned = glsr(Database::class)->get($postId, 'pinned')
56
-            ? 'pinned '
57
-            : '';
58
-        if (glsr()->can('edit_others_posts')) {
59
-            $pinned.= 'pin-review ';
60
-        }
61
-        return glsr(Builder::class)->i([
62
-            'class' => $pinned.'dashicons dashicons-sticky',
63
-            'data-id' => $postId,
64
-        ]);
65
-    }
49
+	/**
50
+	 * @param int $postId
51
+	 * @return string
52
+	 */
53
+	public function buildColumnPinned($postId)
54
+	{
55
+		$pinned = glsr(Database::class)->get($postId, 'pinned')
56
+			? 'pinned '
57
+			: '';
58
+		if (glsr()->can('edit_others_posts')) {
59
+			$pinned.= 'pin-review ';
60
+		}
61
+		return glsr(Builder::class)->i([
62
+			'class' => $pinned.'dashicons dashicons-sticky',
63
+			'data-id' => $postId,
64
+		]);
65
+	}
66 66
 
67
-    /**
68
-     * @param int $postId
69
-     * @return string
70
-     */
71
-    public function buildColumnResponse($postId)
72
-    {
73
-        return glsr(Database::class)->get($postId, 'response')
74
-            ? __('Yes', 'site-reviews')
75
-            : __('No', 'site-reviews');
76
-    }
67
+	/**
68
+	 * @param int $postId
69
+	 * @return string
70
+	 */
71
+	public function buildColumnResponse($postId)
72
+	{
73
+		return glsr(Database::class)->get($postId, 'response')
74
+			? __('Yes', 'site-reviews')
75
+			: __('No', 'site-reviews');
76
+	}
77 77
 
78
-    /**
79
-     * @param int $postId
80
-     * @return string
81
-     */
82
-    public function buildColumnReviewer($postId)
83
-    {
84
-        $author = strval(glsr(Database::class)->get($postId, 'author'));
85
-        $userId = Helper::castToInt(get_post($postId)->post_author);
86
-        return !empty($userId)
87
-            ? glsr(Builder::class)->a($author, ['href' => get_author_posts_url($userId)])
88
-            : $author;
89
-    }
78
+	/**
79
+	 * @param int $postId
80
+	 * @return string
81
+	 */
82
+	public function buildColumnReviewer($postId)
83
+	{
84
+		$author = strval(glsr(Database::class)->get($postId, 'author'));
85
+		$userId = Helper::castToInt(get_post($postId)->post_author);
86
+		return !empty($userId)
87
+			? glsr(Builder::class)->a($author, ['href' => get_author_posts_url($userId)])
88
+			: $author;
89
+	}
90 90
 
91
-    /**
92
-     * @param int $postId
93
-     * @param int|null $rating
94
-     * @return string
95
-     */
96
-    public function buildColumnRating($postId)
97
-    {
98
-        return glsr_star_rating(intval(glsr(Database::class)->get($postId, 'rating')));
99
-    }
91
+	/**
92
+	 * @param int $postId
93
+	 * @param int|null $rating
94
+	 * @return string
95
+	 */
96
+	public function buildColumnRating($postId)
97
+	{
98
+		return glsr_star_rating(intval(glsr(Database::class)->get($postId, 'rating')));
99
+	}
100 100
 
101
-    /**
102
-     * @param int $postId
103
-     * @return string
104
-     */
105
-    public function buildColumnReviewType($postId)
106
-    {
107
-        $type = glsr(Database::class)->get($postId, 'review_type');
108
-        return array_key_exists($type, glsr()->reviewTypes)
109
-            ? glsr()->reviewTypes[$type]
110
-            : __('Unsupported Type', 'site-reviews');
111
-    }
101
+	/**
102
+	 * @param int $postId
103
+	 * @return string
104
+	 */
105
+	public function buildColumnReviewType($postId)
106
+	{
107
+		$type = glsr(Database::class)->get($postId, 'review_type');
108
+		return array_key_exists($type, glsr()->reviewTypes)
109
+			? glsr()->reviewTypes[$type]
110
+			: __('Unsupported Type', 'site-reviews');
111
+	}
112 112
 
113
-    /**
114
-     * @param string $postType
115
-     * @return void
116
-     */
117
-    public function renderFilters($postType)
118
-    {
119
-        if (Application::POST_TYPE !== $postType) {
120
-            return;
121
-        }
122
-        if (!($status = filter_input(INPUT_GET, 'post_status'))) {
123
-            $status = 'publish';
124
-        }
125
-        $ratings = glsr(Database::class)->getReviewsMeta('rating', $status);
126
-        $types = glsr(Database::class)->getReviewsMeta('review_type', $status);
127
-        $this->renderFilterRatings($ratings);
128
-        $this->renderFilterTypes($types);
129
-    }
113
+	/**
114
+	 * @param string $postType
115
+	 * @return void
116
+	 */
117
+	public function renderFilters($postType)
118
+	{
119
+		if (Application::POST_TYPE !== $postType) {
120
+			return;
121
+		}
122
+		if (!($status = filter_input(INPUT_GET, 'post_status'))) {
123
+			$status = 'publish';
124
+		}
125
+		$ratings = glsr(Database::class)->getReviewsMeta('rating', $status);
126
+		$types = glsr(Database::class)->getReviewsMeta('review_type', $status);
127
+		$this->renderFilterRatings($ratings);
128
+		$this->renderFilterTypes($types);
129
+	}
130 130
 
131
-    /**
132
-     * @param string $column
133
-     * @param int $postId
134
-     * @return void
135
-     */
136
-    public function renderValues($column, $postId)
137
-    {
138
-        $method = Helper::buildMethodName($column, 'buildColumn');
139
-        $value = method_exists($this, $method)
140
-            ? call_user_func([$this, $method], $postId)
141
-            : '';
142
-        $value = apply_filters('site-reviews/columns/'.$column, $value, $postId);
143
-        if (0 !== $value && empty($value)) {
144
-            $value = '—';
145
-        }
146
-        echo $value;
147
-    }
131
+	/**
132
+	 * @param string $column
133
+	 * @param int $postId
134
+	 * @return void
135
+	 */
136
+	public function renderValues($column, $postId)
137
+	{
138
+		$method = Helper::buildMethodName($column, 'buildColumn');
139
+		$value = method_exists($this, $method)
140
+			? call_user_func([$this, $method], $postId)
141
+			: '';
142
+		$value = apply_filters('site-reviews/columns/'.$column, $value, $postId);
143
+		if (0 !== $value && empty($value)) {
144
+			$value = '—';
145
+		}
146
+		echo $value;
147
+	}
148 148
 
149
-    /**
150
-     * @param array $ratings
151
-     * @return void
152
-     */
153
-    protected function renderFilterRatings($ratings)
154
-    {
155
-        if (empty($ratings)) {
156
-            return;
157
-        }
158
-        $ratings = array_flip(array_reverse($ratings));
159
-        array_walk($ratings, function (&$value, $key) {
160
-            $label = _n('%s star', '%s stars', $key, 'site-reviews');
161
-            $value = sprintf($label, $key);
162
-        });
163
-        echo glsr(Builder::class)->label(__('Filter by rating', 'site-reviews'), [
164
-            'class' => 'screen-reader-text',
165
-            'for' => 'rating',
166
-        ]);
167
-        echo glsr(Builder::class)->select([
168
-            'name' => 'rating',
169
-            'options' => ['' => __('All ratings', 'site-reviews')] + $ratings,
170
-            'value' => filter_input(INPUT_GET, 'rating'),
171
-        ]);
172
-    }
149
+	/**
150
+	 * @param array $ratings
151
+	 * @return void
152
+	 */
153
+	protected function renderFilterRatings($ratings)
154
+	{
155
+		if (empty($ratings)) {
156
+			return;
157
+		}
158
+		$ratings = array_flip(array_reverse($ratings));
159
+		array_walk($ratings, function (&$value, $key) {
160
+			$label = _n('%s star', '%s stars', $key, 'site-reviews');
161
+			$value = sprintf($label, $key);
162
+		});
163
+		echo glsr(Builder::class)->label(__('Filter by rating', 'site-reviews'), [
164
+			'class' => 'screen-reader-text',
165
+			'for' => 'rating',
166
+		]);
167
+		echo glsr(Builder::class)->select([
168
+			'name' => 'rating',
169
+			'options' => ['' => __('All ratings', 'site-reviews')] + $ratings,
170
+			'value' => filter_input(INPUT_GET, 'rating'),
171
+		]);
172
+	}
173 173
 
174
-    /**
175
-     * @param array $types
176
-     * @return void
177
-     */
178
-    protected function renderFilterTypes($types)
179
-    {
180
-        if (count(glsr()->reviewTypes) < 2) {
181
-            return;
182
-        }
183
-        echo glsr(Builder::class)->label(__('Filter by type', 'site-reviews'), [
184
-            'class' => 'screen-reader-text',
185
-            'for' => 'review_type',
186
-        ]);
187
-        echo glsr(Builder::class)->select([
188
-            'name' => 'review_type',
189
-            'options' => ['' => __('All types', 'site-reviews')] + glsr()->reviewTypes,
190
-            'value' => filter_input(INPUT_GET, 'review_type'),
191
-        ]);
192
-    }
174
+	/**
175
+	 * @param array $types
176
+	 * @return void
177
+	 */
178
+	protected function renderFilterTypes($types)
179
+	{
180
+		if (count(glsr()->reviewTypes) < 2) {
181
+			return;
182
+		}
183
+		echo glsr(Builder::class)->label(__('Filter by type', 'site-reviews'), [
184
+			'class' => 'screen-reader-text',
185
+			'for' => 'review_type',
186
+		]);
187
+		echo glsr(Builder::class)->select([
188
+			'name' => 'review_type',
189
+			'options' => ['' => __('All types', 'site-reviews')] + glsr()->reviewTypes,
190
+			'value' => filter_input(INPUT_GET, 'review_type'),
191
+		]);
192
+	}
193 193
 }
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
      * @param int $postId
15 15
      * @return void|string
16 16
      */
17
-    public function buildColumnAssignedTo($postId)
17
+    public function buildColumnAssignedTo( $postId )
18 18
     {
19
-        $assignedPost = glsr(Database::class)->getAssignedToPost($postId);
20
-        if ($assignedPost instanceof WP_Post && 'publish' == $assignedPost->post_status) {
21
-            return glsr(Builder::class)->a(get_the_title($assignedPost->ID), [
22
-                'href' => (string) get_the_permalink($assignedPost->ID),
23
-            ]);
19
+        $assignedPost = glsr( Database::class )->getAssignedToPost( $postId );
20
+        if( $assignedPost instanceof WP_Post && 'publish' == $assignedPost->post_status ) {
21
+            return glsr( Builder::class )->a( get_the_title( $assignedPost->ID ), [
22
+                'href' => (string)get_the_permalink( $assignedPost->ID ),
23
+            ] );
24 24
         }
25 25
     }
26 26
 
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
      * @param int $postId
29 29
      * @return void|string
30 30
      */
31
-    public function buildColumnEmail($postId)
31
+    public function buildColumnEmail( $postId )
32 32
     {
33
-        if ($email = glsr(Database::class)->get($postId, 'email')) {
33
+        if( $email = glsr( Database::class )->get( $postId, 'email' ) ) {
34 34
             return $email;
35 35
         }
36 36
     }
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
      * @param int $postId
40 40
      * @return void|string
41 41
      */
42
-    public function buildColumnIpAddress($postId)
42
+    public function buildColumnIpAddress( $postId )
43 43
     {
44
-        if ($ipAddress = glsr(Database::class)->get($postId, 'ip_address')) {
44
+        if( $ipAddress = glsr( Database::class )->get( $postId, 'ip_address' ) ) {
45 45
             return $ipAddress;
46 46
         }
47 47
     }
@@ -50,41 +50,41 @@  discard block
 block discarded – undo
50 50
      * @param int $postId
51 51
      * @return string
52 52
      */
53
-    public function buildColumnPinned($postId)
53
+    public function buildColumnPinned( $postId )
54 54
     {
55
-        $pinned = glsr(Database::class)->get($postId, 'pinned')
55
+        $pinned = glsr( Database::class )->get( $postId, 'pinned' )
56 56
             ? 'pinned '
57 57
             : '';
58
-        if (glsr()->can('edit_others_posts')) {
59
-            $pinned.= 'pin-review ';
58
+        if( glsr()->can( 'edit_others_posts' ) ) {
59
+            $pinned .= 'pin-review ';
60 60
         }
61
-        return glsr(Builder::class)->i([
61
+        return glsr( Builder::class )->i( [
62 62
             'class' => $pinned.'dashicons dashicons-sticky',
63 63
             'data-id' => $postId,
64
-        ]);
64
+        ] );
65 65
     }
66 66
 
67 67
     /**
68 68
      * @param int $postId
69 69
      * @return string
70 70
      */
71
-    public function buildColumnResponse($postId)
71
+    public function buildColumnResponse( $postId )
72 72
     {
73
-        return glsr(Database::class)->get($postId, 'response')
74
-            ? __('Yes', 'site-reviews')
75
-            : __('No', 'site-reviews');
73
+        return glsr( Database::class )->get( $postId, 'response' )
74
+            ? __( 'Yes', 'site-reviews' )
75
+            : __( 'No', 'site-reviews' );
76 76
     }
77 77
 
78 78
     /**
79 79
      * @param int $postId
80 80
      * @return string
81 81
      */
82
-    public function buildColumnReviewer($postId)
82
+    public function buildColumnReviewer( $postId )
83 83
     {
84
-        $author = strval(glsr(Database::class)->get($postId, 'author'));
85
-        $userId = Helper::castToInt(get_post($postId)->post_author);
84
+        $author = strval( glsr( Database::class )->get( $postId, 'author' ) );
85
+        $userId = Helper::castToInt( get_post( $postId )->post_author );
86 86
         return !empty($userId)
87
-            ? glsr(Builder::class)->a($author, ['href' => get_author_posts_url($userId)])
87
+            ? glsr( Builder::class )->a( $author, ['href' => get_author_posts_url( $userId )] )
88 88
             : $author;
89 89
     }
90 90
 
@@ -93,39 +93,39 @@  discard block
 block discarded – undo
93 93
      * @param int|null $rating
94 94
      * @return string
95 95
      */
96
-    public function buildColumnRating($postId)
96
+    public function buildColumnRating( $postId )
97 97
     {
98
-        return glsr_star_rating(intval(glsr(Database::class)->get($postId, 'rating')));
98
+        return glsr_star_rating( intval( glsr( Database::class )->get( $postId, 'rating' ) ) );
99 99
     }
100 100
 
101 101
     /**
102 102
      * @param int $postId
103 103
      * @return string
104 104
      */
105
-    public function buildColumnReviewType($postId)
105
+    public function buildColumnReviewType( $postId )
106 106
     {
107
-        $type = glsr(Database::class)->get($postId, 'review_type');
108
-        return array_key_exists($type, glsr()->reviewTypes)
107
+        $type = glsr( Database::class )->get( $postId, 'review_type' );
108
+        return array_key_exists( $type, glsr()->reviewTypes )
109 109
             ? glsr()->reviewTypes[$type]
110
-            : __('Unsupported Type', 'site-reviews');
110
+            : __( 'Unsupported Type', 'site-reviews' );
111 111
     }
112 112
 
113 113
     /**
114 114
      * @param string $postType
115 115
      * @return void
116 116
      */
117
-    public function renderFilters($postType)
117
+    public function renderFilters( $postType )
118 118
     {
119
-        if (Application::POST_TYPE !== $postType) {
119
+        if( Application::POST_TYPE !== $postType ) {
120 120
             return;
121 121
         }
122
-        if (!($status = filter_input(INPUT_GET, 'post_status'))) {
122
+        if( !($status = filter_input( INPUT_GET, 'post_status' )) ) {
123 123
             $status = 'publish';
124 124
         }
125
-        $ratings = glsr(Database::class)->getReviewsMeta('rating', $status);
126
-        $types = glsr(Database::class)->getReviewsMeta('review_type', $status);
127
-        $this->renderFilterRatings($ratings);
128
-        $this->renderFilterTypes($types);
125
+        $ratings = glsr( Database::class )->getReviewsMeta( 'rating', $status );
126
+        $types = glsr( Database::class )->getReviewsMeta( 'review_type', $status );
127
+        $this->renderFilterRatings( $ratings );
128
+        $this->renderFilterTypes( $types );
129 129
     }
130 130
 
131 131
     /**
@@ -133,14 +133,14 @@  discard block
 block discarded – undo
133 133
      * @param int $postId
134 134
      * @return void
135 135
      */
136
-    public function renderValues($column, $postId)
136
+    public function renderValues( $column, $postId )
137 137
     {
138
-        $method = Helper::buildMethodName($column, 'buildColumn');
139
-        $value = method_exists($this, $method)
140
-            ? call_user_func([$this, $method], $postId)
138
+        $method = Helper::buildMethodName( $column, 'buildColumn' );
139
+        $value = method_exists( $this, $method )
140
+            ? call_user_func( [$this, $method], $postId )
141 141
             : '';
142
-        $value = apply_filters('site-reviews/columns/'.$column, $value, $postId);
143
-        if (0 !== $value && empty($value)) {
142
+        $value = apply_filters( 'site-reviews/columns/'.$column, $value, $postId );
143
+        if( 0 !== $value && empty($value) ) {
144 144
             $value = '&mdash;';
145 145
         }
146 146
         echo $value;
@@ -150,44 +150,44 @@  discard block
 block discarded – undo
150 150
      * @param array $ratings
151 151
      * @return void
152 152
      */
153
-    protected function renderFilterRatings($ratings)
153
+    protected function renderFilterRatings( $ratings )
154 154
     {
155
-        if (empty($ratings)) {
155
+        if( empty($ratings) ) {
156 156
             return;
157 157
         }
158
-        $ratings = array_flip(array_reverse($ratings));
159
-        array_walk($ratings, function (&$value, $key) {
160
-            $label = _n('%s star', '%s stars', $key, 'site-reviews');
161
-            $value = sprintf($label, $key);
158
+        $ratings = array_flip( array_reverse( $ratings ) );
159
+        array_walk( $ratings, function( &$value, $key ) {
160
+            $label = _n( '%s star', '%s stars', $key, 'site-reviews' );
161
+            $value = sprintf( $label, $key );
162 162
         });
163
-        echo glsr(Builder::class)->label(__('Filter by rating', 'site-reviews'), [
163
+        echo glsr( Builder::class )->label( __( 'Filter by rating', 'site-reviews' ), [
164 164
             'class' => 'screen-reader-text',
165 165
             'for' => 'rating',
166
-        ]);
167
-        echo glsr(Builder::class)->select([
166
+        ] );
167
+        echo glsr( Builder::class )->select( [
168 168
             'name' => 'rating',
169
-            'options' => ['' => __('All ratings', 'site-reviews')] + $ratings,
170
-            'value' => filter_input(INPUT_GET, 'rating'),
171
-        ]);
169
+            'options' => ['' => __( 'All ratings', 'site-reviews' )] + $ratings,
170
+            'value' => filter_input( INPUT_GET, 'rating' ),
171
+        ] );
172 172
     }
173 173
 
174 174
     /**
175 175
      * @param array $types
176 176
      * @return void
177 177
      */
178
-    protected function renderFilterTypes($types)
178
+    protected function renderFilterTypes( $types )
179 179
     {
180
-        if (count(glsr()->reviewTypes) < 2) {
180
+        if( count( glsr()->reviewTypes ) < 2 ) {
181 181
             return;
182 182
         }
183
-        echo glsr(Builder::class)->label(__('Filter by type', 'site-reviews'), [
183
+        echo glsr( Builder::class )->label( __( 'Filter by type', 'site-reviews' ), [
184 184
             'class' => 'screen-reader-text',
185 185
             'for' => 'review_type',
186
-        ]);
187
-        echo glsr(Builder::class)->select([
186
+        ] );
187
+        echo glsr( Builder::class )->select( [
188 188
             'name' => 'review_type',
189
-            'options' => ['' => __('All types', 'site-reviews')] + glsr()->reviewTypes,
190
-            'value' => filter_input(INPUT_GET, 'review_type'),
191
-        ]);
189
+            'options' => ['' => __( 'All types', 'site-reviews' )] + glsr()->reviewTypes,
190
+            'value' => filter_input( INPUT_GET, 'review_type' ),
191
+        ] );
192 192
     }
193 193
 }
Please login to merge, or discard this patch.