当前位置: 首页>>代码示例>>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;未经允许,请勿转载。