@@ -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='.glsr()->post_type.'&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='.glsr()->post_type.'&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='.glsr()->post_type.'&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='.glsr()->post_type.'&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='.glsr()->post_type.'&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='.glsr()->post_type.'&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,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='.glsr()->post_type.'&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='.glsr()->post_type.'&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='.glsr()->post_type.'&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='.glsr()->post_type.'&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='.glsr()->post_type.'&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='.glsr()->post_type.'&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='.glsr()->post_type.'&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='.glsr()->post_type.'&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='.glsr()->post_type.'&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='.glsr()->post_type.'&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='.glsr()->post_type.'&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='.glsr()->post_type.'&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='.glsr()->post_type.'&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='.glsr()->post_type.'&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='.glsr()->post_type.'&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='.glsr()->post_type.'&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='.glsr()->post_type.'&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='.glsr()->post_type.'&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> |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | <div class="glsr-card-header"> |
461 | 461 | <h3>Why are the IP Addresses being detected as 127.0.0.1?</h3> |
462 | 462 | <button type="button" class="handlediv" aria-expanded="true"> |
463 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
463 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
464 | 464 | <span class="toggle-indicator" aria-hidden="true"></span> |
465 | 465 | </button> |
466 | 466 | </div> |
@@ -6,15 +6,15 @@ |
||
6 | 6 | <p><?= __('Add-ons extend the functionality of Site Reviews.', 'site-reviews'); ?></p> |
7 | 7 | <div class="glsr-addons wp-clearfix"> |
8 | 8 | <?php |
9 | - $template->render('partials/addons/addon', [ |
|
10 | - 'context' => [ |
|
11 | - 'description' => __('Allow your site visitors to submit images with their reviews.', 'site-reviews'), |
|
12 | - 'link' => 'https://niftyplugins.com/plugins/images/', |
|
13 | - 'slug' => 'images', |
|
14 | - 'title' => 'Images', |
|
15 | - ], |
|
16 | - 'plugin' => 'site-reviews-images/site-reviews-images.php', |
|
17 | - ]); |
|
18 | - ?> |
|
9 | + $template->render('partials/addons/addon', [ |
|
10 | + 'context' => [ |
|
11 | + 'description' => __('Allow your site visitors to submit images with their reviews.', 'site-reviews'), |
|
12 | + 'link' => 'https://niftyplugins.com/plugins/images/', |
|
13 | + 'slug' => 'images', |
|
14 | + 'title' => 'Images', |
|
15 | + ], |
|
16 | + 'plugin' => 'site-reviews-images/site-reviews-images.php', |
|
17 | + ]); |
|
18 | + ?> |
|
19 | 19 | </div> |
20 | 20 | </div> |
@@ -1,20 +1,20 @@ |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | 3 | <div class="wrap"> |
4 | - <h1 class="wp-heading-inline"><?= esc_html(get_admin_page_title()); ?></h1> |
|
4 | + <h1 class="wp-heading-inline"><?= esc_html( get_admin_page_title() ); ?></h1> |
|
5 | 5 | <?= $notices; ?> |
6 | - <p><?= __('Add-ons extend the functionality of Site Reviews.', 'site-reviews'); ?></p> |
|
6 | + <p><?= __( 'Add-ons extend the functionality of Site Reviews.', 'site-reviews' ); ?></p> |
|
7 | 7 | <div class="glsr-addons wp-clearfix"> |
8 | 8 | <?php |
9 | - $template->render('partials/addons/addon', [ |
|
9 | + $template->render( 'partials/addons/addon', [ |
|
10 | 10 | 'context' => [ |
11 | - 'description' => __('Allow your site visitors to submit images with their reviews.', 'site-reviews'), |
|
11 | + 'description' => __( 'Allow your site visitors to submit images with their reviews.', 'site-reviews' ), |
|
12 | 12 | 'link' => 'https://niftyplugins.com/plugins/images/', |
13 | 13 | 'slug' => 'images', |
14 | 14 | 'title' => 'Images', |
15 | 15 | ], |
16 | 16 | 'plugin' => 'site-reviews-images/site-reviews-images.php', |
17 | - ]); |
|
17 | + ] ); |
|
18 | 18 | ?> |
19 | 19 | </div> |
20 | 20 | </div> |
@@ -1,7 +1,7 @@ |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | 3 | <p class="about-description"> |
4 | - Still need help with <?= glsr()->name; ?>? We offer excellent support, but don't forget to check our <a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=documentation#!shortcodes'); ?>">documentation</a> first. |
|
4 | + Still need help with <?= glsr()->name; ?>? We offer excellent support, but don't forget to check our <a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=documentation#!shortcodes' ); ?>">documentation</a> first. |
|
5 | 5 | </p> |
6 | 6 | <div class="is-fullwidth"> |
7 | 7 | <div class="glsr-flex-row glsr-has-2-columns"> |
@@ -1,23 +1,23 @@ |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | 3 | <div class="glsr-welcome wrap about-wrap about-wrap-content"> |
4 | 4 | <h1>Welcome to <?= glsr()->name; ?></h1> |
5 | 5 | <div class="about-text">Site Reviews is a free WordPress review plugin with advanced features that makes it easy to manage reviews on your website. Follow the instructions below to get started!</div> |
6 | 6 | <div class="wp-badge">Version <?= glsr()->version; ?></div> |
7 | 7 | <p class="about-buttons"> |
8 | - <a class="button" href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=documentation'); ?>">Documentation</a> |
|
8 | + <a class="button" href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=documentation' ); ?>">Documentation</a> |
|
9 | 9 | <a class="button" href="https://wordpress.org/support/plugin/site-reviews/">Support</a> |
10 | 10 | <a target="_blank" class="button" href="https://www.facebook.com/sharer/sharer.php?u=https%3A//geminilabs.io/site-reviews"><span class="dashicons dashicons-facebook-alt"></span> Share</a> |
11 | 11 | <a target="_blank" class="button" href="https://twitter.com/intent/tweet?text=Site Reviews is a fantastic WordPress review plugin with advanced features that makes it easy to manage reviews on your website.&url=https://geminilabs.io/site-reviews&hashtags=WordPress,reviewplugins,"><span class="dashicons dashicons-twitter"></span> Tweet</a> |
12 | 12 | </p> |
13 | 13 | <nav class="glsr-nav-tab-wrapper nav-tab-wrapper"> |
14 | - <?php foreach ($tabs as $id => $title) : ?> |
|
14 | + <?php foreach( $tabs as $id => $title ) : ?> |
|
15 | 15 | <a class="glsr-nav-tab nav-tab" href="#<?= $id; ?>"><?= $title; ?></a> |
16 | 16 | <?php endforeach; ?> |
17 | 17 | </nav> |
18 | - <?php foreach ($tabs as $id => $title) : ?> |
|
18 | + <?php foreach( $tabs as $id => $title ) : ?> |
|
19 | 19 | <div class="glsr-nav-view ui-tabs-hide" id="<?= $id; ?>"> |
20 | - <?php $template->render('pages/welcome/'.$id, $data); ?> |
|
20 | + <?php $template->render( 'pages/welcome/'.$id, $data ); ?> |
|
21 | 21 | </div> |
22 | 22 | <?php endforeach; ?> |
23 | 23 | <input type="hidden" name="_active_tab"> |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <div class="notice is-dismissible glsr-notice" data-dismiss="rebusify"> |
2 | 2 | <div class="glsr-notice-icon"> |
3 | - <img width="96" height="96" src="<?= glsr()->url('assets/images/rebusify-badge.png'); ?>"> |
|
3 | + <img width="96" height="96" src="<?= glsr()->url( 'assets/images/rebusify-badge.png' ); ?>"> |
|
4 | 4 | </div> |
5 | 5 | <div class="glsr-notice-content"> |
6 | 6 | <h3>Validate Your Reviews on the Blockchain With the Rebusify Confidence System</h3> |
7 | - <p>Site Reviews now integrates with the Rebusify Confidence System which uses blockchain technology to verify to your visitors and customers that your reviews are authentic. Simply create a free Rebusify account and <a href="<?= admin_url('edit.php?post_type='.glsr()->post_type.'&page=settings#!general'); ?>">enter your credentials in the Settings</a>. Site Reviews will take care of the rest!</p> |
|
7 | + <p>Site Reviews now integrates with the Rebusify Confidence System which uses blockchain technology to verify to your visitors and customers that your reviews are authentic. Simply create a free Rebusify account and <a href="<?= admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=settings#!general' ); ?>">enter your credentials in the Settings</a>. Site Reviews will take care of the rest!</p> |
|
8 | 8 | <a href="https://rebusify.com/plans?ref=105" class="button" target="_blank">Create Your Rebusify Account</a> |
9 | 9 | </div> |
10 | 10 | </div> |
@@ -1,5 +1,5 @@ |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | -<strong><a href="<?= esc_url(admin_url('edit.php?post_type='.glsr()->post_type.'&page=settings#!licenses')); ?>"> |
|
4 | - <?= __('Enter a valid license key for automatic updates.', 'site-reviews'); ?> |
|
3 | +<strong><a href="<?= esc_url( admin_url( 'edit.php?post_type='.glsr()->post_type.'&page=settings#!licenses' ) ); ?>"> |
|
4 | + <?= __( 'Enter a valid license key for automatic updates.', 'site-reviews' ); ?> |
|
5 | 5 | </a></strong> |
@@ -12,160 +12,160 @@ |
||
12 | 12 | |
13 | 13 | class SettingsController extends Controller |
14 | 14 | { |
15 | - /** |
|
16 | - * @param mixed $input |
|
17 | - * @return array |
|
18 | - * @callback register_setting |
|
19 | - */ |
|
20 | - public function callbackRegisterSettings($input) |
|
21 | - { |
|
22 | - $settings = Arr::consolidateArray($input); |
|
23 | - if (1 === count($settings) && array_key_exists('settings', $settings)) { |
|
24 | - $options = array_replace_recursive(glsr(OptionManager::class)->all(), $input); |
|
25 | - $options = $this->sanitizeGeneral($input, $options); |
|
26 | - $options = $this->sanitizeLicenses($input, $options); |
|
27 | - $options = $this->sanitizeSubmissions($input, $options); |
|
28 | - $options = $this->sanitizeTranslations($input, $options); |
|
29 | - $options = apply_filters('site-reviews/settings/callback', $options, $settings); |
|
30 | - if (filter_input(INPUT_POST, 'option_page') == Application::ID.'-settings') { |
|
31 | - glsr(Notice::class)->addSuccess(__('Settings updated.', 'site-reviews')); |
|
32 | - } |
|
33 | - return $options; |
|
34 | - } |
|
35 | - return $input; |
|
36 | - } |
|
15 | + /** |
|
16 | + * @param mixed $input |
|
17 | + * @return array |
|
18 | + * @callback register_setting |
|
19 | + */ |
|
20 | + public function callbackRegisterSettings($input) |
|
21 | + { |
|
22 | + $settings = Arr::consolidateArray($input); |
|
23 | + if (1 === count($settings) && array_key_exists('settings', $settings)) { |
|
24 | + $options = array_replace_recursive(glsr(OptionManager::class)->all(), $input); |
|
25 | + $options = $this->sanitizeGeneral($input, $options); |
|
26 | + $options = $this->sanitizeLicenses($input, $options); |
|
27 | + $options = $this->sanitizeSubmissions($input, $options); |
|
28 | + $options = $this->sanitizeTranslations($input, $options); |
|
29 | + $options = apply_filters('site-reviews/settings/callback', $options, $settings); |
|
30 | + if (filter_input(INPUT_POST, 'option_page') == Application::ID.'-settings') { |
|
31 | + glsr(Notice::class)->addSuccess(__('Settings updated.', 'site-reviews')); |
|
32 | + } |
|
33 | + return $options; |
|
34 | + } |
|
35 | + return $input; |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * @return void |
|
40 | - * @action admin_init |
|
41 | - */ |
|
42 | - public function registerSettings() |
|
43 | - { |
|
44 | - register_setting(Application::ID.'-settings', OptionManager::databaseKey(), [ |
|
45 | - 'sanitize_callback' => [$this, 'callbackRegisterSettings'], |
|
46 | - ]); |
|
47 | - } |
|
38 | + /** |
|
39 | + * @return void |
|
40 | + * @action admin_init |
|
41 | + */ |
|
42 | + public function registerSettings() |
|
43 | + { |
|
44 | + register_setting(Application::ID.'-settings', OptionManager::databaseKey(), [ |
|
45 | + 'sanitize_callback' => [$this, 'callbackRegisterSettings'], |
|
46 | + ]); |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * @return array |
|
51 | - */ |
|
52 | - protected function sanitizeGeneral(array $input, array $options) |
|
53 | - { |
|
54 | - $key = 'settings.general'; |
|
55 | - $inputForm = Arr::get($input, $key); |
|
56 | - if (!$this->hasMultilingualIntegration(Arr::get($inputForm, 'multilingual'))) { |
|
57 | - $options = Arr::set($options, $key.'.multilingual', ''); |
|
58 | - } |
|
59 | - if ('' == trim(Arr::get($inputForm, 'notification_message'))) { |
|
60 | - $defaultValue = Arr::get(glsr()->defaults, $key.'.notification_message'); |
|
61 | - $options = Arr::set($options, $key.'.notification_message', $defaultValue); |
|
62 | - } |
|
63 | - $defaultValue = Arr::get($inputForm, 'notifications', []); |
|
64 | - $options = Arr::set($options, $key.'.notifications', $defaultValue); |
|
65 | - return $options; |
|
66 | - } |
|
49 | + /** |
|
50 | + * @return array |
|
51 | + */ |
|
52 | + protected function sanitizeGeneral(array $input, array $options) |
|
53 | + { |
|
54 | + $key = 'settings.general'; |
|
55 | + $inputForm = Arr::get($input, $key); |
|
56 | + if (!$this->hasMultilingualIntegration(Arr::get($inputForm, 'multilingual'))) { |
|
57 | + $options = Arr::set($options, $key.'.multilingual', ''); |
|
58 | + } |
|
59 | + if ('' == trim(Arr::get($inputForm, 'notification_message'))) { |
|
60 | + $defaultValue = Arr::get(glsr()->defaults, $key.'.notification_message'); |
|
61 | + $options = Arr::set($options, $key.'.notification_message', $defaultValue); |
|
62 | + } |
|
63 | + $defaultValue = Arr::get($inputForm, 'notifications', []); |
|
64 | + $options = Arr::set($options, $key.'.notifications', $defaultValue); |
|
65 | + return $options; |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * @return array |
|
70 | - */ |
|
71 | - protected function sanitizeLicenses(array $input, array $options) |
|
72 | - { |
|
73 | - $key = 'settings.licenses'; |
|
74 | - $licenses = Arr::consolidateArray(Arr::get($input, $key)); |
|
75 | - foreach ($licenses as $slug => &$license) { |
|
76 | - $license = $this->verifyLicense($license, $slug); |
|
77 | - } |
|
78 | - $options = Arr::set($options, $key, $licenses); |
|
79 | - return $options; |
|
80 | - } |
|
68 | + /** |
|
69 | + * @return array |
|
70 | + */ |
|
71 | + protected function sanitizeLicenses(array $input, array $options) |
|
72 | + { |
|
73 | + $key = 'settings.licenses'; |
|
74 | + $licenses = Arr::consolidateArray(Arr::get($input, $key)); |
|
75 | + foreach ($licenses as $slug => &$license) { |
|
76 | + $license = $this->verifyLicense($license, $slug); |
|
77 | + } |
|
78 | + $options = Arr::set($options, $key, $licenses); |
|
79 | + return $options; |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * @return array |
|
84 | - */ |
|
85 | - protected function sanitizeSubmissions(array $input, array $options) |
|
86 | - { |
|
87 | - $key = 'settings.submissions'; |
|
88 | - $inputForm = Arr::get($input, $key); |
|
89 | - $defaultValue = isset($inputForm['required']) |
|
90 | - ? $inputForm['required'] |
|
91 | - : []; |
|
92 | - $options = Arr::set($options, $key.'.required', $defaultValue); |
|
93 | - return $options; |
|
94 | - } |
|
82 | + /** |
|
83 | + * @return array |
|
84 | + */ |
|
85 | + protected function sanitizeSubmissions(array $input, array $options) |
|
86 | + { |
|
87 | + $key = 'settings.submissions'; |
|
88 | + $inputForm = Arr::get($input, $key); |
|
89 | + $defaultValue = isset($inputForm['required']) |
|
90 | + ? $inputForm['required'] |
|
91 | + : []; |
|
92 | + $options = Arr::set($options, $key.'.required', $defaultValue); |
|
93 | + return $options; |
|
94 | + } |
|
95 | 95 | |
96 | - /** |
|
97 | - * @return array |
|
98 | - */ |
|
99 | - protected function sanitizeTranslations(array $input, array $options) |
|
100 | - { |
|
101 | - $key = 'settings.strings'; |
|
102 | - $inputForm = Arr::consolidateArray(Arr::get($input, $key)); |
|
103 | - if (!empty($inputForm)) { |
|
104 | - $options = Arr::set($options, $key, array_values(array_filter($inputForm))); |
|
105 | - $allowedTags = [ |
|
106 | - 'a' => ['class' => [], 'href' => [], 'target' => []], |
|
107 | - 'span' => ['class' => []], |
|
108 | - ]; |
|
109 | - array_walk($options['settings']['strings'], function (&$string) use ($allowedTags) { |
|
110 | - if (isset($string['s2'])) { |
|
111 | - $string['s2'] = wp_kses($string['s2'], $allowedTags); |
|
112 | - } |
|
113 | - if (isset($string['p2'])) { |
|
114 | - $string['p2'] = wp_kses($string['p2'], $allowedTags); |
|
115 | - } |
|
116 | - }); |
|
117 | - } |
|
118 | - return $options; |
|
119 | - } |
|
96 | + /** |
|
97 | + * @return array |
|
98 | + */ |
|
99 | + protected function sanitizeTranslations(array $input, array $options) |
|
100 | + { |
|
101 | + $key = 'settings.strings'; |
|
102 | + $inputForm = Arr::consolidateArray(Arr::get($input, $key)); |
|
103 | + if (!empty($inputForm)) { |
|
104 | + $options = Arr::set($options, $key, array_values(array_filter($inputForm))); |
|
105 | + $allowedTags = [ |
|
106 | + 'a' => ['class' => [], 'href' => [], 'target' => []], |
|
107 | + 'span' => ['class' => []], |
|
108 | + ]; |
|
109 | + array_walk($options['settings']['strings'], function (&$string) use ($allowedTags) { |
|
110 | + if (isset($string['s2'])) { |
|
111 | + $string['s2'] = wp_kses($string['s2'], $allowedTags); |
|
112 | + } |
|
113 | + if (isset($string['p2'])) { |
|
114 | + $string['p2'] = wp_kses($string['p2'], $allowedTags); |
|
115 | + } |
|
116 | + }); |
|
117 | + } |
|
118 | + return $options; |
|
119 | + } |
|
120 | 120 | |
121 | - /** |
|
122 | - * @param string $integrationSlug |
|
123 | - * @return bool |
|
124 | - */ |
|
125 | - protected function hasMultilingualIntegration($integrationSlug) |
|
126 | - { |
|
127 | - $integration = glsr(Multilingual::class)->getIntegration($integrationSlug); |
|
128 | - if (!$integration) { |
|
129 | - return false; |
|
130 | - } |
|
131 | - if (!$integration->isActive()) { |
|
132 | - glsr(Notice::class)->addError(sprintf( |
|
133 | - __('Please install/activate the %s plugin to enable integration.', 'site-reviews'), |
|
134 | - $integration->pluginName |
|
135 | - )); |
|
136 | - return false; |
|
137 | - } elseif (!$integration->isSupported()) { |
|
138 | - glsr(Notice::class)->addError(sprintf( |
|
139 | - __('Please update the %s plugin to v%s or greater to enable integration.', 'site-reviews'), |
|
140 | - $integration->pluginName, |
|
141 | - $integration->supportedVersion |
|
142 | - )); |
|
143 | - return false; |
|
144 | - } |
|
145 | - return true; |
|
146 | - } |
|
121 | + /** |
|
122 | + * @param string $integrationSlug |
|
123 | + * @return bool |
|
124 | + */ |
|
125 | + protected function hasMultilingualIntegration($integrationSlug) |
|
126 | + { |
|
127 | + $integration = glsr(Multilingual::class)->getIntegration($integrationSlug); |
|
128 | + if (!$integration) { |
|
129 | + return false; |
|
130 | + } |
|
131 | + if (!$integration->isActive()) { |
|
132 | + glsr(Notice::class)->addError(sprintf( |
|
133 | + __('Please install/activate the %s plugin to enable integration.', 'site-reviews'), |
|
134 | + $integration->pluginName |
|
135 | + )); |
|
136 | + return false; |
|
137 | + } elseif (!$integration->isSupported()) { |
|
138 | + glsr(Notice::class)->addError(sprintf( |
|
139 | + __('Please update the %s plugin to v%s or greater to enable integration.', 'site-reviews'), |
|
140 | + $integration->pluginName, |
|
141 | + $integration->supportedVersion |
|
142 | + )); |
|
143 | + return false; |
|
144 | + } |
|
145 | + return true; |
|
146 | + } |
|
147 | 147 | |
148 | - /** |
|
149 | - * @param string $license |
|
150 | - * @param string $slug |
|
151 | - * @return string |
|
152 | - */ |
|
153 | - protected function verifyLicense($license, $slug) |
|
154 | - { |
|
155 | - try { |
|
156 | - $addon = glsr($slug); |
|
157 | - $updater = new Updater($addon->update_url, $addon->file, [ |
|
158 | - 'license' => $license, |
|
159 | - 'testedTo' => $addon->testedTo, |
|
160 | - ]); |
|
161 | - if (!$updater->isLicenseValid()) { |
|
162 | - throw new Exception('Invalid license: '.$license.' ('.$addon->id.')'); |
|
163 | - } |
|
164 | - } catch (Exception $e) { |
|
165 | - $license = ''; |
|
166 | - glsr_log()->debug($e->getMessage()); |
|
167 | - glsr(Notice::class)->addError(__('A license you entered was invalid.', 'site-reviews')); |
|
168 | - } |
|
169 | - return $license; |
|
170 | - } |
|
148 | + /** |
|
149 | + * @param string $license |
|
150 | + * @param string $slug |
|
151 | + * @return string |
|
152 | + */ |
|
153 | + protected function verifyLicense($license, $slug) |
|
154 | + { |
|
155 | + try { |
|
156 | + $addon = glsr($slug); |
|
157 | + $updater = new Updater($addon->update_url, $addon->file, [ |
|
158 | + 'license' => $license, |
|
159 | + 'testedTo' => $addon->testedTo, |
|
160 | + ]); |
|
161 | + if (!$updater->isLicenseValid()) { |
|
162 | + throw new Exception('Invalid license: '.$license.' ('.$addon->id.')'); |
|
163 | + } |
|
164 | + } catch (Exception $e) { |
|
165 | + $license = ''; |
|
166 | + glsr_log()->debug($e->getMessage()); |
|
167 | + glsr(Notice::class)->addError(__('A license you entered was invalid.', 'site-reviews')); |
|
168 | + } |
|
169 | + return $license; |
|
170 | + } |
|
171 | 171 | } |
@@ -17,18 +17,18 @@ discard block |
||
17 | 17 | * @return array |
18 | 18 | * @callback register_setting |
19 | 19 | */ |
20 | - public function callbackRegisterSettings($input) |
|
20 | + public function callbackRegisterSettings( $input ) |
|
21 | 21 | { |
22 | - $settings = Arr::consolidateArray($input); |
|
23 | - if (1 === count($settings) && array_key_exists('settings', $settings)) { |
|
24 | - $options = array_replace_recursive(glsr(OptionManager::class)->all(), $input); |
|
25 | - $options = $this->sanitizeGeneral($input, $options); |
|
26 | - $options = $this->sanitizeLicenses($input, $options); |
|
27 | - $options = $this->sanitizeSubmissions($input, $options); |
|
28 | - $options = $this->sanitizeTranslations($input, $options); |
|
29 | - $options = apply_filters('site-reviews/settings/callback', $options, $settings); |
|
30 | - if (filter_input(INPUT_POST, 'option_page') == Application::ID.'-settings') { |
|
31 | - glsr(Notice::class)->addSuccess(__('Settings updated.', 'site-reviews')); |
|
22 | + $settings = Arr::consolidateArray( $input ); |
|
23 | + if( 1 === count( $settings ) && array_key_exists( 'settings', $settings ) ) { |
|
24 | + $options = array_replace_recursive( glsr( OptionManager::class )->all(), $input ); |
|
25 | + $options = $this->sanitizeGeneral( $input, $options ); |
|
26 | + $options = $this->sanitizeLicenses( $input, $options ); |
|
27 | + $options = $this->sanitizeSubmissions( $input, $options ); |
|
28 | + $options = $this->sanitizeTranslations( $input, $options ); |
|
29 | + $options = apply_filters( 'site-reviews/settings/callback', $options, $settings ); |
|
30 | + if( filter_input( INPUT_POST, 'option_page' ) == Application::ID.'-settings' ) { |
|
31 | + glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ) ); |
|
32 | 32 | } |
33 | 33 | return $options; |
34 | 34 | } |
@@ -41,77 +41,77 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function registerSettings() |
43 | 43 | { |
44 | - register_setting(Application::ID.'-settings', OptionManager::databaseKey(), [ |
|
44 | + register_setting( Application::ID.'-settings', OptionManager::databaseKey(), [ |
|
45 | 45 | 'sanitize_callback' => [$this, 'callbackRegisterSettings'], |
46 | - ]); |
|
46 | + ] ); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
50 | 50 | * @return array |
51 | 51 | */ |
52 | - protected function sanitizeGeneral(array $input, array $options) |
|
52 | + protected function sanitizeGeneral( array $input, array $options ) |
|
53 | 53 | { |
54 | 54 | $key = 'settings.general'; |
55 | - $inputForm = Arr::get($input, $key); |
|
56 | - if (!$this->hasMultilingualIntegration(Arr::get($inputForm, 'multilingual'))) { |
|
57 | - $options = Arr::set($options, $key.'.multilingual', ''); |
|
55 | + $inputForm = Arr::get( $input, $key ); |
|
56 | + if( !$this->hasMultilingualIntegration( Arr::get( $inputForm, 'multilingual' ) ) ) { |
|
57 | + $options = Arr::set( $options, $key.'.multilingual', '' ); |
|
58 | 58 | } |
59 | - if ('' == trim(Arr::get($inputForm, 'notification_message'))) { |
|
60 | - $defaultValue = Arr::get(glsr()->defaults, $key.'.notification_message'); |
|
61 | - $options = Arr::set($options, $key.'.notification_message', $defaultValue); |
|
59 | + if( '' == trim( Arr::get( $inputForm, 'notification_message' ) ) ) { |
|
60 | + $defaultValue = Arr::get( glsr()->defaults, $key.'.notification_message' ); |
|
61 | + $options = Arr::set( $options, $key.'.notification_message', $defaultValue ); |
|
62 | 62 | } |
63 | - $defaultValue = Arr::get($inputForm, 'notifications', []); |
|
64 | - $options = Arr::set($options, $key.'.notifications', $defaultValue); |
|
63 | + $defaultValue = Arr::get( $inputForm, 'notifications', [] ); |
|
64 | + $options = Arr::set( $options, $key.'.notifications', $defaultValue ); |
|
65 | 65 | return $options; |
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
69 | 69 | * @return array |
70 | 70 | */ |
71 | - protected function sanitizeLicenses(array $input, array $options) |
|
71 | + protected function sanitizeLicenses( array $input, array $options ) |
|
72 | 72 | { |
73 | 73 | $key = 'settings.licenses'; |
74 | - $licenses = Arr::consolidateArray(Arr::get($input, $key)); |
|
75 | - foreach ($licenses as $slug => &$license) { |
|
76 | - $license = $this->verifyLicense($license, $slug); |
|
74 | + $licenses = Arr::consolidateArray( Arr::get( $input, $key ) ); |
|
75 | + foreach( $licenses as $slug => &$license ) { |
|
76 | + $license = $this->verifyLicense( $license, $slug ); |
|
77 | 77 | } |
78 | - $options = Arr::set($options, $key, $licenses); |
|
78 | + $options = Arr::set( $options, $key, $licenses ); |
|
79 | 79 | return $options; |
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
83 | 83 | * @return array |
84 | 84 | */ |
85 | - protected function sanitizeSubmissions(array $input, array $options) |
|
85 | + protected function sanitizeSubmissions( array $input, array $options ) |
|
86 | 86 | { |
87 | 87 | $key = 'settings.submissions'; |
88 | - $inputForm = Arr::get($input, $key); |
|
88 | + $inputForm = Arr::get( $input, $key ); |
|
89 | 89 | $defaultValue = isset($inputForm['required']) |
90 | 90 | ? $inputForm['required'] |
91 | 91 | : []; |
92 | - $options = Arr::set($options, $key.'.required', $defaultValue); |
|
92 | + $options = Arr::set( $options, $key.'.required', $defaultValue ); |
|
93 | 93 | return $options; |
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
97 | 97 | * @return array |
98 | 98 | */ |
99 | - protected function sanitizeTranslations(array $input, array $options) |
|
99 | + protected function sanitizeTranslations( array $input, array $options ) |
|
100 | 100 | { |
101 | 101 | $key = 'settings.strings'; |
102 | - $inputForm = Arr::consolidateArray(Arr::get($input, $key)); |
|
103 | - if (!empty($inputForm)) { |
|
104 | - $options = Arr::set($options, $key, array_values(array_filter($inputForm))); |
|
102 | + $inputForm = Arr::consolidateArray( Arr::get( $input, $key ) ); |
|
103 | + if( !empty($inputForm) ) { |
|
104 | + $options = Arr::set( $options, $key, array_values( array_filter( $inputForm ) ) ); |
|
105 | 105 | $allowedTags = [ |
106 | 106 | 'a' => ['class' => [], 'href' => [], 'target' => []], |
107 | 107 | 'span' => ['class' => []], |
108 | 108 | ]; |
109 | - array_walk($options['settings']['strings'], function (&$string) use ($allowedTags) { |
|
110 | - if (isset($string['s2'])) { |
|
111 | - $string['s2'] = wp_kses($string['s2'], $allowedTags); |
|
109 | + array_walk( $options['settings']['strings'], function( &$string ) use ($allowedTags) { |
|
110 | + if( isset($string['s2']) ) { |
|
111 | + $string['s2'] = wp_kses( $string['s2'], $allowedTags ); |
|
112 | 112 | } |
113 | - if (isset($string['p2'])) { |
|
114 | - $string['p2'] = wp_kses($string['p2'], $allowedTags); |
|
113 | + if( isset($string['p2']) ) { |
|
114 | + $string['p2'] = wp_kses( $string['p2'], $allowedTags ); |
|
115 | 115 | } |
116 | 116 | }); |
117 | 117 | } |
@@ -122,24 +122,24 @@ discard block |
||
122 | 122 | * @param string $integrationSlug |
123 | 123 | * @return bool |
124 | 124 | */ |
125 | - protected function hasMultilingualIntegration($integrationSlug) |
|
125 | + protected function hasMultilingualIntegration( $integrationSlug ) |
|
126 | 126 | { |
127 | - $integration = glsr(Multilingual::class)->getIntegration($integrationSlug); |
|
128 | - if (!$integration) { |
|
127 | + $integration = glsr( Multilingual::class )->getIntegration( $integrationSlug ); |
|
128 | + if( !$integration ) { |
|
129 | 129 | return false; |
130 | 130 | } |
131 | - if (!$integration->isActive()) { |
|
132 | - glsr(Notice::class)->addError(sprintf( |
|
133 | - __('Please install/activate the %s plugin to enable integration.', 'site-reviews'), |
|
131 | + if( !$integration->isActive() ) { |
|
132 | + glsr( Notice::class )->addError( sprintf( |
|
133 | + __( 'Please install/activate the %s plugin to enable integration.', 'site-reviews' ), |
|
134 | 134 | $integration->pluginName |
135 | - )); |
|
135 | + ) ); |
|
136 | 136 | return false; |
137 | - } elseif (!$integration->isSupported()) { |
|
138 | - glsr(Notice::class)->addError(sprintf( |
|
139 | - __('Please update the %s plugin to v%s or greater to enable integration.', 'site-reviews'), |
|
137 | + } elseif( !$integration->isSupported() ) { |
|
138 | + glsr( Notice::class )->addError( sprintf( |
|
139 | + __( 'Please update the %s plugin to v%s or greater to enable integration.', 'site-reviews' ), |
|
140 | 140 | $integration->pluginName, |
141 | 141 | $integration->supportedVersion |
142 | - )); |
|
142 | + ) ); |
|
143 | 143 | return false; |
144 | 144 | } |
145 | 145 | return true; |
@@ -150,21 +150,21 @@ discard block |
||
150 | 150 | * @param string $slug |
151 | 151 | * @return string |
152 | 152 | */ |
153 | - protected function verifyLicense($license, $slug) |
|
153 | + protected function verifyLicense( $license, $slug ) |
|
154 | 154 | { |
155 | 155 | try { |
156 | - $addon = glsr($slug); |
|
157 | - $updater = new Updater($addon->update_url, $addon->file, [ |
|
156 | + $addon = glsr( $slug ); |
|
157 | + $updater = new Updater( $addon->update_url, $addon->file, [ |
|
158 | 158 | 'license' => $license, |
159 | 159 | 'testedTo' => $addon->testedTo, |
160 | - ]); |
|
161 | - if (!$updater->isLicenseValid()) { |
|
162 | - throw new Exception('Invalid license: '.$license.' ('.$addon->id.')'); |
|
160 | + ] ); |
|
161 | + if( !$updater->isLicenseValid() ) { |
|
162 | + throw new Exception( 'Invalid license: '.$license.' ('.$addon->id.')' ); |
|
163 | 163 | } |
164 | - } catch (Exception $e) { |
|
164 | + } catch( Exception $e ) { |
|
165 | 165 | $license = ''; |
166 | - glsr_log()->debug($e->getMessage()); |
|
167 | - glsr(Notice::class)->addError(__('A license you entered was invalid.', 'site-reviews')); |
|
166 | + glsr_log()->debug( $e->getMessage() ); |
|
167 | + glsr( Notice::class )->addError( __( 'A license you entered was invalid.', 'site-reviews' ) ); |
|
168 | 168 | } |
169 | 169 | return $license; |
170 | 170 | } |
@@ -134,7 +134,8 @@ discard block |
||
134 | 134 | $integration->pluginName |
135 | 135 | )); |
136 | 136 | return false; |
137 | - } elseif (!$integration->isSupported()) { |
|
137 | + } |
|
138 | + elseif (!$integration->isSupported()) { |
|
138 | 139 | glsr(Notice::class)->addError(sprintf( |
139 | 140 | __('Please update the %s plugin to v%s or greater to enable integration.', 'site-reviews'), |
140 | 141 | $integration->pluginName, |
@@ -161,7 +162,8 @@ discard block |
||
161 | 162 | if (!$updater->isLicenseValid()) { |
162 | 163 | throw new Exception('Invalid license: '.$license.' ('.$addon->id.')'); |
163 | 164 | } |
164 | - } catch (Exception $e) { |
|
165 | + } |
|
166 | + catch (Exception $e) { |
|
165 | 167 | $license = ''; |
166 | 168 | glsr_log()->debug($e->getMessage()); |
167 | 169 | glsr(Notice::class)->addError(__('A license you entered was invalid.', 'site-reviews')); |
@@ -9,65 +9,65 @@ |
||
9 | 9 | |
10 | 10 | class Reviews extends ArrayObject |
11 | 11 | { |
12 | - /** |
|
13 | - * @var array |
|
14 | - */ |
|
15 | - public $args; |
|
12 | + /** |
|
13 | + * @var array |
|
14 | + */ |
|
15 | + public $args; |
|
16 | 16 | |
17 | - /** |
|
18 | - * @var int |
|
19 | - */ |
|
20 | - public $max_num_pages; |
|
17 | + /** |
|
18 | + * @var int |
|
19 | + */ |
|
20 | + public $max_num_pages; |
|
21 | 21 | |
22 | - /** |
|
23 | - * @var array |
|
24 | - */ |
|
25 | - public $reviews; |
|
22 | + /** |
|
23 | + * @var array |
|
24 | + */ |
|
25 | + public $reviews; |
|
26 | 26 | |
27 | - public function __construct(array $reviews, $maxPageCount, array $args) |
|
28 | - { |
|
29 | - $this->args = $args; |
|
30 | - $this->max_num_pages = $maxPageCount; |
|
31 | - $this->reviews = $reviews; |
|
32 | - parent::__construct($reviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS); |
|
33 | - } |
|
27 | + public function __construct(array $reviews, $maxPageCount, array $args) |
|
28 | + { |
|
29 | + $this->args = $args; |
|
30 | + $this->max_num_pages = $maxPageCount; |
|
31 | + $this->reviews = $reviews; |
|
32 | + parent::__construct($reviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS); |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * @return string |
|
37 | - */ |
|
38 | - public function __toString() |
|
39 | - { |
|
40 | - return (string) $this->build(); |
|
41 | - } |
|
35 | + /** |
|
36 | + * @return string |
|
37 | + */ |
|
38 | + public function __toString() |
|
39 | + { |
|
40 | + return (string) $this->build(); |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @return ReviewsHtml |
|
45 | - */ |
|
46 | - public function build() |
|
47 | - { |
|
48 | - $args = glsr(SiteReviewsDefaults::class)->merge($this->args); |
|
49 | - return glsr(SiteReviewsPartial::class)->build($args, $this); |
|
50 | - } |
|
43 | + /** |
|
44 | + * @return ReviewsHtml |
|
45 | + */ |
|
46 | + public function build() |
|
47 | + { |
|
48 | + $args = glsr(SiteReviewsDefaults::class)->merge($this->args); |
|
49 | + return glsr(SiteReviewsPartial::class)->build($args, $this); |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * @param mixed $key |
|
54 | - * @return mixed |
|
55 | - */ |
|
56 | - public function offsetGet($key) |
|
57 | - { |
|
58 | - if (array_key_exists($key, $this->reviews)) { |
|
59 | - return $this->reviews[$key]; |
|
60 | - } |
|
61 | - return property_exists($this, $key) |
|
62 | - ? $this->$key |
|
63 | - : null; |
|
64 | - } |
|
52 | + /** |
|
53 | + * @param mixed $key |
|
54 | + * @return mixed |
|
55 | + */ |
|
56 | + public function offsetGet($key) |
|
57 | + { |
|
58 | + if (array_key_exists($key, $this->reviews)) { |
|
59 | + return $this->reviews[$key]; |
|
60 | + } |
|
61 | + return property_exists($this, $key) |
|
62 | + ? $this->$key |
|
63 | + : null; |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * @return void |
|
68 | - */ |
|
69 | - public function render() |
|
70 | - { |
|
71 | - echo $this->build(); |
|
72 | - } |
|
66 | + /** |
|
67 | + * @return void |
|
68 | + */ |
|
69 | + public function render() |
|
70 | + { |
|
71 | + echo $this->build(); |
|
72 | + } |
|
73 | 73 | } |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public $reviews; |
26 | 26 | |
27 | - public function __construct(array $reviews, $maxPageCount, array $args) |
|
27 | + public function __construct( array $reviews, $maxPageCount, array $args ) |
|
28 | 28 | { |
29 | 29 | $this->args = $args; |
30 | 30 | $this->max_num_pages = $maxPageCount; |
31 | 31 | $this->reviews = $reviews; |
32 | - parent::__construct($reviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS); |
|
32 | + parent::__construct( $reviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS ); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function __toString() |
39 | 39 | { |
40 | - return (string) $this->build(); |
|
40 | + return (string)$this->build(); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -45,20 +45,20 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function build() |
47 | 47 | { |
48 | - $args = glsr(SiteReviewsDefaults::class)->merge($this->args); |
|
49 | - return glsr(SiteReviewsPartial::class)->build($args, $this); |
|
48 | + $args = glsr( SiteReviewsDefaults::class )->merge( $this->args ); |
|
49 | + return glsr( SiteReviewsPartial::class )->build( $args, $this ); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
53 | 53 | * @param mixed $key |
54 | 54 | * @return mixed |
55 | 55 | */ |
56 | - public function offsetGet($key) |
|
56 | + public function offsetGet( $key ) |
|
57 | 57 | { |
58 | - if (array_key_exists($key, $this->reviews)) { |
|
58 | + if( array_key_exists( $key, $this->reviews ) ) { |
|
59 | 59 | return $this->reviews[$key]; |
60 | 60 | } |
61 | - return property_exists($this, $key) |
|
61 | + return property_exists( $this, $key ) |
|
62 | 62 | ? $this->$key |
63 | 63 | : null; |
64 | 64 | } |