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);
    }
Beispiel #3
0
function hocwp_generate_unsubscribe_link($email, $text = '')
{
    if (!is_email($email)) {
        return '';
    }
    $query = hocwp_get_post_by_meta('subscriber_email', $email, array('post_type' => 'hocwp_subscriber'));
    $key = '';
    $post = null;
    if ($query->have_posts()) {
        $post = array_shift($query->posts);
        $key = hocwp_get_post_meta('subscriber_deactivate_key', $post->ID);
    }
    if (empty($key)) {
        $key = hocwp_generate_reset_key();
        if (is_a($post, 'WP_Post')) {
            update_post_meta($post->ID, 'subscriber_deactivate_key', $key);
        }
    }
    $url = home_url('/');
    $url = add_query_arg(array('key' => $key, 'action' => 'unsubscribe', 'email' => $email), $url);
    $a = new HOCWP_HTML('a');
    $a->set_href($url);
    if (empty($text)) {
        $text = $url;
    }
    $a->set_text($text);
    $a->set_attribute('target', '_blank');
    return $a->build();
}
Beispiel #4
0
function hocwp_slider_html($args = array())
{
    if (!is_array($args)) {
        $position = $args;
    } else {
        $position = hocwp_get_value_by_key($args, 'position');
    }
    $slider = hocwp_get_slider_by_position($position);
    if (hocwp_is_post($slider)) {
        $items = hocwp_get_post_meta('slider_items', $slider->ID);
        $order = hocwp_get_value_by_key($items, 'order');
        if (!empty($order)) {
            $order = explode(',', $order);
            $items = hocwp_get_value_by_key($items, 'items');
            $slider_class = 'hocwp-slider';
            $thumbs = (bool) hocwp_get_value_by_key($args, 'thumbs', false);
            if ($thumbs) {
                hocwp_add_string_with_space_before($slider_class, 'thumbs-paging');
            }
            hocwp_add_string_with_space_before($slider_class, hocwp_sanitize_html_class($position));
            $custom_arrow = hocwp_get_value_by_key($args, 'custom_arrow');
            if ($custom_arrow) {
                $slider_class = hocwp_add_more_class($slider_class, 'custom-arrow');
            }
            $fit_width = hocwp_get_post_meta('fit_width', $slider->ID);
            $fit_width = hocwp_int_to_bool($fit_width);
            $height = hocwp_get_post_meta('height', $slider->ID);
            if (!hocwp_is_positive_number($height)) {
                $height = 350;
            }
            $atts = array('data-height="' . $height . '"');
            if ($fit_width) {
                $atts[] = 'data-fit-width="1"';
            }
            $atts = implode(' ', $atts);
            if (!empty($atts)) {
                $atts = ' ' . $atts;
                $atts = rtrim($atts);
            }
            echo '<div class="' . $slider_class . '">';
            echo '<ul class="list-unstyled list-items slickslide list-inline"' . $atts . '>';
            $list_paging = '';
            $lazyload = hocwp_get_value_by_key($args, 'lazyload');
            foreach ($order as $item_id) {
                $item = hocwp_get_value_by_key($items, $item_id);
                if (hocwp_array_has_value($item)) {
                    $title = hocwp_get_value_by_key($item, 'title');
                    $link = hocwp_get_value_by_key($item, 'link');
                    $description = hocwp_get_value_by_key($item, 'description');
                    $image_url = hocwp_get_value_by_key($item, 'image_url');
                    $image_id = hocwp_get_value_by_key($item, 'image_id');
                    $image_url = hocwp_return_media_url($image_url, $image_id);
                    $img = new HOCWP_HTML('img');
                    $img->set_image_src($image_url);
                    $img->add_class('slider-image');
                    $li = new HOCWP_HTML('li');
                    $li->set_text($img);
                    $li->add_class('slider-item');
                    if ($lazyload) {
                        $li->add_class('lazyload');
                        $img->set_attribute('data-original', $image_url);
                        $img->set_image_src(hocwp_get_image_url('transparent.gif'));
                    }
                    $list_paging .= $li->build();
                    if (!empty($link)) {
                        $a = new HOCWP_HTML('a');
                        $a->set_href($link);
                        $a->set_text($img);
                        $li->set_text($a);
                    } else {
                        $li->set_text($img);
                    }
                    $li->output();
                }
            }
            echo '</ul>';
            if ($thumbs) {
                echo '<div class="thumbs-paging slick-thumbs">';
                echo '<ul class="list-unstyled list-paging">';
                echo $list_paging;
                echo '</ul>';
                echo '</div>';
            }
            echo '</div>';
        }
    }
}
Beispiel #5
0
function hocwp_show_ads($args = array())
{
    $ads = $args;
    $position = '';
    if (!is_object($args)) {
        if (!is_array($args)) {
            $args = array('position' => $args);
        }
        $position = hocwp_get_value_by_key($args, 'position');
        if (!empty($position)) {
            $random = (bool) hocwp_get_value_by_key($args, 'random');
            $current_datetime = date(hocwp_get_date_format());
            $current_datetime = strtotime($current_datetime);
            $query_args = array('post_type' => 'hocwp_ads', 'posts_per_page' => 1, 'meta_query' => array('relation' => 'AND', array('relation' => 'OR', array('key' => 'expire', 'compare' => 'NOT EXISTS'), array('key' => 'expire', 'value' => '', 'compare' => '='), array('key' => 'expire', 'value' => 0, 'type' => 'numeric'), array('key' => 'expire', 'value' => $current_datetime, 'type' => 'numeric', 'compare' => '>=')), array('key' => 'active', 'value' => 1, 'type' => 'numeric')));
            if ($random) {
                $query_args['orderby'] = 'rand';
            }
            $ads = hocwp_get_post_by_meta('position', $position, $query_args);
            if ($ads->have_posts()) {
                $posts = $ads->posts;
                $ads = array_shift($posts);
            }
        }
    }
    if (hocwp_is_post($ads) && 'hocwp_ads' == $ads->post_type) {
        $code = hocwp_get_post_meta('code', $ads->ID);
        if (empty($code)) {
            $image = hocwp_get_post_meta('image', $ads->ID);
            $image = hocwp_sanitize_media_value($image);
            $image = $image['url'];
            if (!empty($image)) {
                $img = new HOCWP_HTML('img');
                $img->set_image_src($image);
                $url = hocwp_get_post_meta('url', $ads->ID);
                if (!empty($url)) {
                    $a = new HOCWP_HTML('a');
                    $a->set_href($url);
                    $a->set_text($img);
                    $code = $a->build();
                } else {
                    $code = $img->build();
                }
            }
        }
        if (!empty($code)) {
            $class = hocwp_get_value_by_key($args, 'class');
            hocwp_add_string_with_space_before($class, 'hocwp-ads text-center ads');
            if (!empty($position)) {
                hocwp_add_string_with_space_before($class, 'position-' . $position);
                $position = hocwp_sanitize_html_class($position);
                $class = hocwp_add_more_class($class, $position);
            }
            hocwp_add_string_with_space_before($class, $ads->post_name);
            $div = new HOCWP_HTML('div');
            $div->set_class($class);
            $div->set_text($code);
            $html = $div->build();
            $html = apply_filters('hocwp_ads_html', $html, $ads_or_args = $args);
            echo $html;
        }
    }
}
Beispiel #6
0
function hocwp_notification_posts_ajax_callback()
{
    $lists = get_option('hocwp_notification_posts');
    $lists = hocwp_to_array($lists);
    if (hocwp_array_has_value($lists)) {
        $query = hocwp_get_post_by_meta('subscriber_verified', 1, array('post_type' => 'hocwp_subscriber'));
        if ($query->have_posts()) {
            $subscribers = $query->posts;
            $date = hocwp_get_current_date();
            $transient_name = hocwp_build_transient_name('hocwp_notification_posts_table_%s', $date);
            if (false === ($table_content = get_transient($transient_name))) {
                $table = new HOCWP_HTML('table');
                $table->set_attribute('align', 'center');
                $table->set_attribute('width', '100%');
                $table->set_attribute('cellspacing', 0);
                $table->set_attribute('border', 0);
                $table->set_attribute('cellpadding', 0);
                $table->set_attribute('bgcolor', '#ffffff');
                $table_content = '';
                foreach ($lists as $post_id) {
                    $obj = get_post($post_id);
                    $post_type = get_post_type_object($obj->post_type);
                    if (!is_object($post_type) || !$post_type->public) {
                        continue;
                    }
                    $notified = (bool) hocwp_get_post_meta('hocwp_notification_posts_sent', $post_id);
                    if ($notified) {
                        continue;
                    }
                    $inner_table = $table;
                    $tbody = new HOCWP_HTML('tbody');
                    $tr = new HOCWP_HTML('tr');
                    $td = new HOCWP_HTML('td');
                    $td->set_attribute('style', 'font-size:1px;line-height:1px');
                    $tr->set_text($td);
                    $tr2 = new HOCWP_HTML('tr');
                    $td2 = new HOCWP_HTML('td');
                    $td2->set_attribute('style', 'border-bottom:2px dotted #808285;padding-bottom:12px');
                    $a = new HOCWP_HTML('a');
                    $a->set_attribute('target', '_blank');
                    $a->set_href(get_permalink($obj));
                    $a->set_attribute('style', 'font-family: Helvetica,arial,sans-serif; font-size: 20px; color: rgb(22, 63, 144); text-align: left; font-weight: 500; text-decoration: none; line-height: 27px;');
                    $a->set_text(get_the_title($obj));
                    $p = new HOCWP_HTML('p');
                    $excerpt = get_the_excerpt($obj);
                    if (empty($excerpt)) {
                        $excerpt = $obj->post_content;
                        $excerpt = strip_tags($excerpt);
                        $excerpt = apply_filters('excerpt_length', $excerpt, 150);
                    }
                    $p->set_text($excerpt);
                    $td2->set_text($a->build() . $p->build());
                    $tr2->set_text($td2);
                    $tbody->set_text($tr->build() . $tr2->build());
                    $inner_table->set_text($tbody);
                    $table_content .= $inner_table->build();
                    update_post_meta($post_id, 'hocwp_notification_posts_sent', 1);
                }
                if (!empty($table_content)) {
                    $tbody = new HOCWP_HTML('tbody');
                    $tr = new HOCWP_HTML('tr');
                    $td = new HOCWP_HTML('td');
                    $td->set_text($table_content);
                    $tr->set_text($td);
                    $tbody->set_text($tr);
                    $table->set_text($tbody);
                    $table_content = $table->build();
                }
            }
            if (!empty($table_content)) {
                foreach ($subscribers as $subscriber) {
                    $email = hocwp_get_post_meta('subscriber_email', $subscriber->ID);
                    if (is_email($email)) {
                        $transient_name = 'hocwp_notification_posts_to_user_' . md5($email);
                        $transient_name = hocwp_build_transient_name($transient_name . '_%s', $table_content);
                        if (false === get_transient($transient_name)) {
                            $subject = '[' . get_bloginfo('name') . '] New content updated on ' . hocwp_get_current_date(hocwp_get_date_format());
                            $message = $table_content;
                            $message = hocwp_mail_unsubscribe_link_footer($message, $email);
                            $sent = hocwp_send_html_mail($email, $subject, $message);
                            if ($sent) {
                                set_transient($transient_name, 1, DAY_IN_SECONDS);
                            }
                        }
                    }
                }
            }
        }
    }
    exit;
}
 public function set_page_title_action($action, $url, $text)
 {
     $action = hocwp_sanitize($action, 'html_class');
     hocwp_add_string_with_space_before($action, 'page-title-action');
     $link = new HOCWP_HTML('a');
     $link->set_class($action);
     $link->set_attribute('href', $url);
     $link->set_text($text);
     $this->page_title_action = $link->build();
 }
