<?php

if (!function_exists('add_filter')) {
    exit;
}
global $hocwp_pos_tabs;
$parent_slug = 'hocwp_plugin_option';
$option = new HOCWP_Option(__('Custom CSS', 'hocwp-theme'), 'hocwp_plugin_custom_css');
$option->set_parent_slug($parent_slug);
$option->add_field(array('id' => 'code', 'title' => __('Custom Style Sheet', 'hocwp-theme'), 'class' => 'widefat', 'row' => 30, 'field_callback' => 'hocwp_field_textarea'));
$option->add_option_tab($hocwp_pos_tabs);
$option->set_page_header_callback('hocwp_plugin_option_page_header');
$option->set_page_footer_callback('hocwp_plugin_option_page_footer');
$option->set_page_sidebar_callback('hocwp_plugin_option_page_sidebar');
$option->init();
hocwp_option_add_object_to_list($option);
예제 #2
0
<?php

if (!function_exists('add_filter')) {
    exit;
}
global $hocwp_tos_tabs;
$option = new HOCWP_Option(__('Writing', 'hocwp-theme'), 'hocwp_writing');
$option->set_parent_slug('hocwp_theme_option');
$option->set_use_media_upload(true);
$option->add_field(array('id' => 'default_post_thumbnail', 'title' => __('Default post thumbnail', 'hocwp-theme'), 'field_callback' => 'hocwp_field_media_upload'));
$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);
function hocwp_option_theme_setting_defaults()
{
    $alls = hocwp_option_defaults();
    $defaults = hocwp_get_value_by_key($alls, 'theme_setting');
    if (!hocwp_array_has_value($defaults)) {
        $defaults = array('language' => 'vi');
    }
    return apply_filters('hocwp_option_theme_setting_defaults', $defaults);
}
function hocwp_option_theme_setting()
{
    $defaults = hocwp_option_theme_setting_defaults();
    $options = get_option('hocwp_theme_setting');
    $options = wp_parse_args($options, $defaults);
    return apply_filters('hocwp_option_theme_setting', $options);
}
global $hocwp_tos_tabs;
$parent_slug = 'hocwp_theme_option';
$option = new HOCWP_Option(__('General', 'hocwp-theme'), 'hocwp_theme_setting');
$option->set_parent_slug($parent_slug);
$option->set_use_style_and_script(true);
$option->set_use_media_upload(true);
$option->add_field(array('id' => 'language', 'title' => __('Language', 'hocwp-theme'), 'field_callback' => 'hocwp_field_select_language'));
$option->add_field(array('id' => 'favicon', 'title' => __('Favicon', 'hocwp-theme'), 'field_callback' => 'hocwp_field_media_upload'));
$option->add_field(array('id' => 'logo', 'title' => __('Logo', 'hocwp-theme'), 'field_callback' => 'hocwp_field_media_upload'));
$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);
예제 #4
0
<?php

if (!function_exists('add_filter')) {
    exit;
}
global $hocwp_theme_option, $hocwp_tos_tabs;
$hocwp_theme_option = new HOCWP_Option(__('Theme Options', 'hocwp-theme'), 'hocwp_theme_option');
$hocwp_theme_option->set_parent_slug('');
$hocwp_theme_option->set_icon_url('dashicons-admin-generic');
$hocwp_theme_option->set_position(61);
$hocwp_theme_option->set_use_style_and_script(true);
$hocwp_theme_option->init();
$hocwp_theme_option = new HOCWP_Option(__('Private Types', 'hocwp-theme'), 'hocwp_private_types');
$hocwp_theme_option->set_parent_slug('');
$hocwp_theme_option->set_icon_url('dashicons-admin-post');
$hocwp_theme_option->set_position(90);
$hocwp_theme_option->set_use_style_and_script(false);
$hocwp_theme_option->init();
require HOCWP_THEME_INC_PATH . '/options/setting-theme-setting.php';
require HOCWP_THEME_INC_PATH . '/options/setting-theme-home.php';
require HOCWP_THEME_INC_PATH . '/options/setting-theme-custom.php';
require HOCWP_THEME_INC_PATH . '/options/setting-theme-custom-css.php';
require HOCWP_THEME_INC_PATH . '/options/setting-theme-add-to-head.php';
require HOCWP_THEME_INC_PATH . '/options/setting-theme-add-to-footer.php';
require HOCWP_THEME_INC_PATH . '/options/setting-optimize.php';
require HOCWP_THEME_INC_PATH . '/options/setting-social.php';
require HOCWP_THEME_INC_PATH . '/options/setting-login.php';
require HOCWP_THEME_INC_PATH . '/options/setting-smtp-email.php';
require HOCWP_THEME_INC_PATH . '/options/setting-writing.php';
require HOCWP_THEME_INC_PATH . '/options/setting-reading.php';
require HOCWP_THEME_INC_PATH . '/options/setting-discussion.php';
<?php

