function get_the_share_container($_params = array(), $isCatalog = false, $isAjax = false, $isScroll = true) { echo '<div id="X_Wall-Result" class="clearfix">'; echo '<div id="X_Wall-Container" class="xt-wall-container row" data-scroll="' . ($isScroll ? 'true' : 'false') . '">'; if ($isCatalog) { xt_load_template('xt-widget_catalog'); } $_user_id = 0; $_delClass = ''; $msg = 'share_not_found'; if (isset($_params['isHome']) && $_params['isHome']) { global $xt_pageuser_follows; if (!empty($xt_pageuser_follows)) { $msg = 'share_home_not_found_other'; if (!empty($xt_user) && $xt_user->exists()) { $current_user = wp_get_current_user(); if ($current_user->exists()) { if ($current_user->ID == $xt_user->ID) { $msg = 'share_home_not_found_myself'; } } } } else { $_params['nopage'] = 1; } } elseif (isset($_params['album_id']) && $_params['album_id']) { //xt_load_template('xt-widget_albums'); $_user_id = $_params['user_id']; $_delClass = 'xt-delete-album-share'; $msg = 'share_album_not_found'; } elseif (isset($_params['isFavorite']) && $_params['isFavorite']) { $_user_id = $_params['user_id']; $_delClass = 'xt-delete-favorite'; $msg = 'share_favorite_not_found'; } elseif (isset($_params['isShare']) && $_params['isShare']) { $msg = 'share_share_not_found'; } $_count = 0; echo '<div class="span12">'; while (xt_have_shares()) { xt_the_share(); get_the_share_template($_user_id, $_delClass); $_count++; } echo '</div>'; if ($_count == 0) { echo xt_not_found($msg, 'xt-share-not-found'); } echo '</div>'; if ($isScroll) { echo "<div id=\"X_Page-Nav\" style=\"display: none; \"><a id=\"X_Page-Next-Link\" rel=\"nofollow\" href=\"" . admin_url('admin-ajax.php') . "?action=xt_ajax_search_shares&s_index=" . $_params['page'] . "&" . http_build_query($_params) . "\"></a></div>"; } if (isset($_params['nopage']) && $_params['nopage']) { //no page } else { echo '<div id="X_Pagination-Bottom" class="clearfix">'; echo '<div class="pagination xt-pagination-links">'; xt_shares_pagination_links(); echo '</div>'; echo '</div>'; } echo '</div>'; }
function xt_screens() { global $xt, $wp_query, $xt_catalog, $xt_user, $xt_album, $xt_taobao_item, $xt_template_name; if (xt_is_404()) { if (is_home()) { xt_clear_404(); $xt->is_xintao = true; $xt->is_index = true; $xt_template_name = 'home'; } elseif (is_front_page()) { if (is_page(xt_base()) && !isset($wp_query->query_vars['xt_action'])) { xt_clear_404(); $xt->is_xintao = true; $xt->is_index = true; $xt_template_name = 'home'; } elseif (!isset($wp_query->query_vars['xt_action'])) { $xt->is_xintao = false; } } } if (is_404() && !$xt->is_xintao) { $xt->is_xintao = true; xt_set_404(); } if ($xt->is_xintao) { if (isset($_GET['invite']) && absint($_GET['invite']) > 0) { setcookie(XT_USER_PARENT, (string) $_GET['invite'], time() + 1296000, COOKIEPATH, COOKIE_DOMAIN); } $xt_share_param = isset($wp_query->query_vars['xt_param']) ? $wp_query->query_vars['xt_param'] : ''; if ($xt->is_shares) { query_shares($xt_share_param); if (isset($xt_share_param['s']) && !empty($xt_share_param['s'])) { //设置搜索词 $wp_query->set('s', $xt_share_param['s']); } if (absint($xt_share_param['cid']) > 0) { $_term = xt_get_catalog($xt_share_param['cid']); if (!empty($_term)) { $xt_catalog = $_term; } } } elseif ($xt->is_albums) { query_albums($xt_share_param); if (isset($xt_share_param['s']) && !empty($xt_share_param['s'])) { //设置搜索词 $wp_query->set('s', $xt_share_param['s']); } } elseif ($xt->is_share) { $xt_user = null; if (absint($xt_share_param) > 0) { query_shares(array('id' => absint($xt_share_param))); if (xt_have_shares()) { xt_the_share(); $xt_user = new WP_User(get_the_share_userid()); if (!empty($xt_user) && $xt_user->ID != 0) { xt_setup_single_userdata(); } else { xt_set_404(); } } else { xt_set_404(); } } else { xt_set_404(); } } elseif ($xt->is_user) { $xt_user = null; if (absint($xt_share_param) > 0) { $uid = absint($xt_share_param); $_user = wp_get_current_user(); if ($_user->exists()) { if ($_user->ID == $uid) { $xt_user = $_user; } } if (empty($xt_user) || $xt_user->ID == 0) { $_user = new WP_User($uid); if ($_user && $_user->ID != 0) { $xt_user = $_user; } } if (!empty($xt_user) && $xt_user->ID != 0) { xt_setup_single_userdata(); } } if (empty($xt_user) || $xt_user->ID == 0) { xt_set_404(); } } elseif ($xt->is_account) { $xt_user = wp_get_current_user(); if ($xt_user->exists()) { //xt_setup_single_userdata(); } else { xt_set_404(); wp_safe_redirect(site_url('wp-login.php')); exit; } } elseif ($xt->is_album) { $xt_user = null; $xt_album = null; if (absint($xt_share_param) > 0) { $xt_album = xt_get_album($xt_share_param); if (!empty($xt_album)) { $_user = wp_get_current_user(); if ($_user->exists()) { if ($_user->ID == $xt_album->user_id) { $xt_user = $_user; } else { $xt_user = new WP_User($xt_album->user_id); } } else { $xt_user = new WP_User($xt_album->user_id); } if (!empty($xt_user) && $xt_user->ID > 0) { xt_setup_single_userdata(); // query_albums(array ( // 'page' => 1, // 'album_per_page' => 20, // 'user_id' => $xt_album->user_id // )); //当前专辑所属用户的前20个专辑 query_shares(array('album_id' => absint($xt_share_param), 'page' => 1, 'share_per_page' => 40, 'user_id' => $xt_album->user_id)); } //当前专辑内的宝贝 } if (empty($xt_album) || empty($xt_user) || $xt_user->ID == 0) { xt_set_404(); } } } elseif ($xt->is_page) { } elseif ($xt->is_invite) { $xt_user = null; if (absint($xt_share_param) > 0) { $xt_user = new WP_User(absint($xt_share_param)); } if (empty($xt_user) || $xt_user->ID == 0) { xt_set_404(); } else { $user = wp_get_current_user(); if (!$user->exists()) { //15days setcookie(XT_USER_PARENT, (string) $xt_user->ID, time() + 1296000, COOKIEPATH, COOKIE_DOMAIN); } } } elseif ($xt->is_taobao) { $xt_taobao_item = xt_taobao_item($xt_share_param, "detail_url,num_iid,title,nick,props_name,cid,pic_url,num,location,price,post_fee,express_fee,ems_fee,item_img,prop_imgs"); if (is_wp_error($xt_taobao_item)) { xt_set_404(); } } if (xt_is_404()) { $xt_template_name = 'error404'; } if ($xt->is_login) { xt_load_template('xt-login', true, true); } elseif ($xt->is_jump) { xt_load_template('xt-jump', true, true); } elseif ($xt->is_sitemap) { xt_load_template('xt-sitemap', true, true); } else { xt_load_template('xt-template', true, true); } } }