示例#1
0
function xt_ajax_search_shares()
{
    global $xt;
    $xt->is_shares = false;
    $xt_share_param = $_GET;
    if (isset($xt_share_param['s_index'])) {
        $xt->is_shares = true;
        if ($xt_share_param['page'] > $xt_share_param['s_index'] + 4) {
            exit('no more');
        }
    }
    unset($xt_share_param['action']);
    if (isset($xt_share_param['isHome']) && $xt_share_param['isHome']) {
        global $xt_pageuser_follows;
        $xt_pageuser_follows = get_user_meta(intval($xt_share_param['user_id']), XT_USER_FOLLOW, true);
        if (empty($xt_pageuser_follows)) {
            query_shares(array_merge(array('no_found_rows' => 1), $xt_share_param));
        } else {
            query_shares($xt_share_param);
        }
    } else {
        query_shares($xt_share_param);
    }
    $_isScroll = isset($xt_share_param['isScroll']) && "false" == $xt_share_param['isScroll'] ? false : true;
    $_isCatalog = isset($xt_share_param['isCatalog']) && "false" == $xt_share_param['isCatalog'] ? false : true;
    get_the_share_container($xt_share_param, false, true, $_isScroll);
    exit;
}
示例#2
0
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('xt_widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
        $cids = $instance['cids'];
        $color = isset($instance['color']) && !empty($instance['color']) ? $instance['color'] : 'yellow';
        echo $before_widget;
        echo '<div id="X_Topic_Menu"><ul class="nav nav-tabs">';
        if (!empty($cids)) {
            global $wpdb;
            $cats = $wpdb->get_results('SELECT * FROM ' . XT_TABLE_CATALOG . ' WHERE id in (' . implode(',', $cids) . ') AND type=\'share\'');
            $cats_array = array();
            $default_cat = 0;
            foreach ($cids as $cid) {
                $cats_array[$cid] = '';
            }
            if (!empty($cats)) {
                foreach ($cats as $cat) {
                    $cats_array[$cat->id] = esc_html($cat->title);
                }
            }
            $_count = 0;
            foreach ($cats_array as $cid => $cname) {
                if (!empty($cname)) {
                    if ($_count == 0) {
                        $default_cat = $cid;
                    }
                    ?>
                    <li <?php 
                    echo $_count == 0 ? 'class="active"' : '';
                    ?>
>
                        <a href="javascript:;" data-id="<?php 
                    echo $cid;
                    ?>
"><?php 
                    echo $cname;
                    ?>
</a>
                    </li>

                    <?php 
                    $_count++;
                }
            }
        }
        echo '</ul><i class="xt-right-bottom-left"></i> <i class="xt-right-bottom-right"></i></div>';
        if ($default_cat > 0) {
            query_shares(array('page' => 1, 'share_per_page' => 40, 'cid' => $default_cat, 'no_found_rows' => true));
            get_the_share_container(array('nopage' => true));
        }
        echo $after_widget;
    }
 function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
     echo $before_widget;
     global $wp_query;
     $xt_share_param = $wp_query->query_vars['xt_param'];
     echo "<script type='text/javascript'>var XT_SHARE_PARAMS=" . json_encode($xt_share_param) . ";</script>";
     get_the_share_container($xt_share_param, isset($instance['isCat']) && $instance['isCat']);
     echo $after_widget;
 }