<?php

if (!function_exists('add_filter')) {
    exit;
}
global $hocwp_tos_tabs;
$parent_slug = 'hocwp_theme_option';
$option = new HOCWP_Option(__('Socials', 'hocwp-theme'), 'hocwp_option_social');
$option->set_parent_slug($parent_slug);
$option->set_use_style_and_script(true);
$option->add_section(array('id' => 'account', 'title' => __('Account', 'hocwp-theme'), 'description' => __('Your social accounts to config API on website.', 'hocwp-theme')));
$option->add_section(array('id' => 'facebook', 'title' => __('Facebook', 'hocwp-theme'), 'description' => __('All information about Facebook account and Facebook Insights Admins.', 'hocwp-theme')));
$option->add_section(array('id' => 'google', 'title' => __('Google', 'hocwp-theme'), 'description' => __('All information about Google account and Google console.', 'hocwp-theme')));
$option->add_field(array('id' => 'facebook_site', 'title' => __('Facebook page URL', 'hocwp-theme'), 'value' => hocwp_get_wpseo_social_value('facebook_site')));
$twitter_account = hocwp_get_wpseo_social_value('twitter_site');
if (!empty($twitter_account) && !hocwp_url_valid($twitter_account)) {
    $twitter_account = 'http://twitter.com/' . $twitter_account;
}
$option->add_field(array('id' => 'twitter_site', 'title' => __('Twitter URL', 'hocwp-theme'), 'value' => $twitter_account));
$option->add_field(array('id' => 'instagram_url', 'title' => __('Instagram URL', 'hocwp-theme'), 'value' => hocwp_get_wpseo_social_value('instagram_url')));
$option->add_field(array('id' => 'linkedin_url', 'title' => __('LinkedIn URL', 'hocwp-theme'), 'value' => hocwp_get_wpseo_social_value('linkedin_url')));
$option->add_field(array('id' => 'myspace_url', 'title' => __('Myspace URL', 'hocwp-theme'), 'value' => hocwp_get_wpseo_social_value('myspace_url')));
$option->add_field(array('id' => 'pinterest_url', 'title' => __('Pinterest URL', 'hocwp-theme'), 'value' => hocwp_get_wpseo_social_value('pinterest_url')));
$option->add_field(array('id' => 'youtube_url', 'title' => __('YouTube URL', 'hocwp-theme'), 'value' => hocwp_get_wpseo_social_value('youtube_url')));
$option->add_field(array('id' => 'google_plus_url', 'title' => __('Google+ URL', 'hocwp-theme'), 'value' => hocwp_get_wpseo_social_value('google_plus_url')));
$option->add_field(array('id' => 'rss_url', 'title' => __('RSS URL', 'hocwp-theme')));
$option->add_field(array('id' => 'addthis_id', 'title' => __('AddThis ID', 'hocwp-theme'), 'section' => 'account'));
$option->add_field(array('id' => 'fbadminapp', 'title' => __('Facebook App ID', 'hocwp-theme'), 'section' => 'facebook', 'value' => hocwp_get_wpseo_social_value('fbadminapp')));
$option->add_field(array('id' => 'google_api_key', 'title' => __('Google API Key', 'hocwp-theme'), 'section' => 'google'));
$option->add_field(array('id' => 'google_client_id', 'title' => __('Google Client ID', 'hocwp-theme'), 'section' => 'google'));
$option->add_option_tab($hocwp_tos_tabs);
    return apply_filters('hocwp_option_theme_custom_defaults', $defaults);
}
function hocwp_option_theme_custom()
{
    $defaults = hocwp_option_theme_custom_defaults();
    $options = get_option('hocwp_theme_custom');
    $options = wp_parse_args($options, $defaults);
    return apply_filters('hocwp_option_theme_custom', $options);
}
global $hocwp_tos_tabs;
$parent_slug = 'hocwp_theme_option';
$defaults = hocwp_option_defaults();
$option = new HOCWP_Option(__('Theme Custom', 'hocwp-theme'), 'hocwp_theme_custom');
$options = $option->get();
$option->set_parent_slug($parent_slug);
$option->add_section(array('id' => 'music', 'title' => __('Music', 'hocwp-theme'), 'description' => __('Play music on your site as background music.', 'hocwp-theme')));
$option->add_field(array('id' => 'background_music', 'title' => __('Embed Code', 'hocwp-theme'), 'class' => 'widefat', 'row' => 3, 'field_callback' => 'hocwp_field_textarea', 'section' => 'music'));
$lists = hocwp_get_value_by_key($defaults, array('theme_custom', 'background_music', 'play_ons'));
$play_on = hocwp_get_value_by_key($defaults, array('theme_custom', 'background_music', 'play_on'));
$all_option = '';
$value = hocwp_get_value_by_key($options, 'play_on');
if (empty($value)) {
    $value = $play_on;
}
if (hocwp_array_has_value($lists)) {
    foreach ($lists as $key => $item) {
        $tmp_option = hocwp_field_get_option(array('value' => $key, 'text' => $item, 'selected' => $value));
        $all_option .= $tmp_option;
    }
}
$option->add_field(array('id' => 'play_on', 'title' => __('Play On', 'hocwp-theme'), 'field_callback' => 'hocwp_field_select', 'section' => 'music', 'all_option' => $all_option, 'default' => $play_on));
<?php

