public function __construct($post) { $epl_posts = array('property', 'land', 'commercial', 'business', 'commercial_land', 'location_profile', 'rental', 'rural'); $this->post = $post; $this->epl_settings = epl_settings(); $this->meta = get_post_custom(); $this->post_type = $this->post->post_type; $this->property_post_type = $this->post->post_type; $this->epl_labels(); }
/** * Delete plugin settings * @since 2.0.0 **/ function epl_am_uninstall() { global $wpdb, $epl_options; $epl_settings = epl_settings(); $new_fields_defaults = array('epl_am_custom_marker' => '0', 'epl_am_map_enable' => '1', 'epl_am_single_tab_position' => '1', 'epl_am_single_map_height' => '400', 'epl_am_infobox_position' => 'left', 'epl_am_default_map_type' => 'SATELLITE', 'epl_am_infobox_style' => 'rounded', 'epl_am_disable_mousescroll' => 0, 'epl_am_enable_sat_view' => 1, 'epl_am_enable_street_view' => 0, 'epl_am_enable_transit_view' => 1, 'epl_am_enable_bike_view' => 1, 'epl_am_enable_comparables_view' => 1, 'epl_slider_eam_mode' => 'false'); foreach ($new_fields_defaults as $key => &$value) { if (isset($epl_settings[$key])) { unset($epl_settings[$key]); } } update_option('epl_settings', $epl_settings); }
/** * Install * * Runs on plugin install by setting up the current version, * flushing rewrite rules to initiate the new 'property' slug and also * creates the plugin and populates the settings fields for those plugin * pages. After successful install, the user is redirected to the EPL Welcome * screen. * * @since 1.0 * @global $wpdb * @global $epl_options * @global $wp_version * @return void */ function epl_install() { global $wpdb, $epl_options, $wp_version; // Clear the permalinks flush_rewrite_rules(); // Add default EPL Settings $epl_settings = epl_settings(); $new_fields_defaults = array('currency' => 'AUD', 'currency_position' => 'before', 'currency_thousands_separator' => ',', 'currency_decimal_separator' => '.', 'admin_unique_id' => 0, 'debug' => 0, 'display_bond' => 0, 'display_single_gallery' => 0, 'display_gallery_n' => 4, 'display_feature_columns' => 2, 'display_excerpt_length' => 10, 'display_archive_view_type' => 'list', 'use_fancy_navigation' => 0, 'label_bond' => __('Bond', 'epl'), 'label_location' => __('Suburb', 'epl'), 'label_suburb' => __('Suburb', 'epl'), 'label_city' => __('City', 'epl'), 'label_state' => __('State', 'epl'), 'label_postcode' => __('Post Code', 'epl'), 'label_home_open' => __('Home Open', 'epl'), 'label_poa' => __('POA', 'epl'), 'label_new' => __('New', 'epl'), 'label_under_offer' => __('Under Offer', 'epl'), 'label_leased' => __('Leased', 'epl'), 'label_sold' => __('Sold', 'epl'), 'widget_label_property' => __('Buy', 'epl'), 'widget_label_land' => __('Land', 'epl'), 'widget_label_rental' => __('Rent', 'epl'), 'widget_label_rural' => __('Rural', 'epl'), 'widget_label_business' => __('Business', 'epl'), 'widget_label_commercial' => __('Commercial', 'epl'), 'widget_label_commercial_land' => __('Commercial Land', 'epl'), 'epl_max_graph_sales_price' => 2000000, 'epl_max_graph_rent_price' => 2000, 'sticker_new_range' => 7, 'epl_admin_thumb_size' => 'admin-list-thumb', 'epl_enable_city_field' => 'no', 'epl_enable_country_field' => 'no', 'epl_feeling_lucky' => 'off', 'epl_lucky_disable_single_thumb' => 'off', 'epl_lucky_disable_theme_single_thumb' => 'off', 'epl_lucky_disable_archive_thumb' => 'off', 'epl_lucky_disable_epl_archive_thumb' => 'off', 'epl_use_core_css' => 'off', 'uninstall_on_delete' => 0); if (!empty($epl_settings)) { // possible upgrade foreach ($new_fields_defaults as $key => $value) { if (!isset($epl_settings[$key])) { // sure upgrade, fields are not set lets set them for very first time $epl_settings[$key] = $value; } } } else { // first time install . load with default values. $epl_settings = $new_fields_defaults; } update_option('epl_settings', $epl_settings); // Add Upgraded From Option $current_version = get_option('epl_version'); if ($current_version != '') { update_option('epl_version_upgraded_from', $current_version); } else { $epl_data = get_plugin_data(EPL_PLUGIN_PATH . '/easy-property-listings.php'); update_option('epl_version', $epl_data['Version']); } // Bail if activating from network, or bulk if (is_network_admin() || isset($_GET['activate-multi'])) { return; } // Add the transient to redirect set_transient('_epl_activation_redirect', true, 30); }
<?php $epl_settings = epl_settings(); $new_fields_defaults = array('label_city' => __('City', 'epl'), 'label_state' => __('State', 'epl'), 'epl_feeling_lucky' => 'off', 'epl_lucky_disable_single_thumb' => 'off', 'epl_lucky_disable_theme_single_thumb' => 'off', 'epl_lucky_disable_archive_thumb' => 'off', 'epl_lucky_disable_epl_archive_thumb' => 'off', 'display_archive_view_type' => 'list', 'use_fancy_navigation' => 0, 'epl_enable_city_field' => 'no', 'epl_enable_country_field' => 'no', 'epl_use_core_css' => 'off', 'uninstall_on_delete' => 'no'); foreach ($new_fields_defaults as $key => $value) { if (!isset($epl_settings[$key])) { // sure upgrade, fields are not set lets set them for very first time $epl_settings[$key] = $value; } } update_option('epl_settings', $epl_settings);