function hocwp_option_utilities_defaults() { $alls = hocwp_option_defaults(); $defaults = hocwp_get_value_by_key($alls, 'utilities'); if (!hocwp_array_has_value($defaults)) { $defaults = array('link_manager' => 0, 'dashboard_widget' => 1, 'force_admin_english' => 1); } return apply_filters('hocwp_option_utilities_defaults', $defaults); }
function hocwp_option_theme_custom_defaults() { $alls = hocwp_option_defaults(); $defaults = hocwp_get_value_by_key($alls, 'theme_custom'); if (!hocwp_array_has_value($defaults)) { $defaults = array('background_lazyload' => 0); } return apply_filters('hocwp_option_theme_custom_defaults', $defaults); }
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_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_reading_defaults() { $alls = hocwp_option_defaults(); $defaults = hocwp_get_value_by_key($alls, 'reading'); 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_home_setting_defaults() { $alls = hocwp_option_defaults(); $defaults = hocwp_get_value_by_key($alls, 'home_setting'); 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); }
private function get_defaults() { $option_socials = hocwp_option_defaults(); $option_socials = $option_socials['social']; $defaults = array('order' => $option_socials['order'], 'option_names' => $option_socials['option_names'], 'icons' => $option_socials['icons']); $defaults = apply_filters('hocwp_widget_social_defaults', $defaults, $this); $args = apply_filters('hocwp_widget_social_args', array(), $this); $args = wp_parse_args($args, $defaults); return $args; }
function hocwp_option_get_value($base, $key) { $data = hocwp_option_get_data($base); $base_slug = str_replace('hocwp_', '', $base); $defaults = hocwp_option_defaults(); $defaults = hocwp_get_value_by_key($defaults, $base_slug); if (hocwp_array_has_value($defaults)) { $data = (array) $data; $data = wp_parse_args($data, $defaults); } if (!empty($key)) { $result = hocwp_get_value_by_key($data, $key); } else { $result = $data; } return $result; }
function hocwp_the_social_list($args = array()) { $option_socials = hocwp_option_defaults(); $option_socials = $option_socials['social']; $order = hocwp_get_value_by_key($args, 'order', hocwp_get_value_by_key($option_socials, 'order')); $orders = explode(',', $order); $orders = array_map('trim', $orders); $orders = hocwp_sanitize_array($orders); $option_names = $option_socials['option_names']; $options = hocwp_get_option('option_social'); $icons = $option_socials['icons']; $list = (bool) hocwp_get_value_by_key($args, 'list'); if (hocwp_array_has_value($orders)) { if ($list) { echo '<ul class="list-socials list-unstyled list-inline">'; foreach ($orders as $social) { $option_name = hocwp_get_value_by_key($option_names, $social); $item = hocwp_get_value_by_key($options, $option_name); if (!empty($item)) { $icon = '<i class="fa ' . $icons[$social] . '"></i>'; $a = new HOCWP_HTML('a'); $a->set_href($item); $a->set_class('social-item link-' . $social); $a->set_text($icon); $li = new HOCWP_HTML('li'); $li->set_text($a); $li->output(); } } echo '</ul>'; } else { foreach ($orders as $social) { $option_name = hocwp_get_value_by_key($option_names, $social); $item = hocwp_get_value_by_key($options, $option_name); if (!empty($item)) { $icon = '<i class="fa ' . $icons[$social] . '"></i>'; $a = new HOCWP_HTML('a'); $a->set_href($item); $a->set_class('social-item link-' . $social); $a->set_text($icon); $a->output(); } } } } }
function hocwp_setup_theme_custom_footer() { if (!wp_is_mobile()) { $options = get_option('hocwp_theme_custom'); $background_music = hocwp_get_value_by_key($options, 'background_music'); if (!empty($background_music)) { $play_on = hocwp_get_value_by_key($options, 'play_on'); if (empty($play_on)) { $defaults = hocwp_option_defaults(); $play_on = hocwp_get_value_by_key($defaults, array('theme_custom', 'background_music', 'play_on')); } $play = false; if ('home' == $play_on && is_home()) { $play = true; } elseif ('single' == $play_on && is_single()) { $play = true; } elseif ('page' == $play_on && is_page()) { $play = true; } elseif ('archive' == $play_on && is_archive()) { $play = true; } elseif ('search' == $play_on && is_search()) { $play = true; } elseif ('all' == $play_on) { $play = true; } $play = apply_filters('hocwp_play_background_music', $play); if ((bool) $play) { $div = new HOCWP_HTML('div'); $div->set_class('hocwp-background-music hocwp-hidden'); if (hocwp_url_valid($background_music)) { } $div->set_text($background_music); $div->output(); } } } }