if (!function_exists('add_filter')) {
    exit;
}
global $hocwp_tos_tabs;
$parent_slug = 'hocwp_theme_option';
$option = new HOCWP_Option(__('SMTP Email', 'hocwp-theme'), 'hocwp_option_smtp_email');
$option->set_parent_slug($parent_slug);
$args = array('id' => 'smtp_option', 'title' => __('SMTP Options', 'hocwp-theme'), 'description' => __('These options only apply if you have chosen to send mail by SMTP above.', 'hocwp-theme'));
$option->add_section($args);
$args = array('id' => 'testing', 'title' => __('Configuration Testing', 'hocwp-theme'), 'description' => __('If you do not feel very confident with the above configuration, you can send a test mail to know the results.', 'hocwp-theme'));
$option->add_section($args);
$args = array('id' => 'mail_from', 'title' => __('From Email', 'hocwp-theme'), 'description' => __('You can specify the email address that emails should be sent from. If you leave this blank, the default email will be used.', 'hocwp-theme'));
$option->add_field($args);
$args = array('id' => 'mail_from_name', 'title' => __('From Name', 'hocwp-theme'), 'description' => __('You can specify the name that emails should be sent from. If you leave this blank, the emails will be sent from WordPress.', 'hocwp-theme'));
$option->add_field($args);
$field_options = array(array('id' => 'mailer_smtp', 'label' => __('Send all WordPress emails via SMTP.', 'hocwp-theme'), 'option_value' => 'smtp'), array('id' => 'mailer_mail', 'label' => __('Use the PHP mail() function to send emails.', 'hocwp-theme'), 'option_value' => 'mail'));
$args = array('id' => 'mailer', 'title' => __('Mailer', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_radio', 'options' => $field_options);
$option->add_field($args);
$field_options = array(array('id' => 'mail_set_return_path', 'label' => __('Set the return-path to match the From Email.', 'hocwp-theme')));
$args = array('id' => 'mail_set_return_path', 'title' => __('Return Path', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'options' => $field_options);
$option->add_field($args);
$args = array('id' => 'smtp_host', 'title' => __('SMTP Host', 'hocwp-theme'), 'default' => 'localhost', 'section' => 'smtp_option');
$option->add_field($args);
$args = array('id' => 'smtp_port', 'title' => __('SMTP Port', 'hocwp-theme'), 'default' => 25, 'section' => 'smtp_option');
$option->add_field($args);
$field_options = array(array('id' => 'smtp_ssl_none', 'label' => __('No encryption.', 'hocwp-theme'), 'option_value' => 'none'), array('id' => 'smtp_ssl_ssl', 'label' => __('Use SSL encryption.', 'hocwp-theme'), 'option_value' => 'ssl'), array('id' => 'smtp_ssl_tls', 'label' => __('Use TLS encryption. This is not the same as STARTTLS. For most servers SSL is the recommended option.', 'hocwp-theme'), 'option_value' => 'tls'));
$args = array('id' => 'smtp_ssl', 'title' => __('Encryption', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_radio', 'options' => $field_options, 'section' => 'smtp_option');
$option->add_field($args);
$field_options = array(array('id' => 'smtp_auth_true', 'label' => __('Yes: Use SMTP authentication.', 'hocwp-theme'), 'option_value' => 'true'), array('id' => 'smtp_auth_false', 'label' => __('No: Do not use SMTP authentication.', 'hocwp-theme'), 'option_value' => 'false'));
<?php

if (!function_exists('add_filter')) {
    exit;
}
global $hocwp_tos_tabs;
$parent_slug = 'hocwp_theme_option';
$defaults = hocwp_maintenance_mode_default_settings();
$option = new HOCWP_Option(__('Maintenance', 'hocwp-theme'), 'hocwp_maintenance');
$option->set_parent_slug($parent_slug);
$option->set_use_media_upload(true);
$option->set_use_style_and_script(true);
$option->add_field(array('id' => 'enabled', 'title' => __('Enable', 'hocwp-theme'), 'label' => __('Put your WordPress site in maintenance mode.', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox'));
$option->add_section(array('id' => 'front_end', 'title' => __('Front-end', 'hocwp-theme'), 'description' => __('All settings to display on front-end.', 'hocwp-theme')));
$option->add_field(array('id' => 'background', 'title' => __('Background', 'hocwp-theme'), 'field_callback' => 'hocwp_field_media_upload', 'section' => 'front_end'));
$option->add_field(array('id' => 'heading', 'title' => __('Heading', 'hocwp-theme'), 'default' => hocwp_get_value_by_key($defaults, 'heading'), 'section' => 'front_end'));
$option->add_field(array('id' => 'text', 'title' => __('Text', 'hocwp-theme'), 'default' => hocwp_get_value_by_key($defaults, 'text'), 'field_callback' => 'hocwp_field_rich_editor', 'section' => 'front_end'));
$option->add_option_tab($hocwp_tos_tabs);
$option->set_page_header_callback('hocwp_theme_option_form_before');
$option->set_page_footer_callback('hocwp_theme_option_form_after');
$option->set_page_sidebar_callback('hocwp_theme_option_sidebar_tab');
$option->init();
hocwp_option_add_object_to_list($option);
$option->add_field(array('id' => 'statistics', 'title' => __('Statistics', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Check here if you want to enable user statistics on your site.', 'hocwp-theme')));
$option->add_field(array('id' => 'trending', 'title' => __('Trending', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Track trending post?', 'hocwp-theme')));
$option->add_field(array('id' => 'search_tracking', 'title' => __('Search Tracking', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Tracking search query on your site?', 'hocwp-theme')));
$option->add_field(array('id' => 'post_statistics', 'title' => __('Post Statistics', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Track post views on your site.', 'hocwp-theme')));
$option->add_field(array('id' => 'sticky_widget', 'title' => __('Sticky Widget', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Make last widget fixed when scroll down.', 'hocwp-theme')));
$option->add_field(array('id' => 'redirect_404', 'title' => __('Redirect 404', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Auto redirect 404 page to homepage.', 'hocwp-theme')));
$option->add_field(array('id' => 'bold_first_paragraph', 'title' => __('Bold First Paragraph', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Automatically bold first paragraph of content?', 'hocwp-theme')));
$option->add_field(array('id' => 'enlarge_thumbnail', 'title' => __('Enlarge Thumbnail', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Enlarge post thumbnail when using mobile?', 'hocwp-theme')));
$option->add_field(array('id' => 'content_none_title', 'title' => __('Content None Title', 'hocwp-theme')));
$excerpt_length = hocwp_get_value_by_key($options, 'excerpt_length');
$option->add_field(array('id' => 'excerpt_length', 'title' => __('Excerpt Length', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_number', 'value' => $excerpt_length));
if (hocwp_wc_installed() || hocwp_is_shop_site()) {
    $value = hocwp_get_product_posts_per_page();
    $option->add_field(array('id' => 'products_per_page', 'title' => __('Product Each Page', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_number', 'value' => $value));
}
$option->add_section(array('id' => 'breadcrumb', 'title' => __('Breadcrumb', 'hocwp-theme'), 'description' => __('Custom breadcrumb on your site.', 'hocwp-theme')));
$option->add_field(array('id' => 'breadcrumb_label', 'title' => __('Breadcrumb Label', 'hocwp-theme'), 'value' => hocwp_wpseo_internallink_value('breadcrumbs-prefix'), 'section' => 'breadcrumb'));
$option->add_field(array('id' => 'disable_post_title_breadcrumb', 'title' => __('Disable Post Title', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Prevent post title to be shown on last item.', 'hocwp-theme'), 'section' => 'breadcrumb'));
$option->add_field(array('id' => 'link_last_item_breadcrumb', 'title' => __('Link Last Item', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Add link to last item instead of text.', 'hocwp-theme'), 'section' => 'breadcrumb'));
$thumbnail_image_sizes = $options['thumbnail_image_sizes'];
$thumbnail_image_sizes = apply_filters('hocwp_thumbnail_image_sizes', $thumbnail_image_sizes);
$thumbnail_image_sizes = hocwp_sanitize_array($thumbnail_image_sizes);
if (hocwp_array_has_value($thumbnail_image_sizes)) {
    $option->add_section(array('id' => 'thumbnail_images', 'title' => __('Thumbnail Images', 'hocwp-theme'), 'description' => __('These settings affect the display and dimensions of images in your catalog – the display on the front-end will still be affected by CSS styles.', 'hocwp-theme')));
    foreach ($thumbnail_image_sizes as $thumbnail_size) {
        $thumbnail_size['section'] = 'thumbnail_images';
        $thumbnail_size['field_callback'] = 'hocwp_field_size';
        $option->add_field($thumbnail_size);
    }
}
$option->add_section(array('id' => 'scroll_top_section', 'title' => __('Scroll To Top', 'hocwp-theme'), 'description' => __('This option can help you to display scroll to top button on your site.', 'hocwp-theme')));
<?php

if (!function_exists('add_filter')) {
    exit;
}
global $hocwp_tos_tabs;
$option = new HOCWP_Option(__('Discussion', 'hocwp-theme'), 'hocwp_discussion');
$option->set_parent_slug('hocwp_theme_option');
$option->add_field(array('id' => 'allow_shortcode', 'title' => __('Shortcode', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Allow user to post shortcode in comment.', 'hocwp-theme')));
$option->add_section(array('id' => 'comment_form', 'title' => __('Comment Form', 'hocwp-theme'), 'description' => __('These options can help you to customize comment form on your site.', 'hocwp-theme')));
$field_options = array(array('id' => 'comment_system_default', 'label' => __('Use WordPress default comment system.', 'hocwp-theme'), 'option_value' => 'default'), array('id' => 'comment_system_facebook', 'label' => __('Use Facebook comment system.', 'hocwp-theme'), 'option_value' => 'facebook'), array('id' => 'comment_system_default_and_facebook', 'label' => __('Display bold WordPress default comment system and Facebook comment system.', 'hocwp-theme'), 'option_value' => 'default_and_facebook'), array('id' => 'comment_system_tabs', 'label' => __('Using multiple comment system as tabs.', 'hocwp-theme'), 'option_value' => 'tabs'));
$option->add_field(array('id' => 'comment_system', 'title' => __('Comment System', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_radio', 'options' => $field_options, 'section' => 'comment_form'));
$option->add_field(array('id' => 'button_style', 'title' => __('Button Style', 'hocwp-theme'), 'field_callback' => 'hocwp_field_select', 'field_args' => array('options' => hocwp_bootstrap_color_select_options()), 'default' => 'warning', 'section' => 'comment_form'));
$field_options = array(array('id' => 'use_captcha', 'label' => __('Use captcha to validate human on comment form.', 'hocwp-theme'), 'default' => 0), array('id' => 'user_no_captcha', 'label' => __('Disable captcha if user is logged in.', 'hocwp-theme'), 'default' => 1));
$option->add_field(array('id' => 'captcha', 'title' => __('Captcha', 'hocwp-theme'), 'options' => $field_options, 'field_callback' => 'hocwp_field_input_checkbox', 'section' => 'comment_form'));
$option->add_option_tab($hocwp_tos_tabs);
$option->set_page_header_callback('hocwp_theme_option_form_before');
$option->set_page_footer_callback('hocwp_theme_option_form_after');
$option->set_page_sidebar_callback('hocwp_theme_option_sidebar_tab');
$option->init();
hocwp_option_add_object_to_list($option);