当前位置: 首页>>代码示例>>PHP>>正文


PHP utils::addslashes_array方法代码示例

本文整理汇总了PHP中utils::addslashes_array方法的典型用法代码示例。如果您正苦于以下问题:PHP utils::addslashes_array方法的具体用法?PHP utils::addslashes_array怎么用?PHP utils::addslashes_array使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在utils的用法示例。


在下文中一共展示了utils::addslashes_array方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: goods_filter

 public function goods_filter(&$filter, &$object)
 {
     if (!$filter['goods_id']) {
         $filter['goods_id'] = array();
     }
     if (!is_array($filter['goods_id'])) {
         $filter['goods_id'] = (array) $filter['goods_id'];
     }
     if (count($filter['goods_id'])) {
         return $filter;
         //有goods_id filter 时,不折腾
     }
     $filter = utils::addslashes_array($filter);
     //拦截货品相关filter
     $filter = $this->fix_product_filter($filter, $object);
     //子类、扩展分类商品
     $filter = $this->_cat_merge($filter, $object);
     //关键词搜
     if ($filter['keyword']) {
         $keyword = $filter['keyword'];
         foreach ($object->app->model('goods_keywords')->getList('goods_id', array('keyword|has' => $filter['keyword'])) as $item) {
             array_push($filter['goods_id'], $item['goods_id']);
         }
         $goods_select_sql = 'SELECT goods_id FROM ' . $object->table_name(1) . ' WHERE name LIKE "%' . $keyword . '%" OR brief LIKE "%' . $keyword . '%"';
         foreach ($object->db->select($goods_select_sql) as $item) {
             array_push($filter['goods_id'], $item['goods_id']);
         }
         unset($filter['keyword']);
         if (empty($filter['goods_id'])) {
             $filter['intro|has'] = $keyword;
         }
     }
     if ($filter['product_filter']) {
         foreach ($object->app->model('products')->getList('goods_id', $filter['product_filter']) as $item) {
             array_push($filter['goods_id'], $item['goods_id']);
         }
         unset($filter['product_filter']);
     }
     if ($filter['name']) {
         $filter['name|has'] = $filter['name'];
         unset($filter['name']);
     }
     if (!$filter['goods_type']) {
         $filter['goods_type'] = 'normal';
     }
     if (is_array($filter['goods_id'])) {
         $filter['goods_id'] = array_unique($filter['goods_id']);
     }
     foreach ($filter as $k => $v) {
         if (!isset($v) || empty($v)) {
             unset($filter[$k]);
         }
     }
     return $filter;
 }
开发者ID:yindonghai,项目名称:msk.com,代码行数:55,代码来源:filter.php

