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


PHP EnmasseHelper::checkSpecialCharacter方法代码示例

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


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

示例1: save

 function save()
 {
     $data = JRequest::get('post');
     $checkchracter = EnmasseHelper::checkSpecialCharacter($data['name']);
     if ($checkchracter) {
         $msg = JText::_('SAVE_DEAL_NOTICE');
         if ($data['id'] == null) {
             $this->setRedirect('index.php?option=com_enmasse&controller=' . JRequest::getVar('controller') . '&task=add', $msg, 'notice');
             return false;
         } else {
             $this->setRedirect('index.php?option=com_enmasse&controller=' . JRequest::getVar('controller') . '&task=edit&cid[0]=' . $data['id'], $msg, 'notice');
             return false;
         }
     }
     $data['slug_name'] = EnmasseHelper::seoUrl($data['name']);
     $data['description'] = JRequest::getVar('description', '', 'post', 'string', JREQUEST_ALLOWRAW);
     $data['highlight'] = JRequest::getVar('highlight', '', 'post', 'string', JREQUEST_ALLOWRAW);
     $data['terms'] = JRequest::getVar('terms', '', 'post', 'string', JREQUEST_ALLOWRAW);
     if ($data['slug_name'] == '_' || $data['slug_name'] == '') {
         $now = str_replace(":", " ", DatetimeWrapper::getDatetimeOfNow());
         $data['slug_name'] = EnmasseHelper::seoUrl($now);
     }
     $model = JModel::getInstance('deal', 'enmasseModel');
     //---------------------------------------------------------------
     // if edit deal
     if ($data['id'] > 0) {
         //---get deal data
         $deal = JModel::getInstance('deal', 'enmasseModel')->getById($data['id']);
         // get sold coupon qty for deal
         $soldCouponList = JModel::getInstance('invty', 'enmasseModel')->getSoldCouponByPdtId($deal->id);
         //if from unlimited to limited
         if ($deal->max_coupon_qty < 0) {
             if ($data['max_coupon_qty'] > 0) {
                 if ($data['max_coupon_qty'] <= count($soldCouponList)) {
                     $msg = JText::_('MSG_CURRENT_SOLD_GRATER_THAN_MODIFIED_COUPON');
                     JFactory::getApplication()->redirect('index.php?option=com_enmasse&controller=deal&task=edit&cid=' . $data['id'], $msg);
                 } else {
                     $numOfAddCoupon = $data['max_coupon_qty'] - count($soldCouponList);
                 }
             }
         } else {
             //---------------- if change from limited to unlimited
             if ($data['max_coupon_qty'] < 0) {
                 $unlimit = true;
             } else {
                 if ($data['max_coupon_qty'] < $deal->max_coupon_qty) {
                     //---------------------- if new coupon qty <= the sold coupon qty
                     if ($data['max_coupon_qty'] <= count($soldCouponList)) {
                         $msg = JText::_('MSG_CURRENT_SOLD_GRATER_THAN_MODIFIED_COUPON');
                         JFactory::getApplication()->redirect('index.php?option=com_enmasse&controller=deal&task=edit&cid=' . $data['id'], $msg);
                     } else {
                         $numOfRemoveCoupon = $deal->max_coupon_qty - $data['max_coupon_qty'];
                     }
                 } else {
                     if ($data['max_coupon_qty'] > $deal->max_coupon_qty) {
                         $numOfAddCoupon = $data['max_coupon_qty'] - $deal->max_coupon_qty;
                     }
                 }
             }
         }
         // suong.mai edit save description to oder_item
         $db =& JFactory::getDBO();
         $query = "UPDATE #__enmasse_order_item\n\t\t\t\t\t  SET description ='" . $data['name'] . "'" . "WHERE pdt_id=" . $data['id'];
         $db->setQuery($query);
         $db->query();
         //$db->updateObject($this->, $object, $key)
     }
     //------------------------
     //gemerate integration class
     $integrateFileName = EnmasseHelper::getSubscriptionClassFromSetting() . '.class.php';
     $integrationClass = EnmasseHelper::getSubscriptionClassFromSetting();
     require_once JPATH_SITE . DS . "components" . DS . "com_enmasse" . DS . "helpers" . DS . "subscription" . DS . $integrationClass . DS . $integrateFileName;
     $integrationObject = new $integrationClass();
     // store data
     $row = $model->store($data);
     if ($row->success) {
         if ($data['id'] == 0) {
             $integrationObject->integration($row, 'newDeal');
         }
         //--------------------------------------
         // store location and category
         JModel::getInstance('dealCategory', 'enmasseModel')->store($row->id, $data['pdt_cat_id']);
         JModel::getInstance('dealLocation', 'enmasseModel')->store($row->id, $data['location_id']);
         // if is new deal and limited the coupdon then create coupon in invty
         if ($data['id'] == 0 && $row->max_coupon_qty > 0) {
             for ($i = 0; $i < $row->max_coupon_qty; $i++) {
                 $name = $i + 1;
                 JModel::getInstance('invty', 'enmasseModel')->generateCouponFreeStatus($row->id, $name, 'Free');
             }
         } else {
             if ($data['id'] != 0) {
                 if (!empty($numOfRemoveCoupon)) {
                     $freeCouponList = JModel::getInstance('invty', 'enmasseModel')->getCouponFreeByPdtID($data['id']);
                     // removed the coupons from invty
                     for ($i = 0; $i < $numOfRemoveCoupon; $i++) {
                         JModel::getInstance('invty', 'enmasseModel')->removeById($freeCouponList[$i]->id);
                     }
                 } else {
                     if (!empty($numOfAddCoupon)) {
                         // add more coupon to invty
//.........这里部分代码省略.........
开发者ID:marsa1985,项目名称:kazabiz,代码行数:101,代码来源:deal.php


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