- Timestamp:
- 01/29/2020 12:43:23 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php
r46696 r47122 45 45 */ 46 46 public function register_routes() { 47 /* translators: %s: register_routes() */ 48 _doing_it_wrong( 'WP_REST_Controller::register_routes', sprintf( __( "Method '%s' must be overridden." ), __METHOD__ ), '4.7' ); 47 _doing_it_wrong( 48 'WP_REST_Controller::register_routes', 49 /* translators: %s: register_routes() */ 50 sprintf( __( "Method '%s' must be overridden." ), __METHOD__ ), 51 '4.7' 52 ); 49 53 } 50 54 … … 58 62 */ 59 63 public function get_items_permissions_check( $request ) { 60 /* translators: %s: Method name. */ 61 return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) ); 64 return new WP_Error( 65 'invalid-method', 66 /* translators: %s: Method name. */ 67 sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), 68 array( 'status' => 405 ) 69 ); 62 70 } 63 71 … … 71 79 */ 72 80 public function get_items( $request ) { 73 /* translators: %s: Method name. */ 74 return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) ); 81 return new WP_Error( 82 'invalid-method', 83 /* translators: %s: Method name. */ 84 sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), 85 array( 'status' => 405 ) 86 ); 75 87 } 76 88 … … 84 96 */ 85 97 public function get_item_permissions_check( $request ) { 86 /* translators: %s: Method name. */ 87 return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) ); 98 return new WP_Error( 99 'invalid-method', 100 /* translators: %s: Method name. */ 101 sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), 102 array( 'status' => 405 ) 103 ); 88 104 } 89 105 … … 97 113 */ 98 114 public function get_item( $request ) { 99 /* translators: %s: Method name. */ 100 return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) ); 115 return new WP_Error( 116 'invalid-method', 117 /* translators: %s: Method name. */ 118 sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), 119 array( 'status' => 405 ) 120 ); 101 121 } 102 122 … … 110 130 */ 111 131 public function create_item_permissions_check( $request ) { 112 /* translators: %s: Method name. */ 113 return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) ); 132 return new WP_Error( 133 'invalid-method', 134 /* translators: %s: Method name. */ 135 sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), 136 array( 'status' => 405 ) 137 ); 114 138 } 115 139 … … 123 147 */ 124 148 public function create_item( $request ) { 125 /* translators: %s: Method name. */ 126 return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) ); 149 return new WP_Error( 150 'invalid-method', 151 /* translators: %s: Method name. */ 152 sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), 153 array( 'status' => 405 ) 154 ); 127 155 } 128 156 … … 136 164 */ 137 165 public function update_item_permissions_check( $request ) { 138 /* translators: %s: Method name. */ 139 return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) ); 166 return new WP_Error( 167 'invalid-method', 168 /* translators: %s: Method name. */ 169 sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), 170 array( 'status' => 405 ) 171 ); 140 172 } 141 173 … … 149 181 */ 150 182 public function update_item( $request ) { 151 /* translators: %s: Method name. */ 152 return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) ); 183 return new WP_Error( 184 'invalid-method', 185 /* translators: %s: Method name. */ 186 sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), 187 array( 'status' => 405 ) 188 ); 153 189 } 154 190 … … 162 198 */ 163 199 public function delete_item_permissions_check( $request ) { 164 /* translators: %s: Method name. */ 165 return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) ); 200 return new WP_Error( 201 'invalid-method', 202 /* translators: %s: Method name. */ 203 sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), 204 array( 'status' => 405 ) 205 ); 166 206 } 167 207 … … 175 215 */ 176 216 public function delete_item( $request ) { 177 /* translators: %s: Method name. */ 178 return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) ); 217 return new WP_Error( 218 'invalid-method', 219 /* translators: %s: Method name. */ 220 sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), 221 array( 'status' => 405 ) 222 ); 179 223 } 180 224 … … 188 232 */ 189 233 protected function prepare_item_for_database( $request ) { 190 /* translators: %s: Method name. */ 191 return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) ); 234 return new WP_Error( 235 'invalid-method', 236 /* translators: %s: Method name. */ 237 sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), 238 array( 'status' => 405 ) 239 ); 192 240 } 193 241 … … 202 250 */ 203 251 public function prepare_item_for_response( $item, $request ) { 204 /* translators: %s: Method name. */ 205 return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) ); 252 return new WP_Error( 253 'invalid-method', 254 /* translators: %s: Method name. */ 255 sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), 256 array( 'status' => 405 ) 257 ); 206 258 } 207 259 … … 392 444 393 445 foreach ( $additional_fields as $field_name => $field_options ) { 394 395 446 if ( ! $field_options['get_callback'] ) { 396 447 continue; … … 530 581 531 582 $additional_fields = $this->get_additional_fields(); 583 532 584 foreach ( $additional_fields as $field_name => $field_options ) { 533 585 // For back-compat, include any field with an empty schema … … 573 625 // Check for nested fields if $field is not a direct match. 574 626 $nested_fields = explode( '.', $field ); 575 // A nested field is included so long as its top-level property is576 // present in the schema.627 // A nested field is included so long as its top-level property 628 // is present in the schema. 577 629 if ( in_array( $nested_fields[0], $fields, true ) ) { 578 630 $response_fields[] = $field;
Note: See TracChangeset
for help on using the changeset viewer.