array('title'=>'Accordion Options', 'type'=>'separator', 'colspan'=>'6'), 'accordion_display_mode' => array( 'name' => 'accordion_display_mode', 'label' => 'Accordion mode while loading', 'type' => 'select', 'options' => array( 'open_first' => 'Open first faq', 'close_all' => 'Close all faqs', ), 'value' => 'open_first', ), 'faq_border_radius' => array( 'name' => 'faq_border_radius', 'label' => 'FAQs border radius', 'type' => 'number', 'value' => 6, ), 'open_multiple_faqs' => array( 'name' => 'open_multiple_faqs', 'label' => 'Keep multiple faq tab open on click.', 'type' => 'switch', 'value' => 'yes', 'checked' => 0, ), 'show_updated_date' =>array( 'name' => 'show_updated_date', 'label' => 'Display faq updated date.', 'type' => 'switch', 'value' => 'yes', 'checked' => 0, ), 'like_and_dislike_option' =>array( 'name' => 'like_and_dislike_option', 'label' => 'Like/Dislike option.', 'type' => 'switch', 'value' => 'yes', 'checked' => 0, ), 'section_display_settings' => array('title'=>'Display Settings', 'type'=>'separator', 'colspan'=>'6'), 'display_settings_subtitle' => array('title'=>'Apply Display Color for FAQs. Colors can be also set for Individual FAQs at Corresponding FAQ.', 'type'=>'subtitle', 'colspan'=>'6'), 'title_color' => array( 'name' => 'title_color', 'label' => 'Title text color', 'type' => 'colorpicker', 'value' => '#000000', ), 'title_bg_color' => array( 'name' => 'title_bg_color', 'label' => 'Title background color', 'type' => 'colorpicker', 'value' => '#dae6ed', ), 'content_color' => array( 'name' => 'content_color', 'label' => 'Content text color', 'type' => 'colorpicker', 'value' => '#000000', ), 'content_bg_color' => array( 'name' => 'content_bg_color', 'label' => 'Content background color', 'type' => 'colorpicker', 'value' => '#f3f8fb', ), 'expnd_icon_color' => array( 'name' => 'expnd_icon_color', 'label' => 'Expand & collapse Icon color', 'type' => 'colorpicker', 'value' => '#000000', ), 'section_social_share_settings' => array('title'=>'Social Share Settings', 'type'=>'separator', 'colspan'=>'6'), 'enable_share_button' =>array( 'name' => 'enable_share_button', 'label' => 'Enable social share option for faqs', 'type' => 'switch', 'value' => 'yes', 'checked' => 0, 'onchange' => 'thfaqfEnableDisableSocialShare(this)', ), 'social_share_title' => array( 'name' => 'social_share_title', 'label' => 'Share button title', 'type' => 'text', 'class' => array('social-share-field'), 'value' => '', ), 'social_share_options' =>array( 'name' => 'social_share_options', 'label' => 'Add share buttons', 'type' => 'multiselect', 'options' => array( 'facebook' => 'Facebook', 'twitter' => 'Twitter', 'linkedin' => 'Linkedin', 'email' => 'Email', ), 'class' => array('social-share-field-multiselect'), 'value' => '', ), 'expand_style' => array( 'name' =>'expand_style', 'label' => 'Expand & collapse icon style', 'type' => 'radio_btn', 'icon_path' => array('images-arrow.svg','plus-minus.svg'), 'class' => array('thfaq-input-hidden-field'), 'ids' => array('Drop arrow','+ or -',), 'rvalue' => array('thfaq-arrow','thfaq-marker',), 'value' => 'thfaq-marker', ), ); } public static function get_settings_override_fields(){ return array( 'title_color' => array( 'name' => 'title_color', 'label' => 'Title text', 'type' => 'colorpicker', 'value' => '#000000', ), 'title_bg_color' => array( 'name' => 'title_bg_color', 'label' => 'Title Background', 'type' => 'colorpicker', 'value' => '#dae6ed', ), 'content_color' => array( 'name' => 'content_color', 'label' => 'Content Text', 'type' => 'colorpicker', 'value' => '#000000', ), 'content_bg_color' => array( 'name' => 'content_bg_color', 'label' => 'Content Background', 'type' => 'colorpicker', 'value' => '#f3f8fb', ), 'expnd_icon_color' => array( 'name' => 'expnd_icon_color', 'label' => 'Expand & collapse Icon color', 'type' => 'colorpicker', 'value' => '#000000', ), ); } public static function save_faq_settings($settings){ $result = update_option(self::OPTION_KEY_FAQ_SETTINGS, $settings); return $result; } public static function delete_faq_settings(){ $result = delete_option(self::OPTION_KEY_FAQ_SETTINGS); return $result; } public static function get_faq_settings($load_defaults=true,$index = '',$deflt = ''){ $settings = get_option(self::OPTION_KEY_FAQ_SETTINGS); if(empty($settings) && $load_defaults){ $settings = self::prepare_default_settings(); } if($index){ $settings = isset($settings[$index]) ? $settings[$index] : $deflt; } return empty($settings) ? false : $settings; } public static function get_settings($key){ $settings = self::get_faq_settings(); if(is_array($settings) && isset($settings[$key])){ return $settings[$key]; } return ''; } public static function get_setting_value($settings, $key){ if(is_array($settings) && isset($settings[$key])){ return $settings[$key]; } return ''; } public static function prepare_default_settings(){ $settings = array(); $settings_fields = self::get_settings_fields(); foreach($settings_fields as $key => $field){ $type = isset($field['type']) ? $field['type'] : 'text'; if($type != 'separator' && $type != 'subtitle'){ if($type === 'checkbox' || $type === 'switch'){ $settings[$key] = isset($field['checked']) && $field['checked'] ? 'yes' : ''; }else{ $settings[$key] = isset($field['value']) ? $field['value'] : false; } } } return $settings; } public static function check_premium_plugn_actve(){ if(is_plugin_active('advanced-faq-manager-pro/advanced-thfaq-manager-pro.php')){ $data = 'active'; }else{ $data = 'deactivate'; } return $data; } public static function write_log( $log=false ){ if( true === WP_DEBUG ){ if( is_array( $log ) || is_object( $log ) ){ error_log( print_r( $log, true ) ); }else{ error_log( $log ); } } } } endif;