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 widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('xt_widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
     $cids = $instance['cids'];
     $cnames = $instance['cnames'];
     echo $before_widget;
     echo '<div class="hd"><h4 class="xt-bd-l" ' . (!empty($title) ? '' : 'style="display:none"') . '><span>' . $title . '</span></h4></div><div class="bd"><ul class="xt-bd-list unstyled clearfix">';
     if (!empty($cids) && !empty($cnames)) {
         $cids = explode(',', $cids);
         $cnames = explode(',', $cnames);
         if (count($cids) == count($cnames)) {
             global $xt_current_page;
             for ($i = 0; $i < count($cids); $i++) {
                 $_url = '';
                 if ($xt_current_page == 'taobaos') {
                     $_url = xt_get_taobao_search_url(array('cid' => $cids[$i]));
                 } elseif ($xt_current_page == 'paipais') {
                     $_url = xt_get_paipai_search_url(array('classId' => $cids[$i]));
                 }
                 echo '<li><a href="' . $_url . '">' . $cnames[$i] . '</a></li>';
             }
         }
     }
     echo '</ul></div>';
     echo $after_widget;
 }
예제 #3
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;
 }
예제 #4
0
 /**
  * xt__breadcrumbs function.
  * 
  * @access public
  * @return void
  */
 function xt_breadcrumbs()
 {
     global $xt, $wp_query;
     $this->breadcrumbs = array();
     if ($xt->is_taobaos || $xt->is_coupons) {
         $this->breadcrumbs[] = array('name' => '所有分类', 'url' => xt_site_url($xt->is_coupons ? 'coupon' : 'taobao'));
         $_param = $wp_query->query_vars['xt_param'];
         if (!empty($_param['cid'])) {
             $xt_taobao_itemcat = xt_taobao_item_cat(absint($_param['cid']));
             if (!empty($xt_taobao_itemcat)) {
                 $this->breadcrumbs[] = array('name' => htmlentities($xt_taobao_itemcat['name'], ENT_QUOTES, 'UTF-8'), 'url' => !empty($_param['keyword']) ? $xt->is_coupons ? xt_get_coupon_search_url(array('cid' => $xt_taobao_itemcat['cid'])) : xt_get_taobao_search_url(array('cid' => $xt_taobao_itemcat['cid'])) : '');
             }
         }
         if (!empty($_param['keyword'])) {
             $_s = htmlentities(trim($_param['keyword']), ENT_QUOTES, 'UTF-8');
             $this->breadcrumbs[] = array('name' => $_s, 'url' => '');
         }
     } elseif ($xt->is_shops) {
         $_param = $wp_query->query_vars['xt_param'];
         if (!empty($_param['keyword'])) {
             $this->breadcrumbs[] = array('name' => '所有分类', 'url' => xt_get_shop_search_url(array('keyword' => $_param['keyword'])));
         }
         if (!empty($_param['cid'])) {
             $xt_taobao_shopcat = xt_taobao_shopcat(absint($_param['cid']));
             if (!empty($xt_taobao_shopcat)) {
                 $this->breadcrumbs[] = array('name' => htmlentities($xt_taobao_shopcat['name'], ENT_QUOTES, 'UTF-8'), 'url' => !empty($_param['keyword']) ? xt_get_shop_search_url(array('cid' => $xt_taobao_shopcat['cid'])) : '');
             }
         }
         if (!empty($_param['keyword'])) {
             $_s = htmlentities(trim($_param['keyword']), ENT_QUOTES, 'UTF-8');
             $this->breadcrumbs[] = array('name' => $_s, 'url' => '');
         }
     } elseif ($xt->is_paipais) {
         $this->breadcrumbs[] = array('name' => '所有分类', 'url' => xt_site_url('paipai'));
         $_param = $wp_query->query_vars['xt_param'];
         if (!empty($_param['classId'])) {
             $xt_paipai_itemcat = xt_paipai_item_cat(absint($_param['classId']));
             if (!empty($xt_paipai_itemcat)) {
                 $this->breadcrumbs[] = array('name' => htmlentities($xt_paipai_itemcat['name'], ENT_QUOTES, 'UTF-8'), 'url' => !empty($_param['keyWord']) ? xt_get_paipai_search_url(array('classId' => $xt_paipai_itemcat['cid'])) : '');
             }
         }
         if (!empty($_param['keyWord'])) {
             $_s = htmlentities(trim($_param['keyWord']), ENT_QUOTES, 'UTF-8');
             $this->breadcrumbs[] = array('name' => $_s, 'url' => '');
         }
     } elseif ($xt->is_bijias) {
         $this->breadcrumbs[] = array('name' => '所有分类', 'url' => xt_site_url('bijia'));
         $_param = $wp_query->query_vars['xt_param'];
         if (!empty($_param['category']) && $_param['category'] != -1) {
             $xt_bijia_itemcat = xt_bijia_item_cat(absint($_param['category']));
             if (!empty($xt_bijia_itemcat)) {
                 $this->breadcrumbs[] = array('name' => htmlentities($xt_bijia_itemcat['catName'], ENT_QUOTES, 'UTF-8'), 'url' => !empty($_param['keyword']) ? xt_get_bijia_search_url(array('category' => $xt_bijia_itemcat['catId'])) : '');
             }
         }
         if (!empty($_param['keyword'])) {
             $_s = htmlentities(trim($_param['keyword']), ENT_QUOTES, 'UTF-8');
             $this->breadcrumbs[] = array('name' => $_s, 'url' => '');
         }
     } elseif ($xt->is_temais) {
         $_param = $wp_query->query_vars['xt_param'];
         if (!empty($_param['cat']) && $_param['cat'] != -1) {
             $xt_temai_itemcat = xt_temai_item_cat(absint($_param['cat']));
             if (!empty($xt_temai_itemcat)) {
                 if (!empty($xt_temai_itemcat['parent_cid'])) {
                     $this->breadcrumbs[] = array('name' => htmlentities($xt_temai_itemcat['parent_name'], ENT_QUOTES, 'UTF-8'), 'url' => xt_get_temai_search_url(array('cat' => $xt_temai_itemcat['parent_cid'])));
                 }
                 $this->breadcrumbs[] = array('name' => htmlentities($xt_temai_itemcat['name'], ENT_QUOTES, 'UTF-8'), 'url' => '');
             }
         }
     }
     $this->breadcrumbs = apply_filters('xt_breadcrumbs', $this->breadcrumbs);
     $this->breadcrumb_count = count($this->breadcrumbs);
 }
