Passed
Push — master ( 0b281c...7e4cda )
by Paul
10:53 queued 04:23
created
plugin/Widgets/SiteReviewsWidget.php 2 patches
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -7,92 +7,92 @@
 block discarded – undo
7 7
 
8 8
 class SiteReviewsWidget extends Widget
9 9
 {
10
-    /**
11
-     * @param array $instance
12
-     * @return void
13
-     */
14
-    public function form($instance)
15
-    {
16
-        $this->widgetArgs = glsr(SiteReviewsShortcode::class)->normalizeAtts($instance);
17
-        $terms = glsr(Database::class)->getTerms();
18
-        $this->renderField('text', [
19
-            'class' => 'widefat',
20
-            'label' => __('Title', 'site-reviews'),
21
-            'name' => 'title',
22
-        ]);
23
-        $this->renderField('number', [
24
-            'class' => 'small-text',
25
-            'default' => 10,
26
-            'label' => __('How many reviews would you like to display?', 'site-reviews'),
27
-            'max' => 100,
28
-            'name' => 'display',
29
-        ]);
30
-        $this->renderField('select', [
31
-            'label' => __('What is the minimum rating to display?', 'site-reviews'),
32
-            'name' => 'rating',
33
-            'options' => [
34
-                '5' => sprintf(_n('%s star', '%s stars', 5, 'site-reviews'), 5),
35
-                '4' => sprintf(_n('%s star', '%s stars', 4, 'site-reviews'), 4),
36
-                '3' => sprintf(_n('%s star', '%s stars', 3, 'site-reviews'), 3),
37
-                '2' => sprintf(_n('%s star', '%s stars', 2, 'site-reviews'), 2),
38
-                '1' => sprintf(_n('%s star', '%s stars', 1, 'site-reviews'), 1),
39
-            ],
40
-        ]);
41
-        if (count(glsr()->reviewTypes) > 1) {
42
-            $this->renderField('select', [
43
-                'class' => 'widefat',
44
-                'label' => __('Which type of review would you like to display?', 'site-reviews'),
45
-                'name' => 'type',
46
-                'options' => ['' => __('All Reviews', 'site-reviews')] + glsr()->reviewTypes,
47
-            ]);
48
-        }
49
-        if (!empty($terms)) {
50
-            $this->renderField('select', [
51
-                'class' => 'widefat',
52
-                'label' => __('Limit reviews to this category', 'site-reviews'),
53
-                'name' => 'category',
54
-                'options' => ['' => __('All Categories', 'site-reviews')] + $terms,
55
-            ]);
56
-        }
57
-        $this->renderField('text', [
58
-            'class' => 'widefat',
59
-            'default' => '',
60
-            'description' => sprintf(__("Separate multiple ID's with a comma. You may also enter %s to automatically represent the current page/post ID.", 'site-reviews'), '<code>post_id</code>'),
61
-            'label' => __('Limit reviews to those assigned to this page/post ID', 'site-reviews'),
62
-            'name' => 'assigned_to',
63
-        ]);
64
-        $this->renderField('text', [
65
-            'class' => 'widefat',
66
-            'label' => __('Enter any custom CSS classes here', 'site-reviews'),
67
-            'name' => 'class',
68
-        ]);
69
-        $this->renderField('checkbox', [
70
-            'name' => 'hide',
71
-            'options' => glsr(SiteReviewsShortcode::class)->getHideOptions(),
72
-        ]);
73
-    }
10
+	/**
11
+	 * @param array $instance
12
+	 * @return void
13
+	 */
14
+	public function form($instance)
15
+	{
16
+		$this->widgetArgs = glsr(SiteReviewsShortcode::class)->normalizeAtts($instance);
17
+		$terms = glsr(Database::class)->getTerms();
18
+		$this->renderField('text', [
19
+			'class' => 'widefat',
20
+			'label' => __('Title', 'site-reviews'),
21
+			'name' => 'title',
22
+		]);
23
+		$this->renderField('number', [
24
+			'class' => 'small-text',
25
+			'default' => 10,
26
+			'label' => __('How many reviews would you like to display?', 'site-reviews'),
27
+			'max' => 100,
28
+			'name' => 'display',
29
+		]);
30
+		$this->renderField('select', [
31
+			'label' => __('What is the minimum rating to display?', 'site-reviews'),
32
+			'name' => 'rating',
33
+			'options' => [
34
+				'5' => sprintf(_n('%s star', '%s stars', 5, 'site-reviews'), 5),
35
+				'4' => sprintf(_n('%s star', '%s stars', 4, 'site-reviews'), 4),
36
+				'3' => sprintf(_n('%s star', '%s stars', 3, 'site-reviews'), 3),
37
+				'2' => sprintf(_n('%s star', '%s stars', 2, 'site-reviews'), 2),
38
+				'1' => sprintf(_n('%s star', '%s stars', 1, 'site-reviews'), 1),
39
+			],
40
+		]);
41
+		if (count(glsr()->reviewTypes) > 1) {
42
+			$this->renderField('select', [
43
+				'class' => 'widefat',
44
+				'label' => __('Which type of review would you like to display?', 'site-reviews'),
45
+				'name' => 'type',
46
+				'options' => ['' => __('All Reviews', 'site-reviews')] + glsr()->reviewTypes,
47
+			]);
48
+		}
49
+		if (!empty($terms)) {
50
+			$this->renderField('select', [
51
+				'class' => 'widefat',
52
+				'label' => __('Limit reviews to this category', 'site-reviews'),
53
+				'name' => 'category',
54
+				'options' => ['' => __('All Categories', 'site-reviews')] + $terms,
55
+			]);
56
+		}
57
+		$this->renderField('text', [
58
+			'class' => 'widefat',
59
+			'default' => '',
60
+			'description' => sprintf(__("Separate multiple ID's with a comma. You may also enter %s to automatically represent the current page/post ID.", 'site-reviews'), '<code>post_id</code>'),
61
+			'label' => __('Limit reviews to those assigned to this page/post ID', 'site-reviews'),
62
+			'name' => 'assigned_to',
63
+		]);
64
+		$this->renderField('text', [
65
+			'class' => 'widefat',
66
+			'label' => __('Enter any custom CSS classes here', 'site-reviews'),
67
+			'name' => 'class',
68
+		]);
69
+		$this->renderField('checkbox', [
70
+			'name' => 'hide',
71
+			'options' => glsr(SiteReviewsShortcode::class)->getHideOptions(),
72
+		]);
73
+	}
74 74
 
75
-    /**
76
-     * @param array $newInstance
77
-     * @param array $oldInstance
78
-     * @return array
79
-     */
80
-    public function update($newInstance, $oldInstance)
81
-    {
82
-        if (!is_numeric($newInstance['display'])) {
83
-            $newInstance['display'] = 10;
84
-        }
85
-        $newInstance['display'] = min(50, max(0, intval($newInstance['display'])));
86
-        return parent::update($newInstance, $oldInstance);
87
-    }
75
+	/**
76
+	 * @param array $newInstance
77
+	 * @param array $oldInstance
78
+	 * @return array
79
+	 */
80
+	public function update($newInstance, $oldInstance)
81
+	{
82
+		if (!is_numeric($newInstance['display'])) {
83
+			$newInstance['display'] = 10;
84
+		}
85
+		$newInstance['display'] = min(50, max(0, intval($newInstance['display'])));
86
+		return parent::update($newInstance, $oldInstance);
87
+	}
88 88
 
89
-    /**
90
-     * @param array $args
91
-     * @param array $instance
92
-     * @return void
93
-     */
94
-    public function widget($args, $instance)
95
-    {
96
-        echo glsr(SiteReviewsShortcode::class)->build($instance, $args, 'widget');
97
-    }
89
+	/**
90
+	 * @param array $args
91
+	 * @param array $instance
92
+	 * @return void
93
+	 */
94
+	public function widget($args, $instance)
95
+	{
96
+		echo glsr(SiteReviewsShortcode::class)->build($instance, $args, 'widget');
97
+	}
98 98
 }
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -11,65 +11,65 @@  discard block
 block discarded – undo
11 11
      * @param array $instance
12 12
      * @return void
13 13
      */
14
-    public function form($instance)
14
+    public function form( $instance )
15 15
     {
16
-        $this->widgetArgs = glsr(SiteReviewsShortcode::class)->normalizeAtts($instance);
17
-        $terms = glsr(Database::class)->getTerms();
18
-        $this->renderField('text', [
16
+        $this->widgetArgs = glsr( SiteReviewsShortcode::class )->normalizeAtts( $instance );
17
+        $terms = glsr( Database::class )->getTerms();
18
+        $this->renderField( 'text', [
19 19
             'class' => 'widefat',
20
-            'label' => __('Title', 'site-reviews'),
20
+            'label' => __( 'Title', 'site-reviews' ),
21 21
             'name' => 'title',
22
-        ]);
23
-        $this->renderField('number', [
22
+        ] );
23
+        $this->renderField( 'number', [
24 24
             'class' => 'small-text',
25 25
             'default' => 10,
26
-            'label' => __('How many reviews would you like to display?', 'site-reviews'),
26
+            'label' => __( 'How many reviews would you like to display?', 'site-reviews' ),
27 27
             'max' => 100,
28 28
             'name' => 'display',
29
-        ]);
30
-        $this->renderField('select', [
31
-            'label' => __('What is the minimum rating to display?', 'site-reviews'),
29
+        ] );
30
+        $this->renderField( 'select', [
31
+            'label' => __( 'What is the minimum rating to display?', 'site-reviews' ),
32 32
             'name' => 'rating',
33 33
             'options' => [
34
-                '5' => sprintf(_n('%s star', '%s stars', 5, 'site-reviews'), 5),
35
-                '4' => sprintf(_n('%s star', '%s stars', 4, 'site-reviews'), 4),
36
-                '3' => sprintf(_n('%s star', '%s stars', 3, 'site-reviews'), 3),
37
-                '2' => sprintf(_n('%s star', '%s stars', 2, 'site-reviews'), 2),
38
-                '1' => sprintf(_n('%s star', '%s stars', 1, 'site-reviews'), 1),
34
+                '5' => sprintf( _n( '%s star', '%s stars', 5, 'site-reviews' ), 5 ),
35
+                '4' => sprintf( _n( '%s star', '%s stars', 4, 'site-reviews' ), 4 ),
36
+                '3' => sprintf( _n( '%s star', '%s stars', 3, 'site-reviews' ), 3 ),
37
+                '2' => sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 ),
38
+                '1' => sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 ),
39 39
             ],
40
-        ]);
41
-        if (count(glsr()->reviewTypes) > 1) {
42
-            $this->renderField('select', [
40
+        ] );
41
+        if( count( glsr()->reviewTypes ) > 1 ) {
42
+            $this->renderField( 'select', [
43 43
                 'class' => 'widefat',
44
-                'label' => __('Which type of review would you like to display?', 'site-reviews'),
44
+                'label' => __( 'Which type of review would you like to display?', 'site-reviews' ),
45 45
                 'name' => 'type',
46
-                'options' => ['' => __('All Reviews', 'site-reviews')] + glsr()->reviewTypes,
47
-            ]);
46
+                'options' => ['' => __( 'All Reviews', 'site-reviews' )] + glsr()->reviewTypes,
47
+            ] );
48 48
         }
