/** * Whitelist options * * @access public * @return void */ function sc_chat_register_options() { if (false === sc_chat_get_options()) { add_option('sc_chat_opts', sc_chat_get_default_options()); } register_setting('sc_chat_opt_group_general', 'sc_chat_opts', 'sc_chat_options_validate'); register_setting('sc_chat_opt_group_customize_skin', 'sc_chat_opts', 'sc_chat_options_validate'); register_setting('sc_chat_opt_group_messages', 'sc_chat_opts', 'sc_chat_options_validate'); /** * SECTION: General **/ add_settings_section('general', __('General Settings', 'sc_chat'), '__return_false', 'sc_chat_opts_slug_general'); /** * SECTION: Offline messages **/ add_settings_section('offline_msg', __('Offline Messages', 'sc_chat'), '__return_false', 'sc_chat_opts_slug_general'); /** * SECTION: Users & Visitors **/ add_settings_section('users', __('Users & Visitors', 'sc_chat'), '__return_false', 'sc_chat_opts_slug_general'); /** * SECTION: Customize Skin **/ add_settings_section('customize_skin', __('Customize Skin', 'sc_chat'), '__return_false', 'sc_chat_opts_slug_customize_skin'); /** * SECTION: Colors **/ add_settings_section('colors', __('Colors', 'sc_chat'), '__return_false', 'sc_chat_opts_slug_customize_skin'); /** * SECTION: Sound **/ add_settings_section('sound', __('Sound', 'sc_chat'), '__return_false', 'sc_chat_opts_slug_customize_skin'); /** * SECTION: Messages **/ add_settings_section('messages', __('Messages', 'sc_chat'), '__return_false', 'sc_chat_opts_slug_customize_messages'); /** * SECTION: Forms **/ add_settings_section('forms', __('Forms', 'sc_chat'), '__return_false', 'sc_chat_opts_slug_customize_messages'); /** * SECTION: Advanced **/ add_settings_section('advanced', __('Advanced', 'sc_chat'), '__return_false', 'sc_chat_opts_slug_general'); // Hide chatbox add_settings_field('sc_chat_display_chatbox', __('Display chatbox automatically', 'sc_chat'), 'sc_chat_render_display_chatbox', 'sc_chat_opts_slug_general', 'general'); // Hide When Offline add_settings_field('sc_chat_hide_chat_when_offline', __('Hide When Offline', 'sc_chat'), 'sc_chat_render_hide_chat_when_offline', 'sc_chat_opts_slug_general', 'general'); // Always show in homepage add_settings_field('sc_chat_always_show_homepage', __('Always show in homepage', 'sc_chat'), 'sc_chat_render_always_show_homepage', 'sc_chat_opts_slug_general', 'general'); // Disable in mobile devices add_settings_field('sc_chat_disable_in_mobile', __('Disable in mobile devices', 'sc_chat'), 'sc_chat_render_disable_in_mobile', 'sc_chat_opts_slug_general', 'general'); // Where should offline messages go? add_settings_field('sc_chat_offline_msg_email', __('Where should offline messages go?', 'sc_chat'), 'sc_chat_render_offline_msg_email', 'sc_chat_opts_slug_general', 'offline_msg'); // Get notifications by email add_settings_field('sc_chat_get_notifications', __('Get notifications by email', 'sc_chat'), 'sc_chat_render_get_notifications', 'sc_chat_opts_slug_general', 'offline_msg'); // Allowed visitors at one time add_settings_field('sc_chat_allowed_visitors', __('Allowed visitors at one time', 'sc_chat'), 'sc_chat_render_allowed_visitors', 'sc_chat_opts_slug_general', 'users'); // Operator additional role add_settings_field('sc_chat_op_role', __('Operator Additional Role', 'sc_chat'), 'sc_chat_render_op_role', 'sc_chat_opts_slug_general', 'users'); // Position add_settings_field('sc_chat_position', __('Position', 'sc_chat'), 'sc_chat_render_position', 'sc_chat_opts_slug_customize_skin', 'customize_skin'); // Offset add_settings_field('sc_chat_offset', __('Offset', 'sc_chat'), 'sc_chat_render_offset', 'sc_chat_opts_slug_customize_skin', 'customize_skin'); // Use CSS3 Animations add_settings_field('sc_chat_use_css_anim', __('CSS Animations', 'sc_chat'), 'sc_chat_render_use_css_anim', 'sc_chat_opts_slug_customize_skin', 'customize_skin'); // Ask for name add_settings_field('sc_chat_ask_name_field', __('Ask for name?', 'sc_chat'), 'sc_chat_render_ask_name_field', 'sc_chat_opts_slug_customize_skin', 'customize_skin'); // Ask for phone field add_settings_field('sc_chat_ask_phone_field', __('Ask for phone field?', 'sc_chat'), 'sc_chat_render_ask_phone_field', 'sc_chat_opts_slug_customize_skin', 'customize_skin'); // Delay add_settings_field('sc_chat_delay', __('Delay', 'sc_chat'), 'sc_chat_render_delay', 'sc_chat_opts_slug_customize_skin', 'customize_skin'); // Skin Box Width add_settings_field('sc_chat_skin_box_width', __('Width', 'sc_chat'), 'sc_chat_render_skin_box_width', 'sc_chat_opts_slug_customize_skin', 'customize_skin'); // Skin Box Height add_settings_field('sc_chat_skin_box_height', __('Height', 'sc_chat'), 'sc_chat_render_skin_box_height', 'sc_chat_opts_slug_customize_skin', 'customize_skin'); // Default radius add_settings_field('sc_chat_default_radius', __('Default Radius', 'sc_chat'), 'sc_chat_render_default_radius', 'sc_chat_opts_slug_customize_skin', 'customize_skin'); // Load default skin CSS file add_settings_field('sc_chat_load_skin_css', __('Load default skin CSS file', 'sc_chat'), 'sc_chat_render_load_skin_css', 'sc_chat_opts_slug_customize_skin', 'customize_skin'); // Compress CSS file add_settings_field('sc_chat_compress_css', __('Compress CSS', 'sc_chat'), 'sc_chat_render_compress_css', 'sc_chat_opts_slug_customize_skin', 'customize_skin'); // Compress JS file add_settings_field('sc_chat_compress_js', __('Compress JavaScript file', 'sc_chat'), 'sc_chat_render_compress_js', 'sc_chat_opts_slug_customize_skin', 'customize_skin'); // Custom CSS add_settings_field('sc_chat_custom_css', __('Custom CSS', 'sc_chat'), 'sc_chat_render_custom_css', 'sc_chat_opts_slug_customize_skin', 'customize_skin'); // Skin Type add_settings_field('sc_chat_skin_type', __('Skin Type', 'sc_chat'), 'sc_chat_render_skin_type', 'sc_chat_opts_slug_customize_skin', 'colors'); // Skin Chat Box Background add_settings_field('sc_chat_skin_chatbox_bg', __('Chat Box Background', 'sc_chat'), 'sc_chat_render_skin_chatbox_bg', 'sc_chat_opts_slug_customize_skin', 'colors'); // Skin Chat Box Foreground add_settings_field('sc_chat_skin_chatbox_fg', __('Chat Box Foreground', 'sc_chat'), 'sc_chat_render_skin_chatbox_fg', 'sc_chat_opts_slug_customize_skin', 'colors'); // Skin Header Background add_settings_field('sc_chat_skin_header_bg', __('Header Background', 'sc_chat'), 'sc_chat_render_skin_header_bg', 'sc_chat_opts_slug_customize_skin', 'colors'); // Skin Header Forefround add_settings_field('sc_chat_skin_header_fg', __('Header Foreground', 'sc_chat'), 'sc_chat_render_skin_header_fg', 'sc_chat_opts_slug_customize_skin', 'colors'); // Skin Submit Button Background add_settings_field('sc_chat_skin_submit_btn_bg', __('Submit Button Background', 'sc_chat'), 'sc_chat_render_skin_submit_btn_bg', 'sc_chat_opts_slug_customize_skin', 'colors'); // Skin Submit Button Foreground add_settings_field('sc_chat_skin_submit_btn_fg', __('Submit Button Foreground', 'sc_chat'), 'sc_chat_render_skin_submit_btn_fg', 'sc_chat_opts_slug_customize_skin', 'colors'); // Skin Mute Sound add_settings_field('sc_chat_mute_sound', __('Mute sound', 'sc_chat'), 'sc_chat_render_mute_sound', 'sc_chat_opts_slug_customize_skin', 'sound'); // Before chat header add_settings_field('sc_chat_before_chat_header', __('Before Chat Header', 'sc_chat'), 'sc_chat_render_before_chat_header', 'sc_chat_opts_slug_customize_messages', 'messages'); // In chat header add_settings_field('sc_chat_in_chat_header', __('In Chat Header', 'sc_chat'), 'sc_chat_render_in_chat_header', 'sc_chat_opts_slug_customize_messages', 'messages'); // Welcome Message (Pre-chat) add_settings_field('sc_chat_prechat_welcome_msg', __('Welcome Message (Pre-chat)', 'sc_chat'), 'sc_chat_render_prechat_welcome_msg', 'sc_chat_opts_slug_customize_messages', 'messages'); // Welcome Message (During chat) add_settings_field('sc_chat_welcome_msg', __('Welcome Message (During chat)', 'sc_chat'), 'sc_chat_render_welcome_msg', 'sc_chat_opts_slug_customize_messages', 'messages'); // Offline Header add_settings_field('sc_chat_offline_header', __('Offline Header', 'sc_chat'), 'sc_chat_render_offline_header', 'sc_chat_opts_slug_customize_messages', 'messages'); // Offline Body add_settings_field('sc_chat_offline_body', __('Offline Body', 'sc_chat'), 'sc_chat_render_offline_body', 'sc_chat_opts_slug_customize_messages', 'messages'); // End chat add_settings_field('sc_chat_end_chat_field', __('End chat', 'sc_chat'), 'sc_chat_render_end_chat_field', 'sc_chat_opts_slug_customize_messages', 'messages'); // Name field add_settings_field('sc_chat_name_field', __('Name Field', 'sc_chat'), 'sc_chat_render_name_field', 'sc_chat_opts_slug_customize_messages', 'forms'); // E-mail field add_settings_field('sc_chat_email_field', __('E-mail Field', 'sc_chat'), 'sc_chat_render_email_field', 'sc_chat_opts_slug_customize_messages', 'forms'); // Phone field add_settings_field('sc_chat_phone_field', __('Phone Field', 'sc_chat'), 'sc_chat_render_phone_field', 'sc_chat_opts_slug_customize_messages', 'forms'); // Question field add_settings_field('sc_chat_question_field', __('Question Field', 'sc_chat'), 'sc_chat_render_question_field', 'sc_chat_opts_slug_customize_messages', 'forms'); // Required text add_settings_field('sc_chat_req_text', __('Required text', 'sc_chat'), 'sc_chat_render_req_text', 'sc_chat_opts_slug_customize_messages', 'forms'); // Chat Button add_settings_field('sc_chat_chat_btn', __('Chat Button', 'sc_chat'), 'sc_chat_render_chat_btn', 'sc_chat_opts_slug_customize_messages', 'forms'); // Send Button add_settings_field('sc_chat_send_btn', __('Send Button', 'sc_chat'), 'sc_chat_render_send_btn', 'sc_chat_opts_slug_customize_messages', 'forms'); // Input box placeholder add_settings_field('sc_chat_input_box_placeholder', __('Input Box Placeholder', 'sc_chat'), 'sc_chat_render_input_box_placeholder', 'sc_chat_opts_slug_customize_messages', 'forms'); // Input Box Message add_settings_field('sc_chat_input_box_msg', __('Input Box Message', 'sc_chat'), 'sc_chat_render_input_box_msg', 'sc_chat_opts_slug_customize_messages', 'forms'); // Item Purchase Key add_settings_field('sc_chat_purchase_key', __('Item Purchase Key', 'sc_chat'), 'sc_chat_render_purchase_key', 'sc_chat_opts_slug_general', 'advanced'); }
/** * Add Compatibility for various bits * * @access public * @return void */ function compatibility() { global $sc_chat_default_opts; // First we check if our default plugin have been applied. $the_plugin_status = get_option('sc_chat_setup_status'); // Get current plugin version $current_version = get_option('sc_chat_plugin_version'); // If new version installed, upgrade the plugin if (empty($current_version) or version_compare($current_version, $this->version, '<')) { $this->upgrade($current_version); // Save new version into DB update_option('sc_chat_plugin_version', $this->version); } // If the settings has not yet been used we want to run our default settings. if ($the_plugin_status != '1') { // Setup default theme settings add_option('sc_chat_opts', sc_chat_get_default_options($sc_chat_default_opts)); // Once done, we register our setting to make sure we don't duplicate everytime we activate. update_option('sc_chat_setup_status', '1'); } }