當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Html::escapeJsRegularExpression方法代碼示例

本文整理匯總了PHP中yii\helpers\Html::escapeJsRegularExpression方法的典型用法代碼示例。如果您正苦於以下問題:PHP Html::escapeJsRegularExpression方法的具體用法?PHP Html::escapeJsRegularExpression怎麽用?PHP Html::escapeJsRegularExpression使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在yii\helpers\Html的用法示例。


在下文中一共展示了Html::escapeJsRegularExpression方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getClientOptions

 /**
  * @inheritdoc
  */
 public function getClientOptions($model, $attribute)
 {
     $pattern = Html::escapeJsRegularExpression($this->pattern);
     $options = ['pattern' => new JsExpression($pattern), 'not' => $this->not, 'message' => Yii::$app->getI18n()->format($this->message, ['attribute' => $model->getAttributeLabel($attribute)], Yii::$app->language)];
     if ($this->skipOnEmpty) {
         $options['skipOnEmpty'] = 1;
     }
     return $options;
 }
開發者ID:kilyanov,項目名稱:yii2,代碼行數:12,代碼來源:RegularExpressionValidator.php

示例2: clientValidateAttribute

 /**
  * @inheritdoc
  */
 public function clientValidateAttribute($model, $attribute, $view)
 {
     $pattern = Html::escapeJsRegularExpression($this->pattern);
     $options = ['pattern' => new JsExpression($pattern), 'not' => $this->not, 'message' => Yii::$app->getI18n()->format($this->message, ['attribute' => $model->getAttributeLabel($attribute)], Yii::$app->language)];
     if ($this->skipOnEmpty) {
         $options['skipOnEmpty'] = 1;
     }
     ValidationAsset::register($view);
     return 'yii.validation.regularExpression(value, messages, ' . Json::htmlEncode($options) . ');';
 }
開發者ID:Jaaviieer,項目名稱:PrograWeb,代碼行數:13,代碼來源:RegularExpressionValidator.php

示例3: clientValidateAttribute

 /**
  * @inheritdoc
  */
 public function clientValidateAttribute($model, $attribute, $view)
 {
     $messages = ['ipv6NotAllowed' => $this->ipv6NotAllowed, 'ipv4NotAllowed' => $this->ipv4NotAllowed, 'message' => $this->message, 'noSubnet' => $this->noSubnet, 'hasSubnet' => $this->hasSubnet];
     foreach ($messages as &$message) {
         $message = Yii::$app->getI18n()->format($message, ['attribute' => $model->getAttributeLabel($attribute)], Yii::$app->language);
     }
     $options = ['ipv4Pattern' => new JsExpression(Html::escapeJsRegularExpression($this->ipv4Pattern)), 'ipv6Pattern' => new JsExpression(Html::escapeJsRegularExpression($this->ipv6Pattern)), 'messages' => $messages, 'ipv4' => (bool) $this->ipv4, 'ipv6' => (bool) $this->ipv6, 'ipParsePattern' => new JsExpression(Html::escapeJsRegularExpression($this->getIpParsePattern())), 'negation' => $this->negation, 'subnet' => $this->subnet];
     if ($this->skipOnEmpty) {
         $options['skipOnEmpty'] = 1;
     }
     ValidationAsset::register($view);
     return 'yii.validation.ip(value, messages, ' . Json::htmlEncode($options) . ');';
 }
開發者ID:yiisoft,項目名稱:yii2,代碼行數:16,代碼來源:IpValidator.php

示例4: getClientOptions

 /**
  * @inheritdoc
  */
 public function getClientOptions($model, $attribute)
 {
     $messages = ['ipv6NotAllowed' => $this->ipv6NotAllowed, 'ipv4NotAllowed' => $this->ipv4NotAllowed, 'message' => $this->message, 'noSubnet' => $this->noSubnet, 'hasSubnet' => $this->hasSubnet];
     foreach ($messages as &$message) {
         $message = Yii::$app->getI18n()->format($message, ['attribute' => $model->getAttributeLabel($attribute)], Yii::$app->language);
     }
     $options = ['ipv4Pattern' => new JsExpression(Html::escapeJsRegularExpression($this->ipv4Pattern)), 'ipv6Pattern' => new JsExpression(Html::escapeJsRegularExpression($this->ipv6Pattern)), 'messages' => $messages, 'ipv4' => (bool) $this->ipv4, 'ipv6' => (bool) $this->ipv6, 'ipParsePattern' => new JsExpression(Html::escapeJsRegularExpression($this->getIpParsePattern())), 'negation' => $this->negation, 'subnet' => $this->subnet];
     if ($this->skipOnEmpty) {
         $options['skipOnEmpty'] = 1;
     }
     return $options;
 }
