Passed
Push — feature/rebusify ( 0fe5b2...103190 )
by Paul
08:37 queued 03:55
created
plugin/Handlers/RegisterPostType.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -6,16 +6,16 @@
 block discarded – undo
6 6
 
7 7
 class RegisterPostType
8 8
 {
9
-    /**
10
-     * @return void
11
-     */
12
-    public function handle(Command $command)
13
-    {
14
-        if (!in_array($command->postType, get_post_types(['_builtin' => true]))) {
15
-            register_post_type($command->postType, $command->args);
16
-            glsr()->postTypeColumns = wp_parse_args(glsr()->postTypeColumns, [
17
-                $command->postType => $command->columns,
18
-            ]);
19
-        }
20
-    }
9
+	/**
10
+	 * @return void
11
+	 */
12
+	public function handle(Command $command)
13
+	{
14
+		if (!in_array($command->postType, get_post_types(['_builtin' => true]))) {
15
+			register_post_type($command->postType, $command->args);
16
+			glsr()->postTypeColumns = wp_parse_args(glsr()->postTypeColumns, [
17
+				$command->postType => $command->columns,
18
+			]);
19
+		}
20
+	}
21 21
 }
Please login to merge, or discard this patch.
plugin/Handlers/RegisterShortcodes.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -7,18 +7,18 @@
 block discarded – undo
7 7
 
8 8
 class RegisterShortcodes
9 9
 {
10
-    /**
11
-     * @return void
12
-     */
13
-    public function handle(Command $command)
14
-    {
15
-        foreach ($command->shortcodes as $shortcode) {
16
-            $shortcodeClass = glsr(Helper::class)->buildClassName($shortcode.'-shortcode', 'Shortcodes');
17
-            if (!class_exists($shortcodeClass)) {
18
-                glsr_log()->error(sprintf('Class missing (%s)', $shortcodeClass));
19
-                continue;
20
-            }
21
-            add_shortcode($shortcode, [glsr($shortcodeClass), 'buildShortcode']);
22
-        }
23
-    }
10
+	/**
11
+	 * @return void
12
+	 */
13
+	public function handle(Command $command)
14
+	{
15
+		foreach ($command->shortcodes as $shortcode) {
16
+			$shortcodeClass = glsr(Helper::class)->buildClassName($shortcode.'-shortcode', 'Shortcodes');
17
+			if (!class_exists($shortcodeClass)) {
18
+				glsr_log()->error(sprintf('Class missing (%s)', $shortcodeClass));
19
+				continue;
20
+			}
21
+			add_shortcode($shortcode, [glsr($shortcodeClass), 'buildShortcode']);
22
+		}
23
+	}
24 24
 }
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsFormPopup.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -4,50 +4,50 @@
 block discarded – undo
4 4
 
5 5
 class SiteReviewsFormPopup extends TinymcePopupGenerator
