Example #1
0
function xt_register_from_fields_save($user_id, $password = "", $meta = array())
{
    global $xt_during_user_creation;
    if (!$xt_during_user_creation) {
        $user = new WP_User($user_id);
        $user_login = $user->user_login;
        xt_fanxian_invite($user_id);
        //invite
        if (xt_is_fanxian()) {
            //cash ,jifen
            $registe_cash = xt_fanxian_registe_cash();
            $registe_jifen = xt_fanxian_registe_jifen();
            if (intval($registe_cash) > 0 || intval($registe_jifen) > 0) {
                xt_new_fanxian(array('platform' => 'xt', 'trade_id' => $user_id, 'type' => 'REGISTE', 'user_id' => $user_id, 'user_name' => $user_login, 'fanxian' => intval($registe_cash), 'jifen' => intval($registe_jifen), 'create_time' => current_time('mysql'), 'order_time' => current_time('mysql')));
            }
        }
        do_action('xt_register_from_fields_save');
        if (isset($_POST['user_pass']) && !empty($_POST['user_pass'])) {
            $userdata = array();
            $userdata['ID'] = $user_id;
            $userdata['user_pass'] = $_POST['user_pass'];
            wp_new_user_notification($user_id, $_POST['user_pass'], 1);
            wp_update_user($userdata);
            //auto login
            wp_set_auth_cookie($user_id, true, false);
            wp_set_current_user($user_login);
            do_action('wp_login', $user_login);
            wp_redirect(home_url());
            exit;
        }
    }
}
Example #2
0
/**
 * xt_obtain_the_title function, for replaacing the page title with the category or product
 * @return string - the new page title
 */