if (!function_exists('add_filter')) {
    exit;
}
global $hocwp_tos_tabs;
$parent_slug = 'hocwp_theme_option';
$theme = wp_get_theme();
$template = hocwp_sanitize_id($theme->get_template());
$option = new HOCWP_Option(__('Custom CSS', 'hocwp-theme'), 'hocwp_theme_custom_css');
$option->set_parent_slug($parent_slug);
$option->add_field(array('id' => $template, 'title' => __('Theme Custom CSS', 'hocwp-theme'), 'class' => 'widefat', 'row' => 30, 'field_callback' => 'hocwp_field_textarea'));
$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);
<?php

if (!function_exists('add_filter')) {
    exit;
}
global $hocwp_plugin_theme_switcher;
$option = new HOCWP_Option(__('Theme switcher', 'hocwp-theme-switcher'), $hocwp_plugin_theme_switcher->option_name);
$args = array('id' => 'mobile_theme', 'title' => __('Default Mobile Theme', 'hocwp-theme-switcher'), 'field_callback' => 'hocwp_field_select_theme');
$option->add_field($args);
$hocwp_plugin_theme_switcher->add_option_to_sidebar_tab($option);
if (hocwp_theme_switcher_enabled()) {
    $option->init();
}
hocwp_option_add_object_to_list($option);
<?php

