Пример #1
0
/**
 * Display the picture url of the current item in the Xintaoke Loop.
 *
 */
function the_share_picurl($type = 200, $_share = 0)
{
    echo get_the_share_picurl($type, $_share);
}
Пример #2
0
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('xt_widget_title', empty($instance['title']) ? '分享' : $instance['title'], $instance, $this->id_base);
        $style = isset($instance['style']) ? $instance['style'] : 'MZ';
        $sortby = empty($instance['sortby']) ? 'newest' : $instance['sortby'];
        $cid = empty($instance['cid']) ? '' : $instance['cid'];
        $row = isset($instance['row']) ? intval($instance['row']) : 1;
        $tagPicCount = $style == 'MZ' ? 10 : $row * 6;
        $tagCount = $style == 'MZ' ? 20 : 28;
        $query_tags = query_tags(array('cid' => $cid, 'tag_per_page' => $tagPicCount + $tagCount));
        $tags = $query_tags['tags'];
        $shares = xt_shareandtags($cid, array_slice($tags, 0, $tagPicCount), $sortby);
        $count = count($shares);
        if ($style == 'MZ') {
            echo str_replace('clearfix', 'xt-widget-shareandtags-mz clearfix', $before_widget);
            ?>
            <div class="hd"><h4 <?php 
            echo !empty($title) ? '' : 'style="display:none;"';
            ?>
><span><?php 
            echo $title;
            ?>
</span></h4></div>
            <div class="bd">
                <div class="clearfix">
                    <div class="xt-big xt-img-box">
                        <?php 
            if ($count > 0) {
                $_share = $shares[0]['share'];
                $_tag = $shares[0]['tag'];
                if (!empty($_share)) {
                    ?>
                                <a href="<?php 
                    echo xt_get_shares_search_url(array('cid' => $cid, 's' => $_tag));
                    ?>
" target="_blank" title="<?php 
                    echo $_share->title;
                    ?>
"><?php 
                    xt_write_pic(base64_encode(get_the_share_picurl(200, $_share)), $_share->title);
                    ?>
<span><?php 
                    echo $_tag;
                    ?>
</span></a>
                                <?php 
                } else {
                    ?>
                                <a href="<?php 
                    echo xt_get_shares_search_url(array('cid' => $cid, 's' => $_tag));
                    ?>
" target="_blank"><span><?php 
                    echo $_tag;
                    ?>
</span></a>
                                <?php 
                }
            }
            ?>
                    </div>
                    <div class="xt-small">
                        <?php 
            if ($count > 1) {
                $length = $count > 7 ? 7 : $count;
                for ($i = 1; $i < $length; $i++) {
                    $_share = $shares[$i]['share'];
                    $_tag = $shares[$i]['tag'];
                    if (!empty($_share)) {
                        ?>
                                    <div class="xt-img-box"><a href="<?php 
                        echo xt_get_shares_search_url(array('cid' => $cid, 's' => $_tag));
                        ?>
" target="_blank" title="<?php 
                        echo $_share->title;
                        ?>
"><?php 
                        xt_write_pic(base64_encode(get_the_share_picurl(160, $_share)), $_share->title);
                        ?>
<span><?php 
                        echo $_tag;
                        ?>
</span></a></div>
                                    <?php 
                    } else {
                        ?>
                                    <div class="xt-img-box"><a href="<?php 
                        echo xt_get_shares_search_url(array('cid' => $cid, 's' => $_tag));
                        ?>
" target="_blank"><span><?php 
                        echo $_tag;
                        ?>
</span></a></div>
                                    <?php 
                    }
                }
            }
            ?>
                    </div>
                    <div class="xt-big xt-img-box">
                        <?php 
            if ($count > 7) {
                $_share = $shares[7]['share'];
                $_tag = $shares[7]['tag'];
                if (!empty($_share)) {
                    ?>
                                <a href="<?php 
                    echo xt_get_shares_search_url(array('cid' => $cid, 's' => $_tag));
                    ?>
" target="_blank" title="<?php 
                    echo $_share->title;
                    ?>
"><?php 
                    xt_write_pic(base64_encode(get_the_share_picurl(200, $_share)), $_share->title);
                    ?>
<span><?php 
                    echo $_tag;
                    ?>
</span></a>
                                <?php 
                } else {
                    ?>
                                <a href="<?php 
                    echo xt_get_shares_search_url(array('cid' => $cid, 's' => $_tag));
                    ?>
" target="_blank"><span><?php 
                    echo $_tag;
                    ?>
</span></a>
                                <?php 
                }
            }
            ?>
                    </div>
                    <div class="xt-small xt-last">
                        <?php 
            if ($count > 8) {
                for ($i = 8; $i < $count; $i++) {
                    $_share = $shares[$i]['share'];
                    $_tag = $shares[$i]['tag'];
                    if (!empty($_share)) {
                        ?>
                                    <div class="xt-img-box"><a href="<?php 
                        echo xt_get_shares_search_url(array('cid' => $cid, 's' => $_tag));
                        ?>
" target="_blank" title="<?php 
                        echo $_share->title;
                        ?>
"><?php 
                        xt_write_pic(base64_encode(get_the_share_picurl(160, $_share)), $_share->title);
                        ?>
<span><?php 
                        echo $_tag;
                        ?>
</span></a></div>
                                    <?php 
                    } else {
                        ?>
                                    <div class="xt-img-box"><a href="<?php 
                        echo xt_get_shares_search_url(array('cid' => $cid, 's' => $_tag));
                        ?>
" target="_blank"><span><?php 
                        echo $_tag;
                        ?>
</span></a></div>
                                    <?php 
                    }
                }
            }
            ?>
                    </div>
                </div>
                <?php 
            if (count($tags) > $tagPicCount) {
                $tags = array_slice($tags, $tagPicCount, $tagCount);
                $tagsList = array_chunk($tags, 5);
                ?>
                    <div class="xt-tags clearfix">
                        <?php 
                foreach ($tagsList as $_tags) {
                    if (!empty($_tags)) {
                        $_count = 0;
                        foreach ($_tags as $_tag) {
                            echo '<a ' . ($_count == 0 ? 'class="xt-first"' : 'class="text-gray"') . ' href="' . xt_get_shares_search_url(array('cid' => $cid, 's' => $_tag->title)) . '" target="_blank">' . $_tag->title . '</a>';
                            $_count++;
                        }
                    }
                }
                ?>
                    </div>
                    <?php 
            }
            ?>

            </div>
            <?php 
        } else {
            echo $before_widget;
            ?>
            <div class="hd xt-bd-radius-top"><h4 class="xt-bd-l" <?php 
            echo !empty($title) ? '' : 'style="display:none;"';
            ?>
><span><?php 
            echo $title;
            ?>
</span></h4></div>
            <div class="bd xt-bd-radius-bottom">
                <?php 
            if (!empty($shares)) {
                $_count = 0;
                ?>
                    <ul class="thumbnails">
                        <?php 
                if (!empty($shares)) {
                    foreach ($shares as $__share) {
                        $_share = $__share['share'];
                        $_tag = $__share['tag'];
                        if (!empty($_share)) {
                            ?>
                                    <li><a class="thumbnail" href="<?php 
                            echo xt_get_shares_search_url(array('cid' => $cid, 's' => $_tag));
                            ?>
" target="_blank" title="<?php 
                            echo $_share->title;
                            ?>
"><?php 
                            xt_write_pic(base64_encode(get_the_share_picurl(200, $_share)), $_share->title);
                            ?>
<span><?php 
                            echo $_tag;
                            ?>
</span></a></li>
                                    <?php 
                        } else {
                            ?>
                                    <li><a class="thumbnail" href="<?php 
                            echo xt_get_shares_search_url(array('cid' => $cid, 's' => $_tag));
                            ?>
" target="_blank"><span><?php 
                            echo $_tag;
                            ?>
</span></a></li>
                                    <?php 
                        }
                    }
                }
                ?>
	
                    </ul>
                <?php 
            }
            ?>
                <?php 
            if (count($tags) > $tagPicCount) {
                $tags = array_slice($tags, $tagPicCount - 1, $tagCount);
                ?>
                    <div class="clearfix" style="position:relative;">
                        <?php 
                $chunks = array_chunk($tags, 7);
                foreach ($chunks as $chunk) {
                    $_tag0 = (array) $chunk[0];
                    ?>
                            <dl class="dl-horizontal pull-left">
                                <dt>
                                <a target="_blank" class="text-success" href="<?php 
                    echo xt_get_shares_search_url(array('cid' => $cid, 's' => $_tag0['title']));
                    ?>
"><?php 
                    echo $_tag0['title'];
                    ?>
</a>
                                </dt>
                                <dd>
                                    <ul class="inline">
                                        <?php 
                    for ($i = 1; $i < count($chunk); $i++) {
                        $_random = rand(1, 3);
                        $_tag = (array) $chunk[$i];
                        echo '<li><a ' . ($_random == 1 ? ' class="text-default" ' : ' class="text-gray"') . 'href="' . xt_get_shares_search_url(array('cid' => $cid, 's' => $_tag['title'])) . '" target="_blank">' . $_tag['title'] . '</a></li>';
                    }
                    ?>
                                    </ul>
                                </dd>
                            </dl>
                        <?php 
                }
                ?>
                        <?php 
                if ($cid > 0) {
                    ?>
<a class="xt-widget-tag-more label-default" href="<?php 
                    echo xt_get_shares_search_url(array('cid' => $cid));
                    ?>
" target="_blank">全部<span>...</span></a><?php 
                }
                ?>
                    </div>
                <?php 
            }
            ?>
		
            </div>	
            <?php 
        }
        echo $after_widget;
    }
