modify Images.php use regex to php function
Showing
2 changed files
with
3 additions
and
2 deletions
@@ -152,7 +152,8 @@ class Helpers | @@ -152,7 +152,8 @@ class Helpers | ||
152 | $result['price'] = $productData['market_price']; | 152 | $result['price'] = $productData['market_price']; |
153 | $result['salePrice'] = $productData['sales_price']; | 153 | $result['salePrice'] = $productData['sales_price']; |
154 | $result['is_soon_sold_out'] = ($productData['is_soon_sold_out'] === 'Y'); | 154 | $result['is_soon_sold_out'] = ($productData['is_soon_sold_out'] === 'Y'); |
155 | - $result['url'] = OLD_MAIN . '/product/pro_' . $productData['product_id'] . '_' . $productData['goods_list'][0]['goods_id'] | 155 | + $result['url'] = OLD_MAIN . '/product/pro_' . $productData['product_id'] . '_' |
156 | + . $productData['goods_list'][0]['goods_id'] | ||
156 | . '/'. $productData['cn_alphabet'] . '.html'; | 157 | . '/'. $productData['cn_alphabet'] . '.html'; |
157 | 158 | ||
158 | if ($showTags) { | 159 | if ($showTags) { |
@@ -66,7 +66,7 @@ class Images | @@ -66,7 +66,7 @@ class Images | ||
66 | */ | 66 | */ |
67 | public static function getImageUrl($fileName, $width, $height, $mode = 1, $bucket = 'goodsimg') | 67 | public static function getImageUrl($fileName, $width, $height, $mode = 1, $bucket = 'goodsimg') |
68 | { | 68 | { |
69 | - if(!preg_match('|http://|', $fileName)){ | 69 | + if (stripos($fileName, 'http://') !== 0){ |
70 | $fileName = self::template($fileName, $bucket, $mode); | 70 | $fileName = self::template($fileName, $bucket, $mode); |
71 | } | 71 | } |
72 | return strtr($fileName, array('{width}' => $width, '{height}' => $height, '{mode}' => $mode)); | 72 | return strtr($fileName, array('{width}' => $width, '{height}' => $height, '{mode}' => $mode)); |
-
Please register or login to post a comment