Make WordPress Core

Ticket #41667: 41667.patch

File 41667.patch, 7.4 KB (added by ramiy, 7 years ago)
  • wp-includes/rest-api/endpoints/class-wp-rest-controller.php

     
    3636         * @since 4.7.0
    3737         */
    3838        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' );
    4041        }
    4142
    4243        /**
     
    4849         * @return WP_Error|bool True if the request has read access, WP_Error object otherwise.
    4950         */
    5051        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 ) );
    5254        }
    5355
    5456        /**
     
    6062         * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure.
    6163         */
    6264        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 ) );
    6467        }
    6568
    6669        /**
     
    7275         * @return WP_Error|bool True if the request has read access for the item, WP_Error object otherwise.
    7376         */
    7477        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 ) );
    7680        }
    7781
    7882        /**
     
    8488         * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure.
    8589         */
    8690        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 ) );
    8893        }
    8994
    9095        /**
     
    96101         * @return WP_Error|bool True if the request has access to create items, WP_Error object otherwise.
    97102         */
    98103        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 ) );
    100106        }
    101107
    102108        /**
     
    108114         * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure.
    109115         */
    110116        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 ) );
    112119        }
    113120
    114121        /**
     
    120127         * @return WP_Error|bool True if the request has access to update the item, WP_Error object otherwise.
    121128         */
    122129        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 ) );
    124132        }
    125133
    126134        /**
     
    132140         * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure.
    133141         */
    134142        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 ) );
    136145        }
    137146
    138147        /**
     
    144153         * @return WP_Error|bool True if the request has access to delete the item, WP_Error object otherwise.
    145154         */
    146155        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 ) );
    148158        }
    149159
    150160        /**
     
    156166         * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure.
    157167         */
    158168        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 ) );
    160171        }
    161172
    162173        /**
     
    168179         * @return WP_Error|object The prepared item, or WP_Error object on failure.
    169180         */
    170181        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 ) );
    172184        }
    173185
    174186        /**
     
    181193         * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure.
    182194         */
    183195        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 ) );
    185198        }
    186199
    187200        /**