/** * Function used to create instance of class. */ public static function instance() { if (!isset(self::$instance)) { self::$instance = new Easy_Real_Estate_Property_Taxonomies(); } return self::$instance; }
/** * This function handles updating (saving) widget options */ function update($new_instance, $old_instance) { // Sanitize all input data $new_instance['title'] = sanitize_text_field($new_instance['title']); // Widget Title // Taxonomies $ere_property_taxonomies = Easy_Real_Estate_Property_Taxonomies::get_taxonomies(); // Get active taxonomies foreach ($new_instance['taxonomies'] as $taxonomy => $value) { $new_instance['taxonomies'][$taxonomy] = isset($new_instance['taxonomies'][$taxonomy]) && array_key_exists($taxonomy, $ere_property_taxonomies) ? $ere_property_taxonomies[$taxonomy]['labels']['name'] : false; } $new_instance['button_text'] = sanitize_text_field($new_instance['button_text']); // Button Text return $new_instance; }