Пример #3
0
function xt_widget_template_grid_sidesmall_item_share($_count, $rate, $item)
{
    $_url = get_the_share_url($item->id);
    $_title = esc_html($item->title);
    $_pic = get_the_share_picurl(80, $item);
    ?>
    <li class="media"<?php 
    echo $_count == 0 ? ' style="padding-top:0px;"' : '';
    ?>
>
        <a rel="nofollow" class="pull-left" href="<?php 
    echo $_url;
    ?>
" target="_blank">
            <?php 
    xt_write_pic(base64_encode($_pic), $_title, 0, 0, 'media-object');
    ?>
<span><i>喜欢:<?php 
    echo $item->fav_count;
    ?>
</i></span>
        </a>
        <div class="media-body">
            <h4 class="media-heading"><a rel="nofollow" class="text-gray" href="<?php 
    echo $_url;
    ?>
" target="_blank"><?php 
    echo $_title;
    ?>
</a></h4>
            <div class="media">
                <p><span>¥</span><strong><?php 
    echo $item->price;
    ?>
</strong></p>
                <p><span>来自:</span><a class="X_Nick" data-value="<?php 
    echo $item->user_id;
    ?>
" href="<?php 
    xt_the_user_url($item->user_id);
    ?>
" target="_blank"><?php 
    echo $item->user_name;
    ?>
</a></p>
            </div>
        </div>
    </li>
    <?php 
}