@@ -1,37 +1,37 @@ discard block |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | 3 | <form method="post" class="glsr-form-sync glsr-status"> |
4 | - <?php $selected = key($services); ?> |
|
4 | + <?php $selected = key( $services ); ?> |
|
5 | 5 | <table class="wp-list-table widefat fixed striped"> |
6 | 6 | <thead> |
7 | 7 | <tr> |
8 | 8 | <td class="check-column glsr-radio-column"><span class="dashicons-before dashicons-update"></span></td> |
9 | - <th scope="col" class="column-primary"><?= __('Service', 'site-reviews'); ?></th> |
|
10 | - <th scope="col" class="column-total_fetched"><?= __('Reviews', 'site-reviews'); ?></th> |
|
11 | - <th scope="col" class="column-last_sync"><?= __('Last Sync', 'site-reviews'); ?></th> |
|
9 | + <th scope="col" class="column-primary"><?= __( 'Service', 'site-reviews' ); ?></th> |
|
10 | + <th scope="col" class="column-total_fetched"><?= __( 'Reviews', 'site-reviews' ); ?></th> |
|
11 | + <th scope="col" class="column-last_sync"><?= __( 'Last Sync', 'site-reviews' ); ?></th> |
|
12 | 12 | </tr> |
13 | 13 | </thead> |
14 | 14 | <tbody> |
15 | - <?php foreach ($services as $slug => $details) : ?> |
|
15 | + <?php foreach( $services as $slug => $details ) : ?> |
|
16 | 16 | <tr class="service-<?= $slug; ?>"> |
17 | 17 | <th scope="row" class="check-column"> |
18 | - <input type="radio" name="{{ id }}[service]" value="<?= $slug; ?>" <?php checked($slug, $selected); ?>> |
|
18 | + <input type="radio" name="{{ id }}[service]" value="<?= $slug; ?>" <?php checked( $slug, $selected ); ?>> |
|
19 | 19 | </th> |
20 | 20 | <td class="column-primary has-row-actions"> |
21 | 21 | <strong><?= $details['name']; ?></strong> |
22 | 22 | <div class="row-actions"> |
23 | - <span><a href="{{ base_url }}&page=settings#!addons"><?= __('Settings', 'site-reviews'); ?></a> | </span> |
|
24 | - <span><a href="{{ base_url }}&page=settings#!licenses"><?= __('License', 'site-reviews'); ?></a> | </span> |
|
25 | - <span><a href="{{ base_url }}&page=documentation#!addons"><?= __('Documentation', 'site-reviews'); ?></a></span> |
|
23 | + <span><a href="{{ base_url }}&page=settings#!addons"><?= __( 'Settings', 'site-reviews' ); ?></a> | </span> |
|
24 | + <span><a href="{{ base_url }}&page=settings#!licenses"><?= __( 'License', 'site-reviews' ); ?></a> | </span> |
|
25 | + <span><a href="{{ base_url }}&page=documentation#!addons"><?= __( 'Documentation', 'site-reviews' ); ?></a></span> |
|
26 | 26 | </div> |
27 | 27 | <button type="button" class="toggle-row"> |
28 | - <span class="screen-reader-text"><?= __('Show more details', 'site-reviews'); ?></span> |
|
28 | + <span class="screen-reader-text"><?= __( 'Show more details', 'site-reviews' ); ?></span> |
|
29 | 29 | </button> |
30 | 30 | </td> |
31 | - <td class="column-total_fetched" data-colname="<?= __('Reviews', 'site-reviews'); ?>"> |
|
31 | + <td class="column-total_fetched" data-colname="<?= __( 'Reviews', 'site-reviews' ); ?>"> |
|
32 | 32 | <a href="<?= $details['reviews_url']; ?>"><?= $details['reviews_count']; ?></a> |
33 | 33 | </td> |
34 | - <td class="column-last_sync" data-colname="<?= __('Last Sync', 'site-reviews'); ?>"> |
|
34 | + <td class="column-last_sync" data-colname="<?= __( 'Last Sync', 'site-reviews' ); ?>"> |
|
35 | 35 | <?= $details['last_sync']; ?> |
36 | 36 | </td> |
37 | 37 | </tr> |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | <tfoot> |
41 | 41 | <tr> |
42 | 42 | <td colspan="4" class="no-items" style="display:table-cell!important;"> |
43 | - <div class="glsr-progress" data-active-text="<?= __('Please wait...', 'site-reviews'); ?>"> |
|
43 | + <div class="glsr-progress" data-active-text="<?= __( 'Please wait...', 'site-reviews' ); ?>"> |
|
44 | 44 | <div class="glsr-progress-bar" style="width: 0%;"> |
45 | - <span class="glsr-progress-status"><?= __('Inactive', 'site-reviews'); ?></span> |
|
45 | + <span class="glsr-progress-status"><?= __( 'Inactive', 'site-reviews' ); ?></span> |
|
46 | 46 | </div> |
47 | 47 | <div class="glsr-progress-background"> |
48 | - <span class="glsr-progress-status"><?= __('Inactive', 'site-reviews'); ?></span> |
|
48 | + <span class="glsr-progress-status"><?= __( 'Inactive', 'site-reviews' ); ?></span> |
|
49 | 49 | </div> |
50 | 50 | </div> |
51 | 51 | </td> |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | </table> |
55 | 55 | <div class="tablenav bottom"> |
56 | 56 | <button type="submit" class="glsr-button button" id="sync-reviews"> |
57 | - <span data-loading="<?= __('Syncing...', 'site-reviews'); ?>"><?= __('Sync Reviews', 'site-reviews'); ?></span> |
|
57 | + <span data-loading="<?= __( 'Syncing...', 'site-reviews' ); ?>"><?= __( 'Sync Reviews', 'site-reviews' ); ?></span> |
|
58 | 58 | </button> |
59 | 59 | </div> |
60 | 60 | </form> |
@@ -16,34 +16,34 @@ discard block |
||
16 | 16 | */ |
17 | 17 | public function registerPostType() |
18 | 18 | { |
19 | - if (!glsr()->hasPermission()) { |
|
19 | + if( !glsr()->hasPermission() ) { |
|
20 | 20 | return; |
21 | 21 | } |
22 | - $command = new RegisterPostType([ |
|
22 | + $command = new RegisterPostType( [ |
|
23 | 23 | 'capabilities' => ['create_posts' => 'create_'.Application::POST_TYPE], |
24 | 24 | 'columns' => [ |
25 | 25 | 'title' => '', |
26 | 26 | 'category' => '', |
27 | - 'assigned_to' => __('Assigned To', 'site-reviews'), |
|
28 | - 'reviewer' => __('Author', 'site-reviews'), |
|
29 | - 'email' => __('Email', 'site-reviews'), |
|
30 | - 'ip_address' => __('IP Address', 'site-reviews'), |
|
31 | - 'response' => __('Response', 'site-reviews'), |
|
32 | - 'review_type' => __('Type', 'site-reviews'), |
|
33 | - 'rating' => __('Rating', 'site-reviews'), |
|
34 | - 'pinned' => __('Pinned', 'site-reviews'), |
|
27 | + 'assigned_to' => __( 'Assigned To', 'site-reviews' ), |
|
28 | + 'reviewer' => __( 'Author', 'site-reviews' ), |
|
29 | + 'email' => __( 'Email', 'site-reviews' ), |
|
30 | + 'ip_address' => __( 'IP Address', 'site-reviews' ), |
|
31 | + 'response' => __( 'Response', 'site-reviews' ), |
|
32 | + 'review_type' => __( 'Type', 'site-reviews' ), |
|
33 | + 'rating' => __( 'Rating', 'site-reviews' ), |
|
34 | + 'pinned' => __( 'Pinned', 'site-reviews' ), |
|
35 | 35 | 'date' => '', |
36 | 36 | ], |
37 | 37 | 'menu_icon' => 'dashicons-star-half', |
38 | 38 | 'menu_name' => glsr()->name, |
39 | 39 | 'map_meta_cap' => true, |
40 | - 'plural' => __('Reviews', 'site-reviews'), |
|
40 | + 'plural' => __( 'Reviews', 'site-reviews' ), |
|
41 | 41 | 'post_type' => Application::POST_TYPE, |
42 | 42 | 'rest_controller_class' => RestReviewController::class, |
43 | 43 | 'show_in_rest' => true, |
44 | - 'single' => __('Review', 'site-reviews'), |
|
45 | - ]); |
|
46 | - $this->execute($command); |
|
44 | + 'single' => __( 'Review', 'site-reviews' ), |
|
45 | + ] ); |
|
46 | + $this->execute( $command ); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function registerShortcodes() |
54 | 54 | { |
55 | - $command = new RegisterShortcodes([ |
|
55 | + $command = new RegisterShortcodes( [ |
|
56 | 56 | 'site_reviews', |
57 | 57 | 'site_reviews_form', |
58 | 58 | 'site_reviews_summary', |
59 | - ]); |
|
60 | - $this->execute($command); |
|
59 | + ] ); |
|
60 | + $this->execute( $command ); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -66,16 +66,16 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function registerTaxonomy() |
68 | 68 | { |
69 | - $command = new RegisterTaxonomy([ |
|
69 | + $command = new RegisterTaxonomy( [ |
|
70 | 70 | 'hierarchical' => true, |
71 | - 'meta_box_cb' => [glsr(EditorController::class), 'renderTaxonomyMetabox'], |
|
71 | + 'meta_box_cb' => [glsr( EditorController::class ), 'renderTaxonomyMetabox'], |
|
72 | 72 | 'public' => false, |
73 | 73 | 'rest_controller_class' => RestCategoryController::class, |
74 | 74 | 'show_admin_column' => true, |
75 | 75 | 'show_in_rest' => true, |
76 | 76 | 'show_ui' => true, |
77 | - ]); |
|
78 | - $this->execute($command); |
|
77 | + ] ); |
|
78 | + $this->execute( $command ); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -84,23 +84,23 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function registerWidgets() |
86 | 86 | { |
87 | - $command = new RegisterWidgets([ |
|
87 | + $command = new RegisterWidgets( [ |
|
88 | 88 | 'site-reviews' => [ |
89 | 89 | 'class' => 'glsr-widget glsr-widget-site-reviews', |
90 | - 'description' => __('Site Reviews: Display your recent reviews.', 'site-reviews'), |
|
91 | - 'title' => __('Recent Reviews', 'site-reviews'), |
|
90 | + 'description' => __( 'Site Reviews: Display your recent reviews.', 'site-reviews' ), |
|
91 | + 'title' => __( 'Recent Reviews', 'site-reviews' ), |
|
92 | 92 | ], |
93 | 93 | 'site-reviews-form' => [ |
94 | 94 | 'class' => 'glsr-widget glsr-widget-site-reviews-form', |
95 | - 'description' => __('Site Reviews: Display a form to submit reviews.', 'site-reviews'), |
|
96 | - 'title' => __('Submit a Review', 'site-reviews'), |
|
95 | + 'description' => __( 'Site Reviews: Display a form to submit reviews.', 'site-reviews' ), |
|
96 | + 'title' => __( 'Submit a Review', 'site-reviews' ), |
|
97 | 97 | ], |
98 | 98 | 'site-reviews-summary' => [ |
99 | 99 | 'class' => 'glsr-widget glsr-widget-site-reviews-summary', |
100 | - 'description' => __('Site Reviews: Display a summary of your reviews.', 'site-reviews'), |
|
101 | - 'title' => __('Summary of Reviews', 'site-reviews'), |
|
100 | + 'description' => __( 'Site Reviews: Display a summary of your reviews.', 'site-reviews' ), |
|
101 | + 'title' => __( 'Summary of Reviews', 'site-reviews' ), |
|
102 | 102 | ], |
103 | - ]); |
|
104 | - $this->execute($command); |
|
103 | + ] ); |
|
104 | + $this->execute( $command ); |
|
105 | 105 | } |
106 | 106 | } |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | * @param int $postId |
15 | 15 | * @return void|string |
16 | 16 | */ |
17 | - public function buildColumnAssignedTo($postId) |
|
17 | + public function buildColumnAssignedTo( $postId ) |
|
18 | 18 | { |
19 | - $assignedPost = glsr(Database::class)->getAssignedToPost($postId); |
|
20 | - if ($assignedPost instanceof WP_Post && 'publish' == $assignedPost->post_status) { |
|
21 | - return glsr(Builder::class)->a(get_the_title($assignedPost->ID), [ |
|
22 | - 'href' => (string) get_the_permalink($assignedPost->ID), |
|
23 | - ]); |
|
19 | + $assignedPost = glsr( Database::class )->getAssignedToPost( $postId ); |
|
20 | + if( $assignedPost instanceof WP_Post && 'publish' == $assignedPost->post_status ) { |
|
21 | + return glsr( Builder::class )->a( get_the_title( $assignedPost->ID ), [ |
|
22 | + 'href' => (string)get_the_permalink( $assignedPost->ID ), |
|
23 | + ] ); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 | |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | * @param int $postId |
29 | 29 | * @return void|string |
30 | 30 | */ |
31 | - public function buildColumnEmail($postId) |
|
31 | + public function buildColumnEmail( $postId ) |
|
32 | 32 | { |
33 | - if ($email = glsr(Database::class)->get($postId, 'email')) { |
|
33 | + if( $email = glsr( Database::class )->get( $postId, 'email' ) ) { |
|
34 | 34 | return $email; |
35 | 35 | } |
36 | 36 | } |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | * @param int $postId |
40 | 40 | * @return void|string |
41 | 41 | */ |
42 | - public function buildColumnIpAddress($postId) |
|
42 | + public function buildColumnIpAddress( $postId ) |
|
43 | 43 | { |
44 | - if ($ipAddress = glsr(Database::class)->get($postId, 'ip_address')) { |
|
44 | + if( $ipAddress = glsr( Database::class )->get( $postId, 'ip_address' ) ) { |
|
45 | 45 | return $ipAddress; |
46 | 46 | } |
47 | 47 | } |
@@ -50,35 +50,35 @@ discard block |
||
50 | 50 | * @param int $postId |
51 | 51 | * @return string |
52 | 52 | */ |
53 | - public function buildColumnPinned($postId) |
|
53 | + public function buildColumnPinned( $postId ) |
|
54 | 54 | { |
55 | - $pinned = glsr(Database::class)->get($postId, 'pinned') |
|
55 | + $pinned = glsr( Database::class )->get( $postId, 'pinned' ) |
|
56 | 56 | ? 'pinned ' |
57 | 57 | : ''; |
58 | - return glsr(Builder::class)->i([ |
|
58 | + return glsr( Builder::class )->i( [ |
|
59 | 59 | 'class' => $pinned.'dashicons dashicons-sticky', |
60 | 60 | 'data-id' => $postId, |
61 | - ]); |
|
61 | + ] ); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
65 | 65 | * @param int $postId |
66 | 66 | * @return string |
67 | 67 | */ |
68 | - public function buildColumnResponse($postId) |
|
68 | + public function buildColumnResponse( $postId ) |
|
69 | 69 | { |
70 | - return glsr(Database::class)->get($postId, 'response') |
|
71 | - ? __('Yes', 'site-reviews') |
|
72 | - : __('No', 'site-reviews'); |
|
70 | + return glsr( Database::class )->get( $postId, 'response' ) |
|
71 | + ? __( 'Yes', 'site-reviews' ) |
|
72 | + : __( 'No', 'site-reviews' ); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
76 | 76 | * @param int $postId |
77 | 77 | * @return string |
78 | 78 | */ |
79 | - public function buildColumnReviewer($postId) |
|
79 | + public function buildColumnReviewer( $postId ) |
|
80 | 80 | { |
81 | - return strval(glsr(Database::class)->get($postId, 'author')); |
|
81 | + return strval( glsr( Database::class )->get( $postId, 'author' ) ); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -86,39 +86,39 @@ discard block |
||
86 | 86 | * @param int|null $rating |
87 | 87 | * @return string |
88 | 88 | */ |
89 | - public function buildColumnRating($postId) |
|
89 | + public function buildColumnRating( $postId ) |
|
90 | 90 | { |
91 | - return glsr_star_rating(intval(glsr(Database::class)->get($postId, 'rating'))); |
|
91 | + return glsr_star_rating( intval( glsr( Database::class )->get( $postId, 'rating' ) ) ); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
95 | 95 | * @param int $postId |
96 | 96 | * @return string |
97 | 97 | */ |
98 | - public function buildColumnReviewType($postId) |
|
98 | + public function buildColumnReviewType( $postId ) |
|
99 | 99 | { |
100 | - $type = glsr(Database::class)->get($postId, 'review_type'); |
|
101 | - return array_key_exists($type, glsr()->reviewTypes) |
|
100 | + $type = glsr( Database::class )->get( $postId, 'review_type' ); |
|
101 | + return array_key_exists( $type, glsr()->reviewTypes ) |
|
102 | 102 | ? glsr()->reviewTypes[$type] |
103 | - : __('Unsupported Type', 'site-reviews'); |
|
103 | + : __( 'Unsupported Type', 'site-reviews' ); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
107 | 107 | * @param string $postType |
108 | 108 | * @return void |
109 | 109 | */ |
110 | - public function renderFilters($postType) |
|
110 | + public function renderFilters( $postType ) |
|
111 | 111 | { |
112 | - if (Application::POST_TYPE !== $postType) { |
|
112 | + if( Application::POST_TYPE !== $postType ) { |
|
113 | 113 | return; |
114 | 114 | } |
115 | - if (!($status = filter_input(INPUT_GET, 'post_status'))) { |
|
115 | + if( !($status = filter_input( INPUT_GET, 'post_status' )) ) { |
|
116 | 116 | $status = 'publish'; |
117 | 117 | } |
118 | - $ratings = glsr(Database::class)->getReviewsMeta('rating', $status); |
|
119 | - $types = glsr(Database::class)->getReviewsMeta('review_type', $status); |
|
120 | - $this->renderFilterRatings($ratings); |
|
121 | - $this->renderFilterTypes($types); |
|
118 | + $ratings = glsr( Database::class )->getReviewsMeta( 'rating', $status ); |
|
119 | + $types = glsr( Database::class )->getReviewsMeta( 'review_type', $status ); |
|
120 | + $this->renderFilterRatings( $ratings ); |
|
121 | + $this->renderFilterTypes( $types ); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -126,13 +126,13 @@ discard block |
||
126 | 126 | * @param int $postId |
127 | 127 | * @return void |
128 | 128 | */ |
129 | - public function renderValues($column, $postId) |
|
129 | + public function renderValues( $column, $postId ) |
|
130 | 130 | { |
131 | - $method = Helper::buildMethodName($column, 'buildColumn'); |
|
132 | - $value = method_exists($this, $method) |
|
133 | - ? call_user_func([$this, $method], $postId) |
|
134 | - : apply_filters('site-reviews/columns/'.$column, '', $postId); |
|
135 | - if (empty($value)) { |
|
131 | + $method = Helper::buildMethodName( $column, 'buildColumn' ); |
|
132 | + $value = method_exists( $this, $method ) |
|
133 | + ? call_user_func( [$this, $method], $postId ) |
|
134 | + : apply_filters( 'site-reviews/columns/'.$column, '', $postId ); |
|
135 | + if( empty($value) ) { |
|
136 | 136 | $value = '—'; |
137 | 137 | } |
138 | 138 | echo $value; |
@@ -142,44 +142,44 @@ discard block |
||
142 | 142 | * @param array $ratings |
143 | 143 | * @return void |
144 | 144 | */ |
145 | - protected function renderFilterRatings($ratings) |
|
145 | + protected function renderFilterRatings( $ratings ) |
|
146 | 146 | { |
147 | - if (empty($ratings)) { |
|
147 | + if( empty($ratings) ) { |
|
148 | 148 | return; |
149 | 149 | } |
150 | - $ratings = array_flip(array_reverse($ratings)); |
|
151 | - array_walk($ratings, function (&$value, $key) { |
|
152 | - $label = _n('%s star', '%s stars', $key, 'site-reviews'); |
|
153 | - $value = sprintf($label, $key); |
|
150 | + $ratings = array_flip( array_reverse( $ratings ) ); |
|
151 | + array_walk( $ratings, function( &$value, $key ) { |
|
152 | + $label = _n( '%s star', '%s stars', $key, 'site-reviews' ); |
|
153 | + $value = sprintf( $label, $key ); |
|
154 | 154 | }); |
155 | - echo glsr(Builder::class)->label(__('Filter by rating', 'site-reviews'), [ |
|
155 | + echo glsr( Builder::class )->label( __( 'Filter by rating', 'site-reviews' ), [ |
|
156 | 156 | 'class' => 'screen-reader-text', |
157 | 157 | 'for' => 'rating', |
158 | - ]); |
|
159 | - echo glsr(Builder::class)->select([ |
|
158 | + ] ); |
|
159 | + echo glsr( Builder::class )->select( [ |
|
160 | 160 | 'name' => 'rating', |
161 | - 'options' => ['' => __('All ratings', 'site-reviews')] + $ratings, |
|
162 | - 'value' => filter_input(INPUT_GET, 'rating'), |
|
163 | - ]); |
|
161 | + 'options' => ['' => __( 'All ratings', 'site-reviews' )] + $ratings, |
|
162 | + 'value' => filter_input( INPUT_GET, 'rating' ), |
|
163 | + ] ); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
167 | 167 | * @param array $types |
168 | 168 | * @return void |
169 | 169 | */ |
170 | - protected function renderFilterTypes($types) |
|
170 | + protected function renderFilterTypes( $types ) |
|
171 | 171 | { |
172 | - if (count(glsr()->reviewTypes) < 2) { |
|
172 | + if( count( glsr()->reviewTypes ) < 2 ) { |
|
173 | 173 | return; |
174 | 174 | } |
175 | - echo glsr(Builder::class)->label(__('Filter by type', 'site-reviews'), [ |
|
175 | + echo glsr( Builder::class )->label( __( 'Filter by type', 'site-reviews' ), [ |
|
176 | 176 | 'class' => 'screen-reader-text', |
177 | 177 | 'for' => 'review_type', |
178 | - ]); |
|
179 | - echo glsr(Builder::class)->select([ |
|
178 | + ] ); |
|
179 | + echo glsr( Builder::class )->select( [ |
|
180 | 180 | 'name' => 'review_type', |
181 | - 'options' => ['' => __('All types', 'site-reviews')] + glsr()->reviewTypes, |
|
182 | - 'value' => filter_input(INPUT_GET, 'review_type'), |
|
183 | - ]); |
|
181 | + 'options' => ['' => __( 'All types', 'site-reviews' )] + glsr()->reviewTypes, |
|
182 | + 'value' => filter_input( INPUT_GET, 'review_type' ), |
|
183 | + ] ); |
|
184 | 184 | } |
185 | 185 | } |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | 3 | <p>This page shows all of the available shortcode options with examples of how to use them. You can use multiple options in the same shortcode.</p> |
4 | 4 | |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | <div class="glsr-card-header"> |
7 | 7 | <h3>[site_reviews]</h3> |
8 | 8 | <button type="button" class="handlediv" aria-expanded="true"> |
9 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
9 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
10 | 10 | <span class="toggle-indicator" aria-hidden="true"></span> |
11 | 11 | </button> |
12 | 12 | </div> |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | <div class="glsr-card-header"> |
81 | 81 | <h3>[site_reviews_form]</h3> |
82 | 82 | <button type="button" class="handlediv" aria-expanded="true"> |
83 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
83 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
84 | 84 | <span class="toggle-indicator" aria-hidden="true"></span> |
85 | 85 | </button> |
86 | 86 | </div> |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | <div class="glsr-card-header"> |
129 | 129 | <h3>[site_reviews_summary]</h3> |
130 | 130 | <button type="button" class="handlediv" aria-expanded="true"> |
131 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
131 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
132 | 132 | <span class="toggle-indicator" aria-hidden="true"></span> |
133 | 133 | </button> |
134 | 134 | </div> |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | <pre><code>[site_reviews_summary hide="bars,if_empty,rating,stars,summary"]</code></pre> |
159 | 159 | |
160 | 160 | <p class="glsr-heading">labels</p> |
161 | - <p>The "labels" attribute allows you to enter custom labels for the percentage bar levels (from high to low), each level should be separated with a comma. However, rather than using this attribute to change the labels it's recommended to instead create a custom translation for them in the <code><a href="<?= admin_url('edit.php?post_type=site-review&page=settings#!translations'); ?>">Settings → Translations</a></code> page.</p> |
|
161 | + <p>The "labels" attribute allows you to enter custom labels for the percentage bar levels (from high to low), each level should be separated with a comma. However, rather than using this attribute to change the labels it's recommended to instead create a custom translation for them in the <code><a href="<?= admin_url( 'edit.php?post_type=site-review&page=settings#!translations' ); ?>">Settings → Translations</a></code> page.</p> |
|
162 | 162 | <p>The default labels value is: <code>"Excellent,Very good,Average,Poor,Terrible"</code></p> |
163 | 163 | <pre><code>[site_reviews_summary labels="5 star,4 star,3 star,2 star,1 star"]</code></pre> |
164 | 164 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | <pre><code>[site_reviews_summary schema="true"]</code></pre> |
176 | 176 | |
177 | 177 | <p class="glsr-heading">text</p> |
178 | - <p>The "text" attribute allows you to change the summary text. Available template tags to use are, "{rating}" which represents the calculated average rating, "{max}" which represents the maximum star rating available, and "{num}" which represents the total number of reviews. However, rather than using this attribute to change the summary text it's recommended to instead create a custom translation for it in the <code><a href="<?= admin_url('edit.php?post_type=site-review&page=settings#!translations'); ?>">Settings → Translations</a></code> page. That way, you will be able to customize both the singular (1 review) and plural (2 reviews) summary texts.</p> |
|
178 | + <p>The "text" attribute allows you to change the summary text. Available template tags to use are, "{rating}" which represents the calculated average rating, "{max}" which represents the maximum star rating available, and "{num}" which represents the total number of reviews. However, rather than using this attribute to change the summary text it's recommended to instead create a custom translation for it in the <code><a href="<?= admin_url( 'edit.php?post_type=site-review&page=settings#!translations' ); ?>">Settings → Translations</a></code> page. That way, you will be able to customize both the singular (1 review) and plural (2 reviews) summary texts.</p> |
|
179 | 179 | <p>The default text value is: <code>"{rating} out of {max} stars (based on {num} reviews)"</code></p> |
180 | 180 | <pre><code>[site_reviews_summary text="{num} customer reviews"]</code></pre> |
181 | 181 |
@@ -1,3 +1,3 @@ |
||
1 | 1 | <div class="notice notice-info is-dismissible glsr-notice" data-dismiss="welcome"> |
2 | - <p><?= $text; ?> — <a class="button button-small" href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=welcome#!whatsnew'); ?>">See what's new</a></p> |
|
2 | + <p><?= $text; ?> — <a class="button button-small" href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=welcome#!whatsnew' ); ?>">See what's new</a></p> |
|
3 | 3 | </div> |
@@ -11,65 +11,65 @@ discard block |
||
11 | 11 | * @param array $instance |
12 | 12 | * @return void |
13 | 13 | */ |
14 | - public function form($instance) |
|
14 | + public function form( $instance ) |
|
15 | 15 | { |
16 | - $this->widgetArgs = glsr(SiteReviewsShortcode::class)->normalizeAtts($instance); |
|
17 | - $terms = glsr(Database::class)->getTerms(); |
|
18 | - $this->renderField('text', [ |
|
16 | + $this->widgetArgs = glsr( SiteReviewsShortcode::class )->normalizeAtts( $instance ); |
|
17 | + $terms = glsr( Database::class )->getTerms(); |
|
18 | + $this->renderField( 'text', [ |
|
19 | 19 | 'class' => 'widefat', |
20 | - 'label' => __('Title', 'site-reviews'), |
|
20 | + 'label' => __( 'Title', 'site-reviews' ), |
|
21 | 21 | 'name' => 'title', |
22 | - ]); |
|
23 | - $this->renderField('number', [ |
|
22 | + ] ); |
|
23 | + $this->renderField( 'number', [ |
|
24 | 24 | 'class' => 'small-text', |
25 | 25 | 'default' => 10, |
26 | - 'label' => __('How many reviews would you like to display?', 'site-reviews'), |
|
26 | + 'label' => __( 'How many reviews would you like to display?', 'site-reviews' ), |
|
27 | 27 | 'max' => 100, |
28 | 28 | 'name' => 'display', |
29 | - ]); |
|
30 | - $this->renderField('select', [ |
|
31 | - 'label' => __('What is the minimum rating to display?', 'site-reviews'), |
|
29 | + ] ); |
|
30 | + $this->renderField( 'select', [ |
|
31 | + 'label' => __( 'What is the minimum rating to display?', 'site-reviews' ), |
|
32 | 32 | 'name' => 'rating', |
33 | 33 | 'options' => [ |
34 | - '5' => sprintf(_n('%s star', '%s stars', 5, 'site-reviews'), 5), |
|
35 | - '4' => sprintf(_n('%s star', '%s stars', 4, 'site-reviews'), 4), |
|
36 | - '3' => sprintf(_n('%s star', '%s stars', 3, 'site-reviews'), 3), |
|
37 | - '2' => sprintf(_n('%s star', '%s stars', 2, 'site-reviews'), 2), |
|
38 | - '1' => sprintf(_n('%s star', '%s stars', 1, 'site-reviews'), 1), |
|
34 | + '5' => sprintf( _n( '%s star', '%s stars', 5, 'site-reviews' ), 5 ), |
|
35 | + '4' => sprintf( _n( '%s star', '%s stars', 4, 'site-reviews' ), 4 ), |
|
36 | + '3' => sprintf( _n( '%s star', '%s stars', 3, 'site-reviews' ), 3 ), |
|
37 | + '2' => sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 ), |
|
38 | + '1' => sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 ), |
|
39 | 39 | ], |
40 | - ]); |
|
41 | - if (count(glsr()->reviewTypes) > 1) { |
|
42 | - $this->renderField('select', [ |
|
40 | + ] ); |
|
41 | + if( count( glsr()->reviewTypes ) > 1 ) { |
|
42 | + $this->renderField( 'select', [ |
|
43 | 43 | 'class' => 'widefat', |
44 | - 'label' => __('Which type of review would you like to display?', 'site-reviews'), |
|
44 | + 'label' => __( 'Which type of review would you like to display?', 'site-reviews' ), |
|
45 | 45 | 'name' => 'type', |
46 | - 'options' => ['' => __('All Reviews', 'site-reviews')] + glsr()->reviewTypes, |
|
47 | - ]); |
|
46 | + 'options' => ['' => __( 'All Reviews', 'site-reviews' )] + glsr()->reviewTypes, |
|
47 | + ] ); |
|
48 | 48 | } |
49 | - if (!empty($terms)) { |
|
50 | - $this->renderField('select', [ |
|
49 | + if( !empty($terms) ) { |
|
50 | + $this->renderField( 'select', [ |
|
51 | 51 | 'class' => 'widefat', |
52 | - 'label' => __('Limit reviews to this category', 'site-reviews'), |
|
52 | + 'label' => __( 'Limit reviews to this category', 'site-reviews' ), |
|
53 | 53 | 'name' => 'category', |
54 | - 'options' => ['' => __('All Categories', 'site-reviews')] + $terms, |
|
55 | - ]); |
|
54 | + 'options' => ['' => __( 'All Categories', 'site-reviews' )] + $terms, |
|
55 | + ] ); |
|
56 | 56 | } |
57 | - $this->renderField('text', [ |
|
57 | + $this->renderField( 'text', [ |
|
58 | 58 | 'class' => 'widefat', |
59 | 59 | 'default' => '', |
60 | - 'description' => sprintf(__("Separate multiple ID's with a comma. You may also enter %s to automatically represent the current page/post ID.", 'site-reviews'), '<code>post_id</code>'), |
|
61 | - 'label' => __('Limit reviews to those assigned to this page/post ID', 'site-reviews'), |
|
60 | + 'description' => sprintf( __( "Separate multiple ID's with a comma. You may also enter %s to automatically represent the current page/post ID.", 'site-reviews' ), '<code>post_id</code>' ), |
|
61 | + 'label' => __( 'Limit reviews to those assigned to this page/post ID', 'site-reviews' ), |
|
62 | 62 | 'name' => 'assigned_to', |
63 | - ]); |
|
64 | - $this->renderField('text', [ |
|
63 | + ] ); |
|
64 | + $this->renderField( 'text', [ |
|
65 | 65 | 'class' => 'widefat', |
66 | - 'label' => __('Enter any custom CSS classes here', 'site-reviews'), |
|
66 | + 'label' => __( 'Enter any custom CSS classes here', 'site-reviews' ), |
|
67 | 67 | 'name' => 'class', |
68 | - ]); |
|
69 | - $this->renderField('checkbox', [ |
|
68 | + ] ); |
|
69 | + $this->renderField( 'checkbox', [ |
|
70 | 70 | 'name' => 'hide', |
71 | - 'options' => glsr(SiteReviewsShortcode::class)->getHideOptions(), |
|
72 | - ]); |
|
71 | + 'options' => glsr( SiteReviewsShortcode::class )->getHideOptions(), |
|
72 | + ] ); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -77,13 +77,13 @@ discard block |
||
77 | 77 | * @param array $oldInstance |
78 | 78 | * @return array |
79 | 79 | */ |
80 | - public function update($newInstance, $oldInstance) |
|
80 | + public function update( $newInstance, $oldInstance ) |
|
81 | 81 | { |
82 | - if (!is_numeric($newInstance['display'])) { |
|
82 | + if( !is_numeric( $newInstance['display'] ) ) { |
|
83 | 83 | $newInstance['display'] = 10; |
84 | 84 | } |
85 | - $newInstance['display'] = min(50, max(0, intval($newInstance['display']))); |
|
86 | - return parent::update($newInstance, $oldInstance); |
|
85 | + $newInstance['display'] = min( 50, max( 0, intval( $newInstance['display'] ) ) ); |
|
86 | + return parent::update( $newInstance, $oldInstance ); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -91,8 +91,8 @@ discard block |
||
91 | 91 | * @param array $instance |
92 | 92 | * @return void |
93 | 93 | */ |
94 | - public function widget($args, $instance) |
|
94 | + public function widget( $args, $instance ) |
|
95 | 95 | { |
96 | - echo glsr(SiteReviewsShortcode::class)->build($instance, $args, 'widget'); |
|
96 | + echo glsr( SiteReviewsShortcode::class )->build( $instance, $args, 'widget' ); |
|
97 | 97 | } |
98 | 98 | } |
@@ -10,71 +10,71 @@ |
||
10 | 10 | public function fields() |
11 | 11 | { |
12 | 12 | return [[ |
13 | - 'html' => sprintf('<p class="strong">%s</p>', esc_html__('All settings are optional.', 'site-reviews')), |
|
13 | + 'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' ) ), |
|
14 | 14 | 'minWidth' => 320, |
15 | 15 | 'type' => 'container', |
16 | 16 | ], [ |
17 | - 'label' => esc_html__('Title', 'site-reviews'), |
|
17 | + 'label' => esc_html__( 'Title', 'site-reviews' ), |
|
18 | 18 | 'name' => 'title', |
19 | - 'tooltip' => __('Enter a custom shortcode heading.', 'site-reviews'), |
|
19 | + 'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ), |
|
20 | 20 | 'type' => 'textbox', |
21 | 21 | ], [ |
22 | - 'label' => esc_html__('Display', 'site-reviews'), |
|
22 | + 'label' => esc_html__( 'Display', 'site-reviews' ), |
|
23 | 23 | 'maxLength' => 5, |
24 | 24 | 'name' => 'display', |
25 | 25 | 'size' => 3, |
26 | 26 | 'text' => '10', |
27 | - 'tooltip' => __('How many reviews would you like to display (default: 10)?', 'site-reviews'), |
|
27 | + 'tooltip' => __( 'How many reviews would you like to display (default: 10)?', 'site-reviews' ), |
|
28 | 28 | 'type' => 'textbox', |
29 | 29 | ], [ |
30 | - 'label' => esc_html__('Rating', 'site-reviews'), |
|
30 | + 'label' => esc_html__( 'Rating', 'site-reviews' ), |
|
31 | 31 | 'name' => 'rating', |
32 | 32 | 'options' => [ |
33 | - '5' => esc_html(sprintf(_n('%s star', '%s stars', 5, 'site-reviews'), 5)), |
|
34 | - '4' => esc_html(sprintf(_n('%s star', '%s stars', 4, 'site-reviews'), 4)), |
|
35 | - '3' => esc_html(sprintf(_n('%s star', '%s stars', 3, 'site-reviews'), 3)), |
|
36 | - '2' => esc_html(sprintf(_n('%s star', '%s stars', 2, 'site-reviews'), 2)), |
|
37 | - '1' => esc_html(sprintf(_n('%s star', '%s stars', 1, 'site-reviews'), 1)), |
|
38 | - '0' => esc_html(__('Unrated', 'site-reviews')), |
|
33 | + '5' => esc_html( sprintf( _n( '%s star', '%s stars', 5, 'site-reviews' ), 5 ) ), |
|
34 | + '4' => esc_html( sprintf( _n( '%s star', '%s stars', 4, 'site-reviews' ), 4 ) ), |
|
35 | + '3' => esc_html( sprintf( _n( '%s star', '%s stars', 3, 'site-reviews' ), 3 ) ), |
|
36 | + '2' => esc_html( sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 ) ), |
|
37 | + '1' => esc_html( sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 ) ), |
|
38 | + '0' => esc_html( __( 'Unrated', 'site-reviews' ) ), |
|
39 | 39 | ], |
40 | - 'tooltip' => __('What is the minimum rating to display (default: 1 star)?', 'site-reviews'), |
|
40 | + 'tooltip' => __( 'What is the minimum rating to display (default: 1 star)?', 'site-reviews' ), |
|
41 | 41 | 'type' => 'listbox', |
42 | 42 | ], [ |
43 | - 'label' => esc_html__('Pagination', 'site-reviews'), |
|
43 | + 'label' => esc_html__( 'Pagination', 'site-reviews' ), |
|
44 | 44 | 'name' => 'pagination', |
45 | 45 | 'options' => [ |
46 | - 'true' => esc_html__('Enable', 'site-reviews'), |
|
47 | - 'ajax' => esc_html__('Enable (using ajax)', 'site-reviews'), |
|
48 | - 'false' => esc_html__('Disable', 'site-reviews'), |
|
46 | + 'true' => esc_html__( 'Enable', 'site-reviews' ), |
|
47 | + 'ajax' => esc_html__( 'Enable (using ajax)', 'site-reviews' ), |
|
48 | + 'false' => esc_html__( 'Disable', 'site-reviews' ), |
|
49 | 49 | ], |
50 | - 'tooltip' => __('When using pagination this shortcode can only be used once on a page. (default: disable)', 'site-reviews'), |
|
50 | + 'tooltip' => __( 'When using pagination this shortcode can only be used once on a page. (default: disable)', 'site-reviews' ), |
|
51 | 51 | 'type' => 'listbox', |
52 | 52 | ], |
53 | - $this->getTypes(__('Which type of review would you like to display?', 'site-reviews')), |
|
54 | - $this->getCategories(__('Limit reviews to this category.', 'site-reviews')), |
|
53 | + $this->getTypes( __( 'Which type of review would you like to display?', 'site-reviews' ) ), |
|
54 | + $this->getCategories( __( 'Limit reviews to this category.', 'site-reviews' ) ), |
|
55 | 55 | [ |
56 | - 'label' => esc_html__('Assigned To', 'site-reviews'), |
|
56 | + 'label' => esc_html__( 'Assigned To', 'site-reviews' ), |
|
57 | 57 | 'name' => 'assigned_to', |
58 | - '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'), |
|
58 | + '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' ), |
|
59 | 59 | 'type' => 'textbox', |
60 | 60 | ], [ |
61 | - 'label' => esc_html__('Schema', 'site-reviews'), |
|
61 | + 'label' => esc_html__( 'Schema', 'site-reviews' ), |
|
62 | 62 | 'name' => 'schema', |
63 | 63 | 'options' => [ |
64 | - 'true' => esc_html__('Enable rich snippets', 'site-reviews'), |
|
65 | - 'false' => esc_html__('Disable rich snippets', 'site-reviews'), |
|
64 | + 'true' => esc_html__( 'Enable rich snippets', 'site-reviews' ), |
|
65 | + 'false' => esc_html__( 'Disable rich snippets', 'site-reviews' ), |
|
66 | 66 | ], |
67 | - 'tooltip' => __('Rich snippets are disabled by default.', 'site-reviews'), |
|
67 | + 'tooltip' => __( 'Rich snippets are disabled by default.', 'site-reviews' ), |
|
68 | 68 | 'type' => 'listbox', |
69 | 69 | ], [ |
70 | - 'label' => esc_html__('Classes', 'site-reviews'), |
|
70 | + 'label' => esc_html__( 'Classes', 'site-reviews' ), |
|
71 | 71 | 'name' => 'class', |
72 | - 'tooltip' => __('Add custom CSS classes to the shortcode.', 'site-reviews'), |
|
72 | + 'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ), |
|
73 | 73 | 'type' => 'textbox', |
74 | 74 | ], [ |
75 | 75 | 'columns' => 2, |
76 | 76 | 'items' => $this->getHideOptions(), |
77 | - 'label' => esc_html__('Hide', 'site-reviews'), |
|
77 | + 'label' => esc_html__( 'Hide', 'site-reviews' ), |
|
78 | 78 | 'layout' => 'grid', |
79 | 79 | 'spacing' => 5, |
80 | 80 | 'type' => 'container', |
@@ -12,11 +12,11 @@ discard block |
||
12 | 12 | * @return array |
13 | 13 | * @filter plugin_action_links_site-reviews/site-reviews.php |
14 | 14 | */ |
15 | - public function filterActionLinks(array $links) |
|
15 | + public function filterActionLinks( array $links ) |
|
16 | 16 | { |
17 | - $links['welcome'] = glsr(Builder::class)->a(__('About', 'site-reviews'), [ |
|
18 | - 'href' => admin_url('edit.php?post_type='.Application::POST_TYPE.'&page=welcome'), |
|
19 | - ]); |
|
17 | + $links['welcome'] = glsr( Builder::class )->a( __( 'About', 'site-reviews' ), [ |
|
18 | + 'href' => admin_url( 'edit.php?post_type='.Application::POST_TYPE.'&page=welcome' ), |
|
19 | + ] ); |
|
20 | 20 | return $links; |
21 | 21 | } |
22 | 22 | |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | * @return string |
25 | 25 | * @filter admin_title |
26 | 26 | */ |
27 | - public function filterAdminTitle($title) |
|
27 | + public function filterAdminTitle( $title ) |
|
28 | 28 | { |
29 | 29 | return Application::POST_TYPE.'_page_welcome' == glsr_current_screen()->id |
30 | - ? sprintf(__('Welcome to %s — WordPress', 'site-reviews'), glsr()->name) |
|
30 | + ? sprintf( __( 'Welcome to %s — WordPress', 'site-reviews' ), glsr()->name ) |
|
31 | 31 | : $title; |
32 | 32 | } |
33 | 33 | |
@@ -36,17 +36,17 @@ discard block |
||
36 | 36 | * @return string |
37 | 37 | * @filter admin_footer_text |
38 | 38 | */ |
39 | - public function filterFooterText($text) |
|
39 | + public function filterFooterText( $text ) |
|
40 | 40 | { |
41 | - if (Application::POST_TYPE.'_page_welcome' != glsr_current_screen()->id) { |
|
41 | + if( Application::POST_TYPE.'_page_welcome' != glsr_current_screen()->id ) { |
|
42 | 42 | return $text; |
43 | 43 | } |
44 | 44 | $url = 'https://wordpress.org/support/view/plugin-reviews/site-reviews?filter=5#new-post'; |
45 | - return wp_kses_post(sprintf( |
|
46 | - __('Please rate %s on %s and help us spread the word. Thank you so much!', 'site-reviews'), |
|
45 | + return wp_kses_post( sprintf( |
|
46 | + __( 'Please rate %s on %s and help us spread the word. Thank you so much!', 'site-reviews' ), |
|
47 | 47 | '<strong>'.glsr()->name.'</strong> <a href="'.$url.'" target="_blank">★★★★★</a>', |
48 | 48 | '<a href="'.$url.'" target="_blank">wordpress.org</a>' |
49 | - )); |
|
49 | + ) ); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | * @return void |
56 | 56 | * @action activated_plugin |
57 | 57 | */ |
58 | - public function redirectOnActivation($plugin, $isNetworkActivation) |
|
58 | + public function redirectOnActivation( $plugin, $isNetworkActivation ) |
|
59 | 59 | { |
60 | - if (!$isNetworkActivation |
|
60 | + if( !$isNetworkActivation |
|
61 | 61 | && 'cli' !== php_sapi_name() |
62 | - && $plugin === plugin_basename(glsr()->file)) { |
|
63 | - wp_safe_redirect(admin_url('edit.php?post_type='.Application::POST_TYPE.'&page=welcome')); |
|
62 | + && $plugin === plugin_basename( glsr()->file ) ) { |
|
63 | + wp_safe_redirect( admin_url( 'edit.php?post_type='.Application::POST_TYPE.'&page=welcome' ) ); |
|
64 | 64 | exit; |
65 | 65 | } |
66 | 66 | } |
@@ -71,14 +71,14 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function registerPage() |
73 | 73 | { |
74 | - add_submenu_page('edit.php?post_type='.Application::POST_TYPE, |
|
75 | - sprintf(__('Welcome to %s', 'site-reviews'), glsr()->name), |
|
74 | + add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, |
|
75 | + sprintf( __( 'Welcome to %s', 'site-reviews' ), glsr()->name ), |
|
76 | 76 | glsr()->name, |
77 | - glsr()->getPermission('welcome'), |
|
77 | + glsr()->getPermission( 'welcome' ), |
|
78 | 78 | 'welcome', |
79 | 79 | [$this, 'renderPage'] |
80 | 80 | ); |
81 | - remove_submenu_page('edit.php?post_type='.Application::POST_TYPE, 'welcome'); |
|
81 | + remove_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, 'welcome' ); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -88,17 +88,17 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function renderPage() |
90 | 90 | { |
91 | - $tabs = apply_filters('site-reviews/addon/welcome/tabs', [ |
|
92 | - 'getting-started' => __('Getting Started', 'site-reviews'), |
|
93 | - 'whatsnew' => __('What\'s New', 'site-reviews'), |
|
94 | - 'upgrade-guide' => __('Upgrade Guide', 'site-reviews'), |
|
95 | - 'support' => __('Support', 'site-reviews'), |
|
96 | - ]); |
|
97 | - glsr()->render('pages/welcome/index', [ |
|
91 | + $tabs = apply_filters( 'site-reviews/addon/welcome/tabs', [ |
|
92 | + 'getting-started' => __( 'Getting Started', 'site-reviews' ), |
|
93 | + 'whatsnew' => __( 'What\'s New', 'site-reviews' ), |
|
94 | + 'upgrade-guide' => __( 'Upgrade Guide', 'site-reviews' ), |
|
95 | + 'support' => __( 'Support', 'site-reviews' ), |
|
96 | + ] ); |
|
97 | + glsr()->render( 'pages/welcome/index', [ |
|
98 | 98 | 'data' => ['context' => []], |
99 | - 'http_referer' => (string) wp_get_referer(), |
|
99 | + 'http_referer' => (string)wp_get_referer(), |
|
100 | 100 | 'tabs' => $tabs, |
101 | - 'template' => glsr(Template::class), |
|
102 | - ]); |
|
101 | + 'template' => glsr( Template::class ), |
|
102 | + ] ); |
|
103 | 103 | } |
104 | 104 | } |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | public function __construct() |
19 | 19 | { |
20 | 20 | $this->dismissValuesMap = [ |
21 | - 'rebusify' => glsr()->version('major'), |
|
22 | - 'welcome' => glsr()->version('minor'), |
|
21 | + 'rebusify' => glsr()->version( 'major' ), |
|
22 | + 'welcome' => glsr()->version( 'minor' ), |
|
23 | 23 | ]; |
24 | 24 | } |
25 | 25 | |
@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | public function filterAdminNotices() |
31 | 31 | { |
32 | 32 | $screen = glsr_current_screen(); |
33 | - $this->renderWelcomeNotice($screen->post_type); |
|
34 | - $this->renderRebusifyNotice($screen->post_type); |
|
35 | - $this->renderAddonsNotice($screen->id); |
|
33 | + $this->renderWelcomeNotice( $screen->post_type ); |
|
34 | + $this->renderRebusifyNotice( $screen->post_type ); |
|
35 | + $this->renderAddonsNotice( $screen->id ); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
39 | 39 | * @return void |
40 | 40 | */ |
41 | - public function routerDismissNotice(array $request) |
|
41 | + public function routerDismissNotice( array $request ) |
|
42 | 42 | { |
43 | - if ($key = Arr::get($request, 'notice')) { |
|
44 | - $this->dismissNotice($key); |
|
43 | + if( $key = Arr::get( $request, 'notice' ) ) { |
|
44 | + $this->dismissNotice( $key ); |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | * @param string $key |
50 | 50 | * @return void |
51 | 51 | */ |
52 | - protected function dismissNotice($key) |
|
52 | + protected function dismissNotice( $key ) |
|
53 | 53 | { |
54 | - $this->setUserMeta($key, $this->getVersionFor($key)); |
|
54 | + $this->setUserMeta( $key, $this->getVersionFor( $key ) ); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -59,29 +59,29 @@ discard block |
||
59 | 59 | * @param mixed $fallback |
60 | 60 | * @return mixed |
61 | 61 | */ |
62 | - protected function getUserMeta($key, $fallback) |
|
62 | + protected function getUserMeta( $key, $fallback ) |
|
63 | 63 | { |
64 | - $meta = get_user_meta(get_current_user_id(), static::USER_META_KEY, true); |
|
65 | - return Arr::get($meta, $key, $fallback); |
|
64 | + $meta = get_user_meta( get_current_user_id(), static::USER_META_KEY, true ); |
|
65 | + return Arr::get( $meta, $key, $fallback ); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
69 | 69 | * @param string $noticeKey |
70 | 70 | * @return string |
71 | 71 | */ |
72 | - protected function getVersionFor($noticeKey) |
|
72 | + protected function getVersionFor( $noticeKey ) |
|
73 | 73 | { |
74 | - return Arr::get($this->dismissValuesMap, $noticeKey, glsr()->version('major')); |
|
74 | + return Arr::get( $this->dismissValuesMap, $noticeKey, glsr()->version( 'major' ) ); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
78 | 78 | * @param string $screenId |
79 | 79 | * @return void |
80 | 80 | */ |
81 | - protected function renderAddonsNotice($screenId) |
|
81 | + protected function renderAddonsNotice( $screenId ) |
|
82 | 82 | { |
83 | - if (Application::POST_TYPE.'_page_addons' == $screenId) { |
|
84 | - echo glsr()->render('partials/notices/addons'); |
|
83 | + if( Application::POST_TYPE.'_page_addons' == $screenId ) { |
|
84 | + echo glsr()->render( 'partials/notices/addons' ); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | * @param string $screenPostType |
90 | 90 | * @return void |
91 | 91 | */ |
92 | - protected function renderRebusifyNotice($screenPostType) |
|
92 | + protected function renderRebusifyNotice( $screenPostType ) |
|
93 | 93 | { |
94 | - if (Application::POST_TYPE == $screenPostType |
|
95 | - && version_compare($this->getVersionFor('rebusify'), $this->getUserMeta('rebusify', 0), '>') |
|
96 | - && !glsr(OptionManager::class)->getBool('settings.general.rebusify')) { |
|
97 | - echo glsr()->render('partials/notices/rebusify'); |
|
94 | + if( Application::POST_TYPE == $screenPostType |
|
95 | + && version_compare( $this->getVersionFor( 'rebusify' ), $this->getUserMeta( 'rebusify', 0 ), '>' ) |
|
96 | + && !glsr( OptionManager::class )->getBool( 'settings.general.rebusify' ) ) { |
|
97 | + echo glsr()->render( 'partials/notices/rebusify' ); |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
@@ -102,16 +102,16 @@ discard block |
||
102 | 102 | * @param string $screenPostType |
103 | 103 | * @return void |
104 | 104 | */ |
105 | - protected function renderWelcomeNotice($screenPostType) |
|
105 | + protected function renderWelcomeNotice( $screenPostType ) |
|
106 | 106 | { |
107 | - if (Application::POST_TYPE == $screenPostType |
|
108 | - && version_compare($this->getVersionFor('welcome'), $this->getUserMeta('welcome', 0), '>')) { |
|
109 | - $welcomeText = '0.0.0' == glsr(OptionManager::class)->get('version_upgraded_from') |
|
110 | - ? __('Thanks for installing Site Reviews %s, we hope you love it!', 'site-reviews') |
|
111 | - : __('Thanks for updating to Site Reviews %s, we hope you love the changes!', 'site-reviews'); |
|
112 | - echo glsr()->render('partials/notices/welcome', [ |
|
113 | - 'text' => sprintf($welcomeText, glsr()->version), |
|
114 | - ]); |
|
107 | + if( Application::POST_TYPE == $screenPostType |
|
108 | + && version_compare( $this->getVersionFor( 'welcome' ), $this->getUserMeta( 'welcome', 0 ), '>' ) ) { |
|
109 | + $welcomeText = '0.0.0' == glsr( OptionManager::class )->get( 'version_upgraded_from' ) |
|
110 | + ? __( 'Thanks for installing Site Reviews %s, we hope you love it!', 'site-reviews' ) |
|
111 | + : __( 'Thanks for updating to Site Reviews %s, we hope you love the changes!', 'site-reviews' ); |
|
112 | + echo glsr()->render( 'partials/notices/welcome', [ |
|
113 | + 'text' => sprintf( $welcomeText, glsr()->version ), |
|
114 | + ] ); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
@@ -120,12 +120,12 @@ discard block |
||
120 | 120 | * @param mixed $fallback |
121 | 121 | * @return mixed |
122 | 122 | */ |
123 | - protected function setUserMeta($key, $value) |
|
123 | + protected function setUserMeta( $key, $value ) |
|
124 | 124 | { |
125 | 125 | $userId = get_current_user_id(); |
126 | - $meta = (array) get_user_meta($userId, static::USER_META_KEY, true); |
|
127 | - $meta = array_filter(wp_parse_args($meta, [])); |
|
126 | + $meta = (array)get_user_meta( $userId, static::USER_META_KEY, true ); |
|
127 | + $meta = array_filter( wp_parse_args( $meta, [] ) ); |
|
128 | 128 | $meta[$key] = $value; |
129 | - update_user_meta($userId, static::USER_META_KEY, $meta); |
|
129 | + update_user_meta( $userId, static::USER_META_KEY, $meta ); |
|
130 | 130 | } |
131 | 131 | } |