@@ -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 | ]; |
@@ -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', |
@@ -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 | } |
@@ -9,5 +9,5 @@ |
||
| 9 | 9 | /** |
| 10 | 10 | * @return void |
| 11 | 11 | */ |
| 12 | - public function register(Application $app); |
|
| 12 | + public function register( Application $app ); |
|
| 13 | 13 | } |
@@ -12,11 +12,11 @@ |
||
| 12 | 12 | protected function defaults() |
| 13 | 13 | { |
| 14 | 14 | return [ |
| 15 | - 'before_page_number' => '<span class="meta-nav screen-reader-text">'.__('Page', 'site-reviews').' </span>', |
|
| 16 | - 'format' => '?'.glsr()->constant('PAGED_QUERY_VAR').'=%#%', |
|
| 15 | + 'before_page_number' => '<span class="meta-nav screen-reader-text">'.__( 'Page', 'site-reviews' ).' </span>', |
|
| 16 | + 'format' => '?'.glsr()->constant( 'PAGED_QUERY_VAR' ).'=%#%', |
|
| 17 | 17 | 'mid_size' => 1, |
| 18 | - 'next_text' => __('Next →', 'site-reviews'), |
|
| 19 | - 'prev_text' => __('← Previous', 'site-reviews'), |
|
| 18 | + 'next_text' => __( 'Next →', 'site-reviews' ), |
|
| 19 | + 'prev_text' => __( '← Previous', 'site-reviews' ), |
|
| 20 | 20 | 'type' => 'plain', |
| 21 | 21 | ]; |
| 22 | 22 | } |
@@ -12,18 +12,18 @@ |
||
| 12 | 12 | protected function defaults() |
| 13 | 13 | { |
| 14 | 14 | return [ |
| 15 | - 'accepted' => __('This field must be accepted.', 'site-reviews'), |
|
| 16 | - 'between' => __('This field value must be between %s and %s.', 'site-reviews'), |
|
| 17 | - 'betweenlength' => __('This field must have between %s and %s characters.', 'site-reviews'), |
|
| 18 | - 'email' => __('This field requires a valid e-mail address.', 'site-reviews'), |
|
| 19 | - 'errors' => __('Please fix the submission errors.', 'site-reviews'), |
|
| 20 | - 'max' => __('Maximum value for this field is %s.', 'site-reviews'), |
|
| 21 | - 'maxlength' => __('This field allows a maximum of %s characters.', 'site-reviews'), |
|
| 22 | - 'min' => __('Minimum value for this field is %s.', 'site-reviews'), |
|
| 23 | - 'minlength' => __('This field requires a minimum of %s characters.', 'site-reviews'), |
|
| 24 | - 'number' => __('This field requires a number.', 'site-reviews'), |
|
| 25 | - 'required' => __('This field is required.', 'site-reviews'), |
|
| 26 | - 'unsupported' => __('The review could not be submitted (unsupported browser).', 'site-reviews'), |
|
| 15 | + 'accepted' => __( 'This field must be accepted.', 'site-reviews' ), |
|
| 16 | + 'between' => __( 'This field value must be between %s and %s.', 'site-reviews' ), |
|
| 17 | + 'betweenlength' => __( 'This field must have between %s and %s characters.', 'site-reviews' ), |
|
| 18 | + 'email' => __( 'This field requires a valid e-mail address.', 'site-reviews' ), |
|
| 19 | + 'errors' => __( 'Please fix the submission errors.', 'site-reviews' ), |
|
| 20 | + 'max' => __( 'Maximum value for this field is %s.', 'site-reviews' ), |
|
| 21 | + 'maxlength' => __( 'This field allows a maximum of %s characters.', 'site-reviews' ), |
|
| 22 | + 'min' => __( 'Minimum value for this field is %s.', 'site-reviews' ), |
|
| 23 | + 'minlength' => __( 'This field requires a minimum of %s characters.', 'site-reviews' ), |
|
| 24 | + 'number' => __( 'This field requires a number.', 'site-reviews' ), |
|
| 25 | + 'required' => __( 'This field is required.', 'site-reviews' ), |
|
| 26 | + 'unsupported' => __( 'The review could not be submitted (unsupported browser).', 'site-reviews' ), |
|
| 27 | 27 | ]; |
| 28 | 28 | } |
| 29 | 29 | } |
@@ -12,11 +12,11 @@ |
||
| 12 | 12 | protected function defaults() |
| 13 | 13 | { |
| 14 | 14 | return [ |
| 15 | - 'button_text' => __('View Review', 'site-reviews'), |
|
| 15 | + 'button_text' => __( 'View Review', 'site-reviews' ), |
|
| 16 | 16 | 'button_url' => '', |
| 17 | 17 | 'color' => '#665068', |
| 18 | 18 | 'fallback' => '', |
| 19 | - 'icon_url' => glsr()->url('assets/images/icon.png'), |
|
| 19 | + 'icon_url' => glsr()->url( 'assets/images/icon.png' ), |
|
| 20 | 20 | 'pretext' => '', |
| 21 | 21 | 'username' => glsr()->name, |
| 22 | 22 | ]; |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | { |
| 14 | 14 | public function __construct() |
| 15 | 15 | { |
| 16 | - $this->meta = new WP_REST_Term_Meta_Fields(Application::TAXONOMY); |
|
| 16 | + $this->meta = new WP_REST_Term_Meta_Fields( Application::TAXONOMY ); |
|
| 17 | 17 | $this->namespace = Application::ID.'/v1'; |
| 18 | 18 | $this->rest_base = 'categories'; |
| 19 | 19 | $this->taxonomy = Application::TAXONOMY; |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | public function register_routes() |
| 26 | 26 | { |
| 27 | - register_rest_route($this->namespace, '/'.$this->rest_base, [ |
|
| 27 | + register_rest_route( $this->namespace, '/'.$this->rest_base, [ |
|
| 28 | 28 | [ |
| 29 | 29 | 'args' => $this->get_collection_params(), |
| 30 | 30 | 'callback' => [$this, 'get_items'], |
@@ -32,6 +32,6 @@ discard block |
||
| 32 | 32 | 'permission_callback' => [$this, 'get_items_permissions_check'], |
| 33 | 33 | ], |
| 34 | 34 | 'schema' => [$this, 'get_public_item_schema'], |
| 35 | - ]); |
|
| 35 | + ] ); |
|
| 36 | 36 | } |
| 37 | 37 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | { |
| 15 | 15 | public function __construct() |
| 16 | 16 | { |
| 17 | - $this->meta = new WP_REST_Post_Meta_Fields(Application::POST_TYPE); |
|
| 17 | + $this->meta = new WP_REST_Post_Meta_Fields( Application::POST_TYPE ); |
|
| 18 | 18 | $this->namespace = Application::ID.'/v1'; |
| 19 | 19 | $this->post_type = Application::POST_TYPE; |
| 20 | 20 | $this->rest_base = 'reviews'; |
@@ -29,9 +29,9 @@ discard block |
||
| 29 | 29 | // ['callback' => [$this, 'createReview'], 'methods' => Server::CREATABLE], |
| 30 | 30 | // ['callback' => [$this, 'getReviews'], 'methods' => Server::READABLE], |
| 31 | 31 | // ]); |
| 32 | - register_rest_route($this->namespace, '/types', [ |
|
| 32 | + register_rest_route( $this->namespace, '/types', [ |
|
| 33 | 33 | ['callback' => [$this, 'getReviewTypes'], 'methods' => Server::READABLE], |
| 34 | - ]); |
|
| 34 | + ] ); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | public function createReview() |
| 41 | 41 | { |
| 42 | 42 | $response = []; |
| 43 | - return rest_ensure_response($response); |
|
| 43 | + return rest_ensure_response( $response ); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | public function getReviews() |
| 50 | 50 | { |
| 51 | 51 | $response = []; |
| 52 | - return rest_ensure_response($response); |
|
| 52 | + return rest_ensure_response( $response ); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -58,12 +58,12 @@ discard block |
||
| 58 | 58 | public function getReviewTypes() |
| 59 | 59 | { |
| 60 | 60 | $response = []; |
| 61 | - foreach (glsr()->reviewTypes as $slug => $name) { |
|
| 61 | + foreach( glsr()->reviewTypes as $slug => $name ) { |
|
| 62 | 62 | $response[] = [ |
| 63 | 63 | 'name' => $name, |
| 64 | 64 | 'slug' => $slug, |
| 65 | 65 | ]; |
| 66 | 66 | } |
| 67 | - return rest_ensure_response($response); |
|
| 67 | + return rest_ensure_response( $response ); |
|
| 68 | 68 | } |
| 69 | 69 | } |