id = 'general';
$this->label = __( 'General', 'propertyhive' );
add_filter( 'propertyhive_settings_tabs_array', array( $this, 'add_settings_page' ), 5 );
add_action( 'propertyhive_sections_' . $this->id, array( $this, 'output_sections' ) );
add_action( 'propertyhive_settings_' . $this->id, array( $this, 'output' ) );
add_action( 'propertyhive_settings_save_' . $this->id, array( $this, 'save' ) );
}
/**
* Get sections
*
* @return array
*/
public function get_sections() {
$sections = array(
'' => __( 'General', 'propertyhive' ),
'modules' => __( 'Modules', 'propertyhive' ),
'international' => __( 'International', 'propertyhive' ),
'map' => __( 'Map', 'propertyhive' ),
'gdpr' => __( 'GDPR', 'propertyhive' ),
'misc' => __( 'Miscellaneous', 'propertyhive' ),
);
return $sections;
}
/**
* Get general settings array
*
* @return array
*/
public function get_settings() {
$departments = ph_get_departments();
$settings = array(
array( 'title' => __( 'General Options', 'propertyhive' ), 'type' => 'title', 'desc' => '', 'id' => 'general_options' ),
);
$i = 0;
foreach ( $departments as $key => $value )
{
$checkboxgroup = 'middle';
if ( $i == 0 ) { $checkboxgroup = 'start'; }
if ( $i == (count($departments) - 1) ) { $checkboxgroup = 'end'; }
$settings[] = array(
'title' => __( 'Active Departments', 'propertyhive' ),
'desc' => $value,
'id' => 'propertyhive_active_departments_' . str_replace("residential-", "", $key),
'type' => 'checkbox',
'default' => ( ( in_array($key, array('residential-sales', 'residential-lettings', 'commercial')) ) ? 'yes' : '' ),
'checkboxgroup' => $checkboxgroup,
);
++$i;
}
$settings[] = array(
'title' => __( 'Primary Department', 'propertyhive' ),
'id' => 'propertyhive_primary_department',
'type' => 'radio',
'default' => 'residential-sales',
'options' => $departments,
);
$settings[] = array(
'title' => __( 'Property Search Results Page', 'propertyhive' ),
//'desc' => '
' . sprintf( __( 'The base page can also be used in your product permalinks.', 'propertyhive' ), admin_url( 'options-permalink.php' ) ),
'id' => 'propertyhive_search_results_page_id',
'type' => 'single_select_page',
'default' => '',
'css' => 'min-width:300px;',
'desc' => __( 'This sets the page of your property search results', 'propertyhive' ),
);
$settings[] = array(
'title' => __( 'Lettings Fees (Residential)', 'propertyhive' ),
'id' => 'propertyhive_lettings_fees',
'type' => 'textarea',
'css' => 'height:150px; width:100%; max-width:400px'
);
$settings[] = array(
'title' => __( 'Lettings Fees (Commercial)', 'propertyhive' ),
'id' => 'propertyhive_lettings_fees_commercial',
'type' => 'textarea',
'css' => 'height:150px; width:100%; max-width:400px'
);
$settings[] = array(
'title' => __( 'Display Link To Lettings Fees Next To Price', 'propertyhive' ),
'desc' => __( 'In Search Results', 'propertyhive' ),
'id' => 'propertyhive_lettings_fees_display_search_results',
'type' => 'checkbox',
'checkboxgroup' => 'start',
);
$settings[] = array(
'title' => __( 'Display Link To Lettings Fees Next To Price', 'propertyhive' ),
'desc' => __( 'On Property Details Page', 'propertyhive' ),
'id' => 'propertyhive_lettings_fees_display_single_property',
'type' => 'checkbox',
'checkboxgroup' => 'end',
);
$settings[] = array( 'type' => 'sectionend', 'id' => 'general_options');
return apply_filters( 'propertyhive_general_settings', $settings );
}
/**
* Get general modules settings array
*
* @return array
*/
public function get_general_modules_setting() {
return apply_filters( 'propertyhive_general_modules_settings', array(
array( 'title' => __( 'Disabled Modules', 'propertyhive' ), 'type' => 'title', 'desc' => '', 'id' => 'modules_options' ),
array(
'type' => 'html',
'html' => __( 'Here you can choose which modules are enabled or disabled within Property Hive. Check the modules you DO NOT wish to use from the list below', 'propertyhive' ) . ':',
),
array(
'title' => __( 'Disabled Modules', 'propertyhive' ),
'desc' => __( 'Contacts (Applicants, Owners/Landlords and Third Party Contacts)', 'propertyhive' ),
'id' => 'propertyhive_module_disabled_contacts',
'type' => 'checkbox',
'default' => '',
'checkboxgroup' => 'start'
),
array(
'title' => __( 'Disabled Modules', 'propertyhive' ),
'desc' => __( 'Appraisals', 'propertyhive' ),
'id' => 'propertyhive_module_disabled_appraisals',
'type' => 'checkbox',
'default' => '',
'checkboxgroup' => 'middle'
),
array(
'title' => __( 'Disabled Modules', 'propertyhive' ),
'desc' => __( 'Viewings', 'propertyhive' ),
'id' => 'propertyhive_module_disabled_viewings',
'type' => 'checkbox',
'default' => '',
'checkboxgroup' => 'middle'
),
array(
'title' => __( 'Disabled Modules', 'propertyhive' ),
'desc' => __( 'Offers and Sales', 'propertyhive' ),
'id' => 'propertyhive_module_disabled_offers_sales',
'type' => 'checkbox',
'default' => '',
'checkboxgroup' => 'middle'
),
array(
'title' => __( 'Disabled Modules', 'propertyhive' ),
'desc' => __( 'Enquiries', 'propertyhive' ),
'id' => 'propertyhive_module_disabled_enquiries',
'type' => 'checkbox',
'default' => '',
'checkboxgroup' => 'end'
),
array( 'type' => 'sectionend', 'id' => 'modules_options'),
) ); // End general module settings
}
/**
* Get international settings array
*
* @return array
*/
public function get_general_international_setting() {
$settings = array(
array( 'title' => __( 'International Options', 'propertyhive' ), 'type' => 'title', 'desc' => '', 'id' => 'international_options' ),
array(
'title' => __( 'Default Country', 'propertyhive' ),
'id' => 'propertyhive_default_country',
'type' => 'single_select_country',
'css' => 'min-width:300px;',
),
array(
'title' => __( 'Countries Where You Operate', 'propertyhive' ),
'id' => 'propertyhive_countries',
'type' => 'multi_select_countries',
'css' => 'min-width:300px;',
'desc' => __( 'Hold ctrl/cmd whilst clicking to select multiple', 'propertyhive' )
),
array(
'title' => __( 'Price Thousand Separator', 'propertyhive' ),
'id' => 'propertyhive_price_thousand_separator',
'type' => 'text',
'default' => ',',
'css' => 'width:50px;',
),
array(
'title' => __( 'Price Decimal Separator', 'propertyhive' ),
'id' => 'propertyhive_price_decimal_separator',
'type' => 'text',
'default' => '.',
'css' => 'width:50px;',
)
);
$ph_countries = new PH_Countries();
$ph_countries = $ph_countries->countries;
$currencies = array();
$countries = array();
if ( !empty($ph_countries) )
{
foreach ( $ph_countries as $country_code => $country )
{
$currencies[$country['currency_code']] = $country['currency_code'];
$countries[$country_code] = $country;
}
}
$currencies = array_unique($currencies);
ksort($currencies);
$settings[] = array(
'title' => __( 'Currency Used In Search Forms', 'propertyhive' ),
'id' => 'propertyhive_search_form_currency',
'type' => 'select',
'options' => $currencies,
'default' => 'GBP',
'desc' => __( 'Please note that this doesn\'t change the currency symbol shown in price dropdowns within search forms. The easiest way to achieve that is to use our free Template Assistant add on.', 'propertyhive' ),
);
$settings[] = array( 'type' => 'sectionend', 'id' => 'international_options');
$settings[] = array(
'type' => 'html',
'html' => ''
);
return apply_filters( 'propertyhive_general_international_settings', $settings );
}
/**
* Get map settings array
*
* @return array
*/
public function get_general_map_setting() {
$settings = array(
array( 'title' => __( 'Map Options', 'propertyhive' ), 'type' => 'title', 'desc' => '', 'id' => 'map_options' ),
array(
'title' => __( 'Google Maps API Key', 'propertyhive' ),
'id' => 'propertyhive_google_maps_api_key',
'type' => 'text',
'desc' => '
' . __( 'If you have a Google Maps API key you can enter it here. You can generate an API key here.
This is used when displaying the map when adding/editing properties, and if using our Map Search or Radial Search add ons.
When creating your API key we recommend that you enable the Geocoding library. More about this can be found here.', 'propertyhive' ) . '
' . __( 'If you have referer restrictions applied to the main API key entered then server side geocoding requests will be blocked. To get around this you can setup a separate API key specifically for geocoding and enter it here, with IP restrictions applied instead if required.
More about this can be found here.', 'propertyhive' ) . '
' . __( 'When a maximum price is entered against an applicants requirements we create a \'Match Price Range\' which determines the price of properties that would get matched to the applicant.
We do this because you:
a) Wouldn\'t want to send them properties that were way below their specified maximum price and
b) Would probably want to send them properties which are slightly just over the price specified as, if the perfect property came along, a lot of people would actually be able to increase their maximum.
These settings determine the % above and below the maximum price entered that the \'Match Price Range\' will default to per applicant.
For example, if the maximum price entered was £500,000, the lower setting was 20% and the higher setting was 5%, the applicant would actually match to properties that were priced £400,000 - £525,000.
This price range can be overwritten on a per-applicant basis, or disabled completely by leaving these settings empty.
Note that this currently only applies to applicants looking for sales properties and changing this value at a later date will only effect applicants that don\'t already have a match price range set.', 'propertyhive' ) . '