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


PHP StringHelper::filterString方法代码示例

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


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

示例1: getUrlUploadMultiImages

 public static function getUrlUploadMultiImages($obj, $user_id)
 {
     $url_arr = array();
     $min_size = 1024 * 1000 * 700;
     $max_size = 1024 * 1000 * 1000 * 3.5;
     foreach ($obj["tmp_name"] as $key => $tmp_name) {
         $ext_arr = array('png', 'jpg', 'jpeg', 'bmp');
         $name = StringHelper::filterString($obj['name'][$key]);
         $storeFolder = Yii::getPathOfAlias('webroot') . '/images/' . date('Y-m-d', time()) . '/' . $user_id . '/';
         $pathUrl = 'images/' . date('Y-m-d', time()) . '/' . $user_id . '/' . time() . $name;
         if (!file_exists($storeFolder)) {
             mkdir($storeFolder, 0777, true);
         }
         $tempFile = $obj['tmp_name'][$key];
         $targetFile = $storeFolder . time() . $name;
         $ext = strtolower(pathinfo($name, PATHINFO_EXTENSION));
         $size = $obj['name']['size'];
         if (in_array($ext, $ext_arr)) {
             if ($size >= $min_size && $size <= $max_size) {
                 if (move_uploaded_file($tempFile, $targetFile)) {
                     array_push($url_arr, $pathUrl);
                 } else {
                     return NULL;
                 }
             } else {
                 return NULL;
             }
         } else {
             return NULL;
         }
     }
     return $url_arr;
 }
开发者ID:huynt57,项目名称:image_chooser,代码行数:33,代码来源:UploadHelper.php

示例2: checkOut

 public function checkOut(Request $request)
 {
     $address = \StringHelper::filterString($request->input('address'));
     $name = \StringHelper::filterString($request->input('name'));
     $content = \StringHelper::filterString($request->input('comments'));
     $phone = \StringHelper::filterString($request->input('phone'));
     $count = Cart::count();
     if ($phone != "" && $name != "" && $content != "" && $count > 0) {
         $order = new Order();
         $order->order_name = $name;
         $order->status = 1;
         $order->active = 1;
         $order->order_comment = $content;
         $order->order_address = $address;
         $order->order_phone = $phone;
         $order->save();
         $cart = Cart::content();
         foreach ($cart as $item) {
             $order_detail = new OrderDetail();
             $order_detail->dish_id = $item->id;
             $order_detail->dish_number = $item->qty;
             $order_detail->order_id = $order->id;
             $order_detail->save();
         }
         Cart::destroy();
         return Redirect::to(url('menu'))->with('message', 'Order Success !. You can continue buy now !');
     } else {
         return Redirect::to(url('checkout'))->with('message', 'Order Fail !. Something Wrong !');
     }
 }
开发者ID:huynt57,项目名称:savvy-restaurant,代码行数:30,代码来源:CartController.php

示例3: bookTable

 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function bookTable(Request $request)
 {
     $email = \StringHelper::filterString($request->input('email'));
     $name = \StringHelper::filterString($request->input('name'));
     $phone = \StringHelper::filterString($request->input('phone'));
     $number = \StringHelper::filterString($request->input('number'));
     $month = \StringHelper::filterString($request->input('month'));
     $day = \StringHelper::filterString($request->input('day'));
     $hour = \StringHelper::filterString($request->input('hour'));
     $min = \StringHelper::filterString($request->input('min'));
     $a_p = \StringHelper::filterString($request->input('a-p'));
     $content = \StringHelper::filterString($request->input('comments'));
     if ($email != "" && $name != "" && $phone != "" && $number != "" && $month != "" && $day != "") {
         $book_table = new BookTable();
         $book_table->name = $name;
         $book_table->email = $email;
         $book_table->phone = $phone;
         $book_table->number = $number;
         $book_table->comments = $content;
         $book_table->active = 1;
         $book_table->status = 1;
         $book_table->date = $day . "-" . $month . " " . $hour . ":" . $min . " " . $a_p;
         $book_table->save();
     }
     return Redirect::back()->with('message', 'Success');
 }
开发者ID:huynt57,项目名称:savvy-restaurant,代码行数:31,代码来源:ReservationController.php

示例4: deleteOrder

 public function deleteOrder(Request $request)
 {
     $order_id = \StringHelper::filterString($request->input('order_id'));
     $deletedRows = Order::where('id', $order_id)->delete();
     $catRow = OrderDetail::where('order_id', $order_id)->delete();
     return Redirect::back()->with('message', 'Success');
 }
开发者ID:huynt57,项目名称:savvy-restaurant,代码行数:7,代码来源:OrderController.php