49
-        if (!empty($terms)) {
50
-            $this->renderField('select', [
49
+        if( !empty($terms) ) {
50
+            $this->renderField( 'select', [
51 51
                 'class' => 'widefat',
52
-                'label' => __('Limit reviews to this category', 'site-reviews'),
52
+                'label' => __( 'Limit reviews to this category', 'site-reviews' ),
53 53
                 'name' => 'category',
54
-                'options' => ['' => __('All Categories', 'site-reviews')] + $terms,
55
-            ]);
54
+                'options' => ['' => __( 'All Categories', 'site-reviews' )] + $terms,
55
+            ] );
56 56
         }
57
-        $this->renderField('text', [
57
+        $this->renderField( 'text', [
58 58
             'class' => 'widefat',
59 59
             'default' => '',
60
-            'description' => sprintf(__("Separate multiple ID's with a comma. You may also enter %s to automatically represent the current page/post ID.", 'site-reviews'), '<code>post_id</code>'),
61
-            'label' => __('Limit reviews to those assigned to this page/post ID', 'site-reviews'),
60
+            'description' => sprintf( __( "Separate multiple ID's with a comma. You may also enter %s to automatically represent the current page/post ID.", 'site-reviews' ), '<code>post_id</code>' ),
61
+            'label' => __( 'Limit reviews to those assigned to this page/post ID', 'site-reviews' ),
62 62
             'name' => 'assigned_to',
63
-        ]);
64
-        $this->renderField('text', [
63
+        ] );
64
+        $this->renderField( 'text', [
65 65
             'class' => 'widefat',
66
-            'label' => __('Enter any custom CSS classes here', 'site-reviews'),
66
+            'label' => __( 'Enter any custom CSS classes here', 'site-reviews' ),
67 67
             'name' => 'class',
68
-        ]);
69
-        $this->renderField('checkbox', [
68
+        ] );
69
+        $this->renderField( 'checkbox', [
70 70
             'name' => 'hide',
71
-            'options' => glsr(SiteReviewsShortcode::class)->getHideOptions(),
72
-        ]);
71
+            'options' => glsr( SiteReviewsShortcode::class )->getHideOptions(),
72
+        ] );
73 73
     }
74 74
 
75 75
     /**
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
      * @param array $oldInstance
78 78
      * @return array
79 79
      */
80
-    public function update($newInstance, $oldInstance)
80
+    public function update( $newInstance, $oldInstance )
81 81
     {
82
-        if (!is_numeric($newInstance['display'])) {
82
+        if( !is_numeric( $newInstance['display'] ) ) {
83 83
             $newInstance['display'] = 10;
84 84
         }
85
-        $newInstance['display'] = min(50, max(0, intval($newInstance['display'])));
86
-        return parent::update($newInstance, $oldInstance);
85
+        $newInstance['display'] = min( 50, max( 0, intval( $newInstance['display'] ) ) );
86
+        return parent::update( $newInstance, $oldInstance );
87 87
     }
88 88
 
89 89
     /**
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
      * @param array $instance
92 92
      * @return void
93 93
      */
94
-    public function widget($args, $instance)
94
+    public function widget( $args, $instance )
95 95
     {
96
-        echo glsr(SiteReviewsShortcode::class)->build($instance, $args, 'widget');
96
+        echo glsr( SiteReviewsShortcode::class )->build( $instance, $args, 'widget' );
97 97
     }
98 98
 }
Please login to merge, or discard this patch.
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/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/Controllers/EditorController/Labels.php 2 patches
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -7,106 +7,106 @@
 block discarded – undo
7 7
 
8 8
 class Labels
9 9
 {
10
-    /**
11
-     * @param string $translation
12
-     * @param string $test
13
-     * @return string
14
-     */
15
-    public function filterPostStatusLabels($translation, $text)
16
-    {
17
-        $replacements = $this->getStatusLabels();
18
-        return array_key_exists($text, $replacements)
19
-            ? $replacements[$text]
20
-            : $translation;
21
-    }
10
+	/**
11
+	 * @param string $translation
12
+	 * @param string $test
13
+	 * @return string
14
+	 */
15
+	public function filterPostStatusLabels($translation, $text)
16
+	{
17
+		$replacements = $this->getStatusLabels();
18
+		return array_key_exists($text, $replacements)
19
+			? $replacements[$text]
20
+			: $translation;
21
+	}
22 22
 
23
-    /**
24
-     * @return array
25
-     */
26
-    public function filterUpdateMessages(array $messages)
27
-    {
28
-        $post = get_post();
29
-        if (!($post instanceof WP_Post)) {
30
-            return;
31
-        }
32
-        $strings = $this->getReviewLabels();
33
-        $restored = filter_input(INPUT_GET, 'revision');
34
-        if ($revisionTitle = wp_post_revision_title(intval($restored), false)) {
35
-            $restored = sprintf($strings['restored'], $revisionTitle);
36
-        }
37
-        $scheduled_date = date_i18n('M j, Y @ H:i', strtotime($post->post_date));
38
-        $messages[Application::POST_TYPE] = [
39
-             1 => $strings['updated'],
40
-             4 => $strings['updated'],
41
-             5 => $restored,
42
-             6 => $strings['published'],
43
-             7 => $strings['saved'],
44
-             8 => $strings['submitted'],
45
-             9 => sprintf($strings['scheduled'], '<strong>'.$scheduled_date.'</strong>'),
46
-            10 => $strings['draft_updated'],
47
-            50 => $strings['approved'],
48
-            51 => $strings['unapproved'],
49
-            52 => $strings['reverted'],
50
-        ];
51
-        return $messages;
52
-    }
23
+	/**
24
+	 * @return array
25
+	 */
26
+	public function filterUpdateMessages(array $messages)
27
+	{
28
+		$post = get_post();
29
+		if (!($post instanceof WP_Post)) {
30
+			return;
31
+		}
32
+		$strings = $this->getReviewLabels();
33
+		$restored = filter_input(INPUT_GET, 'revision');
34
+		if ($revisionTitle = wp_post_revision_title(intval($restored), false)) {
35
+			$restored = sprintf($strings['restored'], $revisionTitle);
36
+		}
37
+		$scheduled_date = date_i18n('M j, Y @ H:i', strtotime($post->post_date));
38
+		$messages[Application::POST_TYPE] = [
39
+			 1 => $strings['updated'],
40
+			 4 => $strings['updated'],
41
+			 5 => $restored,
42
+			 6 => $strings['published'],
43
+			 7 => $strings['saved'],
44
+			 8 => $strings['submitted'],
45
+			 9 => sprintf($strings['scheduled'], '<strong>'.$scheduled_date.'</strong>'),
46
+			10 => $strings['draft_updated'],
47
+			50 => $strings['approved'],
48
+			51 => $strings['unapproved'],
49
+			52 => $strings['reverted'],
50
+		];
51
+		return $messages;
52
+	}
53 53
 
54
-    /**
55
-     * @return void
56
-     */
57
-    public function translatePostStatusLabels()
58
-    {
59
-        global $wp_scripts;
60
-        $strings = [
61
-            'savePending' => __('Save as Unapproved', 'site-reviews'),
62
-            'published' => __('Approved', 'site-reviews'),
63
-        ];
64
-        if (isset($wp_scripts->registered['post']->extra['data'])) {
65
-            $l10n = &$wp_scripts->registered['post']->extra['data'];
66
-            foreach ($strings as $search => $replace) {
67
-                $l10n = preg_replace('/("'.$search.'":")([^"]+)/', '$1'.$replace, $l10n);
68
-            }
69
-        }
70
-    }
54
+	/**
55
+	 * @return void
56
+	 */
57
+	public function translatePostStatusLabels()
58
+	{
59
+		global $wp_scripts;
60
+		$strings = [
61
+			'savePending' => __('Save as Unapproved', 'site-reviews'),
62
+			'published' => __('Approved', 'site-reviews'),
63
+		];
64
+		if (isset($wp_scripts->registered['post']->extra['data'])) {
65
+			$l10n = &$wp_scripts->registered['post']->extra['data'];
66
+			foreach ($strings as $search => $replace) {
67
+				$l10n = preg_replace('/("'.$search.'":")([^"]+)/', '$1'.$replace, $l10n);
68
+			}
69
+		}
70
+	}
71 71
 
72
-    /**
73
-     * @return array
74
-     */
75
-    protected function getReviewLabels()
76
-    {
77
-        return [
78
-            'approved' => __('Review has been approved and published.', 'site-reviews'),
79
-            'draft_updated' => __('Review draft updated.', 'site-reviews'),
80
-            'preview' => __('Preview review', 'site-reviews'),
81
-            'published' => __('Review approved and published.', 'site-reviews'),
82
-            'restored' => __('Review restored to revision from %s.', 'site-reviews'),
83
-            'reverted' => __('Review has been reverted to its original submission state (title, content, and submission date).', 'site-reviews'),
84
-            'saved' => __('Review saved.', 'site-reviews'),
85
-            'scheduled' => __('Review scheduled for: %s.', 'site-reviews'),
86
-            'submitted' => __('Review submitted.', 'site-reviews'),
87
-            'unapproved' => __('Review has been unapproved and is now pending.', 'site-reviews'),
88
-            'updated' => __('Review updated.', 'site-reviews'),
89
-            'view' => __('View review', 'site-reviews'),
90
-        ];
91
-    }
72
+	/**
73
+	 * @return array
74
+	 */
75
+	protected function getReviewLabels()
76
+	{
77
+		return [
78
+			'approved' => __('Review has been approved and published.', 'site-reviews'),
79
+			'draft_updated' => __('Review draft updated.', 'site-reviews'),
80
+			'preview' => __('Preview review', 'site-reviews'),
81
+			'published' => __('Review approved and published.', 'site-reviews'),
82
+			'restored' => __('Review restored to revision from %s.', 'site-reviews'),
83
+			'reverted' => __('Review has been reverted to its original submission state (title, content, and submission date).', 'site-reviews'),
84
+			'saved' => __('Review saved.', 'site-reviews'),
85
+			'scheduled' => __('Review scheduled for: %s.', 'site-reviews'),
86
+			'submitted' => __('Review submitted.', 'site-reviews'),
87
+			'unapproved' => __('Review has been unapproved and is now pending.', 'site-reviews'),
88
+			'updated' => __('Review updated.', 'site-reviews'),
89
+			'view' => __('View review', 'site-reviews'),
90
+		];
91
+	}
92 92
 
93
-    /**
94
-     * Store the labels to avoid unnecessary loops.
95
-     * @return array
96
-     */
97
-    protected function getStatusLabels()
98
-    {
99
-        static $labels;
100
-        if (empty($labels)) {
101
-            $labels = [
102
-                'Pending' => __('Unapproved', 'site-reviews'),
103
-                'Pending Review' => __('Unapproved', 'site-reviews'),
104
-                'Privately Published' => __('Privately Approved', 'site-reviews'),
105
-                'Publish' => __('Approve', 'site-reviews'),
106
-                'Published' => __('Approved', 'site-reviews'),
107
-                'Save as Pending' => __('Save as Unapproved', 'site-reviews'),
108
-            ];
109
-        }
110
-        return $labels;
111
-    }
93
+	/**
94
+	 * Store the labels to avoid unnecessary loops.
95
+	 * @return array
96
+	 */
97
+	protected function getStatusLabels()
98
+	{
99
+		static $labels;
100
+		if (empty($labels)) {
101
+			$labels = [
102
+				'Pending' => __('Unapproved', 'site-reviews'),
103
+				'Pending Review' => __('Unapproved', 'site-reviews'),
104
+				'Privately Published' => __('Privately Approved', 'site-reviews'),
105
+				'Publish' => __('Approve', 'site-reviews'),
106
+				'Published' => __('Approved', 'site-reviews'),
107
+				'Save as Pending' => __('Save as Unapproved', 'site-reviews'),
108
+			];
109
+		}
110
+		return $labels;
111
+	}
112 112
 }
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
      * @param string $test
