@@ -4,8 +4,8 @@ |
||
4 | 4 | |
5 | 5 | interface PartialContract |
6 | 6 | { |
7 | - /** |
|
8 | - * @return void|string |
|
9 | - */ |
|
10 | - public function build(array $args = []); |
|
7 | + /** |
|
8 | + * @return void|string |
|
9 | + */ |
|
10 | + public function build(array $args = []); |
|
11 | 11 | } |
@@ -6,8 +6,8 @@ |
||
6 | 6 | |
7 | 7 | interface ProviderContract |
8 | 8 | { |
9 | - /** |
|
10 | - * @return void |
|
11 | - */ |
|
12 | - public function register(Application $app); |
|
9 | + /** |
|
10 | + * @return void |
|
11 | + */ |
|
12 | + public function register(Application $app); |
|
13 | 13 | } |
@@ -6,83 +6,83 @@ |
||
6 | 6 | |
7 | 7 | class SiteReviewsSummaryBlock extends BlockGenerator |
8 | 8 | { |
9 | - /** |
|
10 | - * @return array |
|
11 | - */ |
|
12 | - public function attributes() |
|
13 | - { |
|
14 | - return [ |
|
15 | - 'assigned_to' => [ |
|
16 | - 'default' => '', |
|
17 | - 'type' => 'string', |
|
18 | - ], |
|
19 | - 'category' => [ |
|
20 | - 'default' => '', |
|
21 | - 'type' => 'string', |
|
22 | - ], |
|
23 | - 'className' => [ |
|
24 | - 'default' => '', |
|
25 | - 'type' => 'string', |
|
26 | - ], |
|
27 | - 'hide' => [ |
|
28 | - 'default' => '', |
|
29 | - 'type' => 'string', |
|
30 | - ], |
|
31 | - 'post_id' => [ |
|
32 | - 'default' => '', |
|
33 | - 'type' => 'string', |
|
34 | - ], |
|
35 | - 'rating' => [ |
|
36 | - 'default' => '1', |
|
37 | - 'type' => 'number', |
|
38 | - ], |
|
39 | - 'schema' => [ |
|
40 | - 'default' => false, |
|
41 | - 'type' => 'boolean', |
|
42 | - ], |
|
43 | - 'type' => [ |
|
44 | - 'default' => 'local', |
|
45 | - 'type' => 'string', |
|
46 | - ], |
|
47 | - ]; |
|
48 | - } |
|
9 | + /** |
|
10 | + * @return array |
|
11 | + */ |
|
12 | + public function attributes() |
|
13 | + { |
|
14 | + return [ |
|
15 | + 'assigned_to' => [ |
|
16 | + 'default' => '', |
|
17 | + 'type' => 'string', |
|
18 | + ], |
|
19 | + 'category' => [ |
|
20 | + 'default' => '', |
|
21 | + 'type' => 'string', |
|
22 | + ], |
|
23 | + 'className' => [ |
|
24 | + 'default' => '', |
|
25 | + 'type' => 'string', |
|
26 | + ], |
|
27 | + 'hide' => [ |
|
28 | + 'default' => '', |
|
29 | + 'type' => 'string', |
|
30 | + ], |
|
31 | + 'post_id' => [ |
|
32 | + 'default' => '', |
|
33 | + 'type' => 'string', |
|
34 | + ], |
|
35 | + 'rating' => [ |
|
36 | + 'default' => '1', |
|
37 | + 'type' => 'number', |
|
38 | + ], |
|
39 | + 'schema' => [ |
|
40 | + 'default' => false, |
|
41 | + 'type' => 'boolean', |
|
42 | + ], |
|
43 | + 'type' => [ |
|
44 | + 'default' => 'local', |
|
45 | + 'type' => 'string', |
|
46 | + ], |
|
47 | + ]; |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * @return string |
|
52 | - */ |
|
53 | - public function render(array $attributes) |
|
54 | - { |
|
55 | - $attributes['class'] = $attributes['className']; |
|
56 | - $shortcode = glsr(Shortcode::class); |
|
57 | - if ('edit' == filter_input(INPUT_GET, 'context')) { |
|
58 | - $attributes = $this->normalize($attributes); |
|
59 | - $this->filterShortcodeClass(); |
|
60 | - if (!$this->hasVisibleFields($shortcode, $attributes)) { |
|
61 | - $this->filterInterpolation(); |
|
62 | - } |
|
63 | - } |
|
64 | - return $shortcode->buildShortcode($attributes); |
|
65 | - } |
|
50 | + /** |
|
51 | + * @return string |
|
52 | + */ |
|
53 | + public function render(array $attributes) |
|
54 | + { |
|
55 | + $attributes['class'] = $attributes['className']; |
|
56 | + $shortcode = glsr(Shortcode::class); |
|
57 | + if ('edit' == filter_input(INPUT_GET, 'context')) { |
|
58 | + $attributes = $this->normalize($attributes); |
|
59 | + $this->filterShortcodeClass(); |
|
60 | + if (!$this->hasVisibleFields($shortcode, $attributes)) { |
|
61 | + $this->filterInterpolation(); |
|
62 | + } |
|
63 | + } |
|
64 | + return $shortcode->buildShortcode($attributes); |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * @return void |
|
69 | - */ |
|
70 | - protected function filterInterpolation() |
|
71 | - { |
|
72 | - add_filter('site-reviews/interpolate/reviews-summary', function ($context) { |
|
73 | - $context['class'] = 'glsr-default glsr-block-disabled'; |
|
74 | - $context['text'] = __('You have hidden all of the fields for this block.', 'site-reviews'); |
|
75 | - return $context; |
|
76 | - }); |
|
77 | - } |
|
67 | + /** |
|
68 | + * @return void |
|
69 | + */ |
|
70 | + protected function filterInterpolation() |
|
71 | + { |
|
72 | + add_filter('site-reviews/interpolate/reviews-summary', function ($context) { |
|
73 | + $context['class'] = 'glsr-default glsr-block-disabled'; |
|
74 | + $context['text'] = __('You have hidden all of the fields for this block.', 'site-reviews'); |
|
75 | + return $context; |
|
76 | + }); |
|
77 | + } |
|
78 | 78 | |
79 | - /** |
|
80 | - * @return void |
|
81 | - */ |
|
82 | - protected function filterShortcodeClass() |
|
83 | - { |
|
84 | - add_filter('site-reviews/style', function () { |
|
85 | - return 'default'; |
|
86 | - }); |
|
87 | - } |
|
79 | + /** |
|
80 | + * @return void |
|
81 | + */ |
|
82 | + protected function filterShortcodeClass() |
|
83 | + { |
|
84 | + add_filter('site-reviews/style', function () { |
|
85 | + return 'default'; |
|
86 | + }); |
|
87 | + } |
|
88 | 88 | } |
@@ -6,115 +6,115 @@ |
||
6 | 6 | |
7 | 7 | class SiteReviewsFormBlock extends BlockGenerator |
8 | 8 | { |
9 | - /** |
|
10 | - * @return array |
|
11 | - */ |
|
12 | - public function attributes() |
|
13 | - { |
|
14 | - return [ |
|
15 | - 'assign_to' => [ |
|
16 | - 'default' => '', |
|
17 | - 'type' => 'string', |
|
18 | - ], |
|
19 | - 'category' => [ |
|
20 | - 'default' => '', |
|
21 | - 'type' => 'string', |
|
22 | - ], |
|
23 | - 'className' => [ |
|
24 | - 'default' => '', |
|
25 | - 'type' => 'string', |
|
26 | - ], |
|
27 | - 'hide' => [ |
|
28 | - 'default' => '', |
|
29 | - 'type' => 'string', |
|
30 | - ], |
|
31 | - 'id' => [ |
|
32 | - 'default' => '', |
|
33 | - 'type' => 'string', |
|
34 | - ], |
|
35 | - ]; |
|
36 | - } |
|
9 | + /** |
|
10 | + * @return array |
|
11 | + */ |
|
12 | + public function attributes() |
|
13 | + { |
|
14 | + return [ |
|
15 | + 'assign_to' => [ |
|
16 | + 'default' => '', |
|
17 | + 'type' => 'string', |
|
18 | + ], |
|
19 | + 'category' => [ |
|
20 | + 'default' => '', |
|
21 | + 'type' => 'string', |
|
22 | + ], |
|
23 | + 'className' => [ |
|
24 | + 'default' => '', |
|
25 | + 'type' => 'string', |
|
26 | + ], |
|
27 | + 'hide' => [ |
|
28 | + 'default' => '', |
|
29 | + 'type' => 'string', |
|
30 | + ], |
|
31 | + 'id' => [ |
|
32 | + 'default' => '', |
|
33 | + 'type' => 'string', |
|
34 | + ], |
|
35 | + ]; |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * @return string |
|
40 | - */ |
|
41 | - public function render(array $attributes) |
|
42 | - { |
|
43 | - $attributes['class'] = $attributes['className']; |
|
44 | - $shortcode = glsr(Shortcode::class); |
|
45 | - if ('edit' == filter_input(INPUT_GET, 'context')) { |
|
46 | - $this->filterFormFields(); |
|
47 | - $this->filterRatingField(); |
|
48 | - $this->filterShortcodeClass(); |
|
49 | - $this->filterSubmitButton(); |
|
50 | - if (!$this->hasVisibleFields($shortcode, $attributes)) { |
|
51 | - $this->filterInterpolation(); |
|
52 | - } |
|
53 | - } |
|
54 | - return $shortcode->buildShortcode($attributes); |
|
55 | - } |
|
38 | + /** |
|
39 | + * @return string |
|
40 | + */ |
|
41 | + public function render(array $attributes) |
|
42 | + { |
|
43 | + $attributes['class'] = $attributes['className']; |
|
44 | + $shortcode = glsr(Shortcode::class); |
|
45 | + if ('edit' == filter_input(INPUT_GET, 'context')) { |
|
46 | + $this->filterFormFields(); |
|
47 | + $this->filterRatingField(); |
|
48 | + $this->filterShortcodeClass(); |
|
49 | + $this->filterSubmitButton(); |
|
50 | + if (!$this->hasVisibleFields($shortcode, $attributes)) { |
|
51 | + $this->filterInterpolation(); |
|
52 | + } |
|
53 | + } |
|
54 | + return $shortcode->buildShortcode($attributes); |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * @return void |
|
59 | - */ |
|
60 | - protected function filterFormFields() |
|
61 | - { |
|
62 | - add_filter('site-reviews/config/forms/submission-form', function (array $config) { |
|
63 | - array_walk($config, function (&$field) { |
|
64 | - $field['disabled'] = true; |
|
65 | - $field['tabindex'] = '-1'; |
|
66 | - }); |
|
67 | - return $config; |
|
68 | - }); |
|
69 | - } |
|
57 | + /** |
|
58 | + * @return void |
|
59 | + */ |
|
60 | + protected function filterFormFields() |
|
61 | + { |
|
62 | + add_filter('site-reviews/config/forms/submission-form', function (array $config) { |
|
63 | + array_walk($config, function (&$field) { |
|
64 | + $field['disabled'] = true; |
|
65 | + $field['tabindex'] = '-1'; |
|
66 | + }); |
|
67 | + return $config; |
|
68 | + }); |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * @return void |
|
73 | - */ |
|
74 | - protected function filterInterpolation() |
|
75 | - { |
|
76 | - add_filter('site-reviews/interpolate/reviews-form', function ($context) { |
|
77 | - $context['class'] = 'glsr-default glsr-block-disabled'; |
|
78 | - $context['fields'] = __('You have hidden all of the fields for this block.', 'site-reviews'); |
|
79 | - $context['response'] = ''; |
|
80 | - $context['submit_button'] = ''; |
|
81 | - return $context; |
|
82 | - }); |
|
83 | - } |
|
71 | + /** |
|
72 | + * @return void |
|
73 | + */ |
|
74 | + protected function filterInterpolation() |
|
75 | + { |
|
76 | + add_filter('site-reviews/interpolate/reviews-form', function ($context) { |
|
77 | + $context['class'] = 'glsr-default glsr-block-disabled'; |
|
78 | + $context['fields'] = __('You have hidden all of the fields for this block.', 'site-reviews'); |
|
79 | + $context['response'] = ''; |
|
80 | + $context['submit_button'] = ''; |
|
81 | + return $context; |
|
82 | + }); |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
86 | - * @return void |
|
87 | - */ |
|
88 | - protected function filterRatingField() |
|
89 | - { |
|
90 | - add_filter('site-reviews/rendered/field', function ($html, $type, $args) { |
|
91 | - if ('rating' == $args['path']) { |
|
92 | - $stars = '<span class="glsr-stars">'; |
|
93 | - $stars.= str_repeat('<span class="glsr-star glsr-star-empty" aria-hidden="true"></span>', 5); |
|
94 | - $stars.= '</span>'; |
|
95 | - $html = preg_replace('/(.*)(<select.*)(<\/select>)(.*)/', '$1'.$stars.'$4', $html); |
|
96 | - } |
|
97 | - return $html; |
|
98 | - }, 10, 3); |
|
99 | - } |
|
85 | + /** |
|
86 | + * @return void |
|
87 | + */ |
|
88 | + protected function filterRatingField() |
|
89 | + { |
|
90 | + add_filter('site-reviews/rendered/field', function ($html, $type, $args) { |
|
91 | + if ('rating' == $args['path']) { |
|
92 | + $stars = '<span class="glsr-stars">'; |
|
93 | + $stars.= str_repeat('<span class="glsr-star glsr-star-empty" aria-hidden="true"></span>', 5); |
|
94 | + $stars.= '</span>'; |
|
95 | + $html = preg_replace('/(.*)(<select.*)(<\/select>)(.*)/', '$1'.$stars.'$4', $html); |
|
96 | + } |
|
97 | + return $html; |
|
98 | + }, 10, 3); |
|
99 | + } |
|
100 | 100 | |
101 | - /** |
|
102 | - * @return void |
|
103 | - */ |
|
104 | - protected function filterShortcodeClass() |
|
105 | - { |
|
106 | - add_filter('site-reviews/style', function () { |
|
107 | - return 'default'; |
|
108 | - }); |
|
109 | - } |
|
101 | + /** |
|
102 | + * @return void |
|
103 | + */ |
|
104 | + protected function filterShortcodeClass() |
|
105 | + { |
|
106 | + add_filter('site-reviews/style', function () { |
|
107 | + return 'default'; |
|
108 | + }); |
|
109 | + } |
|
110 | 110 | |
111 | - /** |
|
112 | - * @return void |
|
113 | - */ |
|
114 | - protected function filterSubmitButton() |
|
115 | - { |
|
116 | - add_filter('site-reviews/rendered/template/form/submit-button', function ($template) { |
|
117 | - return str_replace('type="submit"', 'tabindex="-1"', $template); |
|
118 | - }); |
|
119 | - } |
|
111 | + /** |
|
112 | + * @return void |
|
113 | + */ |
|
114 | + protected function filterSubmitButton() |
|
115 | + { |
|
116 | + add_filter('site-reviews/rendered/template/form/submit-button', function ($template) { |
|
117 | + return str_replace('type="submit"', 'tabindex="-1"', $template); |
|
118 | + }); |
|
119 | + } |
|
120 | 120 | } |
@@ -6,65 +6,65 @@ |
||
6 | 6 | |
7 | 7 | abstract class BlockGenerator |
8 | 8 | { |
9 | - /** |
|
10 | - * @return array |
|
11 | - */ |
|
12 | - public function attributes() |
|
13 | - { |
|
14 | - return []; |
|
15 | - } |
|
9 | + /** |
|
10 | + * @return array |
|
11 | + */ |
|
12 | + public function attributes() |
|
13 | + { |
|
14 | + return []; |
|
15 | + } |
|
16 | 16 | |
17 | - /** |
|
18 | - * @return array |
|
19 | - */ |
|
20 | - public function normalize(array $attributes) |
|
21 | - { |
|
22 | - $hide = array_flip(explode(',', $attributes['hide'])); |
|
23 | - unset($hide['if_empty']); |
|
24 | - $attributes['hide'] = implode(',', array_keys($hide)); |
|
25 | - if (!isset($attributes['assigned_to'])) { |
|
26 | - return $attributes; |
|
27 | - } |
|
28 | - if ('post_id' == $attributes['assigned_to']) { |
|
29 | - $attributes['assigned_to'] = $attributes['post_id']; |
|
30 | - } elseif ('parent_id' == $attributes['assigned_to']) { |
|
31 | - $attributes['assigned_to'] = wp_get_post_parent_id($attributes['post_id']); |
|
32 | - } |
|
33 | - return $attributes; |
|
34 | - } |
|
17 | + /** |
|
18 | + * @return array |
|
19 | + */ |
|
20 | + public function normalize(array $attributes) |
|
21 | + { |
|
22 | + $hide = array_flip(explode(',', $attributes['hide'])); |
|
23 | + unset($hide['if_empty']); |
|
24 | + $attributes['hide'] = implode(',', array_keys($hide)); |
|
25 | + if (!isset($attributes['assigned_to'])) { |
|
26 | + return $attributes; |
|
27 | + } |
|
28 | + if ('post_id' == $attributes['assigned_to']) { |
|
29 | + $attributes['assigned_to'] = $attributes['post_id']; |
|
30 | + } elseif ('parent_id' == $attributes['assigned_to']) { |
|
31 | + $attributes['assigned_to'] = wp_get_post_parent_id($attributes['post_id']); |
|
32 | + } |
|
33 | + return $attributes; |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * @return void |
|
38 | - */ |
|
39 | - public function register($block) |
|
40 | - { |
|
41 | - if (!function_exists('register_block_type')) { |
|
42 | - return; |
|
43 | - } |
|
44 | - register_block_type(Application::ID.'/'.$block, [ |
|
45 | - 'attributes' => $this->attributes(), |
|
46 | - 'editor_script' => Application::ID.'/blocks', |
|
47 | - 'editor_style' => Application::ID.'/blocks', |
|
48 | - 'render_callback' => [$this, 'render'], |
|
49 | - 'style' => Application::ID, |
|
50 | - ]); |
|
51 | - } |
|
36 | + /** |
|
37 | + * @return void |
|
38 | + */ |
|
39 | + public function register($block) |
|
40 | + { |
|
41 | + if (!function_exists('register_block_type')) { |
|
42 | + return; |
|
43 | + } |
|
44 | + register_block_type(Application::ID.'/'.$block, [ |
|
45 | + 'attributes' => $this->attributes(), |
|
46 | + 'editor_script' => Application::ID.'/blocks', |
|
47 | + 'editor_style' => Application::ID.'/blocks', |
|
48 | + 'render_callback' => [$this, 'render'], |
|
49 | + 'style' => Application::ID, |
|
50 | + ]); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * @return void |
|
55 | - */ |
|
56 | - abstract public function render(array $attributes); |
|
53 | + /** |
|
54 | + * @return void |
|
55 | + */ |
|
56 | + abstract public function render(array $attributes); |
|
57 | 57 | |
58 | - /** |
|
59 | - * @param mixed $shortcode |
|
60 | - * @return bool |
|
61 | - */ |
|
62 | - protected function hasVisibleFields($shortcode, array $attributes) |
|
63 | - { |
|
64 | - $args = $shortcode->normalizeAtts($attributes); |
|
65 | - $defaults = $shortcode->getHideOptions(); |
|
66 | - $hide = array_flip($args['hide']); |
|
67 | - unset($defaults['if_empty'], $hide['if_empty']); |
|
68 | - return !empty(array_diff_key($defaults, $hide)); |
|
69 | - } |
|
58 | + /** |
|
59 | + * @param mixed $shortcode |
|
60 | + * @return bool |
|
61 | + */ |
|
62 | + protected function hasVisibleFields($shortcode, array $attributes) |
|
63 | + { |
|
64 | + $args = $shortcode->normalizeAtts($attributes); |
|
65 | + $defaults = $shortcode->getHideOptions(); |
|
66 | + $hide = array_flip($args['hide']); |
|
67 | + unset($defaults['if_empty'], $hide['if_empty']); |
|
68 | + return !empty(array_diff_key($defaults, $hide)); |
|
69 | + } |
|
70 | 70 | } |
@@ -7,12 +7,12 @@ |
||
7 | 7 | |
8 | 8 | class RegisterTaxonomy |
9 | 9 | { |
10 | - /** |
|
11 | - * @return void |
|
12 | - */ |
|
13 | - public function handle(Command $command) |
|
14 | - { |
|
15 | - register_taxonomy(Application::TAXONOMY, Application::POST_TYPE, $command->args); |
|
16 | - register_taxonomy_for_object_type(Application::TAXONOMY, Application::POST_TYPE); |
|
17 | - } |
|
10 | + /** |
|
11 | + * @return void |
|
12 | + */ |
|
13 | + public function handle(Command $command) |
|
14 | + { |
|
15 | + register_taxonomy(Application::TAXONOMY, Application::POST_TYPE, $command->args); |
|
16 | + register_taxonomy_for_object_type(Application::TAXONOMY, Application::POST_TYPE); |
|
17 | + } |
|
18 | 18 | } |
@@ -6,16 +6,16 @@ |
||
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 | } |
@@ -4,50 +4,50 @@ |
||
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 | } |
@@ -4,49 +4,49 @@ |
||
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 | } |