/** * Setup hook to prepare returned form. Setup field/choice attributes with callbacks * * @param WP_JSON_ResponseHandler $server * @since 6.0 */ public function __construct($server) { parent::__construct($server); add_filter('json_prepare_post', array($this, 'filter_prepare_post'), 10, 3); $this->field_attribute_keys = apply_filters('ccf_field_attributes', array('type' => array('sanitize' => 'esc_attr', 'escape' => 'esc_attr'), 'slug' => array('sanitize' => 'esc_attr', 'escape' => 'esc_attr'), 'placeholder' => array('sanitize' => 'esc_attr', 'escape' => 'esc_attr'), 'className' => array('sanitize' => 'esc_attr', 'escape' => 'esc_attr'), 'label' => array('sanitize' => 'sanitize_text_field', 'escape' => 'esc_html'), 'description' => array('sanitize' => 'sanitize_text_field', 'escape' => 'esc_html'), 'value' => array('sanitize' => 'sanitize_text_field', 'escape' => 'esc_html'), 'required' => array('sanitize' => array($this, 'boolval'), 'escape' => array($this, 'boolval')), 'showDate' => array('sanitize' => array($this, 'boolval'), 'escape' => array($this, 'boolval')), 'addressType' => array('sanitize' => 'esc_attr', 'escape' => 'esc_attr'), 'siteKey' => array('sanitize' => 'esc_attr', 'escape' => 'esc_attr'), 'secretKey' => array('sanitize' => 'esc_attr', 'escape' => 'esc_attr'), 'phoneFormat' => array('sanitize' => 'esc_attr', 'escape' => 'esc_attr'), 'emailConfirmation' => array('sanitize' => array($this, 'boolval'), 'escape' => array($this, 'boolval')), 'showTime' => array('sanitize' => array($this, 'boolval'), 'escape' => array($this, 'boolval')), 'heading' => array('sanitize' => 'sanitize_text_field', 'escape' => 'esc_html'), 'subheading' => array('sanitize' => 'sanitize_text_field', 'escape' => 'esc_html'), 'html' => array('sanitize' => 'wp_kses_post', 'escape' => 'wp_kses_post'), 'maxFileSize' => array('sanitize' => 'intval', 'escape' => 'intval'), 'fileExtensions' => array('sanitize' => 'sanitize_text_field', 'escape' => 'esc_html'))); $this->choice_attribute_keys = apply_filters('ccf_choice_attributes', array('label' => array('sanitize' => 'sanitize_text_field', 'escape' => 'esc_html'), 'value' => array('sanitize' => 'esc_attr', 'escape' => 'esc_attr'), 'selected' => array('sanitize' => array($this, 'boolval'), 'escape' => array($this, 'boolval')))); }
/** * Construct the API handler object */ public function __construct(WP_JSON_ResponseHandler $server) { if (empty($this->base)) { _doing_it_wrong('WP_JSON_CustomPostType::__construct', __('The route base must be overridden'), 'WPAPI-0.6'); return; } if (empty($this->type)) { _doing_it_wrong('WP_JSON_CustomPostType::__construct', __('The post type must be overridden'), 'WPAPI-0.6'); return; } parent::__construct($server); }