Example #1
0
function hocwp_get_smtp_mail_data()
{
    $defaults = hocwp_smtp_mail_defaults();
    $option = hocwp_get_option('option_smtp_email');
    $result = wp_parse_args($option, $defaults);
    return apply_filters('hocwp_smtp_mail_args', $result);
}
 public function widget($args, $instance)
 {
     $this->instance = $instance;
     $order = hocwp_get_value_by_key($instance, 'order', hocwp_get_value_by_key($this->args, 'order'));
     $orders = explode(',', $order);
     $orders = array_map('trim', $orders);
     $orders = hocwp_sanitize_array($orders);
     $option_names = $this->args['option_names'];
     $options = hocwp_get_option('option_social');
     $icons = $this->args['icons'];
     $description = hocwp_get_value_by_key($instance, 'description');
     hocwp_widget_before($args, $instance);
     ob_start();
     if (!empty($description)) {
         echo hocwp_wrap_tag(wpautop($description), 'div', 'description');
     }
     if (hocwp_array_has_value($orders)) {
         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();
             }
         }
     }
     $widget_html = ob_get_clean();
     $widget_html = apply_filters('hocwp_widget_social_html', $widget_html, $args, $instance, $this);
     echo $widget_html;
     hocwp_widget_after($args, $instance);
 }
Example #3
0
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();
                }
            }
        }
    }
}