本文整理汇总了PHP中sfValidatorBase::setDefaultMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP sfValidatorBase::setDefaultMessage方法的具体用法?PHP sfValidatorBase::setDefaultMessage怎么用?PHP sfValidatorBase::setDefaultMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfValidatorBase
的用法示例。
在下文中一共展示了sfValidatorBase::setDefaultMessage方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configure
public function configure()
{
sfValidatorBase::setDefaultMessage('required', __('GENERAL_REQUIRED_FIELD_ERROR'));
sfValidatorBase::setDefaultMessage('min_length', sprintf(__('GENERAL_FIELD_TOO_SHORT_ERROR'), '"%value%"', '%min_length%'));
$items = PcTimezonePeer::doSelect(new Criteria());
$tzs = array();
foreach ($items as $item) {
$tzs[$item->getLabel()] = $item->getDescription();
}
$this->setWidgets(array('email' => new sfWidgetFormInputText(), 'password1' => new sfWidgetFormInputPassword(), 'password2' => new sfWidgetFormInputPassword(), 'lang' => new sfWidgetFormInputHidden(), 'tz' => new sfWidgetFormInputHidden(array('default' => self::TIMEZONE_DEFAULT_VALUE)), 'dst_on' => new sfWidgetFormInputHidden(array('default' => 0))));
$this->setValidators(array('password1' => new sfValidatorString(array('max_length' => sfConfig::get('app_password_maxLength'), 'min_length' => sfConfig::get('app_password_minLength'))), 'password2' => new sfValidatorString(array('max_length' => sfConfig::get('app_password_maxLength'), 'min_length' => sfConfig::get('app_password_minLength'))), 'tz' => new sfValidatorString(), 'lang' => new sfValidatorString(array('max_length' => 8, 'required' => false)), 'dst_on' => new sfValidatorString(array('max_length' => 1))));
$emailDomainsBlacklistedInRegistration = sfConfig::get('app_site_emailDomainsBlacklistedInRegistration');
foreach ($emailDomainsBlacklistedInRegistration as $k => $v) {
$emailDomainsBlacklistedInRegistration[$k] = str_replace('.', '\\.', $v);
}
$emailDomainsBlacklistedInRegistration = implode('|', $emailDomainsBlacklistedInRegistration);
$this->validatorSchema['email'] = new sfValidatorAnd(array(new sfValidatorEmail(array('required' => true, 'max_length' => sfConfig::get('app_email_maxLength'), 'min_length' => sfConfig::get('app_email_minLength'))), new sfValidatorRegex(array('pattern' => '/@(' . $emailDomainsBlacklistedInRegistration . ')(\\b|$)/si', 'must_match' => false), array('invalid' => 'Domain blocked - please use another email'))), array(), array());
$this->mergePostValidator(new sfValidatorSchemaCompare('password1', '==', 'password2', array(), array('invalid' => __('WEBSITE_REGISTRATION_PASSWORD_MISMATCH_ERROR'))));
$this->mergePostValidator(new sfValidatorDetectingSpammersOnRegistration(null, array(), array('invalid' => __('WEBSITE_REGISTRATION_PASSWORD_MISMATCH_ERROR'))));
$this->widgetSchema->setLabels(array('email' => __('WEBSITE_REGISTRATION_EMAIL_ADDRESS_LABEL'), 'password1' => __('WEBSITE_REGISTRATION_CHOOSE_PASSWORD_LABEL'), 'password2' => __('WEBSITE_REGISTRATION_REPEAT_PASSWORD_LABEL')));
$this->widgetSchema->setNameFormat('registration[%s]');
// {{{ START: anti-spam (see sfValidatorTimerAntiSpam class)
$this->widgetSchema['asdf'] = new sfWidgetFormInputHidden(array(), array('value' => base64_encode(time())));
$this->validatorSchema['asdf'] = new sfValidatorTimerAntiSpam();
// }}} STOP: anti-spam
}
示例2: configure
public function configure()
{
sfValidatorBase::setDefaultMessage('required', __('GENERAL_REQUIRED_FIELD_ERROR'));
sfValidatorBase::setDefaultMessage('min_length', sprintf(__('GENERAL_FIELD_TOO_SHORT_ERROR'), '"%value%"', '%min_length%'));
$this->setWidgets(array('email' => new sfWidgetFormInput(), 'return-url' => new sfWidgetFormInputHidden(), 'password' => new sfWidgetFormInputPassword(), 'rememberme' => new sfWidgetFormInputCheckbox(array())));
$this->setValidators(array('email' => new sfValidatorEmail(array('required' => true, 'max_length' => sfConfig::get('app_email_maxLength'), 'min_length' => sfConfig::get('app_email_minLength')), array('invalid' => __('WEBSITE_LOGIN_EMAIL_ERROR'))), 'password' => new sfValidatorString(array('max_length' => sfConfig::get('app_password_maxLength'), 'min_length' => sfConfig::get('app_password_minLength'))), 'rememberme' => new sfValidatorBoolean(array('required' => false)), 'return-url' => new sfValidatorString(array('required' => false))));
$this->widgetSchema->setLabels(array('email' => __('WEBSITE_LOGIN_EMAIL_LABEL'), 'password' => __('WEBSITE_LOGIN_PASSWORD_LABEL'), 'rememberme' => __('WEBSITE_LOGIN_REMEMBER_ME_LABEL')));
$this->widgetSchema->setNameFormat('login[%s]');
}
示例3: configure
public function configure()
{
sfValidatorBase::setDefaultMessage('required', __('GENERAL_REQUIRED_FIELD_ERROR'));
sfValidatorBase::setDefaultMessage('min_length', sprintf(__('GENERAL_FIELD_TOO_SHORT_ERROR'), '"%value%"', '%min_length%'));
$this->setWidgets(array('username' => new sfWidgetFormInputText(), 'return-url' => new sfWidgetFormInputHidden()));
$this->setValidators(array('username' => new sfValidatorString(array('required' => true, 'max_length' => sfConfig::get('app_username_maxLength'), 'min_length' => sfConfig::get('app_username_minLength'))), 'return-url' => new sfValidatorString(array('required' => false))));
$this->widgetSchema->setLabels(array('username' => __('WEBSITE_FORUM_USERNAME_USERNAME_LABEL')));
$this->widgetSchema->setNameFormat('chooseUsername[%s]');
}
示例4: configure
public function configure()
{
sfValidatorBase::setDefaultMessage('required', __('GENERAL_REQUIRED_FIELD_ERROR'));
sfValidatorBase::setDefaultMessage('min_length', sprintf(__('GENERAL_FIELD_TOO_SHORT_ERROR'), '"%value%"', '%min_length%'));
$this->setWidgets(array('email' => new sfWidgetFormInput()));
$this->setValidators(array('email' => new sfValidatorEmail(array('required' => true), array('invalid' => __('WEBSITE_FORGOTTEN_PSW_EMAIL_ERROR')))));
$this->widgetSchema->setLabels(array('email' => __('WEBSITE_FORGOTTEN_PSW_EMAIL_LABEL')));
$this->widgetSchema->setNameFormat('passwordForgotten[%s]');
}
示例5: setup
public function setup()
{
sfConfig::set('linguagens', array('csharp' => 'C#', 'css' => 'CSS', 'gettext' => 'Gettext', 'groovy' => 'Groovy', 'haskell' => 'Haskell', 'html4strict' => 'HTML', 'java' => 'Java', 'java5' => 'Java 5', 'javascript' => 'JavaScript', 'jquery' => 'jQuery', 'mirc' => 'mIRC', 'mysql' => 'MySQL', 'objc' => 'Objective C', 'php' => 'PHP', 'plsql' => 'PL/SQL', 'properties' => 'Properties', 'python' => 'Python', 'rails' => 'Rails', 'ruby' => 'Ruby', 'scala' => 'Scala', 'sql' => 'SQL', 'text' => 'Texto puro', 'xml' => 'XML'));
sfValidatorBase::setDefaultMessage('required', 'Campo obrigatório');
sfValidatorBase::setDefaultMessage('invalid', 'Campo inválido');
$this->enablePlugins('sfDoctrinePlugin');
$this->enablePlugins('sfGeshiPlugin');
$this->enablePlugins('sfDoctrineActAsTaggablePlugin');
}
示例6: configure
public function configure()
{
sfValidatorBase::setDefaultMessage('required', __('GENERAL_REQUIRED_FIELD_ERROR'));
sfValidatorBase::setDefaultMessage('min_length', sprintf(__('GENERAL_FIELD_TOO_SHORT_ERROR'), '"%value%"', '%min_length%'));
$this->setWidgets(array('email1' => new sfWidgetFormInputText(), 'email2' => new sfWidgetFormInputText()));
$this->setValidators(array('email1' => new sfValidatorEmail(array('required' => true, 'max_length' => sfConfig::get('app_email_maxLength'), 'min_length' => sfConfig::get('app_email_minLength')), array('invalid' => __('ACCOUNT_SETTINGS_INVALID_EMAIL_ERROR'))), 'email2' => new sfValidatorEmail(array('required' => true, 'max_length' => sfConfig::get('app_email_maxLength'), 'min_length' => sfConfig::get('app_email_minLength')), array('invalid' => __('ACCOUNT_SETTINGS_INVALID_EMAIL_ERROR')))));
$this->mergePostValidator(new sfValidatorSchemaCompare('email1', '==', 'email2', array(), array('invalid' => __('ACCOUNT_SETTINGS_EMAILS_DONT_MATCH_ERROR'))));
$this->widgetSchema->setLabels(array('email1' => __('ACCOUNT_SETTINGS_EMAIL'), 'email2' => __('ACCOUNT_SETTINGS_REPEAT_EMAIL')));
$this->widgetSchema->setNameFormat('email[%s]');
}
示例7: configure
public function configure()
{
sfValidatorBase::setDefaultMessage('required', __('GENERAL_REQUIRED_FIELD_ERROR'));
sfValidatorBase::setDefaultMessage('min_length', sprintf(__('GENERAL_FIELD_TOO_SHORT_ERROR'), '"%value%"', '%min_length%'));
$this->setWidgets(array('password1' => new sfWidgetFormInputPassword(), 'password2' => new sfWidgetFormInputPassword()));
$this->setValidators(array('password1' => new sfValidatorString(array('max_length' => sfConfig::get('app_password_maxLength'), 'min_length' => sfConfig::get('app_password_minLength'))), 'password2' => new sfValidatorString(array('max_length' => sfConfig::get('app_password_maxLength'), 'min_length' => sfConfig::get('app_password_minLength')))));
$this->mergePostValidator(new sfValidatorSchemaCompare('password1', '==', 'password2', array(), array('invalid' => __('ACCOUNT_SETTINGS_PASSWORDS_DONT_MATCH_ERROR'))));
$this->widgetSchema->setLabels(array('password1' => __('ACCOUNT_SETTINGS_PASSWORD'), 'password2' => __('ACCOUNT_SETTINGS_REPEAT_PASSWORD')));
$this->widgetSchema->setNameFormat('password[%s]');
}
示例8: setup
public function setup()
{
$this->enablePlugins('sfDoctrinePlugin');
//provisorio
sfValidatorBase::setDefaultMessage('required', 'Campo obrigatório');
sfValidatorBase::setDefaultMessage('invalid', 'Campo inválido');
$this->enablePlugins('doAuthPlugin');
$this->enablePlugins('sfCKEditorPlugin');
$this->enablePlugins('sfFormExtraPlugin');
}
示例9: setup
public function setup()
{
$this->setWebDir($this->getRootDir());
$this->enablePlugins('sfDoctrinePlugin');
$this->enablePlugins('tsUploadPlugin');
sfValidatorBase::setDefaultMessage('required', 'Не должно быть пустым');
sfValidatorBase::setDefaultMessage('invalid', 'Введите корректное значение');
$this->enablePlugins('sfJqueryReloadedPlugin');
$this->enablePlugins('sfAdminDashPlugin');
$this->enablePlugins('sfCKEditorPlugin');
}
示例10: configure
public function configure()
{
sfValidatorBase::setDefaultMessage('required', __('GENERAL_REQUIRED_FIELD_ERROR'));
sfValidatorBase::setDefaultMessage('min_length', sprintf(__('GENERAL_FIELD_TOO_SHORT_ERROR'), '"%value%"', '%min_length%'));
$this->setWidgets(array('file' => new sfWidgetFormInputFile()));
$this->widgetSchema->setNameFormat('avatar[%s]');
$this->setValidators(array('file' => new sfValidatorFile()));
$validMimeTypes = array('image/jpeg', 'image/pjpeg', 'image/png', 'image/x-png', 'image/gif');
$this->validatorSchema['file']->setOption('mime_types', $validMimeTypes);
$this->validatorSchema['file']->setOption('max_size', sfConfig::get('app_avatar_maxSize'));
$messages = array('invalid' => 'Invalid file.', 'required' => 'Select a file to upload.', 'max_size' => 'The file can\'t be bigger than ' . sfConfig::get('app_avatar_maxSize') / 1000000 . 'MB', 'mime_types' => 'The file must be of JPEG, PNG , GIF format.');
$this->validatorSchema['file']->setMessages($messages);
}
示例11: configure
public function configure()
{
sfValidatorBase::setDefaultMessage('required', __('GENERAL_REQUIRED_FIELD_ERROR'));
sfValidatorBase::setDefaultMessage('min_length', sprintf(__('GENERAL_FIELD_TOO_SHORT_ERROR'), '"%value%"', '%min_length%'));
$this->setWidgets(array('file' => new sfWidgetFormInputFile()));
$this->widgetSchema->setNameFormat('import[%s]');
$this->setValidators(array('file' => new sfValidatorFile(array('required' => true))));
$validMimeTypes = array('application/xml');
$this->validatorSchema['file']->setOption('mime_types', $validMimeTypes);
$this->validatorSchema['file']->setOption('max_size', 4000000);
$messages = array('invalid' => 'Invalid file.', 'max_size' => 'The file can\'t be bigger than 4 MB', 'mime_types' => 'The file must be of XML format.');
$this->validatorSchema['file']->setMessages($messages);
$this->widgetSchema->setLabels(array('file' => 'File:'));
$this->widgetSchema->setNameFormat('import[%s]');
}
示例12: configure
public function configure()
{
sfValidatorBase::setDefaultMessage('required', 'Este campo é obrigatório.');
sfValidatorBase::setDefaultMessage('invalid', 'O valor informado é inválido.');
sfValidatorBase::setDefaultMessage('max_length', '"%value%" é muito grande (insira no máximo %max_length% caracteres).');
}