예제 #5
0
function _xt_widget_template_grid_item_paipai_filter($params = array())
{
    $_params = array_merge(array('keyWord' => '', 'begPrice' => '', 'endPrice' => '', 'orderStyle' => 11), $params);
    $orderStyle = intval($_params['orderStyle']);
    if (!in_array($orderStyle, array(6, 7, 9, 11, 21))) {
        $orderStyle = 11;
    }
    $_url = xt_get_paipai_search_url(array_merge($params, array('keyWord' => 'keyWord', 'begPrice' => 'begPrice', 'endPrice' => 'endPrice', 'orderStyle' => 'orderStyle')));
    ?>
    <div class="xt-filter-box xt-paipai-filter form-inline">
        关键词:<input type="text" id="X_Paipai-KeyWord" class="input-small" placeholder="请输入关键词" value="<?php 
    echo htmlentities($_params['keyWord'], ENT_QUOTES, "UTF-8");
    ?>
">
        价格:<input type="number" id="X_Paipai-BegPrice" class="span1" value="<?php 
    echo $_params['begPrice'] > 0 ? $_params['begPrice'] : '';
    ?>
">
        &nbsp;至&nbsp;<input type="number" id="X_Paipai-EndPrice" class="span1" value="<?php 
    echo $_params['endPrice'] ? $_params['endPrice'] : '';
    ?>
">
        <select id="X_Paipai-OrderStyle">
            <option value="6"<?php 
    selected($orderStyle, 6);
    ?>
>价格从低到高</option>
            <option value="7"<?php 
    selected($orderStyle, 7);
    ?>
>价格从高到低</option>
            <option value="9"<?php 
    selected($orderStyle, 9);
    ?>
>信用从高到低</option>
            <option value="11"<?php 
    selected($orderStyle, 11);
    ?>
>浏览量从高到低</option>
            <option value="21"<?php 
    selected($orderStyle, 21);
    ?>
>收藏量从高到低</option>
        </select>
        <button id="X_Paipai-Filter-Search-Btn" type="button" class="btn btn-small btn-primary" data-url="<?php 
    echo $_url;
    ?>
" data-loading-text="搜索中...">搜索</button>
    </div>
    <?php 
}