示例5: actionchangePassword

 public function actionchangePassword()
 {
     $request = Yii::app()->request;
     if ($request->isPostRequest && isset($_POST)) {
         try {
             $old_pass = StringHelper::filterString(Yii::app()->request->getPost('old_password'));
             $pass1 = StringHelper::filterString(Yii::app()->request->getPost('password'));
             $pass2 = StringHelper::filterString(Yii::app()->request->getPost('password2'));
             $user = User::model()->findByAttributes(array('password' => md5($old_pass)));
             if ($user) {
                 if ($pass1 == $pass2) {
                     $user->password = md5($pass1);
                     $user->save(FALSE);
                     Yii::app()->user->setFlash('success', "Password changed !");
                     $this->redirect(Yii::app()->createUrl('admin/order'));
                 }
             } else {
                 $this->redirect(Yii::app()->createUrl('admin/home/login'));
             }
         } catch (exception $e) {
             echo $e->getMessage();
         }
     }
     $this->render('changePassword');
 }
开发者ID:huynt57,项目名称:vs,代码行数:25,代码来源:HomeController.php

示例6: actionInsertPostCeleb

 public function actionInsertPostCeleb()
 {
     $this->pageTitile = 'Thêm bài viết người nổi tiếng';
     $request = Yii::app()->request;
     try {
         $post_content = StringHelper::filterString($request->getPost('post_content'));
         $celeb_id = StringHelper::filterString($request->getPost('celeb_id'));
         $location = StringHelper::filterString($request->getPost('location'));
         $cats = $request->getPost('cats');
         if (count($_FILES['images']['tmp_name']) > 1) {
             $url_arr = UploadHelper::getUrlUploadMultiImages($_FILES['images'], $celeb_id . 'celeb');
         } else {
             $url_arr = UploadHelper::getUrlUploadMultiImages($_FILES['images'], $celeb_id . 'celeb');
         }
         // $album = StringHelper::filterString($request->getPost('album'));
         $album = NULL;
         $res = Posts::model()->addPostCeleb($celeb_id, $post_content, $location, $url_arr, $album, $cats);
         if ($res != FALSE) {
             Yii::app()->user->setFlash('success', 'Thêm bài viết thành công');
         } else {
             Yii::app()->user->setFlash('error', 'Có lỗi xảy ra');
         }
         $this->redirect(Yii::app()->createUrl('celebrity/addPost'));
     } catch (Exception $ex) {
         var_dump($ex->getMessage());
     }
 }
开发者ID:huynt57,项目名称:fashion,代码行数:27,代码来源:CelebrityController.php

示例7: actionUpdateVersion

 public function actionUpdateVersion()
 {
     $this->retVal = new stdClass();
     $request = Yii::app()->request;
     if ($request->isPostRequest && isset($_POST)) {
         try {
             $app_ver = StringHelper::filterString($request->getPost('app_ver'));
             $db_ver = StringHelper::filterString($request->getPost('db_ver'));
             $model = AppDbVer::model()->findByAttributes(array('id' => 1));
             $model->app_ver = $app_ver;
             $model->db_ver = $db_ver;
             if ($model->save(FALSE)) {
                 $this->retVal->status = 1;
                 $this->retVal->message = "Success";
             } else {
                 $this->retVal->status = 0;
                 $this->retVal->message = "Fail";
             }
             $this->retVal->data = "";
         } catch (exception $e) {
             $this->retVal->message = $e->getMessage();
         }
         echo CJSON::encode($this->retVal);
         Yii::app()->end();
     }
 }
开发者ID:huynt57,项目名称:soyba,代码行数:26,代码来源:VersionController.php

示例8: actionGetOrderAndResult

 public function actionGetOrderAndResult()
 {
     $request = Yii::app()->request;
     $order_id = StringHelper::filterString($request->getQuery('order_id'));
     $data = OrderMedlatec::model()->getOrderAndResult($order_id);
     ResponseHelper::JsonReturnSuccess($data, 'Success');
 }
开发者ID:huynt57,项目名称:soyba,代码行数:7,代码来源:MedlatecController.php