13 13
      * @return string
14 14
      */
15
-    public function filterPostStatusLabels($translation, $text)
15
+    public function filterPostStatusLabels( $translation, $text )
16 16
     {
17 17
         $replacements = $this->getStatusLabels();
18
-        return array_key_exists($text, $replacements)
18
+        return array_key_exists( $text, $replacements )
19 19
             ? $replacements[$text]
20 20
             : $translation;
21 21
     }
@@ -23,18 +23,18 @@  discard block
 block discarded – undo
23 23
     /**
24 24
      * @return array
25 25
      */
26
-    public function filterUpdateMessages(array $messages)
26
+    public function filterUpdateMessages( array $messages )
27 27
     {
28 28
         $post = get_post();
29
-        if (!($post instanceof WP_Post)) {
29
+        if( !($post instanceof WP_Post) ) {
30 30
             return;
31 31
         }
32 32
         $strings = $this->getReviewLabels();
33
-        $restored = filter_input(INPUT_GET, 'revision');
34
-        if ($revisionTitle = wp_post_revision_title(intval($restored), false)) {
35
-            $restored = sprintf($strings['restored'], $revisionTitle);
33
+        $restored = filter_input( INPUT_GET, 'revision' );
34
+        if( $revisionTitle = wp_post_revision_title( intval( $restored ), false ) ) {
35
+            $restored = sprintf( $strings['restored'], $revisionTitle );
36 36
         }
37
-        $scheduled_date = date_i18n('M j, Y @ H:i', strtotime($post->post_date));
37
+        $scheduled_date = date_i18n( 'M j, Y @ H:i', strtotime( $post->post_date ) );
38 38
         $messages[Application::POST_TYPE] = [
39 39
              1 => $strings['updated'],
40 40
              4 => $strings['updated'],
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
              6 => $strings['published'],
43 43
              7 => $strings['saved'],
44 44
              8 => $strings['submitted'],
45
-             9 => sprintf($strings['scheduled'], '<strong>'.$scheduled_date.'</strong>'),
45
+             9 => sprintf( $strings['scheduled'], '<strong>'.$scheduled_date.'</strong>' ),
46 46
             10 => $strings['draft_updated'],
47 47
             50 => $strings['approved'],
48 48
             51 => $strings['unapproved'],
@@ -58,13 +58,13 @@  discard block
 block discarded – undo
58 58
     {
59 59
         global $wp_scripts;
60 60
         $strings = [
61
-            'savePending' => __('Save as Unapproved', 'site-reviews'),
62
-            'published' => __('Approved', 'site-reviews'),
61
+            'savePending' => __( 'Save as Unapproved', 'site-reviews' ),
62
+            'published' => __( 'Approved', 'site-reviews' ),
63 63
         ];
64
-        if (isset($wp_scripts->registered['post']->extra['data'])) {
64
+        if( isset($wp_scripts->registered['post']->extra['data']) ) {
65 65
             $l10n = &$wp_scripts->registered['post']->extra['data'];
66
-            foreach ($strings as $search => $replace) {
67
-                $l10n = preg_replace('/("'.$search.'":")([^"]+)/', '$1'.$replace, $l10n);
66
+            foreach( $strings as $search => $replace ) {
67
+                $l10n = preg_replace( '/("'.$search.'":")([^"]+)/', '$1'.$replace, $l10n );
68 68
             }
69 69
         }
70 70
     }
@@ -75,18 +75,18 @@  discard block
 block discarded – undo
75 75
     protected function getReviewLabels()
76 76
     {
77 77
         return [
78
-            'approved' => __('Review has been approved and published.', 'site-reviews'),
79
-            'draft_updated' => __('Review draft updated.', 'site-reviews'),
80
-            'preview' => __('Preview review', 'site-reviews'),
81
-            'published' => __('Review approved and published.', 'site-reviews'),
82
-            'restored' => __('Review restored to revision from %s.', 'site-reviews'),
83
-            'reverted' => __('Review has been reverted to its original submission state (title, content, and submission date).', 'site-reviews'),
84
-            'saved' => __('Review saved.', 'site-reviews'),
85
-            'scheduled' => __('Review scheduled for: %s.', 'site-reviews'),
86
-            'submitted' => __('Review submitted.', 'site-reviews'),
87
-            'unapproved' => __('Review has been unapproved and is now pending.', 'site-reviews'),
88
-            'updated' => __('Review updated.', 'site-reviews'),
89
-            'view' => __('View review', 'site-reviews'),
78
+            'approved' => __( 'Review has been approved and published.', 'site-reviews' ),
79
+            'draft_updated' => __( 'Review draft updated.', 'site-reviews' ),
80
+            'preview' => __( 'Preview review', 'site-reviews' ),
81
+            'published' => __( 'Review approved and published.', 'site-reviews' ),
82
+            'restored' => __( 'Review restored to revision from %s.', 'site-reviews' ),
83
+            'reverted' => __( 'Review has been reverted to its original submission state (title, content, and submission date).', 'site-reviews' ),
84
+            'saved' => __( 'Review saved.', 'site-reviews' ),
85
+            'scheduled' => __( 'Review scheduled for: %s.', 'site-reviews' ),
86
+            'submitted' => __( 'Review submitted.', 'site-reviews' ),
87
+            'unapproved' => __( 'Review has been unapproved and is now pending.', 'site-reviews' ),
88
+            'updated' => __( 'Review updated.', 'site-reviews' ),
89
+            'view' => __( 'View review', 'site-reviews' ),
90 90
         ];
91 91
     }
92 92
 
@@ -97,14 +97,14 @@  discard block
 block discarded – undo
97 97
     protected function getStatusLabels()
98 98
     {
99 99
         static $labels;
100
-        if (empty($labels)) {
100
+        if( empty($labels) ) {
101 101
             $labels = [
102
-                'Pending' => __('Unapproved', 'site-reviews'),
103
-                'Pending Review' => __('Unapproved', 'site-reviews'),
104
-                'Privately Published' => __('Privately Approved', 'site-reviews'),
105
-                'Publish' => __('Approve', 'site-reviews'),
106
-                'Published' => __('Approved', 'site-reviews'),
107
-                'Save as Pending' => __('Save as Unapproved', 'site-reviews'),
102
+                'Pending' => __( 'Unapproved', 'site-reviews' ),
103
+                'Pending Review' => __( 'Unapproved', 'site-reviews' ),
104
+                'Privately Published' => __( 'Privately Approved', 'site-reviews' ),
105
+                'Publish' => __( 'Approve', 'site-reviews' ),
106
+                'Published' => __( 'Approved', 'site-reviews' ),
107
+                'Save as Pending' => __( 'Save as Unapproved', 'site-reviews' ),
108 108
             ];
109 109
         }
110 110
         return $labels;
Please login to merge, or discard this patch.
plugin/Controllers/EditorController.php 2 patches
Indentation   +373 added lines, -373 removed lines patch added patch discarded remove patch
@@ -20,401 +20,401 @@
 block discarded – undo
20 20
 
21 21
 class EditorController extends Controller
22 22
 {
23
-    /**
24
-     * @param array $settings
25
-     * @return array
26
-     * @filter wp_editor_settings
27
-     */
28
-    public function filterEditorSettings($settings)
29
-    {
30
-        return glsr(Customization::class)->filterEditorSettings(
31
-            Arr::consolidateArray($settings)
32
-        );
33
-    }
23
+	/**
24
+	 * @param array $settings
25
+	 * @return array
26
+	 * @filter wp_editor_settings
27
+	 */
28
+	public function filterEditorSettings($settings)
29
+	{
30
+		return glsr(Customization::class)->filterEditorSettings(
31
+			Arr::consolidateArray($settings)
32
+		);
33
+	}
34 34
 
35
-    /**
36
-     * Modify the WP_Editor html to allow autosizing without breaking the `editor-expand` script.
37
-     * @param string $html
38
-     * @return string
39
-     * @filter the_editor
40
-     */
41
-    public function filterEditorTextarea($html)
42
-    {
43
-        return glsr(Customization::class)->filterEditorTextarea($html);
44
-    }
35
+	/**
36
+	 * Modify the WP_Editor html to allow autosizing without breaking the `editor-expand` script.
37
+	 * @param string $html
38
+	 * @return string
39
+	 * @filter the_editor
40
+	 */
41
+	public function filterEditorTextarea($html)
42
+	{
43
+		return glsr(Customization::class)->filterEditorTextarea($html);
44
+	}
45 45
 
46
-    /**
47
-     * @param bool $protected
48
-     * @param string $metaKey
49
-     * @param string $metaType
50
-     * @return bool
51
-     * @filter is_protected_meta
52
-     */
53
-    public function filterIsProtectedMeta($protected, $metaKey, $metaType)
54
-    {
55
-        if ('post' == $metaType && Application::POST_TYPE == get_post_type()) {
56
-            $values = glsr(CreateReviewDefaults::class)->unguarded();
57
-            $values = Arr::prefixArrayKeys($values);
58
-            if (array_key_exists($metaKey, $values)) {
59
-                $protected = false;
60
-            }
61
-        }
62
-        return $protected;
63
-    }
46
+	/**
47
+	 * @param bool $protected
48
+	 * @param string $metaKey
49
+	 * @param string $metaType
50
+	 * @return bool
51
+	 * @filter is_protected_meta
52
+	 */
53
+	public function filterIsProtectedMeta($protected, $metaKey, $metaType)
54
+	{
55
+		if ('post' == $metaType && Application::POST_TYPE == get_post_type()) {
56
+			$values = glsr(CreateReviewDefaults::class)->unguarded();
57
+			$values = Arr::prefixArrayKeys($values);
58
+			if (array_key_exists($metaKey, $values)) {
59
+				$protected = false;
60
+			}
61
+		}
62
+		return $protected;
63
+	}
64 64
 
65
-    /**
66
-     * @param array $messages
67
-     * @return array
68
-     * @filter post_updated_messages
69
-     */
70
-    public function filterUpdateMessages($messages)
71
-    {
72
-        return glsr(Labels::class)->filterUpdateMessages(
73
-            Arr::consolidateArray($messages)
74
-        );
75
-    }
65
+	/**
66
+	 * @param array $messages
67
+	 * @return array
68
+	 * @filter post_updated_messages
69
+	 */
70
+	public function filterUpdateMessages($messages)
71
+	{
72
+		return glsr(Labels::class)->filterUpdateMessages(
73
+			Arr::consolidateArray($messages)
74
+		);
75
+	}
76 76
 
77
-    /**
78
-     * @return void
79
-     * @action add_meta_boxes_{Application::POST_TYPE}
80
-     */
81
-    public function registerMetaBoxes($post)
82
-    {
83
-        add_meta_box(Application::ID.'_assigned_to', __('Assigned To', 'site-reviews'), [$this, 'renderAssignedToMetabox'], null, 'side');
84
-        add_meta_box(Application::ID.'_review', __('Details', 'site-reviews'), [$this, 'renderDetailsMetaBox'], null, 'side');
85
-        if ('local' != glsr(Database::class)->get($post->ID, 'review_type')) {
86
-            return;
87
-        }
88
-        add_meta_box(Application::ID.'_response', __('Respond Publicly', 'site-reviews'), [$this, 'renderResponseMetaBox'], null, 'normal');
89
-    }
77
+	/**
78
+	 * @return void
79
+	 * @action add_meta_boxes_{Application::POST_TYPE}
80
+	 */
81
+	public function registerMetaBoxes($post)
82
+	{
83
+		add_meta_box(Application::ID.'_assigned_to', __('Assigned To', 'site-reviews'), [$this, 'renderAssignedToMetabox'], null, 'side');
84
+		add_meta_box(Application::ID.'_review', __('Details', 'site-reviews'), [$this, 'renderDetailsMetaBox'], null, 'side');
85
+		if ('local' != glsr(Database::class)->get($post->ID, 'review_type')) {
86
+			return;
87
+		}
88
+		add_meta_box(Application::ID.'_response', __('Respond Publicly', 'site-reviews'), [$this, 'renderResponseMetaBox'], null, 'normal');
89
+	}
90 90
 
91
-    /**
92
-     * @return void
93
-     * @action admin_print_scripts
94
-     */
95
-    public function removeAutosave()
96
-    {
97
-        glsr(Customization::class)->removeAutosave();
98
-    }
91
+	/**
92
+	 * @return void
93
+	 * @action admin_print_scripts
94
+	 */
95
+	public function removeAutosave()
96
+	{
97
+		glsr(Customization::class)->removeAutosave();
98
+	}
99 99
 
100
-    /**
101
-     * @return void
102
-     * @action admin_menu
103
-     */
104
-    public function removeMetaBoxes()
105
-    {
106
-        glsr(Customization::class)->removeMetaBoxes();
107
-    }
100
+	/**
101
+	 * @return void
102
+	 * @action admin_menu
103
+	 */
104
+	public function removeMetaBoxes()
105
+	{
106
+		glsr(Customization::class)->removeMetaBoxes();
107
+	}
108 108
 
109
-    /**
110
-     * @return void
111
-     */
112
-    public function removePostTypeSupport()
113
-    {
114
-        glsr(Customization::class)->removePostTypeSupport();
115
-    }
109
+	/**
110
+	 * @return void
111
+	 */
112
+	public function removePostTypeSupport()
113
+	{
114
+		glsr(Customization::class)->removePostTypeSupport();
115
+	}
116 116
 
117
-    /**
118
-     * @param WP_Post $post
119
-     * @return void
120
-     * @callback add_meta_box
121
-     */
122
-    public function renderAssignedToMetabox($post)
123
-    {
124
-        if (!$this->isReviewPostType($post)) {
125
-            return;
126
-        }
127
-        $assignedTo = (string) glsr(Database::class)->get($post->ID, 'assigned_to');
128
-        wp_nonce_field('assigned_to', '_nonce-assigned-to', false);
129
-        glsr()->render('partials/editor/metabox-assigned-to', [
130
-            'id' => $assignedTo,
131
-            'template' => $this->buildAssignedToTemplate($assignedTo, $post),
132
-        ]);
133
-    }
117
+	/**
118
+	 * @param WP_Post $post
119
+	 * @return void
120
+	 * @callback add_meta_box
121
+	 */
122
+	public function renderAssignedToMetabox($post)
123
+	{
124
+		if (!$this->isReviewPostType($post)) {
125
+			return;
126
+		}
127
+		$assignedTo = (string) glsr(Database::class)->get($post->ID, 'assigned_to');
128
+		wp_nonce_field('assigned_to', '_nonce-assigned-to', false);
129
+		glsr()->render('partials/editor/metabox-assigned-to', [
130
+			'id' => $assignedTo,
131
+			'template' => $this->buildAssignedToTemplate($assignedTo, $post),
132
+		]);
133
+	}
134 134
 
135
-    /**
136
-     * @param WP_Post $post
137
-     * @return void
138
-     * @callback add_meta_box
139
-     */
140
-    public function renderDetailsMetaBox($post)
141
-    {
142
-        if (!$this->isReviewPostType($post)) {
143
-            return;
144
-        }
145
-        $review = glsr_get_review($post);
146
-        glsr()->render('partials/editor/metabox-details', [
147
-            'button' => $this->buildDetailsMetaBoxRevertButton($review, $post),
148
-            'metabox' => $this->normalizeDetailsMetaBox($review),
149
-        ]);
150
-    }
135
+	/**
136
+	 * @param WP_Post $post
137
+	 * @return void
138
+	 * @callback add_meta_box
139
+	 */
140
+	public function renderDetailsMetaBox($post)
141
+	{
142
+		if (!$this->isReviewPostType($post)) {
143
+			return;
144
+		}
145
+		$review = glsr_get_review($post);
146
+		glsr()->render('partials/editor/metabox-details', [
147
+			'button' => $this->buildDetailsMetaBoxRevertButton($review, $post),
148
+			'metabox' => $this->normalizeDetailsMetaBox($review),
149
+		]);
150
+	}
151 151
 
152
-    /**
153
-     * @return void
154
-     * @action post_submitbox_misc_actions
155
-     */
156
-    public function renderPinnedInPublishMetaBox()
157
-    {
158
-        if (!$this->isReviewPostType(get_post())) {
159
-            return;
160
-        }
161
-        glsr(Template::class)->render('partials/editor/pinned', [
162
-            'context' => [
163
-                'no' => __('No', 'site-reviews'),
164
-                'yes' => __('Yes', 'site-reviews'),
165
-            ],
166
-            'pinned' => wp_validate_boolean(glsr(Database::class)->get(get_the_ID(), 'pinned')),
167
-        ]);
168
-    }
152
+	/**
153
+	 * @return void
154
+	 * @action post_submitbox_misc_actions
155
+	 */
156
+	public function renderPinnedInPublishMetaBox()
157
+	{
158
+		if (!$this->isReviewPostType(get_post())) {
159
+			return;
160
+		}
161
+		glsr(Template::class)->render('partials/editor/pinned', [
162
+			'context' => [
163
+				'no' => __('No', 'site-reviews'),
164
+				'yes' => __('Yes', 'site-reviews'),
165
+			],
166
+			'pinned' => wp_validate_boolean(glsr(Database::class)->get(get_the_ID(), 'pinned')),
167
+		]);
168
+	}
169 169
 
170
-    /**
171
-     * @param WP_Post $post
172
-     * @return void
173
-     * @callback add_meta_box
174
-     */
175
-    public function renderResponseMetaBox($post)
176
-    {
177
-        if (!$this->isReviewPostType($post)) {
178
-            return;
179
-        }
180
-        wp_nonce_field('response', '_nonce-response', false);
181
-        glsr()->render('partials/editor/metabox-response', [
182
-            'response' => glsr(Database::class)->get($post->ID, 'response'),
183
-        ]);
184
-    }
170
+	/**
171
+	 * @param WP_Post $post
172
+	 * @return void
173
+	 * @callback add_meta_box
174
+	 */
175
+	public function renderResponseMetaBox($post)
176
+	{
177
+		if (!$this->isReviewPostType($post)) {
178
+			return;
179
+		}
180
+		wp_nonce_field('response', '_nonce-response', false);
181
+		glsr()->render('partials/editor/metabox-response', [
182
+			'response' => glsr(Database::class)->get($post->ID, 'response'),
183
+		]);
184
+	}
185 185
 
186
-    /**
187
-     * @param WP_Post $post
188
-     * @return void
189
-     * @action edit_form_after_title
190
-     */
191
-    public function renderReviewEditor($post)
192
-    {
193
-        if (!$this->isReviewPostType($post) || $this->isReviewEditable($post)) {
194
-            return;
195
-        }
196
-        glsr()->render('partials/editor/review', [
197
-            'post' => $post,
198
-            'response' => glsr(Database::class)->get($post->ID, 'response'),
199
-        ]);
200
-    }
186
+	/**
187
+	 * @param WP_Post $post
188
+	 * @return void
189
+	 * @action edit_form_after_title
190
+	 */
191
+	public function renderReviewEditor($post)
192
+	{
193
+		if (!$this->isReviewPostType($post) || $this->isReviewEditable($post)) {
194
+			return;
195
+		}
196
+		glsr()->render('partials/editor/review', [
197
+			'post' => $post,
198
+			'response' => glsr(Database::class)->get($post->ID, 'response'),
199
+		]);
200
+	}
201 201
 
202
-    /**
203
-     * @return void
204
-     * @action admin_head
205
-     */
206
-    public function renderReviewFields()
207
-    {
208
-        $screen = glsr_current_screen();
209
-        if ('post' != $screen->base || Application::POST_TYPE != $screen->post_type) {
210
-            return;
211
-        }
212
-        add_action('edit_form_after_title', [$this, 'renderReviewEditor']);
213
-        add_action('edit_form_top', [$this, 'renderReviewNotice']);
214
-    }
202
+	/**
203
+	 * @return void
204
+	 * @action admin_head
205
+	 */
206
+	public function renderReviewFields()
207
+	{
208
+		$screen = glsr_current_screen();
209
+		if ('post' != $screen->base || Application::POST_TYPE != $screen->post_type) {
210
+			return;
211
+		}
212
+		add_action('edit_form_after_title', [$this, 'renderReviewEditor']);
213
+		add_action('edit_form_top', [$this, 'renderReviewNotice']);
214
+	}
215 215
 
216
-    /**
217
-     * @param WP_Post $post
218
-     * @return void
219
-     * @action edit_form_top
220
-     */
221
-    public function renderReviewNotice($post)
222
-    {
223
-        if (!$this->isReviewPostType($post) || $this->isReviewEditable($post)) {
224
-            return;
225
-        }
226
-        glsr(Notice::class)->addWarning(sprintf(
227
-            __('%s reviews are read-only.', 'site-reviews'),
228
-            glsr(Columns::class)->buildColumnReviewType($post->ID)
229
-        ));
230
-        glsr(Template::class)->render('partials/editor/notice', [
231
-            'context' => [
232
-                'notices' => glsr(Notice::class)->get(),
233
-            ],
234
-        ]);
235
-    }
216
+	/**
217
+	 * @param WP_Post $post
218
+	 * @return void
219
+	 * @action edit_form_top
220
+	 */
221
+	public function renderReviewNotice($post)
222
+	{
223
+		if (!$this->isReviewPostType($post) || $this->isReviewEditable($post)) {
224
+			return;
225
+		}
226
+		glsr(Notice::class)->addWarning(sprintf(
227
+			__('%s reviews are read-only.', 'site-reviews'),
228
+			glsr(Columns::class)->buildColumnReviewType($post->ID)
229
+		));
230
+		glsr(Template::class)->render('partials/editor/notice', [
231
+			'context' => [
232
+				'notices' => glsr(Notice::class)->get(),
233
+			],
234
+		]);
235
+	}
236 236
 
237
-    /**
238
-     * @param WP_Post $post
239
-     * @return void
240
-     * @see glsr_categories_meta_box()
241
-     * @callback register_taxonomy
242
-     */
243
-    public function renderTaxonomyMetabox($post)
244
-    {
245
-        if (!$this->isReviewPostType($post)) {
246
-            return;
247
-        }
248
-        glsr()->render('partials/editor/metabox-categories', [
249
-            'post' => $post,
250
-            'tax_name' => Application::TAXONOMY,
251
-            'taxonomy' => get_taxonomy(Application::TAXONOMY),
252
-        ]);
253
-    }
237
+	/**
238
+	 * @param WP_Post $post
239
+	 * @return void
240
+	 * @see glsr_categories_meta_box()
241
+	 * @callback register_taxonomy
242
+	 */
243
+	public function renderTaxonomyMetabox($post)
244
+	{
245
+		if (!$this->isReviewPostType($post)) {
246
+			return;
247
+		}
248
+		glsr()->render('partials/editor/metabox-categories', [
249
+			'post' => $post,
250
+			'tax_name' => Application::TAXONOMY,
251
+			'taxonomy' => get_taxonomy(Application::TAXONOMY),
252
+		]);
253
+	}
254 254
 
255
-    /**
256
-     * @return void
257
-     * @see $this->filterUpdateMessages()
258
-     * @action admin_action_revert
259
-     */
260
-    public function revertReview()
261
-    {
262
-        if (Application::ID != filter_input(INPUT_GET, 'plugin')) {
263
-            return;
264
-        }
265
-        check_admin_referer('revert-review_'.($postId = $this->getPostId()));
266
-        glsr(ReviewManager::class)->revert($postId);
267
-        $this->redirect($postId, 52);
268
-    }
255
+	/**
256
+	 * @return void
257
+	 * @see $this->filterUpdateMessages()
258
+	 * @action admin_action_revert
259
+	 */
260
+	public function revertReview()
261
+	{
262
+		if (Application::ID != filter_input(INPUT_GET, 'plugin')) {
263
+			return;
264
+		}
265
+		check_admin_referer('revert-review_'.($postId = $this->getPostId()));
266
+		glsr(ReviewManager::class)->revert($postId);
267
+		$this->redirect($postId, 52);
268
+	}
269 269
 
270
-    /**
271
-     * @param int $postId
272
-     * @param \WP_Post $post
273
-     * @param bool $isUpdate
274
-     * @return void
275
-     * @action save_post_.Application::POST_TYPE
276
-     */
277
-    public function saveMetaboxes($postId, $post, $isUpdating)
278
-    {
279
-        glsr(Metaboxes::class)->saveAssignedToMetabox($postId);
280
-        glsr(Metaboxes::class)->saveResponseMetabox($postId);
281
-        if ($isUpdating) {
282
-            do_action('site-reviews/review/saved', glsr_get_review($postId));
283
-        }
284
-    }
270
+	/**
271
+	 * @param int $postId
272
+	 * @param \WP_Post $post
273
+	 * @param bool $isUpdate
274
+	 * @return void
275
+	 * @action save_post_.Application::POST_TYPE
276
+	 */
277
+	public function saveMetaboxes($postId, $post, $isUpdating)
278
+	{
279
+		glsr(Metaboxes::class)->saveAssignedToMetabox($postId);
280
+		glsr(Metaboxes::class)->saveResponseMetabox($postId);
281
+		if ($isUpdating) {
282
+			do_action('site-reviews/review/saved', glsr_get_review($postId));
283
+		}
284
+	}
285 285
 
286
-    /**
287
-     * @param string $assignedTo
288
-     * @return string
289
-     */
290
-    protected function buildAssignedToTemplate($assignedTo, WP_Post $post)
291
-    {
292
-        $assignedPost = glsr(Database::class)->getAssignedToPost($post->ID, $assignedTo);
293
-        if (!($assignedPost instanceof WP_Post)) {
294
-            return;
295
-        }
296
-        return glsr(Template::class)->build('partials/editor/assigned-post', [
297
-            'context' => [
298
-                'data.url' => (string) get_permalink($assignedPost),
299
-                'data.title' => get_the_title($assignedPost),
300
-            ],
301
-        ]);
302
-    }
286
+	/**
287
+	 * @param string $assignedTo
288
+	 * @return string
289
+	 */
290
+	protected function buildAssignedToTemplate($assignedTo, WP_Post $post)
291
+	{
292
+		$assignedPost = glsr(Database::class)->getAssignedToPost($post->ID, $assignedTo);
293
+		if (!($assignedPost instanceof WP_Post)) {
294
+			return;
295
+		}
296
+		return glsr(Template::class)->build('partials/editor/assigned-post', [
297
+			'context' => [
298
+				'data.url' => (string) get_permalink($assignedPost),
299
+				'data.title' => get_the_title($assignedPost),
300
+			],
301
+		]);
302
+	}
303 303
 
304
-    /**
305
-     * @return string
306
-     */
307
-    protected function buildDetailsMetaBoxRevertButton(Review $review, WP_Post $post)
308
-    {
309
-        $isModified = !Arr::compareArrays(
310
-            [$review->title, $review->content, $review->date],
311
-            [
312
-                glsr(Database::class)->get($post->ID, 'title'),
313
-                glsr(Database::class)->get($post->ID, 'content'),
314
-                glsr(Database::class)->get($post->ID, 'date'),
315
-            ]
316
-        );
317
-        if ($isModified) {
318
-            $revertUrl = wp_nonce_url(
319
-                admin_url('post.php?post='.$post->ID.'&action=revert&plugin='.Application::ID),
320
-                'revert-review_'.$post->ID
321
-            );
322
-            return glsr(Builder::class)->a(__('Revert Changes', 'site-reviews'), [
323
-                'class' => 'button button-large',
324
-                'href' => $revertUrl,
325
-                'id' => 'revert',
326
-            ]);
327
-        }
328
-        return glsr(Builder::class)->button(__('Nothing to Revert', 'site-reviews'), [
329
-            'class' => 'button-large',
330
-            'disabled' => true,
331
-            'id' => 'revert',
332
-        ]);
333
-    }
304
+	/**
305
+	 * @return string
306
+	 */
307
+	protected function buildDetailsMetaBoxRevertButton(Review $review, WP_Post $post)
308
+	{
309
+		$isModified = !Arr::compareArrays(
310
+			[$review->title, $review->content, $review->date],
311
+			[
312
+				glsr(Database::class)->get($post->ID, 'title'),
313
+				glsr(Database::class)->get($post->ID, 'content'),
314
+				glsr(Database::class)->get($post->ID, 'date'),
315
+			]
316
+		);
317
+		if ($isModified) {
318
+			$revertUrl = wp_nonce_url(
319
+				admin_url('post.php?post='.$post->ID.'&action=revert&plugin='.Application::ID),
320
+				'revert-review_'.$post->ID
321
+			);
322
+			return glsr(Builder::class)->a(__('Revert Changes', 'site-reviews'), [
323
+				'class' => 'button button-large',
324
+				'href' => $revertUrl,
325
+				'id' => 'revert',
326
+			]);
327
+		}
328
+		return glsr(Builder::class)->button(__('Nothing to Revert', 'site-reviews'), [
329
+			'class' => 'button-large',
330
+			'disabled' => true,
331
+			'id' => 'revert',
332
+		]);
333
+	}
334 334
 
335
-    /**
336
-     * @param object $review
337
-     * @return string|void
338
-     */
339
-    protected function getReviewType($review)
340
-    {
341
-        if (count(glsr()->reviewTypes) < 2) {
342
-            return;
343
-        }
344
-        $reviewType = array_key_exists($review->review_type, glsr()->reviewTypes)
345
-            ? glsr()->reviewTypes[$review->review_type]
346
-            : __('Unknown', 'site-reviews');
347
-        if (!empty($review->url)) {
348
-            $reviewType = glsr(Builder::class)->a($reviewType, [
349
-                'href' => $review->url,
350
-                'target' => '_blank',
351
-            ]);
352
-        }
353
-        return $reviewType;
354
-    }
335
+	/**
336
+	 * @param object $review
337
+	 * @return string|void
338
+	 */
339
+	protected function getReviewType($review)
340
+	{
341
+		if (count(glsr()->reviewTypes) < 2) {
342
+			return;
343
+		}
344
+		$reviewType = array_key_exists($review->review_type, glsr()->reviewTypes)
345
+			? glsr()->reviewTypes[$review->review_type]
346
+			: __('Unknown', 'site-reviews');
347
+		if (!empty($review->url)) {
348
+			$reviewType = glsr(Builder::class)->a($reviewType, [
349
+				'href' => $review->url,
350
+				'target' => '_blank',
351
+			]);
352
+		}
353
+		return $reviewType;
354
+	}
355 355
 
356
-    /**
357
-     * @return bool
358
-     */
359
-    protected function isReviewEditable($post)
360
-    {
361
-        return $this->isReviewPostType($post)
362
-            && post_type_supports(Application::POST_TYPE, 'title')
363
-            && 'local' == glsr(Database::class)->get($post->ID, 'review_type');
364
-    }
356
+	/**
357
+	 * @return bool
358
+	 */
359
+	protected function isReviewEditable($post)
360
+	{
361
+		return $this->isReviewPostType($post)
362
+			&& post_type_supports(Application::POST_TYPE, 'title')
363
+			&& 'local' == glsr(Database::class)->get($post->ID, 'review_type');
364
+	}
365 365
 
366
-    /**
367
-     * @param mixed $post
368
-     * @return bool
369
-     */
370
-    protected function isReviewPostType($post)
371
-    {
372
-        return $post instanceof WP_Post && Application::POST_TYPE == $post->post_type;
373
-    }
366
+	/**
367
+	 * @param mixed $post
368
+	 * @return bool
369
+	 */
370
+	protected function isReviewPostType($post)
371
+	{
372
+		return $post instanceof WP_Post && Application::POST_TYPE == $post->post_type;
373
+	}
374 374
 
375
-    /**
376
-     * @return array
377
-     */
378
-    protected function normalizeDetailsMetaBox(Review $review)
379
-    {
380
-        $user = empty($review->user_id)
381
-            ? __('Unregistered user', 'site-reviews')
382
-            : glsr(Builder::class)->a(get_the_author_meta('display_name', $review->user_id), [
383
-                'href' => get_author_posts_url($review->user_id),
384
-            ]);
385
-        $email = empty($review->email)
386
-            ? '&mdash;'
387
-            : glsr(Builder::class)->a($review->email, [
388
-                'href' => 'mailto:'.$review->email.'?subject='.esc_attr(__('RE:', 'site-reviews').' '.$review->title),
389
-            ]);
390
-        $metabox = [
391
-            __('Rating', 'site-reviews') => glsr_star_rating($review->rating),
392
-            __('Type', 'site-reviews') => $this->getReviewType($review),
393
-            __('Date', 'site-reviews') => get_date_from_gmt($review->date, 'F j, Y'),
394
-            __('Name', 'site-reviews') => $review->author,
395
-            __('Email', 'site-reviews') => $email,
396
-            __('User', 'site-reviews') => $user,
397
-            __('IP Address', 'site-reviews') => $review->ip_address,
398
-            __('Avatar', 'site-reviews') => sprintf('<img src="%s" width="96">', $review->avatar),
399
-        ];
400
-        return array_filter(apply_filters('site-reviews/metabox/details', $metabox, $review));
401
-    }
375
+	/**
376
+	 * @return array
377
+	 */
378
+	protected function normalizeDetailsMetaBox(Review $review)
379
+	{
380
+		$user = empty($review->user_id)
381
+			? __('Unregistered user', 'site-reviews')
382
+			: glsr(Builder::class)->a(get_the_author_meta('display_name', $review->user_id), [
383
+				'href' => get_author_posts_url($review->user_id),
384
+			]);
385
+		$email = empty($review->email)
386
+			? '&mdash;'
387
+			: glsr(Builder::class)->a($review->email, [
388
+				'href' => 'mailto:'.$review->email.'?subject='.esc_attr(__('RE:', 'site-reviews').' '.$review->title),
389
+			]);
390
+		$metabox = [
391
+			__('Rating', 'site-reviews') => glsr_star_rating($review->rating),
392
+			__('Type', 'site-reviews') => $this->getReviewType($review),
393
+			__('Date', 'site-reviews') => get_date_from_gmt($review->date, 'F j, Y'),
394
+			__('Name', 'site-reviews') => $review->author,
395
+			__('Email', 'site-reviews') => $email,
396
+			__('User', 'site-reviews') => $user,
397
+			__('IP Address', 'site-reviews') => $review->ip_address,
398
+			__('Avatar', 'site-reviews') => sprintf('<img src="%s" width="96">', $review->avatar),
399
+		];
400
+		return array_filter(apply_filters('site-reviews/metabox/details', $metabox, $review));
401
+	}
402 402
 
403
-    /**
404
-     * @param int $postId
405
-     * @param int $messageIndex
406
-     * @return void
407
-     */
408
-    protected function redirect($postId, $messageIndex)
409
-    {
410
-        $referer = wp_get_referer();
411
-        $hasReferer = !$referer
412
-            || Str::contains($referer, 'post.php')
413
-            || Str::contains($referer, 'post-new.php');
414
-        $redirectUri = $hasReferer
415
-            ? remove_query_arg(['deleted', 'ids', 'trashed', 'untrashed'], $referer)
416
-            : get_edit_post_link($postId);
417
-        wp_safe_redirect(add_query_arg(['message' => $messageIndex], $redirectUri));
418
-        exit;
419
-    }
403
+	/**
404
+	 * @param int $postId
405
+	 * @param int $messageIndex
406
+	 * @return void
407
+	 */
408
+	protected function redirect($postId, $messageIndex)
409
+	{
410
+		$referer = wp_get_referer();
411
+		$hasReferer = !$referer
412
+			|| Str::contains($referer, 'post.php')
413
+			|| Str::contains($referer, 'post-new.php');
414
+		$redirectUri = $hasReferer
415
+			? remove_query_arg(['deleted', 'ids', 'trashed', 'untrashed'], $referer)
416
+			: get_edit_post_link($postId);
417
+		wp_safe_redirect(add_query_arg(['message' => $messageIndex], $redirectUri));
418
+		exit;
419
+	}
420 420
 }
Please login to merge, or discard this patch.
Spacing   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
      * @return array
26 26
      * @filter wp_editor_settings
27 27
      */
28
-    public function filterEditorSettings($settings)
28
+    public function filterEditorSettings( $settings )
29 29
     {
30
-        return glsr(Customization::class)->filterEditorSettings(
31
-            Arr::consolidateArray($settings)
30
+        return glsr( Customization::class )->filterEditorSettings(
31
+            Arr::consolidateArray( $settings )
32 32
         );
33 33
     }
34 34
 
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
      * @return string
39 39
      * @filter the_editor
40 40
      */
41
-    public function filterEditorTextarea($html)
41
+    public function filterEditorTextarea( $html )
42 42
     {
43
-        return glsr(Customization::class)->filterEditorTextarea($html);
43
+        return glsr( Customization::class )->filterEditorTextarea( $html );
44 44
     }
45 45
 
46 46
     /**
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
      * @return bool
51 51
      * @filter is_protected_meta
52 52
      */
53
-    public function filterIsProtectedMeta($protected, $metaKey, $metaType)
53
+    public function filterIsProtectedMeta( $protected, $metaKey, $metaType )
54 54
     {
55
-        if ('post' == $metaType && Application::POST_TYPE == get_post_type()) {
56
-            $values = glsr(CreateReviewDefaults::class)->unguarded();
57
-            $values = Arr::prefixArrayKeys($values);
58
-            if (array_key_exists($metaKey, $values)) {
55
+        if( 'post' == $metaType && Application::POST_TYPE == get_post_type() ) {
56
+            $values = glsr( CreateReviewDefaults::class )->unguarded();
57
+            $values = Arr::prefixArrayKeys( $values );
58
+            if( array_key_exists( $metaKey, $values ) ) {
59 59
                 $protected = false;
60 60
             }
61 61
         }
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
      * @return array
68 68
      * @filter post_updated_messages
69 69
      */
70
-    public function filterUpdateMessages($messages)
70
+    public function filterUpdateMessages( $messages )
71 71
     {
72
-        return glsr(Labels::class)->filterUpdateMessages(
73
-            Arr::consolidateArray($messages)
72
+        return glsr( Labels::class )->filterUpdateMessages(
73
+            Arr::consolidateArray( $messages )
74 74
         );
75 75
     }
76 76
 
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
      * @return void
79 79
      * @action add_meta_boxes_{Application::POST_TYPE}
80 80
      */
81
-    public function registerMetaBoxes($post)
81
+    public function registerMetaBoxes( $post )
82 82
     {
83
-        add_meta_box(Application::ID.'_assigned_to', __('Assigned To', 'site-reviews'), [$this, 'renderAssignedToMetabox'], null, 'side');
84
-        add_meta_box(Application::ID.'_review', __('Details', 'site-reviews'), [$this, 'renderDetailsMetaBox'], null, 'side');
85
-        if ('local' != glsr(Database::class)->get($post->ID, 'review_type')) {
83
+        add_meta_box( Application::ID.'_assigned_to', __( 'Assigned To', 'site-reviews' ), [$this, 'renderAssignedToMetabox'], null, 'side' );
84
+        add_meta_box( Application::ID.'_review', __( 'Details', 'site-reviews' ), [$this, 'renderDetailsMetaBox'], null, 'side' );
85
+        if( 'local' != glsr( Database::class )->get( $post->ID, 'review_type' ) ) {
86 86
             return;
87 87
         }
88
-        add_meta_box(Application::ID.'_response', __('Respond Publicly', 'site-reviews'), [$this, 'renderResponseMetaBox'], null, 'normal');
88
+        add_meta_box( Application::ID.'_response', __( 'Respond Publicly', 'site-reviews' ), [$this, 'renderResponseMetaBox'], null, 'normal' );
89 89
     }
90 90
 
91 91
     /**
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      */
95 95
     public function removeAutosave()
96 96
     {
97
-        glsr(Customization::class)->removeAutosave();
97
+        glsr( Customization::class )->removeAutosave();
98 98
     }
99 99
 
100 100
     /**
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      */
104 104
     public function removeMetaBoxes()
105 105
     {
106
-        glsr(Customization::class)->removeMetaBoxes();
106
+        glsr( Customization::class )->removeMetaBoxes();
107 107
     }
108 108
 
109 109
     /**
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
      */
112 112
     public function removePostTypeSupport()
113 113
     {
114
-        glsr(Customization::class)->removePostTypeSupport();
114
+        glsr( Customization::class )->removePostTypeSupport();
115 115
     }
116 116
 
117 117
     /**
@@ -119,17 +119,17 @@  discard block
 block discarded – undo
119 119
      * @return void
120 120
      * @callback add_meta_box
121 121
      */
122
-    public function renderAssignedToMetabox($post)
122
+    public function renderAssignedToMetabox( $post )
123 123
     {
124
-        if (!$this->isReviewPostType($post)) {
124
+        if( !$this->isReviewPostType( $post ) ) {
125 125
             return;
126 126
         }
127
-        $assignedTo = (string) glsr(Database::class)->get($post->ID, 'assigned_to');
128
-        wp_nonce_field('assigned_to', '_nonce-assigned-to', false);
129
-        glsr()->render('partials/editor/metabox-assigned-to', [
127
+        $assignedTo = (string)glsr( Database::class )->get( $post->ID, 'assigned_to' );
128
+        wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false );
129
+        glsr()->render( 'partials/editor/metabox-assigned-to', [
130 130
             'id' => $assignedTo,
131
-            'template' => $this->buildAssignedToTemplate($assignedTo, $post),
132
-        ]);
131
+            'template' => $this->buildAssignedToTemplate( $assignedTo, $post ),
132
+        ] );
133 133
     }
134 134
 
135 135
     /**
@@ -137,16 +137,16 @@  discard block
 block discarded – undo
137 137
      * @return void
138 138
      * @callback add_meta_box
139 139
      */
140
-    public function renderDetailsMetaBox($post)
140
+    public function renderDetailsMetaBox( $post )
141 141
     {
142
-        if (!$this->isReviewPostType($post)) {
142
+        if( !$this->isReviewPostType( $post ) ) {
143 143
             return;
144 144
         }
145
-        $review = glsr_get_review($post);
146
-        glsr()->render('partials/editor/metabox-details', [
147
-            'button' => $this->buildDetailsMetaBoxRevertButton($review, $post),
148
-            'metabox' => $this->normalizeDetailsMetaBox($review),
149
-        ]);
145
+        $review = glsr_get_review( $post );
146
+        glsr()->render( 'partials/editor/metabox-details', [
147
+            'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ),
148
+            'metabox' => $this->normalizeDetailsMetaBox( $review ),
149
+        ] );
150 150
     }
151 151
 
152 152
     /**
@@ -155,16 +155,16 @@  discard block
 block discarded – undo
155 155
      */
156 156
     public function renderPinnedInPublishMetaBox()
157 157
     {
158
-        if (!$this->isReviewPostType(get_post())) {
158
+        if( !$this->isReviewPostType( get_post() ) ) {
159 159
             return;
160 160
         }
161
-        glsr(Template::class)->render('partials/editor/pinned', [
161
+        glsr( Template::class )->render( 'partials/editor/pinned', [
162 162
             'context' => [
163
-                'no' => __('No', 'site-reviews'),
164
-                'yes' => __('Yes', 'site-reviews'),
163
+                'no' => __( 'No', 'site-reviews' ),
164
+                'yes' => __( 'Yes', 'site-reviews' ),
165 165
             ],
166
-            'pinned' => wp_validate_boolean(glsr(Database::class)->get(get_the_ID(), 'pinned')),
167
-        ]);
166
+            'pinned' => wp_validate_boolean( glsr( Database::class )->get( get_the_ID(), 'pinned' ) ),
167
+        ] );
168 168
     }
169 169
 
170 170
     /**
@@ -172,15 +172,15 @@  discard block
 block discarded – undo
172 172
      * @return void
173 173
      * @callback add_meta_box
174 174
      */
175
-    public function renderResponseMetaBox($post)
175
+    public function renderResponseMetaBox( $post )
176 176
     {
177
-        if (!$this->isReviewPostType($post)) {
177
+        if( !$this->isReviewPostType( $post ) ) {
178 178
             return;
179 179
         }
180
-        wp_nonce_field('response', '_nonce-response', false);
181
-        glsr()->render('partials/editor/metabox-response', [
182
-            'response' => glsr(Database::class)->get($post->ID, 'response'),
183
-        ]);
180
+        wp_nonce_field( 'response', '_nonce-response', false );
181
+        glsr()->render( 'partials/editor/metabox-response', [
182
+            'response' => glsr( Database::class )->get( $post->ID, 'response' ),
183
+        ] );
184 184
     }
185 185
 
186 186
     /**
@@ -188,15 +188,15 @@  discard block
 block discarded – undo
188 188
      * @return void
189 189
      * @action edit_form_after_title
190 190
      */
191
-    public function renderReviewEditor($post)
191
+    public function renderReviewEditor( $post )
192 192
     {
193
-        if (!$this->isReviewPostType($post) || $this->isReviewEditable($post)) {
193
+        if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) ) {
194 194
             return;
195 195
         }
196
-        glsr()->render('partials/editor/review', [
196
+        glsr()->render( 'partials/editor/review', [
197 197
             'post' => $post,
198
-            'response' => glsr(Database::class)->get($post->ID, 'response'),
199
-        ]);
198
+            'response' => glsr( Database::class )->get( $post->ID, 'response' ),
199
+        ] );
200 200
     }
201 201
 
202 202
     /**
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
     public function renderReviewFields()
207 207
     {
208 208
         $screen = glsr_current_screen();
209
-        if ('post' != $screen->base || Application::POST_TYPE != $screen->post_type) {
209
+        if( 'post' != $screen->base || Application::POST_TYPE != $screen->post_type ) {
210 210
             return;
211 211
         }
212
-        add_action('edit_form_after_title', [$this, 'renderReviewEditor']);
213
-        add_action('edit_form_top', [$this, 'renderReviewNotice']);
212
+        add_action( 'edit_form_after_title', [$this, 'renderReviewEditor'] );
213
+        add_action( 'edit_form_top', [$this, 'renderReviewNotice'] );
214 214
     }
215 215
 
216 216
     /**
@@ -218,20 +218,20 @@  discard block
 block discarded – undo
218 218
      * @return void
219 219
      * @action edit_form_top
220 220
      */
221
-    public function renderReviewNotice($post)
221
+    public function renderReviewNotice( $post )
222 222
     {
223
-        if (!$this->isReviewPostType($post) || $this->isReviewEditable($post)) {
223
+        if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) ) {
224 224
             return;
225 225
         }
226
-        glsr(Notice::class)->addWarning(sprintf(
227
-            __('%s reviews are read-only.', 'site-reviews'),
228
-            glsr(Columns::class)->buildColumnReviewType($post->ID)
229
-        ));
230
-        glsr(Template::class)->render('partials/editor/notice', [
226
+        glsr( Notice::class )->addWarning( sprintf(
227
+            __( '%s reviews are read-only.', 'site-reviews' ),
228
+            glsr( Columns::class )->buildColumnReviewType( $post->ID )
229
+        ) );
230
+        glsr( Template::class )->render( 'partials/editor/notice', [
231 231
             'context' => [
232
-                'notices' => glsr(Notice::class)->get(),
232
+                'notices' => glsr( Notice::class )->get(),
233 233
             ],
234
-        ]);
234
+        ] );
235 235
     }
236 236
 
237 237
     /**
@@ -240,16 +240,16 @@  discard block
 block discarded – undo
240 240
      * @see glsr_categories_meta_box()
241 241
      * @callback register_taxonomy
242 242
      */
243
-    public function renderTaxonomyMetabox($post)
243
+    public function renderTaxonomyMetabox( $post )
244 244
     {
245
-        if (!$this->isReviewPostType($post)) {
245
+        if( !$this->isReviewPostType( $post ) ) {
246 246
             return;
247 247
         }
248
-        glsr()->render('partials/editor/metabox-categories', [
248
+        glsr()->render( 'partials/editor/metabox-categories', [
249 249
             'post' => $post,
250 250
             'tax_name' => Application::TAXONOMY,
251
-            'taxonomy' => get_taxonomy(Application::TAXONOMY),
252
-        ]);
251
+            'taxonomy' => get_taxonomy( Application::TAXONOMY ),
252
+        ] );
253 253
     }
254 254
 
255 255
     /**
@@ -259,12 +259,12 @@  discard block
 block discarded – undo
259 259
      */
260 260
     public function revertReview()
261 261
     {
262
-        if (Application::ID != filter_input(INPUT_GET, 'plugin')) {
262
+        if( Application::ID != filter_input( INPUT_GET, 'plugin' ) ) {
263 263
             return;
264 264
         }
265
-        check_admin_referer('revert-review_'.($postId = $this->getPostId()));
266
-        glsr(ReviewManager::class)->revert($postId);
267
-        $this->redirect($postId, 52);
265
+        check_admin_referer( 'revert-review_'.($postId = $this->getPostId()) );
266
+        glsr( ReviewManager::class )->revert( $postId );
267
+        $this->redirect( $postId, 52 );
268 268
     }
269 269
 
270 270
     /**
@@ -274,12 +274,12 @@  discard block
 block discarded – undo
274 274
      * @return void
275 275
      * @action save_post_.Application::POST_TYPE
276 276
      */
277
-    public function saveMetaboxes($postId, $post, $isUpdating)
277
+    public function saveMetaboxes( $postId, $post, $isUpdating )
278 278
     {
279
-        glsr(Metaboxes::class)->saveAssignedToMetabox($postId);
280
-        glsr(Metaboxes::class)->saveResponseMetabox($postId);
281
-        if ($isUpdating) {
282
-            do_action('site-reviews/review/saved', glsr_get_review($postId));
279
+        glsr( Metaboxes::class )->saveAssignedToMetabox( $postId );
280
+        glsr( Metaboxes::class )->saveResponseMetabox( $postId );
281
+        if( $isUpdating ) {
282
+            do_action( 'site-reviews/review/saved', glsr_get_review( $postId ) );
283 283
         }
284 284
     }
285 285
 
@@ -287,68 +287,68 @@  discard block
 block discarded – undo
287 287
      * @param string $assignedTo
288 288
      * @return string
289 289
      */
290
-    protected function buildAssignedToTemplate($assignedTo, WP_Post $post)
290
+    protected function buildAssignedToTemplate( $assignedTo, WP_Post $post )
291 291
     {
292
-        $assignedPost = glsr(Database::class)->getAssignedToPost($post->ID, $assignedTo);
293
-        if (!($assignedPost instanceof WP_Post)) {
292
+        $assignedPost = glsr( Database::class )->getAssignedToPost( $post->ID, $assignedTo );
293
+        if( !($assignedPost instanceof WP_Post) ) {
294 294
             return;
295 295
         }
296
-        return glsr(Template::class)->build('partials/editor/assigned-post', [
296
+        return glsr( Template::class )->build( 'partials/editor/assigned-post', [
297 297
             'context' => [
298
-                'data.url' => (string) get_permalink($assignedPost),
299
-                'data.title' => get_the_title($assignedPost),
298
+                'data.url' => (string)get_permalink( $assignedPost ),
299
+                'data.title' => get_the_title( $assignedPost ),
300 300
             ],
301
-        ]);
301
+        ] );
302 302
     }
303 303
 
304 304
     /**
305 305
      * @return string
306 306
      */
307
-    protected function buildDetailsMetaBoxRevertButton(Review $review, WP_Post $post)
307
+    protected function buildDetailsMetaBoxRevertButton( Review $review, WP_Post $post )
308 308
     {
309 309
         $isModified = !Arr::compareArrays(
310 310
             [$review->title, $review->content, $review->date],
311 311
             [
312
-                glsr(Database::class)->get($post->ID, 'title'),
313
-                glsr(Database::class)->get($post->ID, 'content'),
314
-                glsr(Database::class)->get($post->ID, 'date'),
312
+                glsr( Database::class )->get( $post->ID, 'title' ),
313
+                glsr( Database::class )->get( $post->ID, 'content' ),
314
+                glsr( Database::class )->get( $post->ID, 'date' ),
315 315
             ]
316 316
         );
317
-        if ($isModified) {
317
+        if( $isModified ) {
318 318
             $revertUrl = wp_nonce_url(
319
-                admin_url('post.php?post='.$post->ID.'&action=revert&plugin='.Application::ID),
319
+                admin_url( 'post.php?post='.$post->ID.'&action=revert&plugin='.Application::ID ),
320 320
                 'revert-review_'.$post->ID
321 321
             );
322
-            return glsr(Builder::class)->a(__('Revert Changes', 'site-reviews'), [
322
+            return glsr( Builder::class )->a( __( 'Revert Changes', 'site-reviews' ), [
323 323
                 'class' => 'button button-large',
324 324
                 'href' => $revertUrl,
325 325
                 'id' => 'revert',
326
-            ]);
326
+            ] );
327 327
         }
328
-        return glsr(Builder::class)->button(__('Nothing to Revert', 'site-reviews'), [
328
+        return glsr( Builder::class )->button( __( 'Nothing to Revert', 'site-reviews' ), [
329 329
             'class' => 'button-large',
330 330
             'disabled' => true,
331 331
             'id' => 'revert',
332
-        ]);
332
+        ] );
333 333
     }
334 334
 
335 335
     /**
336 336
      * @param object $review
337 337
      * @return string|void
338 338
      */
339
-    protected function getReviewType($review)
339
+    protected function getReviewType( $review )
340 340
     {
341
-        if (count(glsr()->reviewTypes) < 2) {
341
+        if( count( glsr()->reviewTypes ) < 2 ) {
342 342
             return;
343 343
         }
344
-        $reviewType = array_key_exists($review->review_type, glsr()->reviewTypes)
344
+        $reviewType = array_key_exists( $review->review_type, glsr()->reviewTypes )
345 345
             ? glsr()->reviewTypes[$review->review_type]
346
-            : __('Unknown', 'site-reviews');
347
-        if (!empty($review->url)) {
348
-            $reviewType = glsr(Builder::class)->a($reviewType, [
346
+            : __( 'Unknown', 'site-reviews' );
347
+        if( !empty($review->url) ) {
348
+            $reviewType = glsr( Builder::class )->a( $reviewType, [
349 349
                 'href' => $review->url,
350 350
                 'target' => '_blank',
351
-            ]);
351
+            ] );
352 352
         }
353 353
         return $reviewType;
354 354
     }
@@ -356,18 +356,18 @@  discard block
 block discarded – undo
356 356
     /**
357 357
      * @return bool
358 358
      */
359
-    protected function isReviewEditable($post)
359
+    protected function isReviewEditable( $post )
360 360
     {
361
-        return $this->isReviewPostType($post)
362
-            && post_type_supports(Application::POST_TYPE, 'title')
363
-            && 'local' == glsr(Database::class)->get($post->ID, 'review_type');
361
+        return $this->isReviewPostType( $post )
362
+            && post_type_supports( Application::POST_TYPE, 'title' )
363
+            && 'local' == glsr( Database::class )->get( $post->ID, 'review_type' );
364 364
     }
365 365
 
366 366
     /**
367 367
      * @param mixed $post
368 368
      * @return bool
369 369
      */
370
-    protected function isReviewPostType($post)
370
+    protected function isReviewPostType( $post )
371 371
     {
372 372
         return $post instanceof WP_Post && Application::POST_TYPE == $post->post_type;
373 373
     }
@@ -375,29 +375,29 @@  discard block
 block discarded – undo
375 375
     /**
376 376
      * @return array
377 377
      */
378
-    protected function normalizeDetailsMetaBox(Review $review)
378
+    protected function normalizeDetailsMetaBox( Review $review )
379 379
     {
380 380
         $user = empty($review->user_id)
381
-            ? __('Unregistered user', 'site-reviews')
382
-            : glsr(Builder::class)->a(get_the_author_meta('display_name', $review->user_id), [
383
-                'href' => get_author_posts_url($review->user_id),
384
-            ]);
381
+            ? __( 'Unregistered user', 'site-reviews' )
382
+            : glsr( Builder::class )->a( get_the_author_meta( 'display_name', $review->user_id ), [
383
+                'href' => get_author_posts_url( $review->user_id ),
384
+            ] );
385 385
         $email = empty($review->email)
386 386
             ? '&mdash;'
387
-            : glsr(Builder::class)->a($review->email, [
388
-                'href' => 'mailto:'.$review->email.'?subject='.esc_attr(__('RE:', 'site-reviews').' '.$review->title),
389
-            ]);
387
+            : glsr( Builder::class )->a( $review->email, [
388
+                'href' => 'mailto:'.$review->email.'?subject='.esc_attr( __( 'RE:', 'site-reviews' ).' '.$review->title ),
389
+            ] );
390 390
         $metabox = [
391
-            __('Rating', 'site-reviews') => glsr_star_rating($review->rating),
392
-            __('Type', 'site-reviews') => $this->getReviewType($review),
393
-            __('Date', 'site-reviews') => get_date_from_gmt($review->date, 'F j, Y'),
394
-            __('Name', 'site-reviews') => $review->author,
395
-            __('Email', 'site-reviews') => $email,
396
-            __('User', 'site-reviews') => $user,
397
-            __('IP Address', 'site-reviews') => $review->ip_address,
398
-            __('Avatar', 'site-reviews') => sprintf('<img src="%s" width="96">', $review->avatar),
391
+            __( 'Rating', 'site-reviews' ) => glsr_star_rating( $review->rating ),
392
+            __( 'Type', 'site-reviews' ) => $this->getReviewType( $review ),
393
+            __( 'Date', 'site-reviews' ) => get_date_from_gmt( $review->date, 'F j, Y' ),
394
+            __( 'Name', 'site-reviews' ) => $review->author,
395
+            __( 'Email', 'site-reviews' ) => $email,
396
+            __( 'User', 'site-reviews' ) => $user,
397
+            __( 'IP Address', 'site-reviews' ) => $review->ip_address,
398
+            __( 'Avatar', 'site-reviews' ) => sprintf( '<img src="%s" width="96">', $review->avatar ),
399 399
         ];
400
-        return array_filter(apply_filters('site-reviews/metabox/details', $metabox, $review));
400
+        return array_filter( apply_filters( 'site-reviews/metabox/details', $metabox, $review ) );
401 401
     }
402 402
 
403 403
     /**
@@ -405,16 +405,16 @@  discard block
 block discarded – undo
405 405
      * @param int $messageIndex
406 406
      * @return void
407 407
      */
408
-    protected function redirect($postId, $messageIndex)
408
+    protected function redirect( $postId, $messageIndex )
409 409
     {
410 410
         $referer = wp_get_referer();
411 411
         $hasReferer = !$referer
412
-            || Str::contains($referer, 'post.php')
413
-            || Str::contains($referer, 'post-new.php');
412
+            || Str::contains( $referer, 'post.php' )
413
+            || Str::contains( $referer, 'post-new.php' );
414 414
         $redirectUri = $hasReferer
415
-            ? remove_query_arg(['deleted', 'ids', 'trashed', 'untrashed'], $referer)
416
-            : get_edit_post_link($postId);
417
-        wp_safe_redirect(add_query_arg(['message' => $messageIndex], $redirectUri));
415
+            ? remove_query_arg( ['deleted', 'ids', 'trashed', 'untrashed'], $referer )
416
+            : get_edit_post_link( $postId );
417
+        wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri ) );
418 418
         exit;
419 419
     }
420 420
 }
Please login to merge, or discard this patch.