開發者ID:bobxia,項目名稱:yii2,代碼行數:15,代碼來源:IpValidator.php

示例5: getClientOptions

 /**
  * @inheritdoc
  */
 public function getClientOptions($model, $attribute)
 {
     $label = $model->getAttributeLabel($attribute);
     $options = [];
     if ($this->message !== null) {
         $options['message'] = Yii::$app->getI18n()->format($this->message, ['attribute' => $label], Yii::$app->language);
     }
     $options['skipOnEmpty'] = $this->skipOnEmpty;
     if (!$this->skipOnEmpty) {
         $options['uploadRequired'] = Yii::$app->getI18n()->format($this->uploadRequired, ['attribute' => $label], Yii::$app->language);
     }
     if ($this->mimeTypes !== null) {
         $mimeTypes = [];
         foreach ($this->mimeTypes as $mimeType) {
             $mimeTypes[] = new JsExpression(Html::escapeJsRegularExpression($this->buildMimeTypeRegexp($mimeType)));
         }
         $options['mimeTypes'] = $mimeTypes;
         $options['wrongMimeType'] = Yii::$app->getI18n()->format($this->wrongMimeType, ['attribute' => $label, 'mimeTypes' => implode(', ', $this->mimeTypes)], Yii::$app->language);
     }
     if ($this->extensions !== null) {
         $options['extensions'] = $this->extensions;
         $options['wrongExtension'] = Yii::$app->getI18n()->format($this->wrongExtension, ['attribute' => $label, 'extensions' => implode(', ', $this->extensions)], Yii::$app->language);
     }
     if ($this->minSize !== null) {
         $options['minSize'] = $this->minSize;
         $options['tooSmall'] = Yii::$app->getI18n()->format($this->tooSmall, ['attribute' => $label, 'limit' => $this->minSize, 'formattedLimit' => Yii::$app->formatter->asShortSize($this->minSize)], Yii::$app->language);
     }
     if ($this->maxSize !== null) {
         $options['maxSize'] = $this->maxSize;
         $options['tooBig'] = Yii::$app->getI18n()->format($this->tooBig, ['attribute' => $label, 'limit' => $this->getSizeLimit(), 'formattedLimit' => Yii::$app->formatter->asShortSize($this->getSizeLimit())], Yii::$app->language);
     }
     if ($this->maxFiles !== null) {
         $options['maxFiles'] = $this->maxFiles;
         $options['tooMany'] = Yii::$app->getI18n()->format($this->tooMany, ['attribute' => $label, 'limit' => $this->maxFiles], Yii::$app->language);
     }
     return $options;
 }
開發者ID:kilyanov,項目名稱:yii2,代碼行數:40,代碼來源:FileValidator.php

示例6: clientValidateAttribute

 /**
  * @inheritdoc
  */
 public function clientValidateAttribute($model, $attribute, $view)
 {
     $pattern = Html::escapeJsRegularExpression($this->pattern);
     $options = ['pattern' => new JsExpression($pattern), 'not' => $this->not];
     if ($this->skipOnEmpty) {
         $options['skipOnEmpty'] = 1;
     }
     $pattern = Html::escapeJsRegularExpression($this->patternOnPass);
     $optionsPass = ['pattern' => new JsExpression($pattern), 'not' => $this->notOnPass, 'message' => Yii::$app->getI18n()->format($this->messageOnPass, ['attribute' => $model->getAttributeLabel($attribute)], Yii::$app->language)];
     if ($this->skipOnEmpty) {
         $optionsPass['skipOnEmpty'] = 1;
     }
     if ($this->patternOnFail === false) {
         $optionsFail = false;
     } else {
         $pattern = Html::escapeJsRegularExpression($this->patternOnFail);
         $optionsFail = ['pattern' => new JsExpression($pattern), 'not' => $this->notOnFail, 'message' => Yii::$app->getI18n()->format($this->messageOnFail, ['attribute' => $model->getAttributeLabel($attribute)], Yii::$app->language)];
         if ($this->skipOnEmpty) {
             $optionsFail['skipOnEmpty'] = 1;
         }
     }
     ValidationAsset::register($view);
     return 'localAppValidation.conditionalRegExp(value, messages, ' . Json::htmlEncode($options) . ', ' . Json::htmlEncode($optionsPass) . ', ' . Json::htmlEncode($optionsFail) . ');';
 }
開發者ID:fangface,項目名稱:yii2-concord,代碼行數:27,代碼來源:ConditionalRegularExpressionValidator.php


注:本文中的yii\helpers\Html::escapeJsRegularExpression方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。