示例9: actionViewDocument

 public function actionViewDocument()
 {
     if (isset($_GET['doc_id'])) {
         $doc_id = StringHelper::filterString($_GET['doc_id']);
         $detail_doc = Doc::model()->findAll(array("select" => "*", "condition" => "doc_id = :doc_id", "params" => array(':doc_id' => $doc_id)));
         $spCriteria = new CDbCriteria();
         $spCriteria->select = "*";
         $spCriteria->condition = "doc_id = :doc_id";
         $spCriteria->params = array(':doc_id' => $doc_id);
         $subject_doc = SubjectDoc::model()->find($spCriteria);
         $spjCriteria = new CDbCriteria();
         $spjCriteria->select = "*";
         $spjCriteria->condition = "subject_id = :subject_id";
         $spjCriteria->params = array(':subject_id' => $subject_doc->subject_id);
         $subject = Subject::model()->find($spjCriteria);
         $related_doc = Doc::model()->findAll(array("select" => "*", "limit" => "3", "order" => "RAND()"));
         foreach ($detail_doc as $detail) {
             $title = $detail->doc_name . " | Bluebee - UET";
             $this->pageTitle = $title;
             if ($detail->doc_type == 3) {
                 $image = Yii::app()->getBaseUrl(true) . $detail->doc_url;
             } else {
                 $image = $detail->doc_url;
             }
             $des = $detail->doc_description;
             Yii::app()->clientScript->registerMetaTag($title, null, null, array('property' => 'og:title'));
             Yii::app()->clientScript->registerMetaTag($image, null, null, array('property' => 'og:image'));
             Yii::app()->clientScript->registerMetaTag(500, null, null, array('property' => 'og:image:width'));
             Yii::app()->clientScript->registerMetaTag(500, null, null, array('property' => 'og:image:height'));
             Yii::app()->clientScript->registerMetaTag("website", null, null, array('property' => 'og:type'));
             Yii::app()->clientScript->registerMetaTag($des, null, null, array('property' => 'og:description'));
         }
         $this->render('viewDocument', array('detail_doc' => $detail_doc, 'related_doc' => $related_doc, 'subject' => $subject));
     }
 }
开发者ID:huynt57,项目名称:bluebee-uet.com,代码行数:35,代码来源:ViewDocumentController.php

示例10: actionDetail

 public function actionDetail()
 {
     $request = Yii::app()->request;
     $patient_id = StringHelper::filterString($request->getQuery("patient_id"));
     $patient_info = Patient::model()->findByAttributes(array('patient_id' => $patient_id));
     // $patient_info = Patient::model()->getPatientDetailAdmin($patient_id);
     // echo CJSON::encode($patient_info);
     $this->render('detail', array('patient_info' => $patient_info));
 }
开发者ID:huynt57,项目名称:soyba,代码行数:9,代码来源:PatientController.php

示例11: actionEdit

 public function actionEdit()
 {
     $request = Yii::app()->request;
     $this->layoutPath = Yii::getPathOfAlias('webroot') . "/themes/classic/views/layouts";
     $this->layout = 'main_modal';
     $service_id = StringHelper::filterString($request->getQuery('service_id'));
     $data = ServiceMedlatec::model()->findByPk($service_id);
     $this->render('edit', array('data' => $data));
 }
开发者ID:huynt57,项目名称:medlatec,代码行数:9,代码来源:ServiceController.php

示例12: actionEdit

 public function actionEdit()
 {
     try {
         $id = StringHelper::filterString(Yii::app()->request->getQuery('id'));
         $result = Opinion::model()->findByPk($id);
     } catch (Exception $ex) {
         var_dump($ex->getMessage());
     }
     $this->render('edit', array('model' => $result));
 }
开发者ID:huynt57,项目名称:vksnd,代码行数:10,代码来源:OpinionController.php

示例13: actionGetSubjectByUser

 public function actionGetSubjectByUser()
 {
     $request = Yii::app()->request;
     try {
         $user_id = StringHelper::filterString($request->getQuery('user_id'));
         $data = Subject::model()->getSubjectByUser($user_id);
         ResponseHelper::JsonReturnSuccess($data, 'success');
     } catch (Exception $ex) {
         var_dump($ex->getMessage());
     }
 }
开发者ID:uethackathon,项目名称:uethackathon2015_team4,代码行数:11,代码来源:SubjectController.php

示例14: actionGetServices

 public function actionGetServices()
 {
     $request = Yii::app()->request;
     try {
         $limit = StringHelper::filterString($request->getQuery('limit'));
         $offset = StringHelper::filterString($request->getQuery('offset'));
         $data = ServiceMedlatec::model()->getServices($limit, $offset);
         ResponseHelper::JsonReturnSuccess($data, 'Success');
     } catch (Exception $ex) {
     }
 }
开发者ID:huynt57,项目名称:soyba,代码行数:11,代码来源:ProviderController.php

示例15: processAdminLogin

 public function processAdminLogin(Request $request)
 {
     $uname = \StringHelper::filterString($request->input('uname'));
     $upw = \StringHelper::filterString($request->input('upw'));
     if ($uname == 'admin' && $upw == 'admin') {
         // Session::put('admin', 'admin');
         return Redirect::to(url('admin/dish'))->with('message', 'Login success');
     } else {
         return Redirect::to(url('admin/login'))->with('message', 'Something Wrong :(');
     }
 }
开发者ID:huynt57,项目名称:savvy-restaurant,代码行数:11,代码来源:AdminController.php


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