@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
2 | +if ( ! defined('ABSPATH')) exit; |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Main plugin object to define the plugin |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @author Nirjhar Lo |
9 | 9 | * @package wp-plugin-framework |
10 | 10 | */ |
11 | -if ( ! class_exists( 'PLUGIN_BUILD' ) ) { |
|
11 | +if ( ! class_exists('PLUGIN_BUILD')) { |
|
12 | 12 | |
13 | 13 | final class PLUGIN_BUILD { |
14 | 14 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public static function instance() { |
71 | 71 | |
72 | - if ( is_null( self::$_instance ) ) { |
|
72 | + if (is_null(self::$_instance)) { |
|
73 | 73 | self::$_instance = new self(); |
74 | 74 | self::$_instance->init(); |
75 | 75 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | } |
96 | 96 | |
97 | 97 | //If CPT exists, include taht and flush the rewrite rules |
98 | - if ( class_exists( 'PLUGIN_CPT' ) ) new PLUGIN_CPT(); |
|
98 | + if (class_exists('PLUGIN_CPT')) new PLUGIN_CPT(); |
|
99 | 99 | flush_rewrite_rules(); |
100 | 100 | } |
101 | 101 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function cron_activation() { |
109 | 109 | |
110 | - if ( class_exists( 'PLUGIN_CRON' ) ) { |
|
110 | + if (class_exists('PLUGIN_CRON')) { |
|
111 | 111 | |
112 | 112 | $cron = new PLUGIN_CRON(); |
113 | 113 | $schedule = $cron->schedule_task( |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function db_install() { |
132 | 132 | |
133 | - if ( class_exists( 'PLUGIN_DB' ) ) { |
|
133 | + if (class_exists('PLUGIN_DB')) { |
|
134 | 134 | |
135 | 135 | $db = new PLUGIN_DB(); |
136 | 136 | $db->table = self::$plugin_table; |
@@ -140,15 +140,15 @@ discard block |
||
140 | 140 | $db->build(); |
141 | 141 | } |
142 | 142 | |
143 | - if (get_option( '_plugin_db_exist') == '0' ) { |
|
144 | - add_action( 'admin_notices', array( $this, 'db_error_msg' ) ); |
|
143 | + if (get_option('_plugin_db_exist') == '0') { |
|
144 | + add_action('admin_notices', array($this, 'db_error_msg')); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | $options = array( |
148 | - array( 'option_name', '__value__' ), |
|
148 | + array('option_name', '__value__'), |
|
149 | 149 | ); |
150 | - foreach ( $options as $value ) { |
|
151 | - update_option( $value[0], $value[1] ); |
|
150 | + foreach ($options as $value) { |
|
151 | + update_option($value[0], $value[1]); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | public function db_error_msg() { ?> |
162 | 162 | |
163 | 163 | <div class="notice notice-error is-dismissible"> |
164 | - <p><?php _e( 'Database table Not installed correctly.', 'textdomain' ); ?></p> |
|
164 | + <p><?php _e('Database table Not installed correctly.', 'textdomain'); ?></p> |
|
165 | 165 | </div> |
166 | 166 | <?php |
167 | 167 | } |
@@ -177,13 +177,13 @@ discard block |
||
177 | 177 | $table_name = self::$plugin_table; |
178 | 178 | |
179 | 179 | global $wpdb; |
180 | - $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}$table_name" ); |
|
180 | + $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}$table_name"); |
|
181 | 181 | |
182 | 182 | $options = array( |
183 | 183 | '_plugin_db_exist' |
184 | 184 | ); |
185 | - foreach ( $options as $value ) { |
|
186 | - delete_option( $value ); |
|
185 | + foreach ($options as $value) { |
|
186 | + delete_option($value); |
|
187 | 187 | } |
188 | 188 | } |
189 | 189 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | */ |
207 | 207 | public function custom_cron_hook_cb() { |
208 | 208 | |
209 | - add_action( 'custom_cron_hook', array( $this, 'do_cron_job_function' ) ); |
|
209 | + add_action('custom_cron_hook', array($this, 'do_cron_job_function')); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | */ |
218 | 218 | public function cron_uninstall() { |
219 | 219 | |
220 | - wp_clear_scheduled_hook( 'custom_cron_hook' ); |
|
220 | + wp_clear_scheduled_hook('custom_cron_hook'); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | */ |
229 | 229 | public function cpt() { |
230 | 230 | |
231 | - if ( class_exists( 'PLUGIN_CPT' ) ) new PLUGIN_CPT(); |
|
231 | + if (class_exists('PLUGIN_CPT')) new PLUGIN_CPT(); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | */ |
240 | 240 | public function scripts() { |
241 | 241 | |
242 | - if ( class_exists( 'PLUGIN_SCRIPT' ) ) new PLUGIN_SCRIPT(); |
|
242 | + if (class_exists('PLUGIN_SCRIPT')) new PLUGIN_SCRIPT(); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | */ |
251 | 251 | public function settings() { |
252 | 252 | |
253 | - if ( class_exists( 'PLUGIN_SETTINGS' ) ) new PLUGIN_SETTINGS(); |
|
253 | + if (class_exists('PLUGIN_SETTINGS')) new PLUGIN_SETTINGS(); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | */ |
262 | 262 | public function widgets() { |
263 | 263 | |
264 | - if ( class_exists( 'PLUGIN_WIDGET' ) ) new PLUGIN_WIDGET(); |
|
264 | + if (class_exists('PLUGIN_WIDGET')) new PLUGIN_WIDGET(); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | */ |
273 | 273 | public function metabox() { |
274 | 274 | |
275 | - if ( class_exists( 'PLUGIN_METABOX' ) ) new PLUGIN_METABOX(); |
|
275 | + if (class_exists('PLUGIN_METABOX')) new PLUGIN_METABOX(); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | */ |
284 | 284 | public function shortcode() { |
285 | 285 | |
286 | - if ( class_exists( 'PLUGIN_SHORTCODE' ) ) new PLUGIN_SHORTCODE(); |
|
286 | + if (class_exists('PLUGIN_SHORTCODE')) new PLUGIN_SHORTCODE(); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | */ |
295 | 295 | public function rest_api() { |
296 | 296 | |
297 | - if ( class_exists( 'PLUGIN_CUSTOM_ROUTE' ) ) new PLUGIN_CUSTOM_ROUTE(); |
|
297 | + if (class_exists('PLUGIN_CUSTOM_ROUTE')) new PLUGIN_CUSTOM_ROUTE(); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | |
@@ -306,15 +306,15 @@ discard block |
||
306 | 306 | */ |
307 | 307 | public function functionality() { |
308 | 308 | |
309 | - require_once( 'src/class-install.php' ); |
|
310 | - require_once( 'src/class-db.php' ); |
|
311 | - require_once( 'src/class-query.php' ); |
|
312 | - require_once( 'src/class-settings.php' ); |
|
313 | - require_once( 'src/class-widget.php' ); |
|
314 | - require_once( 'src/class-metabox.php' ); |
|
315 | - require_once( 'src/class-shortcode.php' ); |
|
316 | - require_once( 'src/class-cpt.php' ); |
|
317 | - require_once( 'src/class-rest.php' ); |
|
309 | + require_once('src/class-install.php'); |
|
310 | + require_once('src/class-db.php'); |
|
311 | + require_once('src/class-query.php'); |
|
312 | + require_once('src/class-settings.php'); |
|
313 | + require_once('src/class-widget.php'); |
|
314 | + require_once('src/class-metabox.php'); |
|
315 | + require_once('src/class-shortcode.php'); |
|
316 | + require_once('src/class-cpt.php'); |
|
317 | + require_once('src/class-rest.php'); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | |
@@ -326,12 +326,12 @@ discard block |
||
326 | 326 | */ |
327 | 327 | public function helpers() { |
328 | 328 | |
329 | - require_once( 'lib/class-cron.php' ); |
|
330 | - require_once( 'lib/class-api.php' ); |
|
331 | - require_once( 'lib/class-table.php' ); |
|
332 | - require_once( 'lib/class-ajax.php' ); |
|
333 | - require_once( 'lib/class-upload.php' ); |
|
334 | - require_once( 'lib/class-script.php' ); |
|
329 | + require_once('lib/class-cron.php'); |
|
330 | + require_once('lib/class-api.php'); |
|
331 | + require_once('lib/class-table.php'); |
|
332 | + require_once('lib/class-ajax.php'); |
|
333 | + require_once('lib/class-upload.php'); |
|
334 | + require_once('lib/class-script.php'); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | |
@@ -345,17 +345,17 @@ discard block |
||
345 | 345 | $this->helpers(); |
346 | 346 | $this->functionality(); |
347 | 347 | |
348 | - register_activation_hook( PLUGIN_FILE, array( $this, 'db_install' ) ); |
|
349 | - register_activation_hook( PLUGIN_FILE, array( $this, 'cron_activation' ) ); |
|
348 | + register_activation_hook(PLUGIN_FILE, array($this, 'db_install')); |
|
349 | + register_activation_hook(PLUGIN_FILE, array($this, 'cron_activation')); |
|
350 | 350 | |
351 | 351 | //remove the DB and CORN upon uninstallation |
352 | 352 | //using $this won't work here. |
353 | - register_uninstall_hook( PLUGIN_FILE, array( 'PLUGIN_BUILD', 'db_uninstall' ) ); |
|
354 | - register_uninstall_hook( PLUGIN_FILE, array( 'PLUGIN_BUILD', 'cron_uninstall' ) ); |
|
353 | + register_uninstall_hook(PLUGIN_FILE, array('PLUGIN_BUILD', 'db_uninstall')); |
|
354 | + register_uninstall_hook(PLUGIN_FILE, array('PLUGIN_BUILD', 'cron_uninstall')); |
|
355 | 355 | |
356 | - add_action( 'init', array( $this, 'installation' ) ); |
|
357 | - add_action( 'init', array( $this, 'custom_cron_hook_cb' ) ); |
|
358 | - add_action( 'init', array( $this, 'cpt' ) ); |
|
356 | + add_action('init', array($this, 'installation')); |
|
357 | + add_action('init', array($this, 'custom_cron_hook_cb')); |
|
358 | + add_action('init', array($this, 'cpt')); |
|
359 | 359 | |
360 | 360 | $this->scripts(); |
361 | 361 | $this->widgets(); |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
3 | + exit; |
|
4 | +} |
|
3 | 5 | |
4 | 6 | /** |
5 | 7 | * Main plugin object to define the plugin |
@@ -95,7 +97,9 @@ discard block |
||
95 | 97 | } |
96 | 98 | |
97 | 99 | //If CPT exists, include taht and flush the rewrite rules |
98 | - if ( class_exists( 'PLUGIN_CPT' ) ) new PLUGIN_CPT(); |
|
100 | + if ( class_exists( 'PLUGIN_CPT' ) ) { |
|
101 | + new PLUGIN_CPT(); |
|
102 | + } |
|
99 | 103 | flush_rewrite_rules(); |
100 | 104 | } |
101 | 105 | |
@@ -228,7 +232,9 @@ discard block |
||
228 | 232 | */ |
229 | 233 | public function cpt() { |
230 | 234 | |
231 | - if ( class_exists( 'PLUGIN_CPT' ) ) new PLUGIN_CPT(); |
|
235 | + if ( class_exists( 'PLUGIN_CPT' ) ) { |
|
236 | + new PLUGIN_CPT(); |
|
237 | + } |
|
232 | 238 | } |
233 | 239 | |
234 | 240 | |
@@ -239,7 +245,9 @@ discard block |
||
239 | 245 | */ |
240 | 246 | public function scripts() { |
241 | 247 | |
242 | - if ( class_exists( 'PLUGIN_SCRIPT' ) ) new PLUGIN_SCRIPT(); |
|
248 | + if ( class_exists( 'PLUGIN_SCRIPT' ) ) { |
|
249 | + new PLUGIN_SCRIPT(); |
|
250 | + } |
|
243 | 251 | } |
244 | 252 | |
245 | 253 | |
@@ -250,7 +258,9 @@ discard block |
||
250 | 258 | */ |
251 | 259 | public function settings() { |
252 | 260 | |
253 | - if ( class_exists( 'PLUGIN_SETTINGS' ) ) new PLUGIN_SETTINGS(); |
|
261 | + if ( class_exists( 'PLUGIN_SETTINGS' ) ) { |
|
262 | + new PLUGIN_SETTINGS(); |
|
263 | + } |
|
254 | 264 | } |
255 | 265 | |
256 | 266 | |
@@ -261,7 +271,9 @@ discard block |
||
261 | 271 | */ |
262 | 272 | public function widgets() { |
263 | 273 | |
264 | - if ( class_exists( 'PLUGIN_WIDGET' ) ) new PLUGIN_WIDGET(); |
|
274 | + if ( class_exists( 'PLUGIN_WIDGET' ) ) { |
|
275 | + new PLUGIN_WIDGET(); |
|
276 | + } |
|
265 | 277 | } |
266 | 278 | |
267 | 279 | |
@@ -272,7 +284,9 @@ discard block |
||
272 | 284 | */ |
273 | 285 | public function metabox() { |
274 | 286 | |
275 | - if ( class_exists( 'PLUGIN_METABOX' ) ) new PLUGIN_METABOX(); |
|
287 | + if ( class_exists( 'PLUGIN_METABOX' ) ) { |
|
288 | + new PLUGIN_METABOX(); |
|
289 | + } |
|
276 | 290 | } |
277 | 291 | |
278 | 292 | |
@@ -283,7 +297,9 @@ discard block |
||
283 | 297 | */ |
284 | 298 | public function shortcode() { |
285 | 299 | |
286 | - if ( class_exists( 'PLUGIN_SHORTCODE' ) ) new PLUGIN_SHORTCODE(); |
|
300 | + if ( class_exists( 'PLUGIN_SHORTCODE' ) ) { |
|
301 | + new PLUGIN_SHORTCODE(); |
|
302 | + } |
|
287 | 303 | } |
288 | 304 | |
289 | 305 | |
@@ -294,7 +310,9 @@ discard block |
||
294 | 310 | */ |
295 | 311 | public function rest_api() { |
296 | 312 | |
297 | - if ( class_exists( 'PLUGIN_CUSTOM_ROUTE' ) ) new PLUGIN_CUSTOM_ROUTE(); |
|
313 | + if ( class_exists( 'PLUGIN_CUSTOM_ROUTE' ) ) { |
|
314 | + new PLUGIN_CUSTOM_ROUTE(); |
|
315 | + } |
|
298 | 316 | } |
299 | 317 | |
300 | 318 |
@@ -21,16 +21,16 @@ discard block |
||
21 | 21 | public function register_routes() { |
22 | 22 | |
23 | 23 | $version = '1'; |
24 | - $namespace = 'vendor/v' . $version; |
|
25 | - $base = 'route'; |
|
24 | + $namespace = 'vendor/v' . $version; |
|
25 | + $base = 'route'; |
|
26 | 26 | |
27 | 27 | //Available options for methods are CREATABLE, READABLE, EDITABLE, DELETABLE |
28 | 28 | register_rest_route( $namespace, '/' . $base, array( |
29 | - 'methods' => WP_REST_Server::READABLE, |
|
30 | - 'callback' => array( $this, 'callback' ), |
|
31 | - 'permission_callback' => array( $this, 'permission' ), |
|
32 | - 'args' => array('sample', 'list', 'of', 'args'), |
|
33 | - ), |
|
29 | + 'methods' => WP_REST_Server::READABLE, |
|
30 | + 'callback' => array( $this, 'callback' ), |
|
31 | + 'permission_callback' => array( $this, 'permission' ), |
|
32 | + 'args' => array('sample', 'list', 'of', 'args'), |
|
33 | + ), |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
@@ -41,13 +41,13 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function callback() { |
43 | 43 | |
44 | - $params = $request->get_params(); |
|
45 | - $items = array(); |
|
46 | - $data = $this->prepare_item_for_response( $items, $request ); |
|
44 | + $params = $request->get_params(); |
|
45 | + $items = array(); |
|
46 | + $data = $this->prepare_item_for_response( $items, $request ); |
|
47 | 47 | |
48 | - if ( $data ) { |
|
49 | - return new WP_REST_Response( $data, 200 ); |
|
50 | - } else { |
|
48 | + if ( $data ) { |
|
49 | + return new WP_REST_Response( $data, 200 ); |
|
50 | + } else { |
|
51 | 51 | return new WP_Error( 'status_code', __( 'message', 'text-domain' ) ); |
52 | 52 | } |
53 | 53 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -<?php |
|
3 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
2 | +< ?php |
|
3 | +if ( ! defined('ABSPATH')) exit; |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Extending REST API framework of WordPress |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @author Nirjhar Lo |
9 | 9 | * @package wp-plugin-framework |
10 | 10 | */ |
11 | -if ( ! class_exists( 'PLUGIN_CUSTOM_ROUTE' ) ) { |
|
11 | +if ( ! class_exists('PLUGIN_CUSTOM_ROUTE')) { |
|
12 | 12 | |
13 | 13 | class PLUGIN_CUSTOM_ROUTE extends WP_REST_Controller { |
14 | 14 | |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | $base = 'route'; |
26 | 26 | |
27 | 27 | //Available options for methods are CREATABLE, READABLE, EDITABLE, DELETABLE |
28 | - register_rest_route( $namespace, '/' . $base, array( |
|
28 | + register_rest_route($namespace, '/' . $base, array( |
|
29 | 29 | 'methods' => WP_REST_Server::READABLE, |
30 | - 'callback' => array( $this, 'callback' ), |
|
31 | - 'permission_callback' => array( $this, 'permission' ), |
|
30 | + 'callback' => array($this, 'callback'), |
|
31 | + 'permission_callback' => array($this, 'permission'), |
|
32 | 32 | 'args' => array('sample', 'list', 'of', 'args'), |
33 | 33 | ), |
34 | 34 | } |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | |
44 | 44 | $params = $request->get_params(); |
45 | 45 | $items = array(); |
46 | - $data = $this->prepare_item_for_response( $items, $request ); |
|
46 | + $data = $this->prepare_item_for_response($items, $request); |
|
47 | 47 | |
48 | - if ( $data ) { |
|
49 | - return new WP_REST_Response( $data, 200 ); |
|
48 | + if ($data) { |
|
49 | + return new WP_REST_Response($data, 200); |
|
50 | 50 | } else { |
51 | - return new WP_Error( 'status_code', __( 'message', 'text-domain' ) ); |
|
51 | + return new WP_Error('status_code', __('message', 'text-domain')); |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function permission() { |
62 | 62 | |
63 | - return current_user_can( 'manage_options' ); |
|
63 | + return current_user_can('manage_options'); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 |
@@ -1,6 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | <?php |
3 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
3 | +if ( ! defined( 'ABSPATH' ) ) { |
|
4 | + exit; |
|
5 | +} |
|
4 | 6 | |
5 | 7 | /** |
6 | 8 | * Extending REST API framework of WordPress |
@@ -49,24 +49,24 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function labels() { |
51 | 51 | |
52 | - $labels = array( |
|
53 | - 'name' => _x( '', 'Post Type General Name', 'textdomain' ), |
|
54 | - 'singular_name' => _x( '', 'Post Type Singular Name', 'textdomain' ), |
|
55 | - 'menu_name' => __( '', 'textdomain' ), |
|
56 | - 'parent_item_colon' => __( '', 'textdomain' ), |
|
57 | - 'all_items' => __( '', 'textdomain' ), |
|
58 | - 'view_item' => __( '', 'textdomain' ), |
|
59 | - 'add_new_item' => __( '', 'textdomain' ), |
|
60 | - 'add_new' => __( '', 'textdomain' ), |
|
61 | - 'edit_item' => __( '', 'textdomain' ), |
|
62 | - 'update_item' => __( '', 'textdomain' ), |
|
63 | - 'search_items' => __( '', 'textdomain' ), |
|
64 | - 'not_found' => __( '', 'textdomain' ), |
|
65 | - 'not_found_in_trash' => __( '', 'textdomain' ), |
|
66 | - ); |
|
67 | - |
|
68 | - return $labels; |
|
69 | - } |
|
52 | + $labels = array( |
|
53 | + 'name' => _x( '', 'Post Type General Name', 'textdomain' ), |
|
54 | + 'singular_name' => _x( '', 'Post Type Singular Name', 'textdomain' ), |
|
55 | + 'menu_name' => __( '', 'textdomain' ), |
|
56 | + 'parent_item_colon' => __( '', 'textdomain' ), |
|
57 | + 'all_items' => __( '', 'textdomain' ), |
|
58 | + 'view_item' => __( '', 'textdomain' ), |
|
59 | + 'add_new_item' => __( '', 'textdomain' ), |
|
60 | + 'add_new' => __( '', 'textdomain' ), |
|
61 | + 'edit_item' => __( '', 'textdomain' ), |
|
62 | + 'update_item' => __( '', 'textdomain' ), |
|
63 | + 'search_items' => __( '', 'textdomain' ), |
|
64 | + 'not_found' => __( '', 'textdomain' ), |
|
65 | + 'not_found_in_trash' => __( '', 'textdomain' ), |
|
66 | + ); |
|
67 | + |
|
68 | + return $labels; |
|
69 | + } |
|
70 | 70 | |
71 | 71 | |
72 | 72 | /** |
@@ -76,44 +76,44 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @return Array |
78 | 78 | */ |
79 | - public function args( $labels ) { |
|
80 | - |
|
81 | - $args = array( |
|
82 | - 'label' => __( '', 'textdomain' ), |
|
83 | - 'description' => __( '', 'textdomain' ), |
|
84 | - 'labels' => $labels, |
|
85 | - 'supports' => array( 'title', 'editor', 'thumbnail' ), |
|
86 | - 'taxonomies' => array( 'topics', 'post_tag' ), |
|
87 | - 'hierarchical' => true, |
|
88 | - 'public' => true, |
|
79 | + public function args( $labels ) { |
|
80 | + |
|
81 | + $args = array( |
|
82 | + 'label' => __( '', 'textdomain' ), |
|
83 | + 'description' => __( '', 'textdomain' ), |
|
84 | + 'labels' => $labels, |
|
85 | + 'supports' => array( 'title', 'editor', 'thumbnail' ), |
|
86 | + 'taxonomies' => array( 'topics', 'post_tag' ), |
|
87 | + 'hierarchical' => true, |
|
88 | + 'public' => true, |
|
89 | 89 | 'rewrite' => array( 'slug' => 'slug_name' ), |
90 | - 'show_ui' => true, |
|
91 | - 'show_in_menu' => true, |
|
90 | + 'show_ui' => true, |
|
91 | + 'show_in_menu' => true, |
|
92 | 92 | 'menu_icon' => 'data:image/svg+xml;base64,' . self::$menu_svg, |
93 | - 'show_in_nav_menus' => true, |
|
94 | - 'show_in_admin_bar' => true, |
|
95 | - 'menu_position' => 5, |
|
96 | - 'can_export' => true, |
|
97 | - 'has_archive' => true, |
|
98 | - 'exclude_from_search' => false, |
|
99 | - 'publicly_queryable' => true, |
|
100 | - 'capability_type' => 'post', |
|
101 | - 'show_in_rest' => true, |
|
93 | + 'show_in_nav_menus' => true, |
|
94 | + 'show_in_admin_bar' => true, |
|
95 | + 'menu_position' => 5, |
|
96 | + 'can_export' => true, |
|
97 | + 'has_archive' => true, |
|
98 | + 'exclude_from_search' => false, |
|
99 | + 'publicly_queryable' => true, |
|
100 | + 'capability_type' => 'post', |
|
101 | + 'show_in_rest' => true, |
|
102 | 102 | //Controls WP REST API behaviour |
103 | 103 | 'rest_controller_class' => 'WP_REST_Terms_Controller', |
104 | - ); |
|
104 | + ); |
|
105 | 105 | |
106 | - return $args; |
|
107 | - } |
|
106 | + return $args; |
|
107 | + } |
|
108 | 108 | |
109 | 109 | |
110 | 110 | /** |
111 | - * Modify the cpt messages |
|
111 | + * Modify the cpt messages |
|
112 | 112 | * |
113 | 113 | * @param Array $messages |
114 | 114 | * |
115 | 115 | * @return Array |
116 | - */ |
|
116 | + */ |
|
117 | 117 | public function cpt_updated_messages( $messages ) { |
118 | 118 | |
119 | 119 | global $post, $post_ID; |