6 6
 {
7
-    /**
8
-     * @return array
9
-     */
10
-    public function fields()
11
-    {
12
-        return [[
13
-            'type' => 'container',
14
-            'html' => '<p class="strong">'.esc_html__('All settings are optional.', 'site-reviews').'</p>',
15
-        ], [
16
-            'label' => esc_html__('Title', 'site-reviews'),
17
-            'name' => 'title',
18
-            'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
19
-            'type' => 'textbox',
20
-        ], [
21
-            'label' => esc_html__('Description', 'site-reviews'),
22
-            'minHeight' => 60,
23
-            'minWidth' => 240,
24
-            'multiline' => true,
25
-            'name' => 'description',
26
-            'tooltip' => __('Enter a custom shortcode description.', 'site-reviews'),
27
-            'type' => 'textbox',
28
-        ],
29
-        $this->getCategories(__('Automatically assign a category to reviews submitted with this shortcode.', 'site-reviews')),
30
-        [
31
-            'label' => esc_html__('Assign To', 'site-reviews'),
32
-            'name' => 'assign_to',
33
-            'tooltip' => __('Assign submitted reviews to a custom page/post ID. You can also enter "post_id" to assign reviews to the ID of the current page.', 'site-reviews'),
34
-            'type' => 'textbox',
35
-        ], [
36
-            'label' => esc_html__('Classes', 'site-reviews'),
37
-            'name' => 'class',
38
-            'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
39
-            'type' => 'textbox',
40
-        ], [
41
-            'columns' => 2,
42
-            'items' => $this->getHideOptions(),
43
-            'label' => esc_html__('Hide', 'site-reviews'),
44
-            'layout' => 'grid',
45
-            'spacing' => 5,
46
-            'type' => 'container',
47
-        ], [
48
-            'hidden' => true,
49
-            'name' => 'id',
50
-            'type' => 'textbox',
51
-        ], ];
52
-    }
7
+	/**
8
+	 * @return array
9
+	 */
10
+	public function fields()
11
+	{
12
+		return [[
13
+			'type' => 'container',
14
+			'html' => '<p class="strong">'.esc_html__('All settings are optional.', 'site-reviews').'</p>',
15
+		], [
16
+			'label' => esc_html__('Title', 'site-reviews'),
17
+			'name' => 'title',
18
+			'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'),
19
+			'type' => 'textbox',
20
+		], [
21
+			'label' => esc_html__('Description', 'site-reviews'),
22
+			'minHeight' => 60,
23
+			'minWidth' => 240,
24
+			'multiline' => true,
25
+			'name' => 'description',
26
+			'tooltip' => __('Enter a custom shortcode description.', 'site-reviews'),
27
+			'type' => 'textbox',
28
+		],
29
+		$this->getCategories(__('Automatically assign a category to reviews submitted with this shortcode.', 'site-reviews')),
30
+		[
31
+			'label' => esc_html__('Assign To', 'site-reviews'),
32
+			'name' => 'assign_to',
33
+			'tooltip' => __('Assign submitted reviews to a custom page/post ID. You can also enter "post_id" to assign reviews to the ID of the current page.', 'site-reviews'),
34
+			'type' => 'textbox',
35
+		], [
36
+			'label' => esc_html__('Classes', 'site-reviews'),
37
+			'name' => 'class',
38
+			'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
39
+			'type' => 'textbox',
40
+		], [
41
+			'columns' => 2,
42
+			'items' => $this->getHideOptions(),
43
+			'label' => esc_html__('Hide', 'site-reviews'),
44
+			'layout' => 'grid',
45
+			'spacing' => 5,
46
+			'type' => 'container',
47
+		], [
48
+			'hidden' => true,
49
+			'name' => 'id',
50
+			'type' => 'textbox',
51
+		], ];
52
+	}
53 53
 }
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsSummaryPopup.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -4,49 +4,49 @@
 block discarded – undo
4 4
 
5 5
 class SiteReviewsSummaryPopup extends SiteReviewsPopup
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
-        $this->getTypes(__('Which type of review would you like to use?', 'site-reviews')),
23
-        $this->getCategories(__('Limit reviews to this category.', 'site-reviews')),
24
-        [
25
-            'label' => esc_html__('Assigned To', 'site-reviews'),
26
-            'name' => 'assigned_to',
27
-            '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'),
28
-            'type' => 'textbox',
29
-        ], [
30
-            'label' => esc_html__('Schema', 'site-reviews'),
31
-            'name' => 'schema',
32
-            'options' => [
33
-                'true' => esc_html__('Enable rich snippets', 'site-reviews'),
34
-                'false' => esc_html__('Disable rich snippets', 'site-reviews'),
35
-            ],
36
-            'tooltip' => __('Rich snippets are disabled by default.', 'site-reviews'),
37
-            'type' => 'listbox',
38
-        ], [
39
-            'label' => esc_html__('Classes', 'site-reviews'),
40
-            'name' => 'class',
41
-            'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
42
-            'type' => 'textbox',
43
-        ], [
44
-            'columns' => 2,
45
-            'items' => $this->getHideOptions(),
46
-            'label' => esc_html__('Hide', 'site-reviews'),
47
-            'layout' => 'grid',
48
-            'spacing' => 5,
49
-            'type' => 'container',
50
-        ], ];
51
-    }
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
+		$this->getTypes(__('Which type of review would you like to use?', 'site-reviews')),
23
+		$this->getCategories(__('Limit reviews to this category.', 'site-reviews')),
24
+		[
25
+			'label' => esc_html__('Assigned To', 'site-reviews'),
26
+			'name' => 'assigned_to',
27
+			'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'),
28
+			'type' => 'textbox',
29
+		], [
30
+			'label' => esc_html__('Schema', 'site-reviews'),
31
+			'name' => 'schema',
32
+			'options' => [
33
+				'true' => esc_html__('Enable rich snippets', 'site-reviews'),
34
+				'false' => esc_html__('Disable rich snippets', 'site-reviews'),
35
+			],
36
+			'tooltip' => __('Rich snippets are disabled by default.', 'site-reviews'),
37
+			'type' => 'listbox',
38
+		], [
39
+			'label' => esc_html__('Classes', 'site-reviews'),
40
+			'name' => 'class',
41
+			'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'),
42
+			'type' => 'textbox',
43
+		], [
44
+			'columns' => 2,
45
+			'items' => $this->getHideOptions(),
46
+			'label' => esc_html__('Hide', 'site-reviews'),
47
+			'layout' => 'grid',
48
+			'spacing' => 5,
49
+			'type' => 'container',
50
+		], ];
51
+	}
52 52
 }
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsFormShortcode.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -4,29 +4,29 @@
 block discarded – undo
