Passed
Push — master ( 4321c5...7f1e4d )
by Paul
07:58 queued 04:14
created
plugin/Shortcodes/SiteReviewsPopup.php 2 patches
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -4,84 +4,84 @@
 block discarded – undo
4 4
 
5 5
 class SiteReviewsPopup extends TinymcePopupGenerator
6 6
 {
7
-    /**
8
-     * @return array
9
-     */
10
-    public function fields()
11
-    {
12
-        return [[
13
-            'html' => sprintf('<p class="strong">%s</p>', esc_html__('All settings are optional.', 'site-reviews')),
14
-            'minWidth' => 320,
15
-            'type' => 'container',
16
-        ], [
17
-            'label' => esc_html__('Title', 'site-reviews'),
18
-            'name' => 'title',
19
-            'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
20
-            'type' => 'textbox',
21
-        ], [
22
-            'label' => esc_html__('Display', 'site-reviews'),
23
-            'maxLength' => 5,
24
-            'name' => 'display',
25
-            'size' => 3,
26
-            'text' => '10',
27
-            'tooltip' => __('How many reviews would you like to display (default: 10)?', 'site-reviews'),
28
-            'type' => 'textbox',
29
-        ], [
30
-            'label' => esc_html__('Rating', 'site-reviews'),
31
-            'name' => 'rating',
32
-            'options' => [
33
-                '5' => esc_html(sprintf(_n('%s star', '%s stars', 5, 'site-reviews'), 5)),
34
-                '4' => esc_html(sprintf(_n('%s star', '%s stars', 4, 'site-reviews'), 4)),
35
-                '3' => esc_html(sprintf(_n('%s star', '%s stars', 3, 'site-reviews'), 3)),
36
-                '2' => esc_html(sprintf(_n('%s star', '%s stars', 2, 'site-reviews'), 2)),
37
-                '1' => esc_html(sprintf(_n('%s star', '%s stars', 1, 'site-reviews'), 1)),
38
-                '0' => esc_html(__('Unrated', 'site-reviews')),
39
-            ],
40
-            'tooltip' => __('What is the minimum rating to display (default: 1 star)?', 'site-reviews'),
41
-            'type' => 'listbox',
42
-        ], [
43
-            'label' => esc_html__('Pagination', 'site-reviews'),
44
-            'name' => 'pagination',
45
-            'options' => [
46
-                'true' => esc_html__('Enable', 'site-reviews'),
47
-                'ajax' => esc_html__('Enable (using ajax)', 'site-reviews'),
48
-                'false' => esc_html__('Disable', 'site-reviews'),
49
-            ],
50
-            'tooltip' => __('When using pagination this shortcode can only be used once on a page. (default: disable)', 'site-reviews'),
51
-            'type' => 'listbox',
52
-        ],
53
-        $this->getTypes(__('Which type of review would you like to display?', 'site-reviews')),
54
-        $this->getCategories(__('Limit reviews to this category.', 'site-reviews')),
55
-        [
56
-            'label' => esc_html__('Assigned To', 'site-reviews'),
57
-            'name' => 'assigned_to',
58
-            'tooltip' => __('Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page, or "parent_id" to use the ID of the parent page.', 'site-reviews'),
59
-            'type' => 'textbox',
60
-        ], [
61
-            'label' => esc_html__('Schema', 'site-reviews'),
62
-            'name' => 'schema',
63
-            'options' => [
64
-                'true' => esc_html__('Enable rich snippets', 'site-reviews'),
65
-                'false' => esc_html__('Disable rich snippets', 'site-reviews'),
66
-            ],
67
-            'tooltip' => __('Rich snippets are disabled by default.', 'site-reviews'),
68
-            'type' => 'listbox',
69
-        ], [
70
-            'label' => esc_html__('Classes', 'site-reviews'),
71
-            'name' => 'class',
72
-            'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
73
-            'type' => 'textbox',
74
-        ], [
75
-            'columns' => 2,
76
-            'items' => $this->getHideOptions(),
77
-            'label' => esc_html__('Hide', 'site-reviews'),
78
-            'layout' => 'grid',
79
-            'spacing' => 5,
80
-            'type' => 'container',
81
-        ], [
82
-            'hidden' => true,
83
-            'name' => 'id',
84
-            'type' => 'textbox',
85
-        ], ];
86
-    }
7
+	/**
8
+	 * @return array
9
+	 */
10
+	public function fields()
11
+	{
12
+		return [[
13
+			'html' => sprintf('<p class="strong">%s</p>', esc_html__('All settings are optional.', 'site-reviews')),
14
+			'minWidth' => 320,
15
+			'type' => 'container',
16
+		], [
17
+			'label' => esc_html__('Title', 'site-reviews'),
18
+			'name' => 'title',
19
+			'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
20
+			'type' => 'textbox',
21
+		], [
22
+			'label' => esc_html__('Display', 'site-reviews'),
23
+			'maxLength' => 5,
24
+			'name' => 'display',
25
+			'size' => 3,
26
+			'text' => '10',
27
+			'tooltip' => __('How many reviews would you like to display (default: 10)?', 'site-reviews'),
28
+			'type' => 'textbox',
29
+		], [
30
+			'label' => esc_html__('Rating', 'site-reviews'),
31
+			'name' => 'rating',
32
+			'options' => [
33
+				'5' => esc_html(sprintf(_n('%s star', '%s stars', 5, 'site-reviews'), 5)),
34
+				'4' => esc_html(sprintf(_n('%s star', '%s stars', 4, 'site-reviews'), 4)),
35
+				'3' => esc_html(sprintf(_n('%s star', '%s stars', 3, 'site-reviews'), 3)),
36
+				'2' => esc_html(sprintf(_n('%s star', '%s stars', 2, 'site-reviews'), 2)),
37
+				'1' => esc_html(sprintf(_n('%s star', '%s stars', 1, 'site-reviews'), 1)),
38
+				'0' => esc_html(__('Unrated', 'site-reviews')),
39
+			],
40
+			'tooltip' => __('What is the minimum rating to display (default: 1 star)?', 'site-reviews'),
41
+			'type' => 'listbox',
42
+		], [
43
+			'label' => esc_html__('Pagination', 'site-reviews'),
44
+			'name' => 'pagination',
45
+			'options' => [
46
+				'true' => esc_html__('Enable', 'site-reviews'),
47
+				'ajax' => esc_html__('Enable (using ajax)', 'site-reviews'),
48
+				'false' => esc_html__('Disable', 'site-reviews'),
49
+			],
50
+			'tooltip' => __('When using pagination this shortcode can only be used once on a page. (default: disable)', 'site-reviews'),
51
+			'type' => 'listbox',
52
+		],
53
+		$this->getTypes(__('Which type of review would you like to display?', 'site-reviews')),
54
+		$this->getCategories(__('Limit reviews to this category.', 'site-reviews')),
55
+		[
56
+			'label' => esc_html__('Assigned To', 'site-reviews'),
57
+			'name' => 'assigned_to',
58
+			'tooltip' => __('Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page, or "parent_id" to use the ID of the parent page.', 'site-reviews'),
59
+			'type' => 'textbox',
60
+		], [
61
+			'label' => esc_html__('Schema', 'site-reviews'),
62
+			'name' => 'schema',
63
+			'options' => [
64
+				'true' => esc_html__('Enable rich snippets', 'site-reviews'),
65
+				'false' => esc_html__('Disable rich snippets', 'site-reviews'),
66
+			],
67
+			'tooltip' => __('Rich snippets are disabled by default.', 'site-reviews'),
68
+			'type' => 'listbox',
69
+		], [
70
+			'label' => esc_html__('Classes', 'site-reviews'),
71
+			'name' => 'class',
72
+			'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
73
+			'type' => 'textbox',
74
+		], [
75
+			'columns' => 2,
76
+			'items' => $this->getHideOptions(),
77
+			'label' => esc_html__('Hide', 'site-reviews'),
78
+			'layout' => 'grid',
79
+			'spacing' => 5,
80
+			'type' => 'container',
81
+		], [
82
+			'hidden' => true,
83
+			'name' => 'id',
84
+			'type' => 'textbox',
85
+		], ];
86
+	}
87 87
 }
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -10,71 +10,71 @@
 block discarded – undo
10 10
     public function fields()
11 11
     {
12 12
         return [[
13
-            'html' => sprintf('<p class="strong">%s</p>', esc_html__('All settings are optional.', 'site-reviews')),
13
+            'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' ) ),
14 14
             'minWidth' => 320,
15 15
             'type' => 'container',
16 16
         ], [
17
-            'label' => esc_html__('Title', 'site-reviews'),
17
+            'label' => esc_html__( 'Title', 'site-reviews' ),
18 18
             'name' => 'title',
19
-            'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
19
+            'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ),
20 20
             'type' => 'textbox',
21 21
         ], [
22
-            'label' => esc_html__('Display', 'site-reviews'),
22
+            'label' => esc_html__( 'Display', 'site-reviews' ),
23 23
             'maxLength' => 5,
24 24
             'name' => 'display',
25 25
             'size' => 3,
26 26
             'text' => '10',
27
-            'tooltip' => __('How many reviews would you like to display (default: 10)?', 'site-reviews'),
27
+            'tooltip' => __( 'How many reviews would you like to display (default: 10)?', 'site-reviews' ),
28 28
             'type' => 'textbox',
29 29
         ], [
30
-            'label' => esc_html__('Rating', 'site-reviews'),
30
+            'label' => esc_html__( 'Rating', 'site-reviews' ),
31 31
             'name' => 'rating',
32 32
             'options' => [
33
-                '5' => esc_html(sprintf(_n('%s star', '%s stars', 5, 'site-reviews'), 5)),
34
-                '4' => esc_html(sprintf(_n('%s star', '%s stars', 4, 'site-reviews'), 4)),
35
-                '3' => esc_html(sprintf(_n('%s star', '%s stars', 3, 'site-reviews'), 3)),
36
-                '2' => esc_html(sprintf(_n('%s star', '%s stars', 2, 'site-reviews'), 2)),
37
-                '1' => esc_html(sprintf(_n('%s star', '%s stars', 1, 'site-reviews'), 1)),
38
-                '0' => esc_html(__('Unrated', 'site-reviews')),
33
+                '5' => esc_html( sprintf( _n( '%s star', '%s stars', 5, 'site-reviews' ), 5 ) ),
34
+                '4' => esc_html( sprintf( _n( '%s star', '%s stars', 4, 'site-reviews' ), 4 ) ),
35
+                '3' => esc_html( sprintf( _n( '%s star', '%s stars', 3, 'site-reviews' ), 3 ) ),
36
+                '2' => esc_html( sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 ) ),
37
+                '1' => esc_html( sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 ) ),
38
+                '0' => esc_html( __( 'Unrated', 'site-reviews' ) ),
39 39
             ],
40
-            'tooltip' => __('What is the minimum rating to display (default: 1 star)?', 'site-reviews'),
40
+            'tooltip' => __( 'What is the minimum rating to display (default: 1 star)?', 'site-reviews' ),
41 41
             'type' => 'listbox',
42 42
         ], [
43
-            'label' => esc_html__('Pagination', 'site-reviews'),
43
+            'label' => esc_html__( 'Pagination', 'site-reviews' ),
44 44
             'name' => 'pagination',
45 45
             'options' => [
46
-                'true' => esc_html__('Enable', 'site-reviews'),
47
-                'ajax' => esc_html__('Enable (using ajax)', 'site-reviews'),
48
-                'false' => esc_html__('Disable', 'site-reviews'),
46
+                'true' => esc_html__( 'Enable', 'site-reviews' ),
47
+                'ajax' => esc_html__( 'Enable (using ajax)', 'site-reviews' ),
48
+                'false' => esc_html__( 'Disable', 'site-reviews' ),
49 49
             ],
50
-            'tooltip' => __('When using pagination this shortcode can only be used once on a page. (default: disable)', 'site-reviews'),
50
+            'tooltip' => __( 'When using pagination this shortcode can only be used once on a page. (default: disable)', 'site-reviews' ),
51 51
             'type' => 'listbox',
52 52
         ],
