Ticket #41667: 41667.patch
File 41667.patch, 7.4 KB (added by , 7 years ago) |
---|
-
wp-includes/rest-api/endpoints/class-wp-rest-controller.php
36 36 * @since 4.7.0 37 37 */ 38 38 public function register_routes() { 39 _doing_it_wrong( 'WP_REST_Controller::register_routes', __( 'The register_routes() method must be overridden' ), '4.7' ); 39 /* translators: %s: register_routes() */ 40 _doing_it_wrong( 'WP_REST_Controller::register_routes', sprintf( __( 'Method %s must be overridden.' ), '<code>register_routes()</code>' ) '4.7' ); 40 41 } 41 42 42 43 /** … … 48 49 * @return WP_Error|bool True if the request has read access, WP_Error object otherwise. 49 50 */ 50 51 public function get_items_permissions_check( $request ) { 51 return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) ); 52 /* translators: %s: method name */ 53 return new WP_Error( 'invalid-method', sprintf( __( 'Method %s not implemented. Must be overridden in subclass.' ), '<code>' . __METHOD__ . '</code>' ), array( 'status' => 405 ) ); 52 54 } 53 55 54 56 /** … … 60 62 * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure. 61 63 */ 62 64 public function get_items( $request ) { 63 return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) ); 65 /* translators: %s: method name */ 66 return new WP_Error( 'invalid-method', sprintf( __( 'Method %s not implemented. Must be overridden in subclass.' ), '<code>' . __METHOD__ . '</code>' ), array( 'status' => 405 ) ); 64 67 } 65 68 66 69 /** … … 72 75 * @return WP_Error|bool True if the request has read access for the item, WP_Error object otherwise. 73 76 */ 74 77 public function get_item_permissions_check( $request ) { 75 return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) ); 78 /* translators: %s: method name */ 79 return new WP_Error( 'invalid-method', sprintf( __( 'Method %s not implemented. Must be overridden in subclass.' ), '<code>' . __METHOD__ . '</code>' ), array( 'status' => 405 ) ); 76 80 } 77 81 78 82 /** … … 84 88 * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure. 85 89 */ 86 90 public function get_item( $request ) { 87 return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) ); 91 /* translators: %s: method name */ 92 return new WP_Error( 'invalid-method', sprintf( __( 'Method %s not implemented. Must be overridden in subclass.' ), '<code>' . __METHOD__ . '</code>' ), array( 'status' => 405 ) ); 88 93 } 89 94 90 95 /** … … 96 101 * @return WP_Error|bool True if the request has access to create items, WP_Error object otherwise. 97 102 */ 98 103 public function create_item_permissions_check( $request ) { 99 return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) ); 104 /* translators: %s: method name */ 105 return new WP_Error( 'invalid-method', sprintf( __( 'Method %s not implemented. Must be overridden in subclass.' ), '<code>' . __METHOD__ . '</code>' ), array( 'status' => 405 ) ); 100 106 } 101 107 102 108 /** … … 108 114 * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure. 109 115 */ 110 116 public function create_item( $request ) { 111 return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) ); 117 /* translators: %s: method name */ 118 return new WP_Error( 'invalid-method', sprintf( __( 'Method %s not implemented. Must be overridden in subclass.' ), '<code>' . __METHOD__ . '</code>' ), array( 'status' => 405 ) ); 112 119 } 113 120 114 121 /** … … 120 127 * @return WP_Error|bool True if the request has access to update the item, WP_Error object otherwise. 121 128 */ 122 129 public function update_item_permissions_check( $request ) { 123 return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) ); 130 /* translators: %s: method name */ 131 return new WP_Error( 'invalid-method', sprintf( __( 'Method %s not implemented. Must be overridden in subclass.' ), '<code>' . __METHOD__ . '</code>' ), array( 'status' => 405 ) ); 124 132 } 125 133 126 134 /** … … 132 140 * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure. 133 141 */ 134 142 public function update_item( $request ) { 135 return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) ); 143 /* translators: %s: method name */ 144 return new WP_Error( 'invalid-method', sprintf( __( 'Method %s not implemented. Must be overridden in subclass.' ), '<code>' . __METHOD__ . '</code>' ), array( 'status' => 405 ) ); 136 145 } 137 146 138 147 /** … … 144 153 * @return WP_Error|bool True if the request has access to delete the item, WP_Error object otherwise. 145 154 */ 146 155 public function delete_item_permissions_check( $request ) { 147 return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) ); 156 /* translators: %s: method name */ 157 return new WP_Error( 'invalid-method', sprintf( __( 'Method %s not implemented. Must be overridden in subclass.' ), '<code>' . __METHOD__ . '</code>' ), array( 'status' => 405 ) ); 148 158 } 149 159 150 160 /** … … 156 166 * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure. 157 167 */ 158 168 public function delete_item( $request ) { 159 return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) ); 169 /* translators: %s: method name */ 170 return new WP_Error( 'invalid-method', sprintf( __( 'Method %s not implemented. Must be overridden in subclass.' ), '<code>' . __METHOD__ . '</code>' ), array( 'status' => 405 ) ); 160 171 } 161 172 162 173 /** … … 168 179 * @return WP_Error|object The prepared item, or WP_Error object on failure. 169 180 */ 170 181 protected function prepare_item_for_database( $request ) { 171 return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) ); 182 /* translators: %s: method name */ 183 return new WP_Error( 'invalid-method', sprintf( __( 'Method %s not implemented. Must be overridden in subclass.' ), '<code>' . __METHOD__ . '</code>' ), array( 'status' => 405 ) ); 172 184 } 173 185 174 186 /** … … 181 193 * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure. 182 194 */ 183 195 public function prepare_item_for_response( $item, $request ) { 184 return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array( 'status' => 405 ) ); 196 /* translators: %s: method name */ 197 return new WP_Error( 'invalid-method', sprintf( __( 'Method %s not implemented. Must be overridden in subclass.' ), '<code>' . __METHOD__ . '</code>' ), array( 'status' => 405 ) ); 185 198 } 186 199 187 200 /**