示例2: products

 function products()
 {
     $objGoods = $this->app->model('goods');
     $imageDefault = app::get('image')->getConf('image.set');
     $this->pagedata['image_set'] = $imageDefault;
     $this->pagedata['defaultImage'] = $imageDefault['S']['default_image'];
     $filter = array();
     foreach (explode(',', $_POST['goods']) as $gid) {
         $filter['goods_id'][] = $gid;
     }
     $aProduct = $objGoods->getList('*,find_in_set(goods_id,"' . utils::addslashes_array($_POST['goods']) . '") as rank', $filter, 0, -1, array('rank', 'asc'));
     $aData = $this->get_current_member();
     if (!$aData['member_id']) {
         $this->pagedata['login'] = 'nologin';
     }
     $view = $this->app->getConf('gallery.default_view');
     if ($view == 'index') {
         $view = 'list';
     }
     if (is_array($aProduct) && count($aProduct) > 0) {
         $objProduct = $this->app->model('products');
         if ($this->app->getConf('site.show_mark_price') == 'true') {
             $setting['mktprice'] = $this->app->getConf('site.show_mark_price');
             if (isset($aProduct)) {
                 foreach ($aProduct as $pk => $pv) {
                     if (empty($aProduct[$pk]['mktprice'])) {
                         $aProduct[$pk]['mktprice'] = $objProduct->getRealMkt($pv['price']);
                     }
                 }
             }
         } else {
             $setting['mktprice'] = 0;
         }
         $setting['saveprice'] = $this->app->getConf('site.save_price');
         $setting['buytarget'] = $this->app->getConf('site.buy.target');
         $this->pagedata['setting'] = $setting;
         //spec_desc
         $siteMember = $this->get_current_member();
         $this->site_member_lv_id = $siteMember['member_lv'];
         $oGoodsLv = $this->app->model('goods_lv_price');
         $oMlv = $this->app->model('member_lv');
         $mlv = $oMlv->db_dump($this->site_member_lv_id, 'dis_count');
         foreach ($aProduct as $key => &$val) {
             $temp = $objProduct->getList('product_id, spec_info, price, freez, store,   marketable, goods_id', array('goods_id' => $val['goods_id'], 'marketable' => 'true'));
             $aProduct[$key]['spec_desc'] = unserialize($val['spec_desc']);
             if ($this->site_member_lv_id) {
                 $tmpGoods = array();
                 foreach ($oGoodsLv->getList('product_id,price', array('goods_id' => $val['goods_id'], 'level_id' => $this->site_member_lv_id)) as $k => $v) {
                     $tmpGoods[$v['product_id']] = $v['price'];
                 }
                 foreach ($temp as &$tv) {
                     $tv['price'] = isset($tmpGoods[$tv['product_id']]) ? $tmpGoods[$tv['product_id']] : $mlv['dis_count'] * $tv['price'];
                 }
                 $val['price'] = isset($tmpGoods[$tv['product_id']]) ? $tmpGoods[$tv['product_id']] : $mlv['dis_count'] * $val['price'];
             }
             $promotion_price = kernel::single('b2c_goods_promotion_price')->process($val);
             if ($promotion_price) {
                 if ($promotion_price['price']) {
                     $val['timebuyprice'] = $promotion_price['price'];
                 } else {
                     $val['timebuyprice'] = $val['price'];
                 }
                 $val['show_button'] = $promotion_price['show_button'];
                 $val['timebuy_over'] = $promotion_price['timebuy_over'];
             }
             $val['spec_desc_info'] = $temp;
             $aProduct[$key]['product_id'] = $temp[0]['product_id'];
             if (empty($val['image_default_id'])) {
                 $aProduct[$key]['image_default_id'] = $imageDefault['S']['default_image'];
             }
         }
         $this->pagedata['products'] =& $aProduct;
     }
     $this->page('wap/gallery/type/' . $view . '.html', true);
 }
开发者ID:sss201413,项目名称:ecstore,代码行数:75,代码来源:tools.php

