Ejemplo n.º 1
0
 public function rules()
 {
     return [[['name', 'address'], 'required', 'on' => 'confirm'], ['email', 'required', 'when' => function ($model) {
         return $model->scenario == 'confirm' && Yii::$app->getModule('admin')->activeModules['shopcart']->settings['enableEmail'];
     }], ['phone', 'required', 'when' => function ($model) {
         return $model->scenario == 'confirm' && Yii::$app->getModule('admin')->activeModules['shopcart']->settings['enablePhone'];
     }], [['name', 'address', 'phone', 'comment'], 'trim'], ['email', 'email'], ['name', 'string', 'max' => 32], ['address', 'string', 'max' => 1024], ['phone', 'string', 'max' => 32], ['phone', 'match', 'pattern' => '/^[\\d\\s-\\+\\(\\)]+$/'], ['comment', 'string', 'max' => 1024], [['name', 'address', 'phone', 'comment'], EscapeValidator::className()]];
 }
Ejemplo n.º 2
0
 public function rules()
 {
     $required = ['name', 'text'];
     if (Yii::$app->getModule('admin')->activeModules['feedback']->settings['enableEmail']) {
         $required[] = 'email';
     }
     return [[$required, 'required'], [['name', 'email', 'phone', 'title', 'text'], 'trim'], [['name', 'title', 'text'], EscapeValidator::className()], ['title', 'string', 'max' => 128], ['email', 'email'], ['phone', 'match', 'pattern' => '/^[\\d\\s-\\+\\(\\)]+$/'], ['reCaptcha', ReCaptchaValidator::className(), 'when' => function ($model) {
         return $model->isNewRecord && Yii::$app->getModule('admin')->activeModules['feedback']->settings['enableCaptcha'];
     }]];
 }
Ejemplo n.º 3
0
 public function rules()
 {
     return [[['order_id', 'item_id'], 'required'], [['order_id', 'item_id', 'count'], 'integer', 'min' => 1], ['price', 'number', 'min' => 0.1], ['options', 'trim'], ['options', 'string', 'max' => 255], ['options', EscapeValidator::className()], ['count', 'default', 'value' => 1], ['discount', 'default', 'value' => 0]];
 }
Ejemplo n.º 4
0
 public function rules()
 {
     return [[['name'], 'required', 'message' => Yii::t('easyii', 'Enter your name')], [['text'], 'required', 'message' => Yii::t('easyii', 'Enter your message ')], [['email'], 'required', 'message' => Yii::t('easyii', 'Enter Avalid Email')], [['phone'], 'required', 'message' => Yii::t('easyii', 'Enter your Phone')], ['email', 'email', 'message' => Yii::t('easyii', 'Enter Avalid Email')], [['name', 'email', 'phone', 'title', 'text'], 'trim'], [['name', 'title', 'text'], EscapeValidator::className()], ['title', 'string', 'max' => 128], ['phone', 'number', 'message' => Yii::t('easyii', 'Phone should be number')], ['reCaptcha', ReCaptchaValidator::className(), 'when' => function ($model) {
         return $model->isNewRecord && Yii::$app->getModule('admin')->activeModules['awarness']->settings['enableCaptcha'];
     }]];
 }
Ejemplo n.º 5
0
 public function rules()
 {
     return [[['h1', 'title', 'keywords', 'description'], 'trim'], [['h1', 'title', 'keywords', 'description'], 'string', 'max' => 255], [['h1', 'title', 'keywords', 'description'], EscapeValidator::className()]];
 }
Ejemplo n.º 6
0
 public function rules()
 {
     return [[['name', 'text'], 'required'], [['name', 'title', 'text'], 'trim'], [['name', 'title', 'text'], EscapeValidator::className()], ['email', 'email'], ['title', 'string', 'max' => 128], ['reCaptcha', ReCaptchaValidator::className(), 'on' => 'send', 'when' => function () {
         return Yii::$app->getModule('admin')->activeModules['guestbook']->settings['enableCaptcha'];
     }]];
 }
Ejemplo n.º 7
0
 public function rules()
 {
     return [[['title'], 'required', 'message' => Yii::t('easyii', 'Enter Title')], [['name'], 'required', 'message' => Yii::t('easyii', 'Enter Company name')], [['text'], 'required', 'message' => Yii::t('easyii', 'Enter your message ')], [['email'], 'required', 'message' => Yii::t('easyii', 'Enter your Email')], [['phone'], 'required', 'message' => Yii::t('easyii', 'Enter your Phone')], [['name', 'email', 'phone', 'title', 'text'], 'trim'], [['name', 'title', 'text'], EscapeValidator::className()], ['title', 'string', 'max' => 128], ['email', 'email', 'message' => Yii::t('easyii', 'Enter Avalid Email')], ['phone', 'match', 'pattern' => '/^[\\d\\s-\\+\\(\\)]+$/', 'message' => Yii::t('easyii', 'Enter Avalid phone number')], ['reCaptcha', ReCaptchaValidator::className(), 'when' => function ($model) {
         return $model->isNewRecord && Yii::$app->getModule('admin')->activeModules['agencies']->settings['enableCaptcha'];
     }]];
 }
Ejemplo n.º 8
0
 public function rules()
 {
     return [[['name', 'text'], 'required'], [['name', 'email', 'phone', 'title', 'text'], 'trim'], [['name', 'title', 'text'], EscapeValidator::className()], ['title', 'string', 'max' => 128], ['email', 'email'], ['reCaptcha', ReCaptchaValidator::className(), 'when' => function ($model) {
         return $model->isNewRecord && Yii::$app->getModule('admin')->activeModules['awarness']->settings['enableCaptcha'];
     }]];
 }
Ejemplo n.º 9
0
 public function rules()
 {
     return [[['username', 'password'], 'required'], [['username', 'password'], EscapeValidator::className()], ['password', 'validatePassword']];
 }
Ejemplo n.º 10
0
 public function rules()
 {
     return [[['h1', 'title', 'keywords', 'description', 'og_title', 'og_description', 'og_image', 'og_url', 'og_sitename'], 'trim'], [['h1', 'title', 'keywords', 'description', 'og_title', 'og_description', 'og_image', 'og_url', 'og_sitename'], 'string', 'max' => 255], [['h1', 'title', 'keywords', 'description', 'og_title', 'og_description', 'og_image', 'og_url', 'og_sitename'], EscapeValidator::className()], [['_image'], 'image', 'maxSize' => \yii\easyii\models\Photo::PHOTO_MAX_FILESIZE]];
 }