Test Failed
Push — hotfix/fix-counts ( 1fe4ce...872cd6 )
by Paul
03:14
created

SiteReviewsPopup   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 80
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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