コード例 #1
0
 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);
    }
コード例 #3
0
ファイル: utils.php プロジェクト: skylarkcob/hocwp-projects
function hocwp_loading_image($args = array())
{
    $name = hocwp_get_value_by_key($args, 'name', 'icon-loading-circle-16.gif');
    $class = hocwp_get_value_by_key($args, 'class');
    hocwp_add_string_with_space_before($class, 'img-loading');
    $alt = hocwp_get_value_by_key($args, 'alt');
    $display = hocwp_get_value_by_key($args, 'display', 'none');
    $style = 'display: ' . $display;
    $img = new HOCWP_HTML('img');
    $image_url = hocwp_get_image_url($name);
    $img->set_image_alt($alt);
    $img->set_class($class);
    $img->set_attribute('style', $style);
    $img->set_image_src($image_url);
    $img->output();
}
コード例 #4
0
ファイル: slider.php プロジェクト: skylarkcob/hocwp-projects
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>';
        }
    }
}
コード例 #5
0
ファイル: ads.php プロジェクト: skylarkcob/hocwp-projects
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;
        }
    }
}
コード例 #6
0
ファイル: post.php プロジェクト: skylarkcob/hocwp-projects
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;
}
コード例 #7
0
function hocwp_theme_post_column_content_partner($column, $post_id)
{
    $post = get_post($post_id);
    if ('partner' == $post->post_type) {
        if ('url' == $column) {
            echo hocwp_get_post_meta($column, $post_id);
        } elseif ('thumbnail' == $column) {
            $thumbnail = hocwp_get_post_meta($column, $post_id);
            $thumbnail = hocwp_sanitize_media_value($thumbnail);
            $thumbnail = $thumbnail['url'];
            if (!empty($thumbnail)) {
                $img = new HOCWP_HTML('img');
                $img->set_image_src($thumbnail);
                $img->output();
            }
        }
    }
}
コード例 #8
0
function hocwp_setup_theme_more_user_profile($user)
{
    $user_id = $user->ID;
    ?>
	<h3><?php 
    _e('Social Accounts', 'hocwp-theme');
    ?>
</h3>
	<table class="form-table">
		<tr>
			<th><label for="facebook">Facebook</label></th>
			<td>
				<?php 
    $facebook = get_the_author_meta('facebook', $user_id);
    $input = new HOCWP_HTML('input');
    $input->set_attribute('name', 'facebook');
    if (empty($facebook)) {
        $input->set_attribute('type', 'button');
        $input->set_text(__('Connect with Facebook account', 'hocwp-theme'));
        $input->set_class('button button-secondary hide-if-no-js hocwp-connect-facebook facebook');
        $input->set_attribute('onclick', 'hocwp_facebook_login();');
    } else {
        $facebook_data = get_the_author_meta('facebook_data', $user_id);
        $avatar = hocwp_get_value_by_key($facebook_data, array('picture', 'data', 'url'));
        $email = hocwp_get_value_by_key($facebook_data, 'email');
        if (!empty($avatar)) {
            $img = new HOCWP_HTML('img');
            $img->set_image_alt('');
            $img->set_image_src($avatar);
        }
        $input->set_attribute('type', 'text');
        $input->set_attribute('readonly', 'readonly');
        $input->set_attribute('value', $facebook . ' - ' . $email);
        $input->set_class('regular-text hocwp-disconnect-social facebook');
        $input->set_attribute('data-user-id', $user_id);
        $input->set_attribute('data-social', 'facebook');
    }
    if (empty($facebook) && 'profile.php' == $GLOBALS['pagenow']) {
        $input->output();
        if (empty($facebook)) {
            hocwp_facebook_login_script(array('connect' => true));
        }
    } else {
        if (!empty($facebook)) {
            $input->output();
        } else {
            _e('You can only connect to social account on profile page.', 'hocwp-theme');
        }
    }
    ?>
			</td>
		</tr>
		<tr>
			<th><label for="google">Google</label></th>
			<td>
				<?php 
    $social = 'google';
    $social_id = get_the_author_meta($social, $user_id);
    $input = new HOCWP_HTML('input');
    $input->set_attribute('name', $social);
    if (empty($social_id)) {
        $input->set_attribute('type', 'button');
        $input->set_text(__('Connect with Google account', 'hocwp-theme'));
        $input->set_class('button button-secondary hide-if-no-js hocwp-connect-' . $social . ' ' . $social);
        $input->set_attribute('onclick', 'hocwp_google_login();');
    } else {
        $facebook_data = get_the_author_meta($social . '_data', $user_id);
        $avatar = hocwp_get_value_by_key($facebook_data, array('picture', 'data', 'url'));
        $email = hocwp_get_value_by_key($facebook_data, array('emails', 0, 'value'));
        if (!empty($avatar)) {
            $img = new HOCWP_HTML('img');
            $img->set_image_alt('');
            $img->set_image_src($avatar);
        }
        $input->set_attribute('type', 'text');
        $input->set_attribute('readonly', 'readonly');
        $input->set_attribute('value', $social_id . ' - ' . $email);
        $input->set_class('regular-text hocwp-disconnect-social ' . $social);
        $input->set_attribute('data-user-id', $user_id);
        $input->set_attribute('data-social', $social);
    }
    if (empty($social_id) && 'profile.php' == $GLOBALS['pagenow']) {
        $input->output();
        if (empty($social_id)) {
            hocwp_google_login_script(array('connect' => true));
        }
    } else {
        if (!empty($social_id)) {
            $input->output();
        } else {
            _e('You can only connect to social account on profile page.', 'hocwp-theme');
        }
    }
    ?>
			</td>
		</tr>
	</table>
	<?php 
}
コード例 #9
0
ファイル: login.php プロジェクト: skylarkcob/hocwp-projects
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 
}
コード例 #10
0
ファイル: term.php プロジェクト: skylarkcob/hocwp-projects
function hocwp_term_icon_html($term_id, $default = '')
{
    $icon = hocwp_get_term_icon($term_id);
    $icon = hocwp_sanitize_media_value($icon);
    $icon = $icon['url'];
    if (empty($icon)) {
        $icon = $default;
    }
    if (hocwp_string_contain($icon, 'fa') || hocwp_string_contain($icon, '</i>')) {
        echo $icon;
    } else {
        if (!empty($icon)) {
            $img = new HOCWP_HTML('img');
            $img->set_image_src($icon);
            $img->output();
        }
    }
}