Changeset 3016 for sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/inc/rest-api/endpoints/class-jobs-controller.php
- Timestamp:
- 04/26/2016 07:47:23 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/inc/rest-api/endpoints/class-jobs-controller.php
r3014 r3016 32 32 'sanitize_callback' => 'sanitize_text_field', 33 33 'validate_callback' => [ $this, 'validate_recurrence' ], 34 ], 35 'hook' => [ 36 'required' => true, 37 'sanitize_callback' => 'sanitize_text_field', 38 ], 39 'args' => [ 40 'default' => [], 41 'validate_callback' => [ $this, 'validate_args' ], 42 ], 43 ], 44 ], 45 [ 46 'methods' => WP_REST_Server::DELETABLE, 47 'callback' => [ $this, 'delete_item' ], 48 'permission_callback' => [ $this, 'permission_check_internal_api_bearer' ], 49 'args' => [ 50 'timestamp' => [ 51 'required' => true, 52 'sanitize_callback' => 'absint', 53 'validate_callback' => [ $this, 'validate_timestamp' ], 34 54 ], 35 55 'hook' => [ … … 95 115 96 116 /** 117 * Delete one job from the collection. 118 * 119 * @param \WP_REST_Request $request Full data about the request. 120 * @return \WP_Error|bool WP_Error on failure, true on success. 121 */ 122 public function delete_item( $request ) { 123 $result = wp_unschedule_event( $request['timestamp'], $request['hook'], $request['args'] ); 124 if ( false === $result ) { 125 return new WP_Error( 'insert_failed' ); 126 } 127 128 return true; 129 } 130 131 /** 97 132 * Validates a timestamp. 98 133 *
Note: See TracChangeset
for help on using the changeset viewer.