4 4
 
5 5
 class SiteReviewsFormShortcode extends Shortcode
6 6
 {
7
-    protected function hideOptions()
8
-    {
9
-        return [
10
-            'rating' => __('Hide the rating field', 'site-reviews'),
11
-            'title' => __('Hide the title field', 'site-reviews'),
12
-            'content' => __('Hide the review field', 'site-reviews'),
13
-            'name' => __('Hide the name field', 'site-reviews'),
14
-            'email' => __('Hide the email field', 'site-reviews'),
15
-            'terms' => __('Hide the terms field', 'site-reviews'),
16
-        ];
17
-    }
7
+	protected function hideOptions()
8
+	{
9
+		return [
10
+			'rating' => __('Hide the rating field', 'site-reviews'),
11
+			'title' => __('Hide the title field', 'site-reviews'),
12
+			'content' => __('Hide the review field', 'site-reviews'),
13
+			'name' => __('Hide the name field', 'site-reviews'),
14
+			'email' => __('Hide the email field', 'site-reviews'),
15
+			'terms' => __('Hide the terms field', 'site-reviews'),
16
+		];
17
+	}
18 18
 
19
-    /**
20
-     * @param array|string $atts
21
-     * @param string $type
22
-     * @return array
23
-     */
24
-    public function normalizeAtts($atts, $type = 'shortcode')
25
-    {
26
-        $atts = parent::normalizeAtts($atts, $type);
27
-        if (empty($atts['id'])) {
28
-            $atts['id'] = substr(md5(serialize($atts)), 0, 8);
29
-        }
30
-        return $atts;
31
-    }
19
+	/**
20
+	 * @param array|string $atts
21
+	 * @param string $type
22
+	 * @return array
23
+	 */
24
+	public function normalizeAtts($atts, $type = 'shortcode')
25
+	{
26
+		$atts = parent::normalizeAtts($atts, $type);
27
+		if (empty($atts['id'])) {
28
+			$atts['id'] = substr(md5(serialize($atts)), 0, 8);
29
+		}
30
+		return $atts;
31
+	}
32 32
 }
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsPopup.php 1 patch
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__('Count', 'site-reviews'),
23
-            'maxLength' => 5,
24
-            'name' => 'count',
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__('Count', 'site-reviews'),
23
+			'maxLength' => 5,
24
+			'name' => 'count',
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.
plugin/Shortcodes/SiteReviewsShortcode.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -4,17 +4,17 @@
 block discarded – undo
4 4
 
5 5
 class SiteReviewsShortcode extends Shortcode
6 6
 {
7
-    protected function hideOptions()
8
-    {
9
-        return [
10
-            'title' => __('Hide the title', 'site-reviews'),
11
-            'rating' => __('Hide the rating', 'site-reviews'),
12
-            'date' => __('Hide the date', 'site-reviews'),
13
-            'assigned_to' => __('Hide the assigned to link (if shown)', 'site-reviews'),
14
-            'content' => __('Hide the content', 'site-reviews'),
15
-            'avatar' => __('Hide the avatar (if shown)', 'site-reviews'),
16
-            'author' => __('Hide the author', 'site-reviews'),
17
-            'response' => __('Hide the response', 'site-reviews'),
18
-        ];
19
-    }
7
+	protected function hideOptions()
8
+	{
9
+		return [
10
+			'title' => __('Hide the title', 'site-reviews'),
11
+			'rating' => __('Hide the rating', 'site-reviews'),
12
+			'date' => __('Hide the date', 'site-reviews'),
13
+			'assigned_to' => __('Hide the assigned to link (if shown)', 'site-reviews'),
14
+			'content' => __('Hide the content', 'site-reviews'),
15
+			'avatar' => __('Hide the avatar (if shown)', 'site-reviews'),
16
+			'author' => __('Hide the author', 'site-reviews'),
17
+			'response' => __('Hide the response', 'site-reviews'),
18
+		];
19
+	}
20 20
 }