示例3: goods_filter

 function goods_filter(&$filter, &$object)
 {
     $filter = utils::addslashes_array($filter);
     $ObjProducts = $object->app->model('products');
     $where = array();
     if (isset($filter['marketable'])) {
         if ($filter['marketable'] === 'true') {
             $filter['marketable'] = 'true';
         }
         if ($filter['marketable'] === 'false') {
             $filter['marketable'] = 'false';
         }
     }
     if ($filter['type_id'] == '_ANY_') {
         unset($filter['type_id']);
     }
     // 此导致商品高级筛选(销售价介于)
     if (is_numeric($filter['price']) && isset($filter['_price_search'])) {
         $filter['price|' . $filter['_price_search']] = $filter['price'];
         if ($filter['price_from'] && $filter['price_to']) {
             $filter['price|' . $filter['_price_search']] = array($filter['price_from'], $filter['price_to']);
         }
         unset($filter['price']);
         unset($filter['_price_search']);
     }
     if ($filter['cat_id'][0] == "_ANY_" || $filter['cat_id'] == "_ANY_") {
         unset($filter['cat_id']);
     }
     if ($filter['cat_id'] || $filter['cat_id'] === 0) {
         if (!is_array($filter['cat_id'])) {
             $filter['cat_id'] = array($filter['cat_id']);
         } else {
             foreach ($filter['cat_id'] as $vCat_id) {
                 if ($vCat_id !== '_ANY_' && $vCat_id !== '') {
                     $aCat_id[] = intval($vCat_id);
                 }
             }
             $filter['cat_id'] = $aCat_id;
         }
         if (!isset($object->__show_goods)) {
             $object->__show_goods = $object->app->getConf('system.category.showgoods');
         }
         if ($object->__show_goods) {
             if (count($filter['cat_id']) > 0) {
                 $where[] = 'cat_id in (' . implode($filter['cat_id'], ' , ') . ')';
             }
         } else {
             if ($filter['cat_id']) {
                 $oCat = $object->app->model('goods_cat');
                 $fcat_id = $filter['cat_id'];
                 $aCat = $oCat->getList('cat_path,cat_id', array('cat_id' => $fcat_id));
             }
             $pathplus = '';
             if (count($aCat)) {
                 foreach ($aCat as $v) {
                     $pathplus .= ' cat_path LIKE \'' . $v['cat_path'] . $v['cat_id'] . ',%\' OR';
                 }
             }
             if ($aCat) {
                 foreach ($object->db->select('SELECT cat_id FROM sdb_b2c_goods_cat WHERE ' . $pathplus . ' cat_id in (' . implode($filter['cat_id'], ' , ') . ')') as $rows) {
                     $aCatid[] = $rows['cat_id'];
                 }
             } else {
                 unset($aCatid);
             }
             /*                if(in_array('0', $filter['cat_id'])){
                                 $aCatid[] = 0;
                             }*/
             if (!is_null($aCatid)) {
                 $where[] = 'cat_id IN (' . implode(',', $aCatid) . ')';
             } else {
                 if ($filter['cat_id'] && $filter['cat_id'][0]) {
                     $where[] = 'cat_id IN (' . implode(',', $filter['cat_id']) . ')';
                 }
             }
         }
         $filter['cat_id'] = null;
     }
     if (isset($filter['area']) && $filter['area']) {
         $where[] = 'goods_id < ' . $filter['area'][0] . ' and goods_id >' . $filter['area'][1];
         //$where[] = 'and goods_id < 1000';
         unset($filter['area']);
     }
     if ($filter['type_id'] == "_ANY_" || empty($filter['type_id'][0])) {
         unset($filter['type_id']);
     }
     if (is_array($filter['tag'])) {
         foreach ($filter['tag'] as $tk => $tv) {
             if ($tv == '_ANY_') {
                 unset($filter['tag'][$tk]);
             }
         }
     }
     if (isset($filter['brand_id']) && $filter['brand_id']) {
         if (is_array($filter['brand_id'])) {
             foreach ($filter['brand_id'] as $brand_id) {
                 if ($brand_id != '_ANY_') {
                     $aBrand[] = intval($brand_id);
                 }
             }
//.........这里部分代码省略.........
开发者ID:syjzwjj,项目名称:quyeba,代码行数:101,代码来源:filter.php

示例4: dbeav_filter_parser

 function dbeav_filter_parser($filter, $tableAlias = null, $baseWhere = null, &$object)
 {
     $this->use_like = $object->filter_use_like;
     $filter = utils::addslashes_array($filter);
     $schema = $object->get_schema();
     $idColumn = $schema['idColumn'];
     $tPre = ($tableAlias ? $tableAlias : '`' . $object->table_name(true) . '`') . '.';
     $where = $baseWhere ? $baseWhere : array(1);
     if (isset($filter['tag']) && ($tag = $filter['tag'])) {
         if (is_array($filter['tag'])) {
             foreach ($filter['tag'] as $tk => $tv) {
                 if ($tv == '_ANY_') {
                     unset($filter['tag'][$tk]);
                 }
             }
         }
         if (isset($filter['tag'])) {
             unset($filter['tag']);
         }
         if (is_array($tag)) {
             if (count($tag) == 0) {
                 unset($tag);
             }
         } else {
             $tag = array($tag);
         }
         if ($tag == '_ANY_' || $tag == array('_ANY_')) {
             unset($tag);
         }
         if ($tag) {
             $a = array();
             if (is_array($tag) && count($tag) > 0) {
                 foreach ($object->db->select("select rel_id from sdb_desktop_tag_rel where tag_id in (" . implode(',', $tag) . ")") as $r) {
                     $a[] = $r['rel_id'];
                 }
             }
             if (count($a) > 0) {
                 $where[] = "{$tPre}{$idColumn} in ('" . implode("','", $a) . "')";
             } else {
                 $where[] = ' 0';
             }
         }
     }
     if (isset($filter['final_amount']) && !is_array($filter['final_amount']) && !is_numeric($filter['final_amount'])) {
         unset($filter['final_amount']);
     }
     if (isset($filter['advance']) && !is_array($filter['advance']) && !is_numeric($filter['advance'])) {
         unset($filter['advance']);
     }
     $cols = array_merge($object->searchOptions(), $object->_columns());
     //idColumn为数组时单独处理
     if (!is_array($idColumn) && ($filter[$idColumn] == '_ALL_' || $filter[$idColumn] == array('_ALL_'))) {
         unset($filter[$idColumn]);
     } elseif (!is_array($idColumn) && isset($filter[$idColumn])) {
         $where[] = " {$tPre}{$idColumn} in ('" . implode("','", (array) $filter[$idColumn]) . "') ";
         unset($filter[$idColumn]);
     }
     if (is_array($filter)) {
         foreach ($filter as $k => $v) {
             if (is_null($v)) {
                 $where[] = $tPre . $k . ' is NULL ';
                 continue;
             }
             if ($k == 'filter_sql') {
                 $where[] = str_replace('{table}', $tPre, stripslashes($v));
                 continue;
             }
             if (isset($cols[$k]) || strpos($k, '|')) {
                 if (strpos($k, '|') !== false) {
                     list($k, $type) = explode('|', $k);
                     unset($filter[$k]);
                     $_str = $this->_inner_getFilterType($type, $v, false);
                     if (strpos($_str, '{field}') !== false) {
                         $where[] = str_replace('{field}', $tPre . $k, $_str);
                     } else {
                         $where[] = $tPre . $k . $_str;
                     }
                     $_str = null;
                     continue;
                 }
                 if (is_array($v)) {
                     $where[] = $tPre . $k . $this->_inner_getFilterType('in', $v, false);
                     continue;
                 }
                 $ac = array();
                 if ($cols[$k]['type'] == 'time' || $cols[$k]['type'] == 'last_modify') {
                     if ($filter['_' . $k . '_search'] == 'between') {
                         $a_v = array();
                         $a_v[] = strtotime($filter[$k . '_from'] . ' ' . $filter['_DTIME_']['H'][$k . '_from'] . ':' . $filter['_DTIME_']['M'][$k . '_from'] . ':00');
                         $a_v[] = strtotime($filter[$k . '_to'] . ' ' . $filter['_DTIME_']['H'][$k . '_to'] . ':' . $filter['_DTIME_']['M'][$k . '_to'] . ':00');
                         if (!empty($filter[$k . '_from']) && empty($filter[$k . '_to'])) {
                             $where[] = $tPre . $k . $this->_inner_getFilterType('bthan', $a_v[0]);
                         } elseif (empty($filter[$k . '_from']) && !empty($filter[$k . '_to'])) {
                             $where[] = $tPre . $k . $this->_inner_getFilterType('lthan', $a_v[1]);
                         } elseif (!empty($filter[$k . '_from']) && !empty($filter[$k . '_to'])) {
                             $where[] = str_replace('{field}', $tPre . $k, $this->_inner_getFilterType($filter['_' . $k . '_search'], $a_v));
                         }
                     } else {
                         $a_v = strtotime($filter[$k] . ' ' . $filter['_DTIME_']['H'][$k] . ':' . $filter['_DTIME_']['M'][$k] . ':00');
                         $where[] = $tPre . $k . $this->_inner_getFilterType($filter['_' . $k . '_search'], $a_v);
//.........这里部分代码省略.........
开发者ID:syjzwjj,项目名称:quyeba,代码行数:101,代码来源:filter.php

示例5: goods_filter

 function goods_filter(&$filter, &$object)
 {
     if (!is_array($filter) || isset($filter['goods_id']) && count($filter['goods_id']) == 1) {
         return $this->_pre_filter($filter);
     }
     $filter = utils::addslashes_array($filter);
     //过滤基本的条件
     $filter = $this->base_filter($filter);
     $ObjProducts = $object->app->model('products');
     //分类
     $filter = $this->get_cat_filter($filter, $object);
     /** 下面查询通过商品主键组合查询条件 - left join 相应的表 **/
     //关键字查找到对应的goodsId
     if (isset($filter['search_keywords'][0])) {
         if ($filter['filter_sql']) {
             $filter['filter_sql'] .= ' and ' . $object->wFilter($filter['search_keywords'][0]);
         } else {
             $filter['filter_sql'] = $object->wFilter($filter['search_keywords'][0]);
         }
     }
     if (isset($filter['keyword']) && $filter['keyword']) {
         $filter['keywords'] = array($filter['keyword']);
         unset($filter['keyword']);
     }
     if (isset($filter['keywords']) && $filter['keywords'] && !in_array('_ANY_', $filter['keywords'])) {
         $keywordsList = $object->getGoodsIdByKeyword($filter['keywords'], $filter['_keyword_search']);
         $keywordsGoods = array();
         foreach ($keywordsList as $keyword) {
             $keywordsGoods[] = intval($keyword['goods_id']);
         }
         if (!empty($keywordsGoods) && !empty($goods)) {
             $keywordsGoods = array_intersect($keywordsGoods, $goods);
             if (empty($keywordsGoods)) {
                 $goods = array('-1');
             } else {
                 $goods = $keywordsGoods;
             }
         } else {
             if (!empty($keywordsGoods)) {
                 $goods = $keywordsGoods;
             } else {
                 $goods = array('-1');
             }
         }
     }
     unset($filter['keywords']);
     //包含商品bn和货品bn都可以搜索到
     if (isset($filter['bn']) && $filter['bn']) {
         $sBn = '';
         if (is_array($filter['bn'])) {
             $sBn = trim($filter['bn'][0]);
         } else {
             $sBn = trim($filter['bn']);
         }
         $bnGoodsId = $object->getGoodsIdByBn($sBn, $filter['_bn_search']);
         if (!empty($bnGoodsId) && !empty($goods)) {
             $bnGoodsId = array_intersect($bnGoodsId, $goods);
             if (empty($bnGoodsId)) {
                 $goods = array('-1');
             } else {
                 $goods = $bnGoodsId;
             }
         } else {
             if (!empty($bnGoodsId)) {
                 $goods = $bnGoodsId;
             } else {
                 $goods = array('-1');
             }
         }
         unset($filter['bn']);
     }
     //货品编号
     if (isset($filter['barcode']) && $filter['barcode']) {
         $goods_id = $ObjProducts->getList('goods_id', array('barcode' => $filter['barcode']));
         if (isset($goods_id[0]['goods_id'])) {
             $filter['goods_id'] = $goods_id[0]['goods_id'];
         } else {
             $filter['goods_id'] = 0;
         }
         unset($filter['barcode']);
     }
     //规格筛选 mysql中
     if (count($filter['spec_value_id']) > 0) {
         $sql = 'SELECT goods_id FROM sdb_b2c_goods_spec_index WHERE spec_value_id IN ( ' . implode(',', $filter['spec_value_id']) . ' )';
         $sGoodsId = $object->db->select($sql);
         $sgid = array();
         foreach ($sGoodsId as $si) {
             $sgid[] = $si['goods_id'];
         }
         if (!empty($goods)) {
             $sgid = array_intersect($sgid, $goods);
         }
         if (!empty($sgid)) {
             $goods = $sgid;
         } else {
             $goods = array(-1);
         }
     }
     if (isset($goods) && count($goods) > 0) {
         $filter['goods_id'] = $goods;
//.........这里部分代码省略.........
开发者ID:sss201413,项目名称:ecstore,代码行数:101,代码来源:filter.php


注:本文中的utils::addslashes_array方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。