Test Failed
Push — hotfix/fix-counts ( e9420b...4803a6 )
by Paul
05:49
created

SiteReviewsPopup   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 80
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 61
c 0
b 0
f 0
dl 0
loc 80
ccs 0
cts 54
cp 0
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
B fields() 0 75 1
1
<?php
2
3
namespace GeminiLabs\SiteReviews\Shortcodes;
4
5
use GeminiLabs\SiteReviews\Database;
6
use GeminiLabs\SiteReviews\Shortcodes\TinymcePopupGenerator;
7
8
class SiteReviewsPopup extends TinymcePopupGenerator
9
{
10
	/**
11
	 * @return array
12
	 */
13
	public function fields()
14
	{
15
		return [[
16
			'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' )),
17
			'minWidth' => 320,
18
			'type' => 'container',
19
		],[
20
			'label' => esc_html__( 'Title', 'site-reviews' ),
21
			'name' => 'title',
22
			'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ),
23
			'type' => 'textbox',
24
		],[
25
			'label' => esc_html__( 'Count', 'site-reviews' ),
26
			'maxLength' => 5,
27
			'name' => 'count',
28
			'size' => 3,
29
			'text' => '10',
30
			'tooltip' => __( 'How many reviews would you like to display (default: 10)?', 'site-reviews' ),
31
			'type' => 'textbox',
32
		],[
33
			'label' => esc_html__( 'Rating', 'site-reviews' ),
34
			'name' => 'rating',
35
			'options' => [
36
				'5' => esc_html( sprintf( _n( '%s star', '%s stars', 5, 'site-reviews' ), 5 )),
37
				'4' => esc_html( sprintf( _n( '%s star', '%s stars', 4, 'site-reviews' ), 4 )),
38
				'3' => esc_html( sprintf( _n( '%s star', '%s stars', 3, 'site-reviews' ), 3 )),
39
				'2' => esc_html( sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 )),
40
				'1' => esc_html( sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 )),
41
				'0' => esc_html( __( 'Unrated', 'site-reviews' )),
42
			],
43
			'tooltip' => __( 'What is the minimum rating to display (default: 1 star)?', 'site-reviews' ),
44
			'type' => 'listbox',
45
		],[
46
			'label' => esc_html__( 'Pagination', 'site-reviews' ),
47
			'name' => 'pagination',
48
			'options' => [
49
				'true' => esc_html__( 'Enable', 'site-reviews' ),
50
				'ajax' => esc_html__( 'Enable (using ajax)', 'site-reviews' ),
51
				'false' => esc_html__( 'Disable', 'site-reviews' ),
52
			],
53
			'tooltip' => __( 'When using pagination this shortcode can only be used once on a page. (default: disable)', 'site-reviews' ),
54
			'type' => 'listbox',
55
		],
56
		$this->getTypes( __( 'Which type of review would you like to display?', 'site-reviews' )),
57
		$this->getCategories( __( 'Limit reviews to this category.', 'site-reviews' )),
58
		[
59
			'label' => esc_html__( 'Assigned To', 'site-reviews' ),
60
			'name' => 'assigned_to',
61
			'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' ),
62
			'type' => 'textbox',
63
		],[
64
			'label' => esc_html__( 'Schema', 'site-reviews' ),
65
			'name' => 'schema',
66
			'options' => [
67
				'true' => esc_html__( 'Enable rich snippets', 'site-reviews' ),
68
				'false' => esc_html__( 'Disable rich snippets', 'site-reviews' ),
69
			],
70
			'tooltip' => __( 'Rich snippets are disabled by default.', 'site-reviews' ),
71
			'type' => 'listbox',
72
		],[
73
			'label' => esc_html__( 'Classes', 'site-reviews' ),
74
			'name' => 'class',
75
			'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ),
76
			'type' => 'textbox',
77
		],[
78
			'columns' => 2,
79
			'items' => $this->getHideOptions(),
80
			'label' => esc_html__( 'Hide', 'site-reviews' ),
81
			'layout' => 'grid',
82
			'spacing' => 5,
83
			'type' => 'container',
84
		],[
85
			'hidden' => true,
86
			'name' => 'id',
87
			'type' => 'textbox',
88
		]];
89
	}
90
}
91