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);
 }
 public function widget($args, $instance)
 {
     $this->instance = $instance;
     $feedburner_name = hocwp_get_value_by_key($instance, 'feedburner_name');
     if (!empty($feedburner_name)) {
         $button_text = hocwp_get_value_by_key($instance, 'button_text', hocwp_get_value_by_key($this->args, 'button_text'));
         $placeholder = hocwp_get_value_by_key($instance, 'placeholder', hocwp_get_value_by_key($this->args, 'placeholder'));
         $description = hocwp_get_value_by_key($instance, 'description', hocwp_get_value_by_key($this->args, 'description'));
         $desc_position = hocwp_get_value_by_key($instance, 'desc_position', hocwp_get_value_by_key($this->args, 'desc_position'));
         hocwp_widget_before($args, $instance);
         ob_start();
         if (!empty($description) && 'before' == $desc_position) {
             echo '<p class="description">' . $description . '</p>';
         }
         $fb_args = array('button_text' => $button_text, 'name' => $feedburner_name, 'placeholder' => $placeholder);
         hocwp_feedburner_form($fb_args);
         if (!empty($description) && 'after' == $desc_position) {
             echo '<p class="description">' . $description . '</p>';
         }
         $widget_html = ob_get_clean();
         $widget_html = apply_filters('hocwp_widget_feedburner_html', $widget_html, $args, $instance, $this);
         echo $widget_html;
         hocwp_widget_after($args, $instance);
     }
 }
 public function widget($args, $instance)
 {
     $this->instance = $instance;
     $page_name = isset($instance['page_name']) ? $instance['page_name'] : '';
     $href = isset($instance['href']) ? $instance['href'] : '';
     $tabs = hocwp_get_value_by_key($instance, 'tabs', $this->args['tabs']);
     if (!is_array($tabs)) {
         $tabs = explode(',', $tabs);
     }
     $tabs = array_map('trim', $tabs);
     $width = isset($instance['width']) ? $instance['width'] : $this->args['width'];
     $height = isset($instance['height']) ? $instance['height'] : $this->args['height'];
     $hide_cover = (bool) (isset($instance['hide_cover']) ? $instance['hide_cover'] : $this->args['hide_cover']);
     $show_facepile = (bool) (isset($instance['show_facepile']) ? $instance['show_facepile'] : $this->args['show_facepile']);
     $show_posts = (bool) (isset($instance['show_posts']) ? $instance['show_posts'] : $this->args['show_posts']);
     $hide_cta = (bool) (isset($instance['hide_cta']) ? $instance['hide_cta'] : $this->args['hide_cta']);
     $small_header = (bool) (isset($instance['small_header']) ? $instance['small_header'] : $this->args['small_header']);
     $adapt_container_width = (bool) (isset($instance['adapt_container_width']) ? $instance['adapt_container_width'] : $this->args['adapt_container_width']);
     if (!empty($href)) {
         add_filter('hocwp_use_facebook_javascript_sdk', '__return_true');
     }
     hocwp_widget_before($args, $instance);
     $fanpage_args = array('page_name' => $page_name, 'href' => $href, 'width' => $width, 'height' => $height, 'tabs' => $tabs, 'hide_cover' => $hide_cover, 'show_facepile' => $show_facepile, 'show_posts' => $show_posts, 'hide_cta' => $hide_cta, 'small_header' => $small_header, 'adapt_container_width' => $adapt_container_width);
     ob_start();
     hocwp_facebook_page_plugin($fanpage_args);
     $widget_html = ob_get_clean();
     $widget_html = apply_filters('hocwp_widget_facebook_box_html', $widget_html, $args, $instance, $this);
     echo $widget_html;
     hocwp_widget_after($args, $instance);
 }
 public function widget($args, $instance)
 {
     $this->instance = $instance;
     $sidebar = hocwp_get_value_by_key($args, 'id', 'default');
     $title = hocwp_widget_title($args, $instance, false);
     $title_link = hocwp_get_value_by_key($instance, 'title_link', hocwp_get_value_by_key($this->args, 'title_link'));
     $icon = hocwp_get_value_by_key($instance, 'icon');
     $icon = hocwp_sanitize_media_value($icon);
     $icon_url = $icon['url'];
     $icon_hover = hocwp_get_value_by_key($instance, 'icon_hover');
     $icon_hover = hocwp_sanitize_media_value($icon_hover);
     $icon_hover_url = $icon_hover['url'];
     $icon_html = hocwp_get_value_by_key($instance, 'icon_html');
     $link = hocwp_get_value_by_key($instance, 'link');
     if (empty($link)) {
         $link = 'javascript:';
     }
     $text = hocwp_get_value_by_key($instance, 'text');
     hocwp_widget_before($args, $instance, false);
     $widget_html = '';
     if (!empty($icon_url)) {
         $icon_html = $icon_html = '<img class="icon" src="' . $icon_url . '" alt="" data-hover="' . $icon_hover_url . '">';
     }
     if (!empty($icon_html)) {
         $widget_html .= '<a href="' . $link . '" class="icon-link icon-url">' . $icon_html . '</a>';
     }
     if ((bool) $title_link) {
         $title = hocwp_get_value_by_key($instance, 'title');
         $id_base = hocwp_get_value_by_key($args, 'id_base');
         $title = apply_filters('widget_title', $title, $instance, $id_base);
         $before_title = hocwp_get_value_by_key($args, 'before_title');
         $after_title = hocwp_get_value_by_key($args, 'after_title');
         $title = '<a href="' . $link . '" class="title-link title-url">' . $title . '</a>';
         $title = $before_title . $title . $after_title;
         $title = apply_filters('hocwp_widget_icon_title_html', $title, $args, $instance, $this);
     }
     $widget_html .= $title;
     $widget_html .= '<div class="text">' . hocwp_get_rich_text($text) . '</div>';
     $widget_html = apply_filters($this->option_name . '_html', $widget_html, $instance, $widget_args = $args, $widget_number = $this->number, $sidebar_id = $sidebar);
     $widget_html = apply_filters($this->option_name . '_' . $sidebar . '_html', $widget_html, $instance, $widget_args = $args, $widget_number = $this->number);
     $widget_html = apply_filters('hocwp_widget_icon_html', $widget_html, $args, $instance, $this);
     echo $widget_html;
     hocwp_widget_after($args, $instance);
 }
 public function widget($args, $instance)
 {
     $this->instance = $instance;
     $category = $this->get_category_from_instance($instance);
     $categories = array();
     foreach ($category as $pvalue) {
         $value = hocwp_get_value_by_key($pvalue, 'value');
         if (hocwp_id_number_valid($value)) {
             $categories[] = $value;
         }
     }
     $bm_args = array('category' => implode(',', $categories));
     $bookmarks = get_bookmarks($bm_args);
     hocwp_widget_before($args, $instance);
     $bookmarks = hocwp_sanitize_bookmark_link_image($bookmarks);
     $bm_args = array('before' => '', 'after' => '');
     echo _walk_bookmarks($bookmarks, $bm_args);
     hocwp_widget_after($args, $instance);
 }
    public function widget($args, $instance)
    {
        $this->instance = $instance;
        hocwp_widget_before($args, $instance);
        $total_text = _x('Total:', 'Total visits count', 'hocwp-theme');
        $today_text = __('Visit Today:', 'hocwp-theme');
        $online_text = __('Online:', 'hocwp-theme');
        ob_start();
        ?>
		<ul class="list-unstyled">
			<li><p><?php 
        echo $total_text;
        ?>
 <span class="count"><?php 
        echo hocwp_statistics_total();
        ?>
</span></p>
			</li>
			<li><p><?php 
        echo $today_text;
        ?>
 <span class="count"><?php 
        echo hocwp_statistics_today();
        ?>
</span></p>
			</li>
			<li><p><?php 
        echo $online_text;
        ?>
 <span class="count"><?php 
        echo hocwp_statistics_online();
        ?>
</span></p>
			</li>
		</ul>
		<?php 
        $html = ob_get_clean();
        $widget_html = apply_filters('hocwp_widget_statistics_html', $html, $args, $instance, $this);
        echo $widget_html;
        hocwp_widget_after($args, $instance);
    }
    public function widget($args, $instance)
    {
        $this->instance = $instance;
        add_filter('dynamic_sidebar_params', array($this, 'dynamic_sidebar_params'));
        $sidebar = hocwp_get_value_by_key($instance, 'sidebar');
        hocwp_widget_before($args, $instance, false);
        if (empty($sidebar)) {
            echo '<p>' . __('Please select sidebar that widgets will be displayed here as tabber.', 'hocwp-theme') . '</p>';
        } elseif ($args['id'] != $sidebar) {
            ?>
			<div class="hocwp-tab-content">
				<ul class="nav nav-tabs list-tab hocwp-tabs"></ul>
				<div class="tab-content hocwp-tab-container">
					<?php 
            if (is_active_sidebar($sidebar)) {
                dynamic_sidebar($sidebar);
            } else {
                $sidebar_tmp = hocwp_get_sidebar_by('id', $sidebar);
                $sidebar_name = '';
                if ($sidebar_tmp) {
                    $sidebar_name = $sidebar_tmp['name'];
                }
                ?>
						<p><?php 
                printf(__('Please drag and drop widget into sidebar %s.', 'hocwp-theme'), $sidebar_name);
                ?>
</p>
						<?php 
            }
            ?>
				</div>
			</div>
		<?php 
        }
        hocwp_widget_after($args, $instance);
        remove_filter('dynamic_sidebar_params', array($this, 'dynamic_sidebar_params'));
    }
 public function widget($args, $instance)
 {
     $this->instance = $instance;
     $title_text = isset($instance['title']) ? $instance['title'] : '';
     $first_char = hocwp_get_first_char($title_text);
     if ('!' === $first_char) {
         $title_text = ltrim($title_text, '!');
     }
     $banner_image = isset($instance['banner_image']) ? $instance['banner_image'] : '';
     $banner_url = isset($instance['banner_url']) ? $instance['banner_url'] : '';
     $banner_image = hocwp_sanitize_media_value($banner_image);
     $banner_image = $banner_image['url'];
     if (!empty($banner_image)) {
         hocwp_widget_before($args, $instance);
         $img = new HOCWP_HTML('img');
         $img->set_image_src($banner_image);
         $img->set_image_alt($title_text);
         $img->set_class('hocwp-banner-image');
         $html = $img->build();
         if (!empty($banner_url)) {
             $a = new HOCWP_HTML('a');
             $a->set_class('hocwp-banner-link');
             $a->set_attribute('title', $title_text);
             $a->set_href($banner_url);
             $a->set_text($html);
             $nofollow = hocwp_get_value_by_key($instance, 'nofollow', hocwp_get_value_by_key($this->args, 'nofollow'));
             if ((bool) $nofollow) {
                 $a->set_attribute('rel', 'nofollow');
             }
             $html = $a->build();
         }
         $widget_html = apply_filters('hocwp_widget_banner_html', $html, $args, $instance, $this);
         echo $widget_html;
         hocwp_widget_after($args, $instance);
     }
 }
    public function widget($args, $instance)
    {
        $this->instance = $instance;
        $page_name = isset($instance['page_name']) ? $instance['page_name'] : '';
        $href = isset($instance['href']) ? $instance['href'] : '';
        $width = isset($instance['width']) ? $instance['width'] : $this->args['width'];
        $height = isset($instance['height']) ? $instance['height'] : $this->args['height'];
        $hide_cover = (bool) (isset($instance['hide_cover']) ? $instance['hide_cover'] : $this->args['hide_cover']);
        $show_facepile = (bool) (isset($instance['show_facepile']) ? $instance['show_facepile'] : $this->args['show_facepile']);
        $hide_cta = (bool) (isset($instance['hide_cta']) ? $instance['hide_cta'] : $this->args['hide_cta']);
        $small_header = (bool) (isset($instance['small_header']) ? $instance['small_header'] : $this->args['small_header']);
        $adapt_container_width = (bool) (isset($instance['adapt_container_width']) ? $instance['adapt_container_width'] : $this->args['adapt_container_width']);
        $fixed = hocwp_get_value_by_key($instance, 'fixed', $this->args['fixed']);
        $only_link = hocwp_get_value_by_key($instance, 'only_link', $this->args['only_link']);
        $button_text = hocwp_get_value_by_key($instance, 'button_text', $this->args['button_text']);
        $before_widget = hocwp_get_value_by_key($args, 'before_widget');
        $widget_class = '';
        if ($fixed) {
            hocwp_add_string_with_space_before($widget_class, 'fixed');
            $position = hocwp_get_value_by_key($instance, 'position', $this->args['position']);
            hocwp_add_string_with_space_before($widget_class, hocwp_sanitize_html_class($position));
        }
        $before_widget = hocwp_add_class_to_string('', $before_widget, $widget_class);
        $args['before_widget'] = $before_widget;
        $img = new HOCWP_HTML('img');
        $img->set_image_src(hocwp_get_image_url('icon-facebook-messenger-white-64.png'));
        $img->set_class('icon-messenger');
        hocwp_widget_before($args, $instance);
        if ($only_link) {
            if (!hocwp_is_url($href)) {
                $href = 'https://m.me/' . $href;
            }
            $span = new HOCWP_HTML('span');
            $span->set_text($button_text);
            $link_text = $img->build();
            $link_text .= $span->build();
            $a = new HOCWP_HTML('a');
            $a->add_class('button btn btn-facebook-messenger');
            $a->set_text($link_text);
            $a->set_href($href);
            $widget_html = $a->build();
        } else {
            $app_id = hocwp_get_wpseo_social_facebook_app_id();
            if (empty($app_id)) {
                hocwp_debug_log(__('Please set your Facebook APP ID first.', 'hocwp-theme'));
                return;
            }
            add_filter('hocwp_use_facebook_javascript_sdk', '__return_true');
            ?>
			<script type="text/javascript">
				window.fbAsyncInit = function () {
					FB.init({
						appId: '<?php 
            echo $app_id;
            ?>
',
						cookie: true,
						xfbml: true,
						version: 'v<?php 
            echo HOCWP_FACEBOOK_JAVASCRIPT_SDK_VERSION;
            ?>
'
					});
				};
			</script>
			<?php 
            $fanpage_args = array('page_name' => $page_name, 'href' => $href, 'width' => $width, 'height' => $height, 'tabs' => 'messages', 'hide_cover' => $hide_cover, 'show_facepile' => $show_facepile, 'hide_cta' => $hide_cta, 'small_header' => $small_header, 'adapt_container_width' => $adapt_container_width);
            ob_start();
            if ($fixed) {
                $fanpage_args['width'] = 300;
                ?>
				<div class="messenger-box module">
					<div class="module-header heading btn-facebook-messenger" title="<?php 
                echo $button_text;
                ?>
">
						<?php 
                $img->output();
                ?>
						<label><?php 
                echo $button_text;
                ?>
</label>
						<?php 
                if ('left' == $position || 'right' == $position) {
                    echo '<i class="fa fa-times" aria-hidden="true"></i>';
                    $span = new HOCWP_HTML('span');
                    $span->add_class('facebook-messenger-box-control');
                    $span->set_text($img);
                    $span->output();
                } else {
                    echo '<i class="fa fa-angle-up" aria-hidden="true"></i>';
                }
                ?>
					</div>
					<div class="module-body">
						<?php 
                hocwp_facebook_page_plugin($fanpage_args);
                ?>
					</div>
				</div>
				<?php 
            } else {
                hocwp_facebook_page_plugin($fanpage_args);
            }
            $widget_html = ob_get_clean();
        }
        $widget_html = apply_filters('hocwp_widget_facebook_messenger_html', $widget_html, $args, $instance, $this);
        echo $widget_html;
        hocwp_widget_after($args, $instance);
    }
    public function widget($args, $instance)
    {
        $this->instance = $instance;
        $register = hocwp_get_value_by_key($instance, 'register', hocwp_get_value_by_key($this->args, 'register'));
        $button_text = hocwp_get_value_by_key($instance, 'button_text', hocwp_get_value_by_key($this->args, 'button_text'));
        $captcha = (bool) hocwp_get_value_by_key($instance, 'captcha', hocwp_get_value_by_key($this->args, 'captcha'));
        if ($captcha) {
            add_filter('hocwp_use_session', '__return_true');
        }
        $description = hocwp_get_value_by_key($instance, 'description', hocwp_get_value_by_key($this->args, 'description'));
        $desc_position = hocwp_get_value_by_key($instance, 'desc_position', hocwp_get_value_by_key($this->args, 'desc_position'));
        $fields = $this->get_value_fields($instance);
        $all_fields = explode(',', $fields);
        hocwp_widget_before($args, $instance);
        ob_start();
        ?>
		<form class="subscribe-form hocwp-subscribe-form" method="post"
		      data-captcha="<?php 
        echo hocwp_bool_to_int($captcha);
        ?>
"
		      data-register="<?php 
        echo hocwp_bool_to_int($register);
        ?>
">
			<?php 
        echo '<div class="messages"></div>';
        if (!empty($description) && 'before' == $desc_position) {
            echo '<p class="description">' . $description . '</p>';
        }
        foreach ($all_fields as $field_name) {
            $field = hocwp_get_value_by_key($this->args['fields'], $field_name);
            if (hocwp_array_has_value($field)) {
                $label = $this->get_value_field($instance, $field_name, 'label');
                $placeholder = $this->get_value_field($instance, $field_name, 'placeholder');
                $required = $this->get_value_field($instance, $field_name, 'required');
                $class = hocwp_sanitize_html_class($field_name);
                $field_args = array('id' => $this->get_field_id('subscribe_' . $field_name), 'name' => $this->get_field_name('subscribe_' . $field_name), 'value' => '', 'label' => $label, 'placeholder' => $placeholder, 'required' => $required, 'class' => 'form-control input-' . $class, 'before' => '<div class="form-group field-' . $class . '">', 'after' => '</div>');
                hocwp_field_input($field_args);
            }
        }
        if (!empty($description) && 'after' == $desc_position) {
            echo '<p class="description">' . $description . '</p>';
        }
        if ($captcha) {
            $captcha_label = hocwp_get_value_by_key($instance, 'captcha_label', hocwp_get_value_by_key($this->args, 'captcha_label'));
            $captcha_placeholder = hocwp_get_value_by_key($instance, 'captcha_placeholder', hocwp_get_value_by_key($this->args, 'captcha_placeholder'));
            $field_args = array('id' => $this->get_field_id('captcha'), 'name' => $this->get_field_name('captcha'), 'input_width' => '100%', 'class' => 'form-control', 'label' => $captcha_label, 'placeholder' => $captcha_placeholder, 'before' => '<div class="form-group field-captcha">', 'after' => '</div>');
            hocwp_field_captcha($field_args);
        }
        $field_args = array('type' => 'submit', 'name' => 'submit', 'value' => $button_text, 'class' => 'form-control', 'before' => '<div class="form-group field-submit">', 'after' => '</div>');
        hocwp_field_input($field_args);
        hocwp_loading_image(array('name' => 'icon-loading-long.gif'));
        ?>
		</form>
		<?php 
        $widget_html = ob_get_clean();
        $widget_html = apply_filters('hocwp_widget_subscribe_html', $widget_html, $args, $instance, $this);
        echo $widget_html;
        hocwp_widget_after($args, $instance);
    }
    public function widget($args, $instance)
    {
        $this->instance = $instance;
        $number = hocwp_get_value_by_key($instance, 'number', hocwp_get_value_by_key($this->args, 'number'));
        $time = hocwp_get_value_by_key($instance, 'time', hocwp_get_value_by_key($this->args, 'time'));
        $exclude_users = hocwp_get_value_by_key($instance, 'exclude_users');
        $exclude_users = hocwp_json_string_to_array($exclude_users);
        $show_count = hocwp_get_value_by_key($instance, 'show_count', hocwp_get_value_by_key($this->args, 'show_count'));
        $link_author_name = hocwp_get_value_by_key($instance, 'link_author_name', hocwp_get_value_by_key($this->args, 'link_author_name'));
        $none_text = hocwp_get_value_by_key($instance, 'none_text', hocwp_get_value_by_key($this->args, 'none_text'));
        hocwp_widget_before($args, $instance);
        $condition = '';
        if (hocwp_array_has_value($exclude_users)) {
            $not_in = array();
            foreach ($exclude_users as $data) {
                $uid = hocwp_get_value_by_key($data, 'value');
                if (hocwp_id_number_valid($uid)) {
                    $not_in[] = $uid;
                }
            }
            if (hocwp_array_has_value($not_in)) {
                $condition = 'AND user_id NOT IN (' . implode(', ', $not_in) . ')';
            }
        }
        $commenters = hocwp_get_top_commenters($number, $time, $condition);
        ob_start();
        if (!hocwp_array_has_value($commenters)) {
            echo wpautop($none_text);
        } else {
            ?>
			<ol class="list-commenters">
				<?php 
            foreach ($commenters as $commenter) {
                $url = $commenter->comment_author_url;
                $author = $commenter->comment_author;
                $count = absint($commenter->comments_count);
                $email = $commenter->comment_author_email;
                $user_id = 0;
                if (!empty($commenter->user_id)) {
                    $user_id = $commenter->user_id;
                }
                if ((bool) $show_count) {
                    $author .= " ({$count})";
                }
                if (empty($url) || 'http://' == $url || !(bool) $link_author_name) {
                    $url = $author;
                } else {
                    $url = "<a href='{$url}' rel='external nofollow' class='url'>{$author}</a>";
                }
                ?>
					<li class="commenter"><?php 
                echo $url;
                ?>
</li>
					<?php 
            }
            ?>
			</ol>
			<?php 
        }
        $widget_html = ob_get_clean();
        $widget_html = apply_filters('hocwp_widget_top_commenter_html', $widget_html, $args, $instance, $this);
        echo $widget_html;
        hocwp_widget_after($args, $instance);
    }
 public function widget($args, $instance)
 {
     $this->instance = $instance;
     $before_widget = hocwp_get_value_by_key($args, 'before_widget');
     $taxonomy = $this->get_taxonomy_from_instance($instance);
     $taxonomies = array();
     $widget_class = '';
     foreach ($taxonomy as $tax) {
         $tax = hocwp_get_value_by_key($tax, 'value');
         if (!empty($tax)) {
             $taxonomies[] = $tax;
             hocwp_add_string_with_space_before($widget_class, hocwp_sanitize_html_class($tax));
         }
     }
     $before_widget = hocwp_add_class_to_string('', $before_widget, $widget_class);
     $args['before_widget'] = $before_widget;
     $in_current_post = (bool) hocwp_get_value_by_key($instance, 'in_current_post', hocwp_get_value_by_key($this->args, 'in_current_post'));
     if ($in_current_post && (!is_singular() || is_page())) {
         return;
     }
     if ($in_current_post) {
         $post_id = get_the_ID();
         $current_post = get_post($post_id);
         $obj_taxs = get_object_taxonomies($current_post->post_type);
         $has_tax = false;
         foreach ($taxonomies as $tax) {
             foreach ($obj_taxs as $tax_name) {
                 if ($tax == $tax_name) {
                     $has_tax = true;
                     break;
                 }
             }
         }
         if (!$has_tax) {
             return;
         }
         $before_widget = hocwp_add_class_to_string('', $before_widget, 'in-current-post');
         $args['before_widget'] = $before_widget;
     }
     $number = hocwp_get_value_by_key($instance, 'number', hocwp_get_value_by_key($this->args, 'number'));
     if (0 > $number) {
         $number = 0;
     }
     $thumbnail_size = hocwp_get_value_by_key($instance, 'thumbnail_size', hocwp_get_value_by_key($this->args, 'thumbnail_size'));
     $thumbnail_size = hocwp_sanitize_size($thumbnail_size);
     $full_width_item = hocwp_get_value_by_key($instance, 'full_width_item', hocwp_get_value_by_key($this->args, 'full_width_item'));
     $show_count = hocwp_get_value_by_key($instance, 'show_count', hocwp_get_value_by_key($this->args, 'show_count'));
     $hide_thumbnail = hocwp_get_value_by_key($instance, 'hide_thumbnail', hocwp_get_value_by_key($this->args, 'hide_thumbnail'));
     $only_thumbnail = hocwp_get_value_by_key($instance, 'only_thumbnail', hocwp_get_value_by_key($this->args, 'only_thumbnail'));
     $order = hocwp_get_value_by_key($instance, 'order', hocwp_get_value_by_key($this->args, 'order'));
     $orderby = hocwp_get_value_by_key($instance, 'orderby', hocwp_get_value_by_key($this->args, 'orderby'));
     $count_format = hocwp_get_value_by_key($instance, 'count_format', hocwp_get_value_by_key($this->args, 'count_format'));
     $different_name = (bool) hocwp_get_value_by_key($instance, 'different_name', hocwp_get_value_by_key($this->args, 'different_name'));
     $hide_empty = hocwp_get_value_by_key($instance, 'hide_empty', hocwp_get_value_by_key($this->args, 'hide_empty'));
     $only_parent = hocwp_get_value_by_key($instance, 'only_parent', hocwp_get_value_by_key($this->args, 'only_parent'));
     $child_of_current = hocwp_get_value_by_key($instance, 'child_of_current', hocwp_get_value_by_key($this->args, 'child_of_current'));
     $child_of_parent = hocwp_get_value_by_key($instance, 'child_of_parent', hocwp_get_value_by_key($this->args, 'child_of_parent'));
     $parent_as_title = hocwp_get_value_by_key($instance, 'parent_as_title', hocwp_get_value_by_key($this->args, 'parent_as_title'));
     if ($hide_thumbnail) {
         $only_thumbnail = false;
     }
     $defaults = array('order' => $order, 'orderby' => $orderby, 'number' => absint($number));
     if (0 == $hide_empty || !(bool) $hide_empty) {
         $defaults['hide_empty'] = 0;
     } else {
         $defaults['hide_empty'] = 1;
     }
     if ($only_parent) {
         $defaults['parent'] = 0;
     }
     if ($in_current_post && is_singular()) {
         $terms = wp_get_post_terms(get_the_ID(), $taxonomies);
     } elseif (($child_of_current || $child_of_parent) && is_tax()) {
         $current_term = hocwp_term_get_current();
         $tax_args = array('child_of' => $current_term->term_id);
         $tax_args = wp_parse_args($tax_args, $defaults);
         unset($tax_args['parent']);
         $terms = hocwp_get_terms($current_term->taxonomy, $tax_args);
         if ($child_of_parent) {
             if (!hocwp_array_has_value($terms) && hocwp_id_number_valid($current_term->parent)) {
                 $parent = hocwp_term_get_top_most_parent($current_term);
                 $tax_args['child_of'] = $parent->term_id;
                 $terms = hocwp_get_terms($parent->taxonomy, $tax_args);
             }
         }
     } else {
         $terms = hocwp_get_terms($taxonomies, $defaults);
     }
     if (($in_current_post || $child_of_current) && !hocwp_array_has_value($terms)) {
         return;
     }
     if ($parent_as_title && is_tax()) {
         $current_term = hocwp_term_get_current();
         if (hocwp_id_number_valid($current_term->parent)) {
             $parent = hocwp_term_get_top_most_parent($current_term);
             $instance['title'] = $parent->name;
         } elseif ($child_of_current) {
             $instance['title'] = $current_term->name;
         }
     }
     hocwp_widget_before($args, $instance);
     ob_start();
     if (hocwp_array_has_value($terms)) {
         $count_terms = count($terms);
         $html = '<ul class="list-unstyled list-terms">';
         $count = 0;
         foreach ($terms as $term) {
             $item_class = 'term-item';
             hocwp_add_string_with_space_before($item_class, hocwp_sanitize_html_class('tax-' . $term->taxonomy));
             if (!(bool) $hide_thumbnail) {
                 hocwp_add_string_with_space_before($item_class, 'show-thumbnail');
             }
             if ((bool) $only_thumbnail) {
                 hocwp_add_string_with_space_before($item_class, 'only-thumbnail');
             }
             $full_width = hocwp_widget_item_full_width_result($full_width_item, $count_terms, $count);
             if ($full_width) {
                 hocwp_add_string_with_space_before($item_class, 'full-width');
             }
             if ((bool) $show_count) {
                 hocwp_add_string_with_space_before($item_class, 'show-count');
             } else {
                 hocwp_add_string_with_space_before($item_class, 'no-count');
             }
             $html .= '<li class="' . $item_class . '">';
             if (!(bool) $hide_thumbnail) {
                 $html .= hocwp_term_get_thumbnail_html(array('term' => $term, 'width' => $thumbnail_size[0], $thumbnail_size[1], 'bfi_thumb' => false));
             }
             if (!(bool) $only_thumbnail) {
                 $term_name = $term->name;
                 if ($different_name) {
                     $term_name = hocwp_term_get_name($term);
                 }
                 $html .= '<a class="term-name" href="' . get_term_link($term) . '">' . $term_name . '</a>';
                 if ((bool) $show_count && !empty($count_format)) {
                     $html .= ' <span class="count">' . str_replace('%TERM_COUNT%', $term->count, $count_format) . '</span>';
                 }
             }
             $html .= '</li>';
             $count++;
         }
         $html .= '</ul>';
         echo $html;
     } else {
         _e('Sorry, nothing found.', 'hocwp-theme');
     }
     $widget_html = ob_get_clean();
     $widget_html = apply_filters('hocwp_widget_term_html', $widget_html, $args, $instance, $this);
     echo $widget_html;
     hocwp_widget_after($args, $instance);
 }