Passed
Push — master ( 1931dd...40edde )
by Nirjhar
02:32
created
autoload.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -299,28 +299,28 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/class-rest.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -20,16 +20,16 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
src/class-cpt.php 1 patch
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -54,24 +54,24 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.