function xt_obtain_the_title($sep)
{
    global $xt, $wpdb, $wp_query, $xt_meta, $share, $xt_catalog, $xt_user, $xt_album, $xt_taobao_item;
    if (!$xt->is_xintao) {
        return NULL;
    }
    $_site = get_bloginfo('name');
    if ($xt->is_index) {
        $title = $_site;
        $site_description = get_bloginfo('description', 'display');
        if ($site_description) {
            $title = "{$_site} {$sep} {$site_description}";
        }
        $_metas = get_option(XT_OPTION_PAGE_PRE . 'home');
        if (!empty($_metas) && isset($_metas['seos'])) {
            $_meta = $_metas['seos'];
            $_meta_keywords = htmlentities(stripslashes($_meta['keywords']), ENT_QUOTES, 'UTF-8');
            $_meta_description = htmlentities(stripslashes($_meta['description']), ENT_QUOTES, 'UTF-8');
            $_from = array('{sitetitle}', '{description}');
            $_to = array($_site, $site_description);
            $xt_meta['keywords'] = str_replace($_from, $_to, $_meta_keywords);
            $xt_meta['description'] = str_replace($_from, $_to, $_meta_description);
        }
        return $title;
    } elseif ($xt->is_page) {
        if (isset($wp_query->post) && isset($wp_query->post->ID)) {
            $title = $wp_query->post->post_title;
            $_metas = get_option(XT_OPTION_PAGE_PRE . $wp_query->post->ID);
            $_from = array('{title}', '{sitetitle}');
            $_to = array($title, $_site);
            $_meta_title = $title;
            if (!empty($_metas) && isset($_metas['seos'])) {
                $_meta = $_metas['seos'];
                $_meta_title = htmlentities(stripslashes($_meta['title']), ENT_QUOTES, 'UTF-8');
                $_meta_keywords = htmlentities(stripslashes($_meta['keywords']), ENT_QUOTES, 'UTF-8');
                $_meta_description = htmlentities(stripslashes($_meta['description']), ENT_QUOTES, 'UTF-8');
                $xt_meta['keywords'] = str_replace($_from, $_to, $_meta_keywords);
                $xt_meta['description'] = str_replace($_from, $_to, $_meta_description);
            }
            $_title = str_replace($_from, $_to, $_meta_title);
            return (empty($_title) ? $title : $_title) . " " . $sep . " " . $_site;
        }
    } elseif ($xt->is_shares) {
        $_metas = get_option(XT_OPTION_PAGE_PRE . 'shares');
        if (!empty($_metas) && isset($_metas['seos'])) {
            $_meta = $_metas['seos'];
            $_meta_title = htmlentities(stripslashes($_meta['title']), ENT_QUOTES, 'UTF-8');
            $_meta_keywords = htmlentities(stripslashes($_meta['keywords']), ENT_QUOTES, 'UTF-8');
            $_meta_description = htmlentities(stripslashes($_meta['description']), ENT_QUOTES, 'UTF-8');
            $_param = $wp_query->query_vars['xt_param'];
            $_price = $_param['price'];
            $prices = xt_prices();
            switch ($_price) {
                case 'low':
                    $_price = '(价位:0-' . $prices['low']['end'] . '元)';
                    break;
                case 'medium':
                    $_price = '(价位:' . $prices['medium']['start'] . '-' . $prices['medium']['end'] . '元)';
                    break;
                case 'high':
                    $_price = '(价位:' . $prices['high']['start'] . '-' . $prices['high']['end'] . '元)';
                    break;
                case 'higher':
                    $_price = '(价位:' . $prices['higher']['start'] . '元以上)';
                    break;
                default:
                    $_price = '';
            }
            $_from = array('{page}', '{sortOrder}', '{cat}', '{s}', '{price}', '{sitetitle}');
            $_sortOrder = array('newest' => '最新', 'popular' => '潮流', 'hot' => '最热');
            $_to = array($_param['page'] > 1 ? '第' . $_param['page'] . '页 ' : '', isset($_sortOrder[$_param['sortOrder']]) ? $_sortOrder[$_param['sortOrder']] : '', !empty($xt_catalog) ? $xt_catalog->title : '', $_param['s'], $_price, $_site);
            if (empty($xt_catalog)) {
                $_meta_keywords = preg_replace('/(\\{sortOrder\\}){0,1}\\{cat\\}(,|\\s|,)?/i', '', $_meta_keywords);
            }
            if (empty($_param['s'])) {
                $_meta_keywords = preg_replace('/(\\{sortOrder\\}){0,1}\\{s\\}(,|\\s|,)?/i', '', $_meta_keywords);
            }
            $xt_meta['keywords'] = str_replace($_from, $_to, $_meta_keywords);
            $xt_meta['description'] = str_replace($_from, $_to, $_meta_description);
            return str_replace($_from, $_to, $_meta_title) . " " . $sep . " " . $_site;
        }
    } elseif ($xt->is_share) {
        $_metas = get_option(XT_OPTION_PAGE_PRE . 'share');
        if (!empty($_metas) && isset($_metas['seos'])) {
            $_meta = $_metas['seos'];
            $_meta_title = htmlentities(stripslashes($_meta['title']), ENT_QUOTES, 'UTF-8');
            $_meta_keywords = htmlentities(stripslashes($_meta['keywords']), ENT_QUOTES, 'UTF-8');
            $_meta_description = htmlentities(stripslashes($_meta['description']), ENT_QUOTES, 'UTF-8');
            $_from = array('{title}', '{price}', '{sitetitle}', '{tags}', '{user}', '{share}');
            $_to = array($share->title, $share->cache_data['item']['price'], $_site, $share->tags, $share->user_name, $share->content);
            $xt_meta['keywords'] = str_replace($_from, $_to, $_meta_keywords);
            $xt_meta['description'] = str_replace($_from, $_to, $_meta_description);
            return str_replace($_from, $_to, $_meta_title) . " " . $sep . " " . $_site;
        }
    } elseif ($xt->is_user) {
        $_metas = get_option(XT_OPTION_PAGE_PRE . 'user');
        if (!empty($_metas) && isset($_metas['seos'])) {
            $_meta = $_metas['seos'];
            $_meta_title = htmlentities(stripslashes($_meta['title']), ENT_QUOTES, 'UTF-8');
            $_meta_keywords = htmlentities(stripslashes($_meta['keywords']), ENT_QUOTES, 'UTF-8');
            $_meta_description = htmlentities(stripslashes($_meta['description']), ENT_QUOTES, 'UTF-8');
            $_from = array('{user}', '{sitetitle}', '{description}');
            if (empty($xt_user->display_name)) {
                $xt_user->display_name = $xt_user->user_login;
            }
            $user_name = $wpdb->escape($xt_user->display_name);
            $_description = xt_html(xt_get_the_user_description());
            $_to = array($user_name, $_site, $_description);
            $xt_meta['keywords'] = str_replace($_from, $_to, $_meta_keywords);
            $xt_meta['description'] = str_replace($_from, $_to, $_meta_description);
            return str_replace($_from, $_to, $_meta_title) . " " . $sep . " " . $_site;
        }
    } elseif ($xt->is_albums) {
        $_metas = get_option(XT_OPTION_PAGE_PRE . 'albums');
        if (!empty($_metas) && isset($_metas['seos'])) {
            $_meta = $_metas['seos'];
            $_meta_title = htmlentities(stripslashes($_meta['title']), ENT_QUOTES, 'UTF-8');
            $_meta_keywords = htmlentities(stripslashes($_meta['keywords']), ENT_QUOTES, 'UTF-8');
            $_meta_description = htmlentities(stripslashes($_meta['description']), ENT_QUOTES, 'UTF-8');
            $_param = $wp_query->query_vars['xt_param'];
            $_from = array('{page}', '{sortOrder}', '{s}', '{sitetitle}');
            $_sortOrder = array('newest' => '最新', 'popular' => '潮流', 'hot' => '最热');
            $_to = array($_param['page'] > 1 ? '第' . $_param['page'] . '页 ' : '', isset($_sortOrder[$_param['sortOrder']]) ? $_sortOrder[$_param['sortOrder']] : '', $_param['s'], $_site);
            $xt_meta['keywords'] = str_replace($_from, $_to, $_meta_keywords);
            $xt_meta['description'] = str_replace($_from, $_to, $_meta_description);
            return str_replace($_from, $_to, $_meta_title) . " " . $sep . " " . $_site;
        }
    } elseif ($xt->is_album) {
        $_metas = get_option(XT_OPTION_PAGE_PRE . 'album');
        if (!empty($_metas) && isset($_metas['seos'])) {
            $_meta = $_metas['seos'];
            $_meta_title = htmlentities(stripslashes($_meta['title']), ENT_QUOTES, 'UTF-8');
            $_meta_keywords = htmlentities(stripslashes($_meta['keywords']), ENT_QUOTES, 'UTF-8');
            $_meta_description = htmlentities(stripslashes($_meta['description']), ENT_QUOTES, 'UTF-8');
            $_from = array('{user}', '{sitetitle}', '{albumtitle}', '{albumcontent}');
            if (empty($xt_user->display_name)) {
                $xt_user->display_name = $xt_user->user_login;
            }
            $user_name = $wpdb->escape($xt_user->display_name);
            $_to = array($user_name, $_site, $xt_album->title, $xt_album->content);
            $xt_meta['keywords'] = str_replace($_from, $_to, $_meta_keywords);
            $xt_meta['description'] = str_replace($_from, $_to, $_meta_description);
            return str_replace($_from, $_to, $_meta_title) . " " . $sep . " " . $_site;
        }
    } elseif ($xt->is_daogous) {
        $_metas = get_option(XT_OPTION_PAGE_PRE . 'daogous');
        if (!empty($_metas) && isset($_metas['seos'])) {
            $_meta = $_metas['seos'];
            $_meta_title = htmlentities(stripslashes($_meta['title']), ENT_QUOTES, 'UTF-8');
            $_meta_keywords = htmlentities(stripslashes($_meta['keywords']), ENT_QUOTES, 'UTF-8');
            $_meta_description = htmlentities(stripslashes($_meta['description']), ENT_QUOTES, 'UTF-8');
            $_param = $wp_query->query_vars['xt_param'];
            $_cat = '最新';
            $_from = array('{cat}', '{s}', '{sitetitle}');
            if (!empty($_param['cid'])) {
                $xt_daogou_itemcat = xt_daogou_item_cat($_param['cid']);
                if (!empty($xt_daogou_itemcat)) {
                    $_cat = $xt_daogou_itemcat->name;
                }
            }
            $_to = array($_cat, $_param['s'], $_site);
            $xt_meta['keywords'] = str_replace($_from, $_to, $_meta_keywords);
            $xt_meta['description'] = str_replace($_from, $_to, $_meta_description);
            return str_replace($_from, $_to, $_meta_title) . " " . $sep . " " . $_site;
        }
    } elseif ($xt->is_helps) {
        $_metas = get_option(XT_OPTION_PAGE_PRE . 'helps');
        if (!empty($_metas) && isset($_metas['seos'])) {
            $_meta = $_metas['seos'];
            $_meta_title = htmlentities(stripslashes($_meta['title']), ENT_QUOTES, 'UTF-8');
            $_meta_keywords = htmlentities(stripslashes($_meta['keywords']), ENT_QUOTES, 'UTF-8');
            $_meta_description = htmlentities(stripslashes($_meta['description']), ENT_QUOTES, 'UTF-8');
            $_param = $wp_query->query_vars['xt_param'];
            $_cat = '常见问题';
            $_from = array('{cat}', '{s}', '{sitetitle}');
            if (!empty($_param['cid'])) {
                $xt_help_itemcat = xt_help_item_cat($_param['cid']);
                if (!empty($xt_help_itemcat)) {
                    $_cat = $xt_help_itemcat->name;
                }
            }
            $_to = array($_cat, $_param['s'], $_site);
            $xt_meta['keywords'] = str_replace($_from, $_to, $_meta_keywords);
            $xt_meta['description'] = str_replace($_from, $_to, $_meta_description);
            return str_replace($_from, $_to, $_meta_title) . " " . $sep . " " . $_site;
        }
    } elseif ($xt->is_daogou || $xt->is_help) {
        $__page = 'daogou';
        if ($xt->is_help) {
            $__page = 'help';
        }
        $_metas = get_option(XT_OPTION_PAGE_PRE . $__page);
        if (!empty($_metas) && isset($_metas['seos'])) {
            $_meta = $_metas['seos'];
            $_meta_title = htmlentities(stripslashes($_meta['title']), ENT_QUOTES, 'UTF-8');
            $_meta_keywords = htmlentities(stripslashes($_meta['keywords']), ENT_QUOTES, 'UTF-8');
            $_meta_description = htmlentities(stripslashes($_meta['description']), ENT_QUOTES, 'UTF-8');
            $_from = array('{sitetitle}', '{blogtitle}', '{blogtags}', '{blogexcerpt}');
            $_postexcerpt = '';
            $_post = get_queried_object();
            if ($_post->post_excerpt) {
                $_postexcerpt = $_post->post_excerpt;
            } else {
                $_postexcerpt = wp_trim_words(strip_tags($_post->post_content), 180);
            }
            $_posttags = array();
            $_tags = wp_get_post_tags($_post->ID);
            if (!empty($_tags)) {
                foreach ($_tags as $_tag) {
                    $_posttags[] = $_tag->name;
                }
            }
            $_posttags = implode(' ', $_posttags);
            $_to = array($_site, $_post->post_title, $_posttags, $_postexcerpt);
            $xt_meta['keywords'] = str_replace($_from, $_to, $_meta_keywords);
            $xt_meta['description'] = str_replace($_from, $_to, $_meta_description);
            return str_replace($_from, $_to, $_meta_title) . " " . $sep . " " . $_site;
        }
    } elseif ($xt->is_account) {
        if (empty($xt_user->display_name)) {
            $xt_user->display_name = $xt_user->user_login;
        }
        $user_name = $wpdb->escape($xt_user->display_name);
        return $user_name . $sep . '管理中心' . " " . $sep . " " . $_site;
    } elseif ($xt->is_taobaos) {
        $_metas = get_option(XT_OPTION_PAGE_PRE . 'taobaos');
        if (!empty($_metas) && isset($_metas['seos'])) {
            $_meta = $_metas['seos'];
            $_meta_title = htmlentities(stripslashes($_meta['title']), ENT_QUOTES, 'UTF-8');
            $_meta_keywords = htmlentities(stripslashes($_meta['keywords']), ENT_QUOTES, 'UTF-8');
            $_meta_description = htmlentities(stripslashes($_meta['description']), ENT_QUOTES, 'UTF-8');
            $_param = $wp_query->query_vars['xt_param'];
            $_s = $_param['keyword'];
            $_start_price = $_param['start_price'];
            $_end_price = $_param['end_price'];
            $_sort = $_param['sort'];
            $_mall = $_param['mall_item'];
            $_cat = '';
            if (!empty($_sort)) {
                $xt_sort_taobao = xt_sort_taobao();
                if (isset($xt_sort_taobao[$_sort])) {
                    $_sort = $xt_sort_taobao[$_sort]['seo'];
                } else {
                    $_sort = '人气';
                }
            }
            if (empty($_sort)) {
                $_sort = '人气';
            }
            if (!empty($_param['cid'])) {
                $xt_taobao_itemcat = xt_taobao_item_cat(absint($_param['cid']));
                if (!empty($xt_taobao_itemcat)) {
                    $_cat = $xt_taobao_itemcat['name'];
                }
            }
            $_from = array('{page}', '{sitetitle}', '{cat}', '{s}', '{start_price}', '{end_price}', '{sort}', '{mall}');
            $_to = array($_param['page_no'] > 1 ? '第' . $_param['page_no'] . '页 ' : '', $_site, $_cat, $_s, $_start_price ? '最低价格:' . $_start_price : '', $_end_price ? '最高价格:' . $_end_price : '', $_sort, $_mall ? '天猫' : '');
            $xt_meta['keywords'] = str_replace($_from, $_to, $_meta_keywords);
            $xt_meta['description'] = str_replace($_from, $_to, $_meta_description);
            return str_replace($_from, $_to, $_meta_title) . " " . $sep . " " . $_site;
        }
    } elseif ($xt->is_taobao) {
        $_metas = get_option(XT_OPTION_PAGE_PRE . 'taobao');
        if (!empty($_metas) && isset($_metas['seos'])) {
            $_meta = $_metas['seos'];
            $_meta_title = htmlentities(stripslashes($_meta['title']), ENT_QUOTES, 'UTF-8');
            $_meta_keywords = htmlentities(stripslashes($_meta['keywords']), ENT_QUOTES, 'UTF-8');
            $_meta_description = htmlentities(stripslashes($_meta['description']), ENT_QUOTES, 'UTF-8');
            $_param = $wp_query->query_vars['xt_param'];
            $_from = array('{sitetitle}', '{itemtitle}', '{itemprice}');
            $_to = array($_site, $xt_taobao_item->title, $xt_taobao_item->price);
            $xt_meta['keywords'] = str_replace($_from, $_to, $_meta_keywords);
            $xt_meta['description'] = str_replace($_from, $_to, $_meta_description);
            return str_replace($_from, $_to, $_meta_title) . " " . $sep . " " . $_site;
        }
    } elseif ($xt->is_shops) {
        $_metas = get_option(XT_OPTION_PAGE_PRE . 'shops');
        if (!empty($_metas) && isset($_metas['seos'])) {
            $_meta = $_metas['seos'];
            $_meta_title = htmlentities(stripslashes($_meta['title']), ENT_QUOTES, 'UTF-8');
            $_meta_keywords = htmlentities(stripslashes($_meta['keywords']), ENT_QUOTES, 'UTF-8');
            $_meta_description = htmlentities(stripslashes($_meta['description']), ENT_QUOTES, 'UTF-8');
            $_param = $wp_query->query_vars['xt_param'];
            $_s = $_param['keyword'];
            $_start_credit = $_param['start_credit'];
            $_end_credit = $_param['end_credit'];
            $_mall = $_param['only_mall'];
            $_cat = '';
            if (!empty($_param['cid'])) {
                $xt_taobao_shopcat = xt_taobao_shopcat(absint($_param['cid']));
                if (!empty($xt_taobao_shopcat)) {
                    $_cat = $xt_taobao_shopcat['name'];
                }
            }
            $_from = array('{page}', '{sitetitle}', '{cat}', '{s}', '{start_credit}', '{end_credit}', '{mall}');
            $_to = array($_param['page_no'] > 1 ? '第' . $_param['page_no'] . '页 ' : '', $_site, $_cat, $_s, $_start_credit ? '最低信用:' . $_start_credit : '', $_end_credit ? '最高信用:' . $_end_credit : '', $_mall ? '天猫' : '');
            $xt_meta['keywords'] = str_replace($_from, $_to, $_meta_keywords);
            $xt_meta['description'] = str_replace($_from, $_to, $_meta_description);
            return str_replace($_from, $_to, $_meta_title) . " " . $sep . " " . $_site;
        }
    } elseif ($xt->is_paipais) {
        $_metas = get_option(XT_OPTION_PAGE_PRE . 'paipais');
        if (!empty($_metas) && isset($_metas['seos'])) {
            $_meta = $_metas['seos'];
            $_meta_title = htmlentities(stripslashes($_meta['title']), ENT_QUOTES, 'UTF-8');
            $_meta_keywords = htmlentities(stripslashes($_meta['keywords']), ENT_QUOTES, 'UTF-8');
            $_meta_description = htmlentities(stripslashes($_meta['description']), ENT_QUOTES, 'UTF-8');
            $_param = $wp_query->query_vars['xt_param'];
            $_s = $_param['keyWord'];
            $_start_price = $_param['begPrice'];
            $_end_price = $_param['endPrice'];
            $_sort = $_param['orderStyle'];
            $_cat = '';
            if (!empty($_sort)) {
                $xt_sort_paipai = xt_sort_paipai();
                if (isset($xt_sort_paipai[$_sort])) {
                    $_sort = $xt_sort_paipai[$_sort]['seo'];
                } else {
                    $_sort = '';
                }
            }
            if (!empty($_param['classId'])) {
                $xt_paipai_itemcat = xt_paipai_item_cat(absint($_param['classId']));
                if (!empty($xt_paipai_itemcat)) {
                    $_cat = $xt_paipai_itemcat['name'];
                }
            }
            $_from = array('{page}', '{sitetitle}', '{cat}', '{s}', '{start_price}', '{end_price}', '{sort}');
            $_to = array($_param['pageIndex'] > 1 ? '第' . $_param['pageIndex'] . '页 ' : '', $_site, $_cat, $_s, $_start_price > 0 ? '最低价格:' . $_start_price : '', $_end_price > 0 ? '最高价格:' . $_end_price : '', $_sort);
            $xt_meta['keywords'] = str_replace($_from, $_to, $_meta_keywords);
            $xt_meta['description'] = str_replace($_from, $_to, $_meta_description);
            return str_replace($_from, $_to, $_meta_title) . " " . $sep . " " . $_site;
        }
    } elseif ($xt->is_bijias) {
        $_metas = get_option(XT_OPTION_PAGE_PRE . 'bijias');
        if (!empty($_metas) && isset($_metas['seos'])) {
            $_meta = $_metas['seos'];
            $_meta_title = htmlentities(stripslashes($_meta['title']), ENT_QUOTES, 'UTF-8');
            $_meta_keywords = htmlentities(stripslashes($_meta['keywords']), ENT_QUOTES, 'UTF-8');
            $_meta_description = htmlentities(stripslashes($_meta['description']), ENT_QUOTES, 'UTF-8');
            $_param = $wp_query->query_vars['xt_param'];
            $_s = $_param['keyword'];
            $_start_price = $_param['minprice'];
            $_end_price = $_param['maxprice'];
            $_sort = $_param['orderby'];
            $_cat = '';
            if (!empty($_sort)) {
                $xt_sort_bijia = xt_sort_bijia();
                if (isset($xt_sort_bijia[$_sort])) {
                    $_sort = $xt_sort_bijia[$_sort]['seo'];
                } else {
                    $_sort = '';
                }
            }
            if (!empty($_param['catid']) && $_param['catid'] != -1) {
                $xt_bijia_itemcat = xt_bijia_item_cat($_param['catid']);
                if (!empty($xt_bijia_itemcat)) {
                    $_cat = $xt_bijia_itemcat['name'];
                }
            }
            $_from = array('{page}', '{sitetitle}', '{cat}', '{s}', '{start_price}', '{end_price}', '{sort}');
            $_to = array($_param['page_no'] > 1 ? '第' . $_param['page_no'] . '页 ' : '', $_site, $_cat, $_s, $_start_price > 0 ? '最低价格:' . $_start_price : '', $_end_price > 0 ? '最高价格:' . $_end_price : '', $_sort);
            $xt_meta['keywords'] = str_replace($_from, $_to, $_meta_keywords);
            $xt_meta['description'] = str_replace($_from, $_to, $_meta_description);
            return str_replace($_from, $_to, $_meta_title) . " " . $sep . " " . $_site;
        }
    } elseif ($xt->is_tuans) {
        $_metas = get_option(XT_OPTION_PAGE_PRE . 'tuans');
        if (!empty($_metas) && isset($_metas['seos'])) {
            $_meta = $_metas['seos'];
            $_meta_title = htmlentities(stripslashes($_meta['title']), ENT_QUOTES, 'UTF-8');
            $_meta_keywords = htmlentities(stripslashes($_meta['keywords']), ENT_QUOTES, 'UTF-8');
            $_meta_description = htmlentities(stripslashes($_meta['description']), ENT_QUOTES, 'UTF-8');
            $_param = $wp_query->query_vars['xt_param'];
            $_s = $_param['keyword'];
            $_price = $_param['price'];
            $_sort = $_param['orderby'];
            $_city = '';
            $_cat = '';
            if (!empty($_sort)) {
                $xt_sort_tuan = xt_sort_tuan();
                if (isset($xt_sort_tuan[$_sort])) {
                    $_sort = $xt_sort_tuan[$_sort]['seo'];
                } else {
                    $_sort = '';
                }
            }
            if (!empty($_param['catid']) && $_param['catid'] != -1) {
                $xt_tuan_itemcat = xt_tuan_item_cat($_param['catid']);
                if (!empty($xt_tuan_itemcat)) {
                    $_cat = $xt_tuan_itemcat['name'];
                }
            }
            if (!empty($_param['city_id'])) {
                $xt_yiqifa_tuan_cities = xt_yiqifa_tuan_city();
                if (isset($xt_yiqifa_tuan_cities[$_param['city_id']])) {
                    $_city = $xt_yiqifa_tuan_cities[$_param['city_id']]['name_cn'];
                }
            }
            switch ($_price) {
                case 'low':
                    $_price = '50元以下';
                    break;
                case 'medium':
                    $_price = '50-100元';
                    break;
                case 'high':
                    $_price = '100元以上';
                    break;
                default:
                    $_price = '';
            }
            $_from = array('{page}', '{sitetitle}', '{city}', '{cat}', '{s}', '{price}', '{sort}');
            $_to = array($_param['page_no'] > 1 ? '第' . $_param['page_no'] . '页 ' : '', $_site, $_city, $_cat, $_s, $_price, $_sort);
            $xt_meta['keywords'] = str_replace($_from, $_to, $_meta_keywords);
            $xt_meta['description'] = str_replace($_from, $_to, $_meta_description);
            return str_replace($_from, $_to, $_meta_title) . " " . $sep . " " . $_site;
        }
    } elseif ($xt->is_temais) {
        $_metas = get_option(XT_OPTION_PAGE_PRE . 'temais');
        if (!empty($_metas) && isset($_metas['seos'])) {
            $_meta = $_metas['seos'];
            $_meta_title = htmlentities(stripslashes($_meta['title']), ENT_QUOTES, 'UTF-8');
            $_meta_keywords = htmlentities(stripslashes($_meta['keywords']), ENT_QUOTES, 'UTF-8');
            $_meta_description = htmlentities(stripslashes($_meta['description']), ENT_QUOTES, 'UTF-8');
            $_param = $wp_query->query_vars['xt_param'];
            $_sort = $_param['sort'];
            $_city = '';
            $_cat = '';
            if (!empty($_sort)) {
                $xt_sort_temai = xt_sort_temai();
                if (isset($xt_sort_temai[$_sort])) {
                    $_sort = $xt_sort_temai[$_sort]['seo'];
                } else {
                    $_sort = '';
                }
            }
            if (!empty($_param['cat'])) {
                $xt_temai_itemcat = xt_temai_item_cat($_param['cat']);
                if (!empty($xt_temai_itemcat)) {
                    $_cat = $xt_temai_itemcat['name'];
                }
            }
            $_from = array('{page}', '{sitetitle}', '{cat}', '{sort}');
            $_to = array($_param['page_no'] > 1 ? '第' . $_param['page_no'] . '页 ' : '', $_site, $_cat, $_sort);
            $xt_meta['keywords'] = str_replace($_from, $_to, $_meta_keywords);
            $xt_meta['description'] = str_replace($_from, $_to, $_meta_description);
            return str_replace($_from, $_to, $_meta_title) . " " . $sep . " " . $_site;
        }
    } elseif ($xt->is_coupons) {
        $_metas = get_option(XT_OPTION_PAGE_PRE . 'coupons');
        if (!empty($_metas) && isset($_metas['seos'])) {
            $_meta = $_metas['seos'];
            $_meta_title = htmlentities(stripslashes($_meta['title']), ENT_QUOTES, 'UTF-8');
            $_meta_keywords = htmlentities(stripslashes($_meta['keywords']), ENT_QUOTES, 'UTF-8');
            $_meta_description = htmlentities(stripslashes($_meta['description']), ENT_QUOTES, 'UTF-8');
            $_param = $wp_query->query_vars['xt_param'];
            $_s = $_param['keyword'];
            $_sort = $_param['sort'];
            $_mall = $_param['shop_type'];
            $_cat = '';
            if (!empty($_sort)) {
                $xt_sort_taobao = xt_sort_taobao();
                if (isset($xt_sort_taobao[$_sort])) {
                    $_sort = $xt_sort_taobao[$_sort]['seo'];
                } else {
                    $_sort = '人气';
                }
            }
            if (empty($_sort)) {
                $_sort = '人气';
            }
            if (!empty($_param['cid'])) {
                $xt_taobao_itemcat = xt_taobao_item_cat(absint($_param['cid']));
                if (!empty($xt_taobao_itemcat)) {
                    $_cat = $xt_taobao_itemcat['name'];
                }
            }
            $_from = array('{page}', '{sitetitle}', '{cat}', '{s}', '{sort}', '{mall}');
            $_to = array($_param['page_no'] > 1 ? '第' . $_param['page_no'] . '页 ' : '', $_site, $_cat, $_s, $_sort, $_mall ? '天猫' : '');
            $xt_meta['keywords'] = str_replace($_from, $_to, $_meta_keywords);
            $xt_meta['description'] = str_replace($_from, $_to, $_meta_description);
            return str_replace($_from, $_to, $_meta_title) . " " . $sep . " " . $_site;
        }
    } elseif ($xt->is_invite) {
        $_metas = get_option(XT_OPTION_PAGE_PRE . 'invite');
        if (!empty($_metas) && isset($_metas['seos'])) {
            $_meta = $_metas['seos'];
            $_meta_title = htmlentities(stripslashes($_meta['title']), ENT_QUOTES, 'UTF-8');
            $_meta_keywords = htmlentities(stripslashes($_meta['keywords']), ENT_QUOTES, 'UTF-8');
            $_meta_description = htmlentities(stripslashes($_meta['description']), ENT_QUOTES, 'UTF-8');
            if (empty($xt_user->display_name)) {
                $xt_user->display_name = $xt_user->user_login;
            }
            $user_name = $wpdb->escape($xt_user->display_name);
            $jifen = intval(xt_fanxian_registe_jifen());
            if ($jifen > 100) {
                $jifen = intval($jifen / 100);
            } else {
                $jifen = 0;
            }
            $cash = intval(xt_fanxian_registe_cash());
            $amount = $cash + $jifen;
            $_from = array('{sitetitle}', '{user}', '{cash}', '{jifenbao}', '{amount}');
            $_to = array($_site, $user_name, $cash, $jifen, $amount);
            $xt_meta['keywords'] = str_replace($_from, $_to, $_meta_keywords);
            $xt_meta['description'] = str_replace($_from, $_to, $_meta_description);
            return str_replace($_from, $_to, $_meta_title) . " " . $sep . " " . $_site;
        }
    } elseif ($xt->is_brands || $xt->is_stars || $xt->is_activities || $xt->is_taoquan || $xt->is_malls || $xt->is_error404) {
        $__page = 'stars';
        if ($xt->is_brands) {
            $__page = 'brands';
        } elseif ($xt->is_activities) {
            $__page = 'activities';
        } elseif ($xt->is_taoquan) {
            $__page = 'taoquan';
        } elseif ($xt->is_malls) {
            $__page = 'malls';
        } elseif ($xt->is_error404) {
            $__page = 'error404';
        }
        $_metas = get_option(XT_OPTION_PAGE_PRE . $__page);
        if (!empty($_metas) && isset($_metas['seos'])) {
            $_meta = $_metas['seos'];
            $_meta_title = htmlentities(stripslashes($_meta['title']), ENT_QUOTES, 'UTF-8');
            $_meta_keywords = htmlentities(stripslashes($_meta['keywords']), ENT_QUOTES, 'UTF-8');
            $_meta_description = htmlentities(stripslashes($_meta['description']), ENT_QUOTES, 'UTF-8');
            $_from = array('{sitetitle}');
            $_to = array($_site);
            $xt_meta['keywords'] = str_replace($_from, $_to, $_meta_keywords);
            $xt_meta['description'] = str_replace($_from, $_to, $_meta_description);
            return str_replace($_from, $_to, $_meta_title) . " " . $sep . " " . $_site;
        }
    }
    return null;
}
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
        echo $before_widget;
        global $xt_user, $wpdb;
        $user = wp_get_current_user();
        ?>
                <div class="xt-invite">
                    <img src="<?php 
        echo XT_CORE_IMAGES_URL;
        ?>