Please login to merge, or discard this patch.
plugin/Shortcodes/SiteReviewsSummaryShortcode.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -4,14 +4,14 @@
 block discarded – undo
4 4
 
5 5
 class SiteReviewsSummaryShortcode extends Shortcode
6 6
 {
7
-    protected function hideOptions()
8
-    {
9
-        return [
10
-            'rating' => __('Hide the rating', 'site-reviews'),
11
-            'stars' => __('Hide the stars', 'site-reviews'),
12
-            'summary' => __('Hide the summary', 'site-reviews'),
13
-            'bars' => __('Hide the percentage bars', 'site-reviews'),
14
-            'if_empty' => __('Hide if no reviews are found', 'site-reviews'),
15
-        ];
16
-    }
7
+	protected function hideOptions()
8
+	{
9
+		return [
10
+			'rating' => __('Hide the rating', 'site-reviews'),
11
+			'stars' => __('Hide the stars', 'site-reviews'),
12
+			'summary' => __('Hide the summary', 'site-reviews'),
13
+			'bars' => __('Hide the percentage bars', 'site-reviews'),
14
+			'if_empty' => __('Hide if no reviews are found', 'site-reviews'),
15
+		];
16
+	}
17 17
 }
Please login to merge, or discard this patch.
plugin/Shortcodes/TinymcePopupGenerator.php 1 patch
Indentation   +301 added lines, -301 removed lines patch added patch discarded remove patch
@@ -6,325 +6,325 @@
 block discarded – undo
6 6
 
7 7
 abstract class TinymcePopupGenerator
