@@ -4,30 +4,30 @@ |
||
4 | 4 | |
5 | 5 | class Honeypot extends Field |
6 | 6 | { |
7 | - /** |
|
8 | - * @return string|void |
|
9 | - */ |
|
10 | - public function build() |
|
11 | - { |
|
12 | - $this->builder->args = wp_parse_args($this->builder->args, [ |
|
13 | - 'name' => $this->builder->args['text'], |
|
14 | - ]); |
|
15 | - $this->builder->tag = 'input'; |
|
16 | - $this->mergeFieldArgs(); |
|
17 | - return $this->builder->getOpeningTag(); |
|
18 | - } |
|
7 | + /** |
|
8 | + * @return string|void |
|
9 | + */ |
|
10 | + public function build() |
|
11 | + { |
|
12 | + $this->builder->args = wp_parse_args($this->builder->args, [ |
|
13 | + 'name' => $this->builder->args['text'], |
|
14 | + ]); |
|
15 | + $this->builder->tag = 'input'; |
|
16 | + $this->mergeFieldArgs(); |
|
17 | + return $this->builder->getOpeningTag(); |
|
18 | + } |
|
19 | 19 | |
20 | - /** |
|
21 | - * @return array |
|
22 | - */ |
|
23 | - public static function required() |
|
24 | - { |
|
25 | - return [ |
|
26 | - 'autocomplete' => 'off', |
|
27 | - 'is_raw' => true, |
|
28 | - 'style' => 'display:none!important', |
|
29 | - 'tabindex' => '-1', |
|
30 | - 'type' => 'text', |
|
31 | - ]; |
|
32 | - } |
|
20 | + /** |
|
21 | + * @return array |
|
22 | + */ |
|
23 | + public static function required() |
|
24 | + { |
|
25 | + return [ |
|
26 | + 'autocomplete' => 'off', |
|
27 | + 'is_raw' => true, |
|
28 | + 'style' => 'display:none!important', |
|
29 | + 'tabindex' => '-1', |
|
30 | + 'type' => 'text', |
|
31 | + ]; |
|
32 | + } |
|
33 | 33 | } |
@@ -9,9 +9,9 @@ |
||
9 | 9 | */ |
10 | 10 | public function build() |
11 | 11 | { |
12 | - $this->builder->args = wp_parse_args($this->builder->args, [ |
|
12 | + $this->builder->args = wp_parse_args( $this->builder->args, [ |
|
13 | 13 | 'name' => $this->builder->args['text'], |
14 | - ]); |
|
14 | + ] ); |
|
15 | 15 | $this->builder->tag = 'input'; |
16 | 16 | $this->mergeFieldArgs(); |
17 | 17 | return $this->builder->getOpeningTag(); |
@@ -4,38 +4,38 @@ |
||
4 | 4 | |
5 | 5 | class YesNo extends Field |
6 | 6 | { |
7 | - /** |
|
8 | - * @return string|void |
|
9 | - */ |
|
10 | - public function build() |
|
11 | - { |
|
12 | - $this->builder->tag = 'input'; |
|
13 | - $this->mergeFieldArgs(); |
|
14 | - return $this->builder->getTag(); |
|
15 | - } |
|
7 | + /** |
|
8 | + * @return string|void |
|
9 | + */ |
|
10 | + public function build() |
|
11 | + { |
|
12 | + $this->builder->tag = 'input'; |
|
13 | + $this->mergeFieldArgs(); |
|
14 | + return $this->builder->getTag(); |
|
15 | + } |
|
16 | 16 | |
17 | - /** |
|
18 | - * @return array |
|
19 | - */ |
|
20 | - public static function defaults() |
|
21 | - { |
|
22 | - return [ |
|
23 | - 'class' => 'inline', |
|
24 | - ]; |
|
25 | - } |
|
17 | + /** |
|
18 | + * @return array |
|
19 | + */ |
|
20 | + public static function defaults() |
|
21 | + { |
|
22 | + return [ |
|
23 | + 'class' => 'inline', |
|
24 | + ]; |
|
25 | + } |
|
26 | 26 | |
27 | - /** |
|
28 | - * @return array |
|
29 | - */ |
|
30 | - public static function required() |
|
31 | - { |
|
32 | - return [ |
|
33 | - 'is_multi' => true, |
|
34 | - 'options' => [ |
|
35 | - 'no' => __('No', 'site-reviews'), |
|
36 | - 'yes' => __('Yes', 'site-reviews'), |
|
37 | - ], |
|
38 | - 'type' => 'radio', |
|
39 | - ]; |
|
40 | - } |
|
27 | + /** |
|
28 | + * @return array |
|
29 | + */ |
|
30 | + public static function required() |
|
31 | + { |
|
32 | + return [ |
|
33 | + 'is_multi' => true, |
|
34 | + 'options' => [ |
|
35 | + 'no' => __('No', 'site-reviews'), |
|
36 | + 'yes' => __('Yes', 'site-reviews'), |
|
37 | + ], |
|
38 | + 'type' => 'radio', |
|
39 | + ]; |
|
40 | + } |
|
41 | 41 | } |
@@ -32,8 +32,8 @@ |
||
32 | 32 | return [ |
33 | 33 | 'is_multi' => true, |
34 | 34 | 'options' => [ |
35 | - 'no' => __('No', 'site-reviews'), |
|
36 | - 'yes' => __('Yes', 'site-reviews'), |
|
35 | + 'no' => __( 'No', 'site-reviews' ), |
|
36 | + 'yes' => __( 'Yes', 'site-reviews' ), |
|
37 | 37 | ], |
38 | 38 | 'type' => 'radio', |
39 | 39 | ]; |
@@ -4,13 +4,13 @@ |
||
4 | 4 | |
5 | 5 | class Number extends Field |
6 | 6 | { |
7 | - /** |
|
8 | - * @return array |
|
9 | - */ |
|
10 | - public static function defaults() |
|
11 | - { |
|
12 | - return [ |
|
13 | - 'class' => 'small-text', |
|
14 | - ]; |
|
15 | - } |
|
7 | + /** |
|
8 | + * @return array |
|
9 | + */ |
|
10 | + public static function defaults() |
|
11 | + { |
|
12 | + return [ |
|
13 | + 'class' => 'small-text', |
|
14 | + ]; |
|
15 | + } |
|
16 | 16 | } |
@@ -4,23 +4,23 @@ |
||
4 | 4 | |
5 | 5 | class Checkbox extends Field |
6 | 6 | { |
7 | - /** |
|
8 | - * @return array |
|
9 | - */ |
|
10 | - public static function defaults() |
|
11 | - { |
|
12 | - return [ |
|
13 | - 'value' => 1, |
|
14 | - ]; |
|
15 | - } |
|
7 | + /** |
|
8 | + * @return array |
|
9 | + */ |
|
10 | + public static function defaults() |
|
11 | + { |
|
12 | + return [ |
|
13 | + 'value' => 1, |
|
14 | + ]; |
|
15 | + } |
|
16 | 16 | |
17 | - /** |
|
18 | - * @return array |
|
19 | - */ |
|
20 | - public static function required() |
|
21 | - { |
|
22 | - return [ |
|
23 | - 'is_multi' => true, |
|
24 | - ]; |
|
25 | - } |
|
17 | + /** |
|
18 | + * @return array |
|
19 | + */ |
|
20 | + public static function required() |
|
21 | + { |
|
22 | + return [ |
|
23 | + 'is_multi' => true, |
|
24 | + ]; |
|
25 | + } |
|
26 | 26 | } |
@@ -6,73 +6,73 @@ |
||
6 | 6 | |
7 | 7 | abstract class Field |
8 | 8 | { |
9 | - /** |
|
10 | - * @var Builder |
|
11 | - */ |
|
12 | - protected $builder; |
|
9 | + /** |
|
10 | + * @var Builder |
|
11 | + */ |
|
12 | + protected $builder; |
|
13 | 13 | |
14 | - public function __construct(Builder $builder) |
|
15 | - { |
|
16 | - $this->builder = $builder; |
|
17 | - } |
|
14 | + public function __construct(Builder $builder) |
|
15 | + { |
|
16 | + $this->builder = $builder; |
|
17 | + } |
|
18 | 18 | |
19 | - /** |
|
20 | - * @return string|void |
|
21 | - */ |
|
22 | - public function build() |
|
23 | - { |
|
24 | - glsr_log()->error('Build method is not implemented for '.get_class($this)); |
|
25 | - } |
|
19 | + /** |
|
20 | + * @return string|void |
|
21 | + */ |
|
22 | + public function build() |
|
23 | + { |
|
24 | + glsr_log()->error('Build method is not implemented for '.get_class($this)); |
|
25 | + } |
|
26 | 26 | |
27 | - /** |
|
28 | - * @return array |
|
29 | - */ |
|
30 | - public static function defaults() |
|
31 | - { |
|
32 | - return []; |
|
33 | - } |
|
27 | + /** |
|
28 | + * @return array |
|
29 | + */ |
|
30 | + public static function defaults() |
|
31 | + { |
|
32 | + return []; |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * @return array |
|
37 | - */ |
|
38 | - public static function merge(array $args) |
|
39 | - { |
|
40 | - $merged = array_merge( |
|
41 | - wp_parse_args($args, static::defaults()), |
|
42 | - static::required() |
|
43 | - ); |
|
44 | - $merged['class'] = implode(' ', static::mergedAttribute('class', ' ', $args)); |
|
45 | - $merged['style'] = implode(';', static::mergedAttribute('style', ';', $args)); |
|
46 | - return $merged; |
|
47 | - } |
|
35 | + /** |
|
36 | + * @return array |
|
37 | + */ |
|
38 | + public static function merge(array $args) |
|
39 | + { |
|
40 | + $merged = array_merge( |
|
41 | + wp_parse_args($args, static::defaults()), |
|
42 | + static::required() |
|
43 | + ); |
|
44 | + $merged['class'] = implode(' ', static::mergedAttribute('class', ' ', $args)); |
|
45 | + $merged['style'] = implode(';', static::mergedAttribute('style', ';', $args)); |
|
46 | + return $merged; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * @param string $delimiter |
|
51 | - * @param string $key |
|
52 | - * @return array |
|
53 | - */ |
|
54 | - public static function mergedAttribute($key, $delimiter, array $args) |
|
55 | - { |
|
56 | - return array_filter(array_merge( |
|
57 | - explode($delimiter, glsr_get($args, $key)), |
|
58 | - explode($delimiter, glsr_get(static::defaults(), $key)), |
|
59 | - explode($delimiter, glsr_get(static::required(), $key)) |
|
60 | - )); |
|
61 | - } |
|
49 | + /** |
|
50 | + * @param string $delimiter |
|
51 | + * @param string $key |
|
52 | + * @return array |
|
53 | + */ |
|
54 | + public static function mergedAttribute($key, $delimiter, array $args) |
|
55 | + { |
|
56 | + return array_filter(array_merge( |
|
57 | + explode($delimiter, glsr_get($args, $key)), |
|
58 | + explode($delimiter, glsr_get(static::defaults(), $key)), |
|
59 | + explode($delimiter, glsr_get(static::required(), $key)) |
|
60 | + )); |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * @return array |
|
65 | - */ |
|
66 | - public static function required() |
|
67 | - { |
|
68 | - return []; |
|
69 | - } |
|
63 | + /** |
|
64 | + * @return array |
|
65 | + */ |
|
66 | + public static function required() |
|
67 | + { |
|
68 | + return []; |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * @return void |
|
73 | - */ |
|
74 | - protected function mergeFieldArgs() |
|
75 | - { |
|
76 | - $this->builder->args = static::merge($this->builder->args); |
|
77 | - } |
|
71 | + /** |
|
72 | + * @return void |
|
73 | + */ |
|
74 | + protected function mergeFieldArgs() |
|
75 | + { |
|
76 | + $this->builder->args = static::merge($this->builder->args); |
|
77 | + } |
|
78 | 78 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | protected $builder; |
13 | 13 | |
14 | - public function __construct(Builder $builder) |
|
14 | + public function __construct( Builder $builder ) |
|
15 | 15 | { |
16 | 16 | $this->builder = $builder; |
17 | 17 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function build() |
23 | 23 | { |
24 | - glsr_log()->error('Build method is not implemented for '.get_class($this)); |
|
24 | + glsr_log()->error( 'Build method is not implemented for '.get_class( $this ) ); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -35,14 +35,14 @@ discard block |
||
35 | 35 | /** |
36 | 36 | * @return array |
37 | 37 | */ |
38 | - public static function merge(array $args) |
|
38 | + public static function merge( array $args ) |
|
39 | 39 | { |
40 | 40 | $merged = array_merge( |
41 | - wp_parse_args($args, static::defaults()), |
|
41 | + wp_parse_args( $args, static::defaults() ), |
|
42 | 42 | static::required() |
43 | 43 | ); |
44 | - $merged['class'] = implode(' ', static::mergedAttribute('class', ' ', $args)); |
|
45 | - $merged['style'] = implode(';', static::mergedAttribute('style', ';', $args)); |
|
44 | + $merged['class'] = implode( ' ', static::mergedAttribute( 'class', ' ', $args ) ); |
|
45 | + $merged['style'] = implode( ';', static::mergedAttribute( 'style', ';', $args ) ); |
|
46 | 46 | return $merged; |
47 | 47 | } |
48 | 48 | |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | * @param string $key |
52 | 52 | * @return array |
53 | 53 | */ |
54 | - public static function mergedAttribute($key, $delimiter, array $args) |
|
54 | + public static function mergedAttribute( $key, $delimiter, array $args ) |
|
55 | 55 | { |
56 | - return array_filter(array_merge( |
|
57 | - explode($delimiter, glsr_get($args, $key)), |
|
58 | - explode($delimiter, glsr_get(static::defaults(), $key)), |
|
59 | - explode($delimiter, glsr_get(static::required(), $key)) |
|
60 | - )); |
|
56 | + return array_filter( array_merge( |
|
57 | + explode( $delimiter, glsr_get( $args, $key ) ), |
|
58 | + explode( $delimiter, glsr_get( static::defaults(), $key ) ), |
|
59 | + explode( $delimiter, glsr_get( static::required(), $key ) ) |
|
60 | + ) ); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -73,6 +73,6 @@ discard block |
||
73 | 73 | */ |
74 | 74 | protected function mergeFieldArgs() |
75 | 75 | { |
76 | - $this->builder->args = static::merge($this->builder->args); |
|
76 | + $this->builder->args = static::merge( $this->builder->args ); |
|
77 | 77 | } |
78 | 78 | } |
@@ -6,29 +6,29 @@ |
||
6 | 6 | |
7 | 7 | class Rating extends Field |
8 | 8 | { |
9 | - /** |
|
10 | - * @return string|void |
|
11 | - */ |
|
12 | - public function build() |
|
13 | - { |
|
14 | - $this->builder->tag = 'select'; |
|
15 | - $this->mergeFieldArgs(); |
|
16 | - return $this->builder->getTag(); |
|
17 | - } |
|
9 | + /** |
|
10 | + * @return string|void |
|
11 | + */ |
|
12 | + public function build() |
|
13 | + { |
|
14 | + $this->builder->tag = 'select'; |
|
15 | + $this->mergeFieldArgs(); |
|
16 | + return $this->builder->getTag(); |
|
17 | + } |
|
18 | 18 | |
19 | - /** |
|
20 | - * @return array |
|
21 | - */ |
|
22 | - public static function required() |
|
23 | - { |
|
24 | - $options = ['' => __('Select a Rating', 'site-reviews')]; |
|
25 | - foreach (range(glsr()->constant('MAX_RATING', RatingModule::class), 1) as $rating) { |
|
26 | - $options[$rating] = sprintf(_n('%s Star', '%s Stars', $rating, 'site-reviews'), $rating); |
|
27 | - } |
|
28 | - return [ |
|
29 | - 'class' => 'glsr-star-rating', |
|
30 | - 'options' => $options, |
|
31 | - 'type' => 'select', |
|
32 | - ]; |
|
33 | - } |
|
19 | + /** |
|
20 | + * @return array |
|
21 | + */ |
|
22 | + public static function required() |
|
23 | + { |
|
24 | + $options = ['' => __('Select a Rating', 'site-reviews')]; |
|
25 | + foreach (range(glsr()->constant('MAX_RATING', RatingModule::class), 1) as $rating) { |
|
26 | + $options[$rating] = sprintf(_n('%s Star', '%s Stars', $rating, 'site-reviews'), $rating); |
|
27 | + } |
|
28 | + return [ |
|
29 | + 'class' => 'glsr-star-rating', |
|
30 | + 'options' => $options, |
|
31 | + 'type' => 'select', |
|
32 | + ]; |
|
33 | + } |
|
34 | 34 | } |
@@ -21,9 +21,9 @@ |
||
21 | 21 | */ |
22 | 22 | public static function required() |
23 | 23 | { |
24 | - $options = ['' => __('Select a Rating', 'site-reviews')]; |
|
25 | - foreach (range(glsr()->constant('MAX_RATING', RatingModule::class), 1) as $rating) { |
|
26 | - $options[$rating] = sprintf(_n('%s Star', '%s Stars', $rating, 'site-reviews'), $rating); |
|
24 | + $options = ['' => __( 'Select a Rating', 'site-reviews' )]; |
|
25 | + foreach( range( glsr()->constant( 'MAX_RATING', RatingModule::class ), 1 ) as $rating ) { |
|
26 | + $options[$rating] = sprintf( _n( '%s Star', '%s Stars', $rating, 'site-reviews' ), $rating ); |
|
27 | 27 | } |
28 | 28 | return [ |
29 | 29 | 'class' => 'glsr-star-rating', |
@@ -6,30 +6,30 @@ |
||
6 | 6 | |
7 | 7 | class Partial |
8 | 8 | { |
9 | - /** |
|
10 | - * @param string $partialPath |
|
11 | - * @return string |
|
12 | - */ |
|
13 | - public function build($partialPath, array $args = []) |
|
14 | - { |
|
15 | - $className = glsr(Helper::class)->buildClassName($partialPath, 'Modules\Html\Partials'); |
|
16 | - if (!class_exists($className)) { |
|
17 | - glsr_log()->error('Partial missing: '.$className); |
|
18 | - return; |
|
19 | - } |
|
20 | - $args = apply_filters('site-reviews/partial/args/'.$partialPath, $args); |
|
21 | - $partial = glsr($className)->build($args); |
|
22 | - $partial = apply_filters('site-reviews/rendered/partial', $partial, $partialPath, $args); |
|
23 | - $partial = apply_filters('site-reviews/rendered/partial/'.$partialPath, $partial, $args); |
|
24 | - return $partial; |
|
25 | - } |
|
9 | + /** |
|
10 | + * @param string $partialPath |
|
11 | + * @return string |
|
12 | + */ |
|
13 | + public function build($partialPath, array $args = []) |
|
14 | + { |
|
15 | + $className = glsr(Helper::class)->buildClassName($partialPath, 'Modules\Html\Partials'); |
|
16 | + if (!class_exists($className)) { |
|
17 | + glsr_log()->error('Partial missing: '.$className); |
|
18 | + return; |
|
19 | + } |
|
20 | + $args = apply_filters('site-reviews/partial/args/'.$partialPath, $args); |
|
21 | + $partial = glsr($className)->build($args); |
|
22 | + $partial = apply_filters('site-reviews/rendered/partial', $partial, $partialPath, $args); |
|
23 | + $partial = apply_filters('site-reviews/rendered/partial/'.$partialPath, $partial, $args); |
|
24 | + return $partial; |
|
25 | + } |
|
26 | 26 | |
27 | - /** |
|
28 | - * @param string $partialPath |
|
29 | - * @return void |
|
30 | - */ |
|
31 | - public function render($partialPath, array $args = []) |
|
32 | - { |
|
33 | - echo $this->build($partialPath, $args); |
|
34 | - } |
|
27 | + /** |
|
28 | + * @param string $partialPath |
|
29 | + * @return void |
|
30 | + */ |
|
31 | + public function render($partialPath, array $args = []) |
|
32 | + { |
|
33 | + echo $this->build($partialPath, $args); |
|
34 | + } |
|
35 | 35 | } |
@@ -10,17 +10,17 @@ discard block |
||
10 | 10 | * @param string $partialPath |
11 | 11 | * @return string |
12 | 12 | */ |
13 | - public function build($partialPath, array $args = []) |
|
13 | + public function build( $partialPath, array $args = [] ) |
|
14 | 14 | { |
15 | - $className = glsr(Helper::class)->buildClassName($partialPath, 'Modules\Html\Partials'); |
|
16 | - if (!class_exists($className)) { |
|
17 | - glsr_log()->error('Partial missing: '.$className); |
|
15 | + $className = glsr( Helper::class )->buildClassName( $partialPath, 'Modules\Html\Partials' ); |
|
16 | + if( !class_exists( $className ) ) { |
|
17 | + glsr_log()->error( 'Partial missing: '.$className ); |
|
18 | 18 | return; |
19 | 19 | } |
20 | - $args = apply_filters('site-reviews/partial/args/'.$partialPath, $args); |
|
21 | - $partial = glsr($className)->build($args); |
|
22 | - $partial = apply_filters('site-reviews/rendered/partial', $partial, $partialPath, $args); |
|
23 | - $partial = apply_filters('site-reviews/rendered/partial/'.$partialPath, $partial, $args); |
|
20 | + $args = apply_filters( 'site-reviews/partial/args/'.$partialPath, $args ); |
|
21 | + $partial = glsr( $className )->build( $args ); |
|
22 | + $partial = apply_filters( 'site-reviews/rendered/partial', $partial, $partialPath, $args ); |
|
23 | + $partial = apply_filters( 'site-reviews/rendered/partial/'.$partialPath, $partial, $args ); |
|
24 | 24 | return $partial; |
25 | 25 | } |
26 | 26 | |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | * @param string $partialPath |
29 | 29 | * @return void |
30 | 30 | */ |
31 | - public function render($partialPath, array $args = []) |
|
31 | + public function render( $partialPath, array $args = [] ) |
|
32 | 32 | { |
33 | - echo $this->build($partialPath, $args); |
|
33 | + echo $this->build( $partialPath, $args ); |
|
34 | 34 | } |
35 | 35 | } |
@@ -4,36 +4,36 @@ |
||
4 | 4 | |
5 | 5 | class Form |
6 | 6 | { |
7 | - /** |
|
8 | - * @param string $id |
|
9 | - * @return string |
|
10 | - */ |
|
11 | - public function buildFields($id) |
|
12 | - { |
|
13 | - return array_reduce($this->getFields($id), function ($carry, $field) { |
|
14 | - return $carry.$field; |
|
15 | - }); |
|
16 | - } |
|
7 | + /** |
|
8 | + * @param string $id |
|
9 | + * @return string |
|
10 | + */ |
|
11 | + public function buildFields($id) |
|
12 | + { |
|
13 | + return array_reduce($this->getFields($id), function ($carry, $field) { |
|
14 | + return $carry.$field; |
|
15 | + }); |
|
16 | + } |
|
17 | 17 | |
18 | - /** |
|
19 | - * @param string $id |
|
20 | - * @return array |
|
21 | - */ |
|
22 | - public function getFields($id) |
|
23 | - { |
|
24 | - $fields = []; |
|
25 | - foreach (glsr()->config('forms/'.$id) as $name => $field) { |
|
26 | - $fields[] = new Field(wp_parse_args($field, ['name' => $name])); |
|
27 | - } |
|
28 | - return $fields; |
|
29 | - } |
|
18 | + /** |
|
19 | + * @param string $id |
|
20 | + * @return array |
|
21 | + */ |
|
22 | + public function getFields($id) |
|
23 | + { |
|
24 | + $fields = []; |
|
25 | + foreach (glsr()->config('forms/'.$id) as $name => $field) { |
|
26 | + $fields[] = new Field(wp_parse_args($field, ['name' => $name])); |
|
27 | + } |
|
28 | + return $fields; |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * @param string $id |
|
33 | - * @return void |
|
34 | - */ |
|
35 | - public function renderFields($id) |
|
36 | - { |
|
37 | - echo $this->buildFields($id); |
|
38 | - } |
|
31 | + /** |
|
32 | + * @param string $id |
|
33 | + * @return void |
|
34 | + */ |
|
35 | + public function renderFields($id) |
|
36 | + { |
|
37 | + echo $this->buildFields($id); |
|
38 | + } |
|
39 | 39 | } |
@@ -8,9 +8,9 @@ discard block |
||
8 | 8 | * @param string $id |
9 | 9 | * @return string |
10 | 10 | */ |
11 | - public function buildFields($id) |
|
11 | + public function buildFields( $id ) |
|
12 | 12 | { |
13 | - return array_reduce($this->getFields($id), function ($carry, $field) { |
|
13 | + return array_reduce( $this->getFields( $id ), function( $carry, $field ) { |
|
14 | 14 | return $carry.$field; |
15 | 15 | }); |
16 | 16 | } |
@@ -19,11 +19,11 @@ discard block |
||
19 | 19 | * @param string $id |
20 | 20 | * @return array |
21 | 21 | */ |
22 | - public function getFields($id) |
|
22 | + public function getFields( $id ) |
|
23 | 23 | { |
24 | 24 | $fields = []; |
25 | - foreach (glsr()->config('forms/'.$id) as $name => $field) { |
|
26 | - $fields[] = new Field(wp_parse_args($field, ['name' => $name])); |
|
25 | + foreach( glsr()->config( 'forms/'.$id ) as $name => $field ) { |
|
26 | + $fields[] = new Field( wp_parse_args( $field, ['name' => $name] ) ); |
|
27 | 27 | } |
28 | 28 | return $fields; |
29 | 29 | } |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | * @param string $id |
33 | 33 | * @return void |
34 | 34 | */ |
35 | - public function renderFields($id) |
|
35 | + public function renderFields( $id ) |
|
36 | 36 | { |
37 | - echo $this->buildFields($id); |
|
37 | + echo $this->buildFields( $id ); |
|
38 | 38 | } |
39 | 39 | } |
@@ -6,17 +6,17 @@ |
||
6 | 6 | |
7 | 7 | class StarRating implements PartialContract |
8 | 8 | { |
9 | - /** |
|
10 | - * @return void|string |
|
11 | - */ |
|
12 | - public function build(array $args = []) |
|
13 | - { |
|
14 | - require_once ABSPATH.'wp-admin/includes/template.php'; |
|
15 | - ob_start(); |
|
16 | - wp_star_rating($args); |
|
17 | - $stars = ob_get_clean(); |
|
18 | - return !glsr()->isAdmin() |
|
19 | - ? str_replace(['star-rating', 'star star'], ['glsr-stars', 'glsr-star glsr-star'], $stars) |
|
20 | - : $stars; |
|
21 | - } |
|
9 | + /** |
|
10 | + * @return void|string |
|
11 | + */ |
|
12 | + public function build(array $args = []) |
|
13 | + { |
|
14 | + require_once ABSPATH.'wp-admin/includes/template.php'; |
|
15 | + ob_start(); |
|
16 | + wp_star_rating($args); |
|
17 | + $stars = ob_get_clean(); |
|
18 | + return !glsr()->isAdmin() |
|
19 | + ? str_replace(['star-rating', 'star star'], ['glsr-stars', 'glsr-star glsr-star'], $stars) |
|
20 | + : $stars; |
|
21 | + } |
|
22 | 22 | } |
@@ -9,14 +9,14 @@ |
||
9 | 9 | /** |
10 | 10 | * @return void|string |
11 | 11 | */ |
12 | - public function build(array $args = []) |
|
12 | + public function build( array $args = [] ) |
|
13 | 13 | { |
14 | 14 | require_once ABSPATH.'wp-admin/includes/template.php'; |
15 | 15 | ob_start(); |
16 | - wp_star_rating($args); |
|
16 | + wp_star_rating( $args ); |
|
17 | 17 | $stars = ob_get_clean(); |
18 | 18 | return !glsr()->isAdmin() |
19 | - ? str_replace(['star-rating', 'star star'], ['glsr-stars', 'glsr-star glsr-star'], $stars) |
|
19 | + ? str_replace( ['star-rating', 'star star'], ['glsr-stars', 'glsr-star glsr-star'], $stars ) |
|
20 | 20 | : $stars; |
21 | 21 | } |
22 | 22 | } |