Beispiel #8
0
function hocwp_post_thumbnail($args = array())
{
    $post_id = isset($args['post_id']) ? $args['post_id'] : '';
    if (empty($post_id)) {
        $post_id = get_the_ID();
    }
    if (post_password_required($post_id) || is_attachment()) {
        return;
    }
    $args['post_id'] = $post_id;
    $transient_name = hocwp_build_transient_name('hocwp_cache_post_thumbnail_%s', $args);
    if (false === ($html = get_transient($transient_name))) {
        $cache = hocwp_get_value_by_key($args, 'cache', HOUR_IN_SECONDS);
        $thumbnail_url = hocwp_get_value_by_key($args, 'thumbnail_url');
        if (empty($thumbnail_url)) {
            $large_size = hocwp_get_value_by_key($args, 'large_size');
            if ($large_size) {
                $thumbnail_url = get_post_meta($post_id, 'large_thumbnail', true);
                $thumbnail_url = hocwp_sanitize_media_value($thumbnail_url);
                $thumbnail_url = $thumbnail_url['url'];
                if (empty($thumbnail_url)) {
                    $thumbnail_url = hocwp_get_post_thumbnail_url($post_id);
                }
            } else {
                $thumbnail_url = hocwp_get_post_thumbnail_url($post_id);
            }
        }
        if (empty($thumbnail_url)) {
            return;
        }
        $bfi_thumb = isset($args['bfi_thumb']) ? $args['bfi_thumb'] : true;
        $bfi_thumb = apply_filters('hocwp_use_bfi_thumb', $bfi_thumb, $post_id);
        $size = hocwp_sanitize_size($args);
        $width = $size[0];
        $height = $size[1];
        $enlarge = apply_filters('hocwp_enlarge_post_thumbnail_on_mobile', false);
        if ($enlarge && wp_is_mobile()) {
            $ratio = 600 / $width;
            $ratio = round($ratio);
            if ($ratio > 1) {
                $width *= $ratio;
                $height *= $ratio;
            }
        }
        $original = $thumbnail_url;
        if ($bfi_thumb) {
            $params = isset($args['params']) ? $args['params'] : array();
            if (is_numeric($width) && $width > 0) {
                $params['width'] = $width;
            }
            if (is_numeric($height) && $height > 0) {
                $params['height'] = $height;
            }
            $bfi_url = apply_filters('hocwp_pre_bfi_thumb', '', $thumbnail_url, $params);
            if (empty($bfi_url)) {
                if ($width > 0 || $height > 0) {
                    $bfi_url = bfi_thumb($thumbnail_url, $params);
                }
            }
            if (!empty($bfi_url)) {
                $thumbnail_url = $bfi_url;
            }
        }
        $img = new HOCWP_HTML('img');
        if (is_numeric($width) && $width > 0) {
            $img->set_attribute('width', $size[0]);
        }
        if (is_numeric($height) && $height > 0) {
            $img->set_attribute('height', $size[1]);
        }
        $img->set_attribute('data-original', $original);
        $lazyload = hocwp_get_value_by_key($args, 'lazyload', false);
        $img->set_attribute('alt', get_the_title($post_id));
        $img->set_class('attachment-post-thumbnail wp-post-image img-responsive');
        $img->set_attribute('src', $thumbnail_url);
        $centered = (bool) hocwp_get_value_by_key($args, 'centered', false);
        if ($centered) {
            $img->add_class('centered');
        }
        $bk_img = '';
        if ((bool) $lazyload) {
            $img->set_wrap_tag('noscript');
            $bk_img = $img->build();
            $img->set_wrap_tag('');
            $loading_icon = hocwp_get_value_by_key($args, 'loading_icon');
            if (!hocwp_is_image($loading_icon)) {
                $loading_icon = hocwp_get_image_url('transparent.gif');
            }
            $img->set_image_src($loading_icon);
            $img->set_attribute('data-original', $thumbnail_url);
            $img->add_class('lazyload');
        }
        $only_image = hocwp_get_value_by_key($args, 'only_image');
        if ((bool) $only_image) {
            $html = $img->build();
            if ((bool) $lazyload) {
                $html = $bk_img;
            }
        } else {
            $before = hocwp_get_value_by_key($args, 'before');
            $after = hocwp_get_value_by_key($args, 'after');
            $permalink = hocwp_get_value_by_key($args, 'permalink', get_permalink($post_id));
            $loop = isset($args['loop']) ? $args['loop'] : true;
            $custom_html = isset($args['custom_html']) ? $args['custom_html'] : '';
            $icon_video = hocwp_get_value_by_key($args, 'icon_video');
            if (true === $icon_video) {
                $icon_video = '<i class="fa fa-play-circle-o" aria-hidden="true"></i>';
            }
            $fancybox = (bool) hocwp_get_value_by_key($args, 'fancybox');
            $a = new HOCWP_HTML('a');
            $a->set_href($permalink);
            if (!empty($icon_video) && is_string($icon_video) && empty($custom_html)) {
                $a->set_text($icon_video);
                $custom_html = $a->build();
            }
            $icon_image = hocwp_get_value_by_key($args, 'icon_image');
            if (true === $icon_image) {
                $icon_image = '<i class="fa fa-camera" aria-hidden="true"></i>';
            }
            if (!empty($icon_image) && is_string($icon_image) && empty($custom_html)) {
                $a->set_text($icon_image);
                $custom_html = $a->build();
            }
            $cover = hocwp_get_value_by_key($args, 'cover');
            $schema = '';
            if (current_theme_supports('hocwp-schema')) {
                ob_start();
                ?>
				<meta itemprop="url" content="<?php 
                echo $thumbnail_url;
                ?>
">
				<meta itemprop="width" content="<?php 
                echo $width;
                ?>
">
				<meta itemprop="height" content="<?php 
                echo $height;
                ?>
">
				<?php 
                $schema = ob_get_clean();
            }
            $html = $before;
            if (is_singular() && !$loop) {
                ob_start();
                ?>
				<div class="post-thumbnail entry-thumb"<?php 
                hocwp_html_tag_attributes('div', 'entry_thumb');
                ?>
>
					<?php 
                $img->output();
                if ((bool) $lazyload) {
                    echo $bk_img;
                }
                echo $custom_html;
                echo $schema;
                ?>
				</div>
				<?php 
                $html = ob_get_clean();
            } else {
                if (!empty($custom_html)) {
                    $html .= '<div class="thumbnail-wrap">';
                }
                $class = 'post-thumbnail-loop entry-thumb post-thumbnail';
                $atts = '';
                if ($fancybox) {
                    hocwp_add_string_with_space_before($class, 'fancybox');
                    $atts = ' data-fancybox-group="gallery"';
                    $atts .= ' rel="gallery"';
                    $permalink = $original;
                }
                ob_start();
                ?>
				<a class="<?php 
                echo $class;
                ?>
"<?php 
                echo $atts;
                ?>
 href="<?php 
                echo $permalink;
                ?>
"
				   aria-hidden="true"<?php 
                hocwp_html_tag_attributes('a', 'entry_thumb');
                ?>
>
					<?php 
                $img->output();
                if ((bool) $lazyload) {
                    echo $bk_img;
                }
                if ($cover) {
                    echo '<span class="cover"></span>';
                }
                echo $schema;
                ?>
				</a>
				<?php 
                $html .= ob_get_clean();
                $html .= $custom_html;
                if (!empty($custom_html)) {
                    $html .= '</div>';
                }
            }
            $html .= $after;
        }
        if (!empty($html)) {
            set_transient($transient_name, $html, $cache);
        }
    }
    echo $html;
}
    public function widget($args, $instance)
    {
        $this->instance = $instance;
        global $post;
        $title = hocwp_widget_title($args, $instance, false);
        $post_type = $this->get_post_type_from_instance($instance);
        $post_types = array();
        foreach ($post_type as $fvdata) {
            $ptvalue = isset($fvdata['value']) ? $fvdata['value'] : '';
            if (!empty($ptvalue)) {
                $post_types[] = $ptvalue;
            }
        }
        $number = isset($instance['number']) ? $instance['number'] : $this->args['number'];
        $by = isset($instance['by']) ? $instance['by'] : $this->args['by'];
        $category = isset($instance['category']) ? $instance['category'] : json_encode($this->args['category']);
        $category = hocwp_json_string_to_array($category);
        $excerpt_length = isset($instance['excerpt_length']) ? $instance['excerpt_length'] : $this->args['excerpt_length'];
        $content_class = 'widget-content';
        $slider = hocwp_get_value_by_key($instance, 'slider', hocwp_get_value_by_key($this->args, 'slider'));
        $title_length = hocwp_get_value_by_key($instance, 'title_length', hocwp_get_value_by_key($this->args, 'title_length'));
        $hide_thumbnail = hocwp_get_value_by_key($instance, 'hide_thumbnail', hocwp_get_value_by_key($this->args, 'hide_thumbnail'));
        $widget_title_link_category = hocwp_get_value_by_key($instance, 'widget_title_link_category', hocwp_get_value_by_key($this->args, 'widget_title_link_category'));
        $category_as_widget_title = hocwp_get_value_by_key($instance, 'category_as_widget_title', hocwp_get_value_by_key($this->args, 'category_as_widget_title'));
        if ((bool) $slider) {
            hocwp_add_string_with_space_before($content_class, 'post-slider');
        }
        if ('category' == $by && (bool) $widget_title_link_category) {
            $cvalue = current($category);
            $term_id = isset($cvalue['value']) ? $cvalue['value'] : '';
            $term_id = absint($term_id);
            if ($term_id > 0) {
                $taxonomy = isset($cvalue['taxonomy']) ? $cvalue['taxonomy'] : '';
                $link = new HOCWP_HTML('a');
                $link->set_class('term-link');
                $link->set_href(get_term_link($term_id, $taxonomy));
                if ((bool) $category_as_widget_title) {
                    $term = get_term($term_id, $taxonomy);
                    $title = $term->name;
                } else {
                    $title = hocwp_get_value_by_key($instance, 'title');
                }
                $link->set_text($title);
                $title = hocwp_get_value_by_key($args, 'before_title') . $link->build() . hocwp_get_value_by_key($args, 'after_title');
            }
        }
        $query_args = array('posts_per_page' => $number, 'post_type' => $post_types);
        $w_query = new WP_Query();
        $get_by = false;
        switch ($by) {
            case 'recent':
                $get_by = true;
                break;
            case 'modified':
            case 'recent_modified':
                $get_by = true;
                $query_args['orderby'] = 'modified';
                $query_args['order'] = 'DESC';
                break;
            case 'rand':
            case 'random':
                $get_by = true;
                $query_args['orderby'] = 'rand';
                break;
            case 'most_comment':
            case 'comment_count':
            case 'comment':
                $get_by = true;
                $query_args['orderby'] = 'comment_count';
                break;
            case 'category':
                foreach ($category as $cvalue) {
                    $term_id = isset($cvalue['value']) ? $cvalue['value'] : '';
                    $term_id = absint($term_id);
                    if ($term_id > 0) {
                        $taxonomy = isset($cvalue['taxonomy']) ? $cvalue['taxonomy'] : '';
                        if (!empty($taxonomy)) {
                            $tax_item = array('taxonomy' => $taxonomy, 'field' => 'term_id', 'terms' => $term_id);
                            $query_args = hocwp_query_sanitize_tax_query($tax_item, $query_args);
                            $get_by = true;
                        }
                    }
                }
                break;
            case 'related':
                $get_by = true;
                break;
            case 'like':
                $get_by = true;
                $query_args['meta_key'] = 'likes';
                $query_args['orderby'] = 'meta_value_num';
                break;
            case 'view':
                $get_by = true;
                $query_args['meta_key'] = 'views';
                $query_args['orderby'] = 'meta_value_num';
                break;
            case 'featured':
                $get_by = true;
                hocwp_query_sanitize_featured_args($query_args);
                break;
            case 'favorite':
                break;
            case 'rate':
                break;
        }
        $get_by = apply_filters('hocwp_widget_post_get_by_check_status', $get_by, $args, $instance, $this);
        if ($get_by) {
            $query_args = apply_filters('hocwp_widget_post_query_args', $query_args, $args, $instance, $this);
            if ('related' == $by) {
                $w_query = hocwp_query_related_post($query_args);
            } else {
                $w_query = hocwp_query($query_args);
            }
        }
        $widget_html = hocwp_get_value_by_key($args, 'before_widget') . $title;
        $widget_html .= '<div class="' . $content_class . '">';
        $widget_post_pre_html = apply_filters('hocwp_widget_post_pre_html', '', $args, $instance, $this);
        if (!empty($widget_post_pre_html)) {
            $widget_html .= $widget_post_pre_html;
        } else {
            if ($w_query->have_posts()) {
                $widget_html .= apply_filters('hocwp_widget_post_before_loop', '', $args, $instance, $this);
                if ((bool) $slider) {
                    $four_posts = array_slice($w_query->posts, 0, 4);
                    $next_posts = array_slice($w_query->posts, 4, absint($w_query->post_count - 4));
                    $widget_content = apply_filters('hocwp_widget_post_pre_slider_html', '', $args, $instance, $this);
                    if (empty($widget_content)) {
                        $carousel_id = $this->id;
                        $carousel_id = hocwp_sanitize_id($carousel_id);
                        $count = 0;
                        ob_start();
                        ?>
						<div id="<?php 
                        echo $carousel_id;
                        ?>
" class="carousel slide" data-ride="carousel">
							<div class="carousel-inner" role="listbox">
								<?php 
                        foreach ($four_posts as $post) {
                            setup_postdata($post);
                            $class = 'item';
                            if (0 == $count) {
                                hocwp_add_string_with_space_before($class, 'active');
                            }
                            ?>
									<div class="<?php 
                            echo $class;
                            ?>
">
										<?php 
                            hocwp_article_before();
                            do_action('hocwp_widget_post_slider_before_post', $args, $instance, $this);
                            if (!(bool) $hide_thumbnail) {
                                if ('coupon' == $post->post_type) {
                                    $store = hocwp_get_coupon_store($post->ID);
                                    echo '<div class="text-center store-logo">';
                                    hocwp_term_the_thumbnail(array('term' => $store, 'width' => 180, 'height' => 110));
                                    echo '</div>';
                                } else {
                                    hocwp_post_thumbnail(array('width' => 300, 'height' => 200));
                                }
                            }
                            do_action('hocwp_widget_post_slider_before_post_title', $args, $instance, $this);
                            hocwp_post_title_link(array('title' => hocwp_substr(get_the_title(), $title_length)));
                            do_action('hocwp_widget_post_slider_after_post_title', $args, $instance, $this);
                            hocwp_entry_summary($excerpt_length);
                            do_action('hocwp_widget_post_slider_after_post', $args, $instance, $this);
                            hocwp_article_after();
                            ?>
									</div>
									<?php 
                            $count++;
                        }
                        wp_reset_postdata();
                        ?>
							</div>
							<ol class="carousel-indicators list-inline list-unstyled">
								<?php 
                        $count = count($four_posts);
                        for ($i = 0; $i < $count; $i++) {
                            $indicator_class = 'indicator-item';
                            if (0 == $i) {
                                hocwp_add_string_with_space_before($indicator_class, 'active');
                            }
                            ?>
									<li data-target="#<?php 
                            echo $carousel_id;
                            ?>
" data-slide-to="<?php 
                            echo $i;
                            ?>
"
									    class="<?php 
                            echo $indicator_class;
                            ?>
">
										<span><?php 
                            echo $i + 1;
                            ?>
</span>
									</li>
									<?php 
                        }
                        ?>
							</ol>
							<a class="left carousel-control" href="#<?php 
                        echo $carousel_id;
                        ?>
" role="button"
							   data-slide="prev">
								<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
								<span class="sr-only"><?php 
                        _e('Previous', 'hocwp-theme');
                        ?>
</span>
							</a>
							<a class="right carousel-control" href="#<?php 
                        echo $carousel_id;
                        ?>
" role="button"
							   data-slide="next">
								<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
								<span class="sr-only"><?php 
                        _e('Next', 'hocwp-theme');
                        ?>
</span>
							</a>
						</div>
						<?php 
                        $widget_content = ob_get_clean();
                        if (hocwp_array_has_value($next_posts)) {
                            $w_query->posts = $next_posts;
                            $w_query->post_count = count($next_posts);
                            ?>
							<div class="more-posts">
								<?php 
                            $widget_content .= $this->list_post_html($args, $instance, $w_query);
                            ?>
							</div>
							<?php 
                        }
                    }
                    $widget_content = apply_filters('hocwp_widget_post_slider_html', $widget_content, $args, $instance, $this);
                    $widget_html .= $widget_content;
                } else {
                    $widget_html .= $this->list_post_html($args, $instance, $w_query);
                }
                $widget_html .= apply_filters('hocwp_widget_post_after_loop', '', $args, $instance, $this);
            } else {
                $widget_html .= '<p class="nothing-found">' . __('Nothing found!', 'hocwp-theme') . '</p>';
            }
        }
        $widget_html = apply_filters('hocwp_widget_post_html', $widget_html, $args, $instance, $this);
        $widget_html .= '</div>';
        $widget_html .= hocwp_get_value_by_key($args, 'after_widget');
        echo $widget_html;
    }
