@@ -1,17 +1,17 @@ discard block |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | 3 | <div class="is-fullwidth"> |
4 | 4 | <div class="glsr-flex-row glsr-has-2-columns"> |
5 | 5 | <div class="glsr-column"> |
6 | 6 | <h3>Editor Blocks</h3> |
7 | 7 | <p>The fastest way to getting started with Site Reviews is use the three provided blocks in the WordPress Block Editor. Each block comes with multiple settings which let you configure the block exactly as needed. To add a block to your page, click the "Add Block" button and search for "Site Reviews".</p> |
8 | - <img class="screenshot" src="<?= glsr()->url('assets/images/blocks.png'); ?>" alt="Editor Blocks" /> |
|
8 | + <img class="screenshot" src="<?= glsr()->url( 'assets/images/blocks.png' ); ?>" alt="Editor Blocks" /> |
|
9 | 9 | </div> |
10 | 10 | <div class="glsr-column"> |
11 | 11 | <h3>Shortcodes and Widgets</h3> |
12 | 12 | <p>You can also use the shortcodes or widgets on your page. Keep in mind, however, that widgets are limited in options compared to the shortcodes (for example, the "Latest Reviews" widget does not allow pagination). If you are using the Classic Editor in WordPress, you can click on the Site Reviews shortcode button above the editor (next to the media button) to add a shortcode via a friendly popup.</p> |
13 | 13 | <p>To learn more about the shortcodes and the available shortcode options, please see the Shortcode Documentation page of the plugin.</p> |
14 | - <a target="_blank" class="button" href="<?= admin_url('edit.php?post_type=site-review&page=documentation#!shortcodes'); ?>">View Shortcode Documentation</a> |
|
14 | + <a target="_blank" class="button" href="<?= admin_url( 'edit.php?post_type=site-review&page=documentation#!shortcodes' ); ?>">View Shortcode Documentation</a> |
|
15 | 15 | </div> |
16 | 16 | </div> |
17 | 17 | </div> |
@@ -20,27 +20,27 @@ discard block |
||
20 | 20 | <h2>Features</h2> |
21 | 21 | <ul class="glsr-flex-row glsr-has-3-columns"> |
22 | 22 | <li class="glsr-column"> |
23 | - <h3><a href="<?= admin_url('edit.php?post_type=site-review&page=addons'); ?>">Add-ons</a></h3> |
|
23 | + <h3><a href="<?= admin_url( 'edit.php?post_type=site-review&page=addons' ); ?>">Add-ons</a></h3> |
|
24 | 24 | <p>Extend Site Reviews with add-ons that provide additional features.</p> |
25 | 25 | </li> |
26 | 26 | <li class="glsr-column"> |
27 | - <h3><a href="<?= admin_url('edit.php?post_type=site-review&page=settings#!reviews'); ?>">Avatars</a></h3> |
|
27 | + <h3><a href="<?= admin_url( 'edit.php?post_type=site-review&page=settings#!reviews' ); ?>">Avatars</a></h3> |
|
28 | 28 | <p>Enable avatars to generate images using the WordPress Gravatar service.</p> |
29 | 29 | </li> |
30 | 30 | <li class="glsr-column"> |
31 | - <h3><a href="<?= admin_url('edit.php?post_type=site-review&page=tools#!general'); ?>">Backup/Restore</a></h3> |
|
31 | + <h3><a href="<?= admin_url( 'edit.php?post_type=site-review&page=tools#!general' ); ?>">Backup/Restore</a></h3> |
|
32 | 32 | <p>Backup and restore your plugin settings as needed.</p> |
33 | 33 | </li> |
34 | 34 | <li class="glsr-column"> |
35 | - <h3><a data-expand="#faq-14" href="<?= admin_url('edit.php?post_type=site-review&page=documentation#!faq'); ?>">Bayesian Ranking</a></h3> |
|
35 | + <h3><a data-expand="#faq-14" href="<?= admin_url( 'edit.php?post_type=site-review&page=documentation#!faq' ); ?>">Bayesian Ranking</a></h3> |
|
36 | 36 | <p>Easily rank pages with assigned reviews using the bayesian algorithm.</p> |
37 | 37 | </li> |
38 | 38 | <li class="glsr-column"> |
39 | - <h3><a href="<?= admin_url('edit.php?post_type=site-review&page=settings#!submissions'); ?>">Blacklist</a></h3> |
|
39 | + <h3><a href="<?= admin_url( 'edit.php?post_type=site-review&page=settings#!submissions' ); ?>">Blacklist</a></h3> |
|
40 | 40 | <p>Blacklist words, phrases, IP addresses, names, and emails.</p> |
41 | 41 | </li> |
42 | 42 | <li class="glsr-column"> |
43 | - <h3><a href="<?= admin_url('edit-tags.php?taxonomy=site-review-category&post_type=site-review'); ?>">Categories</a></h3> |
|
43 | + <h3><a href="<?= admin_url( 'edit-tags.php?taxonomy=site-review-category&post_type=site-review' ); ?>">Categories</a></h3> |
|
44 | 44 | <p>Add your own categories and assign reviews to them.</p> |
45 | 45 | </li> |
46 | 46 | <li class="glsr-column"> |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | <p>Designed for WordPress developers with over 100 filter hooks and convenient functions.</p> |
49 | 49 | </li> |
50 | 50 | <li class="glsr-column"> |
51 | - <h3><a href="<?= admin_url('edit.php?post_type=site-review&page=documentation#!faq'); ?>">Documentation</a></h3> |
|
51 | + <h3><a href="<?= admin_url( 'edit.php?post_type=site-review&page=documentation#!faq' ); ?>">Documentation</a></h3> |
|
52 | 52 | <p>Provides FAQ and documenation for hooks and all shortcodes and functions.</p> |
53 | 53 | </li> |
54 | 54 | <li class="glsr-column"> |
@@ -56,51 +56,51 @@ discard block |
||
56 | 56 | <p>Use configurable editor blocks in the new WordPress 5.0 editor.</p> |
57 | 57 | </li> |
58 | 58 | <li class="glsr-column"> |
59 | - <h3><a href="<?= admin_url('edit.php?post_type=site-review&page=settings#!schema'); ?>">JSON-LD Schema</a></h3> |
|
59 | + <h3><a href="<?= admin_url( 'edit.php?post_type=site-review&page=settings#!schema' ); ?>">JSON-LD Schema</a></h3> |
|
60 | 60 | <p>Enable JSON-LD schema to display your reviews and ratings in search results.</p> |
61 | 61 | </li> |
62 | 62 | <li class="glsr-column"> |
63 | - <h3><a href="<?= admin_url('edit.php?post_type=site-review&page=settings#!general'); ?>">Multilingual</a></h3> |
|
63 | + <h3><a href="<?= admin_url( 'edit.php?post_type=site-review&page=settings#!general' ); ?>">Multilingual</a></h3> |
|
64 | 64 | <p>Integrates with Polylang and WPML and provides easy search/replace translation.</p> |
65 | 65 | </li> |
66 | 66 | <li class="glsr-column"> |
67 | - <h3><a href="<?= admin_url('edit.php?post_type=site-review&page=settings#!general'); ?>">Notifications</a></h3> |
|
67 | + <h3><a href="<?= admin_url( 'edit.php?post_type=site-review&page=settings#!general' ); ?>">Notifications</a></h3> |
|
68 | 68 | <p>Send notifications to one or more emails when a review is submitted.</p> |
69 | 69 | </li> |
70 | 70 | <li class="glsr-column"> |
71 | - <h3><a data-expand="#faq-03" href="<?= admin_url('edit.php?post_type=site-review&page=documentation#!faq'); ?>">Page Assignment</a></h3> |
|
71 | + <h3><a data-expand="#faq-03" href="<?= admin_url( 'edit.php?post_type=site-review&page=documentation#!faq' ); ?>">Page Assignment</a></h3> |
|
72 | 72 | <p>Assign reviews to Posts, Pages, and Custom Post Types.</p> |
73 | 73 | </li> |
74 | 74 | <li class="glsr-column"> |
75 | - <h3><a data-expand="#faq-02" href="<?= admin_url('edit.php?post_type=site-review&page=documentation#!faq'); ?>">Pagination</a></h3> |
|
75 | + <h3><a data-expand="#faq-02" href="<?= admin_url( 'edit.php?post_type=site-review&page=documentation#!faq' ); ?>">Pagination</a></h3> |
|
76 | 76 | <p>Enable AJAX pagination to display a custom number of reviews per-page.</p> |
77 | 77 | </li> |
78 | 78 | <li class="glsr-column"> |
79 | - <h3><a href="<?= admin_url('edit.php?post_type=site-review'); ?>">Responses</a></h3> |
|
79 | + <h3><a href="<?= admin_url( 'edit.php?post_type=site-review' ); ?>">Responses</a></h3> |
|
80 | 80 | <p>Write a response to reviews that require a response.</p> |
81 | 81 | </li> |
82 | 82 | <li class="glsr-column"> |
83 | - <h3><a href="<?= admin_url('edit.php?post_type=site-review&page=settings#!general'); ?>">Restrictions</a></h3> |
|
83 | + <h3><a href="<?= admin_url( 'edit.php?post_type=site-review&page=settings#!general' ); ?>">Restrictions</a></h3> |
|
84 | 84 | <p>Require approval before publishing reviews and limit to registered users.</p> |
85 | 85 | </li> |
86 | 86 | <li class="glsr-column"> |
87 | - <h3><a href="<?= admin_url('edit.php?post_type=site-review&page=documentation#!shortcodes'); ?>">Shortcodes</a></h3> |
|
87 | + <h3><a href="<?= admin_url( 'edit.php?post_type=site-review&page=documentation#!shortcodes' ); ?>">Shortcodes</a></h3> |
|
88 | 88 | <p>Use the configurable shortcodes complete with documentation.</p> |
89 | 89 | </li> |
90 | 90 | <li class="glsr-column"> |
91 | - <h3><a href="<?= admin_url('edit.php?post_type=site-review&page=settings#!general'); ?>">Slack</a></h3> |
|
91 | + <h3><a href="<?= admin_url( 'edit.php?post_type=site-review&page=settings#!general' ); ?>">Slack</a></h3> |
|
92 | 92 | <p>Receive notifications in Slack when a review is submitted.</p> |
93 | 93 | </li> |
94 | 94 | <li class="glsr-column"> |
95 | - <h3><a href="<?= admin_url('edit.php?post_type=site-review&page=settings#!submissions'); ?>">SPAM Protection</a></h3> |
|
95 | + <h3><a href="<?= admin_url( 'edit.php?post_type=site-review&page=settings#!submissions' ); ?>">SPAM Protection</a></h3> |
|
96 | 96 | <p>Uses a Honeypot and integrates with Invisible reCAPTCHA and Akismet.</p> |
97 | 97 | </li> |
98 | 98 | <li class="glsr-column"> |
99 | - <h3><a href="<?= admin_url('edit.php?post_type=site-review&page=settings#!general'); ?>">Styles</a></h3> |
|
99 | + <h3><a href="<?= admin_url( 'edit.php?post_type=site-review&page=settings#!general' ); ?>">Styles</a></h3> |
|
100 | 100 | <p>Change the submission form style to match popular themes and form plugins.</p> |
101 | 101 | </li> |
102 | 102 | <li class="glsr-column"> |
103 | - <h3><a href="<?= admin_url('edit.php?post_type=site-review&page=documentation#!shortcodes'); ?>">Summaries</a></h3> |
|
103 | + <h3><a href="<?= admin_url( 'edit.php?post_type=site-review&page=documentation#!shortcodes' ); ?>">Summaries</a></h3> |
|
104 | 104 | <p>Display a summary of your review ratings from high to low.</p> |
105 | 105 | </li> |
106 | 106 | <li class="glsr-column"> |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | <p>Free premium support included on the WordPress support forum.</p> |
109 | 109 | </li> |
110 | 110 | <li class="glsr-column"> |
111 | - <h3><a data-expand="#faq-17" href="<?= admin_url('edit.php?post_type=site-review&page=documentation#!faq'); ?>">Templates</a></h3> |
|
111 | + <h3><a data-expand="#faq-17" href="<?= admin_url( 'edit.php?post_type=site-review&page=documentation#!faq' ); ?>">Templates</a></h3> |
|
112 | 112 | <p>Use the Site Reviews templates in your theme for full control over the HTML.</p> |
113 | 113 | </li> |
114 | 114 | <li class="glsr-column"> |
115 | - <h3><a href="<?= admin_url('widgets.php'); ?>">Widgets</a></h3> |
|
115 | + <h3><a href="<?= admin_url( 'widgets.php' ); ?>">Widgets</a></h3> |
|
116 | 116 | <p>Use the configurable widgets in your sidebars.</p> |
117 | 117 | </li> |
118 | 118 | </ul> |
@@ -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 }} |
@@ -14,67 +14,67 @@ |
||
14 | 14 | |
15 | 15 | class Filters implements HooksContract |
16 | 16 | { |
17 | - protected $admin; |
|
18 | - protected $app; |
|
19 | - protected $basename; |
|
20 | - protected $blocks; |
|
21 | - protected $editor; |
|
22 | - protected $listtable; |
|
23 | - protected $main; |
|
24 | - protected $public; |
|
25 | - protected $translator; |
|
26 | - protected $welcome; |
|
17 | + protected $admin; |
|
18 | + protected $app; |
|
19 | + protected $basename; |
|
20 | + protected $blocks; |
|
21 | + protected $editor; |
|
22 | + protected $listtable; |
|
23 | + protected $main; |
|
24 | + protected $public; |
|
25 | + protected $translator; |
|
26 | + protected $welcome; |
|
27 | 27 | |
28 | - public function __construct(Application $app) |
|
29 | - { |
|
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); |
|
40 | - } |
|
28 | + public function __construct(Application $app) |
|
29 | + { |
|
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); |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * @return void |
|
44 | - */ |
|
45 | - public function run() |
|
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']); |
|
79 | - } |
|
42 | + /** |
|
43 | + * @return void |
|
44 | + */ |
|
45 | + public function run() |
|
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']); |
|
79 | + } |
|
80 | 80 | } |
@@ -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 | } |
@@ -10,94 +10,94 @@ |
||
10 | 10 | |
11 | 11 | class MainController extends Controller |
12 | 12 | { |
13 | - /** |
|
14 | - * @return void |
|
15 | - * @action init |
|
16 | - */ |
|
17 | - public function registerPostType() |
|
18 | - { |
|
19 | - if (!glsr()->hasPermission()) { |
|
20 | - return; |
|
21 | - } |
|
22 | - $command = new RegisterPostType([ |
|
23 | - 'capabilities' => ['create_posts' => 'create_'.Application::POST_TYPE], |
|
24 | - 'columns' => [ |
|
25 | - 'title' => '', |
|
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'), |
|
32 | - 'date' => '', |
|
33 | - ], |
|
34 | - 'menu_icon' => 'dashicons-star-half', |
|
35 | - 'menu_name' => glsr()->name, |
|
36 | - 'map_meta_cap' => true, |
|
37 | - 'plural' => __('Reviews', 'site-reviews'), |
|
38 | - 'post_type' => Application::POST_TYPE, |
|
39 | - 'rest_controller_class' => RestReviewController::class, |
|
40 | - 'show_in_rest' => true, |
|
41 | - 'single' => __('Review', 'site-reviews'), |
|
42 | - ]); |
|
43 | - $this->execute($command); |
|
44 | - } |
|
13 | + /** |
|
14 | + * @return void |
|
15 | + * @action init |
|
16 | + */ |
|
17 | + public function registerPostType() |
|
18 | + { |
|
19 | + if (!glsr()->hasPermission()) { |
|
20 | + return; |
|
21 | + } |
|
22 | + $command = new RegisterPostType([ |
|
23 | + 'capabilities' => ['create_posts' => 'create_'.Application::POST_TYPE], |
|
24 | + 'columns' => [ |
|
25 | + 'title' => '', |
|
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'), |
|
32 | + 'date' => '', |
|
33 | + ], |
|
34 | + 'menu_icon' => 'dashicons-star-half', |
|
35 | + 'menu_name' => glsr()->name, |
|
36 | + 'map_meta_cap' => true, |
|
37 | + 'plural' => __('Reviews', 'site-reviews'), |
|
38 | + 'post_type' => Application::POST_TYPE, |
|
39 | + 'rest_controller_class' => RestReviewController::class, |
|
40 | + 'show_in_rest' => true, |
|
41 | + 'single' => __('Review', 'site-reviews'), |
|
42 | + ]); |
|
43 | + $this->execute($command); |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * @return void |
|
48 | - * @action init |
|
49 | - */ |
|
50 | - public function registerShortcodes() |
|
51 | - { |
|
52 | - $command = new RegisterShortcodes([ |
|
53 | - 'site_reviews', |
|
54 | - 'site_reviews_form', |
|
55 | - 'site_reviews_summary', |
|
56 | - ]); |
|
57 | - $this->execute($command); |
|
58 | - } |
|
46 | + /** |
|
47 | + * @return void |
|
48 | + * @action init |
|
49 | + */ |
|
50 | + public function registerShortcodes() |
|
51 | + { |
|
52 | + $command = new RegisterShortcodes([ |
|
53 | + 'site_reviews', |
|
54 | + 'site_reviews_form', |
|
55 | + 'site_reviews_summary', |
|
56 | + ]); |
|
57 | + $this->execute($command); |
|
58 | + } |
|
59 | 59 | |
60 | - /** |
|
61 | - * @return void |
|
62 | - * @action init |
|
63 | - */ |
|
64 | - public function registerTaxonomy() |
|
65 | - { |
|
66 | - $command = new RegisterTaxonomy([ |
|
67 | - 'hierarchical' => true, |
|
68 | - 'meta_box_cb' => [glsr(EditorController::class), 'renderTaxonomyMetabox'], |
|
69 | - 'public' => false, |
|
70 | - 'rest_controller_class' => RestCategoryController::class, |
|
71 | - 'show_admin_column' => true, |
|
72 | - 'show_in_rest' => true, |
|
73 | - 'show_ui' => true, |
|
74 | - ]); |
|
75 | - $this->execute($command); |
|
76 | - } |
|
60 | + /** |
|
61 | + * @return void |
|
62 | + * @action init |
|
63 | + */ |
|
64 | + public function registerTaxonomy() |
|
65 | + { |
|
66 | + $command = new RegisterTaxonomy([ |
|
67 | + 'hierarchical' => true, |
|
68 | + 'meta_box_cb' => [glsr(EditorController::class), 'renderTaxonomyMetabox'], |
|
69 | + 'public' => false, |
|
70 | + 'rest_controller_class' => RestCategoryController::class, |
|
71 | + 'show_admin_column' => true, |
|
72 | + 'show_in_rest' => true, |
|
73 | + 'show_ui' => true, |
|
74 | + ]); |
|
75 | + $this->execute($command); |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * @return void |
|
80 | - * @action widgets_init |
|
81 | - */ |
|
82 | - public function registerWidgets() |
|
83 | - { |
|
84 | - $command = new RegisterWidgets([ |
|
85 | - 'site-reviews' => [ |
|
86 | - 'class' => 'glsr-widget glsr-widget-site-reviews', |
|
87 | - 'description' => __('Site Reviews: Display your recent reviews.', 'site-reviews'), |
|
88 | - 'title' => __('Recent Reviews', 'site-reviews'), |
|
89 | - ], |
|
90 | - 'site-reviews-form' => [ |
|
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'), |
|
94 | - ], |
|
95 | - 'site-reviews-summary' => [ |
|
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'), |
|
99 | - ], |
|
100 | - ]); |
|
101 | - $this->execute($command); |
|
102 | - } |
|
78 | + /** |
|
79 | + * @return void |
|
80 | + * @action widgets_init |
|
81 | + */ |
|
82 | + public function registerWidgets() |
|
83 | + { |
|
84 | + $command = new RegisterWidgets([ |
|
85 | + 'site-reviews' => [ |
|
86 | + 'class' => 'glsr-widget glsr-widget-site-reviews', |
|
87 | + 'description' => __('Site Reviews: Display your recent reviews.', 'site-reviews'), |
|
88 | + 'title' => __('Recent Reviews', 'site-reviews'), |
|
89 | + ], |
|
90 | + 'site-reviews-form' => [ |
|
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'), |
|
94 | + ], |
|
95 | + 'site-reviews-summary' => [ |
|
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'), |
|
99 | + ], |
|
100 | + ]); |
|
101 | + $this->execute($command); |
|
102 | + } |
|
103 | 103 | } |
@@ -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 | } |
@@ -33,7 +33,8 @@ |
||
33 | 33 | protected $taxonomy; |
34 | 34 | protected $welcome; |
35 | 35 | |
36 | - public function __construct(Application $app ) { |
|
36 | + public function __construct(Application $app ) |
|
37 | + { |
|
37 | 38 | $this->app = $app; |
38 | 39 | $this->admin = $app->make(AdminController::class); |
39 | 40 | $this->blocks = $app->make(BlocksController::class); |
@@ -19,104 +19,104 @@ |
||
19 | 19 | |
20 | 20 | class Actions implements HooksContract |
21 | 21 | { |
22 | - protected $about; |
|
23 | - protected $app; |
|
24 | - protected $blocks; |
|
25 | - protected $console; |
|
26 | - protected $editor; |
|
27 | - protected $listtable; |
|
28 | - protected $menu; |
|
29 | - protected $main; |
|
30 | - protected $public; |
|
31 | - protected $rebusify; |
|
32 | - protected $review; |
|
33 | - protected $router; |
|
34 | - protected $settings; |
|
35 | - protected $taxonomy; |
|
36 | - protected $welcome; |
|
22 | + protected $about; |
|
23 | + protected $app; |
|
24 | + protected $blocks; |
|
25 | + protected $console; |
|
26 | + protected $editor; |
|
27 | + protected $listtable; |
|
28 | + protected $menu; |
|
29 | + protected $main; |
|
30 | + protected $public; |
|
31 | + protected $rebusify; |
|
32 | + protected $review; |
|
33 | + protected $router; |
|
34 | + protected $settings; |
|
35 | + protected $taxonomy; |
|
36 | + protected $welcome; |
|
37 | 37 | |
38 | - public function __construct(Application $app ) { |
|
39 | - $this->app = $app; |
|
40 | - $this->admin = $app->make(AdminController::class); |
|
41 | - $this->blocks = $app->make(BlocksController::class); |
|
42 | - $this->console = $app->make(Console::class); |
|
43 | - $this->editor = $app->make(EditorController::class); |
|
44 | - $this->listtable = $app->make(ListTableController::class); |
|
45 | - $this->main = $app->make(MainController::class); |
|
46 | - $this->menu = $app->make(MenuController::class); |
|
47 | - $this->public = $app->make(PublicController::class); |
|
48 | - $this->rebusify = $app->make(RebusifyController::class); |
|
49 | - $this->review = $app->make(ReviewController::class); |
|
50 | - $this->router = $app->make(Router::class); |
|
51 | - $this->settings = $app->make(SettingsController::class); |
|
52 | - $this->taxonomy = $app->make(TaxonomyController::class); |
|
53 | - $this->welcome = $app->make(WelcomeController::class); |
|
54 | - } |
|
38 | + public function __construct(Application $app ) { |
|
39 | + $this->app = $app; |
|
40 | + $this->admin = $app->make(AdminController::class); |
|
41 | + $this->blocks = $app->make(BlocksController::class); |
|
42 | + $this->console = $app->make(Console::class); |
|
43 | + $this->editor = $app->make(EditorController::class); |
|
44 | + $this->listtable = $app->make(ListTableController::class); |
|
45 | + $this->main = $app->make(MainController::class); |
|
46 | + $this->menu = $app->make(MenuController::class); |
|
47 | + $this->public = $app->make(PublicController::class); |
|
48 | + $this->rebusify = $app->make(RebusifyController::class); |
|
49 | + $this->review = $app->make(ReviewController::class); |
|
50 | + $this->router = $app->make(Router::class); |
|
51 | + $this->settings = $app->make(SettingsController::class); |
|
52 | + $this->taxonomy = $app->make(TaxonomyController::class); |
|
53 | + $this->welcome = $app->make(WelcomeController::class); |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @return void |
|
58 | - */ |
|
59 | - public function run() |
|
60 | - { |
|
61 | - add_action('admin_enqueue_scripts', [$this->admin, 'enqueueAssets']); |
|
62 | - add_action('admin_init', [$this->admin, 'registerTinymcePopups']); |
|
63 | - add_action('media_buttons', [$this->admin, 'renderTinymceButton'], 11); |
|
64 | - add_action('plugins_loaded', [$this->app, 'getDefaults'], 11); |
|
65 | - add_action('plugins_loaded', [$this->app, 'registerAddons']); |
|
66 | - add_action('plugins_loaded', [$this->app, 'registerLanguages']); |
|
67 | - add_action('plugins_loaded', [$this->app, 'registerReviewTypes']); |
|
68 | - add_action('upgrader_process_complete', [$this->app, 'upgraded'], 10, 2); |
|
69 | - add_action('init', [$this->blocks, 'registerAssets'], 9); |
|
70 | - add_action('init', [$this->blocks, 'registerBlocks']); |
|
71 | - add_action('admin_footer', [$this->console, 'logOnce']); |
|
72 | - add_action('wp_footer', [$this->console, 'logOnce']); |
|
73 | - add_action('admin_enqueue_scripts', [$this->editor, 'customizePostStatusLabels']); |
|
74 | - add_action('add_meta_boxes_'.Application::POST_TYPE, [$this->editor, 'registerMetaBoxes']); |
|
75 | - add_action('admin_print_scripts', [$this->editor, 'removeAutosave'], 999); |
|
76 | - add_action('admin_menu', [$this->editor, 'removeMetaBoxes']); |
|
77 | - add_action('current_screen', [$this->editor, 'removePostTypeSupport']); |
|
78 | - add_action('post_submitbox_misc_actions', [$this->editor, 'renderPinnedInPublishMetaBox']); |
|
79 | - add_action('admin_head', [$this->editor, 'renderReviewFields']); |
|
80 | - add_action('admin_action_revert', [$this->editor, 'revertReview']); |
|
81 | - add_action('save_post_'.Application::POST_TYPE, [$this->editor, 'saveMetaboxes']); |
|
82 | - add_action('admin_action_approve', [$this->listtable, 'approve']); |
|
83 | - add_action('bulk_edit_custom_box', [$this->listtable, 'renderBulkEditFields'], 10, 2); |
|
84 | - add_action('restrict_manage_posts', [$this->listtable, 'renderColumnFilters']); |
|
85 | - add_action('manage_'.Application::POST_TYPE.'_posts_custom_column', [$this->listtable, 'renderColumnValues'], 10, 2); |
|
86 | - add_action('save_post_'.Application::POST_TYPE, [$this->listtable, 'saveBulkEditFields']); |
|
87 | - add_action('pre_get_posts', [$this->listtable, 'setQueryForColumn']); |
|
88 | - add_action('admin_action_unapprove', [$this->listtable, 'unapprove']); |
|
89 | - add_action('init', [$this->main, 'registerPostType'], 8); |
|
90 | - add_action('init', [$this->main, 'registerShortcodes']); |
|
91 | - add_action('init', [$this->main, 'registerTaxonomy']); |
|
92 | - add_action('widgets_init', [$this->main, 'registerWidgets']); |
|
93 | - add_action('admin_menu', [$this->menu, 'registerMenuCount']); |
|
94 | - add_action('admin_menu', [$this->menu, 'registerSubMenus']); |
|
95 | - add_action('admin_init', [$this->menu, 'setCustomPermissions'], 999); |
|
96 | - add_action('wp_enqueue_scripts', [$this->public, 'enqueueAssets'], 999); |
|
97 | - add_filter('site-reviews/builder', [$this->public, 'modifyBuilder']); |
|
98 | - add_action('wp_footer', [$this->public, 'renderSchema']); |
|
99 | - add_action('site-reviews/review/created', [$this->rebusify, 'onCreated']); |
|
100 | - add_action('site-reviews/review/reverted', [$this->rebusify, 'onReverted']); |
|
101 | - add_action('site-reviews/review/saved', [$this->rebusify, 'onSaved']); |
|
102 | - add_action('updated_postmeta', [$this->rebusify, 'onUpdatedMeta'], 10, 4); |
|
103 | - add_action('set_object_terms', [$this->review, 'onAfterChangeCategory'], 10, 6); |
|
104 | - add_action('transition_post_status', [$this->review, 'onAfterChangeStatus'], 10, 3); |
|
105 | - add_action('site-reviews/review/created', [$this->review, 'onAfterCreate']); |
|
106 | - add_action('before_delete_post', [$this->review, 'onBeforeDelete']); |
|
107 | - add_action('update_postmeta', [$this->review, 'onBeforeUpdate'], 10, 4); |
|
108 | - add_action('admin_init', [$this->router, 'routeAdminPostRequest']); |
|
109 | - add_action('wp_ajax_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest']); |
|
110 | - add_action('wp_ajax_nopriv_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest']); |
|
111 | - add_action('init', [$this->router, 'routePublicPostRequest']); |
|
112 | - add_action('admin_init', [$this->settings, 'registerSettings']); |
|
113 | - add_action(Application::TAXONOMY.'_term_edit_form_top', [$this->taxonomy, 'disableParents']); |
|
114 | - add_action(Application::TAXONOMY.'_term_new_form_tag', [$this->taxonomy, 'disableParents']); |
|
115 | - add_action(Application::TAXONOMY.'_add_form_fields', [$this->taxonomy, 'enableParents']); |
|
116 | - add_action(Application::TAXONOMY.'_edit_form', [$this->taxonomy, 'enableParents']); |
|
117 | - add_action('restrict_manage_posts', [$this->taxonomy, 'renderTaxonomyFilter'], 9); |
|
118 | - add_action('set_object_terms', [$this->taxonomy, 'restrictTermSelection'], 9, 6); |
|
119 | - add_action('activated_plugin', [$this->welcome, 'redirectOnActivation'], 10, 2); |
|
120 | - add_action('admin_menu', [$this->welcome, 'registerPage']); |
|
121 | - } |
|
56 | + /** |
|
57 | + * @return void |
|
58 | + */ |
|
59 | + public function run() |
|
60 | + { |
|
61 | + add_action('admin_enqueue_scripts', [$this->admin, 'enqueueAssets']); |
|
62 | + add_action('admin_init', [$this->admin, 'registerTinymcePopups']); |
|
63 | + add_action('media_buttons', [$this->admin, 'renderTinymceButton'], 11); |
|
64 | + add_action('plugins_loaded', [$this->app, 'getDefaults'], 11); |
|
65 | + add_action('plugins_loaded', [$this->app, 'registerAddons']); |
|
66 | + add_action('plugins_loaded', [$this->app, 'registerLanguages']); |
|
67 | + add_action('plugins_loaded', [$this->app, 'registerReviewTypes']); |
|
68 | + add_action('upgrader_process_complete', [$this->app, 'upgraded'], 10, 2); |
|
69 | + add_action('init', [$this->blocks, 'registerAssets'], 9); |
|
70 | + add_action('init', [$this->blocks, 'registerBlocks']); |
|
71 | + add_action('admin_footer', [$this->console, 'logOnce']); |
|
72 | + add_action('wp_footer', [$this->console, 'logOnce']); |
|
73 | + add_action('admin_enqueue_scripts', [$this->editor, 'customizePostStatusLabels']); |
|
74 | + add_action('add_meta_boxes_'.Application::POST_TYPE, [$this->editor, 'registerMetaBoxes']); |
|
75 | + add_action('admin_print_scripts', [$this->editor, 'removeAutosave'], 999); |
|
76 | + add_action('admin_menu', [$this->editor, 'removeMetaBoxes']); |
|
77 | + add_action('current_screen', [$this->editor, 'removePostTypeSupport']); |
|
78 | + add_action('post_submitbox_misc_actions', [$this->editor, 'renderPinnedInPublishMetaBox']); |
|
79 | + add_action('admin_head', [$this->editor, 'renderReviewFields']); |
|
80 | + add_action('admin_action_revert', [$this->editor, 'revertReview']); |
|
81 | + add_action('save_post_'.Application::POST_TYPE, [$this->editor, 'saveMetaboxes']); |
|
82 | + add_action('admin_action_approve', [$this->listtable, 'approve']); |
|
83 | + add_action('bulk_edit_custom_box', [$this->listtable, 'renderBulkEditFields'], 10, 2); |
|
84 | + add_action('restrict_manage_posts', [$this->listtable, 'renderColumnFilters']); |
|
85 | + add_action('manage_'.Application::POST_TYPE.'_posts_custom_column', [$this->listtable, 'renderColumnValues'], 10, 2); |
|
86 | + add_action('save_post_'.Application::POST_TYPE, [$this->listtable, 'saveBulkEditFields']); |
|
87 | + add_action('pre_get_posts', [$this->listtable, 'setQueryForColumn']); |
|
88 | + add_action('admin_action_unapprove', [$this->listtable, 'unapprove']); |
|
89 | + add_action('init', [$this->main, 'registerPostType'], 8); |
|
90 | + add_action('init', [$this->main, 'registerShortcodes']); |
|
91 | + add_action('init', [$this->main, 'registerTaxonomy']); |
|
92 | + add_action('widgets_init', [$this->main, 'registerWidgets']); |
|
93 | + add_action('admin_menu', [$this->menu, 'registerMenuCount']); |
|
94 | + add_action('admin_menu', [$this->menu, 'registerSubMenus']); |
|
95 | + add_action('admin_init', [$this->menu, 'setCustomPermissions'], 999); |
|
96 | + add_action('wp_enqueue_scripts', [$this->public, 'enqueueAssets'], 999); |
|
97 | + add_filter('site-reviews/builder', [$this->public, 'modifyBuilder']); |
|
98 | + add_action('wp_footer', [$this->public, 'renderSchema']); |
|
99 | + add_action('site-reviews/review/created', [$this->rebusify, 'onCreated']); |
|
100 | + add_action('site-reviews/review/reverted', [$this->rebusify, 'onReverted']); |
|
101 | + add_action('site-reviews/review/saved', [$this->rebusify, 'onSaved']); |
|
102 | + add_action('updated_postmeta', [$this->rebusify, 'onUpdatedMeta'], 10, 4); |
|
103 | + add_action('set_object_terms', [$this->review, 'onAfterChangeCategory'], 10, 6); |
|
104 | + add_action('transition_post_status', [$this->review, 'onAfterChangeStatus'], 10, 3); |
|
105 | + add_action('site-reviews/review/created', [$this->review, 'onAfterCreate']); |
|
106 | + add_action('before_delete_post', [$this->review, 'onBeforeDelete']); |
|
107 | + add_action('update_postmeta', [$this->review, 'onBeforeUpdate'], 10, 4); |
|
108 | + add_action('admin_init', [$this->router, 'routeAdminPostRequest']); |
|
109 | + add_action('wp_ajax_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest']); |
|
110 | + add_action('wp_ajax_nopriv_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest']); |
|
111 | + add_action('init', [$this->router, 'routePublicPostRequest']); |
|
112 | + add_action('admin_init', [$this->settings, 'registerSettings']); |
|
113 | + add_action(Application::TAXONOMY.'_term_edit_form_top', [$this->taxonomy, 'disableParents']); |
|
114 | + add_action(Application::TAXONOMY.'_term_new_form_tag', [$this->taxonomy, 'disableParents']); |
|
115 | + add_action(Application::TAXONOMY.'_add_form_fields', [$this->taxonomy, 'enableParents']); |
|
116 | + add_action(Application::TAXONOMY.'_edit_form', [$this->taxonomy, 'enableParents']); |
|
117 | + add_action('restrict_manage_posts', [$this->taxonomy, 'renderTaxonomyFilter'], 9); |
|
118 | + add_action('set_object_terms', [$this->taxonomy, 'restrictTermSelection'], 9, 6); |
|
119 | + add_action('activated_plugin', [$this->welcome, 'redirectOnActivation'], 10, 2); |
|
120 | + add_action('admin_menu', [$this->welcome, 'registerPage']); |
|
121 | + } |
|
122 | 122 | } |
@@ -35,22 +35,22 @@ discard block |
||
35 | 35 | protected $taxonomy; |
36 | 36 | protected $welcome; |
37 | 37 | |
38 | - public function __construct(Application $app ) { |
|
38 | + public function __construct( Application $app ) { |
|
39 | 39 | $this->app = $app; |
40 | - $this->admin = $app->make(AdminController::class); |
|
41 | - $this->blocks = $app->make(BlocksController::class); |
|
42 | - $this->console = $app->make(Console::class); |
|
43 | - $this->editor = $app->make(EditorController::class); |
|
44 | - $this->listtable = $app->make(ListTableController::class); |
|
45 | - $this->main = $app->make(MainController::class); |
|
46 | - $this->menu = $app->make(MenuController::class); |
|
47 | - $this->public = $app->make(PublicController::class); |
|
48 | - $this->rebusify = $app->make(RebusifyController::class); |
|
49 | - $this->review = $app->make(ReviewController::class); |
|
50 | - $this->router = $app->make(Router::class); |
|
51 | - $this->settings = $app->make(SettingsController::class); |
|
52 | - $this->taxonomy = $app->make(TaxonomyController::class); |
|
53 | - $this->welcome = $app->make(WelcomeController::class); |
|
40 | + $this->admin = $app->make( AdminController::class ); |
|
41 | + $this->blocks = $app->make( BlocksController::class ); |
|
42 | + $this->console = $app->make( Console::class ); |
|
43 | + $this->editor = $app->make( EditorController::class ); |
|
44 | + $this->listtable = $app->make( ListTableController::class ); |
|
45 | + $this->main = $app->make( MainController::class ); |
|
46 | + $this->menu = $app->make( MenuController::class ); |
|
47 | + $this->public = $app->make( PublicController::class ); |
|
48 | + $this->rebusify = $app->make( RebusifyController::class ); |
|
49 | + $this->review = $app->make( ReviewController::class ); |
|
50 | + $this->router = $app->make( Router::class ); |
|
51 | + $this->settings = $app->make( SettingsController::class ); |
|
52 | + $this->taxonomy = $app->make( TaxonomyController::class ); |
|
53 | + $this->welcome = $app->make( WelcomeController::class ); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -58,65 +58,65 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function run() |
60 | 60 | { |
61 | - add_action('admin_enqueue_scripts', [$this->admin, 'enqueueAssets']); |
|
62 | - add_action('admin_init', [$this->admin, 'registerTinymcePopups']); |
|
63 | - add_action('media_buttons', [$this->admin, 'renderTinymceButton'], 11); |
|
64 | - add_action('plugins_loaded', [$this->app, 'getDefaults'], 11); |
|
65 | - add_action('plugins_loaded', [$this->app, 'registerAddons']); |
|
66 | - add_action('plugins_loaded', [$this->app, 'registerLanguages']); |
|
67 | - add_action('plugins_loaded', [$this->app, 'registerReviewTypes']); |
|
68 | - add_action('upgrader_process_complete', [$this->app, 'upgraded'], 10, 2); |
|
69 | - add_action('init', [$this->blocks, 'registerAssets'], 9); |
|
70 | - add_action('init', [$this->blocks, 'registerBlocks']); |
|
71 | - add_action('admin_footer', [$this->console, 'logOnce']); |
|
72 | - add_action('wp_footer', [$this->console, 'logOnce']); |
|
73 | - add_action('admin_enqueue_scripts', [$this->editor, 'customizePostStatusLabels']); |
|
74 | - add_action('add_meta_boxes_'.Application::POST_TYPE, [$this->editor, 'registerMetaBoxes']); |
|
75 | - add_action('admin_print_scripts', [$this->editor, 'removeAutosave'], 999); |
|
76 | - add_action('admin_menu', [$this->editor, 'removeMetaBoxes']); |
|
77 | - add_action('current_screen', [$this->editor, 'removePostTypeSupport']); |
|
78 | - add_action('post_submitbox_misc_actions', [$this->editor, 'renderPinnedInPublishMetaBox']); |
|
79 | - add_action('admin_head', [$this->editor, 'renderReviewFields']); |
|
80 | - add_action('admin_action_revert', [$this->editor, 'revertReview']); |
|
81 | - add_action('save_post_'.Application::POST_TYPE, [$this->editor, 'saveMetaboxes']); |
|
82 | - add_action('admin_action_approve', [$this->listtable, 'approve']); |
|
83 | - add_action('bulk_edit_custom_box', [$this->listtable, 'renderBulkEditFields'], 10, 2); |
|
84 | - add_action('restrict_manage_posts', [$this->listtable, 'renderColumnFilters']); |
|
85 | - add_action('manage_'.Application::POST_TYPE.'_posts_custom_column', [$this->listtable, 'renderColumnValues'], 10, 2); |
|
86 | - add_action('save_post_'.Application::POST_TYPE, [$this->listtable, 'saveBulkEditFields']); |
|
87 | - add_action('pre_get_posts', [$this->listtable, 'setQueryForColumn']); |
|
88 | - add_action('admin_action_unapprove', [$this->listtable, 'unapprove']); |
|
89 | - add_action('init', [$this->main, 'registerPostType'], 8); |
|
90 | - add_action('init', [$this->main, 'registerShortcodes']); |
|
91 | - add_action('init', [$this->main, 'registerTaxonomy']); |
|
92 | - add_action('widgets_init', [$this->main, 'registerWidgets']); |
|
93 | - add_action('admin_menu', [$this->menu, 'registerMenuCount']); |
|
94 | - add_action('admin_menu', [$this->menu, 'registerSubMenus']); |
|
95 | - add_action('admin_init', [$this->menu, 'setCustomPermissions'], 999); |
|
96 | - add_action('wp_enqueue_scripts', [$this->public, 'enqueueAssets'], 999); |
|
97 | - add_filter('site-reviews/builder', [$this->public, 'modifyBuilder']); |
|
98 | - add_action('wp_footer', [$this->public, 'renderSchema']); |
|
99 | - add_action('site-reviews/review/created', [$this->rebusify, 'onCreated']); |
|
100 | - add_action('site-reviews/review/reverted', [$this->rebusify, 'onReverted']); |
|
101 | - add_action('site-reviews/review/saved', [$this->rebusify, 'onSaved']); |
|
102 | - add_action('updated_postmeta', [$this->rebusify, 'onUpdatedMeta'], 10, 4); |
|
103 | - add_action('set_object_terms', [$this->review, 'onAfterChangeCategory'], 10, 6); |
|
104 | - add_action('transition_post_status', [$this->review, 'onAfterChangeStatus'], 10, 3); |
|
105 | - add_action('site-reviews/review/created', [$this->review, 'onAfterCreate']); |
|
106 | - add_action('before_delete_post', [$this->review, 'onBeforeDelete']); |
|
107 | - add_action('update_postmeta', [$this->review, 'onBeforeUpdate'], 10, 4); |
|
108 | - add_action('admin_init', [$this->router, 'routeAdminPostRequest']); |
|
109 | - add_action('wp_ajax_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest']); |
|
110 | - add_action('wp_ajax_nopriv_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest']); |
|
111 | - add_action('init', [$this->router, 'routePublicPostRequest']); |
|
112 | - add_action('admin_init', [$this->settings, 'registerSettings']); |
|
113 | - add_action(Application::TAXONOMY.'_term_edit_form_top', [$this->taxonomy, 'disableParents']); |
|
114 | - add_action(Application::TAXONOMY.'_term_new_form_tag', [$this->taxonomy, 'disableParents']); |
|
115 | - add_action(Application::TAXONOMY.'_add_form_fields', [$this->taxonomy, 'enableParents']); |
|
116 | - add_action(Application::TAXONOMY.'_edit_form', [$this->taxonomy, 'enableParents']); |
|
117 | - add_action('restrict_manage_posts', [$this->taxonomy, 'renderTaxonomyFilter'], 9); |
|
118 | - add_action('set_object_terms', [$this->taxonomy, 'restrictTermSelection'], 9, 6); |
|
119 | - add_action('activated_plugin', [$this->welcome, 'redirectOnActivation'], 10, 2); |
|
120 | - add_action('admin_menu', [$this->welcome, 'registerPage']); |
|
61 | + add_action( 'admin_enqueue_scripts', [$this->admin, 'enqueueAssets'] ); |
|
62 | + add_action( 'admin_init', [$this->admin, 'registerTinymcePopups'] ); |
|
63 | + add_action( 'media_buttons', [$this->admin, 'renderTinymceButton'], 11 ); |
|
64 | + add_action( 'plugins_loaded', [$this->app, 'getDefaults'], 11 ); |
|
65 | + add_action( 'plugins_loaded', [$this->app, 'registerAddons'] ); |
|
66 | + add_action( 'plugins_loaded', [$this->app, 'registerLanguages'] ); |
|
67 | + add_action( 'plugins_loaded', [$this->app, 'registerReviewTypes'] ); |
|
68 | + add_action( 'upgrader_process_complete', [$this->app, 'upgraded'], 10, 2 ); |
|
69 | + add_action( 'init', [$this->blocks, 'registerAssets'], 9 ); |
|
70 | + add_action( 'init', [$this->blocks, 'registerBlocks'] ); |
|
71 | + add_action( 'admin_footer', [$this->console, 'logOnce'] ); |
|
72 | + add_action( 'wp_footer', [$this->console, 'logOnce'] ); |
|
73 | + add_action( 'admin_enqueue_scripts', [$this->editor, 'customizePostStatusLabels'] ); |
|
74 | + add_action( 'add_meta_boxes_'.Application::POST_TYPE, [$this->editor, 'registerMetaBoxes'] ); |
|
75 | + add_action( 'admin_print_scripts', [$this->editor, 'removeAutosave'], 999 ); |
|
76 | + add_action( 'admin_menu', [$this->editor, 'removeMetaBoxes'] ); |
|
77 | + add_action( 'current_screen', [$this->editor, 'removePostTypeSupport'] ); |
|
78 | + add_action( 'post_submitbox_misc_actions', [$this->editor, 'renderPinnedInPublishMetaBox'] ); |
|
79 | + add_action( 'admin_head', [$this->editor, 'renderReviewFields'] ); |
|
80 | + add_action( 'admin_action_revert', [$this->editor, 'revertReview'] ); |
|
81 | + add_action( 'save_post_'.Application::POST_TYPE, [$this->editor, 'saveMetaboxes'] ); |
|
82 | + add_action( 'admin_action_approve', [$this->listtable, 'approve'] ); |
|
83 | + add_action( 'bulk_edit_custom_box', [$this->listtable, 'renderBulkEditFields'], 10, 2 ); |
|
84 | + add_action( 'restrict_manage_posts', [$this->listtable, 'renderColumnFilters'] ); |
|
85 | + add_action( 'manage_'.Application::POST_TYPE.'_posts_custom_column', [$this->listtable, 'renderColumnValues'], 10, 2 ); |
|
86 | + add_action( 'save_post_'.Application::POST_TYPE, [$this->listtable, 'saveBulkEditFields'] ); |
|
87 | + add_action( 'pre_get_posts', [$this->listtable, 'setQueryForColumn'] ); |
|
88 | + add_action( 'admin_action_unapprove', [$this->listtable, 'unapprove'] ); |
|
89 | + add_action( 'init', [$this->main, 'registerPostType'], 8 ); |
|
90 | + add_action( 'init', [$this->main, 'registerShortcodes'] ); |
|
91 | + add_action( 'init', [$this->main, 'registerTaxonomy'] ); |
|
92 | + add_action( 'widgets_init', [$this->main, 'registerWidgets'] ); |
|
93 | + add_action( 'admin_menu', [$this->menu, 'registerMenuCount'] ); |
|
94 | + add_action( 'admin_menu', [$this->menu, 'registerSubMenus'] ); |
|
95 | + add_action( 'admin_init', [$this->menu, 'setCustomPermissions'], 999 ); |
|
96 | + add_action( 'wp_enqueue_scripts', [$this->public, 'enqueueAssets'], 999 ); |
|
97 | + add_filter( 'site-reviews/builder', [$this->public, 'modifyBuilder'] ); |
|
98 | + add_action( 'wp_footer', [$this->public, 'renderSchema'] ); |
|
99 | + add_action( 'site-reviews/review/created', [$this->rebusify, 'onCreated'] ); |
|
100 | + add_action( 'site-reviews/review/reverted', [$this->rebusify, 'onReverted'] ); |
|
101 | + add_action( 'site-reviews/review/saved', [$this->rebusify, 'onSaved'] ); |
|
102 | + add_action( 'updated_postmeta', [$this->rebusify, 'onUpdatedMeta'], 10, 4 ); |
|
103 | + add_action( 'set_object_terms', [$this->review, 'onAfterChangeCategory'], 10, 6 ); |
|
104 | + add_action( 'transition_post_status', [$this->review, 'onAfterChangeStatus'], 10, 3 ); |
|
105 | + add_action( 'site-reviews/review/created', [$this->review, 'onAfterCreate'] ); |
|
106 | + add_action( 'before_delete_post', [$this->review, 'onBeforeDelete'] ); |
|
107 | + add_action( 'update_postmeta', [$this->review, 'onBeforeUpdate'], 10, 4 ); |
|
108 | + add_action( 'admin_init', [$this->router, 'routeAdminPostRequest'] ); |
|
109 | + add_action( 'wp_ajax_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] ); |
|
110 | + add_action( 'wp_ajax_nopriv_'.Application::PREFIX.'action', [$this->router, 'routeAjaxRequest'] ); |
|
111 | + add_action( 'init', [$this->router, 'routePublicPostRequest'] ); |
|
112 | + add_action( 'admin_init', [$this->settings, 'registerSettings'] ); |
|
113 | + add_action( Application::TAXONOMY.'_term_edit_form_top', [$this->taxonomy, 'disableParents'] ); |
|
114 | + add_action( Application::TAXONOMY.'_term_new_form_tag', [$this->taxonomy, 'disableParents'] ); |
|
115 | + add_action( Application::TAXONOMY.'_add_form_fields', [$this->taxonomy, 'enableParents'] ); |
|
116 | + add_action( Application::TAXONOMY.'_edit_form', [$this->taxonomy, 'enableParents'] ); |
|
117 | + add_action( 'restrict_manage_posts', [$this->taxonomy, 'renderTaxonomyFilter'], 9 ); |
|
118 | + add_action( 'set_object_terms', [$this->taxonomy, 'restrictTermSelection'], 9, 6 ); |
|
119 | + add_action( 'activated_plugin', [$this->welcome, 'redirectOnActivation'], 10, 2 ); |
|
120 | + add_action( 'admin_menu', [$this->welcome, 'registerPage'] ); |
|
121 | 121 | } |
122 | 122 | } |
@@ -8,99 +8,99 @@ |
||
8 | 8 | |
9 | 9 | class WelcomeController extends Controller |
10 | 10 | { |
11 | - /** |
|
12 | - * @return array |
|
13 | - * @filter plugin_action_links_site-reviews/site-reviews.php |
|
14 | - */ |
|
15 | - public function filterActionLinks(array $links) |
|
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 | - ]); |
|
20 | - return $links; |
|
21 | - } |
|
11 | + /** |
|
12 | + * @return array |
|
13 | + * @filter plugin_action_links_site-reviews/site-reviews.php |
|
14 | + */ |
|
15 | + public function filterActionLinks(array $links) |
|
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 | + ]); |
|
20 | + return $links; |
|
21 | + } |
|
22 | 22 | |
23 | - /** |
|
24 | - * @return string |
|
25 | - * @filter admin_title |
|
26 | - */ |
|
27 | - public function filterAdminTitle($title) |
|
28 | - { |
|
29 | - return Application::POST_TYPE.'_page_welcome' == glsr_current_screen()->id |
|
30 | - ? sprintf(__('Welcome to %s — WordPress', 'site-reviews'), glsr()->name) |
|
31 | - : $title; |
|
32 | - } |
|
23 | + /** |
|
24 | + * @return string |
|
25 | + * @filter admin_title |
|
26 | + */ |
|
27 | + public function filterAdminTitle($title) |
|
28 | + { |
|
29 | + return Application::POST_TYPE.'_page_welcome' == glsr_current_screen()->id |
|
30 | + ? sprintf(__('Welcome to %s — WordPress', 'site-reviews'), glsr()->name) |
|
31 | + : $title; |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * @param string $text |
|
36 | - * @return string |
|
37 | - * @filter admin_footer_text |
|
38 | - */ |
|
39 | - public function filterFooterText($text) |
|
40 | - { |
|
41 | - if (Application::POST_TYPE.'_page_welcome' != glsr_current_screen()->id) { |
|
42 | - return $text; |
|
43 | - } |
|
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'), |
|
47 | - '<strong>'.glsr()->name.'</strong> <a href="'.$url.'" target="_blank">★★★★★</a>', |
|
48 | - '<a href="'.$url.'" target="_blank">wordpress.org</a>' |
|
49 | - )); |
|
50 | - } |
|
34 | + /** |
|
35 | + * @param string $text |
|
36 | + * @return string |
|
37 | + * @filter admin_footer_text |
|
38 | + */ |
|
39 | + public function filterFooterText($text) |
|
40 | + { |
|
41 | + if (Application::POST_TYPE.'_page_welcome' != glsr_current_screen()->id) { |
|
42 | + return $text; |
|
43 | + } |
|
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'), |
|
47 | + '<strong>'.glsr()->name.'</strong> <a href="'.$url.'" target="_blank">★★★★★</a>', |
|
48 | + '<a href="'.$url.'" target="_blank">wordpress.org</a>' |
|
49 | + )); |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * @param string $plugin |
|
54 | - * @param bool $isNetworkActivation |
|
55 | - * @return void |
|
56 | - * @action activated_plugin |
|
57 | - */ |
|
58 | - public function redirectOnActivation($plugin, $isNetworkActivation) |
|
59 | - { |
|
60 | - if (!$isNetworkActivation |
|
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')); |
|
64 | - exit; |
|
65 | - } |
|
66 | - } |
|
52 | + /** |
|
53 | + * @param string $plugin |
|
54 | + * @param bool $isNetworkActivation |
|
55 | + * @return void |
|
56 | + * @action activated_plugin |
|
57 | + */ |
|
58 | + public function redirectOnActivation($plugin, $isNetworkActivation) |
|
59 | + { |
|
60 | + if (!$isNetworkActivation |
|
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')); |
|
64 | + exit; |
|
65 | + } |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * @return void |
|
70 | - * @action admin_menu |
|
71 | - */ |
|
72 | - public function registerPage() |
|
73 | - { |
|
74 | - add_submenu_page('edit.php?post_type='.Application::POST_TYPE, |
|
75 | - sprintf(__('Welcome to %s', 'site-reviews'), glsr()->name), |
|
76 | - glsr()->name, |
|
77 | - glsr()->getPermission('welcome'), |
|
78 | - 'welcome', |
|
79 | - [$this, 'renderPage'] |
|
80 | - ); |
|
81 | - remove_submenu_page('edit.php?post_type='.Application::POST_TYPE, 'welcome'); |
|
82 | - } |
|
68 | + /** |
|
69 | + * @return void |
|
70 | + * @action admin_menu |
|
71 | + */ |
|
72 | + public function registerPage() |
|
73 | + { |
|
74 | + add_submenu_page('edit.php?post_type='.Application::POST_TYPE, |
|
75 | + sprintf(__('Welcome to %s', 'site-reviews'), glsr()->name), |
|
76 | + glsr()->name, |
|
77 | + glsr()->getPermission('welcome'), |
|
78 | + 'welcome', |
|
79 | + [$this, 'renderPage'] |
|
80 | + ); |
|
81 | + remove_submenu_page('edit.php?post_type='.Application::POST_TYPE, 'welcome'); |
|
82 | + } |
|
83 | 83 | |
84 | - /** |
|
85 | - * @return void |
|
86 | - * @see $this->registerPage() |
|
87 | - * @callback add_submenu_page |
|
88 | - */ |
|
89 | - public function renderPage() |
|
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 | - ]); |
|
84 | + /** |
|
85 | + * @return void |
|
86 | + * @see $this->registerPage() |
|
87 | + * @callback add_submenu_page |
|
88 | + */ |
|
89 | + public function renderPage() |
|
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 | + ]); |
|
96 | 96 | |
97 | - glsr()->render('pages/welcome/index', [ |
|
98 | - 'data' => [ |
|
99 | - 'context' => [ |
|
100 | - ], |
|
101 | - ], |
|
102 | - 'tabs' => $tabs, |
|
103 | - 'template' => glsr(Template::class), |
|
104 | - ]); |
|
105 | - } |
|
97 | + glsr()->render('pages/welcome/index', [ |
|
98 | + 'data' => [ |
|
99 | + 'context' => [ |
|
100 | + ], |
|
101 | + ], |
|
102 | + 'tabs' => $tabs, |
|
103 | + 'template' => glsr(Template::class), |
|
104 | + ]); |
|
105 | + } |
|
106 | 106 | } |
@@ -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 | } |
@@ -7,284 +7,284 @@ |
||
7 | 7 | |
8 | 8 | final class Application extends Container |
9 | 9 | { |
10 | - const CAPABILITY = 'edit_others_posts'; |
|
11 | - const CRON_EVENT = 'site-reviews/schedule/session/purge'; |
|
12 | - const ID = 'site-reviews'; |
|
13 | - const PAGED_QUERY_VAR = 'reviews-page'; |
|
14 | - const POST_TYPE = 'site-review'; |
|
15 | - const PREFIX = 'glsr_'; |
|
16 | - const TAXONOMY = 'site-review-category'; |
|
10 | + const CAPABILITY = 'edit_others_posts'; |
|
11 | + const CRON_EVENT = 'site-reviews/schedule/session/purge'; |
|
12 | + const ID = 'site-reviews'; |
|
13 | + const PAGED_QUERY_VAR = 'reviews-page'; |
|
14 | + const POST_TYPE = 'site-review'; |
|
15 | + const PREFIX = 'glsr_'; |
|
16 | + const TAXONOMY = 'site-review-category'; |
|
17 | 17 | |
18 | - public $defaults; |
|
19 | - public $deprecated = []; |
|
20 | - public $file; |
|
21 | - public $languages; |
|
22 | - public $mceShortcodes = []; //defined elsewhere |
|
23 | - public $name; |
|
24 | - public $reviewTypes; |
|
25 | - public $schemas = []; //defined elsewhere |
|
26 | - public $version; |
|
18 | + public $defaults; |
|
19 | + public $deprecated = []; |
|
20 | + public $file; |
|
21 | + public $languages; |
|
22 | + public $mceShortcodes = []; //defined elsewhere |
|
23 | + public $name; |
|
24 | + public $reviewTypes; |
|
25 | + public $schemas = []; //defined elsewhere |
|
26 | + public $version; |
|
27 | 27 | |
28 | - public function __construct() |
|
29 | - { |
|
30 | - static::$instance = $this; |
|
31 | - $this->file = realpath(trailingslashit(dirname(__DIR__)).static::ID.'.php'); |
|
32 | - $plugin = get_file_data($this->file, [ |
|
33 | - 'languages' => 'Domain Path', |
|
34 | - 'name' => 'Plugin Name', |
|
35 | - 'version' => 'Version', |
|
36 | - ], 'plugin'); |
|
37 | - array_walk($plugin, function ($value, $key) { |
|
38 | - $this->$key = $value; |
|
39 | - }); |
|
40 | - } |
|
28 | + public function __construct() |
|
29 | + { |
|
30 | + static::$instance = $this; |
|
31 | + $this->file = realpath(trailingslashit(dirname(__DIR__)).static::ID.'.php'); |
|
32 | + $plugin = get_file_data($this->file, [ |
|
33 | + 'languages' => 'Domain Path', |
|
34 | + 'name' => 'Plugin Name', |
|
35 | + 'version' => 'Version', |
|
36 | + ], 'plugin'); |
|
37 | + array_walk($plugin, function ($value, $key) { |
|
38 | + $this->$key = $value; |
|
39 | + }); |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * @return void |
|
44 | - */ |
|
45 | - public function activate() |
|
46 | - { |
|
47 | - $this->make(DefaultsManager::class)->set(); |
|
48 | - $this->scheduleCronJob(); |
|
49 | - $this->upgrade(); |
|
50 | - } |
|
42 | + /** |
|
43 | + * @return void |
|
44 | + */ |
|
45 | + public function activate() |
|
46 | + { |
|
47 | + $this->make(DefaultsManager::class)->set(); |
|
48 | + $this->scheduleCronJob(); |
|
49 | + $this->upgrade(); |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * @return void |
|
54 | - */ |
|
55 | - public function catchFatalError() |
|
56 | - { |
|
57 | - $error = error_get_last(); |
|
58 | - if (E_ERROR !== $error['type'] || false === strpos($error['message'], $this->path())) { |
|
59 | - return; |
|
60 | - } |
|
61 | - glsr_log()->error($error['message']); |
|
62 | - } |
|
52 | + /** |
|
53 | + * @return void |
|
54 | + */ |
|
55 | + public function catchFatalError() |
|
56 | + { |
|
57 | + $error = error_get_last(); |
|
58 | + if (E_ERROR !== $error['type'] || false === strpos($error['message'], $this->path())) { |
|
59 | + return; |
|
60 | + } |
|
61 | + glsr_log()->error($error['message']); |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * @param string $name |
|
66 | - * @return array |
|
67 | - */ |
|
68 | - public function config($name) |
|
69 | - { |
|
70 | - $configFile = $this->path('config/'.$name.'.php'); |
|
71 | - $config = file_exists($configFile) |
|
72 | - ? include $configFile |
|
73 | - : []; |
|
74 | - return apply_filters('site-reviews/config/'.$name, $config); |
|
75 | - } |
|
64 | + /** |
|
65 | + * @param string $name |
|
66 | + * @return array |
|
67 | + */ |
|
68 | + public function config($name) |
|
69 | + { |
|
70 | + $configFile = $this->path('config/'.$name.'.php'); |
|
71 | + $config = file_exists($configFile) |
|
72 | + ? include $configFile |
|
73 | + : []; |
|
74 | + return apply_filters('site-reviews/config/'.$name, $config); |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * @param string $property |
|
79 | - * @return string |
|
80 | - */ |
|
81 | - public function constant($property, $className = 'static') |
|
82 | - { |
|
83 | - $constant = $className.'::'.$property; |
|
84 | - return defined($constant) |
|
85 | - ? apply_filters('site-reviews/const/'.$property, constant($constant)) |
|
86 | - : ''; |
|
87 | - } |
|
77 | + /** |
|
78 | + * @param string $property |
|
79 | + * @return string |
|
80 | + */ |
|
81 | + public function constant($property, $className = 'static') |
|
82 | + { |
|
83 | + $constant = $className.'::'.$property; |
|
84 | + return defined($constant) |
|
85 | + ? apply_filters('site-reviews/const/'.$property, constant($constant)) |
|
86 | + : ''; |
|
87 | + } |
|
88 | 88 | |
89 | - /** |
|
90 | - * @return void |
|
91 | - */ |
|
92 | - public function deactivate() |
|
93 | - { |
|
94 | - $this->unscheduleCronJob(); |
|
95 | - } |
|
89 | + /** |
|
90 | + * @return void |
|
91 | + */ |
|
92 | + public function deactivate() |
|
93 | + { |
|
94 | + $this->unscheduleCronJob(); |
|
95 | + } |
|
96 | 96 | |
97 | - /** |
|
98 | - * @param string $view |
|
99 | - * @return void|string |
|
100 | - */ |
|
101 | - public function file($view) |
|
102 | - { |
|
103 | - $view.= '.php'; |
|
104 | - $filePaths = []; |
|
105 | - if (glsr(Helper::class)->startsWith('templates/', $view)) { |
|
106 | - $filePaths[] = $this->themePath(glsr(Helper::class)->removePrefix('templates/', $view)); |
|
107 | - } |
|
108 | - $filePaths[] = $this->path($view); |
|
109 | - $filePaths[] = $this->path('views/'.$view); |
|
110 | - foreach ($filePaths as $file) { |
|
111 | - if (!file_exists($file)) { |
|
112 | - continue; |
|
113 | - } |
|
114 | - return $file; |
|
115 | - } |
|
116 | - } |
|
97 | + /** |
|
98 | + * @param string $view |
|
99 | + * @return void|string |
|
100 | + */ |
|
101 | + public function file($view) |
|
102 | + { |
|
103 | + $view.= '.php'; |
|
104 | + $filePaths = []; |
|
105 | + if (glsr(Helper::class)->startsWith('templates/', $view)) { |
|
106 | + $filePaths[] = $this->themePath(glsr(Helper::class)->removePrefix('templates/', $view)); |
|
107 | + } |
|
108 | + $filePaths[] = $this->path($view); |
|
109 | + $filePaths[] = $this->path('views/'.$view); |
|
110 | + foreach ($filePaths as $file) { |
|
111 | + if (!file_exists($file)) { |
|
112 | + continue; |
|
113 | + } |
|
114 | + return $file; |
|
115 | + } |
|
116 | + } |
|
117 | 117 | |
118 | - /** |
|
119 | - * @return array |
|
120 | - */ |
|
121 | - public function getDefaults() |
|
122 | - { |
|
123 | - if (empty($this->defaults)) { |
|
124 | - $this->defaults = $this->make(DefaultsManager::class)->get(); |
|
125 | - $this->upgrade(); |
|
126 | - } |
|
127 | - return apply_filters('site-reviews/get/defaults', $this->defaults); |
|
128 | - } |
|
118 | + /** |
|
119 | + * @return array |
|
120 | + */ |
|
121 | + public function getDefaults() |
|
122 | + { |
|
123 | + if (empty($this->defaults)) { |
|
124 | + $this->defaults = $this->make(DefaultsManager::class)->get(); |
|
125 | + $this->upgrade(); |
|
126 | + } |
|
127 | + return apply_filters('site-reviews/get/defaults', $this->defaults); |
|
128 | + } |
|
129 | 129 | |
130 | - /** |
|
131 | - * @return bool |
|
132 | - */ |
|
133 | - public function getPermission($page = '') |
|
134 | - { |
|
135 | - $permissions = [ |
|
136 | - 'addons' => 'install_plugins', |
|
137 | - 'settings' => 'manage_options', |
|
138 | - // 'welcome' => 'activate_plugins', |
|
139 | - ]; |
|
140 | - return glsr_get($permissions, $page, $this->constant('CAPABILITY')); |
|
141 | - } |
|
130 | + /** |
|
131 | + * @return bool |
|
132 | + */ |
|
133 | + public function getPermission($page = '') |
|
134 | + { |
|
135 | + $permissions = [ |
|
136 | + 'addons' => 'install_plugins', |
|
137 | + 'settings' => 'manage_options', |
|
138 | + // 'welcome' => 'activate_plugins', |
|
139 | + ]; |
|
140 | + return glsr_get($permissions, $page, $this->constant('CAPABILITY')); |
|
141 | + } |
|
142 | 142 | |
143 | - /** |
|
144 | - * @return bool |
|
145 | - */ |
|
146 | - public function hasPermission($page = '') |
|
147 | - { |
|
148 | - $isAdmin = $this->isAdmin(); |
|
149 | - return !$isAdmin || ($isAdmin && current_user_can($this->getPermission($page))); |
|
150 | - } |
|
143 | + /** |
|
144 | + * @return bool |
|
145 | + */ |
|
146 | + public function hasPermission($page = '') |
|
147 | + { |
|
148 | + $isAdmin = $this->isAdmin(); |
|
149 | + return !$isAdmin || ($isAdmin && current_user_can($this->getPermission($page))); |
|
150 | + } |
|
151 | 151 | |
152 | - /** |
|
153 | - * @return void |
|
154 | - */ |
|
155 | - public function init() |
|
156 | - { |
|
157 | - $this->make(Actions::class)->run(); |
|
158 | - $this->make(Filters::class)->run(); |
|
159 | - } |
|
152 | + /** |
|
153 | + * @return void |
|
154 | + */ |
|
155 | + public function init() |
|
156 | + { |
|
157 | + $this->make(Actions::class)->run(); |
|
158 | + $this->make(Filters::class)->run(); |
|
159 | + } |
|
160 | 160 | |
161 | - /** |
|
162 | - * @return bool |
|
163 | - */ |
|
164 | - public function isAdmin() |
|
165 | - { |
|
166 | - return is_admin() && !wp_doing_ajax(); |
|
167 | - } |
|
161 | + /** |
|
162 | + * @return bool |
|
163 | + */ |
|
164 | + public function isAdmin() |
|
165 | + { |
|
166 | + return is_admin() && !wp_doing_ajax(); |
|
167 | + } |
|
168 | 168 | |
169 | - /** |
|
170 | - * @param string $file |
|
171 | - * @return string |
|
172 | - */ |
|
173 | - public function path($file = '', $realpath = true) |
|
174 | - { |
|
175 | - $path = plugin_dir_path($this->file); |
|
176 | - if (!$realpath) { |
|
177 | - $path = trailingslashit(WP_PLUGIN_DIR).basename(dirname($this->file)); |
|
178 | - } |
|
179 | - $path = trailingslashit($path).ltrim(trim($file), '/'); |
|
180 | - return apply_filters('site-reviews/path', $path, $file); |
|
181 | - } |
|
169 | + /** |
|
170 | + * @param string $file |
|
171 | + * @return string |
|
172 | + */ |
|
173 | + public function path($file = '', $realpath = true) |
|
174 | + { |
|
175 | + $path = plugin_dir_path($this->file); |
|
176 | + if (!$realpath) { |
|
177 | + $path = trailingslashit(WP_PLUGIN_DIR).basename(dirname($this->file)); |
|
178 | + } |
|
179 | + $path = trailingslashit($path).ltrim(trim($file), '/'); |
|
180 | + return apply_filters('site-reviews/path', $path, $file); |
|
181 | + } |
|
182 | 182 | |
183 | - /** |
|
184 | - * @return void |
|
185 | - */ |
|
186 | - public function registerAddons() |
|
187 | - { |
|
188 | - do_action('site-reviews/addon/register', $this); |
|
189 | - } |
|
183 | + /** |
|
184 | + * @return void |
|
185 | + */ |
|
186 | + public function registerAddons() |
|
187 | + { |
|
188 | + do_action('site-reviews/addon/register', $this); |
|
189 | + } |
|
190 | 190 | |
191 | - /** |
|
192 | - * @return void |
|
193 | - */ |
|
194 | - public function registerLanguages() |
|
195 | - { |
|
196 | - load_plugin_textdomain(static::ID, false, |
|
197 | - trailingslashit(plugin_basename($this->path()).'/'.$this->languages) |
|
198 | - ); |
|
199 | - } |
|
191 | + /** |
|
192 | + * @return void |
|
193 | + */ |
|
194 | + public function registerLanguages() |
|
195 | + { |
|
196 | + load_plugin_textdomain(static::ID, false, |
|
197 | + trailingslashit(plugin_basename($this->path()).'/'.$this->languages) |
|
198 | + ); |
|
199 | + } |
|
200 | 200 | |
201 | - /** |
|
202 | - * @return void |
|
203 | - */ |
|
204 | - public function registerReviewTypes() |
|
205 | - { |
|
206 | - $types = apply_filters('site-reviews/addon/types', []); |
|
207 | - $this->reviewTypes = wp_parse_args($types, [ |
|
208 | - 'local' => __('Local', 'site-reviews'), |
|
209 | - ]); |
|
210 | - } |
|
201 | + /** |
|
202 | + * @return void |
|
203 | + */ |
|
204 | + public function registerReviewTypes() |
|
205 | + { |
|
206 | + $types = apply_filters('site-reviews/addon/types', []); |
|
207 | + $this->reviewTypes = wp_parse_args($types, [ |
|
208 | + 'local' => __('Local', 'site-reviews'), |
|
209 | + ]); |
|
210 | + } |
|
211 | 211 | |
212 | - /** |
|
213 | - * @param string $view |
|
214 | - * @return void |
|
215 | - */ |
|
216 | - public function render($view, array $data = []) |
|
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); |
|
222 | - return; |
|
223 | - } |
|
224 | - $data = apply_filters('site-reviews/views/data', $data, $view); |
|
225 | - extract($data); |
|
226 | - include $file; |
|
227 | - } |
|
212 | + /** |
|
213 | + * @param string $view |
|
214 | + * @return void |
|
215 | + */ |
|
216 | + public function render($view, array $data = []) |
|
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); |
|
222 | + return; |
|
223 | + } |
|
224 | + $data = apply_filters('site-reviews/views/data', $data, $view); |
|
225 | + extract($data); |
|
226 | + include $file; |
|
227 | + } |
|
228 | 228 | |
229 | - /** |
|
230 | - * @return void |
|
231 | - */ |
|
232 | - public function scheduleCronJob() |
|
233 | - { |
|
234 | - if (wp_next_scheduled(static::CRON_EVENT)) { |
|
235 | - return; |
|
236 | - } |
|
237 | - wp_schedule_event(time(), 'twicedaily', static::CRON_EVENT); |
|
238 | - } |
|
229 | + /** |
|
230 | + * @return void |
|
231 | + */ |
|
232 | + public function scheduleCronJob() |
|
233 | + { |
|
234 | + if (wp_next_scheduled(static::CRON_EVENT)) { |
|
235 | + return; |
|
236 | + } |
|
237 | + wp_schedule_event(time(), 'twicedaily', static::CRON_EVENT); |
|
238 | + } |
|
239 | 239 | |
240 | - /** |
|
241 | - * @param string $file |
|
242 | - * @return string |
|
243 | - */ |
|
244 | - public function themePath($file = '') |
|
245 | - { |
|
246 | - return get_stylesheet_directory().'/'.static::ID.'/'.ltrim(trim($file), '/'); |
|
247 | - } |
|
240 | + /** |
|
241 | + * @param string $file |
|
242 | + * @return string |
|
243 | + */ |
|
244 | + public function themePath($file = '') |
|
245 | + { |
|
246 | + return get_stylesheet_directory().'/'.static::ID.'/'.ltrim(trim($file), '/'); |
|
247 | + } |
|
248 | 248 | |
249 | - /** |
|
250 | - * @return void |
|
251 | - */ |
|
252 | - public function unscheduleCronJob() |
|
253 | - { |
|
254 | - wp_unschedule_event(intval(wp_next_scheduled(static::CRON_EVENT)), static::CRON_EVENT); |
|
255 | - } |
|
249 | + /** |
|
250 | + * @return void |
|
251 | + */ |
|
252 | + public function unscheduleCronJob() |
|
253 | + { |
|
254 | + wp_unschedule_event(intval(wp_next_scheduled(static::CRON_EVENT)), static::CRON_EVENT); |
|
255 | + } |
|
256 | 256 | |
257 | - /** |
|
258 | - * @return void |
|
259 | - */ |
|
260 | - public function upgrade() |
|
261 | - { |
|
262 | - $this->make(Upgrader::class)->run(); |
|
263 | - } |
|
257 | + /** |
|
258 | + * @return void |
|
259 | + */ |
|
260 | + public function upgrade() |
|
261 | + { |
|
262 | + $this->make(Upgrader::class)->run(); |
|
263 | + } |
|
264 | 264 | |
265 | - /** |
|
266 | - * @param mixed $upgrader |
|
267 | - * @return void |
|
268 | - * @action upgrader_process_complete |
|
269 | - */ |
|
270 | - public function upgraded($upgrader, array $data) |
|
271 | - { |
|
272 | - if (array_key_exists('plugins', $data) |
|
273 | - && in_array(plugin_basename($this->file), $data['plugins']) |
|
274 | - && 'update' === $data['action'] |
|
275 | - && 'plugin' === $data['type'] |
|
276 | - ) { |
|
277 | - $this->upgrade(); |
|
278 | - } |
|
279 | - } |
|
265 | + /** |
|
266 | + * @param mixed $upgrader |
|
267 | + * @return void |
|
268 | + * @action upgrader_process_complete |
|
269 | + */ |
|
270 | + public function upgraded($upgrader, array $data) |
|
271 | + { |
|
272 | + if (array_key_exists('plugins', $data) |
|
273 | + && in_array(plugin_basename($this->file), $data['plugins']) |
|
274 | + && 'update' === $data['action'] |
|
275 | + && 'plugin' === $data['type'] |
|
276 | + ) { |
|
277 | + $this->upgrade(); |
|
278 | + } |
|
279 | + } |
|
280 | 280 | |
281 | - /** |
|
282 | - * @param string $path |
|
283 | - * @return string |
|
284 | - */ |
|
285 | - public function url($path = '') |
|
286 | - { |
|
287 | - $url = esc_url(plugin_dir_url($this->file).ltrim(trim($path), '/')); |
|
288 | - return apply_filters('site-reviews/url', $url, $path); |
|
289 | - } |
|
281 | + /** |
|
282 | + * @param string $path |
|
283 | + * @return string |
|
284 | + */ |
|
285 | + public function url($path = '') |
|
286 | + { |
|
287 | + $url = esc_url(plugin_dir_url($this->file).ltrim(trim($path), '/')); |
|
288 | + return apply_filters('site-reviews/url', $url, $path); |
|
289 | + } |
|
290 | 290 | } |
@@ -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 | } |