function xt_install_menu($global)
{
    $menu_id = wp_create_nav_menu('新淘客菜单');
    if ($menu_id) {
        //home
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => get_home_url('/'), 'menu-item-title' => '首页', 'menu-item-status' => 'publish', 'menu-item-position' => 1));
        //shares
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_get_shares_search_url(), 'menu-item-title' => '逛街啦', 'menu-item-status' => 'publish', 'menu-item-position' => 2));
        //albums
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_get_albums_search_url(), 'menu-item-title' => '专辑', 'menu-item-status' => 'publish', 'menu-item-position' => 3));
        //taobaos
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_get_taobao_search_url(), 'menu-item-title' => '淘宝', 'menu-item-status' => 'publish', 'menu-item-position' => 6));
        //paipais
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_get_paipai_search_url(), 'menu-item-title' => '拍拍', 'menu-item-status' => 'publish', 'menu-item-position' => 7));
        //bijias
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_get_bijia_search_url(), 'menu-item-title' => '比价', 'menu-item-status' => 'publish', 'menu-item-position' => 8));
        //tuans
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_get_tuan_search_url(), 'menu-item-title' => '团购', 'menu-item-status' => 'publish', 'menu-item-position' => 9));
        //coupons
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_get_coupon_search_url(), 'menu-item-title' => '折扣', 'menu-item-status' => 'publish', 'menu-item-position' => 10));
        //temais
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_get_temai_search_url(), 'menu-item-title' => '特卖', 'menu-item-status' => 'publish', 'menu-item-position' => 11));
        //stars
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_site_url('stars'), 'menu-item-title' => '明星', 'menu-item-status' => 'publish', 'menu-item-position' => 12));
        //brands
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-type' => 'custom', 'menu-item-url' => xt_site_url('brands'), 'menu-item-title' => '品牌', 'menu-item-status' => 'publish', 'menu-item-position' => 13));
        set_theme_mod('nav_menu_locations', array('primary' => $menu_id));
        $global['isMenu'] = 1;
        update_option(XT_OPTION_GLOBAL, $global);
    }
}
示例#2
0
function xt_header_script()
{
    global $xt;
    $_global = get_option(XT_OPTION_GLOBAL);
    $searchtaobaourl = '';
    if (xt_is_s8()) {
        $searchtaobaourl = xt_jump_url(array('title' => 'SEARCH'));
    } else {
        $searchtaobaourl = xt_get_taobao_search_url(array('keyword' => 'SEARCH'));
    }
    echo '<script type="text/javascript">var XT = ' . json_encode(array('isfanxian' => xt_is_fanxian() ? 1 : 0, 'siteurl' => home_url(), 'pluginurl' => XT_PLUGIN_URL, 'ajaxurl' => admin_url('admin-ajax.php'), 'loginurl' => site_url('wp-login.php'), 'inviteurl' => xt_site_url('invite-USERID'), 'authorizeurl' => xt_platform_authorize_url('[PLATFORM]', '[STATE]', '[MODE]'), 'registerurl' => site_url('wp-login.php?action=register&redirect_to=[REDIRECT]', 'login'), 'searchshareurl' => xt_get_shares_search_url(array('s' => 'SEARCH')), 'searchalbumurl' => xt_get_albums_search_url(array('s' => 'SEARCH')), 'searchuserurl' => '', 'searchtaobaourl' => $searchtaobaourl, 'taobaoitemurl' => xt_site_url('taobao-NUMIID'), 'searchshopurl' => xt_get_shop_search_url(array('keyword' => 'SEARCH')), 'searchtaobaoitemurl' => xt_jump_url(array('id' => 'SEARCH')), 'searchpaipaiurl' => xt_get_paipai_search_url(array('keyWord' => 'SEARCH')), 'searchbijiaurl' => xt_get_bijia_search_url(array('keyword' => 'SEARCH')), 'searchtuanurl' => xt_get_tuan_search_url(array('keyword' => 'SEARCH')), 'userId' => get_current_user_id(), 'token' => wp_create_nonce('token'), 'option' => $_global, 'is_taobaopopup' => xt_is_taobaoPopup(), 'is_shares' => $xt->is_shares, 'is_albums' => $xt->is_albums, 'is_users' => $xt->is_users, 'is_shops' => $xt->is_shops, 'is_paipais' => $xt->is_paipais, 'is_bijias' => $xt->is_bijias, 'is_tuans' => $xt->is_tuans, 'is_user' => $xt->is_user, 'is_album' => $xt->is_album, 'is_account' => $xt->is_account, 'rate' => xt_get_rate(), 'jifenbao' => xt_jifenbao_text(), 'outercode' => xt_outercode(), 'fanxianhtml' => xt_fanxian_html('{fx}', '{fxtext}'))) . ';</script>';
}
示例#3
0
function xt_default_menu($args = array())
{
    ?>
    <ul class="nav">
        <li class="menu-item"><a href="<?php 
    echo home_url('/');
    ?>
">首页</a></li>
        <li class="menu-item"><a href="<?php 
    echo xt_get_shares_search_url();
    ?>
">逛街啦</a></li>
        <li class="menu-item"><a href="<?php 
    echo xt_get_albums_search_url();
    ?>
">专辑</a></li>
        <li class="menu-item"><a href="<?php 
    echo xt_get_taobao_search_url();
    ?>
">淘宝</a></li>
        <li class="menu-item"><a href="<?php 
    echo xt_get_tuan_search_url();
    ?>
">团购</a></li>
        <li class="menu-item"><a href="<?php 
    echo xt_get_bijia_search_url();
    ?>
">比价</a></li>
        <li class="menu-item"><a href="<?php 
    echo xt_get_paipai_search_url();
    ?>
">拍拍</a></li>
        <li class="menu-item"><a href="<?php 
    echo xt_get_temai_search_url();
    ?>
">特卖</a></li>
        <li class="menu-item"><a href="<?php 
    echo xt_get_coupon_search_url();
    ?>
">折扣</a></li>
        <li class="menu-item"><a href="<?php 
    echo xt_site_url('brands');
    ?>
">品牌</a></li>
        <li class="menu-item"><a href="<?php 
    echo xt_site_url('stars');
    ?>
">明星</a></li>
    </ul>
    <?php 
}
    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;
        if ($xt->is_albums) {
            $xt_album_param = $wp_query->query_vars['xt_param'];
            $s = isset($xt_album_param['s']) ? $xt_album_param['s'] : '';
            $h3 = !empty($s) ? $s : '';
            if (!isset($instance['isSort']) || $instance['isSort']) {
                $filterSortOrder = $xt_album_param['sortOrder'];
                ?>
	
                    <div class="row-fluid clearfix" style="margin-bottom:10px;">
                        <h3 class="pull-left text-default" style="margin:0px;"><?php 
                echo $h3;
                ?>
</h3>&nbsp;&nbsp;
                        <div class="pull-left" style="padding:8px 0px 3px 20px;">
                            排序:
                            <div class="btn-group">
                                <a class="btn btn-small <?php 
                echo $filterSortOrder == 'popular' ? 'btn-primary' : '';
                ?>
" href="<?php 
                echo xt_get_albums_search_url(array('s' => $s, 'sortOrder' => 'popular'));
                ?>
" data-value="popular">潮流</a>
                                <a class="btn btn-small <?php 
                echo $filterSortOrder == 'newest' ? 'btn-primary' : '';
                ?>
" href="<?php 
                echo xt_get_albums_search_url(array('s' => $s, 'sortOrder' => 'newest'));
                ?>
" data-value="newest">最新</a>
                                <a class="btn btn-small <?php 
                echo $filterSortOrder == 'hot' ? 'btn-primary' : '';
                ?>
" href="<?php 
                echo xt_get_albums_search_url(array('s' => $s, 'sortOrder' => 'hot'));
                ?>
" data-value="hot">最热</a>
                            </div>
                        </div>
                    </div>
                    <?php 
            }
        }
        $xt_album_param = $wp_query->query_vars['xt_param'];
        echo "<script type='text/javascript'>var XT_ALBUM_PARAMS=" . json_encode($xt_album_param) . ";</script>";
        get_the_album_container($xt_album_param, 'no albums', false, false, false);
        echo $after_widget;
    }
