本文整理汇总了PHP中Fields::getPurifier方法的典型用法代码示例。如果您正苦于以下问题:PHP Fields::getPurifier方法的具体用法?PHP Fields::getPurifier怎么用?PHP Fields::getPurifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fields
的用法示例。
在下文中一共展示了Fields::getPurifier方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionUpdate
/**
* Updates a particular model.
* If update is successful, the browser will be redirected to the 'view' page.
*
* @param integer $id the ID of the model to be updated
*/
public function actionUpdate($id)
{
$model = $this->loadModel($id);
if (!isset($model)) {
Yii::app()->user->setFlash('error', Yii::t('app', 'The requested page does not exist.'));
$this->redirect(array('index'));
}
if (isset($_POST['Campaign'])) {
$oldAttributes = $model->attributes;
$model->setX2Fields($_POST['Campaign']);
$model->content = Fields::getPurifier()->purify($model->content);
$model->content = Formatter::restoreInsertableAttributes($model->content);
if ($model->save()) {
CampaignAttachment::model()->deleteAllByAttributes(array('campaign' => $model->id));
if (isset($_POST['AttachmentFiles'])) {
if (isset($_POST['AttachmentFiles']['id'])) {
foreach ($_POST['AttachmentFiles']['id'] as $mediaId) {
$attachment = new CampaignAttachment();
$attachment->campaign = $model->id;
$attachment->media = $mediaId;
$attachment->save();
}
}
}
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('update', array('model' => $model));
}
示例2: setActionDescription
public function setActionDescription($value)
{
// Magic setter stores value in actionDescriptionTemp until saved
$this->actionDescriptionTemp = Fields::getPurifier()->purify($value);
}
示例3: handleServiceFormSubmission
private function handleServiceFormSubmission($model, $extractedParams)
{
if (isset($_POST['Services'])) {
// web form submitted
if (isset($_POST['Services']['firstName'])) {
$firstName = $_POST['Services']['firstName'];
$fullName = $firstName;
}
if (isset($_POST['Services']['lastName'])) {
$lastName = $_POST['Services']['lastName'];
if (isset($fullName)) {
$fullName .= ' ' . $lastName;
} else {
$fullName = $lastName;
}
}
if (isset($_POST['Services']['email'])) {
$email = $_POST['Services']['email'];
}
if (isset($_POST['Services']['phone'])) {
$phone = $_POST['Services']['phone'];
}
if (isset($_POST['Services']['desription'])) {
$description = $_POST['Services']['description'];
}
// Extra sanitizing
$p = Fields::getPurifier();
foreach ($model->attributes as $name => $value) {
if ($name != $model->primaryKey() && !empty($value)) {
$model->{$name} = $p->purify($value);
}
}
if (isset($email) && $email) {
$contact = Contacts::model()->findByAttributes(array('email' => $email));
} else {
$contact = false;
}
if ($contact) {
$model->contactId = $contact->nameId;
} else {
$model->contactId = "Unregistered";
}
if (isset($fullName) || isset($email)) {
$model->subject = Yii::t('services', 'Web Form Case entered by {name}', array('{name}' => isset($fullName) ? $fullName : $email));
} else {
$model->subject = Yii::t('services', 'Web Form Case');
}
$model->origin = 'Web';
if (!isset($model->impact) || $model->impact == '') {
$model->impact = Yii::t('services', '3 - Moderate');
}
if (!isset($model->status) || $model->status == '') {
$model->status = Yii::t('services', 'New');
}
if (!isset($model->mainIssue) || $model->mainIssue == '') {
$model->mainIssue = Yii::t('services', 'General Request');
}
if (!isset($model->subIssue) || $model->subIssue == '') {
$model->subIssue = Yii::t('services', 'Other');
}
$model->assignedTo = $this->controller->getNextAssignee();
if (isset($email)) {
$model->email = CHtml::encode($email);
}
$now = time();
$model->createDate = $now;
$model->lastUpdated = $now;
$model->updatedBy = 'admin';
if (isset($description)) {
$model->description = CHtml::encode($description);
}
if (!$model->hasErrors()) {
if ($model->save()) {
$model->name = $model->id;
$model->update(array('name'));
self::addTags($model);
//use the submitted info to create an action
$action = new Actions();
$action->actionDescription = Yii::t('contacts', 'Web Form') . "\n\n" . (isset($fullName) ? Yii::t('contacts', 'Name') . ': ' . $fullName . "\n" : '') . (isset($email) ? Yii::t('contacts', 'Email') . ": " . $email . "\n" : '') . (isset($phone) ? Yii::t('contacts', 'Phone') . ": " . $phone . "\n" : '') . (isset($description) ? Yii::t('services', 'Description') . ": " . $description : '');
// create action
$action->type = 'note';
$action->assignedTo = $model->assignedTo;
$action->visibility = '1';
$action->associationType = 'services';
$action->associationId = $model->id;
$action->associationName = $model->name;
$action->createDate = $now;
$action->lastUpdated = $now;
$action->completeDate = $now;
$action->complete = 'Yes';
$action->updatedBy = 'admin';
$action->save();
if (isset($email)) {
//send email
$emailBody = Yii::t('services', 'Hello') . ' ' . $fullName . ",<br><br>";
$emailBody .= Yii::t('services', 'Thank you for contacting our Technical Support ' . 'team. This is to verify we have received your request for Case# ' . '{casenumber}. One of our Technical Analysts will contact you shortly.', array('{casenumber}' => $model->id));
$emailBody = Yii::app()->settings->serviceCaseEmailMessage;
if (isset($firstName)) {
$emailBody = preg_replace('/{first}/u', $firstName, $emailBody);
}
//.........这里部分代码省略.........