|
@@ -54,10 +54,10 @@ class Helpers |
|
@@ -54,10 +54,10 @@ class Helpers |
54
|
/**
|
54
|
/**
|
55
|
* 根据尺寸获得图片url
|
55
|
* 根据尺寸获得图片url
|
56
|
*
|
56
|
*
|
57
|
- * @param string $url 路径
|
|
|
58
|
- * @param integer $width 图片宽度
|
|
|
59
|
- * @param integer $height 图片高度
|
|
|
60
|
- * @param integer $mode 模式
|
57
|
+ * @param string $url 路径
|
|
|
58
|
+ * @param integer $width 图片宽度
|
|
|
59
|
+ * @param integer $height 图片高度
|
|
|
60
|
+ * @param integer $mode 模式
|
61
|
* @return string 图片地址
|
61
|
* @return string 图片地址
|
62
|
*/
|
62
|
*/
|
63
|
public static function getImageUrl($url, $width, $height, $mode = 2)
|
63
|
public static function getImageUrl($url, $width, $height, $mode = 2)
|
|
@@ -88,7 +88,8 @@ class Helpers |
|
@@ -88,7 +88,8 @@ class Helpers |
88
|
{
|
88
|
{
|
89
|
$url = strtr($url, array('.m.yohobuy.com' => SUB_DOMAIN, OLD_MAIN => SITE_MAIN, 'www.yohobuy.com' => SITE_MAIN));
|
89
|
$url = strtr($url, array('.m.yohobuy.com' => SUB_DOMAIN, OLD_MAIN => SITE_MAIN, 'www.yohobuy.com' => SITE_MAIN));
|
90
|
if (strrpos($url, 'm.yohobuy.com') && !strrpos($url, 'sale.m.yohobuy.com') && !strrpos($url, 'cuxiao.m.yohobuy.com')
|
90
|
if (strrpos($url, 'm.yohobuy.com') && !strrpos($url, 'sale.m.yohobuy.com') && !strrpos($url, 'cuxiao.m.yohobuy.com')
|
91
|
- && !strrpos($url, 'activity.m.yohobuy.com') && !strrpos($url, 'huodong.m.yohobuy.com') && strrpos($url, 'cdn.yoho.cn/myohobuy') && !strrpos($url, '/home/orders/pay')) {
|
91
|
+ && !strrpos($url, 'activity.m.yohobuy.com') && !strrpos($url, 'huodong.m.yohobuy.com') && strrpos($url, 'cdn.yoho.cn/myohobuy') && !strrpos($url, '/home/orders/pay')
|
|
|
92
|
+ ) {
|
92
|
$url = strtr($url, array('http://' => '//'));
|
93
|
$url = strtr($url, array('http://' => '//'));
|
93
|
}
|
94
|
}
|
94
|
|
95
|
|
|
@@ -183,7 +184,7 @@ class Helpers |
|
@@ -183,7 +184,7 @@ class Helpers |
183
|
/**
|
184
|
/**
|
184
|
* 根据排序类型和类型值获得正确的排序参数
|
185
|
* 根据排序类型和类型值获得正确的排序参数
|
185
|
* @param integer $order 类型值
|
186
|
* @param integer $order 类型值
|
186
|
- * @param string $type 排序类型
|
187
|
+ * @param string $type 排序类型
|
187
|
* @return string 转换之后的排序参数
|
188
|
* @return string 转换之后的排序参数
|
188
|
*/
|
189
|
*/
|
189
|
public static function transOrder($order, $type)
|
190
|
public static function transOrder($order, $type)
|
|
@@ -274,8 +275,8 @@ class Helpers |
|
@@ -274,8 +275,8 @@ class Helpers |
274
|
}
|
275
|
}
|
275
|
$result['is_soon_sold_out'] = ($productData['is_soon_sold_out'] === 'Y');
|
276
|
$result['is_soon_sold_out'] = ($productData['is_soon_sold_out'] === 'Y');
|
276
|
$url = self::url('/product/pro_' . $productData['product_id'] . '_'
|
277
|
$url = self::url('/product/pro_' . $productData['product_id'] . '_'
|
277
|
- . $productData['goods_list'][0]['goods_id']
|
|
|
278
|
- . '/' . $productData['cn_alphabet'] . '.html');
|
278
|
+ . $productData['goods_list'][0]['goods_id']
|
|
|
279
|
+ . '/' . $productData['cn_alphabet'] . '.html');
|
279
|
$result['url'] = strtr($url, array('http://' => '//'));
|
280
|
$result['url'] = strtr($url, array('http://' => '//'));
|
280
|
|
281
|
|
281
|
// APP访问需要加附加的参数
|
282
|
// APP访问需要加附加的参数
|
|
@@ -296,13 +297,12 @@ class Helpers |
|
@@ -296,13 +297,12 @@ class Helpers |
296
|
// 打折与即将售完组合显示打折
|
297
|
// 打折与即将售完组合显示打折
|
297
|
if ($result['is_soon_sold_out'] && $result['tags']['is_discount']) {
|
298
|
if ($result['is_soon_sold_out'] && $result['tags']['is_discount']) {
|
298
|
$result['tags']['is_new'] = false;
|
299
|
$result['tags']['is_new'] = false;
|
299
|
- }
|
|
|
300
|
- // 打折与其它组合则隐藏打折
|
300
|
+ } // 打折与其它组合则隐藏打折
|
301
|
elseif ($result['tags']['is_discount'] &&
|
301
|
elseif ($result['tags']['is_discount'] &&
|
302
|
- ($result['tags']['is_new'] || $result['tags']['is_limited'] || $result['tags']['is_yohood'] || $result['tags']['is_advance'])) {
|
302
|
+ ($result['tags']['is_new'] || $result['tags']['is_limited'] || $result['tags']['is_yohood'] || $result['tags']['is_advance'])
|
|
|
303
|
+ ) {
|
303
|
$result['tags']['is_discount'] = false;
|
304
|
$result['tags']['is_discount'] = false;
|
304
|
- }
|
|
|
305
|
- // YOHOOD和新品组合显示YOHOOD
|
305
|
+ } // YOHOOD和新品组合显示YOHOOD
|
306
|
elseif ($result['tags']['is_yohood'] && $result['tags']['is_new']) {
|
306
|
elseif ($result['tags']['is_yohood'] && $result['tags']['is_new']) {
|
307
|
$result['tags']['is_new'] = false;
|
307
|
$result['tags']['is_new'] = false;
|
308
|
}
|
308
|
}
|
|
@@ -354,7 +354,7 @@ class Helpers |
|
@@ -354,7 +354,7 @@ class Helpers |
354
|
$result['showTags'] = $showTag;
|
354
|
$result['showTags'] = $showTag;
|
355
|
$result['img'] = isset($articleData['src']) ? self::getImageUrl($articleData['src'], 640, 640) : '';
|
355
|
$result['img'] = isset($articleData['src']) ? self::getImageUrl($articleData['src'], 640, 640) : '';
|
356
|
//逛详情页app跳转url处理 20160601
|
356
|
//逛详情页app跳转url处理 20160601
|
357
|
- $result['url'] = $isApp ? self::getUrlSafe($articleData['url']) . '&openby:yohobuy={"action":"go.h5","params":{"param":{"id":"' . $articleData['id'] . '"},"shareparam":{"id":"' . $articleData['id'] . '"},"share":"/guang/api/v1/share/guang","id":' . $articleData['id'] . ',"type":1,"url":"' .'http:'. self::url('/info/index', array(), 'guang') . '","islogin":"N"}}' : $articleData['url'];
|
357
|
+ $result['url'] = $isApp ? self::getUrlSafe($articleData['url']) . '&openby:yohobuy={"action":"go.h5","params":{"param":{"id":"' . $articleData['id'] . '"},"shareparam":{"id":"' . $articleData['id'] . '"},"share":"/guang/api/v1/share/guang","id":' . $articleData['id'] . ',"type":1,"url":"' . 'http:' . self::url('/info/index', array(), 'guang') . '","islogin":"N"}}' : $articleData['url'];
|
358
|
//$result['url'] = $articleData['url']; // ? $articleData['url'] : self::url('/info/index', array('id' => $articleData['id']), 'guang');
|
358
|
//$result['url'] = $articleData['url']; // ? $articleData['url'] : self::url('/info/index', array('id' => $articleData['id']), 'guang');
|
359
|
|
359
|
|
360
|
if (strrpos($result['url'], 'feature.yoho.cn') || strrpos($result['url'], 'cdn.yoho.cn')) {
|
360
|
if (strrpos($result['url'], 'feature.yoho.cn') || strrpos($result['url'], 'cdn.yoho.cn')) {
|
|
@@ -371,16 +371,19 @@ class Helpers |
|
@@ -371,16 +371,19 @@ class Helpers |
371
|
$result['collect'] = array();
|
371
|
$result['collect'] = array();
|
372
|
$result['collect']['isCollected'] = isset($articleData['isFavor']) && $articleData['isFavor'] === 'Y';
|
372
|
$result['collect']['isCollected'] = isset($articleData['isFavor']) && $articleData['isFavor'] === 'Y';
|
373
|
$result['collect']['url'] = !empty($uid) ? 'javascript:;' : strtr($articleData['url'], array('"islogin":"N"' => '"islogin":"Y"'));
|
373
|
$result['collect']['url'] = !empty($uid) ? 'javascript:;' : strtr($articleData['url'], array('"islogin":"N"' => '"islogin":"Y"'));
|
374
|
- }
|
|
|
375
|
- // 点赞
|
374
|
+ } // 点赞
|
376
|
else {
|
375
|
else {
|
377
|
$result['like'] = array();
|
376
|
$result['like'] = array();
|
378
|
$result['like']['count'] = $articleData['praise_num'];
|
377
|
$result['like']['count'] = $articleData['praise_num'];
|
379
|
$result['like']['isLiked'] = isset($articleData['isPraise']) && $articleData['isPraise'] === 'Y';
|
378
|
$result['like']['isLiked'] = isset($articleData['isPraise']) && $articleData['isPraise'] === 'Y';
|
380
|
}
|
379
|
}
|
381
|
|
380
|
|
382
|
- // 分享链接
|
|
|
383
|
- $result['share'] = $isApp && isset($articleData['share']['url']) ? $articleData['share']['url'] : false;
|
381
|
+ if ($isApp && isset($articleData['share']['url'])) {
|
|
|
382
|
+ $shareLink = $articleData['share']['url'] . '?openby:yohobuy={"action":"go.share","params":{"title":"' . $articleData['title'] . '","content":"' . $articleData['intro'] . '","url":"' . $articleData['share']['url'] . '","pic":"' . $result['img'] . '"}}';
|
|
|
383
|
+
|
|
|
384
|
+ // 分享链接
|
|
|
385
|
+ $result['share'] = $shareLink;
|
|
|
386
|
+ }
|
384
|
|
387
|
|
385
|
// 判断是否显示作者信息
|
388
|
// 判断是否显示作者信息
|
386
|
if ($showAuthor && !empty($articleData['author'])) {
|
389
|
if ($showAuthor && !empty($articleData['author'])) {
|
|
@@ -388,7 +391,7 @@ class Helpers |
|
@@ -388,7 +391,7 @@ class Helpers |
388
|
$articleData['author']['url'] = Helpers::getFilterUrl($articleData['author']['url']);
|
391
|
$articleData['author']['url'] = Helpers::getFilterUrl($articleData['author']['url']);
|
389
|
}
|
392
|
}
|
390
|
//编辑人员 app跳转url处理 20160601
|
393
|
//编辑人员 app跳转url处理 20160601
|
391
|
- $articleData['author']['url'] = self::getUrlSafe($articleData['author']['url']).'&openby:yohobuy={"action":"go.h5","params":{"param":{"id":"' . $articleData['author']['author_id'] . '"},"share":"","id":' . $articleData['author']['author_id'] . ',"type":0,"islogin":"N","url":"' .'https:'.self::url('/author/index', array(), 'guang') . '"}}';
|
394
|
+ $articleData['author']['url'] = self::getUrlSafe($articleData['author']['url']) . '&openby:yohobuy={"action":"go.h5","params":{"param":{"id":"' . $articleData['author']['author_id'] . '"},"share":"","id":' . $articleData['author']['author_id'] . ',"type":0,"islogin":"N","url":"' . 'https:' . self::url('/author/index', array(), 'guang') . '"}}';
|
392
|
$result['author'] = $articleData['author'];
|
395
|
$result['author'] = $articleData['author'];
|
393
|
if (isset($result['author']['avatar'])) {
|
396
|
if (isset($result['author']['avatar'])) {
|
394
|
$result['author']['avatar'] = strtr($result['author']['avatar'], array('http://' => '//'));
|
397
|
$result['author']['avatar'] = strtr($result['author']['avatar'], array('http://' => '//'));
|
|
@@ -482,7 +485,7 @@ class Helpers |
|
@@ -482,7 +485,7 @@ class Helpers |
482
|
if (empty($mobile)) {
|
485
|
if (empty($mobile)) {
|
483
|
return false;
|
486
|
return false;
|
484
|
}
|
487
|
}
|
485
|
- return (bool) preg_match('/^1[3|4|5|8|7][0-9]{9}$/', trim($mobile));
|
488
|
+ return (bool)preg_match('/^1[3|4|5|8|7][0-9]{9}$/', trim($mobile));
|
486
|
}
|
489
|
}
|
487
|
|
490
|
|
488
|
/**
|
491
|
/**
|
|
@@ -496,7 +499,7 @@ class Helpers |
|
@@ -496,7 +499,7 @@ class Helpers |
496
|
if (empty($password)) {
|
499
|
if (empty($password)) {
|
497
|
return false;
|
500
|
return false;
|
498
|
}
|
501
|
}
|
499
|
- return (bool) preg_match('/^([a-zA-Z0-9\-\+_!@\#$%\^&\*\(\)\:\;\.=\[\]\\\',\?]){6,20}$/', trim($password));
|
502
|
+ return (bool)preg_match('/^([a-zA-Z0-9\-\+_!@\#$%\^&\*\(\)\:\;\.=\[\]\\\',\?]){6,20}$/', trim($password));
|
500
|
}
|
503
|
}
|
501
|
|
504
|
|
502
|
/**
|
505
|
/**
|
|
@@ -542,14 +545,14 @@ class Helpers |
|
@@ -542,14 +545,14 @@ class Helpers |
542
|
*
|
545
|
*
|
543
|
* @return string 处理之后的地址
|
546
|
* @return string 处理之后的地址
|
544
|
*/
|
547
|
*/
|
545
|
- public static function transUrl($url, $channel='woman')
|
548
|
+ public static function transUrl($url, $channel = 'woman')
|
546
|
{
|
549
|
{
|
547
|
$extra = '';
|
550
|
$extra = '';
|
548
|
- if(!empty($url) && stripos($url, '?') === false) {
|
|
|
549
|
- $extra = '?channel='.$channel;
|
551
|
+ if (!empty($url) && stripos($url, '?') === false) {
|
|
|
552
|
+ $extra = '?channel=' . $channel;
|
550
|
}
|
553
|
}
|
551
|
- if(!empty($url) && stripos($url, '?') !== false){
|
|
|
552
|
- $extra = '&channel='.$channel;
|
554
|
+ if (!empty($url) && stripos($url, '?') !== false) {
|
|
|
555
|
+ $extra = '&channel=' . $channel;
|
553
|
}
|
556
|
}
|
554
|
return $url . $extra;
|
557
|
return $url . $extra;
|
555
|
}
|
558
|
}
|
|
@@ -563,47 +566,47 @@ class Helpers |
|
@@ -563,47 +566,47 @@ class Helpers |
563
|
$verify = array(
|
566
|
$verify = array(
|
564
|
86 => array(
|
567
|
86 => array(
|
565
|
'name' => '中国',
|
568
|
'name' => '中国',
|
566
|
- 'match' => (bool) preg_match('/^1[3|4|5|8|7][0-9]{9}$/', trim($mobile)),
|
569
|
+ 'match' => (bool)preg_match('/^1[3|4|5|8|7][0-9]{9}$/', trim($mobile)),
|
567
|
),
|
570
|
),
|
568
|
852 => array(
|
571
|
852 => array(
|
569
|
'name' => '中国香港',
|
572
|
'name' => '中国香港',
|
570
|
- 'match' => (bool) preg_match('/^[9|6|5][0-9]{7}$/', trim($mobile)),
|
573
|
+ 'match' => (bool)preg_match('/^[9|6|5][0-9]{7}$/', trim($mobile)),
|
571
|
),
|
574
|
),
|
572
|
853 => array(
|
575
|
853 => array(
|
573
|
'name' => '中国澳门',
|
576
|
'name' => '中国澳门',
|
574
|
- 'match' => (bool) preg_match('/^[0-9]{8}$/', trim($mobile)),
|
577
|
+ 'match' => (bool)preg_match('/^[0-9]{8}$/', trim($mobile)),
|
575
|
),
|
578
|
),
|
576
|
886 => array(
|
579
|
886 => array(
|
577
|
'name' => '中国台湾',
|
580
|
'name' => '中国台湾',
|
578
|
- 'match' => (bool) preg_match('/^[0-9]{10}$/', trim($mobile)),
|
581
|
+ 'match' => (bool)preg_match('/^[0-9]{10}$/', trim($mobile)),
|
579
|
),
|
582
|
),
|
580
|
65 => array(
|
583
|
65 => array(
|
581
|
'name' => '新加坡',
|
584
|
'name' => '新加坡',
|
582
|
- 'match' => (bool) preg_match('/^[9|8][0-9]{7}$/', trim($mobile)),
|
585
|
+ 'match' => (bool)preg_match('/^[9|8][0-9]{7}$/', trim($mobile)),
|
583
|
),
|
586
|
),
|
584
|
60 => array(
|
587
|
60 => array(
|
585
|
'name' => '马来西亚',
|
588
|
'name' => '马来西亚',
|
586
|
- 'match' => (bool) preg_match('/^1[1|2|3|4|6|7|9][0-9]{8}$/', trim($mobile)),
|
589
|
+ 'match' => (bool)preg_match('/^1[1|2|3|4|6|7|9][0-9]{8}$/', trim($mobile)),
|
587
|
),
|
590
|
),
|
588
|
1 => array(
|
591
|
1 => array(
|
589
|
'name' => '加拿大&美国',
|
592
|
'name' => '加拿大&美国',
|
590
|
- 'match' => (bool) preg_match('/^[0-9]{10}$/', trim($mobile)),
|
593
|
+ 'match' => (bool)preg_match('/^[0-9]{10}$/', trim($mobile)),
|
591
|
),
|
594
|
),
|
592
|
82 => array(
|
595
|
82 => array(
|
593
|
'name' => '韩国',
|
596
|
'name' => '韩国',
|
594
|
- 'match' => (bool) preg_match('/^01[0-9]{9}$/', trim($mobile)),
|
597
|
+ 'match' => (bool)preg_match('/^01[0-9]{9}$/', trim($mobile)),
|
595
|
),
|
598
|
),
|
596
|
44 => array(
|
599
|
44 => array(
|
597
|
'name' => '英国',
|
600
|
'name' => '英国',
|
598
|
- 'match' => (bool) preg_match('/^7[7|8|9][0-9]{8}$/', trim($mobile)),
|
601
|
+ 'match' => (bool)preg_match('/^7[7|8|9][0-9]{8}$/', trim($mobile)),
|
599
|
),
|
602
|
),
|
600
|
81 => array(
|
603
|
81 => array(
|
601
|
'name' => '日本',
|
604
|
'name' => '日本',
|
602
|
- 'match' => (bool) preg_match('/^0[9|8|7][0-9]{9}$/', trim($mobile)),
|
605
|
+ 'match' => (bool)preg_match('/^0[9|8|7][0-9]{9}$/', trim($mobile)),
|
603
|
),
|
606
|
),
|
604
|
61 => array(
|
607
|
61 => array(
|
605
|
'name' => '澳大利亚',
|
608
|
'name' => '澳大利亚',
|
606
|
- 'match' => (bool) preg_match('/^[0-9]{11}$/', trim($mobile)),
|
609
|
+ 'match' => (bool)preg_match('/^[0-9]{11}$/', trim($mobile)),
|
607
|
),
|
610
|
),
|
608
|
);
|
611
|
);
|
609
|
if (isset($verify[$area])) {
|
612
|
if (isset($verify[$area])) {
|
|
@@ -652,7 +655,7 @@ class Helpers |
|
@@ -652,7 +655,7 @@ class Helpers |
652
|
return $arr;
|
655
|
return $arr;
|
653
|
}
|
656
|
}
|
654
|
|
657
|
|
655
|
-/**
|
658
|
+ /**
|
656
|
* 格式化购物车商品
|
659
|
* 格式化购物车商品
|
657
|
*
|
660
|
*
|
658
|
* @param array $cartGoods 购物车商品列表
|
661
|
* @param array $cartGoods 购物车商品列表
|
|
@@ -722,7 +725,7 @@ class Helpers |
|
@@ -722,7 +725,7 @@ class Helpers |
722
|
* @param int $count 计商品件数
|
725
|
* @param int $count 计商品件数
|
723
|
* @return array $arr 处理之后的加价购商品数据
|
726
|
* @return array $arr 处理之后的加价购商品数据
|
724
|
*/
|
727
|
*/
|
725
|
- public static function formatAdvanceGoods($advanceGoods,&$count = 0,$isGift = false)
|
728
|
+ public static function formatAdvanceGoods($advanceGoods, &$count = 0, $isGift = false)
|
726
|
{
|
729
|
{
|
727
|
$arr = array();
|
730
|
$arr = array();
|
728
|
|
731
|
|
|
@@ -745,7 +748,7 @@ class Helpers |
|
@@ -745,7 +748,7 @@ class Helpers |
745
|
$oneGoods['count'] = $single['storage_number'];
|
748
|
$oneGoods['count'] = $single['storage_number'];
|
746
|
|
749
|
|
747
|
$gift['goods'][] = $oneGoods;
|
750
|
$gift['goods'][] = $oneGoods;
|
748
|
- $number ++;
|
751
|
+ $number++;
|
749
|
}
|
752
|
}
|
750
|
|
753
|
|
751
|
$arr[] = $gift;
|
754
|
$arr[] = $gift;
|
|
@@ -901,12 +904,12 @@ class Helpers |
|
@@ -901,12 +904,12 @@ class Helpers |
901
|
* @param unknown $productSkc
|
904
|
* @param unknown $productSkc
|
902
|
* @return string
|
905
|
* @return string
|
903
|
*/
|
906
|
*/
|
904
|
- public static function getUrlBySkc($product_id, $goods_id, $cn_alphabet='')
|
907
|
+ public static function getUrlBySkc($product_id, $goods_id, $cn_alphabet = '')
|
905
|
{
|
908
|
{
|
906
|
if (empty($cn_alphabet)) {
|
909
|
if (empty($cn_alphabet)) {
|
907
|
$cn_alphabet = 'goods.html';
|
910
|
$cn_alphabet = 'goods.html';
|
908
|
}
|
911
|
}
|
909
|
- return '//item.yohobuy.com/product/pro_' . $product_id . '_' . $goods_id . '/' . $cn_alphabet. '.html';
|
912
|
+ return '//item.yohobuy.com/product/pro_' . $product_id . '_' . $goods_id . '/' . $cn_alphabet . '.html';
|
910
|
}
|
913
|
}
|
911
|
|
914
|
|
912
|
/**
|
915
|
/**
|
|
@@ -926,18 +929,18 @@ class Helpers |
|
@@ -926,18 +929,18 @@ class Helpers |
926
|
return $ip;
|
929
|
return $ip;
|
927
|
}
|
930
|
}
|
928
|
|
931
|
|
929
|
- /**
|
|
|
930
|
- * 组合国际手机号
|
|
|
931
|
- * @param $area
|
|
|
932
|
- * @param $mobile
|
|
|
933
|
- * @return string
|
|
|
934
|
- */
|
932
|
+ /**
|
|
|
933
|
+ * 组合国际手机号
|
|
|
934
|
+ * @param $area
|
|
|
935
|
+ * @param $mobile
|
|
|
936
|
+ * @return string
|
|
|
937
|
+ */
|
935
|
public static function makeMobile($area, $mobile)
|
938
|
public static function makeMobile($area, $mobile)
|
936
|
{
|
939
|
{
|
937
|
- if(empty($area) || $area == 86){
|
940
|
+ if (empty($area) || $area == 86) {
|
938
|
return $mobile;
|
941
|
return $mobile;
|
939
|
}
|
942
|
}
|
940
|
- return $area.'-'.$mobile;
|
943
|
+ return $area . '-' . $mobile;
|
941
|
}
|
944
|
}
|
942
|
|
945
|
|
943
|
/**
|
946
|
/**
|
|
@@ -968,11 +971,11 @@ class Helpers |
|
@@ -968,11 +971,11 @@ class Helpers |
968
|
{
|
971
|
{
|
969
|
return preg_replace('/^\/\//', 'http://', $url);
|
972
|
return preg_replace('/^\/\//', 'http://', $url);
|
970
|
}
|
973
|
}
|
971
|
-
|
974
|
+
|
972
|
/**
|
975
|
/**
|
973
|
* http和https转换成//
|
976
|
* http和https转换成//
|
974
|
* @param type $url 地址
|
977
|
* @param type $url 地址
|
975
|
- * @return type string
|
978
|
+ * @return type string
|
976
|
*/
|
979
|
*/
|
977
|
public static function getUrlSafe($url)
|
980
|
public static function getUrlSafe($url)
|
978
|
{
|
981
|
{
|
|
@@ -980,10 +983,10 @@ class Helpers |
|
@@ -980,10 +983,10 @@ class Helpers |
980
|
}
|
983
|
}
|
981
|
|
984
|
|
982
|
/**
|
985
|
/**
|
983
|
- * 除去数组中的空值和签名参数
|
|
|
984
|
- * @param $para 签名参数组
|
|
|
985
|
- * return 去掉空值与签名参数后的新签名参数组
|
|
|
986
|
- */
|
986
|
+ * 除去数组中的空值和签名参数
|
|
|
987
|
+ * @param $para 签名参数组
|
|
|
988
|
+ * return 去掉空值与签名参数后的新签名参数组
|
|
|
989
|
+ */
|
987
|
public static function paraFilter(&$para)
|
990
|
public static function paraFilter(&$para)
|
988
|
{
|
991
|
{
|
989
|
$para_filter = array();
|
992
|
$para_filter = array();
|
|
@@ -995,16 +998,17 @@ class Helpers |
|
@@ -995,16 +998,17 @@ class Helpers |
995
|
}
|
998
|
}
|
996
|
return $para_filter;
|
999
|
return $para_filter;
|
997
|
}
|
1000
|
}
|
998
|
-
|
|
|
999
|
-
|
1001
|
+
|
|
|
1002
|
+
|
1000
|
/**
|
1003
|
/**
|
1001
|
* 判断是否是微信客户端
|
1004
|
* 判断是否是微信客户端
|
1002
|
* @return boolean
|
1005
|
* @return boolean
|
1003
|
*/
|
1006
|
*/
|
1004
|
- public static function is_weixin(){
|
|
|
1005
|
- if ( strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false ) {
|
1007
|
+ public static function is_weixin()
|
|
|
1008
|
+ {
|
|
|
1009
|
+ if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false) {
|
1006
|
return true;
|
1010
|
return true;
|
1007
|
- }
|
1011
|
+ }
|
1008
|
return false;
|
1012
|
return false;
|
1009
|
}
|
1013
|
}
|
1010
|
} |
1014
|
} |