本文整理汇总了PHP中YumUser::rules方法的典型用法代码示例。如果您正苦于以下问题:PHP YumUser::rules方法的具体用法?PHP YumUser::rules怎么用?PHP YumUser::rules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类YumUser
的用法示例。
在下文中一共展示了YumUser::rules方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rules
public function rules()
{
$rules = parent::rules();
/* FIXME: As soon as i grasp how i can dynamically add variables to a
class in PHP, i will enable this code snippet for flexibility:
$profile = new YumProfile;
$profile_rules = $profile->rules();
foreach($profile_rules as $rule)
if(isset($rule[0]) && is_string($rule[0]))
$this->${$rule[0]} = '';
$rules = array_merge($rules, $profile->rules()); */
$rules[] = array('username', 'required');
$rules[] = array('password, verifyPassword', 'required');
$rules[] = array('password', 'compare',
'compareAttribute'=>'verifyPassword',
'message' => Yum::t("Retype password is incorrect."));
if(Yum::module('registration')->enableCaptcha)
$rules[] = array('verifyCode', 'captcha',
'allowEmpty'=>CCaptcha::checkRequirements());
return $rules;
}
示例2: rules
public function rules()
{
$rules = parent::rules();
if (!(Yum::hasModule('registration') && Yum::module('registration')->registration_by_email)) {
$rules[] = array('username', 'required');
}
$rules[] = array('newsletter, terms,type_id', 'safe');
// password requirement is already checked in YumUser model, its sufficient
// to check for verifyPassword here
$rules[] = array('verifyPassword', 'required');
$rules[] = array('password', 'compare', 'compareAttribute' => 'verifyPassword', 'message' => Yum::t("Retype password is incorrect."));
if (Yum::module('registration')->enableCaptcha && !Yum::module()->debug) {
$rules[] = array('verifyCode', 'captcha', 'allowEmpty' => CCaptcha::checkRequirements());
}
return $rules;
}