8 8
 {
9
-    /**
10
-     * @var array
11
-     */
12
-    public $properties;
9
+	/**
10
+	 * @var array
11
+	 */
12
+	public $properties;
13 13
 
14
-    /**
15
-     * @var string
16
-     */
17
-    public $tag;
14
+	/**
15
+	 * @var string
16
+	 */
17
+	public $tag;
18 18
 
19
-    /**
20
-     * @var array
21
-     */
22
-    protected $errors = [];
19
+	/**
20
+	 * @var array
21
+	 */
22
+	protected $errors = [];
23 23
 
24
-    /**
25
-     * @var array
26
-     */
27
-    protected $required = [];
24
+	/**
25
+	 * @var array
26
+	 */
27
+	protected $required = [];
28 28
 
29
-    /**
30
-     * @return array
31
-     */
32
-    abstract public function fields();
29
+	/**
30
+	 * @return array
31
+	 */
32
+	abstract public function fields();
33 33
 
34
-    /**
35
-     * @param string $tag
36
-     * @return static
37
-     */
38
-    public function register($tag, array $args)
39
-    {
40
-        $this->tag = $tag;
41
-        $this->properties = wp_parse_args($args, [
42
-            'btn_close' => esc_html__('Close', 'site-reviews'),
43
-            'btn_okay' => esc_html__('Insert Shortcode', 'site-reviews'),
44
-            'errors' => $this->errors,
45
-            'fields' => $this->getFields(),
46
-            'label' => '['.$tag.']',
47
-            'required' => $this->required,
48
-            'title' => esc_html__('Shortcode', 'site-reviews'),
49
-        ]);
50
-        return $this;
51
-    }
34
+	/**
35
+	 * @param string $tag
36
+	 * @return static
37
+	 */
38
+	public function register($tag, array $args)
39
+	{
40
+		$this->tag = $tag;
41
+		$this->properties = wp_parse_args($args, [
42
+			'btn_close' => esc_html__('Close', 'site-reviews'),
43
+			'btn_okay' => esc_html__('Insert Shortcode', 'site-reviews'),
44
+			'errors' => $this->errors,
45
+			'fields' => $this->getFields(),
46
+			'label' => '['.$tag.']',
47
+			'required' => $this->required,
48
+			'title' => esc_html__('Shortcode', 'site-reviews'),
49
+		]);
50
+		return $this;
51
+	}
52 52
 
53
-    /**
54
-     * @return array
55
-     */
56
-    protected function generateFields(array $fields)
57
-    {
58
-        $generatedFields = array_map(function ($field) {
59
-            if (empty($field)) {
60
-                return;
61
-            }
62
-            $field = $this->normalize($field);
63
-            if (!method_exists($this, $method = 'normalize'.ucfirst($field['type']))) {
64
-                return;
65
-            }
66
-            return $this->$method($field);
67
-        }, $fields);
68
-        return array_values(array_filter($generatedFields));
69
-    }
53
+	/**
54
+	 * @return array
55
+	 */
56
+	protected function generateFields(array $fields)
57
+	{
58
+		$generatedFields = array_map(function ($field) {
59
+			if (empty($field)) {
60
+				return;
61
+			}
62
+			$field = $this->normalize($field);
63
+			if (!method_exists($this, $method = 'normalize'.ucfirst($field['type']))) {
64
+				return;
65
+			}
66
+			return $this->$method($field);
67
+		}, $fields);
68
+		return array_values(array_filter($generatedFields));
69
+	}
70 70
 
71
-    /**
72
-     * @param string $tooltip
73
-     * @return array
74
-     */
75
-    protected function getCategories($tooltip = '')
76
-    {
77
-        $terms = glsr(Database::class)->getTerms();
78
-        if (empty($terms)) {
79
-            return [];
80
-        }
81
-        return [
82
-            'label' => esc_html__('Category', 'site-reviews'),
83
-            'name' => 'category',
84
-            'options' => $terms,
85
-            'tooltip' => $tooltip,
86
-            'type' => 'listbox',
87
-        ];
88
-    }
71
+	/**
72
+	 * @param string $tooltip
73
+	 * @return array
74
+	 */
75
+	protected function getCategories($tooltip = '')
76
+	{
77
+		$terms = glsr(Database::class)->getTerms();
78
+		if (empty($terms)) {
79
+			return [];
80
+		}
81
+		return [
82
+			'label' => esc_html__('Category', 'site-reviews'),
83
+			'name' => 'category',
84
+			'options' => $terms,
85
+			'tooltip' => $tooltip,
86
+			'type' => 'listbox',
87
+		];
88
+	}
89 89
 
90
-    /**
91
-     * @return array
92
-     */
93
-    protected function getFields()
94
-    {
95
-        $fields = $this->generateFields($this->fields());
96
-        if (!empty($this->errors)) {
97
-            $errors = [];
98
-            foreach ($this->required as $name => $alert) {
99
-                if (false !== array_search($name, glsr_array_column($fields, 'name'))) {
100
-                    continue;
101
-                }
102
-                $errors[] = $this->errors[$name];
103
-            }
104
-            $this->errors = $errors;
105
-        }
106
-        return empty($this->errors)
107
-            ? $fields
108
-            : $this->errors;
109
-    }
90
+	/**
91
+	 * @return array
92
+	 */
93
+	protected function getFields()
94
+	{
95
+		$fields = $this->generateFields($this->fields());
96
+		if (!empty($this->errors)) {
97
+			$errors = [];
98
+			foreach ($this->required as $name => $alert) {
99
+				if (false !== array_search($name, glsr_array_column($fields, 'name'))) {
100
+					continue;
101
+				}
102
+				$errors[] = $this->errors[$name];
103
+			}
104
+			$this->errors = $errors;
105
+		}
106
+		return empty($this->errors)
107
+			? $fields
108
+			: $this->errors;
109
+	}
110 110
 
111
-    /**
112
-     * @return array
113
-     */
114
-    protected function getHideOptions()
115
-    {
116
-        $classname = str_replace('Popup', 'Shortcode', get_class($this));
117
-        $hideOptions = glsr($classname)->getHideOptions();
118
-        $options = [];
119
-        foreach ($hideOptions as $name => $tooltip) {
120
-            $options[] = [
121
-                'name' => 'hide_'.$name,
122
-                'text' => $name,
123
-                'tooltip' => $tooltip,
124
-                'type' => 'checkbox',
125
-            ];
126
-        }
127
-        return $options;
128
-    }
111
+	/**
112
+	 * @return array
113
+	 */
114
+	protected function getHideOptions()
115
+	{
116
+		$classname = str_replace('Popup', 'Shortcode', get_class($this));
117
+		$hideOptions = glsr($classname)->getHideOptions();
118
+		$options = [];
119
+		foreach ($hideOptions as $name => $tooltip) {
120
+			$options[] = [
121
+				'name' => 'hide_'.$name,
122
+				'text' => $name,
123
+				'tooltip' => $tooltip,
124
+				'type' => 'checkbox',
125
+			];
126
+		}
127
+		return $options;
128
+	}
129 129
 
130
-    /**
131
-     * @param string $tooltip
132
-     * @return array
133
-     */
134
-    protected function getTypes($tooltip = '')
135
-    {
136
-        if (count(glsr()->reviewTypes) < 2) {
137
-            return [];
138
-        }
139
-        return [
140
-            'label' => esc_html__('Type', 'site-reviews'),
141
-            'name' => 'type',
142
-            'options' => glsr()->reviewTypes,
143
-            'tooltip' => $tooltip,
144
-            'type' => 'listbox',
145
-        ];
146
-    }
130
+	/**
131
+	 * @param string $tooltip
132
+	 * @return array
133
+	 */
134
+	protected function getTypes($tooltip = '')
135
+	{
136
+		if (count(glsr()->reviewTypes) < 2) {
137
+			return [];
138
+		}
139
+		return [
140
+			'label' => esc_html__('Type', 'site-reviews'),
141
+			'name' => 'type',
142
+			'options' => glsr()->reviewTypes,
143
+			'tooltip' => $tooltip,
144
+			'type' => 'listbox',
145
+		];
146
+	}
147 147
 
148
-    /**
149
-     * @return array
150
-     */
151
-    protected function normalize(array $field)
152
-    {
153
-        return wp_parse_args($field, [
154
-            'items' => [],
155
-            'type' => '',
156
-        ]);
157
-    }
148
+	/**
149
+	 * @return array
150
+	 */
151
+	protected function normalize(array $field)
152
+	{
153
+		return wp_parse_args($field, [
154
+			'items' => [],
155
+			'type' => '',
156
+		]);
157
+	}
158 158
 
159
-    /**
160
-     * @return void|array
161
-     */
162
-    protected function normalizeCheckbox(array $field)
163
-    {
164
-        return $this->normalizeField($field, [
165
-            'checked' => false,
166
-            'label' => '',
167
-            'minHeight' => '',
168
-            'minWidth' => '',
169
-            'name' => false,
170
-            'text' => '',
171
-            'tooltip' => '',
172
-            'type' => '',
173
-            'value' => '',
174
-        ]);
175
-    }
159
+	/**
160
+	 * @return void|array
161
+	 */
162
+	protected function normalizeCheckbox(array $field)
163
+	{
164
+		return $this->normalizeField($field, [
165
+			'checked' => false,
166
+			'label' => '',
167
+			'minHeight' => '',
168
+			'minWidth' => '',
169
+			'name' => false,
170
+			'text' => '',
171
+			'tooltip' => '',
172
+			'type' => '',
173
+			'value' => '',
174
+		]);
175
+	}
176 176
 
177
-    /**
178
-     * @return void|array
179
-     */
180
-    protected function normalizeContainer(array $field)
181
-    {
182
-        if (!array_key_exists('html', $field) && !array_key_exists('items', $field)) {
183
-            return;
184
-        }
185
-        $field['items'] = $this->generateFields($field['items']);
186
-        return $field;
187
-    }
177
+	/**
178
+	 * @return void|array
179
+	 */
180
+	protected function normalizeContainer(array $field)
181
+	{
182
+		if (!array_key_exists('html', $field) && !array_key_exists('items', $field)) {
183
+			return;
184
+		}
185
+		$field['items'] = $this->generateFields($field['items']);
186
+		return $field;
187
+	}
188 188
 
189
-    /**
190
-     * @return void|array
191
-     */
192
-    protected function normalizeField(array $field, array $defaults)
193
-    {
194
-        if (!$this->validate($field)) {
195
-            return;
196
-        }
197
-        return array_filter(shortcode_atts($defaults, $field), function ($value) {
198
-            return '' !== $value;
199
-        });
200
-    }
189
+	/**
190
+	 * @return void|array
191
+	 */
192
+	protected function normalizeField(array $field, array $defaults)
193
+	{
194
+		if (!$this->validate($field)) {
195
+			return;
196
+		}
197
+		return array_filter(shortcode_atts($defaults, $field), function ($value) {
198
+			return '' !== $value;
199
+		});
200
+	}
201 201
 
202
-    /**
203
-     * @return void|array
204
-     */
205
-    protected function normalizeListbox(array $field)
206
-    {
207
-        $listbox = $this->normalizeField($field, [
208
-            'label' => '',
209
-            'minWidth' => '',
210
-            'name' => false,
211
-            'options' => [],
212
-            'placeholder' => esc_attr__('- Select -', 'site-reviews'),
213
-            'tooltip' => '',
214
-            'type' => '',
215
-            'value' => '',
216
-        ]);
217
-        if (!is_array($listbox)) {
218
-            return;
219
-        }
220
-        if (!array_key_exists('', $listbox['options'])) {
221
-            $listbox['options'] = ['' => $listbox['placeholder']] + $listbox['options'];
222
-        }
223
-        foreach ($listbox['options'] as $value => $text) {
224
-            $listbox['values'][] = [
225
-                'text' => $text,
226
-                'value' => $value,
227
-            ];
228
-        }
229
-        return $listbox;
230
-    }
202
+	/**
203
+	 * @return void|array
204
+	 */
205
+	protected function normalizeListbox(array $field)
206
+	{
207
+		$listbox = $this->normalizeField($field, [
208
+			'label' => '',
209
+			'minWidth' => '',
210
+			'name' => false,
211
+			'options' => [],
212
+			'placeholder' => esc_attr__('- Select -', 'site-reviews'),
213
+			'tooltip' => '',
214
+			'type' => '',
215
+			'value' => '',
216
+		]);
217
+		if (!is_array($listbox)) {
218
+			return;
219
+		}
220
+		if (!array_key_exists('', $listbox['options'])) {
221
+			$listbox['options'] = ['' => $listbox['placeholder']] + $listbox['options'];
222
+		}
223
+		foreach ($listbox['options'] as $value => $text) {
224
+			$listbox['values'][] = [
225
+				'text' => $text,
226
+				'value' => $value,
227
+			];
228
+		}
229
+		return $listbox;
230
+	}
231 231
 
232
-    /**
233
-     * @return void|array
234
-     */
235
-    protected function normalizePost(array $field)
236
-    {
237
-        if (!is_array($field['query_args'])) {
238
-            $field['query_args'] = [];
239
-        }
240
-        $posts = get_posts(wp_parse_args($field['query_args'], [
241
-            'order' => 'ASC',
242
-            'orderby' => 'title',
243
-            'post_type' => 'post',
244
-            'posts_per_page' => 30,
245
-        ]));
246
-        if (!empty($posts)) {
247
-            $options = [];
248
-            foreach ($posts as $post) {
249
-                $options[$post->ID] = esc_html($post->post_title);
250
-            }
251
-            $field['options'] = $options;
252
-            $field['type'] = 'listbox';
253
-            return $this->normalizeListbox($field);
254
-        }
255
-        $this->validate($field);
256
-    }
232
+	/**
233
+	 * @return void|array
234
+	 */
235
+	protected function normalizePost(array $field)
236
+	{
237
+		if (!is_array($field['query_args'])) {
238
+			$field['query_args'] = [];
239
+		}
240
+		$posts = get_posts(wp_parse_args($field['query_args'], [
241
+			'order' => 'ASC',
242
+			'orderby' => 'title',
243
+			'post_type' => 'post',
244
+			'posts_per_page' => 30,
245
+		]));
246
+		if (!empty($posts)) {
247
+			$options = [];
248
+			foreach ($posts as $post) {
249
+				$options[$post->ID] = esc_html($post->post_title);
250
+			}
251
+			$field['options'] = $options;
252
+			$field['type'] = 'listbox';
253
+			return $this->normalizeListbox($field);
254
+		}
255
+		$this->validate($field);
256
+	}
257 257
 
258
-    /**
259
-     * @return void|array
260
-     */
261
-    protected function normalizeTextbox(array $field)
262
-    {
263
-        return $this->normalizeField($field, [
264
-            'hidden' => false,
265
-            'label' => '',
266
-            'maxLength' => '',
267
-            'minHeight' => '',
268
-            'minWidth' => '',
269
-            'multiline' => false,
270
-            'name' => false,
271
-            'size' => '',
272
-            'text' => '',
273
-            'tooltip' => '',
274
-            'type' => '',
275
-            'value' => '',
276
-        ]);
277
-    }
258
+	/**
259
+	 * @return void|array
260
+	 */
261
+	protected function normalizeTextbox(array $field)
262
+	{
263
+		return $this->normalizeField($field, [
264
+			'hidden' => false,
265
+			'label' => '',
266
+			'maxLength' => '',
267
+			'minHeight' => '',
268
+			'minWidth' => '',
269
+			'multiline' => false,
270
+			'name' => false,
271
+			'size' => '',
272
+			'text' => '',
273
+			'tooltip' => '',
274
+			'type' => '',
275
+			'value' => '',
276
+		]);
277
+	}
278 278
 
279
-    /**
280
-     * @return bool
281
-     */
282
-    protected function validate(array $field)
283
-    {
284
-        $args = shortcode_atts([
285
-            'label' => '',
286
-            'name' => false,
287
-            'required' => false,
288
-        ], $field);
289
-        if (!$args['name']) {
290
-            return false;
291
-        }
292
-        return $this->validateErrors($args) && $this->validateRequired($args);
293
-    }
279
+	/**
280
+	 * @return bool
281
+	 */
282
+	protected function validate(array $field)
283
+	{
284
+		$args = shortcode_atts([
285
+			'label' => '',
286
+			'name' => false,
287
+			'required' => false,
288
+		], $field);
289
+		if (!$args['name']) {
290
+			return false;
291
+		}
292
+		return $this->validateErrors($args) && $this->validateRequired($args);
293
+	}
294 294
 
295
-    /**
296
-     * @return bool
297
-     */
298
-    protected function validateErrors(array $args)
299
-    {
300
-        if (!isset($args['required']['error'])) {
301
-            return true;
302
-        }
303
-        $this->errors[$args['name']] = $this->normalizeContainer([
304
-            'html' => $args['required']['error'],
305
-            'type' => 'container',
306
-        ]);
307
-        return false;
308
-    }
295
+	/**
296
+	 * @return bool
297
+	 */
298
+	protected function validateErrors(array $args)
299
+	{
300
+		if (!isset($args['required']['error'])) {
301
+			return true;
302
+		}
303
+		$this->errors[$args['name']] = $this->normalizeContainer([
304
+			'html' => $args['required']['error'],
305
+			'type' => 'container',
306
+		]);
307
+		return false;
308
+	}
309 309
 
310
-    /**
311
-     * @return bool
312
-     */
313
-    protected function validateRequired(array $args)
314
-    {
315
-        if (false == $args['required']) {
316
-            return true;
317
-        }
318
-        $alert = esc_html__('Some of the shortcode options are required.', 'site-reviews');
319
-        if (isset($args['required']['alert'])) {
320
-            $alert = $args['required']['alert'];
321
-        } elseif (!empty($args['label'])) {
322
-            $alert = sprintf(
323
-                esc_html_x('The "%s" option is required.', 'the option label', 'site-reviews'),
324
-                str_replace(':', '', $args['label'])
325
-            );
326
-        }
327
-        $this->required[$args['name']] = $alert;
328
-        return false;
329
-    }
310
+	/**
311
+	 * @return bool
312
+	 */
313
+	protected function validateRequired(array $args)
314
+	{
315
+		if (false == $args['required']) {
316
+			return true;
317
+		}
318
+		$alert = esc_html__('Some of the shortcode options are required.', 'site-reviews');
319
+		if (isset($args['required']['alert'])) {
320
+			$alert = $args['required']['alert'];
321
+		} elseif (!empty($args['label'])) {
322
+			$alert = sprintf(
323
+				esc_html_x('The "%s" option is required.', 'the option label', 'site-reviews'),
324
+				str_replace(':', '', $args['label'])
325
+			);
326
+		}
327
+		$this->required[$args['name']] = $alert;
328
+		return false;
329
+	}
330 330
 }
Please login to merge, or discard this patch.