Changeset 3059
- Timestamp:
- 05/02/2016 04:16:25 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
r3016 r3059 24 24 'args' => [ 25 25 'timestamp' => [ 26 'description' => 'Timestamp for when to run the job.', 26 27 'required' => true, 27 28 'sanitize_callback' => 'absint', … … 29 30 ], 30 31 'recurrence' => [ 32 'description' => 'How often the job should rerun.', 31 33 'required' => true, 34 'enum' => array_merge( [ 'once' ], array_keys( wp_get_schedules() ) ), 32 35 'sanitize_callback' => 'sanitize_text_field', 33 36 'validate_callback' => [ $this, 'validate_recurrence' ], 34 37 ], 35 38 'hook' => [ 39 'description' => 'Action hook to execute when cron is run. Must be prefixed with `wporg_translate_`.', 36 40 'required' => true, 37 41 'sanitize_callback' => 'sanitize_text_field', 42 'validate_callback' => [ $this, 'validate_hook' ], 38 43 ], 39 44 'args' => [ 40 'default' => [], 45 'description' => 'Arguments to pass to the hook\'s callback function.', 46 'default' => [], 41 47 'validate_callback' => [ $this, 'validate_args' ], 42 48 ], … … 49 55 'args' => [ 50 56 'timestamp' => [ 57 'description' => 'Timestamp for the next run of the job.', 51 58 'required' => true, 52 59 'sanitize_callback' => 'absint', … … 54 61 ], 55 62 'hook' => [ 63 'description' => 'Action hook to execute when cron is run. Must be prefixed with `wporg_translate_`.', 56 64 'required' => true, 57 65 'sanitize_callback' => 'sanitize_text_field', 66 'validate_callback' => [ $this, 'validate_hook' ], 58 67 ], 59 68 'args' => [ 60 'default' => [], 69 'description' => 'Arguments to pass to the hook\'s callback function.', 70 'default' => [], 61 71 'validate_callback' => [ $this, 'validate_args' ], 62 72 ], … … 164 174 165 175 /** 176 * Validates an action hook. 177 * 178 * @param string $hook The action hook to validate. 179 * @return bool True if valid, false if not. 180 */ 181 public function validate_hook( $hook ) { 182 if ( 0 === strpos( $hook, 'wporg_translate_' ) ) { 183 return true; 184 } 185 186 return false; 187 } 188 189 /** 166 190 * Validates the args parameter for a job. 167 191 *
Note: See TracChangeset
for help on using the changeset viewer.