53
-        $this->getTypes(__('Which type of review would you like to display?', 'site-reviews')),
54
-        $this->getCategories(__('Limit reviews to this category.', 'site-reviews')),
53
+        $this->getTypes( __( 'Which type of review would you like to display?', 'site-reviews' ) ),
54
+        $this->getCategories( __( 'Limit reviews to this category.', 'site-reviews' ) ),
55 55
         [
56
-            'label' => esc_html__('Assigned To', 'site-reviews'),
56
+            'label' => esc_html__( 'Assigned To', 'site-reviews' ),
57 57
             'name' => 'assigned_to',
58
-            'tooltip' => __('Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page, or "parent_id" to use the ID of the parent page.', 'site-reviews'),
58
+            'tooltip' => __( 'Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page, or "parent_id" to use the ID of the parent page.', 'site-reviews' ),
59 59
             'type' => 'textbox',
60 60
         ], [
61
-            'label' => esc_html__('Schema', 'site-reviews'),
61
+            'label' => esc_html__( 'Schema', 'site-reviews' ),
62 62
             'name' => 'schema',
63 63
             'options' => [
64
-                'true' => esc_html__('Enable rich snippets', 'site-reviews'),
65
-                'false' => esc_html__('Disable rich snippets', 'site-reviews'),
64
+                'true' => esc_html__( 'Enable rich snippets', 'site-reviews' ),
65
+                'false' => esc_html__( 'Disable rich snippets', 'site-reviews' ),
66 66
             ],
67
-            'tooltip' => __('Rich snippets are disabled by default.', 'site-reviews'),
67
+            'tooltip' => __( 'Rich snippets are disabled by default.', 'site-reviews' ),
68 68
             'type' => 'listbox',
69 69
         ], [
70
-            'label' => esc_html__('Classes', 'site-reviews'),
70
+            'label' => esc_html__( 'Classes', 'site-reviews' ),
71 71
             'name' => 'class',
72
-            'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
72
+            'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ),
73 73
             'type' => 'textbox',
74 74
         ], [
75 75
             'columns' => 2,
76 76
             'items' => $this->getHideOptions(),
77
-            'label' => esc_html__('Hide', 'site-reviews'),
77
+            'label' => esc_html__( 'Hide', 'site-reviews' ),
78 78
             'layout' => 'grid',
79 79
             'spacing' => 5,
80 80
             'type' => 'container',
Please login to merge, or discard this patch.
plugin/Controllers/WelcomeController.php 2 patches
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -8,97 +8,97 @@
 block discarded – undo
8 8
 
9 9
 class WelcomeController extends Controller
10 10
 {
11
-    /**
12
-     * @return array
13
-     * @filter plugin_action_links_site-reviews/site-reviews.php
14
-     */
15
-    public function filterActionLinks(array $links)
16
-    {
17
-        $links['welcome'] = glsr(Builder::class)->a(__('About', 'site-reviews'), [
18
-            'href' => admin_url('edit.php?post_type='.Application::POST_TYPE.'&page=welcome'),
19
-        ]);
20
-        return $links;
21
-    }
11
+	/**
12
+	 * @return array
13
+	 * @filter plugin_action_links_site-reviews/site-reviews.php
14
+	 */
15
+	public function filterActionLinks(array $links)
16
+	{
17
+		$links['welcome'] = glsr(Builder::class)->a(__('About', 'site-reviews'), [
18
+			'href' => admin_url('edit.php?post_type='.Application::POST_TYPE.'&page=welcome'),
19
+		]);
20
+		return $links;
21
+	}
22 22
 
23
-    /**
24
-     * @return string
25
-     * @filter admin_title
26
-     */
27
-    public function filterAdminTitle($title)
28
-    {
29
-        return Application::POST_TYPE.'_page_welcome' == glsr_current_screen()->id
30
-            ? sprintf(__('Welcome to %s &#8212; WordPress', 'site-reviews'), glsr()->name)
31
-            : $title;
32
-    }
23
+	/**
24
+	 * @return string
25
+	 * @filter admin_title
26
+	 */
27
+	public function filterAdminTitle($title)
28
+	{
29
+		return Application::POST_TYPE.'_page_welcome' == glsr_current_screen()->id
30
+			? sprintf(__('Welcome to %s &#8212; WordPress', 'site-reviews'), glsr()->name)
31
+			: $title;
32
+	}
33 33
 
34
-    /**
35
-     * @param string $text
36
-     * @return string
37
-     * @filter admin_footer_text
38
-     */
39
-    public function filterFooterText($text)
40
-    {
41
-        if (Application::POST_TYPE.'_page_welcome' != glsr_current_screen()->id) {
42
-            return $text;
43
-        }
44
-        $url = 'https://wordpress.org/support/view/plugin-reviews/site-reviews?filter=5#new-post';
45
-        return wp_kses_post(sprintf(
46
-            __('Please rate %s on %s and help us spread the word. Thank you so much!', 'site-reviews'),
47
-            '<strong>'.glsr()->name.'</strong> <a href="'.$url.'" target="_blank">&#9733;&#9733;&#9733;&#9733;&#9733;</a>',
48
-            '<a href="'.$url.'" target="_blank">wordpress.org</a>'
49
-        ));
50
-    }
34
+	/**
35
+	 * @param string $text
36
+	 * @return string
37
+	 * @filter admin_footer_text
38
+	 */
39
+	public function filterFooterText($text)
40
+	{
41
+		if (Application::POST_TYPE.'_page_welcome' != glsr_current_screen()->id) {
42
+			return $text;
43
+		}
44
+		$url = 'https://wordpress.org/support/view/plugin-reviews/site-reviews?filter=5#new-post';
45
+		return wp_kses_post(sprintf(
46
+			__('Please rate %s on %s and help us spread the word. Thank you so much!', 'site-reviews'),
47
+			'<strong>'.glsr()->name.'</strong> <a href="'.$url.'" target="_blank">&#9733;&#9733;&#9733;&#9733;&#9733;</a>',
48
+			'<a href="'.$url.'" target="_blank">wordpress.org</a>'
49
+		));
50
+	}
51 51
 
52
-    /**
53
-     * @param string $plugin
54
-     * @param bool $isNetworkActivation
55
-     * @return void
56
-     * @action activated_plugin
57
-     */
58
-    public function redirectOnActivation($plugin, $isNetworkActivation)
59
-    {
60
-        if (!$isNetworkActivation
61
-            && 'cli' !== php_sapi_name()
62
-            && $plugin === plugin_basename(glsr()->file)) {
63
-            wp_safe_redirect(admin_url('edit.php?post_type='.Application::POST_TYPE.'&page=welcome'));
64
-            exit;
65
-        }
66
-    }
52
+	/**
53
+	 * @param string $plugin
54
+	 * @param bool $isNetworkActivation
55
+	 * @return void
56
+	 * @action activated_plugin
57
+	 */
58
+	public function redirectOnActivation($plugin, $isNetworkActivation)
59
+	{
60
+		if (!$isNetworkActivation
61
+			&& 'cli' !== php_sapi_name()
62
+			&& $plugin === plugin_basename(glsr()->file)) {
63
+			wp_safe_redirect(admin_url('edit.php?post_type='.Application::POST_TYPE.'&page=welcome'));
64
+			exit;
65
+		}
66
+	}
67 67
 
68
-    /**
69
-     * @return void
70
-     * @action admin_menu
71
-     */
72
-    public function registerPage()
73
-    {
74
-        add_submenu_page('edit.php?post_type='.Application::POST_TYPE,
75
-            sprintf(__('Welcome to %s', 'site-reviews'), glsr()->name),
76
-            glsr()->name,
77
-            glsr()->getPermission('welcome'),
78
-            'welcome',
79
-            [$this, 'renderPage']
80
-        );
81
-        remove_submenu_page('edit.php?post_type='.Application::POST_TYPE, 'welcome');
82
-    }
68
+	/**
69
+	 * @return void
70
+	 * @action admin_menu
71
+	 */
72
+	public function registerPage()
73
+	{
74
+		add_submenu_page('edit.php?post_type='.Application::POST_TYPE,
75
+			sprintf(__('Welcome to %s', 'site-reviews'), glsr()->name),
76
+			glsr()->name,
77
+			glsr()->getPermission('welcome'),
78
+			'welcome',
79
+			[$this, 'renderPage']
80
+		);
81
+		remove_submenu_page('edit.php?post_type='.Application::POST_TYPE, 'welcome');
82
+	}
83 83
 
84
-    /**
85
-     * @return void
86
-     * @see $this->registerPage()
87
-     * @callback add_submenu_page
88
-     */
89
-    public function renderPage()
90
-    {
91
-        $tabs = apply_filters('site-reviews/addon/welcome/tabs', [
92
-            'getting-started' => __('Getting Started', 'site-reviews'),
93
-            'whatsnew' => __('What\'s New', 'site-reviews'),
94
-            'upgrade-guide' => __('Upgrade Guide', 'site-reviews'),
95
-            'support' => __('Support', 'site-reviews'),
96
-        ]);
97
-        glsr()->render('pages/welcome/index', [
98
-            'data' => ['context' => []],
99
-            'http_referer' => (string) wp_get_referer(),
100
-            'tabs' => $tabs,
101
-            'template' => glsr(Template::class),
102
-        ]);
103
-    }
84
+	/**
85
+	 * @return void
86
+	 * @see $this->registerPage()
87
+	 * @callback add_submenu_page
88
+	 */
89
+	public function renderPage()
90
+	{
91
+		$tabs = apply_filters('site-reviews/addon/welcome/tabs', [
92
+			'getting-started' => __('Getting Started', 'site-reviews'),
93
+			'whatsnew' => __('What\'s New', 'site-reviews'),
94
+			'upgrade-guide' => __('Upgrade Guide', 'site-reviews'),
95
+			'support' => __('Support', 'site-reviews'),
96
+		]);
97
+		glsr()->render('pages/welcome/index', [
98
+			'data' => ['context' => []],
99
+			'http_referer' => (string) wp_get_referer(),
100
+			'tabs' => $tabs,
101
+			'template' => glsr(Template::class),
102
+		]);
103
+	}
104 104
 }
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@  discard block
 block discarded – undo
12 12
      * @return array
13 13
      * @filter plugin_action_links_site-reviews/site-reviews.php
14 14
      */
15
-    public function filterActionLinks(array $links)
15
+    public function filterActionLinks( array $links )
16 16
     {
17
-        $links['welcome'] = glsr(Builder::class)->a(__('About', 'site-reviews'), [
18
-            'href' => admin_url('edit.php?post_type='.Application::POST_TYPE.'&page=welcome'),
19
-        ]);
17
+        $links['welcome'] = glsr( Builder::class )->a( __( 'About', 'site-reviews' ), [
18
+            'href' => admin_url( 'edit.php?post_type='.Application::POST_TYPE.'&page=welcome' ),
19
+        ] );
20 20
         return $links;
21 21
     }
22 22
 
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
      * @return string
25 25
      * @filter admin_title
26 26
      */
27
-    public function filterAdminTitle($title)
27
+    public function filterAdminTitle( $title )
28 28
     {
29 29
         return Application::POST_TYPE.'_page_welcome' == glsr_current_screen()->id
30
-            ? sprintf(__('Welcome to %s &#8212; WordPress', 'site-reviews'), glsr()->name)
30
+            ? sprintf( __( 'Welcome to %s &#8212; WordPress', 'site-reviews' ), glsr()->name )
31 31
             : $title;
32 32
     }
33 33
 
@@ -36,17 +36,17 @@  discard block
 block discarded – undo
36 36
      * @return string
37 37
      * @filter admin_footer_text
38 38
      */
39
-    public function filterFooterText($text)
39
+    public function filterFooterText( $text )
40 40
     {
41
-        if (Application::POST_TYPE.'_page_welcome' != glsr_current_screen()->id) {
41
+        if( Application::POST_TYPE.'_page_welcome' != glsr_current_screen()->id ) {
42 42
             return $text;
43 43
         }
44 44
         $url = 'https://wordpress.org/support/view/plugin-reviews/site-reviews?filter=5#new-post';
45
-        return wp_kses_post(sprintf(
46
-            __('Please rate %s on %s and help us spread the word. Thank you so much!', 'site-reviews'),
45
+        return wp_kses_post( sprintf(
46
+            __( 'Please rate %s on %s and help us spread the word. Thank you so much!', 'site-reviews' ),
47 47
             '<strong>'.glsr()->name.'</strong> <a href="'.$url.'" target="_blank">&#9733;&#9733;&#9733;&#9733;&#9733;</a>',
48 48
             '<a href="'.$url.'" target="_blank">wordpress.org</a>'
49
-        ));
49
+        ) );
50 50
     }
51 51
 
52 52
     /**
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
      * @return void
56 56
      * @action activated_plugin
57 57
      */
58
-    public function redirectOnActivation($plugin, $isNetworkActivation)
58
+    public function redirectOnActivation( $plugin, $isNetworkActivation )
59 59
     {
60
-        if (!$isNetworkActivation
60
+        if( !$isNetworkActivation
61 61
             && 'cli' !== php_sapi_name()
62
-            && $plugin === plugin_basename(glsr()->file)) {
63
-            wp_safe_redirect(admin_url('edit.php?post_type='.Application::POST_TYPE.'&page=welcome'));
62
+            && $plugin === plugin_basename( glsr()->file ) ) {
63
+            wp_safe_redirect( admin_url( 'edit.php?post_type='.Application::POST_TYPE.'&page=welcome' ) );
64 64
             exit;
65 65
         }
66 66
     }
@@ -71,14 +71,14 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function registerPage()
73 73
     {
74
-        add_submenu_page('edit.php?post_type='.Application::POST_TYPE,
75
-            sprintf(__('Welcome to %s', 'site-reviews'), glsr()->name),
74
+        add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE,
75
+            sprintf( __( 'Welcome to %s', 'site-reviews' ), glsr()->name ),
76 76
             glsr()->name,
77
-            glsr()->getPermission('welcome'),
77
+            glsr()->getPermission( 'welcome' ),
78 78
             'welcome',
79 79
             [$this, 'renderPage']
80 80
         );
81
-        remove_submenu_page('edit.php?post_type='.Application::POST_TYPE, 'welcome');
81
+        remove_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, 'welcome' );
82 82
     }
83 83
 
84 84
     /**
@@ -88,17 +88,17 @@  discard block
 block discarded – undo
88 88
      */
89 89
     public function renderPage()
90 90
     {
91
-        $tabs = apply_filters('site-reviews/addon/welcome/tabs', [
92
-            'getting-started' => __('Getting Started', 'site-reviews'),
93
-            'whatsnew' => __('What\'s New', 'site-reviews'),
94
-            'upgrade-guide' => __('Upgrade Guide', 'site-reviews'),
95
-            'support' => __('Support', 'site-reviews'),
96
-        ]);
97
-        glsr()->render('pages/welcome/index', [
91
+        $tabs = apply_filters( 'site-reviews/addon/welcome/tabs', [
92
+            'getting-started' => __( 'Getting Started', 'site-reviews' ),
93
+            'whatsnew' => __( 'What\'s New', 'site-reviews' ),
94
+            'upgrade-guide' => __( 'Upgrade Guide', 'site-reviews' ),
95
+            'support' => __( 'Support', 'site-reviews' ),
96
+        ] );
97
+        glsr()->render( 'pages/welcome/index', [
98 98
             'data' => ['context' => []],
99
-            'http_referer' => (string) wp_get_referer(),
99
+            'http_referer' => (string)wp_get_referer(),
100 100
             'tabs' => $tabs,
101
-            'template' => glsr(Template::class),
102
-        ]);
101
+            'template' => glsr( Template::class ),
102
+        ] );
103 103
     }
104 104
 }
Please login to merge, or discard this patch.
plugin/Controllers/NoticeController.php 2 patches
Indentation   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -8,124 +8,124 @@
 block discarded – undo
8 8
 
9 9
 class NoticeController extends Controller
10 10
 {
11
-    const USER_META_KEY = '_glsr_notices';
11
+	const USER_META_KEY = '_glsr_notices';
12 12
 
13
-    /**
14
-     * @var array
15
-     */
16
-    protected $dismissValuesMap;
13
+	/**
14
+	 * @var array
15
+	 */
16
+	protected $dismissValuesMap;
17 17
 
18
-    public function __construct()
19
-    {
20
-        $this->dismissValuesMap = [
21
-            'rebusify' => glsr()->version('major'),
22
-            'welcome' => glsr()->version('minor'),
23
-        ];
24
-    }
18
+	public function __construct()
19
+	{
20
+		$this->dismissValuesMap = [
21
+			'rebusify' => glsr()->version('major'),
22
+			'welcome' => glsr()->version('minor'),
23
+		];
24
+	}
25 25
 
26
-    /**
27
-     * @return void
28
-     * @action admin_notices
29
-     */
30
-    public function filterAdminNotices()
31
-    {
32
-        $screen = glsr_current_screen();
33
-        $this->renderWelcomeNotice($screen->post_type);
34
-        $this->renderRebusifyNotice($screen->post_type);
35
-        $this->renderAddonsNotice($screen->id);
36
-    }
26
+	/**
27
+	 * @return void
28
+	 * @action admin_notices
29
+	 */
30
+	public function filterAdminNotices()
31
+	{
32
+		$screen = glsr_current_screen();
33
+		$this->renderWelcomeNotice($screen->post_type);
34
+		$this->renderRebusifyNotice($screen->post_type);
35
+		$this->renderAddonsNotice($screen->id);
36
+	}
37 37
 
38
-    /**
39
-     * @return void
40
-     */
41
-    public function routerDismissNotice(array $request)
42
-    {
43
-        if ($key = Arr::get($request, 'notice')) {
44
-            $this->dismissNotice($key);
45
-        }
46
-    }
38
+	/**
39
+	 * @return void
40
+	 */
41
+	public function routerDismissNotice(array $request)
42
+	{
43
+		if ($key = Arr::get($request, 'notice')) {
44
+			$this->dismissNotice($key);
45
+		}
46
+	}
47 47
 
48
-    /**
49
-     * @param string $key
50
-     * @return void
51
-     */
52
-    protected function dismissNotice($key)
53
-    {
54
-        $this->setUserMeta($key, $this->getVersionFor($key));
55
-    }
48
+	/**
49
+	 * @param string $key
50
+	 * @return void
51
+	 */
52
+	protected function dismissNotice($key)
53
+	{
54
+		$this->setUserMeta($key, $this->getVersionFor($key));
55
+	}
56 56
 
57
-    /**
58
-     * @param string $key
59
-     * @param mixed $fallback
60
-     * @return mixed
61
-     */
62
-    protected function getUserMeta($key, $fallback)
63
-    {
64
-        $meta = get_user_meta(get_current_user_id(), static::USER_META_KEY, true);
65
-        return Arr::get($meta, $key, $fallback);
66
-    }
57
+	/**
58
+	 * @param string $key
59
+	 * @param mixed $fallback
60
+	 * @return mixed
61
+	 */
62
+	protected function getUserMeta($key, $fallback)
63
+	{
64
+		$meta = get_user_meta(get_current_user_id(), static::USER_META_KEY, true);
65
+		return Arr::get($meta, $key, $fallback);
66
+	}
67 67
 
68
-    /**
69
-     * @param string $noticeKey
70
-     * @return string
71
-     */
72
-    protected function getVersionFor($noticeKey)
73
-    {
74
-        return Arr::get($this->dismissValuesMap, $noticeKey, glsr()->version('major'));
75
-    }
68
+	/**
69
+	 * @param string $noticeKey
70
+	 * @return string
71
+	 */
72
+	protected function getVersionFor($noticeKey)
73
+	{
74
+		return Arr::get($this->dismissValuesMap, $noticeKey, glsr()->version('major'));
75
+	}
76 76
 
77
-    /**
78
-     * @param string $screenId
79
-     * @return void
80
-     */
81
-    protected function renderAddonsNotice($screenId)
82
-    {
83
-        if (Application::POST_TYPE.'_page_addons' == $screenId) {
84
-            echo glsr()->render('partials/notices/addons');
85
-        }
86
-    }
77
+	/**
78
+	 * @param string $screenId
79
+	 * @return void
80
+	 */
81
+	protected function renderAddonsNotice($screenId)
82
+	{
83
+		if (Application::POST_TYPE.'_page_addons' == $screenId) {
84
+			echo glsr()->render('partials/notices/addons');
85
+		}
86
+	}
87 87
 
88
-    /**
89
-     * @param string $screenPostType
90
-     * @return void
91
-     */
92
-    protected function renderRebusifyNotice($screenPostType)
93
-    {
94
-        if (Application::POST_TYPE == $screenPostType
95
-            && version_compare($this->getVersionFor('rebusify'), $this->getUserMeta('rebusify', 0), '>')
96
-            && !glsr(OptionManager::class)->getBool('settings.general.rebusify')) {
97
-            echo glsr()->render('partials/notices/rebusify');
98
-        }
99
-    }
88
+	/**
89
+	 * @param string $screenPostType
90
+	 * @return void
91
+	 */
92
+	protected function renderRebusifyNotice($screenPostType)
93
+	{
94
+		if (Application::POST_TYPE == $screenPostType
95
+			&& version_compare($this->getVersionFor('rebusify'), $this->getUserMeta('rebusify', 0), '>')
96
+			&& !glsr(OptionManager::class)->getBool('settings.general.rebusify')) {
97
+			echo glsr()->render('partials/notices/rebusify');
98
+		}
99
+	}
100 100
 
101
-    /**
102
-     * @param string $screenPostType
103
-     * @return void
104
-     */
105
-    protected function renderWelcomeNotice($screenPostType)
106
-    {
107
-        if (Application::POST_TYPE == $screenPostType
108
-            && version_compare($this->getVersionFor('welcome'), $this->getUserMeta('welcome', 0), '>')) {
109
-            $welcomeText = '0.0.0' == glsr(OptionManager::class)->get('version_upgraded_from')
110
-                ? __('Thanks for installing Site Reviews %s, we hope you love it!', 'site-reviews')
111
-                : __('Thanks for updating to Site Reviews %s, we hope you love the changes!', 'site-reviews');
112
-            echo glsr()->render('partials/notices/welcome', [
113
-                'text' => sprintf($welcomeText, glsr()->version),
114
-            ]);
115
-        }
116
-    }
101
+	/**
102
+	 * @param string $screenPostType
103
+	 * @return void
104
+	 */
105
+	protected function renderWelcomeNotice($screenPostType)
106
+	{
107
+		if (Application::POST_TYPE == $screenPostType
108
+			&& version_compare($this->getVersionFor('welcome'), $this->getUserMeta('welcome', 0), '>')) {
109
+			$welcomeText = '0.0.0' == glsr(OptionManager::class)->get('version_upgraded_from')
110
+				? __('Thanks for installing Site Reviews %s, we hope you love it!', 'site-reviews')
111
+				: __('Thanks for updating to Site Reviews %s, we hope you love the changes!', 'site-reviews');
112
+			echo glsr()->render('partials/notices/welcome', [
113
+				'text' => sprintf($welcomeText, glsr()->version),
114
+			]);
115
+		}
116
+	}
117 117
 
118
-    /**
119
-     * @param string $key
120
-     * @param mixed $fallback
121
-     * @return mixed
122
-     */
123
-    protected function setUserMeta($key, $value)
124
-    {
125
-        $userId = get_current_user_id();
126
-        $meta = (array) get_user_meta($userId, static::USER_META_KEY, true);
127
-        $meta = array_filter(wp_parse_args($meta, []));
128
-        $meta[$key] = $value;
129
-        update_user_meta($userId, static::USER_META_KEY, $meta);
130
-    }
118
+	/**
119
+	 * @param string $key
120
+	 * @param mixed $fallback
121
+	 * @return mixed
122
+	 */
123
+	protected function setUserMeta($key, $value)
124
+	{
125
+		$userId = get_current_user_id();
126
+		$meta = (array) get_user_meta($userId, static::USER_META_KEY, true);
127
+		$meta = array_filter(wp_parse_args($meta, []));
128
+		$meta[$key] = $value;
129
+		update_user_meta($userId, static::USER_META_KEY, $meta);
130
+	}
131 131
 }
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
     public function __construct()
19 19
     {
20 20
         $this->dismissValuesMap = [
21
-            'rebusify' => glsr()->version('major'),
22
-            'welcome' => glsr()->version('minor'),
21
+            'rebusify' => glsr()->version( 'major' ),
22
+            'welcome' => glsr()->version( 'minor' ),
23 23
         ];
24 24
     }
25 25
 
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
     public function filterAdminNotices()
31 31
     {
32 32
         $screen = glsr_current_screen();
33
-        $this->renderWelcomeNotice($screen->post_type);
34
-        $this->renderRebusifyNotice($screen->post_type);
35
-        $this->renderAddonsNotice($screen->id);
33
+        $this->renderWelcomeNotice( $screen->post_type );
34
+        $this->renderRebusifyNotice( $screen->post_type );
35
+        $this->renderAddonsNotice( $screen->id );
36 36
     }
37 37
 
38 38
     /**
39 39
      * @return void
40 40
      */
41
-    public function routerDismissNotice(array $request)
41
+    public function routerDismissNotice( array $request )
42 42
     {
43
-        if ($key = Arr::get($request, 'notice')) {
44
-            $this->dismissNotice($key);
43
+        if( $key = Arr::get( $request, 'notice' ) ) {
44
+            $this->dismissNotice( $key );
45 45
         }
46 46
     }
47 47
 
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
      * @param string $key
50 50
      * @return void
51 51
      */
52
-    protected function dismissNotice($key)
52
+    protected function dismissNotice( $key )
53 53
     {
54
-        $this->setUserMeta($key, $this->getVersionFor($key));
54
+        $this->setUserMeta( $key, $this->getVersionFor( $key ) );
55 55
     }
56 56
 
57 57
     /**
@@ -59,29 +59,29 @@  discard block
 block discarded – undo
59 59
      * @param mixed $fallback
60 60
      * @return mixed
61 61
      */
62
-    protected function getUserMeta($key, $fallback)
62
+    protected function getUserMeta( $key, $fallback )
63 63
     {
64
-        $meta = get_user_meta(get_current_user_id(), static::USER_META_KEY, true);
65
-        return Arr::get($meta, $key, $fallback);
64
+        $meta = get_user_meta( get_current_user_id(), static::USER_META_KEY, true );
65
+        return Arr::get( $meta, $key, $fallback );
66 66
     }
67 67
 
68 68
     /**
69 69
      * @param string $noticeKey
70 70
      * @return string
71 71
      */
72
-    protected function getVersionFor($noticeKey)
72
+    protected function getVersionFor( $noticeKey )
73 73
     {
74
-        return Arr::get($this->dismissValuesMap, $noticeKey, glsr()->version('major'));
74
+        return Arr::get( $this->dismissValuesMap, $noticeKey, glsr()->version( 'major' ) );
75 75
     }
76 76
 
77 77
     /**
78 78
      * @param string $screenId
79 79
      * @return void
80 80
      */
81
-    protected function renderAddonsNotice($screenId)
81
+    protected function renderAddonsNotice( $screenId )
82 82
     {
83
-        if (Application::POST_TYPE.'_page_addons' == $screenId) {
84
-            echo glsr()->render('partials/notices/addons');
83
+        if( Application::POST_TYPE.'_page_addons' == $screenId ) {
84
+            echo glsr()->render( 'partials/notices/addons' );
85 85
         }
86 86
     }
87 87
 
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
      * @param string $screenPostType
90 90
      * @return void
91 91
      */
92
-    protected function renderRebusifyNotice($screenPostType)
92
+    protected function renderRebusifyNotice( $screenPostType )
93 93
     {
94
-        if (Application::POST_TYPE == $screenPostType
95
-            && version_compare($this->getVersionFor('rebusify'), $this->getUserMeta('rebusify', 0), '>')
96
-            && !glsr(OptionManager::class)->getBool('settings.general.rebusify')) {
97
-            echo glsr()->render('partials/notices/rebusify');
94
+        if( Application::POST_TYPE == $screenPostType
95
+            && version_compare( $this->getVersionFor( 'rebusify' ), $this->getUserMeta( 'rebusify', 0 ), '>' )
96
+            && !glsr( OptionManager::class )->getBool( 'settings.general.rebusify' ) ) {
97
+            echo glsr()->render( 'partials/notices/rebusify' );
98 98
         }
99 99
     }
100 100
 
@@ -102,16 +102,16 @@  discard block
 block discarded – undo
102 102
      * @param string $screenPostType
103 103
      * @return void
104 104
      */
105
-    protected function renderWelcomeNotice($screenPostType)
105
+    protected function renderWelcomeNotice( $screenPostType )
106 106
     {
107
-        if (Application::POST_TYPE == $screenPostType
108
-            && version_compare($this->getVersionFor('welcome'), $this->getUserMeta('welcome', 0), '>')) {
109
-            $welcomeText = '0.0.0' == glsr(OptionManager::class)->get('version_upgraded_from')
110
-                ? __('Thanks for installing Site Reviews %s, we hope you love it!', 'site-reviews')
111
-                : __('Thanks for updating to Site Reviews %s, we hope you love the changes!', 'site-reviews');
112
-            echo glsr()->render('partials/notices/welcome', [
113
-                'text' => sprintf($welcomeText, glsr()->version),
114
-            ]);
107
+        if( Application::POST_TYPE == $screenPostType
108
+            && version_compare( $this->getVersionFor( 'welcome' ), $this->getUserMeta( 'welcome', 0 ), '>' ) ) {
109
+            $welcomeText = '0.0.0' == glsr( OptionManager::class )->get( 'version_upgraded_from' )
110
+                ? __( 'Thanks for installing Site Reviews %s, we hope you love it!', 'site-reviews' )
111
+                : __( 'Thanks for updating to Site Reviews %s, we hope you love the changes!', 'site-reviews' );
112
+            echo glsr()->render( 'partials/notices/welcome', [
113
+                'text' => sprintf( $welcomeText, glsr()->version ),
114
+            ] );
115 115
         }
116 116
     }
117 117
 
@@ -120,12 +120,12 @@  discard block
 block discarded – undo
120 120
      * @param mixed $fallback
121 121
      * @return mixed
122 122
      */
123
-    protected function setUserMeta($key, $value)
123
+    protected function setUserMeta( $key, $value )
124 124
     {
125 125
         $userId = get_current_user_id();
126
-        $meta = (array) get_user_meta($userId, static::USER_META_KEY, true);
127
-        $meta = array_filter(wp_parse_args($meta, []));
126
+        $meta = (array)get_user_meta( $userId, static::USER_META_KEY, true );
127
+        $meta = array_filter( wp_parse_args( $meta, [] ) );
128 128
         $meta[$key] = $value;
129
-        update_user_meta($userId, static::USER_META_KEY, $meta);
129
+        update_user_meta( $userId, static::USER_META_KEY, $meta );
130 130
     }
131 131
 }
Please login to merge, or discard this patch.
plugin/Controllers/MenuController.php 2 patches
Indentation   +176 added lines, -176 removed lines patch added patch discarded remove patch
@@ -14,189 +14,189 @@
 block discarded – undo
14 14
 
15 15
 class MenuController extends Controller
16 16
 {
17
-    /**
18
-     * @return void
19
-     * @action admin_menu
20
-     */
21
-    public function registerMenuCount()
22
-    {
23
-        global $menu, $typenow;
24
-        foreach ($menu as $key => $value) {
25
-            if (!isset($value[2]) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE) {
26
-                continue;
27
-            }
28
-            $postCount = wp_count_posts(Application::POST_TYPE);
29
-            $pendingCount = glsr(Builder::class)->span(number_format_i18n($postCount->pending), [
30
-                'class' => 'unapproved-count',
31
-            ]);
32
-            $awaitingModeration = glsr(Builder::class)->span($pendingCount, [
33
-                'class' => 'awaiting-mod count-'.$postCount->pending,
34
-            ]);
35
-            $menu[$key][0].= ' '.$awaitingModeration;
36
-            if (Application::POST_TYPE === $typenow) {
37
-                $menu[$key][4].= ' current';
38
-            }
39
-            break;
40
-        }
41
-    }
17
+	/**
18
+	 * @return void
19
+	 * @action admin_menu
20
+	 */
21
+	public function registerMenuCount()
22
+	{
23
+		global $menu, $typenow;
24
+		foreach ($menu as $key => $value) {
25
+			if (!isset($value[2]) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE) {
26
+				continue;
27
+			}
28
+			$postCount = wp_count_posts(Application::POST_TYPE);
29
+			$pendingCount = glsr(Builder::class)->span(number_format_i18n($postCount->pending), [
30
+				'class' => 'unapproved-count',
31
+			]);
32
+			$awaitingModeration = glsr(Builder::class)->span($pendingCount, [
33
+				'class' => 'awaiting-mod count-'.$postCount->pending,
34
+			]);
35
+			$menu[$key][0].= ' '.$awaitingModeration;
36
+			if (Application::POST_TYPE === $typenow) {
37
+				$menu[$key][4].= ' current';
38
+			}
39
+			break;
40
+		}
41
+	}
42 42
 
43
-    /**
44
-     * @return void
45
-     * @action admin_menu
46
-     */
47
-    public function registerSubMenus()
48
-    {
49
-        $pages = $this->parseWithFilter('submenu/pages', [
50
-            'settings' => __('Settings', 'site-reviews'),
51
-            'tools' => __('Tools', 'site-reviews'),
52
-            'addons' => __('Add-ons', 'site-reviews'),
53
-            'documentation' => __('Help', 'site-reviews'),
54
-        ]);
55
-        foreach ($pages as $slug => $title) {
56
-            $method = Helper::buildMethodName('render-'.$slug.'-menu');
57
-            $callback = apply_filters('site-reviews/addon/submenu/callback', [$this, $method], $slug);
58
-            if (!is_callable($callback)) {
59
-                continue;
60
-            }
61
-            add_submenu_page('edit.php?post_type='.Application::POST_TYPE, $title, $title, glsr()->getPermission($slug), $slug, $callback);
62
-        }
63
-    }
43
+	/**
44
+	 * @return void
45
+	 * @action admin_menu
46
+	 */
47
+	public function registerSubMenus()
48
+	{
49
+		$pages = $this->parseWithFilter('submenu/pages', [
50
+			'settings' => __('Settings', 'site-reviews'),
51
+			'tools' => __('Tools', 'site-reviews'),
52
+			'addons' => __('Add-ons', 'site-reviews'),
53
+			'documentation' => __('Help', 'site-reviews'),
54
+		]);
55
+		foreach ($pages as $slug => $title) {
56
+			$method = Helper::buildMethodName('render-'.$slug.'-menu');
57
+			$callback = apply_filters('site-reviews/addon/submenu/callback', [$this, $method], $slug);
58
+			if (!is_callable($callback)) {
59
+				continue;
60
+			}
61
+			add_submenu_page('edit.php?post_type='.Application::POST_TYPE, $title, $title, glsr()->getPermission($slug), $slug, $callback);
62
+		}
63
+	}
64 64
 
65
-    /**
66
-     * @return void
67
-     * @see $this->registerSubMenus()
68
-     * @callback add_submenu_page
69
-     */
70
-    public function renderAddonsMenu()
71
-    {
72
-        $this->renderPage('addons', [
73
-            'template' => glsr(Template::class),
74
-        ]);
75
-    }
65
+	/**
66
+	 * @return void
67
+	 * @see $this->registerSubMenus()
68
+	 * @callback add_submenu_page
69
+	 */
70
+	public function renderAddonsMenu()
71
+	{
72
+		$this->renderPage('addons', [
73
+			'template' => glsr(Template::class),
74
+		]);
75
+	}
76 76
 
77
-    /**
78
-     * @return void
79
-     * @see $this->registerSubMenus()
80
-     * @callback add_submenu_page
81
-     */
82
-    public function renderDocumentationMenu()
83
-    {
84
-        $tabs = $this->parseWithFilter('documentation/tabs', [
85
-            'support' => __('Support', 'site-reviews'),
86
-            'faq' => __('FAQ', 'site-reviews'),
87
-            'shortcodes' => __('Shortcodes', 'site-reviews'),
88
-            'hooks' => __('Hooks', 'site-reviews'),
89
-            'functions' => __('Functions', 'site-reviews'),
90
-            'addons' => __('Addons', 'site-reviews'),
91
-        ]);
92
-        $addons = apply_filters('site-reviews/addon/documentation', []);
93
-        ksort($addons);
94
-        if (empty($addons)) {
95
-            unset($tabs['addons']);
96
-        }
97
-        $this->renderPage('documentation', [
98
-            'addons' => $addons,
99
-            'tabs' => $tabs,
100
-        ]);
101
-    }
77
+	/**
78
+	 * @return void
79
+	 * @see $this->registerSubMenus()
80
+	 * @callback add_submenu_page
81
+	 */
82
+	public function renderDocumentationMenu()
83
+	{
84
+		$tabs = $this->parseWithFilter('documentation/tabs', [
85
+			'support' => __('Support', 'site-reviews'),
86
+			'faq' => __('FAQ', 'site-reviews'),
87
+			'shortcodes' => __('Shortcodes', 'site-reviews'),
88
+			'hooks' => __('Hooks', 'site-reviews'),
89
+			'functions' => __('Functions', 'site-reviews'),
90
+			'addons' => __('Addons', 'site-reviews'),
91
+		]);
92
+		$addons = apply_filters('site-reviews/addon/documentation', []);
93
+		ksort($addons);
94
+		if (empty($addons)) {
95
+			unset($tabs['addons']);
96
+		}
97
+		$this->renderPage('documentation', [
98
+			'addons' => $addons,
99
+			'tabs' => $tabs,
100
+		]);
101
+	}
102 102
 
103
-    /**
104
-     * @return void
105
-     * @see $this->registerSubMenus()
106
-     * @callback add_submenu_page
107
-     */
108
-    public function renderSettingsMenu()
109
-    {
110
-        $tabs = $this->parseWithFilter('settings/tabs', [
111
-            'general' => __('General', 'site-reviews'),
112
-            'reviews' => __('Reviews', 'site-reviews'),
113
-            'submissions' => __('Submissions', 'site-reviews'),
114
-            'schema' => __('Schema', 'site-reviews'),
115
-            'translations' => __('Translations', 'site-reviews'),
116
-            'addons' => __('Addons', 'site-reviews'),
117
-            'licenses' => __('Licenses', 'site-reviews'),
118
-        ]);
119
-        if (empty(Arr::get(glsr()->defaults, 'settings.addons'))) {
120
-            unset($tabs['addons']);
121
-        }
122
-        if (empty(Arr::get(glsr()->defaults, 'settings.licenses'))) {
123
-            unset($tabs['licenses']);
124
-        }
125
-        $this->renderPage('settings', [
126
-            'settings' => glsr(Settings::class),
127
-            'tabs' => $tabs,
128
-        ]);
129
-    }
103
+	/**
104
+	 * @return void
105
+	 * @see $this->registerSubMenus()
106
+	 * @callback add_submenu_page
107
+	 */
108
+	public function renderSettingsMenu()
109
+	{
110
+		$tabs = $this->parseWithFilter('settings/tabs', [
111
+			'general' => __('General', 'site-reviews'),
112
+			'reviews' => __('Reviews', 'site-reviews'),
113
+			'submissions' => __('Submissions', 'site-reviews'),
114
+			'schema' => __('Schema', 'site-reviews'),
115
+			'translations' => __('Translations', 'site-reviews'),
116
+			'addons' => __('Addons', 'site-reviews'),
117
+			'licenses' => __('Licenses', 'site-reviews'),
118
+		]);
119
+		if (empty(Arr::get(glsr()->defaults, 'settings.addons'))) {
120
+			unset($tabs['addons']);
121
+		}
122
+		if (empty(Arr::get(glsr()->defaults, 'settings.licenses'))) {
123
+			unset($tabs['licenses']);
124
+		}
125
+		$this->renderPage('settings', [
126
+			'settings' => glsr(Settings::class),
127
+			'tabs' => $tabs,
128
+		]);
129
+	}
130 130
 
131
-    /**
132
-     * @return void
133
-     * @see $this->registerSubMenus()
134
-     * @callback add_submenu_page
135
-     */
136
-    public function renderToolsMenu()
137
-    {
138
-        $tabs = $this->parseWithFilter('tools/tabs', [
139
-            'general' => __('General', 'site-reviews'),
140
-            'sync' => __('Sync Reviews', 'site-reviews'),
141
-            'console' => __('Console', 'site-reviews'),
142
-            'system-info' => __('System Info', 'site-reviews'),
143
-        ]);
144
-        if (!apply_filters('site-reviews/addon/sync/enable', false)) {
145
-            unset($tabs['sync']);
146
-        }
147
-        $this->renderPage('tools', [
148
-            'data' => [
149
-                'context' => [
150
-                    'base_url' => admin_url('edit.php?post_type='.Application::POST_TYPE),
151
-                    'console' => strval(glsr(Console::class)),
152
-                    'id' => Application::ID,
153
-                    'system' => strval(glsr(System::class)),
154
-                ],
155
-                'services' => apply_filters('site-reviews/addon/sync/services', []),
156
-            ],
157
-            'tabs' => $tabs,
158
-            'template' => glsr(Template::class),
159
-        ]);
160
-    }
131
+	/**
132
+	 * @return void
133
+	 * @see $this->registerSubMenus()
134
+	 * @callback add_submenu_page
135
+	 */
136
+	public function renderToolsMenu()
137
+	{
138
+		$tabs = $this->parseWithFilter('tools/tabs', [
139
+			'general' => __('General', 'site-reviews'),
140
+			'sync' => __('Sync Reviews', 'site-reviews'),
141
+			'console' => __('Console', 'site-reviews'),
142
+			'system-info' => __('System Info', 'site-reviews'),
143
+		]);
144
+		if (!apply_filters('site-reviews/addon/sync/enable', false)) {
145
+			unset($tabs['sync']);
146
+		}
147
+		$this->renderPage('tools', [
148
+			'data' => [
149
+				'context' => [
150
+					'base_url' => admin_url('edit.php?post_type='.Application::POST_TYPE),
151
+					'console' => strval(glsr(Console::class)),
152
+					'id' => Application::ID,
153
+					'system' => strval(glsr(System::class)),
154
+				],
155
+				'services' => apply_filters('site-reviews/addon/sync/services', []),
156
+			],
157
+			'tabs' => $tabs,
158
+			'template' => glsr(Template::class),
159
+		]);
160
+	}
161 161
 
162
-    /**
163
-     * @return void
164
-     * @action admin_init
165
-     */
166
-    public function setCustomPermissions()
167
-    {
168
-        foreach (wp_roles()->roles as $role => $value) {
169
-            wp_roles()->remove_cap($role, 'create_'.Application::POST_TYPE);
170
-        }
171
-    }
162
+	/**
163
+	 * @return void
164
+	 * @action admin_init
165
+	 */
166
+	public function setCustomPermissions()
167
+	{
168
+		foreach (wp_roles()->roles as $role => $value) {
169
+			wp_roles()->remove_cap($role, 'create_'.Application::POST_TYPE);
170
+		}
171
+	}
172 172
 
173
-    /**
174
-     * @return string
175
-     */
176
-    protected function getNotices()
177
-    {
178
-        return glsr(Builder::class)->div(glsr(Notice::class)->get(), [
179
-            'id' => 'glsr-notices',
180
-        ]);
181
-    }
173
+	/**
174
+	 * @return string
175
+	 */
176
+	protected function getNotices()
177
+	{
178
+		return glsr(Builder::class)->div(glsr(Notice::class)->get(), [
179
+			'id' => 'glsr-notices',
180
+		]);
181
+	}
182 182
 
183
-    /**
184
-     * @param string $hookSuffix
185
-     * @return array
186
-     */
187
-    protected function parseWithFilter($hookSuffix, array $args = [])
188
-    {
189
-        return apply_filters('site-reviews/addon/'.$hookSuffix, $args);
190
-    }
183
+	/**
184
+	 * @param string $hookSuffix
185
+	 * @return array
186
+	 */
187
+	protected function parseWithFilter($hookSuffix, array $args = [])
188
+	{
189
+		return apply_filters('site-reviews/addon/'.$hookSuffix, $args);
190
+	}
191 191
 
192
-    /**
193
-     * @param string $page
194
-     * @return void
195
-     */
196
-    protected function renderPage($page, array $data = [])
197
-    {
198
-        $data['http_referer'] = (string) wp_get_referer();
199
-        $data['notices'] = $this->getNotices();
200
-        glsr()->render('pages/'.$page.'/index', $data);
201
-    }
192
+	/**
193
+	 * @param string $page
194
+	 * @return void
195
+	 */
196
+	protected function renderPage($page, array $data = [])
197
+	{
198
+		$data['http_referer'] = (string) wp_get_referer();
199
+		$data['notices'] = $this->getNotices();
200
+		glsr()->render('pages/'.$page.'/index', $data);
201
+	}
202 202
 }
Please login to merge, or discard this patch.
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -21,20 +21,20 @@  discard block
 block discarded – undo
21 21
     public function registerMenuCount()
22 22
     {
23 23
         global $menu, $typenow;
24
-        foreach ($menu as $key => $value) {
25
-            if (!isset($value[2]) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE) {
24
+        foreach( $menu as $key => $value ) {
25
+            if( !isset($value[2]) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE ) {
26 26
                 continue;
27 27
             }
28
-            $postCount = wp_count_posts(Application::POST_TYPE);
29
-            $pendingCount = glsr(Builder::class)->span(number_format_i18n($postCount->pending), [
28
+            $postCount = wp_count_posts( Application::POST_TYPE );
29
+            $pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [
30 30
                 'class' => 'unapproved-count',
31
-            ]);
32
-            $awaitingModeration = glsr(Builder::class)->span($pendingCount, [
31
+            ] );
32
+            $awaitingModeration = glsr( Builder::class )->span( $pendingCount, [
33 33
                 'class' => 'awaiting-mod count-'.$postCount->pending,
34
-            ]);
35
-            $menu[$key][0].= ' '.$awaitingModeration;
36
-            if (Application::POST_TYPE === $typenow) {
37
-                $menu[$key][4].= ' current';
34
+            ] );
35
+            $menu[$key][0] .= ' '.$awaitingModeration;
36
+            if( Application::POST_TYPE === $typenow ) {
37
+                $menu[$key][4] .= ' current';
38 38
             }
39 39
             break;
40 40
         }
@@ -46,19 +46,19 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function registerSubMenus()
48 48
     {
49
-        $pages = $this->parseWithFilter('submenu/pages', [
50
-            'settings' => __('Settings', 'site-reviews'),
51
-            'tools' => __('Tools', 'site-reviews'),
52
-            'addons' => __('Add-ons', 'site-reviews'),
53
-            'documentation' => __('Help', 'site-reviews'),
54
-        ]);
55
-        foreach ($pages as $slug => $title) {
56
-            $method = Helper::buildMethodName('render-'.$slug.'-menu');
57
-            $callback = apply_filters('site-reviews/addon/submenu/callback', [$this, $method], $slug);
58
-            if (!is_callable($callback)) {
49
+        $pages = $this->parseWithFilter( 'submenu/pages', [
50
+            'settings' => __( 'Settings', 'site-reviews' ),
51
+            'tools' => __( 'Tools', 'site-reviews' ),
52
+            'addons' => __( 'Add-ons', 'site-reviews' ),
53
+            'documentation' => __( 'Help', 'site-reviews' ),
54
+        ] );
55
+        foreach( $pages as $slug => $title ) {
56
+            $method = Helper::buildMethodName( 'render-'.$slug.'-menu' );
57
+            $callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug );
58
+            if( !is_callable( $callback ) ) {
59 59
                 continue;
60 60
             }
61
-            add_submenu_page('edit.php?post_type='.Application::POST_TYPE, $title, $title, glsr()->getPermission($slug), $slug, $callback);
61
+            add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, glsr()->getPermission( $slug ), $slug, $callback );
62 62
         }
63 63
     }
64 64
 
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
      */
70 70
     public function renderAddonsMenu()
71 71
     {
72
-        $this->renderPage('addons', [
73
-            'template' => glsr(Template::class),
74
-        ]);
72
+        $this->renderPage( 'addons', [
73
+            'template' => glsr( Template::class ),
74
+        ] );
75 75
     }
76 76
 
77 77
     /**
@@ -81,23 +81,23 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public function renderDocumentationMenu()
83 83
     {
84
-        $tabs = $this->parseWithFilter('documentation/tabs', [
85
-            'support' => __('Support', 'site-reviews'),
86
-            'faq' => __('FAQ', 'site-reviews'),
87
-            'shortcodes' => __('Shortcodes', 'site-reviews'),
88
-            'hooks' => __('Hooks', 'site-reviews'),
89
-            'functions' => __('Functions', 'site-reviews'),
90
-            'addons' => __('Addons', 'site-reviews'),
91
-        ]);
92
-        $addons = apply_filters('site-reviews/addon/documentation', []);
93
-        ksort($addons);
94
-        if (empty($addons)) {
84
+        $tabs = $this->parseWithFilter( 'documentation/tabs', [
85
+            'support' => __( 'Support', 'site-reviews' ),
86
+            'faq' => __( 'FAQ', 'site-reviews' ),
87
+            'shortcodes' => __( 'Shortcodes', 'site-reviews' ),
88
+            'hooks' => __( 'Hooks', 'site-reviews' ),
89
+            'functions' => __( 'Functions', 'site-reviews' ),
90
+            'addons' => __( 'Addons', 'site-reviews' ),
91
+        ] );
92
+        $addons = apply_filters( 'site-reviews/addon/documentation', [] );
93
+        ksort( $addons );
94
+        if( empty($addons) ) {
95 95
             unset($tabs['addons']);
96 96
         }
97
-        $this->renderPage('documentation', [
97
+        $this->renderPage( 'documentation', [
98 98
             'addons' => $addons,
99 99
             'tabs' => $tabs,
100
-        ]);
100
+        ] );
101 101
     }
102 102
 
103 103
     /**
@@ -107,25 +107,25 @@  discard block
 block discarded – undo
107 107
      */
108 108
     public function renderSettingsMenu()
109 109
     {
110
-        $tabs = $this->parseWithFilter('settings/tabs', [
111
-            'general' => __('General', 'site-reviews'),
112
-            'reviews' => __('Reviews', 'site-reviews'),
113
-            'submissions' => __('Submissions', 'site-reviews'),
114
-            'schema' => __('Schema', 'site-reviews'),
115
-            'translations' => __('Translations', 'site-reviews'),
116
-            'addons' => __('Addons', 'site-reviews'),
117
-            'licenses' => __('Licenses', 'site-reviews'),
118
-        ]);
119
-        if (empty(Arr::get(glsr()->defaults, 'settings.addons'))) {
110
+        $tabs = $this->parseWithFilter( 'settings/tabs', [
111
+            'general' => __( 'General', 'site-reviews' ),
112
+            'reviews' => __( 'Reviews', 'site-reviews' ),
113
+            'submissions' => __( 'Submissions', 'site-reviews' ),
114
+            'schema' => __( 'Schema', 'site-reviews' ),
115
+            'translations' => __( 'Translations', 'site-reviews' ),
116
+            'addons' => __( 'Addons', 'site-reviews' ),
117
+            'licenses' => __( 'Licenses', 'site-reviews' ),
118
+        ] );
119
+        if( empty(Arr::get( glsr()->defaults, 'settings.addons' )) ) {
120 120
             unset($tabs['addons']);
121 121
         }
122
-        if (empty(Arr::get(glsr()->defaults, 'settings.licenses'))) {
122
+        if( empty(Arr::get( glsr()->defaults, 'settings.licenses' )) ) {
123 123
             unset($tabs['licenses']);
124 124
         }
125
-        $this->renderPage('settings', [
126
-            'settings' => glsr(Settings::class),
125
+        $this->renderPage( 'settings', [
126
+            'settings' => glsr( Settings::class ),
127 127
             'tabs' => $tabs,
128
-        ]);
128
+        ] );
129 129
     }
130 130
 
131 131
     /**
@@ -135,28 +135,28 @@  discard block
 block discarded – undo
135 135
      */
136 136
     public function renderToolsMenu()
137 137
     {
138
-        $tabs = $this->parseWithFilter('tools/tabs', [
139
-            'general' => __('General', 'site-reviews'),
140
-            'sync' => __('Sync Reviews', 'site-reviews'),
141
-            'console' => __('Console', 'site-reviews'),
142
-            'system-info' => __('System Info', 'site-reviews'),
143
-        ]);
144
-        if (!apply_filters('site-reviews/addon/sync/enable', false)) {
138
+        $tabs = $this->parseWithFilter( 'tools/tabs', [
139
+            'general' => __( 'General', 'site-reviews' ),
140
+            'sync' => __( 'Sync Reviews', 'site-reviews' ),
141
+            'console' => __( 'Console', 'site-reviews' ),
142
+            'system-info' => __( 'System Info', 'site-reviews' ),
143
+        ] );
144
+        if( !apply_filters( 'site-reviews/addon/sync/enable', false ) ) {
145 145
             unset($tabs['sync']);
146 146
         }
147
-        $this->renderPage('tools', [
147
+        $this->renderPage( 'tools', [
148 148
             'data' => [
149 149
                 'context' => [
150
-                    'base_url' => admin_url('edit.php?post_type='.Application::POST_TYPE),
151
-                    'console' => strval(glsr(Console::class)),
150
+                    'base_url' => admin_url( 'edit.php?post_type='.Application::POST_TYPE ),
151
+                    'console' => strval( glsr( Console::class ) ),
152 152
                     'id' => Application::ID,
153
-                    'system' => strval(glsr(System::class)),
153
+                    'system' => strval( glsr( System::class ) ),
154 154
                 ],
155
-                'services' => apply_filters('site-reviews/addon/sync/services', []),
155
+                'services' => apply_filters( 'site-reviews/addon/sync/services', [] ),
156 156
             ],
157 157
             'tabs' => $tabs,
158
-            'template' => glsr(Template::class),
159
-        ]);
158
+            'template' => glsr( Template::class ),
159
+        ] );
160 160
     }
161 161
 
162 162
     /**
@@ -165,8 +165,8 @@  discard block
 block discarded – undo
165 165
      */
166 166
     public function setCustomPermissions()
167 167
     {
168
-        foreach (wp_roles()->roles as $role => $value) {
169
-            wp_roles()->remove_cap($role, 'create_'.Application::POST_TYPE);
168
+        foreach( wp_roles()->roles as $role => $value ) {
169
+            wp_roles()->remove_cap( $role, 'create_'.Application::POST_TYPE );
170 170
         }
171 171
     }
172 172
 
@@ -175,28 +175,28 @@  discard block
 block discarded – undo
175 175
      */
176 176
     protected function getNotices()
177 177
     {
178
-        return glsr(Builder::class)->div(glsr(Notice::class)->get(), [
178
+        return glsr( Builder::class )->div( glsr( Notice::class )->get(), [
179 179
             'id' => 'glsr-notices',
180
-        ]);
180
+        ] );
181 181
     }
182 182
 
183 183
     /**
184 184
      * @param string $hookSuffix
185 185
      * @return array
186 186
      */
187
-    protected function parseWithFilter($hookSuffix, array $args = [])
187
+    protected function parseWithFilter( $hookSuffix, array $args = [] )
188 188
     {
189
-        return apply_filters('site-reviews/addon/'.$hookSuffix, $args);
189
+        return apply_filters( 'site-reviews/addon/'.$hookSuffix, $args );
190 190
     }
191 191
 
192 192
     /**
193 193
      * @param string $page
194 194
      * @return void
195 195
      */
196
-    protected function renderPage($page, array $data = [])
196
+    protected function renderPage( $page, array $data = [] )
197 197
     {
198
-        $data['http_referer'] = (string) wp_get_referer();
198
+        $data['http_referer'] = (string)wp_get_referer();
199 199
         $data['notices'] = $this->getNotices();
200
-        glsr()->render('pages/'.$page.'/index', $data);
200
+        glsr()->render( 'pages/'.$page.'/index', $data );
201 201
     }
202 202
 }
Please login to merge, or discard this patch.
plugin/Defaults/SiteReviewsDefaults.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -6,41 +6,41 @@
 block discarded – undo
6 6
 
7 7
 class SiteReviewsDefaults extends Defaults
8 8
 {
9
-    /**
10
-     * @var array
11
-     */
12
-    protected $guarded = [
13
-        'fallback',
14
-        'title',
15
-    ];
9
+	/**
10
+	 * @var array
11
+	 */
12
+	protected $guarded = [
13
+		'fallback',
14
+		'title',
15
+	];
16 16
 
17
-    /**
18
-     * @var array
19
-     */
20
-    protected $mapped = [
21
-        'count' => 'display', // @deprecated since v4.1.0
22
-        'per_page' => 'display',
23
-    ];
17
+	/**
18
+	 * @var array
19
+	 */
20
+	protected $mapped = [
21
+		'count' => 'display', // @deprecated since v4.1.0
22
+		'per_page' => 'display',
23
+	];
24 24
 
25
-    /**
26
-     * @return array
27
-     */
28
-    protected function defaults()
29
-    {
30
-        return [
31
-            'assigned_to' => '',
32
-            'category' => '',
33
-            'class' => '',
34
-            'display' => 5,
35
-            'fallback' => '',
36
-            'hide' => [],
37
-            'id' => '',
38
-            'offset' => '',
39
-            'pagination' => false,
40
-            'rating' => 0,
41
-            'schema' => false,
42
-            'title' => '',
43
-            'type' => 'local',
44
-        ];
45
-    }
25
+	/**
26
+	 * @return array
27
+	 */
28
+	protected function defaults()
29
+	{
30
+		return [
31
+			'assigned_to' => '',
32
+			'category' => '',
33
+			'class' => '',
34
+			'display' => 5,
35
+			'fallback' => '',
36
+			'hide' => [],
37
+			'id' => '',
38
+			'offset' => '',
39
+			'pagination' => false,
40
+			'rating' => 0,
41
+			'schema' => false,
42
+			'title' => '',
43
+			'type' => 'local',
44
+		];
45
+	}
46 46
 }
Please login to merge, or discard this patch.
plugin/Defaults/ReviewsDefaults.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -6,31 +6,31 @@
 block discarded – undo
6 6
 
7 7
 class ReviewsDefaults extends Defaults
8 8
 {
9
-    /**
10
-     * @var array
11
-     */
12
-    protected $mapped = [
13
-        'count' => 'per_page', // @deprecated since v4.1.0
14
-        'display' => 'per_page',
15
-    ];
9
+	/**
10
+	 * @var array
11
+	 */
12
+	protected $mapped = [
13
+		'count' => 'per_page', // @deprecated since v4.1.0
14
+		'display' => 'per_page',
15
+	];
16 16
 
17
-    /**
18
-     * @return array
19
-     */
20
-    protected function defaults()
21
-    {
22
-        return [
23
-            'assigned_to' => '',
24
-            'category' => '',
25
-            'offset' => '',
26
-            'order' => 'DESC',
27
-            'orderby' => 'date',
28
-            'pagination' => false,
29
-            'per_page' => 10,
30
-            'post__in' => [],
31
-            'post__not_in' => [],
32
-            'rating' => '',
33
-            'type' => '',
34
-        ];
35
-    }
17
+	/**
18
+	 * @return array
19
+	 */
20
+	protected function defaults()
21
+	{
22
+		return [
23
+			'assigned_to' => '',
24
+			'category' => '',
25
+			'offset' => '',
26
+			'order' => 'DESC',
27
+			'orderby' => 'date',
28
+			'pagination' => false,
29
+			'per_page' => 10,
30
+			'post__in' => [],
31
+			'post__not_in' => [],
32
+			'rating' => '',
33
+			'type' => '',
34
+		];
35
+	}
36 36
 }
Please login to merge, or discard this patch.
plugin/Defaults/DefaultsAbstract.php 2 patches
Indentation   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -8,137 +8,137 @@
 block discarded – undo
8 8
 
9 9
 abstract class DefaultsAbstract
10 10
 {
11
-    /**
12
-     * @var array
13
-     */
14
-    protected $callable = [
15
-        'defaults', 'filter', 'merge', 'restrict', 'unguarded',
16
-    ];
17
-
18
-    /**
19
-     * @var array
20
-     */
21
-    protected $guarded = [];
22
-
23
-    /**
24
-     * @var array
25
-     */
26
-    protected $mapped = [];
27
-
28
-    /**
29
-     * @param string $name
30
-     * @return void|array
31
-     */
32
-    public function __call($name, array $args = [])
33
-    {
34
-        if (!method_exists($this, $name) || !in_array($name, $this->callable)) {
35
-            return;
36
-        }
37
-        $args[0] = $this->mapKeys(Arr::get($args, 0, []));
38
-        $defaults = call_user_func_array([$this, $name], $args);
39
-        $hookName = (new ReflectionClass($this))->getShortName();
40
-        $hookName = str_replace('Defaults', '', $hookName);
41
-        $hookName = Str::dashCase($hookName);
42
-        return apply_filters('site-reviews/defaults/'.$hookName, $defaults, $name);
43
-    }
44
-
45
-    /**
46
-     * @return array
47
-     */
48
-    abstract protected function defaults();
49
-
50
-    /**
51
-     * @return array
52
-     */
53
-    protected function filter(array $values = [])
54
-    {
55
-        return $this->normalize($this->merge(array_filter($values)), $values);
56
-    }
57
-
58
-    /**
59
-     * @return string
60
-     */
61
-    protected function filteredJson(array $values = [])
62
-    {
63
-        $defaults = $this->flattenArray(
64
-            array_diff_key($this->defaults(), array_flip($this->guarded))
65
-        );
66
-        $values = $this->flattenArray(
67
-            shortcode_atts($defaults, $values)
68
-        );
69
-        $filtered = array_filter(array_diff_assoc($values, $defaults), function ($value) {
70
-            return !$this->isEmpty($value);
71
-        });
72
-        return json_encode($filtered, JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_TAG | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
73
-    }
74
-
75
-    /**
76
-     * @return array
77
-     */
78
-    protected function flattenArray(array $values)
79
-    {
80
-        array_walk($values, function (&$value) {
81
-            if (!is_array($value)) {
82
-                return;
83
-            }
84
-            $value = implode(',', $value);
85
-        });
86
-        return $values;
87
-    }
88
-
89
-    /**
90
-     * @param mixed $var
91
-     * @return bool
92
-     */
93
-    protected function isEmpty($var)
94
-    {
95
-        return !is_numeric($var) && !is_bool($var) && empty($var);
96
-    }
97
-
98
-    /**
99
-     * @return array
100
-     */
101
-    protected function mapKeys(array $args)
102
-    {
103
-        foreach ($this->mapped as $old => $new) {
104
-            if (array_key_exists($old, $args)) {
105
-                $args[$new] = $args[$old];
106
-                unset($args[$old]);
107
-            }
108
-        }
109
-        return $args;
110
-    }
111
-
112
-    /**
113
-     * @return array
114
-     */
115
-    protected function merge(array $values = [])
116
-    {
117
-        return $this->normalize(wp_parse_args($values, $this->defaults()), $values);
118
-    }
119
-
120
-    /**
121
-     * @return array
122
-     */
123
-    protected function normalize(array $values, array $originalValues)
124
-    {
125
-        $values['json'] = $this->filteredJson($originalValues);
126
-        return $values;
127
-    }
128
-
129
-    /**
130
-     * @return array
131
-     */
132
-    protected function restrict(array $values = [])
133
-    {
134
-        return $this->normalize(shortcode_atts($this->defaults(), $values), $values);
135
-    }
136
-
137
-    /**
138
-     * @return array
139
-     */
140
-    protected function unguarded()
141
-    {
142
-        return array_diff_key($this->defaults(), array_flip($this->guarded));
143
-    }
11
+	/**
12
+	 * @var array
13
+	 */
14
+	protected $callable = [
15
+		'defaults', 'filter', 'merge', 'restrict', 'unguarded',
16
+	];
17
+
18
+	/**
19
+	 * @var array
20
+	 */
21
+	protected $guarded = [];
22
+
23
+	/**
24
+	 * @var array
25
+	 */
26
+	protected $mapped = [];
27
+
28
+	/**
29
+	 * @param string $name
30
+	 * @return void|array
31
+	 */
32
+	public function __call($name, array $args = [])
33
+	{
34
+		if (!method_exists($this, $name) || !in_array($name, $this->callable)) {
35
+			return;
36
+		}
37
+		$args[0] = $this->mapKeys(Arr::get($args, 0, []));
38
+		$defaults = call_user_func_array([$this, $name], $args);
39
+		$hookName = (new ReflectionClass($this))->getShortName();
40
+		$hookName = str_replace('Defaults', '', $hookName);
41
+		$hookName = Str::dashCase($hookName);
42
+		return apply_filters('site-reviews/defaults/'.$hookName, $defaults, $name);
43
+	}
44
+
45
+	/**
46
+	 * @return array
47
+	 */
48
+	abstract protected function defaults();
49
+
50
+	/**
51
+	 * @return array
52
+	 */
53
+	protected function filter(array $values = [])
54
+	{
55
+		return $this->normalize($this->merge(array_filter($values)), $values);
56
+	}
57
+
58
+	/**
59
+	 * @return string
60
+	 */
61
+	protected function filteredJson(array $values = [])
62
+	{
63
+		$defaults = $this->flattenArray(
64
+			array_diff_key($this->defaults(), array_flip($this->guarded))
65
+		);
66
+		$values = $this->flattenArray(
67
+			shortcode_atts($defaults, $values)
68
+		);
69
+		$filtered = array_filter(array_diff_assoc($values, $defaults), function ($value) {
70
+			return !$this->isEmpty($value);
71
+		});
72
+		return json_encode($filtered, JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_TAG | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
73
+	}
74
+
75
+	/**
76
+	 * @return array
77
+	 */
78
+	protected function flattenArray(array $values)
79
+	{
80
+		array_walk($values, function (&$value) {
81
+			if (!is_array($value)) {
82
+				return;
83
+			}
84
+			$value = implode(',', $value);
85
+		});
86
+		return $values;
87
+	}
88
+
89
+	/**
90
+	 * @param mixed $var
91
+	 * @return bool
92
+	 */
93
+	protected function isEmpty($var)
94
+	{
95
+		return !is_numeric($var) && !is_bool($var) && empty($var);
96
+	}
97
+
98
+	/**
99
+	 * @return array
100
+	 */
101
+	protected function mapKeys(array $args)
102
+	{
103
+		foreach ($this->mapped as $old => $new) {
104
+			if (array_key_exists($old, $args)) {
105
+				$args[$new] = $args[$old];
106
+				unset($args[$old]);
107
+			}
108
+		}
109
+		return $args;
110
+	}
111
+
112
+	/**
113
+	 * @return array
114
+	 */
115
+	protected function merge(array $values = [])
116
+	{
117
+		return $this->normalize(wp_parse_args($values, $this->defaults()), $values);
118
+	}
119
+
120
+	/**
121
+	 * @return array
122
+	 */
123
+	protected function normalize(array $values, array $originalValues)
124
+	{
125
+		$values['json'] = $this->filteredJson($originalValues);
126
+		return $values;
127
+	}
128
+
129
+	/**
130
+	 * @return array
131
+	 */
132
+	protected function restrict(array $values = [])
133
+	{
134
+		return $this->normalize(shortcode_atts($this->defaults(), $values), $values);
135
+	}
136
+
137
+	/**
138
+	 * @return array
139
+	 */
140
+	protected function unguarded()
141
+	{
142
+		return array_diff_key($this->defaults(), array_flip($this->guarded));
143
+	}
144 144
 }
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -29,17 +29,17 @@  discard block
 block discarded – undo
29 29
      * @param string $name
30 30
      * @return void|array
31 31
      */
32
-    public function __call($name, array $args = [])
32
+    public function __call( $name, array $args = [] )
33 33
     {
34
-        if (!method_exists($this, $name) || !in_array($name, $this->callable)) {
34
+        if( !method_exists( $this, $name ) || !in_array( $name, $this->callable ) ) {
35 35
             return;
36 36
         }
37
-        $args[0] = $this->mapKeys(Arr::get($args, 0, []));
38
-        $defaults = call_user_func_array([$this, $name], $args);
39
-        $hookName = (new ReflectionClass($this))->getShortName();
40
-        $hookName = str_replace('Defaults', '', $hookName);
41
-        $hookName = Str::dashCase($hookName);
42
-        return apply_filters('site-reviews/defaults/'.$hookName, $defaults, $name);
37
+        $args[0] = $this->mapKeys( Arr::get( $args, 0, [] ) );
38
+        $defaults = call_user_func_array( [$this, $name], $args );
39
+        $hookName = (new ReflectionClass( $this ))->getShortName();
40
+        $hookName = str_replace( 'Defaults', '', $hookName );
41
+        $hookName = Str::dashCase( $hookName );
42
+        return apply_filters( 'site-reviews/defaults/'.$hookName, $defaults, $name );
43 43
     }
44 44
 
45 45
     /**
@@ -50,38 +50,38 @@  discard block
 block discarded – undo
50 50
     /**
51 51
      * @return array
52 52
      */
53
-    protected function filter(array $values = [])
53
+    protected function filter( array $values = [] )
54 54
     {
55
-        return $this->normalize($this->merge(array_filter($values)), $values);
55
+        return $this->normalize( $this->merge( array_filter( $values ) ), $values );
56 56
     }
57 57
 
58 58
     /**
59 59
      * @return string
60 60
      */
61
-    protected function filteredJson(array $values = [])
61
+    protected function filteredJson( array $values = [] )
62 62
     {
63 63
         $defaults = $this->flattenArray(
64
-            array_diff_key($this->defaults(), array_flip($this->guarded))
64
+            array_diff_key( $this->defaults(), array_flip( $this->guarded ) )
65 65
         );
66 66
         $values = $this->flattenArray(
67
-            shortcode_atts($defaults, $values)
67
+            shortcode_atts( $defaults, $values )
68 68
         );
69
-        $filtered = array_filter(array_diff_assoc($values, $defaults), function ($value) {
70
-            return !$this->isEmpty($value);
69
+        $filtered = array_filter( array_diff_assoc( $values, $defaults ), function( $value ) {
70
+            return !$this->isEmpty( $value );
71 71
         });
72
-        return json_encode($filtered, JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_TAG | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
72
+        return json_encode( $filtered, JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_TAG | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE );
73 73
     }
74 74
 
75 75
     /**
76 76
      * @return array
77 77
      */
78
-    protected function flattenArray(array $values)
78
+    protected function flattenArray( array $values )
79 79
     {
80
-        array_walk($values, function (&$value) {
81
-            if (!is_array($value)) {
80
+        array_walk( $values, function( &$value ) {
81
+            if( !is_array( $value ) ) {
82 82
                 return;
83 83
             }
84
-            $value = implode(',', $value);
84
+            $value = implode( ',', $value );
85 85
         });
86 86
         return $values;
87 87
     }
@@ -90,18 +90,18 @@  discard block
 block discarded – undo
90 90
      * @param mixed $var
91 91
      * @return bool
92 92
      */
93
-    protected function isEmpty($var)
93
+    protected function isEmpty( $var )
94 94
     {
95
-        return !is_numeric($var) && !is_bool($var) && empty($var);
95
+        return !is_numeric( $var ) && !is_bool( $var ) && empty($var);
96 96
     }
97 97
 
98 98
     /**
99 99
      * @return array
100 100
      */
101
-    protected function mapKeys(array $args)
101
+    protected function mapKeys( array $args )
102 102
     {
103
-        foreach ($this->mapped as $old => $new) {
104
-            if (array_key_exists($old, $args)) {
103
+        foreach( $this->mapped as $old => $new ) {
104
+            if( array_key_exists( $old, $args ) ) {
105 105
                 $args[$new] = $args[$old];
106 106
                 unset($args[$old]);
107 107
             }
@@ -112,26 +112,26 @@  discard block
 block discarded – undo
112 112
     /**
113 113
      * @return array
114 114
      */
115
-    protected function merge(array $values = [])
115
+    protected function merge( array $values = [] )
116 116
     {
117
-        return $this->normalize(wp_parse_args($values, $this->defaults()), $values);
117
+        return $this->normalize( wp_parse_args( $values, $this->defaults() ), $values );
118 118
     }
119 119
 
120 120
     /**
121 121
      * @return array
122 122
      */
123
-    protected function normalize(array $values, array $originalValues)
123
+    protected function normalize( array $values, array $originalValues )
124 124
     {
125
-        $values['json'] = $this->filteredJson($originalValues);
125
+        $values['json'] = $this->filteredJson( $originalValues );
126 126
         return $values;
127 127
     }
128 128
 
129 129
     /**
130 130
      * @return array
131 131
      */
132
-    protected function restrict(array $values = [])
132
+    protected function restrict( array $values = [] )
133 133
     {
134
-        return $this->normalize(shortcode_atts($this->defaults(), $values), $values);
134
+        return $this->normalize( shortcode_atts( $this->defaults(), $values ), $values );
135 135
     }
136 136
 
137 137
     /**
@@ -139,6 +139,6 @@  discard block
 block discarded – undo
139 139
      */
140 140
     protected function unguarded()
141 141
     {
142
-        return array_diff_key($this->defaults(), array_flip($this->guarded));
142
+        return array_diff_key( $this->defaults(), array_flip( $this->guarded ) );
143 143
     }
144 144
 }
Please login to merge, or discard this patch.
plugin/Database/ReviewManager.php 2 patches
Indentation   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -16,204 +16,204 @@
 block discarded – undo
16 16
 
17 17
 class ReviewManager
18 18
 {
19
-    /**
20
-     * @return false|Review
21
-     */
22
-    public function create(CreateReview $command)
23
-    {
24
-        $reviewValues = glsr(CreateReviewDefaults::class)->restrict((array) $command);
25
-        $reviewValues = apply_filters('site-reviews/create/review-values', $reviewValues, $command);
26
-        $reviewValues = Arr::prefixArrayKeys($reviewValues);
27
-        unset($reviewValues['json']); // @todo remove the need for this
28
-        $postValues = [
29
-            'comment_status' => 'closed',
30
-            'meta_input' => $reviewValues,
31
-            'ping_status' => 'closed',
32
-            'post_content' => $reviewValues['_content'],
33
-            'post_date' => $reviewValues['_date'],
34
-            'post_date_gmt' => get_gmt_from_date($reviewValues['_date']),
35
-            'post_name' => $reviewValues['_review_type'].'-'.$reviewValues['_review_id'],
36
-            'post_status' => $this->getNewPostStatus($reviewValues, $command->blacklisted),
37
-            'post_title' => $reviewValues['_title'],
38
-            'post_type' => Application::POST_TYPE,
39
-        ];
40
-        $postId = wp_insert_post($postValues, true);
41
-        if (is_wp_error($postId)) {
42
-            glsr_log()->error($postId->get_error_message())->debug($postValues);
43
-            return false;
44
-        }
45
-        $this->setTerms($postId, $command->category);
46
-        $review = $this->single(get_post($postId));
47
-        do_action('site-reviews/review/created', $review, $command);
48
-        return $review;
49
-    }
19
+	/**
20
+	 * @return false|Review
21
+	 */
22
+	public function create(CreateReview $command)
23
+	{
24
+		$reviewValues = glsr(CreateReviewDefaults::class)->restrict((array) $command);
25
+		$reviewValues = apply_filters('site-reviews/create/review-values', $reviewValues, $command);
26
+		$reviewValues = Arr::prefixArrayKeys($reviewValues);
27
+		unset($reviewValues['json']); // @todo remove the need for this
28
+		$postValues = [
29
+			'comment_status' => 'closed',
30
+			'meta_input' => $reviewValues,
31
+			'ping_status' => 'closed',
32
+			'post_content' => $reviewValues['_content'],
33
+			'post_date' => $reviewValues['_date'],
34
+			'post_date_gmt' => get_gmt_from_date($reviewValues['_date']),
35
+			'post_name' => $reviewValues['_review_type'].'-'.$reviewValues['_review_id'],
36
+			'post_status' => $this->getNewPostStatus($reviewValues, $command->blacklisted),
37
+			'post_title' => $reviewValues['_title'],
38
+			'post_type' => Application::POST_TYPE,
39
+		];
40
+		$postId = wp_insert_post($postValues, true);
41
+		if (is_wp_error($postId)) {
42
+			glsr_log()->error($postId->get_error_message())->debug($postValues);
43
+			return false;
44
+		}
45
+		$this->setTerms($postId, $command->category);
46
+		$review = $this->single(get_post($postId));
47
+		do_action('site-reviews/review/created', $review, $command);
48
+		return $review;
49
+	}
50 50
 
51
-    /**
52
-     * @param string $metaReviewId
53
-     * @return void
54
-     */
55
-    public function delete($metaReviewId)
56
-    {
57
-        if ($postId = $this->getPostId($metaReviewId)) {
58
-            wp_delete_post($postId, true);
59
-        }
60
-    }
51
+	/**
52
+	 * @param string $metaReviewId
53
+	 * @return void
54
+	 */
55
+	public function delete($metaReviewId)
56
+	{
57
+		if ($postId = $this->getPostId($metaReviewId)) {
58
+			wp_delete_post($postId, true);
59
+		}
60
+	}
61 61
 
62
-    /**
63
-     * @return object
64
-     */
65
-    public function get(array $args = [])
66
-    {
67
-        $args = glsr(ReviewsDefaults::class)->merge($args);
68
-        $metaQuery = glsr(QueryBuilder::class)->buildQuery(
69
-            ['assigned_to', 'email', 'ip_address', 'type', 'rating'],
70
-            $args
71
-        );
72
-        $taxQuery = glsr(QueryBuilder::class)->buildQuery(
73
-            ['category'],
74
-            ['category' => $this->normalizeTermIds($args['category'])]
75
-        );
76
-        $paged = glsr(QueryBuilder::class)->getPaged(
77
-            wp_validate_boolean($args['pagination'])
78
-        );
79
-        $parameters = [
80
-            'meta_key' => '_pinned',
81
-            'meta_query' => $metaQuery,
82
-            'offset' => $args['offset'],
83
-            'order' => $args['order'],
84
-            'orderby' => 'meta_value '.$args['orderby'],
85
-            'paged' => Arr::get($args, 'paged', $paged),
86
-            'post__in' => $args['post__in'],
87
-            'post__not_in' => $args['post__not_in'],
88
-            'post_status' => 'publish',
89
-            'post_type' => Application::POST_TYPE,
90
-            'posts_per_page' => $args['per_page'],
91
-            'tax_query' => $taxQuery,
92
-        ];
93
-        $parameters = apply_filters('site-reviews/get/reviews/query', $parameters, $args);
94
-        $query = new WP_Query($parameters);
95
-        $results = array_map([$this, 'single'], $query->posts);
96
-        $reviews = new Reviews($results, $query->max_num_pages, $args);
97
-        return apply_filters('site-reviews/get/reviews', $reviews, $query);
98
-    }
62
+	/**
63
+	 * @return object
64
+	 */
65
+	public function get(array $args = [])
66
+	{
67
+		$args = glsr(ReviewsDefaults::class)->merge($args);
68
+		$metaQuery = glsr(QueryBuilder::class)->buildQuery(
69
+			['assigned_to', 'email', 'ip_address', 'type', 'rating'],
70
+			$args
71
+		);
72
+		$taxQuery = glsr(QueryBuilder::class)->buildQuery(
73
+			['category'],
74
+			['category' => $this->normalizeTermIds($args['category'])]
75
+		);
76
+		$paged = glsr(QueryBuilder::class)->getPaged(
77
+			wp_validate_boolean($args['pagination'])
78
+		);
79
+		$parameters = [
80
+			'meta_key' => '_pinned',
81
+			'meta_query' => $metaQuery,
82
+			'offset' => $args['offset'],
83
+			'order' => $args['order'],
84
+			'orderby' => 'meta_value '.$args['orderby'],
85
+			'paged' => Arr::get($args, 'paged', $paged),
86
+			'post__in' => $args['post__in'],
87
+			'post__not_in' => $args['post__not_in'],
88
+			'post_status' => 'publish',
89
+			'post_type' => Application::POST_TYPE,
90
+			'posts_per_page' => $args['per_page'],
91
+			'tax_query' => $taxQuery,
92
+		];
93
+		$parameters = apply_filters('site-reviews/get/reviews/query', $parameters, $args);
94
+		$query = new WP_Query($parameters);
95
+		$results = array_map([$this, 'single'], $query->posts);
96
+		$reviews = new Reviews($results, $query->max_num_pages, $args);
97
+		return apply_filters('site-reviews/get/reviews', $reviews, $query);
98
+	}
99 99
 
100
-    /**
101
-     * @param string $metaReviewId
102
-     * @return int
103
-     */
104
-    public function getPostId($metaReviewId)
105
-    {
106
-        return glsr(SqlQueries::class)->getPostIdFromReviewId($metaReviewId);
107
-    }
100
+	/**
101
+	 * @param string $metaReviewId
102
+	 * @return int
103
+	 */
104
+	public function getPostId($metaReviewId)
105
+	{
106
+		return glsr(SqlQueries::class)->getPostIdFromReviewId($metaReviewId);
107
+	}
108 108
 
109
-    /**
110
-     * @return array
111
-     */
112
-    public function getRatingCounts(array $args = [])
113
-    {
114
-        $args = glsr(SiteReviewsSummaryDefaults::class)->filter($args);
115
-        $counts = glsr(CountsManager::class)->get([
116
-            'post_ids' => Arr::convertStringToArray($args['assigned_to']),
117
-            'term_ids' => $this->normalizeTermIds($args['category']),
118
-            'type' => $args['type'],
119
-        ]);
120
-        return glsr(CountsManager::class)->flatten($counts, [
121
-            'min' => $args['rating'],
122
-        ]);
123
-    }
109
+	/**
110
+	 * @return array
111
+	 */
112
+	public function getRatingCounts(array $args = [])
113
+	{
114
+		$args = glsr(SiteReviewsSummaryDefaults::class)->filter($args);
115
+		$counts = glsr(CountsManager::class)->get([
116
+			'post_ids' => Arr::convertStringToArray($args['assigned_to']),
117
+			'term_ids' => $this->normalizeTermIds($args['category']),
118
+			'type' => $args['type'],
119
+		]);
120
+		return glsr(CountsManager::class)->flatten($counts, [
121
+			'min' => $args['rating'],
122
+		]);
123
+	}
124 124
 
125
-    /**
126
-     * @param string $commaSeparatedTermIds
127
-     * @return array
128
-     */
129
-    public function normalizeTermIds($commaSeparatedTermIds)
130
-    {
131
-        $termIds = glsr_array_column($this->normalizeTerms($commaSeparatedTermIds), 'term_id');
132
-        return array_unique(array_map('intval', $termIds));
133
-    }
125
+	/**
126
+	 * @param string $commaSeparatedTermIds
127
+	 * @return array
128
+	 */
129
+	public function normalizeTermIds($commaSeparatedTermIds)
130
+	{
131
+		$termIds = glsr_array_column($this->normalizeTerms($commaSeparatedTermIds), 'term_id');
132
+		return array_unique(array_map('intval', $termIds));
133
+	}
134 134
 
135
-    /**
136
-     * @param string $commaSeparatedTermIds
137
-     * @return array
138
-     */
139
-    public function normalizeTerms($commaSeparatedTermIds)
140
-    {
141
-        $terms = [];
142
-        $termIds = Arr::convertStringToArray($commaSeparatedTermIds);
143
-        foreach ($termIds as $termId) {
144
-            if (is_numeric($termId)) {
145
-                $termId = intval($termId);
146
-            }
147
-            $term = term_exists($termId, Application::TAXONOMY);
148
-            if (!isset($term['term_id'])) {
149
-                continue;
150
-            }
151
-            $terms[] = $term;
152
-        }
153
-        return $terms;
154
-    }
135
+	/**
136
+	 * @param string $commaSeparatedTermIds
137
+	 * @return array
138
+	 */
139
+	public function normalizeTerms($commaSeparatedTermIds)
140
+	{
141
+		$terms = [];
142
+		$termIds = Arr::convertStringToArray($commaSeparatedTermIds);
143
+		foreach ($termIds as $termId) {
144
+			if (is_numeric($termId)) {
145
+				$termId = intval($termId);
146
+			}
147
+			$term = term_exists($termId, Application::TAXONOMY);
148
+			if (!isset($term['term_id'])) {
149
+				continue;
150
+			}
151
+			$terms[] = $term;
152
+		}
153
+		return $terms;
154
+	}
155 155
 
156
-    /**
157
-     * @param int $postId
158
-     * @return void
159
-     */
160
-    public function revert($postId)
161
-    {
162
-        if (Application::POST_TYPE != get_post_field('post_type', $postId)) {
163
-            return;
164
-        }
165
-        delete_post_meta($postId, '_edit_last');
166
-        $result = wp_update_post([
167
-            'ID' => $postId,
168
-            'post_content' => glsr(Database::class)->get($postId, 'content'),
169
-            'post_date' => glsr(Database::class)->get($postId, 'date'),
170
-            'post_title' => glsr(Database::class)->get($postId, 'title'),
171
-        ]);
172
-        if (is_wp_error($result)) {
173
-            glsr_log()->error($result->get_error_message());
174
-            return;
175
-        }
176
-        do_action('site-reviews/review/reverted', glsr_get_review($postId));
177
-    }
156
+	/**
157
+	 * @param int $postId
158
+	 * @return void
159
+	 */
160
+	public function revert($postId)
161
+	{
162
+		if (Application::POST_TYPE != get_post_field('post_type', $postId)) {
163
+			return;
164
+		}
165
+		delete_post_meta($postId, '_edit_last');
166
+		$result = wp_update_post([
167
+			'ID' => $postId,
168
+			'post_content' => glsr(Database::class)->get($postId, 'content'),
169
+			'post_date' => glsr(Database::class)->get($postId, 'date'),
170
+			'post_title' => glsr(Database::class)->get($postId, 'title'),
171
+		]);
172
+		if (is_wp_error($result)) {
173
+			glsr_log()->error($result->get_error_message());
174
+			return;
175
+		}
176
+		do_action('site-reviews/review/reverted', glsr_get_review($postId));
177
+	}
178 178
 
179
-    /**
180
-     * @return Review
181
-     */
182
-    public function single(WP_Post $post)
183
-    {
184
-        if (Application::POST_TYPE != $post->post_type) {
185
-            $post = new WP_Post((object) []);
186
-        }
187
-        $review = new Review($post);
188
-        return apply_filters('site-reviews/get/review', $review, $post);
189
-    }
179
+	/**
180
+	 * @return Review
181
+	 */
182
+	public function single(WP_Post $post)
183
+	{
184
+		if (Application::POST_TYPE != $post->post_type) {
185
+			$post = new WP_Post((object) []);
186
+		}
187
+		$review = new Review($post);
188
+		return apply_filters('site-reviews/get/review', $review, $post);
189
+	}
190 190
 
191
-    /**
192
-     * @param bool $isBlacklisted
193
-     * @return string
194
-     */
195
-    protected function getNewPostStatus(array $reviewValues, $isBlacklisted)
196
-    {
197
-        $requireApproval = glsr(OptionManager::class)->getBool('settings.general.require.approval');
198
-        return 'local' == $reviewValues['_review_type'] && ($requireApproval || $isBlacklisted)
199
-            ? 'pending'
200
-            : 'publish';
201
-    }
191
+	/**
192
+	 * @param bool $isBlacklisted
193
+	 * @return string
194
+	 */
195
+	protected function getNewPostStatus(array $reviewValues, $isBlacklisted)
196
+	{
197
+		$requireApproval = glsr(OptionManager::class)->getBool('settings.general.require.approval');
198
+		return 'local' == $reviewValues['_review_type'] && ($requireApproval || $isBlacklisted)
199
+			? 'pending'
200
+			: 'publish';
201
+	}
202 202
 
203
-    /**
204
-     * @param int $postId
205
-     * @param string $termIds
206
-     * @return void
207
-     */
208
-    protected function setTerms($postId, $termIds)
209
-    {
210
-        $termIds = $this->normalizeTermIds($termIds);
211
-        if (empty($termIds)) {
212
-            return;
213
-        }
214
-        $termTaxonomyIds = wp_set_object_terms($postId, $termIds, Application::TAXONOMY);
215
-        if (is_wp_error($termTaxonomyIds)) {
216
-            glsr_log()->error($termTaxonomyIds->get_error_message());
217
-        }
218
-    }
203
+	/**
204
+	 * @param int $postId
205
+	 * @param string $termIds
206
+	 * @return void
207
+	 */
208
+	protected function setTerms($postId, $termIds)
209
+	{
210
+		$termIds = $this->normalizeTermIds($termIds);
211
+		if (empty($termIds)) {
212
+			return;
213
+		}
214
+		$termTaxonomyIds = wp_set_object_terms($postId, $termIds, Application::TAXONOMY);
215
+		if (is_wp_error($termTaxonomyIds)) {
216
+			glsr_log()->error($termTaxonomyIds->get_error_message());
217
+		}
218
+	}
219 219
 }
Please login to merge, or discard this patch.
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
     /**
20 20
      * @return false|Review
21 21
      */
22
-    public function create(CreateReview $command)
22
+    public function create( CreateReview $command )
23 23
     {
24
-        $reviewValues = glsr(CreateReviewDefaults::class)->restrict((array) $command);
25
-        $reviewValues = apply_filters('site-reviews/create/review-values', $reviewValues, $command);
26
-        $reviewValues = Arr::prefixArrayKeys($reviewValues);
24
+        $reviewValues = glsr( CreateReviewDefaults::class )->restrict( (array)$command );
25
+        $reviewValues = apply_filters( 'site-reviews/create/review-values', $reviewValues, $command );
26
+        $reviewValues = Arr::prefixArrayKeys( $reviewValues );
27 27
         unset($reviewValues['json']); // @todo remove the need for this
28 28
         $postValues = [
29 29
             'comment_status' => 'closed',
@@ -31,20 +31,20 @@  discard block
 block discarded – undo
31 31
             'ping_status' => 'closed',
32 32
             'post_content' => $reviewValues['_content'],
33 33
             'post_date' => $reviewValues['_date'],
34
-            'post_date_gmt' => get_gmt_from_date($reviewValues['_date']),
34
+            'post_date_gmt' => get_gmt_from_date( $reviewValues['_date'] ),
35 35
             'post_name' => $reviewValues['_review_type'].'-'.$reviewValues['_review_id'],
36
-            'post_status' => $this->getNewPostStatus($reviewValues, $command->blacklisted),
36
+            'post_status' => $this->getNewPostStatus( $reviewValues, $command->blacklisted ),
37 37
             'post_title' => $reviewValues['_title'],
38 38
             'post_type' => Application::POST_TYPE,
39 39
         ];
40
-        $postId = wp_insert_post($postValues, true);
41
-        if (is_wp_error($postId)) {
42
-            glsr_log()->error($postId->get_error_message())->debug($postValues);
40
+        $postId = wp_insert_post( $postValues, true );
41
+        if( is_wp_error( $postId ) ) {
42
+            glsr_log()->error( $postId->get_error_message() )->debug( $postValues );
43 43
             return false;
44 44
         }
45
-        $this->setTerms($postId, $command->category);
46
-        $review = $this->single(get_post($postId));
47
-        do_action('site-reviews/review/created', $review, $command);
45
+        $this->setTerms( $postId, $command->category );
46
+        $review = $this->single( get_post( $postId ) );
47
+        do_action( 'site-reviews/review/created', $review, $command );
48 48
         return $review;
49 49
     }
50 50
 
@@ -52,29 +52,29 @@  discard block
 block discarded – undo
52 52
      * @param string $metaReviewId
53 53
      * @return void
54 54
      */
55
-    public function delete($metaReviewId)
55
+    public function delete( $metaReviewId )
56 56
     {
57
-        if ($postId = $this->getPostId($metaReviewId)) {
58
-            wp_delete_post($postId, true);
57
+        if( $postId = $this->getPostId( $metaReviewId ) ) {
58
+            wp_delete_post( $postId, true );
59 59
         }
60 60
     }
61 61
 
62 62
     /**
63 63
      * @return object
64 64
      */
65
-    public function get(array $args = [])
65
+    public function get( array $args = [] )
66 66
     {
67
-        $args = glsr(ReviewsDefaults::class)->merge($args);
68
-        $metaQuery = glsr(QueryBuilder::class)->buildQuery(
67
+        $args = glsr( ReviewsDefaults::class )->merge( $args );
68
+        $metaQuery = glsr( QueryBuilder::class )->buildQuery(
69 69
             ['assigned_to', 'email', 'ip_address', 'type', 'rating'],
70 70
             $args
71 71
         );
72
-        $taxQuery = glsr(QueryBuilder::class)->buildQuery(
72
+        $taxQuery = glsr( QueryBuilder::class )->buildQuery(
73 73
             ['category'],
74
-            ['category' => $this->normalizeTermIds($args['category'])]
74
+            ['category' => $this->normalizeTermIds( $args['category'] )]
75 75
         );
76
-        $paged = glsr(QueryBuilder::class)->getPaged(
77
-            wp_validate_boolean($args['pagination'])
76
+        $paged = glsr( QueryBuilder::class )->getPaged(
77
+            wp_validate_boolean( $args['pagination'] )
78 78
         );
79 79
         $parameters = [
80 80
             'meta_key' => '_pinned',
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             'offset' => $args['offset'],
83 83
             'order' => $args['order'],
84 84
             'orderby' => 'meta_value '.$args['orderby'],
85
-            'paged' => Arr::get($args, 'paged', $paged),
85
+            'paged' => Arr::get( $args, 'paged', $paged ),
86 86
             'post__in' => $args['post__in'],
87 87
             'post__not_in' => $args['post__not_in'],
88 88
             'post_status' => 'publish',
@@ -90,62 +90,62 @@  discard block
 block discarded – undo
90 90
             'posts_per_page' => $args['per_page'],
91 91
             'tax_query' => $taxQuery,
92 92
         ];
93
-        $parameters = apply_filters('site-reviews/get/reviews/query', $parameters, $args);
94
-        $query = new WP_Query($parameters);
95
-        $results = array_map([$this, 'single'], $query->posts);
96
-        $reviews = new Reviews($results, $query->max_num_pages, $args);
97
-        return apply_filters('site-reviews/get/reviews', $reviews, $query);
93
+        $parameters = apply_filters( 'site-reviews/get/reviews/query', $parameters, $args );
94
+        $query = new WP_Query( $parameters );
95
+        $results = array_map( [$this, 'single'], $query->posts );
96
+        $reviews = new Reviews( $results, $query->max_num_pages, $args );
97
+        return apply_filters( 'site-reviews/get/reviews', $reviews, $query );
98 98
     }
99 99
 
100 100
     /**
101 101
      * @param string $metaReviewId
102 102
      * @return int
103 103
      */
104
-    public function getPostId($metaReviewId)
104
+    public function getPostId( $metaReviewId )
105 105
     {
106
-        return glsr(SqlQueries::class)->getPostIdFromReviewId($metaReviewId);
106
+        return glsr( SqlQueries::class )->getPostIdFromReviewId( $metaReviewId );
107 107
     }
108 108
 
109 109
     /**
110 110
      * @return array
111 111
      */
112
-    public function getRatingCounts(array $args = [])
112
+    public function getRatingCounts( array $args = [] )
113 113
     {
114
-        $args = glsr(SiteReviewsSummaryDefaults::class)->filter($args);
115
-        $counts = glsr(CountsManager::class)->get([
116
-            'post_ids' => Arr::convertStringToArray($args['assigned_to']),
117
-            'term_ids' => $this->normalizeTermIds($args['category']),
114
+        $args = glsr( SiteReviewsSummaryDefaults::class )->filter( $args );
115
+        $counts = glsr( CountsManager::class )->get( [
116
+            'post_ids' => Arr::convertStringToArray( $args['assigned_to'] ),
117
+            'term_ids' => $this->normalizeTermIds( $args['category'] ),
118 118
             'type' => $args['type'],
119
-        ]);
120
-        return glsr(CountsManager::class)->flatten($counts, [
119
+        ] );
120
+        return glsr( CountsManager::class )->flatten( $counts, [
121 121
             'min' => $args['rating'],
122
-        ]);
122
+        ] );
123 123
     }
124 124
 
125 125
     /**
126 126
      * @param string $commaSeparatedTermIds
127 127
      * @return array
128 128
      */
129
-    public function normalizeTermIds($commaSeparatedTermIds)
129
+    public function normalizeTermIds( $commaSeparatedTermIds )
130 130
     {
131
-        $termIds = glsr_array_column($this->normalizeTerms($commaSeparatedTermIds), 'term_id');
132
-        return array_unique(array_map('intval', $termIds));
131
+        $termIds = glsr_array_column( $this->normalizeTerms( $commaSeparatedTermIds ), 'term_id' );
132
+        return array_unique( array_map( 'intval', $termIds ) );
133 133
     }
134 134
 
135 135
     /**
136 136
      * @param string $commaSeparatedTermIds
137 137
      * @return array
138 138
      */
139
-    public function normalizeTerms($commaSeparatedTermIds)
139
+    public function normalizeTerms( $commaSeparatedTermIds )
140 140
     {
141 141
         $terms = [];
142
-        $termIds = Arr::convertStringToArray($commaSeparatedTermIds);
143
-        foreach ($termIds as $termId) {
144
-            if (is_numeric($termId)) {
145
-                $termId = intval($termId);
142
+        $termIds = Arr::convertStringToArray( $commaSeparatedTermIds );
143
+        foreach( $termIds as $termId ) {
144
+            if( is_numeric( $termId ) ) {
145
+                $termId = intval( $termId );
146 146
             }
147
-            $term = term_exists($termId, Application::TAXONOMY);
148
-            if (!isset($term['term_id'])) {
147
+            $term = term_exists( $termId, Application::TAXONOMY );
148
+            if( !isset($term['term_id']) ) {
149 149
                 continue;
150 150
             }
151 151
             $terms[] = $term;
@@ -157,44 +157,44 @@  discard block
 block discarded – undo
157 157
      * @param int $postId
158 158
      * @return void
159 159
      */
160
-    public function revert($postId)
160
+    public function revert( $postId )
161 161
     {
162
-        if (Application::POST_TYPE != get_post_field('post_type', $postId)) {
162
+        if( Application::POST_TYPE != get_post_field( 'post_type', $postId ) ) {
163 163
             return;
164 164
         }
165
-        delete_post_meta($postId, '_edit_last');
166
-        $result = wp_update_post([
165
+        delete_post_meta( $postId, '_edit_last' );
166
+        $result = wp_update_post( [
167 167
             'ID' => $postId,
168
-            'post_content' => glsr(Database::class)->get($postId, 'content'),
169
-            'post_date' => glsr(Database::class)->get($postId, 'date'),
170
-            'post_title' => glsr(Database::class)->get($postId, 'title'),
171
-        ]);
172
-        if (is_wp_error($result)) {
173
-            glsr_log()->error($result->get_error_message());
168
+            'post_content' => glsr( Database::class )->get( $postId, 'content' ),
169
+            'post_date' => glsr( Database::class )->get( $postId, 'date' ),
170
+            'post_title' => glsr( Database::class )->get( $postId, 'title' ),
171
+        ] );
172
+        if( is_wp_error( $result ) ) {
173
+            glsr_log()->error( $result->get_error_message() );
174 174
             return;
175 175
         }
176
-        do_action('site-reviews/review/reverted', glsr_get_review($postId));
176
+        do_action( 'site-reviews/review/reverted', glsr_get_review( $postId ) );
177 177
     }
178 178
 
179 179
     /**
180 180
      * @return Review
181 181
      */
182
-    public function single(WP_Post $post)
182
+    public function single( WP_Post $post )
183 183
     {
184
-        if (Application::POST_TYPE != $post->post_type) {
185
-            $post = new WP_Post((object) []);
184
+        if( Application::POST_TYPE != $post->post_type ) {
185
+            $post = new WP_Post( (object)[] );
186 186
         }
187
-        $review = new Review($post);
188
-        return apply_filters('site-reviews/get/review', $review, $post);
187
+        $review = new Review( $post );
188
+        return apply_filters( 'site-reviews/get/review', $review, $post );
189 189
     }
190 190
 
191 191
     /**
192 192
      * @param bool $isBlacklisted
193 193
      * @return string
194 194
      */
195
-    protected function getNewPostStatus(array $reviewValues, $isBlacklisted)
195
+    protected function getNewPostStatus( array $reviewValues, $isBlacklisted )
196 196
     {
197
-        $requireApproval = glsr(OptionManager::class)->getBool('settings.general.require.approval');
197
+        $requireApproval = glsr( OptionManager::class )->getBool( 'settings.general.require.approval' );
198 198
         return 'local' == $reviewValues['_review_type'] && ($requireApproval || $isBlacklisted)
199 199
             ? 'pending'
200 200
             : 'publish';
@@ -205,15 +205,15 @@  discard block
 block discarded – undo
205 205
      * @param string $termIds
206 206
      * @return void
207 207
      */
208
-    protected function setTerms($postId, $termIds)
208
+    protected function setTerms( $postId, $termIds )
209 209
     {
210
-        $termIds = $this->normalizeTermIds($termIds);
211
-        if (empty($termIds)) {
210
+        $termIds = $this->normalizeTermIds( $termIds );
211
+        if( empty($termIds) ) {
212 212
             return;
213 213
         }
214
-        $termTaxonomyIds = wp_set_object_terms($postId, $termIds, Application::TAXONOMY);
215
-        if (is_wp_error($termTaxonomyIds)) {
216
-            glsr_log()->error($termTaxonomyIds->get_error_message());
214
+        $termTaxonomyIds = wp_set_object_terms( $postId, $termIds, Application::TAXONOMY );
215
+        if( is_wp_error( $termTaxonomyIds ) ) {
216
+            glsr_log()->error( $termTaxonomyIds->get_error_message() );
217 217
         }
218 218
     }
219 219
 }
Please login to merge, or discard this patch.
plugin/Application.php 2 patches
Indentation   +279 added lines, -279 removed lines patch added patch discarded remove patch
@@ -9,308 +9,308 @@
 block discarded – undo
9 9
 
10 10
 final class Application extends Container
11 11
 {
12
-    const CAPABILITY = 'edit_others_posts';
13
-    const CRON_EVENT = 'site-reviews/schedule/session/purge';
14
-    const ID = 'site-reviews';
15
-    const PAGED_QUERY_VAR = 'reviews-page';
16
-    const POST_TYPE = 'site-review';
17
-    const PREFIX = 'glsr_';
18
-    const TAXONOMY = 'site-review-category';
12
+	const CAPABILITY = 'edit_others_posts';
13
+	const CRON_EVENT = 'site-reviews/schedule/session/purge';
14
+	const ID = 'site-reviews';
15
+	const PAGED_QUERY_VAR = 'reviews-page';
16
+	const POST_TYPE = 'site-review';
17
+	const PREFIX = 'glsr_';
18
+	const TAXONOMY = 'site-review-category';
19 19
 
20
-    public $defaults;
21
-    public $deprecated = [];
22
-    public $file;
23
-    public $languages;
24
-    public $mceShortcodes = []; //defined elsewhere
25
-    public $name;
26
-    public $reviewTypes;
27
-    public $schemas = []; //defined elsewhere
28
-    public $version;
20
+	public $defaults;
21
+	public $deprecated = [];
22
+	public $file;
23
+	public $languages;
24
+	public $mceShortcodes = []; //defined elsewhere
25
+	public $name;
26
+	public $reviewTypes;
27
+	public $schemas = []; //defined elsewhere
28
+	public $version;
29 29
 
30
-    public function __construct()
31
-    {
32
-        static::$instance = $this;
33
-        $this->file = realpath(trailingslashit(dirname(__DIR__)).static::ID.'.php');
34
-        $plugin = get_file_data($this->file, [
35
-            'languages' => 'Domain Path',
36
-            'name' => 'Plugin Name',
37
-            'version' => 'Version',
38
-        ], 'plugin');
39
-        array_walk($plugin, function ($value, $key) {
40
-            $this->$key = $value;
41
-        });
42
-    }
30
+	public function __construct()
31
+	{
32
+		static::$instance = $this;
33
+		$this->file = realpath(trailingslashit(dirname(__DIR__)).static::ID.'.php');
34
+		$plugin = get_file_data($this->file, [
35
+			'languages' => 'Domain Path',
36
+			'name' => 'Plugin Name',
37
+			'version' => 'Version',
38
+		], 'plugin');
39
+		array_walk($plugin, function ($value, $key) {
40
+			$this->$key = $value;
41
+		});
42
+	}
43 43
 
44
-    /**
45
-     * @return void
46
-     */
47
-    public function activate()
48
-    {
49
-        $this->make(DefaultsManager::class)->set();
50
-        $this->scheduleCronJob();
51
-        $this->upgrade();
52
-    }
44
+	/**
45
+	 * @return void
46
+	 */
47
+	public function activate()
48
+	{
49
+		$this->make(DefaultsManager::class)->set();
50
+		$this->scheduleCronJob();
51
+		$this->upgrade();
52
+	}
53 53
 
54
-    /**
55
-     * @return void
56
-     */
57
-    public function catchFatalError()
58
-    {
59
-        $error = error_get_last();
60
-        if (E_ERROR !== $error['type'] || !Str::contains($error['message'], $this->path())) {
61
-            return;
62
-        }
63
-        glsr_log()->error($error['message']);
64
-    }
54
+	/**
55
+	 * @return void
56
+	 */
57
+	public function catchFatalError()
58
+	{
59
+		$error = error_get_last();
60
+		if (E_ERROR !== $error['type'] || !Str::contains($error['message'], $this->path())) {
61
+			return;
62
+		}
63
+		glsr_log()->error($error['message']);
64
+	}
65 65
 
66
-    /**
67
-     * @param string $name
68
-     * @return array
69
-     */
70
-    public function config($name)
71
-    {
72
-        $configFile = $this->path('config/'.$name.'.php');
73
-        $config = file_exists($configFile)
74
-            ? include $configFile
75
-            : [];
76
-        return apply_filters('site-reviews/config/'.$name, $config);
77
-    }
66
+	/**
67
+	 * @param string $name
68
+	 * @return array
69
+	 */
70
+	public function config($name)
71
+	{
72
+		$configFile = $this->path('config/'.$name.'.php');
73
+		$config = file_exists($configFile)
74
+			? include $configFile
75
+			: [];
76
+		return apply_filters('site-reviews/config/'.$name, $config);
77
+	}
78 78
 
79
-    /**
80
-     * @param string $property
81
-     * @return string
82
-     */
83
-    public function constant($property, $className = 'static')
84
-    {
85
-        $constant = $className.'::'.$property;
86
-        return defined($constant)
87
-            ? apply_filters('site-reviews/const/'.$property, constant($constant))
88
-            : '';
89
-    }
79
+	/**
80
+	 * @param string $property
81
+	 * @return string
82
+	 */
83
+	public function constant($property, $className = 'static')
84
+	{
85
+		$constant = $className.'::'.$property;
86
+		return defined($constant)
87
+			? apply_filters('site-reviews/const/'.$property, constant($constant))
88
+			: '';
89
+	}
90 90
 
91
-    /**
92
-     * @return void
93
-     */
94
-    public function deactivate()
95
-    {
96
-        $this->unscheduleCronJob();
97
-    }
91
+	/**
92
+	 * @return void
93
+	 */
94
+	public function deactivate()
95
+	{
96
+		$this->unscheduleCronJob();
97
+	}
98 98
 
99
-    /**
100
-     * @param string $view
101
-     * @return void|string
102
-     */
103
-    public function file($view)
104
-    {
105
-        $view.= '.php';
106
-        $filePaths = [];
107
-        if (Str::startsWith('templates/', $view)) {
108
-            $filePaths[] = $this->themePath(Str::removePrefix('templates/', $view));
109
-        }
110
-        $filePaths[] = $this->path($view);
111
-        $filePaths[] = $this->path('views/'.$view);
112
-        foreach ($filePaths as $file) {
113
-            if (!file_exists($file)) {
114
-                continue;
115
-            }
116
-            return $file;
117
-        }
118
-    }
99
+	/**
100
+	 * @param string $view
101
+	 * @return void|string
102
+	 */
103
+	public function file($view)
104
+	{
105
+		$view.= '.php';
106
+		$filePaths = [];
107
+		if (Str::startsWith('templates/', $view)) {
108
+			$filePaths[] = $this->themePath(Str::removePrefix('templates/', $view));
109
+		}
110
+		$filePaths[] = $this->path($view);
111
+		$filePaths[] = $this->path('views/'.$view);
112
+		foreach ($filePaths as $file) {
113
+			if (!file_exists($file)) {
114
+				continue;
115
+			}
116
+			return $file;
117
+		}
118
+	}
119 119
 
120
-    /**
121
-     * @return array
122
-     */
123
-    public function getDefaults()
124
-    {
125
-        if (empty($this->defaults)) {
126
-            $this->defaults = $this->make(DefaultsManager::class)->get();
127
-            $this->upgrade();
128
-        }
129
-        return apply_filters('site-reviews/get/defaults', $this->defaults);
130
-    }
120
+	/**
121
+	 * @return array
122
+	 */
123
+	public function getDefaults()
124
+	{
125
+		if (empty($this->defaults)) {
126
+			$this->defaults = $this->make(DefaultsManager::class)->get();
127
+			$this->upgrade();
128
+		}
129
+		return apply_filters('site-reviews/get/defaults', $this->defaults);
130
+	}
131 131
 
132
-    /**
133
-     * @return string
134
-     */
135
-    public function getPermission($page = '')
136
-    {
137
-        $permissions = [
138
-            'addons' => 'install_plugins',
139
-            'settings' => 'manage_options',
140
-            // 'welcome' => 'activate_plugins',
141
-        ];
142
-        return Arr::get($permissions, $page, $this->constant('CAPABILITY'));
143
-    }
132
+	/**
133
+	 * @return string
134
+	 */
135
+	public function getPermission($page = '')
136
+	{
137
+		$permissions = [
138
+			'addons' => 'install_plugins',
139
+			'settings' => 'manage_options',
140
+			// 'welcome' => 'activate_plugins',
141
+		];
142
+		return Arr::get($permissions, $page, $this->constant('CAPABILITY'));
143
+	}
144 144
 
145
-    /**
146
-     * @return bool
147
-     */
148
-    public function hasPermission($page = '')
149
-    {
150
-        $isAdmin = $this->isAdmin();
151
-        return !$isAdmin || ($isAdmin && current_user_can($this->getPermission($page)));
152
-    }
145
+	/**
146
+	 * @return bool
147
+	 */
148
+	public function hasPermission($page = '')
149
+	{
150
+		$isAdmin = $this->isAdmin();
151
+		return !$isAdmin || ($isAdmin && current_user_can($this->getPermission($page)));
152
+	}
153 153
 
154
-    /**
155
-     * @return void
156
-     */
157
-    public function init()
158
-    {
159
-        $this->make(Actions::class)->run();
160
-        $this->make(Filters::class)->run();
161
-    }
154
+	/**
155
+	 * @return void
156
+	 */
157
+	public function init()
158
+	{
159
+		$this->make(Actions::class)->run();
160
+		$this->make(Filters::class)->run();
161
+	}
162 162
 
163
-    /**
164
-     * @return bool
165
-     */
166
-    public function isAdmin()
167
-    {
168
-        return is_admin() && !wp_doing_ajax();
169
-    }
163
+	/**
164
+	 * @return bool
165
+	 */
166
+	public function isAdmin()
167
+	{
168
+		return is_admin() && !wp_doing_ajax();
169
+	}
170 170
 
171
-    /**
172
-     * @param string $file
173
-     * @return string
174
-     */
175
-    public function path($file = '', $realpath = true)
176
-    {
177
-        $path = plugin_dir_path($this->file);
178
-        if (!$realpath) {
179
-            $path = trailingslashit(WP_PLUGIN_DIR).basename(dirname($this->file));
180
-        }
181
-        $path = trailingslashit($path).ltrim(trim($file), '/');
182
-        return apply_filters('site-reviews/path', $path, $file);
183
-    }
171
+	/**
172
+	 * @param string $file
173
+	 * @return string
174
+	 */
175
+	public function path($file = '', $realpath = true)
176
+	{
177
+		$path = plugin_dir_path($this->file);
178
+		if (!$realpath) {
179
+			$path = trailingslashit(WP_PLUGIN_DIR).basename(dirname($this->file));
180
+		}
181
+		$path = trailingslashit($path).ltrim(trim($file), '/');
182
+		return apply_filters('site-reviews/path', $path, $file);
183
+	}
184 184
 
185
-    /**
186
-     * @return void
187
-     */
188
-    public function registerAddons()
189
-    {
190
-        do_action('site-reviews/addon/register', $this);
191
-    }
185
+	/**
186
+	 * @return void
187
+	 */
188
+	public function registerAddons()
189
+	{
190
+		do_action('site-reviews/addon/register', $this);
191
+	}
192 192
 
193
-    /**
194
-     * @return void
195
-     */
196
-    public function registerLanguages()
197
-    {
198
-        load_plugin_textdomain(static::ID, false,
199
-            trailingslashit(plugin_basename($this->path()).'/'.$this->languages)
200
-        );
201
-    }
193
+	/**
194
+	 * @return void
195
+	 */
196
+	public function registerLanguages()
197
+	{
198
+		load_plugin_textdomain(static::ID, false,
199
+			trailingslashit(plugin_basename($this->path()).'/'.$this->languages)
200
+		);
201
+	}
202 202
 
203
-    /**
204
-     * @return void
205
-     */
206
-    public function registerReviewTypes()
207
-    {
208
-        $types = apply_filters('site-reviews/addon/types', []);
209
-        $this->reviewTypes = wp_parse_args($types, [
210
-            'local' => __('Local', 'site-reviews'),
211
-        ]);
212
-    }
203
+	/**
204
+	 * @return void
205
+	 */
206
+	public function registerReviewTypes()
207
+	{
208
+		$types = apply_filters('site-reviews/addon/types', []);
209
+		$this->reviewTypes = wp_parse_args($types, [
210
+			'local' => __('Local', 'site-reviews'),
211
+		]);
212
+	}
213 213
 
214
-    /**
215
-     * @param string $view
216
-     * @return void
217
-     */
218
-    public function render($view, array $data = [])
219
-    {
220
-        $view = apply_filters('site-reviews/render/view', $view, $data);
221
-        $file = apply_filters('site-reviews/views/file', $this->file($view), $view, $data);
222
-        if (!file_exists($file)) {
223
-            glsr_log()->error('File not found: '.$file);
224
-            return;
225
-        }
226
-        $data = apply_filters('site-reviews/views/data', $data, $view);
227
-        extract($data);
228
-        include $file;
229
-    }
214
+	/**
215
+	 * @param string $view
216
+	 * @return void
217
+	 */
218
+	public function render($view, array $data = [])
219
+	{
220
+		$view = apply_filters('site-reviews/render/view', $view, $data);
221
+		$file = apply_filters('site-reviews/views/file', $this->file($view), $view, $data);
222
+		if (!file_exists($file)) {
223
+			glsr_log()->error('File not found: '.$file);
224
+			return;
225
+		}
226
+		$data = apply_filters('site-reviews/views/data', $data, $view);
227
+		extract($data);
228
+		include $file;
229
+	}
230 230
 
231
-    /**
232
-     * @return void
233
-     */
234
-    public function scheduleCronJob()
235
-    {
236
-        if (wp_next_scheduled(static::CRON_EVENT)) {
237
-            return;
238
-        }
239
-        wp_schedule_event(time(), 'twicedaily', static::CRON_EVENT);
240
-    }
231
+	/**
232
+	 * @return void
233
+	 */
234
+	public function scheduleCronJob()
235
+	{
236
+		if (wp_next_scheduled(static::CRON_EVENT)) {
237
+			return;
238
+		}
239
+		wp_schedule_event(time(), 'twicedaily', static::CRON_EVENT);
240
+	}
241 241
 
242
-    /**
243
-     * @param string $file
244
-     * @return string
245
-     */
246
-    public function themePath($file = '')
247
-    {
248
-        return get_stylesheet_directory().'/'.static::ID.'/'.ltrim(trim($file), '/');
249
-    }
242
+	/**
243
+	 * @param string $file
244
+	 * @return string
245
+	 */
246
+	public function themePath($file = '')
247
+	{
248
+		return get_stylesheet_directory().'/'.static::ID.'/'.ltrim(trim($file), '/');
249
+	}
250 250
 
251
-    /**
252
-     * @return void
253
-     */
254
-    public function unscheduleCronJob()
255
-    {
256
-        wp_unschedule_event(intval(wp_next_scheduled(static::CRON_EVENT)), static::CRON_EVENT);
257
-    }
251
+	/**
252
+	 * @return void
253
+	 */
254
+	public function unscheduleCronJob()
255
+	{
256
+		wp_unschedule_event(intval(wp_next_scheduled(static::CRON_EVENT)), static::CRON_EVENT);
257
+	}
258 258
 
259
-    /**
260
-     * @return void
261
-     */
262
-    public function upgrade()
263
-    {
264
-        $this->make(Upgrader::class)->run();
265
-    }
259
+	/**
260
+	 * @return void
261
+	 */
262
+	public function upgrade()
263
+	{
264
+		$this->make(Upgrader::class)->run();
265
+	}
266 266
 
267
-    /**
268
-     * @param mixed $upgrader
269
-     * @return void
270
-     * @action upgrader_process_complete
271
-     */
272
-    public function upgraded($upgrader, array $data)
273
-    {
274
-        if (array_key_exists('plugins', $data)
275
-            && in_array(plugin_basename($this->file), $data['plugins'])
276
-            && 'update' === $data['action']
277
-            && 'plugin' === $data['type']
278
-        ) {
279
-            $this->upgrade();
280
-        }
281
-    }
267
+	/**
268
+	 * @param mixed $upgrader
269
+	 * @return void
270
+	 * @action upgrader_process_complete
271
+	 */
272
+	public function upgraded($upgrader, array $data)
273
+	{
274
+		if (array_key_exists('plugins', $data)
275
+			&& in_array(plugin_basename($this->file), $data['plugins'])
276
+			&& 'update' === $data['action']
277
+			&& 'plugin' === $data['type']
278
+		) {
279
+			$this->upgrade();
280
+		}
281
+	}
282 282
 
283
-    /**
284
-     * @param string $path
285
-     * @return string
286
-     */
287
-    public function url($path = '')
288
-    {
289
-        $url = esc_url(plugin_dir_url($this->file).ltrim(trim($path), '/'));
290
-        return apply_filters('site-reviews/url', $url, $path);
291
-    }
283
+	/**
284
+	 * @param string $path
285
+	 * @return string
286
+	 */
287
+	public function url($path = '')
288
+	{
289
+		$url = esc_url(plugin_dir_url($this->file).ltrim(trim($path), '/'));
290
+		return apply_filters('site-reviews/url', $url, $path);
291
+	}
292 292
 
293
-    /**
294
-     * @param string $versionLevel
295
-     * @return string
296
-     */
297
-    public function version($versionLevel = '')
298
-    {
299
-        $pattern = '/^v?(\d{1,5})(\.\d++)?(\.\d++)?(.+)?$/i';
300
-        preg_match($pattern, $this->version, $matches);
301
-        switch ($versionLevel) {
302
-            case 'major':
303
-                $version = Arr::get($matches, 1);
304
-                break;
305
-            case 'minor':
306
-                $version = Arr::get($matches, 1).Arr::get($matches, 2);
307
-                break;
308
-            case 'patch':
309
-                $version = Arr::get($matches, 1).Arr::get($matches, 2).Arr::get($matches, 3);
310
-                break;
311
-        }
312
-        return empty($version)
313
-            ? $this->version
314
-            : $version;
315
-    }
293
+	/**
294
+	 * @param string $versionLevel
295
+	 * @return string
296
+	 */
297
+	public function version($versionLevel = '')
298
+	{
299
+		$pattern = '/^v?(\d{1,5})(\.\d++)?(\.\d++)?(.+)?$/i';
300
+		preg_match($pattern, $this->version, $matches);
301
+		switch ($versionLevel) {
302
+			case 'major':
303
+				$version = Arr::get($matches, 1);
304
+				break;
305
+			case 'minor':
306
+				$version = Arr::get($matches, 1).Arr::get($matches, 2);
307
+				break;
308
+			case 'patch':
309
+				$version = Arr::get($matches, 1).Arr::get($matches, 2).Arr::get($matches, 3);
310
+				break;
311
+		}
312
+		return empty($version)
313
+			? $this->version
314
+			: $version;
315
+	}
316 316
 }
Please login to merge, or discard this patch.
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
     public function __construct()
31 31
     {
32 32
         static::$instance = $this;
33
-        $this->file = realpath(trailingslashit(dirname(__DIR__)).static::ID.'.php');
34
-        $plugin = get_file_data($this->file, [
33
+        $this->file = realpath( trailingslashit( dirname( __DIR__ ) ).static::ID.'.php' );
34
+        $plugin = get_file_data( $this->file, [
35 35
             'languages' => 'Domain Path',
36 36
             'name' => 'Plugin Name',
37 37
             'version' => 'Version',
38
-        ], 'plugin');
39
-        array_walk($plugin, function ($value, $key) {
38
+        ], 'plugin' );
39
+        array_walk( $plugin, function( $value, $key ) {
40 40
             $this->$key = $value;
41 41
         });
42 42
     }
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function activate()
48 48
     {
49
-        $this->make(DefaultsManager::class)->set();
49
+        $this->make( DefaultsManager::class )->set();
50 50
         $this->scheduleCronJob();
51 51
         $this->upgrade();
52 52
     }
@@ -57,34 +57,34 @@  discard block
 block discarded – undo
57 57
     public function catchFatalError()
58 58
     {
59 59
         $error = error_get_last();
60
-        if (E_ERROR !== $error['type'] || !Str::contains($error['message'], $this->path())) {
60
+        if( E_ERROR !== $error['type'] || !Str::contains( $error['message'], $this->path() ) ) {
61 61
             return;
62 62
         }
63
-        glsr_log()->error($error['message']);
63
+        glsr_log()->error( $error['message'] );
64 64
     }
65 65
 
66 66
     /**
67 67
      * @param string $name
68 68
      * @return array
69 69
      */
70
-    public function config($name)
70
+    public function config( $name )
71 71
     {
72
-        $configFile = $this->path('config/'.$name.'.php');
73
-        $config = file_exists($configFile)
72
+        $configFile = $this->path( 'config/'.$name.'.php' );
73
+        $config = file_exists( $configFile )
74 74
             ? include $configFile
75 75
             : [];
76
-        return apply_filters('site-reviews/config/'.$name, $config);
76
+        return apply_filters( 'site-reviews/config/'.$name, $config );
77 77
     }
78 78
 
79 79
     /**
80 80
      * @param string $property
81 81
      * @return string
82 82
      */
83
-    public function constant($property, $className = 'static')
83
+    public function constant( $property, $className = 'static' )
84 84
     {
85 85
         $constant = $className.'::'.$property;
86
-        return defined($constant)
87
-            ? apply_filters('site-reviews/const/'.$property, constant($constant))
86
+        return defined( $constant )
87
+            ? apply_filters( 'site-reviews/const/'.$property, constant( $constant ) )
88 88
             : '';
89 89
     }
90 90
 
@@ -100,17 +100,17 @@  discard block
 block discarded – undo
100 100
      * @param string $view
101 101
      * @return void|string
102 102
      */
103
-    public function file($view)
103
+    public function file( $view )
104 104
     {
105
-        $view.= '.php';
105
+        $view .= '.php';
106 106
         $filePaths = [];
107
-        if (Str::startsWith('templates/', $view)) {
108
-            $filePaths[] = $this->themePath(Str::removePrefix('templates/', $view));
107
+        if( Str::startsWith( 'templates/', $view ) ) {
108
+            $filePaths[] = $this->themePath( Str::removePrefix( 'templates/', $view ) );
109 109
         }
110
-        $filePaths[] = $this->path($view);
111
-        $filePaths[] = $this->path('views/'.$view);
112
-        foreach ($filePaths as $file) {
113
-            if (!file_exists($file)) {
110
+        $filePaths[] = $this->path( $view );
111
+        $filePaths[] = $this->path( 'views/'.$view );
112
+        foreach( $filePaths as $file ) {
113
+            if( !file_exists( $file ) ) {
114 114
                 continue;
115 115
             }
116 116
             return $file;
@@ -122,33 +122,33 @@  discard block
 block discarded – undo
122 122
      */
123 123
     public function getDefaults()
124 124
     {
125
-        if (empty($this->defaults)) {
126
-            $this->defaults = $this->make(DefaultsManager::class)->get();
125
+        if( empty($this->defaults) ) {
126
+            $this->defaults = $this->make( DefaultsManager::class )->get();
127 127
             $this->upgrade();
128 128
         }
129
-        return apply_filters('site-reviews/get/defaults', $this->defaults);
129
+        return apply_filters( 'site-reviews/get/defaults', $this->defaults );
130 130
     }
131 131
 
132 132
     /**
133 133
      * @return string
134 134
      */
135
-    public function getPermission($page = '')
135
+    public function getPermission( $page = '' )
136 136
     {
137 137
         $permissions = [
138 138
             'addons' => 'install_plugins',
139 139
             'settings' => 'manage_options',
140 140
             // 'welcome' => 'activate_plugins',
141 141
         ];
142
-        return Arr::get($permissions, $page, $this->constant('CAPABILITY'));
142
+        return Arr::get( $permissions, $page, $this->constant( 'CAPABILITY' ) );
143 143
     }
144 144
 
145 145
     /**
146 146
      * @return bool
147 147
      */
148
-    public function hasPermission($page = '')
148
+    public function hasPermission( $page = '' )
149 149
     {
150 150
         $isAdmin = $this->isAdmin();
151
-        return !$isAdmin || ($isAdmin && current_user_can($this->getPermission($page)));
151
+        return !$isAdmin || ($isAdmin && current_user_can( $this->getPermission( $page ) ));
152 152
     }
153 153
 
154 154
     /**
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
      */
157 157
     public function init()
158 158
     {
159
-        $this->make(Actions::class)->run();
160
-        $this->make(Filters::class)->run();
159
+        $this->make( Actions::class )->run();
160
+        $this->make( Filters::class )->run();
161 161
     }
162 162
 
163 163
     /**
@@ -172,14 +172,14 @@  discard block
 block discarded – undo
172 172
      * @param string $file
173 173
      * @return string
174 174
      */
175
-    public function path($file = '', $realpath = true)
175
+    public function path( $file = '', $realpath = true )
176 176
     {
177
-        $path = plugin_dir_path($this->file);
178
-        if (!$realpath) {
179
-            $path = trailingslashit(WP_PLUGIN_DIR).basename(dirname($this->file));
177
+        $path = plugin_dir_path( $this->file );
178
+        if( !$realpath ) {
179
+            $path = trailingslashit( WP_PLUGIN_DIR ).basename( dirname( $this->file ) );
180 180
         }
181
-        $path = trailingslashit($path).ltrim(trim($file), '/');
182
-        return apply_filters('site-reviews/path', $path, $file);
181
+        $path = trailingslashit( $path ).ltrim( trim( $file ), '/' );
182
+        return apply_filters( 'site-reviews/path', $path, $file );
183 183
     }
184 184
 
185 185
     /**
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
      */
188 188
     public function registerAddons()
189 189
     {
190
-        do_action('site-reviews/addon/register', $this);
190
+        do_action( 'site-reviews/addon/register', $this );
191 191
     }
192 192
 
193 193
     /**
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
      */
196 196
     public function registerLanguages()
197 197
     {
198
-        load_plugin_textdomain(static::ID, false,
199
-            trailingslashit(plugin_basename($this->path()).'/'.$this->languages)
198
+        load_plugin_textdomain( static::ID, false,
199
+            trailingslashit( plugin_basename( $this->path() ).'/'.$this->languages )
200 200
         );
201 201
     }
202 202
 
@@ -205,26 +205,26 @@  discard block
 block discarded – undo
205 205
      */
206 206
     public function registerReviewTypes()
207 207
     {
208
-        $types = apply_filters('site-reviews/addon/types', []);
209
-        $this->reviewTypes = wp_parse_args($types, [
210
-            'local' => __('Local', 'site-reviews'),
211
-        ]);
208
+        $types = apply_filters( 'site-reviews/addon/types', [] );
209
+        $this->reviewTypes = wp_parse_args( $types, [
210
+            'local' => __( 'Local', 'site-reviews' ),
211
+        ] );
212 212
     }
213 213
 
214 214
     /**
215 215
      * @param string $view
216 216
      * @return void
217 217
      */
218
-    public function render($view, array $data = [])
218
+    public function render( $view, array $data = [] )
219 219
     {
220
-        $view = apply_filters('site-reviews/render/view', $view, $data);
221
-        $file = apply_filters('site-reviews/views/file', $this->file($view), $view, $data);
222
-        if (!file_exists($file)) {
223
-            glsr_log()->error('File not found: '.$file);
220
+        $view = apply_filters( 'site-reviews/render/view', $view, $data );
221
+        $file = apply_filters( 'site-reviews/views/file', $this->file( $view ), $view, $data );
222
+        if( !file_exists( $file ) ) {
223
+            glsr_log()->error( 'File not found: '.$file );
224 224
             return;
225 225
         }
226
-        $data = apply_filters('site-reviews/views/data', $data, $view);
227
-        extract($data);
226
+        $data = apply_filters( 'site-reviews/views/data', $data, $view );
227
+        extract( $data );
228 228
         include $file;
229 229
     }
230 230
 
@@ -233,19 +233,19 @@  discard block
 block discarded – undo
233 233
      */
234 234
     public function scheduleCronJob()
235 235
     {
236
-        if (wp_next_scheduled(static::CRON_EVENT)) {
236
+        if( wp_next_scheduled( static::CRON_EVENT ) ) {
237 237
             return;
238 238
         }
239
-        wp_schedule_event(time(), 'twicedaily', static::CRON_EVENT);
239
+        wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT );
240 240
     }
241 241
 
242 242
     /**
243 243
      * @param string $file
244 244
      * @return string
245 245
      */
246
-    public function themePath($file = '')
246
+    public function themePath( $file = '' )
247 247
     {
248
-        return get_stylesheet_directory().'/'.static::ID.'/'.ltrim(trim($file), '/');
248
+        return get_stylesheet_directory().'/'.static::ID.'/'.ltrim( trim( $file ), '/' );
249 249
     }
250 250
 
251 251
     /**
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
      */
254 254
     public function unscheduleCronJob()
255 255
     {
256
-        wp_unschedule_event(intval(wp_next_scheduled(static::CRON_EVENT)), static::CRON_EVENT);
256
+        wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT ) ), static::CRON_EVENT );
257 257
     }
258 258
 
259 259
     /**
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
      */
262 262
     public function upgrade()
263 263
     {
264
-        $this->make(Upgrader::class)->run();
264
+        $this->make( Upgrader::class )->run();
265 265
     }
266 266
 
267 267
     /**
@@ -269,10 +269,10 @@  discard block
 block discarded – undo
269 269
      * @return void
270 270
      * @action upgrader_process_complete
271 271
      */
272
-    public function upgraded($upgrader, array $data)
272
+    public function upgraded( $upgrader, array $data )
273 273
     {
274
-        if (array_key_exists('plugins', $data)
275
-            && in_array(plugin_basename($this->file), $data['plugins'])
274
+        if( array_key_exists( 'plugins', $data )
275
+            && in_array( plugin_basename( $this->file ), $data['plugins'] )
276 276
             && 'update' === $data['action']
277 277
             && 'plugin' === $data['type']
278 278
         ) {
@@ -284,29 +284,29 @@  discard block
 block discarded – undo
284 284
      * @param string $path
285 285
      * @return string
286 286
      */
287
-    public function url($path = '')
287
+    public function url( $path = '' )
288 288
     {
289
-        $url = esc_url(plugin_dir_url($this->file).ltrim(trim($path), '/'));
290
-        return apply_filters('site-reviews/url', $url, $path);
289
+        $url = esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ) );
290
+        return apply_filters( 'site-reviews/url', $url, $path );
291 291
     }
292 292
 
293 293
     /**
294 294
      * @param string $versionLevel
295 295
      * @return string
296 296
      */
297
-    public function version($versionLevel = '')
297
+    public function version( $versionLevel = '' )
298 298
     {
299 299
         $pattern = '/^v?(\d{1,5})(\.\d++)?(\.\d++)?(.+)?$/i';
300
-        preg_match($pattern, $this->version, $matches);
301
-        switch ($versionLevel) {
300
+        preg_match( $pattern, $this->version, $matches );
301
+        switch( $versionLevel ) {
302 302
             case 'major':
303
-                $version = Arr::get($matches, 1);
303
+                $version = Arr::get( $matches, 1 );
304 304
                 break;
305 305
             case 'minor':
306
-                $version = Arr::get($matches, 1).Arr::get($matches, 2);
306
+                $version = Arr::get( $matches, 1 ).Arr::get( $matches, 2 );
307 307
                 break;
308 308
             case 'patch':
309
-                $version = Arr::get($matches, 1).Arr::get($matches, 2).Arr::get($matches, 3);
309
+                $version = Arr::get( $matches, 1 ).Arr::get( $matches, 2 ).Arr::get( $matches, 3 );
310 310
                 break;
311 311
         }
312 312
         return empty($version)
Please login to merge, or discard this patch.