/** * Customize taxonomy metaboxes * * @since 0.3.0 */ public function customize_taxonomy_metaboxes() { $taxes = of_cme_supported_taxonomies(); foreach ($taxes as $tax) { $defaults = of_cme_get_defaults(); $options = get_option($this->name . '_' . $tax); $options = wp_parse_args($options, $defaults); $type = $options['type']; if ($type != 'checkbox') { ${$tax . "_metabox"} = new Taxonomy_Single_Term($tax, array(), $type); ${$tax . "_metabox"}->set('force_selection', true); unset($defaults['type']); foreach ($defaults as $key => $v) { $value = $options[$key]; ${$tax . "_metabox"}->set($key, $value); } } } }
/** * Validate inputs * * @return array Sanitized data * * @since 0.4.0 */ public function validate_inputs($inputs) { $outputs = array(); $defaults = of_cme_get_defaults(); foreach ($defaults as $key => $v) { $outputs[$key] = isset($inputs[$key]) ? sanitize_text_field($inputs[$key]) : 0; } return apply_filters('cme_validate_inputs', $outputs, $inputs); }