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); } }
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 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; }
/** * 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); }
function xt_widget_template_grid($args) { global $wp_query; $default = array('breadcrumbs' => 0, 'pager_top' => '', 'pager_bottom' => '', 'total' => 0, 'size' => '', 'count' => '', 'title' => '', 'isHd' => true, 'type' => '', 'items' => array(), 'urlType' => 'direct', 'display' => array('title', 'price', 'volume', 'seller', 'discount'), 'params' => array()); $args = array_merge($default, $args); extract($args); $rate = xt_get_rate(); $span = 'span3'; switch ($size) { case 'big': $span = 'span3'; break; case 'normal': $span = 'span2-4'; break; case 'small': $span = 'span2'; break; } global $xt_current_widget; if ($xt_current_widget == 'systaobaos') { $breadcrumbs = 1; $params = $wp_query->query_vars['xt_param']; $page = $params['page_no']; $prev_url = $next_url = ''; if ($page > 1) { $prev_url = xt_get_taobao_search_url(array_merge($params, array('page_no' => $page - 1))); } if ($page < $total) { $next_url = xt_get_taobao_search_url(array_merge($params, array('page_no' => $page + 1))); } $base = xt_get_taobao_search_url(array_merge($params, array('page_no' => '%#%'))); $pager_top = xt_search_pager_top($prev_url, $next_url, $page, $count, $total); $pager_bottom = xt_search_pager_bottom($base, $page, $count, $total); } elseif ($xt_current_widget == 'syspaipais') { $breadcrumbs = 1; $params = $wp_query->query_vars['xt_param']; $page = $params['pageIndex']; $prev_url = $next_url = ''; if ($page > 1) { $prev_url = xt_get_paipai_search_url(array_merge($params, array('pageIndex' => $page - 1))); } if ($page < $total) { $next_url = xt_get_paipai_search_url(array_merge($params, array('pageIndex' => $page + 1))); } $base = xt_get_paipai_search_url(array_merge($params, array('pageIndex' => '%#%'))); $pager_top = xt_search_pager_top($prev_url, $next_url, $page, $count, $total); $pager_bottom = xt_search_pager_bottom($base, $page, $count, $total); } elseif ($xt_current_widget == 'sysbijias') { $breadcrumbs = 1; $params = $wp_query->query_vars['xt_param']; $page = $params['page_no']; $prev_url = $next_url = ''; if ($page > 1) { $prev_url = xt_get_bijia_search_url(array_merge($params, array('page_no' => $page - 1))); } if ($page < $total) { $next_url = xt_get_bijia_search_url(array_merge($params, array('page_no' => $page + 1))); } $base = xt_get_bijia_search_url(array_merge($params, array('page_no' => '%#%'))); $pager_top = xt_search_pager_top($prev_url, $next_url, $page, $count, $total); $pager_bottom = xt_search_pager_bottom($base, $page, $count, $total); } elseif ($xt_current_widget == 'systuans') { $breadcrumbs = 0; $params = $wp_query->query_vars['xt_param']; $page = $params['page_no']; $prev_url = $next_url = ''; if ($page > 1) { $prev_url = xt_get_tuan_search_url(array_merge($params, array('page_no' => $page - 1))); } if ($page < $total) { $next_url = xt_get_tuan_search_url(array_merge($params, array('page_no' => $page + 1))); } $base = xt_get_tuan_search_url(array_merge($params, array('page_no' => '%#%'))); $pager_top = xt_search_pager_top($prev_url, $next_url, $page, $count, $total); $pager_bottom = xt_search_pager_bottom($base, $page, $count, $total); } elseif ($xt_current_widget == 'systemais') { $breadcrumbs = 1; $params = $wp_query->query_vars['xt_param']; $page = $params['page_no']; $prev_url = $next_url = ''; if ($page > 1) { $prev_url = xt_get_temai_search_url(array_merge($params, array('page_no' => $page - 1))); } if ($page < $total) { $next_url = xt_get_temai_search_url(array_merge($params, array('page_no' => $page + 1))); } $base = xt_get_temai_search_url(array_merge($params, array('page_no' => '%#%'))); $pager_top = xt_search_pager_top($prev_url, $next_url, $page, $count, $total, 100); $pager_bottom = xt_search_pager_bottom($base, $page, $count, $total, 100); } elseif ($xt_current_widget == 'syscoupons') { $breadcrumbs = 1; $params = $wp_query->query_vars['xt_param']; $page = $params['page_no']; $prev_url = $next_url = ''; if ($page > 1) { $prev_url = xt_get_coupon_search_url(array_merge($params, array('page_no' => $page - 1))); } if ($page < $total) { $next_url = xt_get_coupon_search_url(array_merge($params, array('page_no' => $page + 1))); } $base = xt_get_coupon_search_url(array_merge($params, array('page_no' => '%#%'))); $pager_top = xt_search_pager_top($prev_url, $next_url, $page, $count, $total); $pager_bottom = xt_search_pager_bottom($base, $page, $count, $total); } ?> <div class="shop-display"> <div class="hd"> <?php if ($breadcrumbs) { xt_output_breadcrumbs(true, array('name' => $total . '件宝贝', 'url' => ''), false, $pager_top); } else { if ($xt_current_widget != 'systuans') { ?> <h4 class="xt-bd-l" <?php echo !empty($title) ? '' : 'style="display:none"'; ?> ><span><?php echo $title; ?> </span></h4> <?php } } if ($xt_current_widget == 'syspaipais') { _xt_widget_template_grid_item_paipai_filter($params); } elseif ($xt_current_widget == 'sysbijias') { _xt_widget_template_grid_item_bijia_filter($params); } elseif ($xt_current_widget == 'systuans') { _xt_widget_template_grid_item_tuan_filter($params, $pager_top); } elseif ($xt_current_widget == 'systemais') { _xt_widget_template_grid_item_temai_filter($params, $pager_top); } ?> </div> <div class="bd"> <?php if (!empty($items)) { echo '<ul class="thumbnails thumbnails-' . $span . ' clearfix">'; $_count = 0; if (empty($count)) { $count = count($items); } $fanxianText = '元'; $platform = ''; $isJifenbao = false; if ($type == 'taobao' || $type == 'coupon' || $type == 'temai') { $platform = 'taobao'; } elseif ($type == 'paipai') { $platform = 'paipai'; } if ($platform) { if (xt_fanxian_is_jifenbao($platform)) { $isJifenbao = true; $fanxianText = xt_jifenbao_text(); } } foreach ($items as $item) { if ($_count >= $count) { break; } switch ($type) { case 'taobao': xt_widget_template_grid_item_taobao($span, $rate, $item, $display, $isJifenbao, $fanxianText, $urlType); break; case 'paipai': xt_widget_template_grid_item_paipai($span, $rate, $item, $display, $isJifenbao, $fanxianText); break; case 'share': xt_widget_template_grid_item_share($span, $rate, $item, $display); break; case 'coupon': xt_widget_template_grid_item_coupon($span, $rate, $item, $display, $isJifenbao, $fanxianText, $urlType); break; case 'temai': xt_widget_template_grid_item_temai($span, $rate, $item, $display, $isJifenbao, $fanxianText, $urlType); break; case 'bijia': xt_widget_template_grid_item_bijia($span, $rate, $item, $display, $urlType); break; case 'tuan': xt_widget_template_grid_item_tuan($span, $rate, $item, $display, $urlType); break; } $_count++; } echo '</ul>'; if (!empty($pager_bottom)) { echo '<div id="X_Pagination-Bottom" class="clearfix">'; echo '<div class="pagination pagination-large xt-pagination-links">'; echo $pager_bottom; echo '</div>'; echo '</div>'; } } else { $msg = 'item_not_found'; switch ($type) { case 'taobao': $msg = 'item_taobao_not_found'; break; case 'paipai': $msg = 'item_paipai_not_found'; break; case 'share': $msg = 'share_not_found'; break; case 'coupon': $msg = 'item_coupon_not_found'; break; case 'temai': $msg = 'item_temai_not_found'; break; case 'bijia': $msg = 'item_bijia_not_found'; break; case 'tuan': $msg = 'item_tuan_not_found'; break; } echo xt_not_found($msg); } ?> <div class="clearfix"></div> </div> </div> <?php }