if (!function_exists('add_filter')) {
    exit;
}
global $hocwp_tos_tabs;
$option = new HOCWP_Option(__('Permalink', 'hocwp-theme'), 'hocwp_permalink');
$option->set_parent_slug('hocwp_theme_option');
$option->add_field(array('id' => 'nice_future_post_permalink', 'title' => __('Nice Future Post Permalink', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Using nice permalink for scheduled posts instead of short link.', 'hocwp-theme')));
$option->add_field(array('id' => 'remove_taxonomy_base', 'title' => __('Remove Taxonomy Base', 'hocwp-theme'), 'field_callback' => 'hocwp_field_sortable_taxonomy', 'connect' => true, 'description' => __('Drag and drop the taxonomy into right panel to remove it\'s base slug.', 'hocwp-theme')));
$option->set_use_jquery_ui_sortable(true);
$option->set_use_style_and_script(true);
$option->set_parse_options(true);
$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);
function hocwp_option_permalink_update($input)
{
    flush_rewrite_rules();
    return $input;
}
add_action('hocwp_sanitize_' . $option->get_option_name_no_prefix() . '_option', 'hocwp_option_permalink_update');
}
function hocwp_option_optimize_defaults()
{
    $alls = hocwp_option_defaults();
    $defaults = hocwp_get_value_by_key($alls, 'optimize');
    if (!hocwp_array_has_value($defaults)) {
        $defaults = array('use_jquery_cdn' => 1, 'use_bootstrap_cdn' => 1, 'use_fontawesome_cdn' => 1, 'use_superfish_cdn' => 1);
    }
    return apply_filters('hocwp_option_optimize_defaults', $defaults);
}
function hocwp_option_optimize()
{
    $defaults = hocwp_option_optimize_defaults();
    $options = get_option('hocwp_optimize');
    $options = wp_parse_args($options, $defaults);
    return apply_filters('hocwp_option_optimize', $options);
}
global $hocwp_tos_tabs;
$parent_slug = 'hocwp_theme_option';
$option = new HOCWP_Option(__('Optimize', 'hocwp-theme'), 'hocwp_optimize');
$option->set_parent_slug($parent_slug);
$option->add_field(array('id' => 'use_jquery_cdn', 'title' => __('jQuery CDN', 'hocwp-theme'), 'label' => __('Load jQuery from Google CDN server.', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'default' => 1));
$option->add_field(array('id' => 'use_bootstrap_cdn', 'title' => __('Bootstrap CDN', 'hocwp-theme'), 'label' => __('Load Bootstrap from Max CDN server.', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'default' => 1));
$option->add_field(array('id' => 'use_fontawesome_cdn', 'title' => __('FontAwesome CDN', 'hocwp-theme'), 'label' => __('Load FontAwesome from Max CDN server.', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'default' => 1));
$option->add_field(array('id' => 'use_superfish_cdn', 'title' => __('Superfish CDN', 'hocwp-theme'), 'label' => __('Load Superfish from CloudFlare CDN server.', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'default' => 1));
$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);
예제 #9
0
<?php

if (!function_exists('add_filter')) {
    exit;
}
global $hocwp_plugin_option, $hocwp_pos_tabs;
$hocwp_plugin_option = new HOCWP_Option(__('Plugin Options', 'hocwp-theme'), 'hocwp_plugin_option');
$hocwp_plugin_option->set_parent_slug('');
$hocwp_plugin_option->set_icon_url('dashicons-admin-generic');
$hocwp_plugin_option->set_position(66);
$hocwp_plugin_option->set_use_style_and_script(true);
$hocwp_plugin_option->init();
function hocwp_plugin_remove_option_submenu_page()
{
    remove_submenu_page('hocwp_plugin_option', 'hocwp_plugin_option');
}
add_action('admin_menu', 'hocwp_plugin_remove_option_submenu_page', 99);
function hocwp_plugin_redirect_option_page()
{
    $valid = apply_filters('hocwp_plugin_license_valid', true);
    if (!$valid) {
        $page = hocwp_get_current_admin_page();
        if ('hocwp_plugin_option' == $page) {
            $base_url = admin_url('admin.php');
            $base_url = add_query_arg('page', 'hocwp_plugin_license', $base_url);
            wp_redirect($base_url);
            exit;
        }
    }
}
add_action('admin_init', 'hocwp_plugin_redirect_option_page');
<?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);
<?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';
$option = new HOCWP_Option(__('Recommended Plugins', 'hocwp-theme'), 'hocwp_recommended_plugin');
$option->set_parent_slug($parent_slug);
$option->set_is_option_page(false);
$option->set_menu_title(__('Plugins', 'hocwp-theme'));
$option->set_use_style_and_script(true);
$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);
function hocwp_option_page_recommended_plugin_content()
{
    $base_url = 'admin.php?page=hocwp_recommended_plugin';
    $current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : 'installed';
    $tabs = array('installed' => __('Installed', 'hocwp-theme'), 'activated' => __('Activated', 'hocwp-theme'), 'required' => __('Required', 'hocwp-theme'), 'recommended' => __('Recommended', 'hocwp-theme'));
    $plugins = array();
    switch ($current_tab) {
        case 'required':
            $defaults = hocwp_recommended_plugins();
            $lists = hocwp_get_value_by_key($defaults, 'required');
            foreach ($lists as $key => $data) {
                $slug = hocwp_get_plugin_slug_from_file_path($data);
                $plugins[$slug] = $data;
예제 #13
0
    if (!hocwp_array_has_value($defaults)) {
        $defaults = array('statistics' => 0, 'trending' => 0, 'search_tracking' => 0, 'enlarge_thumbnail' => 0, 'excerpt_length' => 75, 'post_statistics' => 0, 'sticky_widget' => 0, 'redirect_404' => 0, 'breadcrumb_label' => '', 'disable_post_title_breadcrumb' => 0, 'link_last_item_breadcrumb' => 0, 'go_to_top' => 0, 'go_to_top_on_left' => 0, 'scroll_top_icon' => '', 'content_none_title' => '', 'thumbnail_image_sizes' => array(), 'products_per_page' => hocwp_get_product_posts_per_page());
    }
    return apply_filters('hocwp_option_reading_defaults', $defaults);
}
function hocwp_option_reading()
{
    $defaults = hocwp_option_reading_defaults();
    $options = get_option('hocwp_reading');
    $options = wp_parse_args($options, $defaults);
    return apply_filters('hocwp_option_reading', $options);
}
global $hocwp_tos_tabs, $hocwp_reading_options;
$options = $hocwp_reading_options;
$options = wp_parse_args($options, hocwp_option_reading_defaults());
$option = new HOCWP_Option(__('Reading', 'hocwp-theme'), 'hocwp_reading');
$option->set_parent_slug('hocwp_theme_option');
$option->set_use_media_upload(true);
$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();
<?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);
<?php

if (!function_exists('add_filter')) {
    exit;
}
global $hocwp_pos_tabs;
$parent_slug = 'hocwp_plugin_option';
$option = new HOCWP_Option(__('Plugin Licenses', 'hocwp-theme'), 'hocwp_plugin_license');
$option->set_parent_slug($parent_slug);
$option->set_use_style_and_script(true);
$option->add_field(array('id' => 'use_for', 'title' => __('For plugin', 'hocwp-theme'), 'field_callback' => 'hocwp_field_select_plugin'));
$option->add_field(array('id' => 'customer_email', 'title' => __('Customer email', 'hocwp-theme')));
$option->add_field(array('id' => 'license_code', 'title' => __('License code', 'hocwp-theme')));
if (!hocwp_menu_page_exists('hocwp_plugin_license')) {
    $option->add_option_tab($hocwp_pos_tabs);
    $option->set_page_header_callback('hocwp_plugin_option_page_header');
    $option->set_page_footer_callback('hocwp_plugin_option_page_footer');
    $option->set_page_sidebar_callback('hocwp_plugin_option_page_sidebar');
    $option->init();
}
hocwp_option_add_object_to_list($option);
function hocwp_option_plugin_license_sanitized($input)
{
    $use_for = isset($input['use_for']) ? $input['use_for'] : '';
    if (!empty($use_for)) {
        $customer_email = isset($input['customer_email']) ? $input['customer_email'] : '';
        if (is_email($customer_email)) {
            $code = isset($input['license_code']) ? $input['license_code'] : '';
            $code = strtoupper($code);
            $option = get_option('hocwp_plugin_licenses');
            $use_for_key = md5($use_for);
<?php

if (!function_exists('add_filter')) {
    exit;
}
global $hocwp_tos_tabs;
$parent_slug = 'hocwp_theme_option';
$option = new HOCWP_Option(__('Theme license', 'hocwp-theme'), 'hocwp_theme_license');
$option->set_parent_slug($parent_slug);
$option->add_field(array('id' => 'customer_email', 'title' => __('Customer email', 'hocwp-theme')));
$option->add_field(array('id' => 'license_code', 'title' => __('License code', 'hocwp-theme')));
$option->add_help_tab(array('id' => 'overview', 'title' => __('Overview', 'hocwp-theme'), 'content' => '<p>' . sprintf(__('Thank you for using WordPress theme by %s.', 'hocwp-theme'), HOCWP_NAME) . '</p>' . '<p>' . __('With each theme, you will receive a license code to activate it. Please enter your theme license information into the form below, if you do not have one, please contact the author to get new code.', 'hocwp-theme') . '</p>'));
$option->set_help_sidebar('<p><strong>' . __('For more information:', 'hocwp-theme') . '</strong></p>' . '<p><a href="http://hocwp.net/quy-dinh-su-dung-ban-quyen-giao-dien/" target="_blank">' . __('Rules of using license', 'hocwp-theme') . '</a></p>' . '<p><a href="http://hocwp.net/lien-he/" target="_blank">' . __('Contact Us', 'hocwp-theme') . '</a></p>');
$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);
function hocwp_theme_license_option_saved($option)
{
    if (is_a($option, 'HOCWP_Option')) {
        hocwp_delete_transient_license_valid();
    }
}
add_action($option->get_menu_slug() . '_option_saved', 'hocwp_theme_license_option_saved');
<?php

if (!function_exists('add_filter')) {
    exit;
}
global $pagenow;
$parent_slug = 'tools.php';
$option = new HOCWP_Option(__('Developers', 'hocwp-theme'), 'hocwp_developers');
$option->set_parent_slug($parent_slug);
$option->disable_sidebar();
$option->add_field(array('id' => 'compress_css', 'title' => __('Compress CSS', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Compress all style in current theme or plugins?', 'hocwp-theme'), 'default' => 1));
$option->add_field(array('id' => 'compress_js', 'title' => __('Compress Javascript', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Compress all javascript in current theme or plugins?', 'hocwp-theme'), 'default' => 1));
$option->add_field(array('id' => 'compress_core', 'title' => __('Compress Core', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Compress core styles and scripts?', 'hocwp-theme'), 'default' => 1));
$option->add_field(array('id' => 're_compress', 'title' => __('Recompress', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Check here if you want to recompress all minified files?', 'hocwp-theme')));
$option->add_field(array('id' => 'force_compress', 'title' => __('Force Compress', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Disable compress cache each 15 minutes?', 'hocwp-theme')));
$option->add_field(array('id' => 'compress_css_js', 'field_callback' => 'hocwp_field_button', 'value' => __('Compress CSS and Javascript', 'hocwp-theme')));
if (HOCWP_DEVELOPING && hocwp_is_localhost()) {
    $option->init();
}
hocwp_option_add_object_to_list($option);
예제 #18
0
<?php

if (!function_exists('add_filter')) {
    exit;
}
global $hocwp_tos_tabs;
$parent_slug = 'hocwp_theme_option';
$lat_lng = hocwp_get_default_lat_long();
$option = new HOCWP_Option(__('Geo', 'hocwp-theme'), 'hocwp_geo');
$option->set_parent_slug($parent_slug);
$option->add_field(array('id' => 'default_lat', 'title' => __('Default Latitude', 'hocwp-theme'), 'default' => $lat_lng['lat']));
$option->add_field(array('id' => 'default_lng', 'title' => __('Default Longitude', 'hocwp-theme'), 'default' => $lat_lng['lng']));
$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);
    return apply_filters('hocwp_option_utilities_defaults', $defaults);
}
function hocwp_option_utilities()
{
    $defaults = hocwp_option_utilities_defaults();
    $options = get_option('hocwp_utilities');
    $options = wp_parse_args($options, $defaults);
    return apply_filters('hocwp_option_utilities', $options);
}
$args = hocwp_option_utilities();
$dashboard_widget = hocwp_get_value_by_key($args, 'dashboard_widget');
$force_admin_english = hocwp_get_value_by_key($args, 'force_admin_english');
$auto_update = hocwp_get_value_by_key($args, 'auto_update');
global $hocwp_tos_tabs;
$parent_slug = 'hocwp_theme_option';
$option = new HOCWP_Option(__('Utilities', 'hocwp-theme'), 'hocwp_utilities');
$option->set_parent_slug($parent_slug);
$option->add_field(array('id' => 'link_manager', 'title' => __('Link Manager', 'hocwp-theme'), 'label' => __('Enable link manager on your site.', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox'));
$option->add_field(array('id' => 'dashboard_widget', 'title' => __('Dashboard Widgets', 'hocwp-theme'), 'default' => 1, 'value' => $dashboard_widget, 'label' => __('Display custom widget on Dashboard for Services News.', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox'));
//$option->add_field(array('id' => 'force_admin_english', 'title' => __('Force Admin English', 'hocwp-theme'), 'default' => 1, 'value' => $force_admin_english, 'label' => __('Force to use English language for backend.', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox'));
$option->add_field(array('id' => 'auto_update', 'title' => __('Auto Update', 'hocwp-theme'), 'value' => $auto_update, 'label' => __('Update WordPress theme, plugin, core and translation automatically.', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox'));
$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);
function hocwp_dashboard_services_news_widget()
{
    $args = hocwp_option_utilities();
    $dashboard_widget = hocwp_get_value_by_key($args, 'dashboard_widget');
 final function add_option_to_sidebar_tab(HOCWP_Option $option)
 {
     if (!hocwp_menu_page_exists($this->option_name)) {
         global $hocwp_pos_tabs;
         $option->set_parent_slug($this->admin_menu_parent);
         $option->add_option_tab($hocwp_pos_tabs);
         $option->set_page_header_callback('hocwp_plugin_option_page_header');
         $option->set_page_footer_callback('hocwp_plugin_option_page_footer');
         $option->set_page_sidebar_callback('hocwp_plugin_option_page_sidebar');
     }
 }
예제 #21
0
function hocwp_option_add_object_to_list(HOCWP_Option $option)
{
    global $hocwp_options;
    $option_name = $option->get_option_name_no_prefix();
    $hocwp_options[$option_name] = $option;
}
    if (!hocwp_array_has_value($defaults)) {
        $defaults = array('background_lazyload' => 0);
    }
    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;
예제 #23
0
<?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);
    if (!hocwp_array_has_value($defaults)) {
        $defaults = array('recent_posts' => 1, 'posts_per_page' => hocwp_get_posts_per_page(), 'pagination' => 1);
    }
    return apply_filters('hocwp_option_home_setting_defaults', $defaults);
}
function hocwp_option_home_setting()
{
    $defaults = hocwp_option_home_setting_defaults();
    $options = get_option('hocwp_home_setting');
    $options = wp_parse_args($options, $defaults);
    return apply_filters('hocwp_option_home_setting', $options);
}
$options = hocwp_option_home_setting();
$posts_per_page = hocwp_get_value_by_key($options, 'posts_per_page');
$pagination = hocwp_get_value_by_key($options, 'pagination');
$recent_posts = hocwp_get_value_by_key($options, 'recent_posts');
global $hocwp_tos_tabs;
$parent_slug = 'hocwp_theme_option';
$option = new HOCWP_Option(__('Home Settings', 'hocwp-theme'), 'hocwp_home_setting');
$option->set_parent_slug($parent_slug);
$option->set_use_style_and_script(true);
$option->set_use_media_upload(true);
$option->add_field(array('id' => 'recent_posts', 'title' => __('Recent Posts', 'hocwp-theme'), 'label' => __('Show recent posts on home page?', 'hocwp-theme'), 'value' => $recent_posts, 'field_callback' => 'hocwp_field_input_checkbox'));
$option->add_field(array('id' => 'posts_per_page', 'title' => __('Posts Number', 'hocwp-theme'), 'value' => $posts_per_page, 'field_callback' => 'hocwp_field_input_number'));
$option->add_field(array('id' => 'pagination', 'title' => __('Pagination', 'hocwp-theme'), 'label' => __('Show pagination on home page?', 'hocwp-theme'), 'value' => $pagination, 'field_callback' => 'hocwp_field_input_checkbox'));
$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);