/T1_C22XfxgXXbY4ZLi-945-50.png" width="945" height="50" alt="" style="vertical-align: top;">
                    <img src="<?php 
        echo XT_CORE_IMAGES_URL;
        ?>
/T10pL4XfVXXXcUTwcX-945-185.png" width="945" height="185" alt="" style="vertical-align: top;">
                    <img src="<?php 
        echo XT_CORE_IMAGES_URL;
        ?>
/T16VY4Xf4bXXa.M2ZX-945-163.png" width="945" height="163" alt="" style="vertical-align: top;">
                    <div class="xt-invite-info">
                        <p style="text-indent: 0;">亲,</p>
                        <p style="margin: 5px 0 0 15px;">
                            <?php 
        if (empty($xt_user->display_name)) {
            $xt_user->display_name = $xt_user->user_login;
        }
        $user_name = $wpdb->escape($xt_user->display_name);
        $jifen = intval(xt_fanxian_registe_jifen());
        if ($jifen > 100) {
            $jifen = intval($jifen / 100);
        } else {
            $jifen = 0;
        }
        $amount = intval(xt_fanxian_registe_cash()) + $jifen;
        echo str_replace(array('#user#', '#site#', '#amount#'), array('<strong>' . $user_name . '</strong>', get_bloginfo('name'), '<strong class="text-default">' . $amount . '</strong>'), esc_textarea($instance['desc']));
        ?>
                        </p>
                    </div>
                    <div class="xt-invite-join"><a class="btn btn-large btn-primary" <?php 
        if (!$user->exists()) {
            echo ' href="' . esc_url(site_url('wp-login.php?action=register&redirect_to' . urlencode(home_url()), 'login')) . '" ';
        } else {
            echo ' href="javascript:;"  onclick="alert(\'该红包为新人专享,您无法领取!\')" ';
        }
        ?>
>接受邀请拿红包</a></div>
                    <div class="xt-invite-step"><a href="<?php 
        echo home_url();
        ?>
" target="_blank"> <img src="<?php 
        echo XT_CORE_IMAGES_URL;
        ?>
/T13Fj3XfXiXXc1XAPD-925-127.png" width="925" height="127"></a></div>
                </div>
                <?php 
        echo $after_widget;
    }
Example #4
0
?>
"
                             class="small-text"> 元(RMB)或同价值的<?php 
echo xt_jifenbao_text();
?>
                </label>
            </td>
        </tr>
        <tr valign="top">
            <th scope="row">注册</th>
            <td>
                <fieldset>
                    <label for="registe_cash">
                        赠送<input name="registe_cash"
                                 type="number" step="1" min="0" max="50" id="registe_cash" value="<?php 
echo xt_fanxian_registe_cash();
?>
"
                                 class="small-text"> 元(RMB)
                    </label>
                    <br>
                    <label for="registe_jifen">
                        赠送<input name="registe_jifen"
                                 type="number" step="100" min="0" max="10000" id="registe_jifen" value="<?php 
echo xt_fanxian_registe_jifen();
?>
"
                                 class="small-text"> 个<?php 
echo xt_jifenbao_text();
?>
(100<?php