@@ -1,15 +1,15 @@ discard block |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | 3 | <div id="faq-01" class="glsr-card postbox"> |
4 | 4 | <div class="glsr-card-header"> |
5 | 5 | <h3>How do I add additional values to the schema?</h3> |
6 | 6 | <button type="button" class="handlediv" aria-expanded="true"> |
7 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
7 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
8 | 8 | <span class="toggle-indicator" aria-hidden="true"></span> |
9 | 9 | </button> |
10 | 10 | </div> |
11 | 11 | <div class="inside"> |
12 | - <p>To add additional values to the generated schema, use the <code><a href="<?= admin_url('edit.php?post_type=site-review&page=documentation#!hooks'); ?>" data-expand="#hooks-07">site-reviews/schema/[SCHEMA_TYPE]</a></code> hook in your theme's functions.php file.</p> |
|
12 | + <p>To add additional values to the generated schema, use the <code><a href="<?= admin_url( 'edit.php?post_type=site-review&page=documentation#!hooks' ); ?>" data-expand="#hooks-07">site-reviews/schema/[SCHEMA_TYPE]</a></code> hook in your theme's functions.php file.</p> |
|
13 | 13 | <p>Make sure to use Google's <a href="https://search.google.com/structured-data/testing-tool">Structured Data Testing Tool</a> to test the schema after any custom modifications have been made.</p> |
14 | 14 | <pre><code class="php">/** |
15 | 15 | * Modifies the schema created by Site Reviews. |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | <div class="glsr-card-header"> |
35 | 35 | <h3>How do I add pagination to my reviews?</h3> |
36 | 36 | <button type="button" class="handlediv" aria-expanded="true"> |
37 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
37 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
38 | 38 | <span class="toggle-indicator" aria-hidden="true"></span> |
39 | 39 | </button> |
40 | 40 | </div> |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | <p>If you are using the shortcodes, then use the <code>pagination</code> and <code>count</code> options.</p> |
44 | 44 | <p>For example, this will paginate reviews to 10 reviews per-page:</p> |
45 | 45 | <pre><code class="php">[site_reviews pagination=ajax count=10]</code></pre> |
46 | - <p>To lean more about the available shortcode options and how to use them, please see the <code><a href="<?= admin_url('edit.php?post_type=site-review&page=documentation#!shortcodes'); ?>">Documentation > Shortcodes</a></code> page.</p> |
|
46 | + <p>To lean more about the available shortcode options and how to use them, please see the <code><a href="<?= admin_url( 'edit.php?post_type=site-review&page=documentation#!shortcodes' ); ?>">Documentation > Shortcodes</a></code> page.</p> |
|
47 | 47 | </div> |
48 | 48 | </div> |
49 | 49 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | <div class="glsr-card-header"> |
52 | 52 | <h3>How do I assign reviews to a page?</h3> |
53 | 53 | <button type="button" class="handlediv" aria-expanded="true"> |
54 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
54 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
55 | 55 | <span class="toggle-indicator" aria-hidden="true"></span> |
56 | 56 | </button> |
57 | 57 | </div> |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | <p>If you use <code>post_id</code> as the value, then Site Reviews will know to automatically use the Page ID of the current page.</p> |
70 | 70 | <p>If you use <code>parent_id</code> as the value, then Site Reviews will know to automatically use the Page ID of the current page's Parent.</p> |
71 | 71 | <p>You can, of course, also directly enter the numerical WordPress Page ID of the page instead if your prefer.</p> |
72 | - <p>To lean more about the available shortcode options and how to use them, please see the <code><a href="<?= admin_url('edit.php?post_type=site-review&page=documentation#!shortcodes'); ?>">Documentation > Shortcodes</a></code> page.</p> |
|
72 | + <p>To lean more about the available shortcode options and how to use them, please see the <code><a href="<?= admin_url( 'edit.php?post_type=site-review&page=documentation#!shortcodes' ); ?>">Documentation > Shortcodes</a></code> page.</p> |
|
73 | 73 | </div> |
74 | 74 | </div> |
75 | 75 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | <div class="glsr-card-header"> |
78 | 78 | <h3>How do I change the font?</h3> |
79 | 79 | <button type="button" class="handlediv" aria-expanded="true"> |
80 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
80 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
81 | 81 | <span class="toggle-indicator" aria-hidden="true"></span> |
82 | 82 | </button> |
83 | 83 | </div> |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | <div class="glsr-card-header"> |
94 | 94 | <h3>How do I change the order of the review fields?</h3> |
95 | 95 | <button type="button" class="handlediv" aria-expanded="true"> |
96 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
96 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
97 | 97 | <span class="toggle-indicator" aria-hidden="true"></span> |
98 | 98 | </button> |
99 | 99 | </div> |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | <div class="glsr-card-header"> |
122 | 122 | <h3>How do I change the order of the reviews summary fields?</h3> |
123 | 123 | <button type="button" class="handlediv" aria-expanded="true"> |
124 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
124 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
125 | 125 | <span class="toggle-indicator" aria-hidden="true"></span> |
126 | 126 | </button> |
127 | 127 | </div> |
@@ -147,12 +147,12 @@ discard block |
||
147 | 147 | <div class="glsr-card-header"> |
148 | 148 | <h3>How do I change the order of the submission form fields?</h3> |
149 | 149 | <button type="button" class="handlediv" aria-expanded="true"> |
150 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
150 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
151 | 151 | <span class="toggle-indicator" aria-hidden="true"></span> |
152 | 152 | </button> |
153 | 153 | </div> |
154 | 154 | <div class="inside"> |
155 | - <p>To customise the order of the fields in the review submission form, use the <code><a href="<?= admin_url('edit.php?post_type=site-review&page=documentation#!hooks'); ?>" data-expand="#hooks-01">site-reviews/submission-form/order</a></code> filter hook in your theme's <code>functions.php</code> file.</p> |
|
155 | + <p>To customise the order of the fields in the review submission form, use the <code><a href="<?= admin_url( 'edit.php?post_type=site-review&page=documentation#!hooks' ); ?>" data-expand="#hooks-01">site-reviews/submission-form/order</a></code> filter hook in your theme's <code>functions.php</code> file.</p> |
|
156 | 156 | <pre><code class="php">/** |
157 | 157 | * Customises the order of the fields used in the Site Reviews submission form. |
158 | 158 | * Paste this in your active theme's functions.php file. |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | 'terms', |
172 | 172 | ]; |
173 | 173 | });</code></pre> |
174 | - <p>If you have used the example above and the submission-form fields are not working correctly, check the <code><a href="<?= admin_url('edit.php?post_type=site-review&page=tools#!console'); ?>">Tools → Console</a></code> for errors.</p> |
|
174 | + <p>If you have used the example above and the submission-form fields are not working correctly, check the <code><a href="<?= admin_url( 'edit.php?post_type=site-review&page=tools#!console' ); ?>">Tools → Console</a></code> for errors.</p> |
|
175 | 175 | </div> |
176 | 176 | </div> |
177 | 177 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | <div class="glsr-card-header"> |
180 | 180 | <h3>How do I change the pagination query string?</h3> |
181 | 181 | <button type="button" class="handlediv" aria-expanded="true"> |
182 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
182 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
183 | 183 | <span class="toggle-indicator" aria-hidden="true"></span> |
184 | 184 | </button> |
185 | 185 | </div> |
@@ -201,12 +201,12 @@ discard block |
||
201 | 201 | <div class="glsr-card-header"> |
202 | 202 | <h3>How do I change the text of...?</h3> |
203 | 203 | <button type="button" class="handlediv" aria-expanded="true"> |
204 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
204 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
205 | 205 | <span class="toggle-indicator" aria-hidden="true"></span> |
206 | 206 | </button> |
207 | 207 | </div> |
208 | 208 | <div class="inside"> |
209 | - <p>You can change any text in the plugin on the <code><a href="<?= admin_url('edit.php?post_type=site-review&page=settings#!translations'); ?>">Settings → Translations</a></code> page.</p> |
|
209 | + <p>You can change any text in the plugin on the <code><a href="<?= admin_url( 'edit.php?post_type=site-review&page=settings#!translations' ); ?>">Settings → Translations</a></code> page.</p> |
|
210 | 210 | </div> |
211 | 211 | </div> |
212 | 212 | |
@@ -214,12 +214,12 @@ discard block |
||
214 | 214 | <div class="glsr-card-header"> |
215 | 215 | <h3>How do I create a review programmatically?</h3> |
216 | 216 | <button type="button" class="handlediv" aria-expanded="true"> |
217 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
217 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
218 | 218 | <span class="toggle-indicator" aria-hidden="true"></span> |
219 | 219 | </button> |
220 | 220 | </div> |
221 | 221 | <div class="inside"> |
222 | - <p>Site Reviews provides a <code><a href="<?= admin_url('edit.php?post_type=site-review&page=documentation#!functions'); ?>" data-expand="#functions-02">glsr_create_review()</a></code> helper function to easily create a review.</p> |
|
222 | + <p>Site Reviews provides a <code><a href="<?= admin_url( 'edit.php?post_type=site-review&page=documentation#!functions' ); ?>" data-expand="#functions-02">glsr_create_review()</a></code> helper function to easily create a review.</p> |
|
223 | 223 | <p>Here is an example:</p> |
224 | 224 | <pre><code class="php">if (function_exists('glsr_create_review')) { |
225 | 225 | $review = glsr_create_review([ |
@@ -239,12 +239,12 @@ discard block |
||
239 | 239 | <div class="glsr-card-header"> |
240 | 240 | <h3>How do I customise the stars?</h3> |
241 | 241 | <button type="button" class="handlediv" aria-expanded="true"> |
242 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
242 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
243 | 243 | <span class="toggle-indicator" aria-hidden="true"></span> |
244 | 244 | </button> |
245 | 245 | </div> |
246 | 246 | <div class="inside"> |
247 | - <p>To customise the star images used by the plugin, use the <code><a href="<?= admin_url('edit.php?post_type=site-review&page=documentation#!hooks'); ?>" data-expand="#hooks-02">site-reviews/config/inline-styles</a></code> filter hook in your theme's <code>functions.php</code> file.</p> |
|
247 | + <p>To customise the star images used by the plugin, use the <code><a href="<?= admin_url( 'edit.php?post_type=site-review&page=documentation#!hooks' ); ?>" data-expand="#hooks-02">site-reviews/config/inline-styles</a></code> filter hook in your theme's <code>functions.php</code> file.</p> |
|
248 | 248 | <p>Here is an example:</p> |
249 | 249 | <pre><code class="php">/** |
250 | 250 | * Customises the stars used by Site Reviews. |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | <li>Open the SVG images that you copied with a text editor</li> |
267 | 267 | <li>Change the <a target="_blank" href="https://www.hexcolortool.com">hex colour code</a> to the one you want</li> |
268 | 268 | <li>Install and activate the <a target="_blank" href="https://wordpress.org/plugins/safe-svg/">Safe SVG</a> plugin</li> |
269 | - <li>Upload the edited SVG images to your <a href="<?= admin_url('upload.php'); ?>">Media Library</a></li> |
|
269 | + <li>Upload the edited SVG images to your <a href="<?= admin_url( 'upload.php' ); ?>">Media Library</a></li> |
|
270 | 270 | <li>Copy the File URL of the uploaded SVG images and paste them into the snippet above</li> |
271 | 271 | </ol> |
272 | 272 | </div> |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | <div class="glsr-card-header"> |
277 | 277 | <h3>How do I hide the form after a review is submitted?</h3> |
278 | 278 | <button type="button" class="handlediv" aria-expanded="true"> |
279 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
279 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
280 | 280 | <span class="toggle-indicator" aria-hidden="true"></span> |
281 | 281 | </button> |
282 | 282 | </div> |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | });"; |
299 | 299 | });</code></pre> |
300 | 300 | <p>You can also hide the form from registered users who have already submitted a review.</p> |
301 | - <p>To do this, you will need to first make sure that the "Limit Reviews" setting on the <code><a href="<?= admin_url('edit.php?post_type=site-review&page=settings#!submissions'); ?>">Settings → Submissions</a></code> page is set to "By Username". Once that is done, you can use the following code snippet:</p> |
|
301 | + <p>To do this, you will need to first make sure that the "Limit Reviews" setting on the <code><a href="<?= admin_url( 'edit.php?post_type=site-review&page=settings#!submissions' ); ?>">Settings → Submissions</a></code> page is set to "By Username". Once that is done, you can use the following code snippet:</p> |
|
302 | 302 | <pre><code class="php">/** |
303 | 303 | * Hides the submission form from registered users who have already submitted a review |
304 | 304 | * Paste this in your active theme's functions.php file |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | <div class="glsr-card-header"> |
320 | 320 | <h3>How do I limit the submitted review length?</h3> |
321 | 321 | <button type="button" class="handlediv" aria-expanded="true"> |
322 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
322 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
323 | 323 | <span class="toggle-indicator" aria-hidden="true"></span> |
324 | 324 | </button> |
325 | 325 | </div> |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | <div class="glsr-card-header"> |
358 | 358 | <h3>How do I order pages with assigned reviews by rating or ranking?</h3> |
359 | 359 | <button type="button" class="handlediv" aria-expanded="true"> |
360 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
360 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
361 | 361 | <span class="toggle-indicator" aria-hidden="true"></span> |
362 | 362 | </button> |
363 | 363 | </div> |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | <div class="glsr-card-header"> |
414 | 414 | <h3>How do I redirect to a custom URL after a form is submitted?</h3> |
415 | 415 | <button type="button" class="handlediv" aria-expanded="true"> |
416 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
416 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
417 | 417 | <span class="toggle-indicator" aria-hidden="true"></span> |
418 | 418 | </button> |
419 | 419 | </div> |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | <div class="glsr-card-header"> |
427 | 427 | <h3>How do I remove the dash in front of the author's name?</h3> |
428 | 428 | <button type="button" class="handlediv" aria-expanded="true"> |
429 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
429 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
430 | 430 | <span class="toggle-indicator" aria-hidden="true"></span> |
431 | 431 | </button> |
432 | 432 | </div> |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | <div class="glsr-card-header"> |
443 | 443 | <h3>How do I use the plugin templates in my theme?</h3> |
444 | 444 | <button type="button" class="handlediv" aria-expanded="true"> |
445 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
445 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
446 | 446 | <span class="toggle-indicator" aria-hidden="true"></span> |
447 | 447 | </button> |
448 | 448 | </div> |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | 3 | <p>Hooks (also known as <a href="https://developer.wordpress.org/plugins/hooks/index.html">Actions and Filters</a>) are used in your theme's <code>functions.php</code> file to make changes to the plugin.</p> |
4 | 4 | |
@@ -6,13 +6,13 @@ discard block |
||
6 | 6 | <div class="glsr-card-header"> |
7 | 7 | <h3>Customise the order of the fields in the review submission form</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> |
13 | 13 | <div class="inside"> |
14 | 14 | <p>Use this hook to customise the order of the fields in the review submission form used by Site Reviews.</p> |
15 | - <p>See the <code><a data-expand="#faq-07" href="<?= admin_url('edit.php?post_type=site-review&page=documentation#!faq'); ?>">FAQ</a></code> for a detailed example of how to use this hook.</p> |
|
15 | + <p>See the <code><a data-expand="#faq-07" href="<?= admin_url( 'edit.php?post_type=site-review&page=documentation#!faq' ); ?>">FAQ</a></code> for a detailed example of how to use this hook.</p> |
|
16 | 16 | <pre><code class="php">/** |
17 | 17 | * Customises the order of the fields used in the Site Reviews submission form. |
18 | 18 | * Paste this in your active theme's functions.php file. |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | <div class="glsr-card-header"> |
31 | 31 | <h3>Customise the star images</h3> |
32 | 32 | <button type="button" class="handlediv" aria-expanded="true"> |
33 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
33 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
34 | 34 | <span class="toggle-indicator" aria-hidden="true"></span> |
35 | 35 | </button> |
36 | 36 | </div> |
37 | 37 | <div class="inside"> |
38 | 38 | <p>Use this hook to customise the star images used by Site Reviews.</p> |
39 | - <p>See the <code><a data-expand="#faq-11" href="<?= admin_url('edit.php?post_type=site-review&page=documentation#!faq'); ?>">FAQ</a></code> for a detailed example of how to use this hook.</p> |
|
39 | + <p>See the <code><a data-expand="#faq-11" href="<?= admin_url( 'edit.php?post_type=site-review&page=documentation#!faq' ); ?>">FAQ</a></code> for a detailed example of how to use this hook.</p> |
|
40 | 40 | <pre><code class="php">/** |
41 | 41 | * Customises the stars used by Site Reviews. |
42 | 42 | * Paste this in your active theme's functions.php file. |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | <div class="glsr-card-header"> |
55 | 55 | <h3>Disable the plugin javascript</h3> |
56 | 56 | <button type="button" class="handlediv" aria-expanded="true"> |
57 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
57 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
58 | 58 | <span class="toggle-indicator" aria-hidden="true"></span> |
59 | 59 | </button> |
60 | 60 | </div> |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | <div class="glsr-card-header"> |
74 | 74 | <h3>Disable the plugin stylesheet</h3> |
75 | 75 | <button type="button" class="handlediv" aria-expanded="true"> |
76 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
76 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
77 | 77 | <span class="toggle-indicator" aria-hidden="true"></span> |
78 | 78 | </button> |
79 | 79 | </div> |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | <div class="glsr-card-header"> |
93 | 93 | <h3>Disable the polyfill.io script</h3> |
94 | 94 | <button type="button" class="handlediv" aria-expanded="true"> |
95 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
95 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
96 | 96 | <span class="toggle-indicator" aria-hidden="true"></span> |
97 | 97 | </button> |
98 | 98 | </div> |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | <div class="glsr-card-header"> |
113 | 113 | <h3>Do something immediately after a review has been submitted</h3> |
114 | 114 | <button type="button" class="handlediv" aria-expanded="true"> |
115 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
115 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
116 | 116 | <span class="toggle-indicator" aria-hidden="true"></span> |
117 | 117 | </button> |
118 | 118 | </div> |
@@ -136,14 +136,14 @@ discard block |
||
136 | 136 | <div class="glsr-card-header"> |
137 | 137 | <h3>Modify the schema</h3> |
138 | 138 | <button type="button" class="handlediv" aria-expanded="true"> |
139 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
139 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
140 | 140 | <span class="toggle-indicator" aria-hidden="true"></span> |
141 | 141 | </button> |
142 | 142 | </div> |
143 | 143 | <div class="inside"> |
144 | 144 | <p>Use this hook if you would like to modify the schema type properties.</p> |
145 | 145 | <p>This hook is specific to the schema type. For example, to modify the schema properties for the LocalBusiness schema type you would use the <code>site-reviews/schema/LocalBusiness</code> hook, but to modify the schema properties for the Product schema type you would use the <code>site-reviews/schema/Product</code> hook.</p> |
146 | - <p>See the <code><a data-expand="#faq-01" href="<?= admin_url('edit.php?post_type=site-review&page=documentation#!faq'); ?>">FAQ</a></code> for a detailed example of how to use this hook.</p> |
|
146 | + <p>See the <code><a data-expand="#faq-01" href="<?= admin_url( 'edit.php?post_type=site-review&page=documentation#!faq' ); ?>">FAQ</a></code> for a detailed example of how to use this hook.</p> |
|
147 | 147 | <p>Make sure to use Google's <a href="https://search.google.com/structured-data/testing-tool">Structured Data Testing Tool</a> to test the schema after any custom modifications have been made.</p> |
148 | 148 | <pre><code class="php">/** |
149 | 149 | * Modifies the properties of the schema created by Site Reviews. |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | <div class="glsr-card-header"> |
164 | 164 | <h3>Modify the submitted review before it is saved</h3> |
165 | 165 | <button type="button" class="handlediv" aria-expanded="true"> |
166 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
166 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
167 | 167 | <span class="toggle-indicator" aria-hidden="true"></span> |
168 | 168 | </button> |
169 | 169 | </div> |
@@ -1,7 +1,7 @@ |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | -<p><?= __('The JSON-LD schema is disabled by default. To use it, please enable the option in your blocks or shortcodes. The schema appears in Google\'s search results and shows the star rating and other information about your reviews. If the schema has been enabled, you can use Google\'s <a href="https://search.google.com/structured-data/testing-tool">Structured Data Testing Tool</a> to test your pages for valid schema data.', 'site-reviews'); ?></p> |
|
4 | -<p><?= __('You may override any of these options on a per-post/page basis by using its Custom Field name and adding a custom value using the <a href="https://codex.wordpress.org/Using_Custom_Fields#Usage">Custom Fields</a> metabox.', 'site-reviews'); ?></p> |
|
3 | +<p><?= __( 'The JSON-LD schema is disabled by default. To use it, please enable the option in your blocks or shortcodes. The schema appears in Google\'s search results and shows the star rating and other information about your reviews. If the schema has been enabled, you can use Google\'s <a href="https://search.google.com/structured-data/testing-tool">Structured Data Testing Tool</a> to test your pages for valid schema data.', 'site-reviews' ); ?></p> |
|
4 | +<p><?= __( 'You may override any of these options on a per-post/page basis by using its Custom Field name and adding a custom value using the <a href="https://codex.wordpress.org/Using_Custom_Fields#Usage">Custom Fields</a> metabox.', 'site-reviews' ); ?></p> |
|
5 | 5 | <table class="form-table"> |
6 | 6 | <tbody> |
7 | 7 | {{ rows }} |
@@ -25,18 +25,18 @@ discard block |
||
25 | 25 | protected $translator; |
26 | 26 | protected $welcome; |
27 | 27 | |
28 | - public function __construct(Application $app) |
|
28 | + public function __construct( Application $app ) |
|
29 | 29 | { |
30 | 30 | $this->app = $app; |
31 | - $this->admin = $app->make(AdminController::class); |
|
32 | - $this->basename = plugin_basename($app->file); |
|
33 | - $this->blocks = $app->make(BlocksController::class); |
|
34 | - $this->editor = $app->make(EditorController::class); |
|
35 | - $this->listtable = $app->make(ListTableController::class); |
|
36 | - $this->main = $app->make(MainController::class); |
|
37 | - $this->public = $app->make(PublicController::class); |
|
38 | - $this->translator = $app->make(Translator::class); |
|
39 | - $this->welcome = $app->make(WelcomeController::class); |
|
31 | + $this->admin = $app->make( AdminController::class ); |
|
32 | + $this->basename = plugin_basename( $app->file ); |
|
33 | + $this->blocks = $app->make( BlocksController::class ); |
|
34 | + $this->editor = $app->make( EditorController::class ); |
|
35 | + $this->listtable = $app->make( ListTableController::class ); |
|
36 | + $this->main = $app->make( MainController::class ); |
|
37 | + $this->public = $app->make( PublicController::class ); |
|
38 | + $this->translator = $app->make( Translator::class ); |
|
39 | + $this->welcome = $app->make( WelcomeController::class ); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -44,37 +44,37 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function run() |
46 | 46 | { |
47 | - add_filter('map_meta_cap', [$this->admin, 'filterCreateCapability'], 10, 2); |
|
48 | - add_filter('mce_external_plugins', [$this->admin, 'filterTinymcePlugins'], 15); |
|
49 | - add_filter('plugin_action_links_'.$this->basename, [$this->admin, 'filterActionLinks']); |
|
50 | - add_filter('dashboard_glance_items', [$this->admin, 'filterDashboardGlanceItems']); |
|
51 | - add_filter('block_categories', [$this->blocks, 'filterBlockCategories']); |
|
52 | - add_filter('classic_editor_enabled_editors_for_post_type', [$this->blocks, 'filterEnabledEditors'], 10, 2); |
|
53 | - add_filter('use_block_editor_for_post_type', [$this->blocks, 'filterUseBlockEditor'], 10, 2); |
|
54 | - add_filter('wp_editor_settings', [$this->editor, 'filterEditorSettings']); |
|
55 | - add_filter('the_editor', [$this->editor, 'filterEditorTextarea']); |
|
56 | - add_filter('is_protected_meta', [$this->editor, 'filterIsProtectedMeta'], 10, 3); |
|
57 | - add_filter('gettext', [$this->editor, 'filterPostStatusLabels'], 10, 3); |
|
58 | - add_filter('gettext_with_context', [$this->editor, 'filterPostStatusLabelsWithContext'], 10, 4); |
|
59 | - add_filter('post_updated_messages', [$this->editor, 'filterUpdateMessages']); |
|
60 | - add_filter('bulk_post_updated_messages', [$this->listtable, 'filterBulkUpdateMessages'], 10, 2); |
|
61 | - add_filter('manage_'.Application::POST_TYPE.'_posts_columns', [$this->listtable, 'filterColumnsForPostType']); |
|
62 | - add_filter('post_date_column_status', [$this->listtable, 'filterDateColumnStatus'], 10, 2); |
|
63 | - add_filter('default_hidden_columns', [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2); |
|
64 | - add_filter('display_post_states', [$this->listtable, 'filterPostStates'], 10, 2); |
|
65 | - add_filter('post_row_actions', [$this->listtable, 'filterRowActions'], 10, 2); |
|
66 | - add_filter('manage_edit-'.Application::POST_TYPE.'_sortable_columns', [$this->listtable, 'filterSortableColumns']); |
|
67 | - add_filter('ngettext', [$this->listtable, 'filterStatusText'], 10, 5); |
|
68 | - add_filter('script_loader_tag', [$this->public, 'filterEnqueuedScripts'], 10, 2); |
|
69 | - add_filter('site-reviews/config/forms/submission-form', [$this->public, 'filterFieldOrder'], 11); |
|
70 | - add_filter('query_vars', [$this->public, 'filterQueryVars']); |
|
71 | - add_filter('site-reviews/render/view', [$this->public, 'filterRenderView']); |
|
72 | - add_filter('gettext', [$this->translator, 'filterGettext'], 10, 3); |
|
73 | - add_filter('gettext_with_context', [$this->translator, 'filterGettextWithContext'], 10, 4); |
|
74 | - add_filter('ngettext', [$this->translator, 'filterNgettext'], 10, 5); |
|
75 | - add_filter('ngettext_with_context', [$this->translator, 'filterNgettextWithContext'], 10, 6); |
|
76 | - add_filter('plugin_action_links_'.$this->basename, [$this->welcome, 'filterActionLinks'], 9); |
|
77 | - add_filter('admin_title', [$this->welcome, 'filterAdminTitle']); |
|
78 | - add_filter('admin_footer_text', [$this->welcome, 'filterFooterText']); |
|
47 | + add_filter( 'map_meta_cap', [$this->admin, 'filterCreateCapability'], 10, 2 ); |
|
48 | + add_filter( 'mce_external_plugins', [$this->admin, 'filterTinymcePlugins'], 15 ); |
|
49 | + add_filter( 'plugin_action_links_'.$this->basename, [$this->admin, 'filterActionLinks'] ); |
|
50 | + add_filter( 'dashboard_glance_items', [$this->admin, 'filterDashboardGlanceItems'] ); |
|
51 | + add_filter( 'block_categories', [$this->blocks, 'filterBlockCategories'] ); |
|
52 | + add_filter( 'classic_editor_enabled_editors_for_post_type', [$this->blocks, 'filterEnabledEditors'], 10, 2 ); |
|
53 | + add_filter( 'use_block_editor_for_post_type', [$this->blocks, 'filterUseBlockEditor'], 10, 2 ); |
|
54 | + add_filter( 'wp_editor_settings', [$this->editor, 'filterEditorSettings'] ); |
|
55 | + add_filter( 'the_editor', [$this->editor, 'filterEditorTextarea'] ); |
|
56 | + add_filter( 'is_protected_meta', [$this->editor, 'filterIsProtectedMeta'], 10, 3 ); |
|
57 | + add_filter( 'gettext', [$this->editor, 'filterPostStatusLabels'], 10, 3 ); |
|
58 | + add_filter( 'gettext_with_context', [$this->editor, 'filterPostStatusLabelsWithContext'], 10, 4 ); |
|
59 | + add_filter( 'post_updated_messages', [$this->editor, 'filterUpdateMessages'] ); |
|
60 | + add_filter( 'bulk_post_updated_messages', [$this->listtable, 'filterBulkUpdateMessages'], 10, 2 ); |
|
61 | + add_filter( 'manage_'.Application::POST_TYPE.'_posts_columns', [$this->listtable, 'filterColumnsForPostType'] ); |
|
62 | + add_filter( 'post_date_column_status', [$this->listtable, 'filterDateColumnStatus'], 10, 2 ); |
|
63 | + add_filter( 'default_hidden_columns', [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2 ); |
|
64 | + add_filter( 'display_post_states', [$this->listtable, 'filterPostStates'], 10, 2 ); |
|
65 | + add_filter( 'post_row_actions', [$this->listtable, 'filterRowActions'], 10, 2 ); |
|
66 | + add_filter( 'manage_edit-'.Application::POST_TYPE.'_sortable_columns', [$this->listtable, 'filterSortableColumns'] ); |
|
67 | + add_filter( 'ngettext', [$this->listtable, 'filterStatusText'], 10, 5 ); |
|
68 | + add_filter( 'script_loader_tag', [$this->public, 'filterEnqueuedScripts'], 10, 2 ); |
|
69 | + add_filter( 'site-reviews/config/forms/submission-form', [$this->public, 'filterFieldOrder'], 11 ); |
|
70 | + add_filter( 'query_vars', [$this->public, 'filterQueryVars'] ); |
|
71 | + add_filter( 'site-reviews/render/view', [$this->public, 'filterRenderView'] ); |
|
72 | + add_filter( 'gettext', [$this->translator, 'filterGettext'], 10, 3 ); |
|
73 | + add_filter( 'gettext_with_context', [$this->translator, 'filterGettextWithContext'], 10, 4 ); |
|
74 | + add_filter( 'ngettext', [$this->translator, 'filterNgettext'], 10, 5 ); |
|
75 | + add_filter( 'ngettext_with_context', [$this->translator, 'filterNgettextWithContext'], 10, 6 ); |
|
76 | + add_filter( 'plugin_action_links_'.$this->basename, [$this->welcome, 'filterActionLinks'], 9 ); |
|
77 | + add_filter( 'admin_title', [$this->welcome, 'filterAdminTitle'] ); |
|
78 | + add_filter( 'admin_footer_text', [$this->welcome, 'filterFooterText'] ); |
|
79 | 79 | } |
80 | 80 | } |
@@ -16,31 +16,31 @@ 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 | - 'review_type' => __('Type', 'site-reviews'), |
|
30 | - 'rating' => __('Rating', 'site-reviews'), |
|
31 | - 'pinned' => __('Pinned', 'site-reviews'), |
|
27 | + 'assigned_to' => __( 'Assigned To', 'site-reviews' ), |
|
28 | + 'reviewer' => __( 'Author', 'site-reviews' ), |
|
29 | + 'review_type' => __( 'Type', 'site-reviews' ), |
|
30 | + 'rating' => __( 'Rating', 'site-reviews' ), |
|
31 | + 'pinned' => __( 'Pinned', 'site-reviews' ), |
|
32 | 32 | 'date' => '', |
33 | 33 | ], |
34 | 34 | 'menu_icon' => 'dashicons-star-half', |
35 | 35 | 'menu_name' => glsr()->name, |
36 | 36 | 'map_meta_cap' => true, |
37 | - 'plural' => __('Reviews', 'site-reviews'), |
|
37 | + 'plural' => __( 'Reviews', 'site-reviews' ), |
|
38 | 38 | 'post_type' => Application::POST_TYPE, |
39 | 39 | 'rest_controller_class' => RestReviewController::class, |
40 | 40 | 'show_in_rest' => true, |
41 | - 'single' => __('Review', 'site-reviews'), |
|
42 | - ]); |
|
43 | - $this->execute($command); |
|
41 | + 'single' => __( 'Review', 'site-reviews' ), |
|
42 | + ] ); |
|
43 | + $this->execute( $command ); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function registerShortcodes() |
51 | 51 | { |
52 | - $command = new RegisterShortcodes([ |
|
52 | + $command = new RegisterShortcodes( [ |
|
53 | 53 | 'site_reviews', |
54 | 54 | 'site_reviews_form', |
55 | 55 | 'site_reviews_summary', |
56 | - ]); |
|
57 | - $this->execute($command); |
|
56 | + ] ); |
|
57 | + $this->execute( $command ); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -63,16 +63,16 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function registerTaxonomy() |
65 | 65 | { |
66 | - $command = new RegisterTaxonomy([ |
|
66 | + $command = new RegisterTaxonomy( [ |
|
67 | 67 | 'hierarchical' => true, |
68 | - 'meta_box_cb' => [glsr(EditorController::class), 'renderTaxonomyMetabox'], |
|
68 | + 'meta_box_cb' => [glsr( EditorController::class ), 'renderTaxonomyMetabox'], |
|
69 | 69 | 'public' => false, |
70 | 70 | 'rest_controller_class' => RestCategoryController::class, |
71 | 71 | 'show_admin_column' => true, |
72 | 72 | 'show_in_rest' => true, |
73 | 73 | 'show_ui' => true, |
74 | - ]); |
|
75 | - $this->execute($command); |
|
74 | + ] ); |
|
75 | + $this->execute( $command ); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -81,23 +81,23 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function registerWidgets() |
83 | 83 | { |
84 | - $command = new RegisterWidgets([ |
|
84 | + $command = new RegisterWidgets( [ |
|
85 | 85 | 'site-reviews' => [ |
86 | 86 | 'class' => 'glsr-widget glsr-widget-site-reviews', |
87 | - 'description' => __('Site Reviews: Display your recent reviews.', 'site-reviews'), |
|
88 | - 'title' => __('Recent Reviews', 'site-reviews'), |
|
87 | + 'description' => __( 'Site Reviews: Display your recent reviews.', 'site-reviews' ), |
|
88 | + 'title' => __( 'Recent Reviews', 'site-reviews' ), |
|
89 | 89 | ], |
90 | 90 | 'site-reviews-form' => [ |
91 | 91 | 'class' => 'glsr-widget glsr-widget-site-reviews-form', |
92 | - 'description' => __('Site Reviews: Display a form to submit reviews.', 'site-reviews'), |
|
93 | - 'title' => __('Submit a Review', 'site-reviews'), |
|
92 | + 'description' => __( 'Site Reviews: Display a form to submit reviews.', 'site-reviews' ), |
|
93 | + 'title' => __( 'Submit a Review', 'site-reviews' ), |
|
94 | 94 | ], |
95 | 95 | 'site-reviews-summary' => [ |
96 | 96 | 'class' => 'glsr-widget glsr-widget-site-reviews-summary', |
97 | - 'description' => __('Site Reviews: Display a summary of your reviews.', 'site-reviews'), |
|
98 | - 'title' => __('Summary of Reviews', 'site-reviews'), |
|
97 | + 'description' => __( 'Site Reviews: Display a summary of your reviews.', 'site-reviews' ), |
|
98 | + 'title' => __( 'Summary of Reviews', 'site-reviews' ), |
|
99 | 99 | ], |
100 | - ]); |
|
101 | - $this->execute($command); |
|
100 | + ] ); |
|
101 | + $this->execute( $command ); |
|
102 | 102 | } |
103 | 103 | } |
@@ -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,19 +88,19 @@ 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 | - 'support' => __('Support', 'site-reviews'), |
|
95 | - ]); |
|
91 | + $tabs = apply_filters( 'site-reviews/addon/welcome/tabs', [ |
|
92 | + 'getting-started' => __( 'Getting Started', 'site-reviews' ), |
|
93 | + 'whatsnew' => __( 'What\'s New', 'site-reviews' ), |
|
94 | + 'support' => __( 'Support', 'site-reviews' ), |
|
95 | + ] ); |
|
96 | 96 | |
97 | - glsr()->render('pages/welcome/index', [ |
|
97 | + glsr()->render( 'pages/welcome/index', [ |
|
98 | 98 | 'data' => [ |
99 | 99 | 'context' => [ |
100 | 100 | ], |
101 | 101 | ], |
102 | 102 | 'tabs' => $tabs, |
103 | - 'template' => glsr(Template::class), |
|
104 | - ]); |
|
103 | + 'template' => glsr( Template::class ), |
|
104 | + ] ); |
|
105 | 105 | } |
106 | 106 | } |
@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | public function __construct() |
29 | 29 | { |
30 | 30 | static::$instance = $this; |
31 | - $this->file = realpath(trailingslashit(dirname(__DIR__)).static::ID.'.php'); |
|
32 | - $plugin = get_file_data($this->file, [ |
|
31 | + $this->file = realpath( trailingslashit( dirname( __DIR__ ) ).static::ID.'.php' ); |
|
32 | + $plugin = get_file_data( $this->file, [ |
|
33 | 33 | 'languages' => 'Domain Path', |
34 | 34 | 'name' => 'Plugin Name', |
35 | 35 | 'version' => 'Version', |
36 | - ], 'plugin'); |
|
37 | - array_walk($plugin, function ($value, $key) { |
|
36 | + ], 'plugin' ); |
|
37 | + array_walk( $plugin, function( $value, $key ) { |
|
38 | 38 | $this->$key = $value; |
39 | 39 | }); |
40 | 40 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function activate() |
46 | 46 | { |
47 | - $this->make(DefaultsManager::class)->set(); |
|
47 | + $this->make( DefaultsManager::class )->set(); |
|
48 | 48 | $this->scheduleCronJob(); |
49 | 49 | $this->upgrade(); |
50 | 50 | } |
@@ -55,34 +55,34 @@ discard block |
||
55 | 55 | public function catchFatalError() |
56 | 56 | { |
57 | 57 | $error = error_get_last(); |
58 | - if (E_ERROR !== $error['type'] || false === strpos($error['message'], $this->path())) { |
|
58 | + if( E_ERROR !== $error['type'] || false === strpos( $error['message'], $this->path() ) ) { |
|
59 | 59 | return; |
60 | 60 | } |
61 | - glsr_log()->error($error['message']); |
|
61 | + glsr_log()->error( $error['message'] ); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
65 | 65 | * @param string $name |
66 | 66 | * @return array |
67 | 67 | */ |
68 | - public function config($name) |
|
68 | + public function config( $name ) |
|
69 | 69 | { |
70 | - $configFile = $this->path('config/'.$name.'.php'); |
|
71 | - $config = file_exists($configFile) |
|
70 | + $configFile = $this->path( 'config/'.$name.'.php' ); |
|
71 | + $config = file_exists( $configFile ) |
|
72 | 72 | ? include $configFile |
73 | 73 | : []; |
74 | - return apply_filters('site-reviews/config/'.$name, $config); |
|
74 | + return apply_filters( 'site-reviews/config/'.$name, $config ); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
78 | 78 | * @param string $property |
79 | 79 | * @return string |
80 | 80 | */ |
81 | - public function constant($property, $className = 'static') |
|
81 | + public function constant( $property, $className = 'static' ) |
|
82 | 82 | { |
83 | 83 | $constant = $className.'::'.$property; |
84 | - return defined($constant) |
|
85 | - ? apply_filters('site-reviews/const/'.$property, constant($constant)) |
|
84 | + return defined( $constant ) |
|
85 | + ? apply_filters( 'site-reviews/const/'.$property, constant( $constant ) ) |
|
86 | 86 | : ''; |
87 | 87 | } |
88 | 88 | |
@@ -98,17 +98,17 @@ discard block |
||
98 | 98 | * @param string $view |
99 | 99 | * @return void|string |
100 | 100 | */ |
101 | - public function file($view) |
|
101 | + public function file( $view ) |
|
102 | 102 | { |
103 | - $view.= '.php'; |
|
103 | + $view .= '.php'; |
|
104 | 104 | $filePaths = []; |
105 | - if (glsr(Helper::class)->startsWith('templates/', $view)) { |
|
106 | - $filePaths[] = $this->themePath(glsr(Helper::class)->removePrefix('templates/', $view)); |
|
105 | + if( glsr( Helper::class )->startsWith( 'templates/', $view ) ) { |
|
106 | + $filePaths[] = $this->themePath( glsr( Helper::class )->removePrefix( 'templates/', $view ) ); |
|
107 | 107 | } |
108 | - $filePaths[] = $this->path($view); |
|
109 | - $filePaths[] = $this->path('views/'.$view); |
|
110 | - foreach ($filePaths as $file) { |
|
111 | - if (!file_exists($file)) { |
|
108 | + $filePaths[] = $this->path( $view ); |
|
109 | + $filePaths[] = $this->path( 'views/'.$view ); |
|
110 | + foreach( $filePaths as $file ) { |
|
111 | + if( !file_exists( $file ) ) { |
|
112 | 112 | continue; |
113 | 113 | } |
114 | 114 | return $file; |
@@ -120,33 +120,33 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function getDefaults() |
122 | 122 | { |
123 | - if (empty($this->defaults)) { |
|
124 | - $this->defaults = $this->make(DefaultsManager::class)->get(); |
|
123 | + if( empty($this->defaults) ) { |
|
124 | + $this->defaults = $this->make( DefaultsManager::class )->get(); |
|
125 | 125 | $this->upgrade(); |
126 | 126 | } |
127 | - return apply_filters('site-reviews/get/defaults', $this->defaults); |
|
127 | + return apply_filters( 'site-reviews/get/defaults', $this->defaults ); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
131 | 131 | * @return bool |
132 | 132 | */ |
133 | - public function getPermission($page = '') |
|
133 | + public function getPermission( $page = '' ) |
|
134 | 134 | { |
135 | 135 | $permissions = [ |
136 | 136 | 'addons' => 'install_plugins', |
137 | 137 | 'settings' => 'manage_options', |
138 | 138 | // 'welcome' => 'activate_plugins', |
139 | 139 | ]; |
140 | - return glsr_get($permissions, $page, $this->constant('CAPABILITY')); |
|
140 | + return glsr_get( $permissions, $page, $this->constant( 'CAPABILITY' ) ); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
144 | 144 | * @return bool |
145 | 145 | */ |
146 | - public function hasPermission($page = '') |
|
146 | + public function hasPermission( $page = '' ) |
|
147 | 147 | { |
148 | 148 | $isAdmin = $this->isAdmin(); |
149 | - return !$isAdmin || ($isAdmin && current_user_can($this->getPermission($page))); |
|
149 | + return !$isAdmin || ($isAdmin && current_user_can( $this->getPermission( $page ) )); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function init() |
156 | 156 | { |
157 | - $this->make(Actions::class)->run(); |
|
158 | - $this->make(Filters::class)->run(); |
|
157 | + $this->make( Actions::class )->run(); |
|
158 | + $this->make( Filters::class )->run(); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
@@ -170,14 +170,14 @@ discard block |
||
170 | 170 | * @param string $file |
171 | 171 | * @return string |
172 | 172 | */ |
173 | - public function path($file = '', $realpath = true) |
|
173 | + public function path( $file = '', $realpath = true ) |
|
174 | 174 | { |
175 | - $path = plugin_dir_path($this->file); |
|
176 | - if (!$realpath) { |
|
177 | - $path = trailingslashit(WP_PLUGIN_DIR).basename(dirname($this->file)); |
|
175 | + $path = plugin_dir_path( $this->file ); |
|
176 | + if( !$realpath ) { |
|
177 | + $path = trailingslashit( WP_PLUGIN_DIR ).basename( dirname( $this->file ) ); |
|
178 | 178 | } |
179 | - $path = trailingslashit($path).ltrim(trim($file), '/'); |
|
180 | - return apply_filters('site-reviews/path', $path, $file); |
|
179 | + $path = trailingslashit( $path ).ltrim( trim( $file ), '/' ); |
|
180 | + return apply_filters( 'site-reviews/path', $path, $file ); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | /** |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function registerAddons() |
187 | 187 | { |
188 | - do_action('site-reviews/addon/register', $this); |
|
188 | + do_action( 'site-reviews/addon/register', $this ); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | /** |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | */ |
194 | 194 | public function registerLanguages() |
195 | 195 | { |
196 | - load_plugin_textdomain(static::ID, false, |
|
197 | - trailingslashit(plugin_basename($this->path()).'/'.$this->languages) |
|
196 | + load_plugin_textdomain( static::ID, false, |
|
197 | + trailingslashit( plugin_basename( $this->path() ).'/'.$this->languages ) |
|
198 | 198 | ); |
199 | 199 | } |
200 | 200 | |
@@ -203,26 +203,26 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public function registerReviewTypes() |
205 | 205 | { |
206 | - $types = apply_filters('site-reviews/addon/types', []); |
|
207 | - $this->reviewTypes = wp_parse_args($types, [ |
|
208 | - 'local' => __('Local', 'site-reviews'), |
|
209 | - ]); |
|
206 | + $types = apply_filters( 'site-reviews/addon/types', [] ); |
|
207 | + $this->reviewTypes = wp_parse_args( $types, [ |
|
208 | + 'local' => __( 'Local', 'site-reviews' ), |
|
209 | + ] ); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
213 | 213 | * @param string $view |
214 | 214 | * @return void |
215 | 215 | */ |
216 | - public function render($view, array $data = []) |
|
216 | + public function render( $view, array $data = [] ) |
|
217 | 217 | { |
218 | - $view = apply_filters('site-reviews/render/view', $view, $data); |
|
219 | - $file = apply_filters('site-reviews/views/file', $this->file($view), $view, $data); |
|
220 | - if (!file_exists($file)) { |
|
221 | - glsr_log()->error('File not found: '.$file); |
|
218 | + $view = apply_filters( 'site-reviews/render/view', $view, $data ); |
|
219 | + $file = apply_filters( 'site-reviews/views/file', $this->file( $view ), $view, $data ); |
|
220 | + if( !file_exists( $file ) ) { |
|
221 | + glsr_log()->error( 'File not found: '.$file ); |
|
222 | 222 | return; |
223 | 223 | } |
224 | - $data = apply_filters('site-reviews/views/data', $data, $view); |
|
225 | - extract($data); |
|
224 | + $data = apply_filters( 'site-reviews/views/data', $data, $view ); |
|
225 | + extract( $data ); |
|
226 | 226 | include $file; |
227 | 227 | } |
228 | 228 | |
@@ -231,19 +231,19 @@ discard block |
||
231 | 231 | */ |
232 | 232 | public function scheduleCronJob() |
233 | 233 | { |
234 | - if (wp_next_scheduled(static::CRON_EVENT)) { |
|
234 | + if( wp_next_scheduled( static::CRON_EVENT ) ) { |
|
235 | 235 | return; |
236 | 236 | } |
237 | - wp_schedule_event(time(), 'twicedaily', static::CRON_EVENT); |
|
237 | + wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT ); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | /** |
241 | 241 | * @param string $file |
242 | 242 | * @return string |
243 | 243 | */ |
244 | - public function themePath($file = '') |
|
244 | + public function themePath( $file = '' ) |
|
245 | 245 | { |
246 | - return get_stylesheet_directory().'/'.static::ID.'/'.ltrim(trim($file), '/'); |
|
246 | + return get_stylesheet_directory().'/'.static::ID.'/'.ltrim( trim( $file ), '/' ); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | /** |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | */ |
252 | 252 | public function unscheduleCronJob() |
253 | 253 | { |
254 | - wp_unschedule_event(intval(wp_next_scheduled(static::CRON_EVENT)), static::CRON_EVENT); |
|
254 | + wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT ) ), static::CRON_EVENT ); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | */ |
260 | 260 | public function upgrade() |
261 | 261 | { |
262 | - $this->make(Upgrader::class)->run(); |
|
262 | + $this->make( Upgrader::class )->run(); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | /** |
@@ -267,10 +267,10 @@ discard block |
||
267 | 267 | * @return void |
268 | 268 | * @action upgrader_process_complete |
269 | 269 | */ |
270 | - public function upgraded($upgrader, array $data) |
|
270 | + public function upgraded( $upgrader, array $data ) |
|
271 | 271 | { |
272 | - if (array_key_exists('plugins', $data) |
|
273 | - && in_array(plugin_basename($this->file), $data['plugins']) |
|
272 | + if( array_key_exists( 'plugins', $data ) |
|
273 | + && in_array( plugin_basename( $this->file ), $data['plugins'] ) |
|
274 | 274 | && 'update' === $data['action'] |
275 | 275 | && 'plugin' === $data['type'] |
276 | 276 | ) { |
@@ -282,9 +282,9 @@ discard block |
||
282 | 282 | * @param string $path |
283 | 283 | * @return string |
284 | 284 | */ |
285 | - public function url($path = '') |
|
285 | + public function url( $path = '' ) |
|
286 | 286 | { |
287 | - $url = esc_url(plugin_dir_url($this->file).ltrim(trim($path), '/')); |
|
288 | - return apply_filters('site-reviews/url', $url, $path); |
|
287 | + $url = esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ) ); |
|
288 | + return apply_filters( 'site-reviews/url', $url, $path ); |
|
289 | 289 | } |
290 | 290 | } |
@@ -15,13 +15,13 @@ discard block |
||
15 | 15 | * Text Domain: site-reviews |
16 | 16 | * Domain Path: languages |
17 | 17 | */ |
18 | -defined('WPINC') || die; |
|
18 | +defined( 'WPINC' ) || die; |
|
19 | 19 | |
20 | -if (!class_exists('GL_Plugin_Check_v3')) { |
|
20 | +if( !class_exists( 'GL_Plugin_Check_v3' ) ) { |
|
21 | 21 | require_once __DIR__.'/activate.php'; |
22 | 22 | } |
23 | -$check = new GL_Plugin_Check_v3(__FILE__); |
|
24 | -if (!$check->canProceed()) { |
|
23 | +$check = new GL_Plugin_Check_v3( __FILE__ ); |
|
24 | +if( !$check->canProceed() ) { |
|
25 | 25 | return; |
26 | 26 | } |
27 | 27 | require_once __DIR__.'/autoload.php'; |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | require_once __DIR__.'/helpers.php'; |
31 | 31 | |
32 | 32 | $app = new GeminiLabs\SiteReviews\Application(); |
33 | -$app->make('Provider')->register($app); |
|
34 | -register_activation_hook(__FILE__, array($app, 'activate')); |
|
35 | -register_deactivation_hook(__FILE__, array($app, 'deactivate')); |
|
36 | -register_shutdown_function(array($app, 'catchFatalError')); |
|
33 | +$app->make( 'Provider' )->register( $app ); |
|
34 | +register_activation_hook( __FILE__, array( $app, 'activate' ) ); |
|
35 | +register_deactivation_hook( __FILE__, array( $app, 'deactivate' ) ); |
|
36 | +register_shutdown_function( array( $app, 'catchFatalError' ) ); |
|
37 | 37 | $app->init(); |
@@ -19,11 +19,11 @@ discard block |
||
19 | 19 | /** |
20 | 20 | * @return false|Review |
21 | 21 | */ |
22 | - public function create(CreateReview $command) |
|
22 | + public function create( CreateReview $command ) |
|
23 | 23 | { |
24 | - $reviewValues = glsr(CreateReviewDefaults::class)->restrict((array) $command); |
|
25 | - $reviewValues = apply_filters('site-reviews/create/review-values', $reviewValues, $command); |
|
26 | - $reviewValues = glsr(Helper::class)->prefixArrayKeys($reviewValues); |
|
24 | + $reviewValues = glsr( CreateReviewDefaults::class )->restrict( (array)$command ); |
|
25 | + $reviewValues = apply_filters( 'site-reviews/create/review-values', $reviewValues, $command ); |
|
26 | + $reviewValues = glsr( Helper::class )->prefixArrayKeys( $reviewValues ); |
|
27 | 27 | unset($reviewValues['json']); // @todo remove the need for this |
28 | 28 | $postValues = [ |
29 | 29 | 'comment_status' => 'closed', |
@@ -31,20 +31,20 @@ discard block |
||
31 | 31 | 'ping_status' => 'closed', |
32 | 32 | 'post_content' => $reviewValues['_content'], |
33 | 33 | 'post_date' => $reviewValues['_date'], |
34 | - 'post_date_gmt' => get_gmt_from_date($reviewValues['_date']), |
|
34 | + 'post_date_gmt' => get_gmt_from_date( $reviewValues['_date'] ), |
|
35 | 35 | 'post_name' => $reviewValues['_review_type'].'-'.$reviewValues['_review_id'], |
36 | - 'post_status' => $this->getNewPostStatus($reviewValues, $command->blacklisted), |
|
36 | + 'post_status' => $this->getNewPostStatus( $reviewValues, $command->blacklisted ), |
|
37 | 37 | 'post_title' => $reviewValues['_title'], |
38 | 38 | 'post_type' => Application::POST_TYPE, |
39 | 39 | ]; |
40 | - $postId = wp_insert_post($postValues, true); |
|
41 | - if (is_wp_error($postId)) { |
|
42 | - glsr_log()->error($postId->get_error_message())->debug($postValues); |
|
40 | + $postId = wp_insert_post( $postValues, true ); |
|
41 | + if( is_wp_error( $postId ) ) { |
|
42 | + glsr_log()->error( $postId->get_error_message() )->debug( $postValues ); |
|
43 | 43 | return false; |
44 | 44 | } |
45 | - $this->setTerms($postId, $command->category); |
|
46 | - $review = $this->single(get_post($postId)); |
|
47 | - do_action('site-reviews/review/created', $review, $command); |
|
45 | + $this->setTerms( $postId, $command->category ); |
|
46 | + $review = $this->single( get_post( $postId ) ); |
|
47 | + do_action( 'site-reviews/review/created', $review, $command ); |
|
48 | 48 | return $review; |
49 | 49 | } |
50 | 50 | |
@@ -52,29 +52,29 @@ discard block |
||
52 | 52 | * @param string $metaReviewId |
53 | 53 | * @return void |
54 | 54 | */ |
55 | - public function delete($metaReviewId) |
|
55 | + public function delete( $metaReviewId ) |
|
56 | 56 | { |
57 | - if ($postId = $this->getPostId($metaReviewId)) { |
|
58 | - wp_delete_post($postId, true); |
|
57 | + if( $postId = $this->getPostId( $metaReviewId ) ) { |
|
58 | + wp_delete_post( $postId, true ); |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
63 | 63 | * @return object |
64 | 64 | */ |
65 | - public function get(array $args = []) |
|
65 | + public function get( array $args = [] ) |
|
66 | 66 | { |
67 | - $args = glsr(ReviewsDefaults::class)->merge($args); |
|
68 | - $metaQuery = glsr(QueryBuilder::class)->buildQuery( |
|
67 | + $args = glsr( ReviewsDefaults::class )->merge( $args ); |
|
68 | + $metaQuery = glsr( QueryBuilder::class )->buildQuery( |
|
69 | 69 | ['assigned_to', 'email', 'ip_address', 'type', 'rating'], |
70 | 70 | $args |
71 | 71 | ); |
72 | - $taxQuery = glsr(QueryBuilder::class)->buildQuery( |
|
72 | + $taxQuery = glsr( QueryBuilder::class )->buildQuery( |
|
73 | 73 | ['category'], |
74 | - ['category' => $this->normalizeTermIds($args['category'])] |
|
74 | + ['category' => $this->normalizeTermIds( $args['category'] )] |
|
75 | 75 | ); |
76 | - $paged = glsr(QueryBuilder::class)->getPaged( |
|
77 | - wp_validate_boolean($args['pagination']) |
|
76 | + $paged = glsr( QueryBuilder::class )->getPaged( |
|
77 | + wp_validate_boolean( $args['pagination'] ) |
|
78 | 78 | ); |
79 | 79 | $parameters = [ |
80 | 80 | 'meta_key' => '_pinned', |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | 'offset' => $args['offset'], |
83 | 83 | 'order' => $args['order'], |
84 | 84 | 'orderby' => 'meta_value '.$args['orderby'], |
85 | - 'paged' => glsr_get($args, 'paged', $paged), |
|
85 | + 'paged' => glsr_get( $args, 'paged', $paged ), |
|
86 | 86 | 'post__in' => $args['post__in'], |
87 | 87 | 'post__not_in' => $args['post__not_in'], |
88 | 88 | 'post_status' => 'publish', |
@@ -90,62 +90,62 @@ discard block |
||
90 | 90 | 'posts_per_page' => $args['count'], |
91 | 91 | 'tax_query' => $taxQuery, |
92 | 92 | ]; |
93 | - $parameters = apply_filters('site-reviews/get/reviews/query', $parameters, $args); |
|
94 | - $query = new WP_Query($parameters); |
|
95 | - $results = array_map([$this, 'single'], $query->posts); |
|
96 | - $reviews = new Reviews($results, $query->max_num_pages, $args); |
|
97 | - return apply_filters('site-reviews/get/reviews', $reviews, $query); |
|
93 | + $parameters = apply_filters( 'site-reviews/get/reviews/query', $parameters, $args ); |
|
94 | + $query = new WP_Query( $parameters ); |
|
95 | + $results = array_map( [$this, 'single'], $query->posts ); |
|
96 | + $reviews = new Reviews( $results, $query->max_num_pages, $args ); |
|
97 | + return apply_filters( 'site-reviews/get/reviews', $reviews, $query ); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
101 | 101 | * @param string $metaReviewId |
102 | 102 | * @return int |
103 | 103 | */ |
104 | - public function getPostId($metaReviewId) |
|
104 | + public function getPostId( $metaReviewId ) |
|
105 | 105 | { |
106 | - return glsr(SqlQueries::class)->getPostIdFromReviewId($metaReviewId); |
|
106 | + return glsr( SqlQueries::class )->getPostIdFromReviewId( $metaReviewId ); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
110 | 110 | * @return array |
111 | 111 | */ |
112 | - public function getRatingCounts(array $args = []) |
|
112 | + public function getRatingCounts( array $args = [] ) |
|
113 | 113 | { |
114 | - $args = glsr(SiteReviewsSummaryDefaults::class)->filter($args); |
|
115 | - $counts = glsr(CountsManager::class)->get([ |
|
116 | - 'post_ids' => glsr(Helper::class)->convertStringToArray($args['assigned_to']), |
|
117 | - 'term_ids' => $this->normalizeTermIds($args['category']), |
|
114 | + $args = glsr( SiteReviewsSummaryDefaults::class )->filter( $args ); |
|
115 | + $counts = glsr( CountsManager::class )->get( [ |
|
116 | + 'post_ids' => glsr( Helper::class )->convertStringToArray( $args['assigned_to'] ), |
|
117 | + 'term_ids' => $this->normalizeTermIds( $args['category'] ), |
|
118 | 118 | 'type' => $args['type'], |
119 | - ]); |
|
120 | - return glsr(CountsManager::class)->flatten($counts, [ |
|
119 | + ] ); |
|
120 | + return glsr( CountsManager::class )->flatten( $counts, [ |
|
121 | 121 | 'min' => $args['rating'], |
122 | - ]); |
|
122 | + ] ); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
126 | 126 | * @param string $commaSeparatedTermIds |
127 | 127 | * @return array |
128 | 128 | */ |
129 | - public function normalizeTermIds($commaSeparatedTermIds) |
|
129 | + public function normalizeTermIds( $commaSeparatedTermIds ) |
|
130 | 130 | { |
131 | - $termIds = glsr_array_column($this->normalizeTerms($commaSeparatedTermIds), 'term_id'); |
|
132 | - return array_unique(array_map('intval', $termIds)); |
|
131 | + $termIds = glsr_array_column( $this->normalizeTerms( $commaSeparatedTermIds ), 'term_id' ); |
|
132 | + return array_unique( array_map( 'intval', $termIds ) ); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
136 | 136 | * @param string $commaSeparatedTermIds |
137 | 137 | * @return array |
138 | 138 | */ |
139 | - public function normalizeTerms($commaSeparatedTermIds) |
|
139 | + public function normalizeTerms( $commaSeparatedTermIds ) |
|
140 | 140 | { |
141 | 141 | $terms = []; |
142 | - $termIds = glsr(Helper::class)->convertStringToArray($commaSeparatedTermIds); |
|
143 | - foreach ($termIds as $termId) { |
|
144 | - if (is_numeric($termId)) { |
|
145 | - $termId = intval($termId); |
|
142 | + $termIds = glsr( Helper::class )->convertStringToArray( $commaSeparatedTermIds ); |
|
143 | + foreach( $termIds as $termId ) { |
|
144 | + if( is_numeric( $termId ) ) { |
|
145 | + $termId = intval( $termId ); |
|
146 | 146 | } |
147 | - $term = term_exists($termId, Application::TAXONOMY); |
|
148 | - if (!isset($term['term_id'])) { |
|
147 | + $term = term_exists( $termId, Application::TAXONOMY ); |
|
148 | + if( !isset($term['term_id']) ) { |
|
149 | 149 | continue; |
150 | 150 | } |
151 | 151 | $terms[] = $term; |
@@ -157,44 +157,44 @@ discard block |
||
157 | 157 | * @param int $postId |
158 | 158 | * @return void |
159 | 159 | */ |
160 | - public function revert($postId) |
|
160 | + public function revert( $postId ) |
|
161 | 161 | { |
162 | - if (Application::POST_TYPE != get_post_field('post_type', $postId)) { |
|
162 | + if( Application::POST_TYPE != get_post_field( 'post_type', $postId ) ) { |
|
163 | 163 | return; |
164 | 164 | } |
165 | - delete_post_meta($postId, '_edit_last'); |
|
166 | - $result = wp_update_post([ |
|
165 | + delete_post_meta( $postId, '_edit_last' ); |
|
166 | + $result = wp_update_post( [ |
|
167 | 167 | 'ID' => $postId, |
168 | - 'post_content' => glsr(Database::class)->get($postId, 'content'), |
|
169 | - 'post_date' => glsr(Database::class)->get($postId, 'date'), |
|
170 | - 'post_title' => glsr(Database::class)->get($postId, 'title'), |
|
171 | - ]); |
|
172 | - if (is_wp_error($result)) { |
|
173 | - glsr_log()->error($result->get_error_message()); |
|
168 | + 'post_content' => glsr( Database::class )->get( $postId, 'content' ), |
|
169 | + 'post_date' => glsr( Database::class )->get( $postId, 'date' ), |
|
170 | + 'post_title' => glsr( Database::class )->get( $postId, 'title' ), |
|
171 | + ] ); |
|
172 | + if( is_wp_error( $result ) ) { |
|
173 | + glsr_log()->error( $result->get_error_message() ); |
|
174 | 174 | return; |
175 | 175 | } |
176 | - do_action('site-reviews/review/reverted', glsr_get_review($postId)); |
|
176 | + do_action( 'site-reviews/review/reverted', glsr_get_review( $postId ) ); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
180 | 180 | * @return Review |
181 | 181 | */ |
182 | - public function single(WP_Post $post) |
|
182 | + public function single( WP_Post $post ) |
|
183 | 183 | { |
184 | - if (Application::POST_TYPE != $post->post_type) { |
|
185 | - $post = new WP_Post((object) []); |
|
184 | + if( Application::POST_TYPE != $post->post_type ) { |
|
185 | + $post = new WP_Post( (object)[] ); |
|
186 | 186 | } |
187 | - $review = new Review($post); |
|
188 | - return apply_filters('site-reviews/get/review', $review, $post); |
|
187 | + $review = new Review( $post ); |
|
188 | + return apply_filters( 'site-reviews/get/review', $review, $post ); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | /** |
192 | 192 | * @param bool $isBlacklisted |
193 | 193 | * @return string |
194 | 194 | */ |
195 | - protected function getNewPostStatus(array $reviewValues, $isBlacklisted) |
|
195 | + protected function getNewPostStatus( array $reviewValues, $isBlacklisted ) |
|
196 | 196 | { |
197 | - $requireApproval = glsr(OptionManager::class)->getBool('settings.general.require.approval'); |
|
197 | + $requireApproval = glsr( OptionManager::class )->getBool( 'settings.general.require.approval' ); |
|
198 | 198 | return 'local' == $reviewValues['_review_type'] && ($requireApproval || $isBlacklisted) |
199 | 199 | ? 'pending' |
200 | 200 | : 'publish'; |
@@ -205,15 +205,15 @@ discard block |
||
205 | 205 | * @param string $termIds |
206 | 206 | * @return void |
207 | 207 | */ |
208 | - protected function setTerms($postId, $termIds) |
|
208 | + protected function setTerms( $postId, $termIds ) |
|
209 | 209 | { |
210 | - $termIds = $this->normalizeTermIds($termIds); |
|
211 | - if (empty($termIds)) { |
|
210 | + $termIds = $this->normalizeTermIds( $termIds ); |
|
211 | + if( empty($termIds) ) { |
|
212 | 212 | return; |
213 | 213 | } |
214 | - $termTaxonomyIds = wp_set_object_terms($postId, $termIds, Application::TAXONOMY); |
|
215 | - if (is_wp_error($termTaxonomyIds)) { |
|
216 | - glsr_log()->error($termTaxonomyIds->get_error_message()); |
|
214 | + $termTaxonomyIds = wp_set_object_terms( $postId, $termIds, Application::TAXONOMY ); |
|
215 | + if( is_wp_error( $termTaxonomyIds ) ) { |
|
216 | + glsr_log()->error( $termTaxonomyIds->get_error_message() ); |
|
217 | 217 | } |
218 | 218 | } |
219 | 219 | } |