@@ -15,10 +15,10 @@ discard block |
||
15 | 15 | public $postType; |
16 | 16 | public $single; |
17 | 17 | |
18 | - public function __construct($input) |
|
18 | + public function __construct( $input ) |
|
19 | 19 | { |
20 | - $args = glsr(PostTypeDefaults::class)->merge($input); |
|
21 | - $this->normalize($args); |
|
20 | + $args = glsr( PostTypeDefaults::class )->merge( $input ); |
|
21 | + $this->normalize( $args ); |
|
22 | 22 | $this->normalizeColumns(); |
23 | 23 | $this->normalizeLabels(); |
24 | 24 | } |
@@ -26,19 +26,19 @@ discard block |
||
26 | 26 | /** |
27 | 27 | * @return void |
28 | 28 | */ |
29 | - protected function normalize(array $args) |
|
29 | + protected function normalize( array $args ) |
|
30 | 30 | { |
31 | - foreach ($args as $key => $value) { |
|
32 | - $property = glsr(Helper::class)->buildPropertyName($key); |
|
33 | - if (!property_exists($this, $property)) { |
|
31 | + foreach( $args as $key => $value ) { |
|
32 | + $property = glsr( Helper::class )->buildPropertyName( $key ); |
|
33 | + if( !property_exists( $this, $property ) ) { |
|
34 | 34 | continue; |
35 | 35 | } |
36 | 36 | $this->$property = $value; |
37 | 37 | unset($args[$key]); |
38 | 38 | } |
39 | - $this->args = wp_parse_args($args, [ |
|
39 | + $this->args = wp_parse_args( $args, [ |
|
40 | 40 | 'menu_name' => $this->plural, |
41 | - ]); |
|
41 | + ] ); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -46,22 +46,22 @@ discard block |
||
46 | 46 | */ |
47 | 47 | protected function normalizeLabels() |
48 | 48 | { |
49 | - $this->args['labels'] = wp_parse_args($this->args['labels'], [ |
|
50 | - 'add_new_item' => sprintf(_x('Add New %s', 'Add New Post', 'site-reviews'), $this->plural), |
|
51 | - 'all_items' => sprintf(_x('All %s', 'All Posts', 'site-reviews'), $this->plural), |
|
52 | - 'archives' => sprintf(_x('%s Archives', 'Post Archives', 'site-reviews'), $this->single), |
|
53 | - 'edit_item' => sprintf(_x('Edit %s', 'Edit Post', 'site-reviews'), $this->single), |
|
54 | - 'insert_into_item' => sprintf(_x('Insert into %s', 'Insert into Post', 'site-reviews'), $this->single), |
|
49 | + $this->args['labels'] = wp_parse_args( $this->args['labels'], [ |
|
50 | + 'add_new_item' => sprintf( _x( 'Add New %s', 'Add New Post', 'site-reviews' ), $this->plural ), |
|
51 | + 'all_items' => sprintf( _x( 'All %s', 'All Posts', 'site-reviews' ), $this->plural ), |
|
52 | + 'archives' => sprintf( _x( '%s Archives', 'Post Archives', 'site-reviews' ), $this->single ), |
|
53 | + 'edit_item' => sprintf( _x( 'Edit %s', 'Edit Post', 'site-reviews' ), $this->single ), |
|
54 | + 'insert_into_item' => sprintf( _x( 'Insert into %s', 'Insert into Post', 'site-reviews' ), $this->single ), |
|
55 | 55 | 'menu_name' => $this->args['menu_name'], |
56 | 56 | 'name' => $this->plural, |
57 | - 'new_item' => sprintf(_x('New %s', 'New Post', 'site-reviews'), $this->single), |
|
58 | - 'not_found' => sprintf(_x('No %s found', 'No Posts found', 'site-reviews'), $this->plural), |
|
59 | - 'not_found_in_trash' => sprintf(_x('No %s found in Trash', 'No Posts found in Trash', 'site-reviews'), $this->plural), |
|
60 | - 'search_items' => sprintf(_x('Search %s', 'Search Posts', 'site-reviews'), $this->plural), |
|
57 | + 'new_item' => sprintf( _x( 'New %s', 'New Post', 'site-reviews' ), $this->single ), |
|
58 | + 'not_found' => sprintf( _x( 'No %s found', 'No Posts found', 'site-reviews' ), $this->plural ), |
|
59 | + 'not_found_in_trash' => sprintf( _x( 'No %s found in Trash', 'No Posts found in Trash', 'site-reviews' ), $this->plural ), |
|
60 | + 'search_items' => sprintf( _x( 'Search %s', 'Search Posts', 'site-reviews' ), $this->plural ), |
|
61 | 61 | 'singular_name' => $this->single, |
62 | - 'uploaded_to_this_item' => sprintf(_x('Uploaded to this %s', 'Uploaded to this Post', 'site-reviews'), $this->single), |
|
63 | - 'view_item' => sprintf(_x('View %s', 'View Post', 'site-reviews'), $this->single), |
|
64 | - ]); |
|
62 | + 'uploaded_to_this_item' => sprintf( _x( 'Uploaded to this %s', 'Uploaded to this Post', 'site-reviews' ), $this->single ), |
|
63 | + 'view_item' => sprintf( _x( 'View %s', 'View Post', 'site-reviews' ), $this->single ), |
|
64 | + ] ); |
|
65 | 65 | unset($this->args['menu_name']); |
66 | 66 | } |
67 | 67 | |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | protected function normalizeColumns() |
72 | 72 | { |
73 | 73 | $this->columns = ['cb' => ''] + $this->columns; |
74 | - if (array_key_exists('category', $this->columns)) { |
|
75 | - $keys = array_keys($this->columns); |
|
76 | - $keys[array_search('category', $keys)] = 'taxonomy-'.Application::TAXONOMY; |
|
77 | - $this->columns = array_combine($keys, $this->columns); |
|
74 | + if( array_key_exists( 'category', $this->columns ) ) { |
|
75 | + $keys = array_keys( $this->columns ); |
|
76 | + $keys[array_search( 'category', $keys )] = 'taxonomy-'.Application::TAXONOMY; |
|
77 | + $this->columns = array_combine( $keys, $this->columns ); |
|
78 | 78 | } |
79 | - if (array_key_exists('pinned', $this->columns)) { |
|
80 | - $this->columns['pinned'] = glsr(Builder::class)->span('<span>'.$this->columns['pinned'].'</span>', |
|
79 | + if( array_key_exists( 'pinned', $this->columns ) ) { |
|
80 | + $this->columns['pinned'] = glsr( Builder::class )->span( '<span>'.$this->columns['pinned'].'</span>', |
|
81 | 81 | ['class' => 'pinned-icon'] |
82 | 82 | ); |
83 | 83 | } |
@@ -6,7 +6,7 @@ |
||
6 | 6 | { |
7 | 7 | public $shortcodes; |
8 | 8 | |
9 | - public function __construct($input) |
|
9 | + public function __construct( $input ) |
|
10 | 10 | { |
11 | 11 | $this->shortcodes = $input; |
12 | 12 | } |
@@ -2,32 +2,32 @@ |
||
2 | 2 | |
3 | 3 | return [ |
4 | 4 | 'rating' => [ |
5 | - 'label' => __('Your overall rating', 'site-reviews'), |
|
5 | + 'label' => __( 'Your overall rating', 'site-reviews' ), |
|
6 | 6 | 'type' => 'rating', |
7 | 7 | ], |
8 | 8 | 'title' => [ |
9 | - 'label' => __('Title of your review', 'site-reviews'), |
|
10 | - 'placeholder' => __('Summarize your review or highlight an interesting detail', 'site-reviews'), |
|
9 | + 'label' => __( 'Title of your review', 'site-reviews' ), |
|
10 | + 'placeholder' => __( 'Summarize your review or highlight an interesting detail', 'site-reviews' ), |
|
11 | 11 | 'type' => 'text', |
12 | 12 | ], |
13 | 13 | 'content' => [ |
14 | - 'label' => __('Your review', 'site-reviews'), |
|
15 | - 'placeholder' => __('Tell people your review', 'site-reviews'), |
|
14 | + 'label' => __( 'Your review', 'site-reviews' ), |
|
15 | + 'placeholder' => __( 'Tell people your review', 'site-reviews' ), |
|
16 | 16 | 'rows' => 5, |
17 | 17 | 'type' => 'textarea', |
18 | 18 | ], |
19 | 19 | 'name' => [ |
20 | - 'label' => __('Your name', 'site-reviews'), |
|
21 | - 'placeholder' => __('Tell us your name', 'site-reviews'), |
|
20 | + 'label' => __( 'Your name', 'site-reviews' ), |
|
21 | + 'placeholder' => __( 'Tell us your name', 'site-reviews' ), |
|
22 | 22 | 'type' => 'text', |
23 | 23 | ], |
24 | 24 | 'email' => [ |
25 | - 'label' => __('Your email', 'site-reviews'), |
|
26 | - 'placeholder' => __('Tell us your email', 'site-reviews'), |
|
25 | + 'label' => __( 'Your email', 'site-reviews' ), |
|
26 | + 'placeholder' => __( 'Tell us your email', 'site-reviews' ), |
|
27 | 27 | 'type' => 'email', |
28 | 28 | ], |
29 | 29 | 'terms' => [ |
30 | - 'label' => __('This review is based on my own experience and is my genuine opinion.', 'site-reviews'), |
|
30 | + 'label' => __( 'This review is based on my own experience and is my genuine opinion.', 'site-reviews' ), |
|
31 | 31 | 'type' => 'checkbox', |
32 | 32 | ], |
33 | 33 | ]; |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | return [ |
4 | - ':star-empty' => glsr()->url('assets/images/star-empty.svg'), |
|
5 | - ':star-error' => glsr()->url('assets/images/star-error.svg'), |
|
6 | - ':star-full' => glsr()->url('assets/images/star-full.svg'), |
|
7 | - ':star-half' => glsr()->url('assets/images/star-half.svg'), |
|
4 | + ':star-empty' => glsr()->url( 'assets/images/star-empty.svg' ), |
|
5 | + ':star-error' => glsr()->url( 'assets/images/star-error.svg' ), |
|
6 | + ':star-full' => glsr()->url( 'assets/images/star-full.svg' ), |
|
7 | + ':star-half' => glsr()->url( 'assets/images/star-half.svg' ), |
|
8 | 8 | ]; |
@@ -1,4 +1,4 @@ |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | 3 | <tr class="glsr-field {{ class }}"> |
4 | 4 | <th scope="row">{{ label }}</th> |
@@ -1,4 +1,4 @@ |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | 3 | <button type="submit" class="glsr-button btn btn-primary"> |
4 | 4 | <span class="glsr-button-loading"></span> |
@@ -1,4 +1,4 @@ |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | 3 | <div class="glsr-field form-group {{ class }}"> |
4 | 4 | {{ label }} |
@@ -1,4 +1,4 @@ |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | 3 | <p class="glsr-field {{ class }}"> |
4 | 4 | {{ label }} |
@@ -1,4 +1,4 @@ |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | 3 | <p class="glsr-field {{ class }}"> |
4 | 4 | {{ label }} |