Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save wolfcoder/1755996ee723537786d3c2c52a6065cb to your computer and use it in GitHub Desktop.
Save wolfcoder/1755996ee723537786d3c2c52a6065cb to your computer and use it in GitHub Desktop.
<?php
class RT_Settings {
function __construct() {
add_action( "rentalist_save_settings", array( $this, "rentalist_save_settings_func" ), 10, 1 );
}
function rentalist_save_settings_func( $params = array() ) {
if ( isset( $params['rentalist_setting'] ) && $params['rentalist_setting'] != '' ) {
unset( $params['rentalist_setting_save'] );
unset( $params['rentalist_setting'] );
update_option( 'rentalist_setting', $params );
$_SESSION['vap_cfg_msg_status'] = true;
$_SESSION['vap_cfg_msg'] = 'Settings updated successfully.';
}
}
function vap_default_setting_option() {
return array(
'rt_api_url' => '',
'rt_api_key' => ''
);
}
function vap_get_settings_func() {
$ncm_default_general_option = $this->vap_default_setting_option();
$ncm_setting_option = get_option( 'rentalist_setting' );
return shortcode_atts( $ncm_default_general_option, $ncm_setting_option );
}
function rt_display_settings() {
include_once( RENTALIST_DIR . "/includes/rt_settings.view.php" );
}
}
//global $rt_settings;
$rt_settings = new RT_Settings();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment