/** * Provides access to a single instance of this class. * @since 1.0.0 * @return object A single instance of this class. */ public static function get_instance() { if (null == self::$instance) { self::$instance = new self(); } return self::$instance; }
/** * Register all of the hooks related to the admin area functionality * of the plugin. * * @since 1.0.0 * @access private */ private function define_admin_hooks() { $plugin_admin = new Inspiry_Real_Estate_Admin($this->get_plugin_name(), $this->get_version()); $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles'); $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts'); $this->loader->add_action('admin_menu', $plugin_admin, 'add_real_estate_settings'); $this->loader->add_action('admin_init', $plugin_admin, 'initialize_price_format_options'); $this->loader->add_action('admin_init', $plugin_admin, 'initialize_url_slugs_options'); $this->loader->add_filter('plugin_action_links_' . INSPIRY_REAL_ESTATE_PLUGIN_BASENAME, $plugin_admin, 'inspiry_real_estate_action_links'); // Filters to modify URL slugs $this->loader->add_filter('inspiry_property_slug', $this, 'modify_property_slug'); $this->loader->add_filter('inspiry_property_type_slug', $this, 'modify_property_type_slug'); $this->loader->add_filter('inspiry_property_status_slug', $this, 'modify_property_status_slug'); $this->loader->add_filter('inspiry_property_city_slug', $this, 'modify_property_city_slug'); $this->loader->add_filter('inspiry_property_feature_slug', $this, 'modify_property_feature_slug'); $this->loader->add_filter('inspiry_agent_slug', $this, 'modify_agent_slug'); // Property Post Type $property_post_type = new Inspiry_Property_Post_Type(); $this->loader->add_action('init', $property_post_type, 'register_property_post_type'); $this->loader->add_action('init', $property_post_type, 'register_property_type_taxonomy'); $this->loader->add_action('init', $property_post_type, 'register_property_status_taxonomy'); $this->loader->add_action('init', $property_post_type, 'register_property_city_taxonomy'); $this->loader->add_action('init', $property_post_type, 'register_property_feature_taxonomy'); $this->loader->add_filter('rwmb_meta_boxes', $property_post_type, 'register_meta_boxes'); $this->loader->add_filter('add_meta_boxes', $property_post_type, 'add_payment_meta_box'); $this->loader->add_filter('posts_join', $property_post_type, 'join_post_meta_table'); $this->loader->add_filter('posts_where', $property_post_type, 'add_property_id_in_search'); $this->loader->add_filter('posts_groupby', $property_post_type, 'group_by_properties'); // Agent Post Type $agent_post_type = new Inspiry_Agent_Post_Type(); $this->loader->add_action('init', $agent_post_type, 'register_agent_post_type'); $this->loader->add_filter('rwmb_meta_boxes', $agent_post_type, 'register_meta_boxes'); // Partner Post Type $partner_post_type = new Inspiry_Partner_Post_Type(); $this->loader->add_action('init', $partner_post_type, 'register_partner_post_type'); $this->loader->add_filter('rwmb_meta_boxes', $partner_post_type, 'register_meta_boxes'); if (is_admin()) { global $pagenow; // property custom columns if ($pagenow == 'edit.php' && isset($_GET['post_type']) && esc_attr($_GET['post_type']) == 'property') { $this->loader->add_filter('manage_edit-property_columns', $property_post_type, 'register_custom_column_titles'); $this->loader->add_action('manage_pages_custom_column', $property_post_type, 'display_custom_column'); } // agent custom columns if ($pagenow == 'edit.php' && isset($_GET['post_type']) && esc_attr($_GET['post_type']) == 'agent') { $this->loader->add_filter('manage_edit-agent_columns', $agent_post_type, 'register_custom_column_titles'); $this->loader->add_action('manage_posts_custom_column', $agent_post_type, 'display_custom_column'); } // partner custom columns if ($pagenow == 'edit.php' && isset($_GET['post_type']) && esc_attr($_GET['post_type']) == 'partners') { $this->loader->add_filter('manage_edit-partners_columns', $partner_post_type, 'register_custom_column_titles'); $this->loader->add_action('manage_posts_custom_column', $partner_post_type, 'display_custom_column'); } } // Additional details meta box $additional_details_meta_box = Additional_Details_Meta_Box::get_instance(); $this->loader->add_action('add_meta_boxes', $additional_details_meta_box, 'add_additional_details_meta_box'); $this->loader->add_action('save_post', $additional_details_meta_box, 'save_additional_details'); }