示例#5
0
 function query($query_vars)
 {
     global $wpdb, $xt;
     $this->init();
     $defaults = array('cid' => '', 'page' => 1, 'album_per_page' => xt_albumperpage(), 'user_id' => 0, 'no_found_rows' => 0, 's' => '', 'isFavorite' => 0, 'isShare' => 0, 'sortOrder' => '', 'album__in' => array());
     $this->query_vars = wp_parse_args($query_vars, $defaults);
     do_action_ref_array('xt_pre_get_albums', array(&$this));
     extract($this->query_vars, EXTR_SKIP);
     $page = absint($page);
     $album_per_page = absint($album_per_page);
     $table = $isFavorite ? XT_TABLE_FAVORITE : XT_TABLE_ALBUM;
     $fields = '*';
     $join = '';
     $where = '';
     $order = "ORDER BY " . XT_TABLE_ALBUM . ".update_date_gmt DESC";
     $groupby = '';
     if (!empty($cid) && $cid > 0) {
         global $xt_catalog;
         if (empty($xt_catalog) || $xt_catalog->id != $cid) {
             $xt_catalog = xt_get_catalog($cid);
         }
         if (!empty($xt_catalog)) {
             if (isset($xt_catalog->children) && !empty($xt_catalog->children)) {
                 $join .= " INNER JOIN " . XT_TABLE_ALBUM_CATALOG . " ON " . XT_TABLE_ALBUM_CATALOG . ".id = " . XT_TABLE_ALBUM . ".id ";
                 $where .= " AND " . XT_TABLE_ALBUM_CATALOG . ".cid in(" . $wpdb->escape($xt_catalog->children) . "," . $cid . ") ";
                 $groupby .= "GROUP BY " . XT_TABLE_ALBUM . ".id";
             } else {
                 $join .= " INNER JOIN " . XT_TABLE_ALBUM_CATALOG . " ON " . XT_TABLE_ALBUM_CATALOG . ".id = " . XT_TABLE_ALBUM . ".id ";
                 $where .= $wpdb->prepare(" AND " . XT_TABLE_ALBUM_CATALOG . ".cid=%d ", $cid);
             }
         }
     } elseif ($cid == -1) {
         $join = '';
         $where = ' AND ' . XT_TABLE_ALBUM . '.id NOT IN (SELECT ID FROM ' . XT_TABLE_ALBUM_CATALOG . ')';
     }
     if ($isFavorite) {
         $join .= " INNER JOIN " . XT_TABLE_ALBUM . " ON  " . XT_TABLE_FAVORITE . ".id=" . XT_TABLE_ALBUM . ".id ";
     }
     if ($user_id > 0) {
         if ($isFavorite) {
             $where .= $wpdb->prepare(" AND " . XT_TABLE_FAVORITE . ".user_id = %d AND " . XT_TABLE_FAVORITE . ".type=2", $user_id);
         } else {
             $where .= $wpdb->prepare(" AND " . XT_TABLE_ALBUM . ".user_id = %d ", $user_id);
         }
     } elseif (!empty($s)) {
         $where .= " AND (" . XT_TABLE_ALBUM . ".title like '%" . $wpdb->escape($s) . "%' OR " . XT_TABLE_ALBUM . ".user_name like '%" . $wpdb->escape($s) . "%') ";
     }
     if (!empty($album__in)) {
         $album__in = implode(',', array_map('absint', $album__in));
         $where .= " AND " . XT_TABLE_ALBUM . ".id IN ({$album__in})";
     }
     $today_time = xt_get_todaytime();
     switch ($sortOrder) {
         case 'newest':
         default:
             $order = " ORDER BY " . XT_TABLE_ALBUM . ".update_date DESC";
             break;
         case 'popular':
             $day7_time = $today_time - 604800;
             //7 days
             $fields .= ",(" . XT_TABLE_ALBUM . ".create_date > {$day7_time}) AS time_sort ";
             $order = " ORDER BY time_sort DESC," . XT_TABLE_ALBUM . ".fav_count DESC";
             break;
         case 'hot':
             $day30_time = $today_time - 2592000;
             //30 days
             $fields .= ",(" . XT_TABLE_ALBUM . ".create_date > {$day30_time}) AS time_sort ";
             $order = " ORDER BY time_sort DESC," . XT_TABLE_ALBUM . ".fav_count DESC";
             break;
     }
     if (!$no_found_rows && $page && $album_per_page) {
         $limits = $wpdb->prepare("LIMIT %d, %d", ($page - 1) * $album_per_page, $album_per_page);
     } else {
         $limits = '';
     }
     if ($isFavorite) {
         $order = " ORDER BY " . XT_TABLE_FAVORITE . ".create_date DESC";
     }
     $found_rows = '';
     if (!$no_found_rows) {
         $found_rows = 'SQL_CALC_FOUND_ROWS';
     }
     $sql = "SELECT {$found_rows} {$fields} FROM {$table} {$join} WHERE 1=1 {$where} {$order}  {$limits}";
     $paged_albums = $wpdb->get_results($sql);
     $paged_albums = apply_filters_ref_array('xt_the_albums', array($paged_albums, &$this));
     $total_albums = -1;
     if (!$no_found_rows) {
         $total_albums = $wpdb->get_var('SELECT FOUND_ROWS()');
     }
     unset($sql);
     $this->found_albums = $total_albums;
     $this->albums = $paged_albums;
     $this->album_count = count($paged_albums);
     if ($total_albums > 1) {
         $total_page = ceil($total_albums / $album_per_page);
         $_base = '#%#%';
         if (isset($xt->is_albums) && $xt->is_albums) {
             $_base = xt_get_albums_search_url(array_merge($this->query_vars, array('page' => '%#%')));
         } else {
             if (isset($_GET['page']) && $_GET['page'] == 'xt_menu_share') {
                 $_base = add_query_arg('paged', '%#%', $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
             }
         }
         $this->paginate_links = paginate_links(array('base' => $_base, 'format' => '', 'end_size' => 3, 'total' => $total_page, 'current' => $page, 'prev_text' => '上一页', 'next_text' => '下一页', 'mid_size' => 1, 'type' => isset($_GET['page']) && $_GET['page'] == 'xt_menu_share' ? 'plain' : 'list'));
     }
     return array('albums' => $paged_albums, 'total' => $total_albums);
 }
示例#6
0
 function xt_design_pages()
 {
     global $xt_design_syspages;
     if (empty($xt_design_syspages)) {
         $xt_design_syspages = array('home' => array('id' => 'home', 'title' => '首页', 'preview' => home_url()), 'error404' => array('id' => 'error404', 'title' => '404错误页面', 'preview' => home_url('404')), 'shares' => array('id' => 'shares', 'title' => '分享列表页', 'preview' => xt_get_shares_search_url(), 'layouts_edit' => 0), 'share' => array('id' => 'share', 'title' => '分享详情页', 'preview' => xt_site_url('id-' . 'SHAREID')), 'albums' => array('id' => 'albums', 'title' => '专辑列表页', 'preview' => xt_get_albums_search_url(), 'layouts_edit' => 0), 'album' => array('id' => 'album', 'title' => '专辑详情页', 'preview' => xt_site_url('aid-' . 'ALBUMID'), 'layouts_edit' => 0), 'users' => array('id' => 'users', 'title' => '会员列表页', 'preview' => ''), 'user' => array('id' => 'user', 'title' => '会员详情页', 'preview' => xt_site_url('uid-USERID'), 'layouts_edit' => 0, 'widgets_edit' => 0), 'taobaos' => array('id' => 'taobaos', 'title' => '淘宝搜索页', 'preview' => xt_get_taobao_search_url(), 'layouts_edit' => 0), 'taobao' => array('id' => 'taobao', 'title' => '淘宝商品详情页', 'preview' => xt_site_url('taobao-NUMIID'), 'layouts_edit' => 0), 'shops' => array('id' => 'shops', 'title' => '淘宝店铺搜索页', 'preview' => xt_get_shop_search_url(), 'layouts_edit' => 0), 'paipais' => array('id' => 'paipais', 'title' => '拍拍搜索页', 'preview' => xt_get_paipai_search_url(), 'layouts_edit' => 0), 'bijias' => array('id' => 'bijias', 'title' => '全网搜索页', 'preview' => xt_get_bijia_search_url(), 'layouts_edit' => 0), 'tuans' => array('id' => 'tuans', 'title' => '团购搜索页', 'preview' => xt_get_tuan_search_url(), 'layouts_edit' => 0), 'temais' => array('id' => 'temais', 'title' => '淘宝特卖搜索页', 'preview' => xt_get_temai_search_url(), 'layouts_edit' => 0), 'coupons' => array('id' => 'coupons', 'title' => '淘宝折扣搜索页', 'preview' => xt_get_coupon_search_url(), 'layouts_edit' => 0), 'daogous' => array('id' => 'daogous', 'title' => '导购文章搜索页', 'preview' => xt_get_daogou_search_url(), 'layouts_edit' => 0), 'daogou' => array('id' => 'daogou', 'title' => '导购文章详情页', 'preview' => '', 'layouts_edit' => 0), 'helps' => array('id' => 'helps', 'title' => '帮助文章列表页', 'preview' => xt_get_help_search_url(), 'layouts_edit' => 0), 'help' => array('id' => 'help', 'title' => '帮助详情页', 'preview' => '', 'layouts_edit' => 0), 'brands' => array('id' => 'brands', 'title' => '天猫品牌街', 'preview' => xt_site_url('brands'), 'layouts_edit' => 0), 'stars' => array('id' => 'stars', 'title' => '明星店', 'preview' => xt_site_url('stars'), 'layouts_edit' => 0), 'activities' => array('id' => 'activities', 'title' => '特卖活动', 'preview' => xt_site_url('activities'), 'layouts_edit' => 0), 'taoquan' => array('id' => 'taoquan', 'title' => '淘宝优惠券', 'preview' => xt_site_url('taoquan'), 'layouts_edit' => 0), 'malls' => array('id' => 'malls', 'title' => '商城', 'preview' => xt_site_url('malls'), 'layouts_edit' => 0), 'invite' => array('id' => 'invite', 'title' => '邀请页', 'preview' => xt_site_url('invite-USERID'), 'layouts_edit' => 0));
     }
     return $xt_design_syspages;
 }
示例#7
0
function xt_row_catalog($cat, $count)
{
    $issub = $cat->parent > 0 ? 1 : 0;
    $_url = 'javascript:;';
    if ($cat->type == 'share') {
        $_url = xt_get_shares_search_url(array('cid' => $cat->id));
    } elseif ($cat->type == 'album') {
        $_url = xt_get_albums_search_url(array('cid' => $cat->id));
    }
    ?>
    <tr id="catalog-<?php 
    echo $cat->id;
    ?>
" <?php 
    echo $count % 2 == 0 ? 'class="alternate"' : '';
    ?>
>
        <td scope="row"><span><?php 
    echo $cat->id;
    ?>
</span></td>
        <td class="name column-name"<?php 
    echo $issub ? ' style="padding-left:20px;"' : '';
    ?>
><strong><a class="row-title" href="<?php 
    echo $_url;
    ?>
" target="_blank"><?php 
    echo ($issub ? '— ' : '') . $cat->title;
    ?>
</a></strong><br>
            <div class="row-actions">
                    <!--<span class="edit"><a href="">编辑</a> | </span>-->
                <span class="inline hide-if-no-js"><a href="#" class="editinline">快速编辑</a> | </span>
                <span class="delete"><a class="delete-catalog" href="javascript:;" data-value="<?php 
    echo $cat->id;
    ?>
">删除</a></span>
            </div>
            <div class="hidden" id="inline_<?php 
    echo $cat->id;
    ?>
">
                <div class="title"><?php 
    echo $cat->title;
    ?>
</div>
                <div class="pic"><?php 
    echo $cat->pic;
    ?>
</div>
                <div class="sort"><?php 
    echo $cat->sort;
    ?>
</div>
            </div>
        </td>
        <td><?php 
    echo $cat->is_front ? '前台分类' : '系统分类';
    ?>
</td>
        <td><?php 
    echo $cat->sort;
    ?>
</td>
        <td><?php 
    echo $cat->count;
    ?>
</td>
    </tr>
    <?php 
}