@@ -13,8 +13,8 @@ |
||
| 13 | 13 | if ( ! class_exists( 'PLUGIN_TABLE' ) ) { |
| 14 | 14 | |
| 15 | 15 | if ( ! class_exists( 'WP_List_Table' ) ) { |
| 16 | - require_once( ABSPATH . 'wp-admin/includes/screen.php' ); |
|
| 17 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); |
|
| 16 | + require_once( ABSPATH . 'wp-admin/includes/screen.php' ); |
|
| 17 | + require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | final class PLUGIN_TABLE extends WP_List_Table { |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | break; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - if ( $output ) return $output; // Related to PLUGIN_TABLE() |
|
| 167 | + if ( $output ) return $output; // Related to PLUGIN_TABLE() |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | echo '<textarea name="settings_field_name" id="settings_field_name" value="' . get_option('settings_field_name') . '>'. __( 'Enter Value', 'textdomain' ) . '</textarea>'; |
| 280 | 280 | echo '<select name="settings_field_name" id="settings_field_name"><option value="value" ' . selected( 'value', get_option('settings_field_name'), false) . '>Value</option></select>'; |
| 281 | 281 | echo '<input type="checkbox" id="settings_field_name" name="settings_field_name" value="1"' . checked( 1, get_option('settings_field_name'), false ) . '/>'; |
| 282 | - */ |
|
| 282 | + */ |
|
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | } ?> |
@@ -40,12 +40,12 @@ |
||
| 40 | 40 | /** |
| 41 | 41 | $user_args = $this->user_args($paged); |
| 42 | 42 | $the_query = new WP_User_Query( $user_args ); |
| 43 | - */ |
|
| 43 | + */ |
|
| 44 | 44 | |
| 45 | 45 | // The Loop |
| 46 | 46 | if ( $the_query->have_posts() ) { |
| 47 | 47 | while ( $the_query->have_posts() ) { |
| 48 | - $the_query->the_post(); |
|
| 48 | + $the_query->the_post(); |
|
| 49 | 49 | // Do Stuff |
| 50 | 50 | } // end while |
| 51 | 51 | } // endif |
@@ -64,12 +64,12 @@ |
||
| 64 | 64 | |
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | - * Save the Metabox post data |
|
| 68 | - * |
|
| 69 | - * @param Array $atts |
|
| 70 | - * |
|
| 71 | - * @return Html |
|
| 72 | - */ |
|
| 67 | + * Save the Metabox post data |
|
| 68 | + * |
|
| 69 | + * @param Array $atts |
|
| 70 | + * |
|
| 71 | + * @return Html |
|
| 72 | + */ |
|
| 73 | 73 | function save( $post_id, $post ) { |
| 74 | 74 | |
| 75 | 75 | //Check if doing autosave |
@@ -44,13 +44,13 @@ |
||
| 44 | 44 | global $wpdb; |
| 45 | 45 | $wpdb->hide_errors(); |
| 46 | 46 | $collate = ""; |
| 47 | - if ( $wpdb->has_cap( 'collation' ) ) { |
|
| 47 | + if ( $wpdb->has_cap( 'collation' ) ) { |
|
| 48 | 48 | if( ! empty($wpdb->charset ) ) |
| 49 | 49 | $collate .= "DEFAULT CHARACTER SET $wpdb->charset"; |
| 50 | 50 | if( ! empty($wpdb->collate ) ) |
| 51 | 51 | $collate .= " COLLATE $wpdb->collate"; |
| 52 | - } |
|
| 53 | - require_once( $this->up_path ); |
|
| 52 | + } |
|
| 53 | + require_once( $this->up_path ); |
|
| 54 | 54 | return $collate; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -24,11 +24,11 @@ |
||
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * Shortcode callback |
| 27 | - * |
|
| 28 | - * @param Array $atts |
|
| 29 | - * |
|
| 30 | - * @return Html |
|
| 31 | - */ |
|
| 27 | + * |
|
| 28 | + * @param Array $atts |
|
| 29 | + * |
|
| 30 | + * @return Html |
|
| 31 | + */ |
|
| 32 | 32 | public function cb($atts) { |
| 33 | 33 | |
| 34 | 34 | $data = shortcode_atts( array( |
@@ -299,28 +299,28 @@ |
||
| 299 | 299 | |
| 300 | 300 | |
| 301 | 301 | /** |
| 302 | - * Instantiate REST API |
|
| 303 | - * |
|
| 304 | - * @return Void |
|
| 305 | - */ |
|
| 302 | + * Instantiate REST API |
|
| 303 | + * |
|
| 304 | + * @return Void |
|
| 305 | + */ |
|
| 306 | 306 | public function prevent_unauthorized_rest_access( $result ) { |
| 307 | - // If a previous authentication check was applied, |
|
| 308 | - // pass that result along without modification. |
|
| 309 | - if ( true === $result || is_wp_error( $result ) ) { |
|
| 310 | - return $result; |
|
| 311 | - } |
|
| 312 | - |
|
| 313 | - // No authentication has been performed yet. |
|
| 314 | - // Return an error if user is not logged in. |
|
| 315 | - if ( ! is_user_logged_in() ) { |
|
| 316 | - return new WP_Error( |
|
| 317 | - 'rest_not_logged_in', |
|
| 318 | - __( 'You are not currently logged in.' ), |
|
| 319 | - array( 'status' => 401 ) |
|
| 320 | - ); |
|
| 321 | - } |
|
| 322 | - |
|
| 323 | - return $result; |
|
| 307 | + // If a previous authentication check was applied, |
|
| 308 | + // pass that result along without modification. |
|
| 309 | + if ( true === $result || is_wp_error( $result ) ) { |
|
| 310 | + return $result; |
|
| 311 | + } |
|
| 312 | + |
|
| 313 | + // No authentication has been performed yet. |
|
| 314 | + // Return an error if user is not logged in. |
|
| 315 | + if ( ! is_user_logged_in() ) { |
|
| 316 | + return new WP_Error( |
|
| 317 | + 'rest_not_logged_in', |
|
| 318 | + __( 'You are not currently logged in.' ), |
|
| 319 | + array( 'status' => 401 ) |
|
| 320 | + ); |
|
| 321 | + } |
|
| 322 | + |
|
| 323 | + return $result; |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | |
@@ -20,16 +20,16 @@ discard block |
||
| 20 | 20 | public function register_routes() { |
| 21 | 21 | |
| 22 | 22 | $version = '1'; |
| 23 | - $namespace = 'vendor/v' . $version; |
|
| 24 | - $base = 'route'; |
|
| 23 | + $namespace = 'vendor/v' . $version; |
|
| 24 | + $base = 'route'; |
|
| 25 | 25 | |
| 26 | 26 | //Available options for methods are CREATABLE, READABLE, EDITABLE, DELETABLE |
| 27 | 27 | register_rest_route( $namespace, '/' . $base, array( |
| 28 | - 'methods' => WP_REST_Server::READABLE, |
|
| 29 | - 'callback' => array( $this, 'callback' ), |
|
| 30 | - 'permission_callback' => array( $this, 'permission' ), |
|
| 31 | - 'args' => array('sample', 'list', 'of', 'args') |
|
| 32 | - )); |
|
| 28 | + 'methods' => WP_REST_Server::READABLE, |
|
| 29 | + 'callback' => array( $this, 'callback' ), |
|
| 30 | + 'permission_callback' => array( $this, 'permission' ), |
|
| 31 | + 'args' => array('sample', 'list', 'of', 'args') |
|
| 32 | + )); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | |
@@ -40,13 +40,13 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function callback() { |
| 42 | 42 | |
| 43 | - $params = $request->get_params(); |
|
| 44 | - $items = array(); |
|
| 45 | - $data = $this->prepare_item_for_response( $items, $request ); |
|
| 43 | + $params = $request->get_params(); |
|
| 44 | + $items = array(); |
|
| 45 | + $data = $this->prepare_item_for_response( $items, $request ); |
|
| 46 | 46 | |
| 47 | - if ( $data ) { |
|
| 48 | - return new WP_REST_Response( $data, 200 ); |
|
| 49 | - } else { |
|
| 47 | + if ( $data ) { |
|
| 48 | + return new WP_REST_Response( $data, 200 ); |
|
| 49 | + } else { |
|
| 50 | 50 | return new WP_Error( 'status_code', __( 'message', 'text-domain' ) ); |
| 51 | 51 | } |
| 52 | 52 | } |
@@ -54,24 +54,24 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function labels() { |
| 56 | 56 | |
| 57 | - $labels = array( |
|
| 58 | - 'name' => _x( '', 'Post Type General Name', 'textdomain' ), |
|
| 59 | - 'singular_name' => _x( '', 'Post Type Singular Name', 'textdomain' ), |
|
| 60 | - 'menu_name' => __( '', 'textdomain' ), |
|
| 61 | - 'parent_item_colon' => __( '', 'textdomain' ), |
|
| 62 | - 'all_items' => __( '', 'textdomain' ), |
|
| 63 | - 'view_item' => __( '', 'textdomain' ), |
|
| 64 | - 'add_new_item' => __( '', 'textdomain' ), |
|
| 65 | - 'add_new' => __( '', 'textdomain' ), |
|
| 66 | - 'edit_item' => __( '', 'textdomain' ), |
|
| 67 | - 'update_item' => __( '', 'textdomain' ), |
|
| 68 | - 'search_items' => __( '', 'textdomain' ), |
|
| 69 | - 'not_found' => __( '', 'textdomain' ), |
|
| 70 | - 'not_found_in_trash' => __( '', 'textdomain' ), |
|
| 71 | - ); |
|
| 72 | - |
|
| 73 | - return $labels; |
|
| 74 | - } |
|
| 57 | + $labels = array( |
|
| 58 | + 'name' => _x( '', 'Post Type General Name', 'textdomain' ), |
|
| 59 | + 'singular_name' => _x( '', 'Post Type Singular Name', 'textdomain' ), |
|
| 60 | + 'menu_name' => __( '', 'textdomain' ), |
|
| 61 | + 'parent_item_colon' => __( '', 'textdomain' ), |
|
| 62 | + 'all_items' => __( '', 'textdomain' ), |
|
| 63 | + 'view_item' => __( '', 'textdomain' ), |
|
| 64 | + 'add_new_item' => __( '', 'textdomain' ), |
|
| 65 | + 'add_new' => __( '', 'textdomain' ), |
|
| 66 | + 'edit_item' => __( '', 'textdomain' ), |
|
| 67 | + 'update_item' => __( '', 'textdomain' ), |
|
| 68 | + 'search_items' => __( '', 'textdomain' ), |
|
| 69 | + 'not_found' => __( '', 'textdomain' ), |
|
| 70 | + 'not_found_in_trash' => __( '', 'textdomain' ), |
|
| 71 | + ); |
|
| 72 | + |
|
| 73 | + return $labels; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -81,44 +81,44 @@ discard block |
||
| 81 | 81 | * |
| 82 | 82 | * @return Array |
| 83 | 83 | */ |
| 84 | - public function args( $labels ) { |
|
| 85 | - |
|
| 86 | - $args = array( |
|
| 87 | - 'label' => __( '', 'textdomain' ), |
|
| 88 | - 'description' => __( '', 'textdomain' ), |
|
| 89 | - 'labels' => $labels, |
|
| 90 | - 'supports' => array( 'title', 'editor', 'thumbnail' ), |
|
| 91 | - 'taxonomies' => array( 'custom_tax', 'post_tag' ), |
|
| 92 | - 'hierarchical' => true, |
|
| 93 | - 'public' => true, |
|
| 84 | + public function args( $labels ) { |
|
| 85 | + |
|
| 86 | + $args = array( |
|
| 87 | + 'label' => __( '', 'textdomain' ), |
|
| 88 | + 'description' => __( '', 'textdomain' ), |
|
| 89 | + 'labels' => $labels, |
|
| 90 | + 'supports' => array( 'title', 'editor', 'thumbnail' ), |
|
| 91 | + 'taxonomies' => array( 'custom_tax', 'post_tag' ), |
|
| 92 | + 'hierarchical' => true, |
|
| 93 | + 'public' => true, |
|
| 94 | 94 | 'rewrite' => array( 'slug' => 'slug_name' ), |
| 95 | - 'show_ui' => true, |
|
| 96 | - 'show_in_menu' => true, |
|
| 95 | + 'show_ui' => true, |
|
| 96 | + 'show_in_menu' => true, |
|
| 97 | 97 | 'menu_icon' => 'data:image/svg+xml;base64,' . self::$menu_svg, |
| 98 | - 'show_in_nav_menus' => true, |
|
| 99 | - 'show_in_admin_bar' => true, |
|
| 100 | - 'menu_position' => 5, |
|
| 101 | - 'can_export' => true, |
|
| 102 | - 'has_archive' => true, |
|
| 103 | - 'exclude_from_search' => false, |
|
| 104 | - 'publicly_queryable' => true, |
|
| 105 | - 'capability_type' => 'post', |
|
| 106 | - 'show_in_rest' => true, |
|
| 98 | + 'show_in_nav_menus' => true, |
|
| 99 | + 'show_in_admin_bar' => true, |
|
| 100 | + 'menu_position' => 5, |
|
| 101 | + 'can_export' => true, |
|
| 102 | + 'has_archive' => true, |
|
| 103 | + 'exclude_from_search' => false, |
|
| 104 | + 'publicly_queryable' => true, |
|
| 105 | + 'capability_type' => 'post', |
|
| 106 | + 'show_in_rest' => true, |
|
| 107 | 107 | //Controls WP REST API behaviour |
| 108 | 108 | 'rest_controller_class' => 'WP_REST_Posts_Controller', |
| 109 | - ); |
|
| 109 | + ); |
|
| 110 | 110 | |
| 111 | - return $args; |
|
| 112 | - } |
|
| 111 | + return $args; |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | 114 | |
| 115 | 115 | /** |
| 116 | - * Modify the cpt messages |
|
| 116 | + * Modify the cpt messages |
|
| 117 | 117 | * |
| 118 | 118 | * @param Array $messages |
| 119 | 119 | * |
| 120 | 120 | * @return Array |
| 121 | - */ |
|
| 121 | + */ |
|
| 122 | 122 | public function cpt_updated_messages( $messages ) { |
| 123 | 123 | |
| 124 | 124 | global $post, $post_ID; |
@@ -142,24 +142,24 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | |
| 144 | 144 | /** |
| 145 | - * Taxonomy labels |
|
| 146 | - * |
|
| 147 | - * @return Array |
|
| 148 | - */ |
|
| 145 | + * Taxonomy labels |
|
| 146 | + * |
|
| 147 | + * @return Array |
|
| 148 | + */ |
|
| 149 | 149 | public function taxonomy_labels() { |
| 150 | 150 | |
| 151 | 151 | $labels = array( |
| 152 | - 'name' => _x( 'Taxonomy', 'taxonomy general name', 'textdomain' ), |
|
| 153 | - 'singular_name' => _x( 'Taxonomy', 'taxonomy singular name', 'textdomain' ), |
|
| 154 | - 'search_items' => __( 'Search Taxonomy', 'textdomain' ), |
|
| 155 | - 'all_items' => __( 'All Taxonomies', 'textdomain' ), |
|
| 156 | - 'parent_item' => __( 'Parent Taxonomy', 'textdomain' ), |
|
| 157 | - 'parent_item_colon' => __( 'Parent Taxonomy:', 'textdomain' ), |
|
| 158 | - 'edit_item' => __( 'Edit Taxonomy', 'textdomain' ), |
|
| 159 | - 'update_item' => __( 'Update Taxonomy', 'textdomain' ), |
|
| 160 | - 'add_new_item' => __( 'Add New Taxonomy', 'textdomain' ), |
|
| 161 | - 'new_item_name' => __( 'New Taxonomy Name', 'textdomain' ), |
|
| 162 | - 'menu_name' => __( 'Taxonomy', 'textdomain' ), |
|
| 152 | + 'name' => _x( 'Taxonomy', 'taxonomy general name', 'textdomain' ), |
|
| 153 | + 'singular_name' => _x( 'Taxonomy', 'taxonomy singular name', 'textdomain' ), |
|
| 154 | + 'search_items' => __( 'Search Taxonomy', 'textdomain' ), |
|
| 155 | + 'all_items' => __( 'All Taxonomies', 'textdomain' ), |
|
| 156 | + 'parent_item' => __( 'Parent Taxonomy', 'textdomain' ), |
|
| 157 | + 'parent_item_colon' => __( 'Parent Taxonomy:', 'textdomain' ), |
|
| 158 | + 'edit_item' => __( 'Edit Taxonomy', 'textdomain' ), |
|
| 159 | + 'update_item' => __( 'Update Taxonomy', 'textdomain' ), |
|
| 160 | + 'add_new_item' => __( 'Add New Taxonomy', 'textdomain' ), |
|
| 161 | + 'new_item_name' => __( 'New Taxonomy Name', 'textdomain' ), |
|
| 162 | + 'menu_name' => __( 'Taxonomy', 'textdomain' ), |
|
| 163 | 163 | ); |
| 164 | 164 | |
| 165 | 165 | return $labels; |
@@ -167,28 +167,28 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | |
| 169 | 169 | /** |
| 170 | - * Define the arguments for custom taxonomy |
|
| 171 | - * |
|
| 172 | - * @param Array $labels |
|
| 173 | - * |
|
| 174 | - * @return Array |
|
| 175 | - */ |
|
| 176 | - public function taxonomy_args( $labels ) { |
|
| 177 | - |
|
| 178 | - $args = array( |
|
| 170 | + * Define the arguments for custom taxonomy |
|
| 171 | + * |
|
| 172 | + * @param Array $labels |
|
| 173 | + * |
|
| 174 | + * @return Array |
|
| 175 | + */ |
|
| 176 | + public function taxonomy_args( $labels ) { |
|
| 177 | + |
|
| 178 | + $args = array( |
|
| 179 | 179 | 'hierarchical' => true, |
| 180 | - 'labels' => $labels, |
|
| 181 | - 'show_ui' => true, |
|
| 182 | - 'show_admin_column' => true, |
|
| 183 | - 'query_var' => true, |
|
| 184 | - 'rewrite' => array( 'slug' => 'custom_tax' ), |
|
| 185 | - 'show_in_rest' => true, |
|
| 186 | - 'rest_base' => 'custom_tax', |
|
| 180 | + 'labels' => $labels, |
|
| 181 | + 'show_ui' => true, |
|
| 182 | + 'show_admin_column' => true, |
|
| 183 | + 'query_var' => true, |
|
| 184 | + 'rewrite' => array( 'slug' => 'custom_tax' ), |
|
| 185 | + 'show_in_rest' => true, |
|
| 186 | + 'rest_base' => 'custom_tax', |
|
| 187 | 187 | //Controls WP REST API behaviour |
| 188 | - 'rest_controller_class' => 'WP_REST_Terms_Controller', |
|
| 189 | - ); |
|
| 188 | + 'rest_controller_class' => 'WP_REST_Terms_Controller', |
|
| 189 | + ); |
|
| 190 | 190 | |
| 191 | - return $args; |
|
| 192 | - } |
|
| 191 | + return $args; |
|
| 192 | + } |
|
| 193 | 193 | } |
| 194 | 194 | } |