function hocwp_theme_translation_comments_list_callback($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    $comment_id = $comment->comment_ID;
    $style = isset($args['style']) ? $args['style'] : 'ol';
    $avatar_size = isset($args['avatar_size']) ? absint($args['avatar_size']) : 64;
    $avatar_size = apply_filters('hocwp_comment_avatar_size', $avatar_size);
    $max_depth = isset($args['max_depth']) ? absint($args['max_depth']) : '';
    $comment_permalink = get_comment_link($comment);
    if ('div' == $style) {
        $tag = 'div';
        $add_below = 'comment';
    } else {
        $tag = 'li';
        $add_below = 'div-comment';
    }
    $comment_date = get_comment_date('Y-m-d H:i:s', $comment_id);
    $comment_author = '<div class="comment-author vcard">' . get_avatar($comment, $avatar_size) . '<b class="fn">' . get_comment_author_link() . '</b> <span class="says">nói:</span></div>';
    $comment_metadata = '<div class="comment-metadata"><a href="' . $comment_permalink . '"><time datetime="' . get_comment_time('c') . '">' . hocwp_human_time_diff_to_now($comment_date) . ' ' . 'trước' . '</time></a> <a class="comment-edit-link" href="' . get_edit_comment_link($comment_id) . '">(' . 'Sửa' . ')</a></div>';
    if ($comment->comment_approved == '0') {
        $comment_metadata .= '<p class="comment-awaiting-moderation">' . 'Bình luận của bạn đang được chờ để xét duyệt.' . '</p>';
    }
    $footer = new HOCWP_HTML('footer');
    $footer->set_class('comment-meta');
    $footer->set_text($comment_author . $comment_metadata);
    $comment_text = get_comment_text($comment_id);
    $comment_text = apply_filters('comment_text', $comment_text, $comment);
    $comment_content = '<div class="comment-content">' . $comment_text . '</div>';
    $reply = '<div class="reply comment-tools">';
    $reply .= get_comment_reply_link(array_merge($args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $max_depth)));
    $comment_tools_enabled = apply_filters('hocwp_comment_tools_enabled', true);
    if ($comment_tools_enabled) {
        $class = 'comment-like comment-likes';
        $session_comment_liked_key = 'comment_' . $comment_id . '_likes';
        $liked = intval(isset($_SESSION[$session_comment_liked_key]) ? $_SESSION[$session_comment_liked_key] : '');
        if ($liked == 1) {
            hocwp_add_string_with_space_before($class, 'disabled');
        }
        $a = new HOCWP_HTML('a');
        $a->set_class($class);
        $a->set_attribute('href', 'javascript:;');
        $a->set_attribute('data-session-likes-key', $session_comment_liked_key);
        $likes = hocwp_get_comment_likes($comment_id);
        $a->set_attribute('data-likes', $likes);
        $a->set_text('<span class="text">' . 'Thích' . '</span> <i class="fa fa-thumbs-o-up"></i><span class="sep-dot">.</span> <span class="count">' . $likes . '</span>');
        $reply .= $a->build();
        $a->set_class('comment-report');
        $a->remove_attribute('data-session-liked-key');
        $a->set_text('Báo cáo vi phạm' . '<i class="fa fa-flag"></i>');
        $reply .= $a->build();
        $a->set_class('comment-share');
        $share_text = '<span class="text">' . 'Chia sẻ' . '<i class="fa fa-angle-down"></i></span>';
        $share_text .= '<span class="list-share">';
        $share_text .= '<i class="fa fa-facebook facebook" data-url="' . hocwp_get_social_share_url(array('social_name' => 'facebook', 'permalink' => $comment_permalink)) . '"></i>';
        $share_text .= '<i class="fa fa-google-plus google" data-url="' . hocwp_get_social_share_url(array('social_name' => 'googleplus', 'permalink' => $comment_permalink)) . '"></i>';
        $share_text .= '<i class="fa fa-twitter twitter" data-url="' . hocwp_get_social_share_url(array('social_name' => 'twitter', 'permalink' => $comment_permalink)) . '"></i>';
        $share_text .= '</span>';
        $a->set_text($share_text);
        $reply .= $a->build();
    }
    $reply .= '</div>';
    $article = new HOCWP_HTML('article');
    $article->set_attribute('id', 'div-comment-' . $comment_id);
    $article->set_class('comment-body');
    $article_text = $footer->build();
    $article_text .= $comment_content;
    $article_text .= $reply;
    $article->set_text($article_text);
    $html = new HOCWP_HTML($tag);
    $comment_class = get_comment_class(empty($args['has_children']) ? '' : 'parent');
    $comment_class = implode(' ', $comment_class);
    $html_atts = array('class' => $comment_class, 'id' => 'comment-' . $comment_id, 'data-comment-id' => $comment_id);
    $html->set_attribute_array($html_atts);
    $html->set_text($article->build());
    $html->set_close(false);
    $html->output();
}
function hocwp_loop_pagination_item($args = array())
{
    $defaults = hocwp_pagination_defaults();
    // The number of page links to show before and after the current page.
    $range = hocwp_get_value_by_key($args, 'range', hocwp_get_value_by_key($defaults, 'range'));
    // The number of page links to show at beginning and end of pagination.
    $anchor = hocwp_get_value_by_key($args, 'anchor', hocwp_get_value_by_key($defaults, 'anchor'));
    // The minimum number of page links before ellipsis shows.
    $gap = hocwp_get_value_by_key($args, 'gap', hocwp_get_value_by_key($defaults, 'gap'));
    $hellip = hocwp_get_value_by_key($args, 'hellip', hocwp_get_value_by_key($defaults, 'hellip'));
    $show_max_page = hocwp_get_value_by_key($args, 'show_max_page', hocwp_get_value_by_key($defaults, 'show_max_page'));
    $min_page = hocwp_get_value_by_key($args, 'min_page', hocwp_get_value_by_key($defaults, 'min_page'));
    $current_page = isset($args['current_page']) ? $args['current_page'] : 1;
    $total_page = isset($args['total_page']) ? $args['total_page'] : 1;
    $current_item_link = hocwp_get_value_by_key($args, 'current_item_link', hocwp_get_value_by_key($defaults, 'current_item_link'));
    $request = isset($args['request']) ? $args['request'] : hocwp_get_request();
    $hidden_button = '<span class="item hidden-item">&hellip;</span>';
    if (!(bool) $hellip) {
        $hidden_button = '';
    }
    $result = '';
    $hidden_before = false;
    $hidden_after = false;
    $before_current = $current_page - $range;
    $after_current = $current_page + $range;
    for ($i = 1; $i <= $total_page; $i++) {
        if (!(bool) $show_max_page) {
            if ($i == $total_page && $current_page < $total_page - 2) {
                continue;
            }
        }
        if ($current_page == $i) {
            if ($current_item_link) {
                $link_href = hocwp_get_pagenum_link(array('pagenum' => $i, 'request' => $request));
                $result .= '<a class="item link-item current-item" href="' . $link_href . '" data-paged="' . $i . '">' . $i . '</a>';
            } else {
                $ajax = (bool) hocwp_get_value_by_key($args, 'ajax');
                $current_item = new HOCWP_HTML('span');
                if ($ajax) {
                    $current_item = new HOCWP_HTML('a');
                    $current_item->add_class('link-item');
                    $current_item->set_attribute('data-paged', $i);
                }
                $current_item->add_class('item current-item');
                $current_item->set_text($i);
                $result .= $current_item->build();
            }
        } else {
            $count_hidden_button_before = $before_current - ($anchor + 1);
            $count_hidden_button_after = $total_page - ($after_current + 1);
            $show_hidden_button_before = $i < $before_current && !$hidden_before && $count_hidden_button_before >= $gap ? true : false;
            $show_hidden_button_after = $i > $after_current && !$hidden_after && $count_hidden_button_after >= $gap ? true : false;
            if (1 == $i || $total_page == $i || $i <= $after_current && $i >= $before_current || $i <= $min_page && $current_page < 2) {
                $link_href = hocwp_get_pagenum_link(array('pagenum' => $i, 'request' => $request));
                $result .= '<a class="item link-item" href="' . $link_href . '" data-paged="' . $i . '">' . $i . '</a>';
            } else {
                if ($show_hidden_button_before && $current_page > 1) {
                    $result .= $hidden_button;
                    $hidden_before = true;
                    $i = $before_current - 1;
                } elseif ($i < $before_current) {
                    $link_href = hocwp_get_pagenum_link(array('pagenum' => $i, 'request' => $request));
                    $result .= '<a class="item link-item" href="' . $link_href . '" data-paged="' . $i . '">' . $i . '</a>';
                } elseif ($show_hidden_button_after) {
                    $result .= $hidden_button;
                    $hidden_after = true;
                    $i = $total_page - 1;
                } else {
                    $link_href = hocwp_get_pagenum_link(array('pagenum' => $i, 'request' => $request));
                    $result .= '<a class="item link-item" href="' . $link_href . '" data-paged="' . $i . '">' . $i . '</a>';
                }
            }
        }
    }
    return $result;
}
Beispiel #12
0
function hocwp_icon_circle_ajax($post_id, $meta_key)
{
    $div = new HOCWP_HTML('div');
    $div->set_attribute('style', 'text-align: center');
    $div->set_class('hocwp-switcher-ajax');
    $span = new HOCWP_HTML('span');
    $circle_class = 'icon-circle';
    $result = get_post_meta($post_id, $meta_key, true);
    if (1 == $result) {
        $circle_class .= ' icon-circle-success';
    }
    $span->set_attribute('data-id', $post_id);
    $span->set_attribute('data-value', $result);
    $span->set_attribute('data-key', $meta_key);
    $span->set_class($circle_class);
    $div->set_text($span->build());
    $div->output();
}
function hocwp_wc_get_cart_preview_html()
{
    $cart_preview = '';
    $cart_items = hocwp_wc_get_cart_items();
    $cart_preview .= '<ul class="cart-preview list-unstyled">';
    $cart_preview .= '<li class="title">' . __('Your cart', 'hocwp-theme') . '</li>';
    if (hocwp_array_has_value($cart_items)) {
        $cart_preview .= '<li class="cart-items"><ul class="list-unstyled list-products">';
        foreach ($cart_items as $item) {
            $post_id = hocwp_get_value_by_key($item, 'product_id');
            if (!hocwp_id_number_valid($post_id)) {
                continue;
            }
            $quantity = absint(hocwp_get_value_by_key($item, 'quantity'));
            $data = hocwp_get_value_by_key($item, 'data');
            $data = hocwp_object_to_array($data);
            $price = floatval(hocwp_get_value_by_key($data, 'price'));
            $li = new HOCWP_HTML('li');
            $li->set_class(hocwp_get_post_class($post_id, 'clearfix'));
            ob_start();
            hocwp_post_thumbnail(array('width' => 44, 'height' => 44, 'post_id' => $post_id));
            hocwp_post_title_link(array('title' => get_the_title($post_id), 'permalink' => get_permalink($post_id)));
            echo '<p class="info">';
            echo '<span class="price">' . sprintf(__('Price: %s', 'hocwp-theme'), hocwp_wc_format_price($price)) . '</span>';
            echo '<span class="quantity">' . sprintf(__('Quantity: %s', 'hocwp-theme'), number_format($quantity)) . '</span>';
            echo '</p>';
            echo '<i class="fa fa-remove" data-id="' . $post_id . '"></i>';
            $li_html = ob_get_clean();
            $li->set_text($li_html);
            $cart_preview .= $li->build();
        }
        $cart_preview .= '</ul></li>';
        $cart_preview .= '<li class="bottom">';
        $cart_preview .= '<span class="total">' . __('Total', 'hocwp-theme') . ': <strong>' . hocwp_wc_get_cart_total_formatted() . '</strong></span>';
        $cart_preview .= '<a class="btn-clickable orange go-page" href="' . hocwp_wc_get_checkout_url() . '">' . __('Checkout', 'hocwp-theme') . '</a>';
        $cart_preview .= '</li>';
    } else {
        $cart_preview .= '<li class="no-item-message">' . __('Your cart is empty now.', 'hocwp-theme') . '</li>';
    }
    $cart_preview .= '</ul>';
    $cart_preview = apply_filters('hocwp_wc_cart_preview_html', $cart_preview);
    return $cart_preview;
}
function hocwp_field_get_option($args = array())
{
    $value = isset($args['value']) ? $args['value'] : '';
    $text = isset($args['text']) ? $args['text'] : '';
    $selected = isset($args['selected']) ? $args['selected'] : '';
    $option = new HOCWP_HTML('option');
    $option->set_attribute('value', $value);
    $option->set_text($text);
    $attributes = isset($args['attributes']) ? $args['attributes'] : array();
    foreach ($attributes as $data_name => $att_value) {
        $option->set_attribute($data_name, $att_value);
    }
    if ($selected == $value) {
        $option->set_attribute('selected', 'selected');
    }
    return $option->build();
}
Beispiel #15
0
function hocwp_lostpassword_form($args = array())
{
    $defaults = hocwp_account_form_default_args();
    $args = wp_parse_args($args, $defaults);
    $data = hocwp_execute_lostpassword();
    $user_login = $data['user_login'];
    $error = $data['error'];
    $message = $data['message'];
    $redirect_to = hocwp_get_value_by_key($args, 'redirect_to', hocwp_get_method_value('redirect_to', 'get'));
    $logo = hocwp_get_value_by_key($args, 'logo', hocwp_get_login_logo_url());
    ?>
	<div class="hocwp-login-box module">
		<div class="module-header text-center">
			<?php 
    if (!empty($logo)) {
        $a = new HOCWP_HTML('a');
        $a->set_href(home_url('/'));
        $a->set_class('logo');
        $img = new HOCWP_HTML('img');
        $img->set_image_alt('');
        $img->set_image_src($logo);
        $a->set_text($img->build());
        $a->output();
    }
    $slogan = new HOCWP_HTML('p');
    $slogan->set_class('slogan');
    $slogan->set_text(sprintf($args['slogan'], hocwp_get_root_domain_name(home_url('/'))));
    $slogan->output();
    if (isset($_POST['submit']) || isset($_POST['wp-submit'])) {
        if (isset($_REQUEST['error']) || $error) {
            $message = hocwp_build_message($message, 'danger');
            echo $message;
        } else {
            if (!empty($message) && !$error || isset($_POST['submit']) && !empty($message)) {
                $message = hocwp_build_message($message, 'success');
                echo $message;
            }
        }
    }
    ?>
		</div>
		<div class="module-body">
			<h4 class="form-title"><?php 
    _e('Reset password', 'hocwp-theme');
    ?>
</h4>

			<form name="lostpasswordform" id="lostpasswordform" action="<?php 
    echo esc_url(wp_lostpassword_url());
    ?>
"
			      method="post">
				<p>
					<label><?php 
    echo hocwp_get_value_by_key($args, 'label_username', __('Username or Email', 'hocwp-theme'));
    ?>
						<br>
						<input type="text" size="20" value="<?php 
    echo esc_attr($user_login);
    ?>
" class="input"
						       id="user_login" name="user_login"></label>
				</p>
				<input type="hidden" name="action" value="lostpassword">
				<input type="hidden" name="redirect_to" value="<?php 
    echo $redirect_to;
    ?>
">

				<p class="submit">
					<input type="submit" name="wp-submit" id="wp-submit" class="button-primary"
					       value="Get New Password" tabindex="100"></p>
			</form>
		</div>
		<div class="module-footer">
			<div class="text-center">
				<p class="form-nav">
					<a href="<?php 
    echo esc_url(wp_login_url());
    ?>
"><?php 
    echo hocwp_get_value_by_key($args, 'label_log_in', __('Login', 'hocwp-theme'));
    ?>
</a>
					<span class="sep">|</span>
					<a href="<?php 
    echo esc_url(wp_lostpassword_url());
    ?>
"
					   title="<?php 
    echo $args['title_lostpassword_link'];
    ?>
"><?php 
    echo $args['text_lostpassword_link'];
    ?>
</a>
				</p>
			</div>
		</div>
	</div>
	<?php 
}
Beispiel #16
0
function hocwp_term_get_thumbnail_html($args = array())
{
    $thumb_url = hocwp_term_get_thumbnail_url($args);
    $result = '';
    $term = hocwp_get_value_by_key($args, 'term');
    if (!empty($thumb_url)) {
        $taxonomy = hocwp_get_value_by_key($args, 'taxonomy');
        if (!is_a($term, 'WP_Term')) {
            $term_id = hocwp_get_value_by_key($args, 'term_id');
            if (hocwp_id_number_valid($term_id) && !empty($taxonomy)) {
                $term = get_term($term_id, $taxonomy);
            }
        }
        if (is_a($term, 'WP_Term')) {
            $taxonomy = $term->taxonomy;
            $size = hocwp_sanitize_size($args);
            $link = hocwp_get_value_by_key($args, 'link', true);
            $show_name = hocwp_get_value_by_key($args, 'show_name');
            $img = new HOCWP_HTML('img');
            $img->set_image_src($thumb_url);
            if ($size[0] > 0) {
                $img->set_attribute('width', $size[0]);
            }
            if ($size[1] > 0) {
                $img->set_attribute('height', $size[1]);
            }
            $class = 'img-responsive wp-term-image';
            $slug = $term->taxonomy;
            hocwp_add_string_with_space_before($class, hocwp_sanitize_html_class($slug) . '-thumb');
            $img->set_class($class);
            $link_text = $img->build();
            if ((bool) $show_name) {
                $link_text .= '<span class="term-name">' . $term->name . '</span>';
            }
            $a = new HOCWP_HTML('a');
            $a->set_class('term-link ' . hocwp_sanitize_html_class($taxonomy));
            $a->set_text($link_text);
            $a->set_attribute('title', $term->name);
            $a->set_href(get_term_link($term));
            if (!(bool) $link) {
                $result = $img->build();
            } else {
                $result = $a->build();
            }
        }
    }
    return apply_filters('hocwp_term_thumbnail_html', $result, $term);
}