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


PHP Sanitizer::sanitize方法代码示例

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


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

示例1: scrub

 /**
  * Clean the value based on the scrubbers specified
  *
  * @param string|array $dirty
  * @return string|array
  */
 public function scrub($dirty)
 {
     $current = array_merge($this->pre, $this->scrubbers, $this->post);
     $sanitizer = new Sanitizer($current, $this->registered);
     return $sanitizer->sanitize($dirty);
 }
开发者ID:rustyrobotmedia,项目名称:mr-clean,代码行数:12,代码来源:MrClean.php

示例2: insertFeedback

 function insertFeedback()
 {
     $this->load->library('Sanitizer');
     $call = $this->uri->segment('3');
     $company = $this->uri->segment('4');
     $employee = $this->uri->segment('5');
     $PreFeedback = $this->input->post('feedback');
     $SanFeed = new Sanitizer($string);
     $feedback = $SanFeed->sanitize($PreFeedback);
     //date
     $date = date('Y-m-d H:i:s', now());
     $this->db->select('*');
     $this->db->from('ecc_feedback_feed');
     $this->db->where('idcall_feed', $call);
     $getFeedbacks = $this->db->get();
     if ($this->id == $employee) {
         $updateStatus = array('callStatus_call' => 'done', 'inDate_call' => date('Y-m-d H:i:s', now()));
         $this->db->where('id_call', $call);
         $this->db->update('ecc_calls_call', $updateStatus);
         //select employee of the department
         $this->db->select('*');
         $this->db->from('ecc_department_dep');
         $this->db->where('name_dep', $this->department);
         $getDep = $this->db->get();
         foreach ($getDep->result() as $depRow) {
             $this->db->select('*');
             $this->db->from('ecc_managers_man');
             $this->db->where('iddep_man', $depRow->id_dep);
             $getMan = $this->db->get();
             foreach ($getMan->result() as $manRow) {
                 $manId = $manRow->idemp_man;
                 //get employee
                 $this->db->SELECT('*');
                 $this->db->FROM('ecc_employee_empmeta');
                 $this->db->WHERE('idemp_empmeta', $manId);
                 $meta = $this->db->GET();
                 $thisMeta = array();
                 foreach ($meta->result() as $row2) {
                     $thisMeta[$row2->metaKey_empmeta] = $row2->metaValue_empmeta;
                 }
                 //meta
                 $MetaEmp = array('first_name' => $thisMeta['first_name'], 'last_name' => $thisMeta['last_name'], 'position' => $thisMeta['position'], 'avatar' => $thisMeta['avatar'], 'mobile' => $thisMeta['mobile']);
                 $EmpName = $MetaEmp['first_name'] . " " . $MetaEmp['last_name'];
                 //getCompany
                 $this->db->select('*');
                 $this->db->from('ecc_company_co');
                 $this->db->where('id_co', $company);
                 $getCoName = $this->db->get();
                 foreach ($getCoName->result() as $rowCo) {
                     $companyName = $rowCo->name_co;
                 }
                 $push = array('objectid_push' => $call, 'affectedEmp_push' => $manId, 'creatorEmp_push' => $this->id, 'affectedNameSpace_push' => $EmpName, 'creatorNameSpace_push' => $this->name, 'type_push' => 'calls', 'name_push' => '<b>' . $this->name . '</b> just added feedback to <b>' . $companyName . '</b> call', 'date_push' => date('Y-m-d H:i:s', now()), 'status_push' => '1');
                 $this->db->insert('ecc_pusher_push', $push);
                 //push notifications
                 $this->db->select('*');
                 $this->db->from('ecc_pusher_push');
                 $this->db->where('status_push', '1');
                 $this->db->where('affectedEmp_push', $employee);
                 $getCount = $this->db->get();
                 $PushNotification = array('count' => $getCount->num_rows(), 'name' => '<b>' . $this->name . '</b> just added feedback to <b>' . $companyName . '</b> call');
                 $this->load->library('pusher');
                 $this->pusher->trigger('notifications-' . $manId, 'notifications', $PushNotification);
             }
         }
     } else {
         //getCompany
         $this->db->select('*');
         $this->db->from('ecc_company_co');
         $this->db->where('id_co', $company);
         $getCoName = $this->db->get();
         foreach ($getCoName->result() as $rowCo) {
             $companyName = $rowCo->name_co;
         }
         //get employee
         $this->db->SELECT('*');
         $this->db->FROM('ecc_employee_empmeta');
         $this->db->WHERE('idemp_empmeta', $employee);
         $meta = $this->db->GET();
         $thisMeta = array();
         foreach ($meta->result() as $row2) {
             $thisMeta[$row2->metaKey_empmeta] = $row2->metaValue_empmeta;
         }
         //meta
         $MetaEmp = array('first_name' => $thisMeta['first_name'], 'last_name' => $thisMeta['last_name'], 'position' => $thisMeta['position'], 'avatar' => $thisMeta['avatar'], 'mobile' => $thisMeta['mobile']);
         $EmpName = $MetaEmp['first_name'] . " " . $MetaEmp['last_name'];
         $push = array('objectid_push' => $call, 'affectedEmp_push' => $employee, 'creatorEmp_push' => $this->id, 'affectedNameSpace_push' => $EmpName, 'creatorNameSpace_push' => $this->name, 'type_push' => 'calls', 'name_push' => '<b>' . $this->name . '</b> just added feedback to <b>' . $companyName . '</b> call', 'date_push' => date('Y-m-d H:i:s', now()), 'status_push' => '1');
         $this->db->insert('ecc_pusher_push', $push);
         //push notifications
         $this->db->select('*');
         $this->db->from('ecc_pusher_push');
         $this->db->where('status_push', '1');
         $this->db->where('affectedEmp_push', $employee);
         $getCount = $this->db->get();
         $PushNotification = array('count' => $getCount->num_rows(), 'name' => '<b>' . $this->name . '</b> just added feedback to <b>' . $companyName . '</b> call');
         $this->load->library('pusher');
         $this->pusher->trigger('notifications-' . $empRow->id_emp, 'notifications', $PushNotification);
     }
     $insertFeedback = array('idcall_feed' => $call, 'idemp_feed' => $this->id, 'idco_feed' => $company, 'feedback_feed' => $feedback, 'date_feed' => $date);
     $this->db->insert('ecc_feedback_feed', $insertFeedback);
 }
开发者ID:sirfsonuji,项目名称:SAM-API,代码行数:100,代码来源:boffice.php

示例3: dispatch

 /**
  * Parses the url, and dispatches to the appropriate controller.
  * @param bool $skipControllerInitialization
  */
 public function dispatch($skipControllerInitialization = false)
 {
     Profile::start('Dispatcher', 'Dispatching');
     $contentTypes = array();
     try {
         $controllerName = isset($_GET['controller']) ? trim($_GET['controller']) : $this->defaultControllerName;
         $controllerName = $this->controllerFromUrlSanitizer->sanitize($controllerName);
         $invalidControllerName = false;
         try {
             $controller = $this->controllerFactory->get($controllerName);
         } catch (ControllerFactoryException $e) {
             // Not failing just yet, so the model gets initialized.
             $invalidControllerName = true;
             $controller = $this->controllerFactory->get($this->defaultControllerName);
         }
         $model = new Model();
         $controller->setModel($model);
         $controller->initModel();
         $contentTypes = $this->getAcceptContentTypes($_SERVER['HTTP_ACCEPT']);
         try {
             if ($invalidControllerName) {
                 ErrorCode::notFound();
             }
             try {
                 $errorDuringRender = null;
                 $errorCode = null;
                 // Try to dispatch to the actual action.
                 $actionParameters = explode('/', isset($_GET['action']) ? $_GET['action'] : 'index');
                 $action = $actionParameters[0];
                 array_shift($actionParameters);
                 if ($action[0] === '_') {
                     throw new ErrorCode(ErrorCode::NOT_FOUND, 'Tried to access action with underscore.');
                 }
                 $action = $this->actionFromUrlSanitizer->sanitize($action);
                 try {
                     // Check if the action is valid
                     $reflectionClass = new ReflectionClass($controller);
                     $actionMethod = $reflectionClass->getMethod($action);
                     if ($action !== 'index' && (method_exists('Controller', $action) || !$actionMethod->isPublic() || $actionMethod->class !== get_class($controller))) {
                         throw new DispatcherException();
                     }
                 } catch (Exception $e) {
                     throw new ErrorCode(ErrorCode::NOT_FOUND, 'Tried to access invalid action.');
                 }
                 $controller->setAction($action);
                 $parameters = array();
                 $stringParameters = array();
                 $i = 0;
                 foreach ($actionMethod->getParameters() as $parameter) {
                     $actionParameter = isset($actionParameters[$i]) ? $actionParameters[$i] : null;
                     if ($actionParameter === null) {
                         if (!$parameter->isDefaultValueAvailable()) {
                             throw new ErrorCode(ErrorCode::BAD_REQUEST, 'Not all parameters supplied.');
                         }
                         // Well: there is no more additional query, and apparently the rest of the parameters are optional, so continue.
                         continue;
                     }
                     if (($parameterTypeClass = $parameter->getClass()) != false) {
                         if (!$parameterTypeClass->isSubclassOf('RW_Type')) {
                             throw new ErrorCode(ErrorCode::BAD_REQUEST, 'Invalid parameter type.');
                         }
                         $parameterTypeClassName = $parameterTypeClass->getName();
                         $parameters[] = new $parameterTypeClassName($actionParameter);
                     } else {
                         $parameters[] = $actionParameter;
                     }
                     $stringParameters[] = $actionParameter;
                     $i++;
                 }
                 $controller->setActionParameters($stringParameters);
                 if (!$skipControllerInitialization) {
                     $controller->initialize();
                 }
                 // This actually calls the apropriate action.
                 call_user_func_array(array($controller, $action), $parameters);
                 $controller->extendModel();
                 try {
                     $this->renderers->render($controller->getViewName(), $model, $this->notificationCenter, $this->theme->getTemplatesPath(), $contentTypes, $controller);
                 } catch (Exception $e) {
                     throw new ErrorCode(ErrorCode::INTERNAL_SERVER_ERROR, 'Error during render: ' . $e->getMessage());
                 }
             } catch (ErrorMessageException $e) {
                 $errorDuringRender = true;
                 $this->notificationCenter->addError($e->getMessage());
             } catch (ErrorCode $e) {
                 throw $e;
             } catch (Exception $e) {
                 $additionalInfo = array();
                 $additionalInfo['controllerName'] = $controllerName;
                 if (isset($action)) {
                     $additionalInfo['action'] = $action;
                 }
                 $additionalInfo['exceptionThrown'] = get_class($e);
                 $additionalInfo['error'] = $e->getMessage();
                 Log::warning($e->getMessage(), 'Dispatcher', $additionalInfo);
                 throw new ErrorCode(ErrorCode::INTERNAL_SERVER_ERROR);
//.........这里部分代码省略.........
开发者ID:enyo,项目名称:rincewind,代码行数:101,代码来源:DefaultDispatcher.php


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