本文整理汇总了PHP中yii\captcha\Captcha::classname方法的典型用法代码示例。如果您正苦于以下问题:PHP Captcha::classname方法的具体用法?PHP Captcha::classname怎么用?PHP Captcha::classname使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\captcha\Captcha
的用法示例。
在下文中一共展示了Captcha::classname方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* @inheritdoc
*/
public function init()
{
/**
* @var Module $m
*/
$m = Yii::$app->getModule('user');
if (!$m->getRegistrationSetting('randomUsernames', $this->userType)) {
$this->attributes['username'] = ['type' => Form::INPUT_TEXT, 'options' => ['autocomplete' => 'new-username']];
}
if (!$m->getRegistrationSetting('randomPasswords', $this->userType)) {
$password = ['type' => Form::INPUT_PASSWORD];
if (in_array(Module::SCN_REGISTER, $m->passwordSettings['strengthMeter'])) {
$password = ['type' => Form::INPUT_WIDGET, 'widgetClass' => PasswordInput::classname(), 'options' => ['options' => ['placeholder' => Yii::t('user', 'Password'), 'autocomplete' => 'off']]];
}
$this->attributes['password'] = $password;
}
$this->attributes['email'] = ['type' => Form::INPUT_TEXT];
$captcha = ArrayHelper::getValue($m->registrationSettings, 'captcha', false);
if ($captcha !== false && is_array($captcha)) {
$this->attributes['captcha'] = ['type' => Form::INPUT_WIDGET, 'widgetClass' => Captcha::classname(), 'options' => $captcha['widget']];
}
parent::init();
unset($this->attributes['rememberMe']);
$this->leftFooter = $m->button(Module::BTN_HOME) . $m->button(Module::BTN_ALREADY_REGISTERED);
$this->rightFooter = $m->button(Module::BTN_RESET_FORM) . ' ' . $m->button(Module::BTN_REGISTER);
}
示例2: renderForm
public function renderForm()
{
if (isset($this->form) && $this->form->active) {
$model = $this->model;
$activeForm = $this->activeForm;
$fieldsHtml = FormUtil::getFieldsHtml($activeForm, $this->model, ['label' => $this->showLabel]);
echo $fieldsHtml;
if ($this->form->captcha) {
if ($this->showLabel) {
$captchaHtml = $activeForm->field($model, 'captcha')->widget(Captcha::classname(), ['options' => ['placeholder' => 'Captcha*']]);
} else {
$captchaHtml = $activeForm->field($model, 'captcha')->label(false)->widget(Captcha::classname(), ['options' => ['placeholder' => 'Captcha*']]);
}
echo $captchaHtml;
}
if (!isset($this->formActions)) {
echo "<div class='frm-actions'><input type='submit' value='Submit' /></div>";
} else {
echo $this->formActions;
}
} else {
echo "<div class='warning'>Form submission is disabled by site admin.</div>";
}
}
示例3:
$field = $form->field($model, "data[note]");
$field->template = "{input}";
echo $field->textArea(["class" => "form-control required", "placeholder" => Yii::t("app", "Notes for us / special request")]);
$model->data = $data;
?>
</div>
<?php
if ($model->captchaRequired) {
?>
<div class="well">
<div class="row">
<?php
echo $form->field($model, "captcha")->widget(Captcha::classname(), ['captchaAction' => ['/yes/order/captcha'], 'imageOptions' => ['class' => 'col-sm-4 col-xs-6', 'style' => 'margin:20px -5px 20px -5px;max-height:80px;cursor:pointer;'], 'options' => ['class' => 'col-sm-8 col-xs-6']]);
?>
</div>
</div>
<?php
}
?>
<hr>
<a onclick="$('#ordertab a[href=\'#summary\']').tab('show')" class="btn btn-warning btn-tab pull-left" ><?php
echo Yii::t("app", "Previous");
?>
</a>
<div class="form-group">
示例4:
<br>
<div class="row">
<div class="col-lg-5">
<!-- 'enableClientValidation' => true 开启表单验证,false为不开启表单验证,-->
<?php
$form = ActiveForm::begin(['id' => 'login-form', 'enableClientValidation' => true]);
?>
<?php
echo $form->field($model, 'username');
?>
<?php
echo $form->field($model, 'password')->passwordInput();
?>
<?php
echo $form->field($model, 'verifyCode')->widget(Captcha::classname(), ['template' => '{input} {image}']);
?>
<?php
echo $form->field($model, 'rememberMe')->checkbox();
?>
<div style="color:#999;margin:1em 0">
<?php
echo Html::a('忘记密码?', ['site/request-password-reset']);
?>
.
</div>
<div class="form-group">
<?php
echo Html::submitButton('登录', ['class' => 'btn btn-primary', 'name' => 'login-button']);
?>
示例5:
<?php
}
?>
<?php
echo $form->field($model, 'username')->textInput(['maxlength' => 20]);
?>
<?php
echo $form->field($model, 'email')->textInput(['maxlength' => 50]);
?>
<?php
echo $form->field($model, 'password')->passwordInput(['maxlength' => 20]);
?>
<?php
echo $form->field($model, 'password_repeat')->passwordInput(['maxlength' => 20]);
if ($model->action !== SignupForm::ACTION_AUTH_SIGNUP && intval(Yii::$app->params['settings']['captcha_enabled']) === 1) {
echo $form->field($model, 'captcha')->widget(\yii\captcha\Captcha::classname());
}
?>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-9">
<?php
echo Html::submitButton($btnLabel, ['class' => 'btn btn-primary', 'name' => 'signup-button']);
?>
</div>
</div>
<?php
ActiveForm::end();
?>
</div>
</div>
示例6:
</div>
<?php
if (Config::getInstance()->get('use_captcha')) {
if (Config::getInstance()->get('recaptcha_sitekey') !== '' && Config::getInstance()->get('recaptcha_secretkey') !== '') {
?>
<div class="form-group">
<?php
echo $form->field($model, 'captcha')->widget(Recaptcha::className(), ['clientOptions' => ['data-sitekey' => Config::getInstance()->get('recaptcha_sitekey')]]);
?>
</div>
<?php
} else {
?>
<div class="form-group">
<?php
echo $form->field($model, 'captcha')->widget(Captcha::classname(), ['captchaAction' => ['account/captcha'], 'options' => ['class' => 'form-control', 'placeholder' => Yii::t('podium/view', 'Type the CAPTCHA text'), 'data-container' => 'body', 'data-toggle' => 'popover', 'data-placement' => 'right', 'data-content' => Yii::t('podium/view', 'Type the CAPTCHA text displayed above. Click the image to generate another CAPTCHA code.'), 'data-trigger' => 'focus']]);
?>
</div>
<?php
}
}
?>
<?php
echo Html::submitButton('<span class="glyphicon glyphicon-ok-sign"></span> ' . Yii::t('podium/view', 'Register new account'), ['class' => 'btn btn-block btn-primary', 'name' => 'register-button']);
?>
<?php
ActiveForm::end();
?>
<br>
</div>
<div class="col-sm-8">
示例7:
<?php
} else {
$form = ActiveForm::begin(['id' => 'frm-contact']);
?>
<?php
echo $form->field($model, 'name')->textInput(['placeholder' => 'Name*'])->label(false);
?>
<?php
echo $form->field($model, 'email')->textInput(['placeholder' => 'Email*'])->label(false);
?>
<?php
echo $form->field($model, 'subject')->textInput(['placeholder' => 'Subject*'])->label(false);
?>
<?php
echo $form->field($model, 'message')->textArea(['placeholder' => 'Message*', 'rows' => 6])->label(false);
?>
<?php
echo $form->field($model, 'captcha')->label(false)->widget(Captcha::classname(), ['options' => ['placeholder' => 'Captcha*']]);
?>
<input type="submit" value="Send" />
<?php
ActiveForm::end();
}
?>
</div>
</div>
</section>
示例8: elseif
if ($widgetEdit = $field->widgetEdit($profile)) {
echo $widgetEdit;
} elseif ($field->range) {
echo $input->dropDownList(Profile::range($field->range));
} elseif ($field->field_type == "TEXT") {
echo $input->textarea(['rows' => 6, 'cols' => 50]);
} else {
echo $input->textInput(['size' => 60, 'maxlength' => $field->field_size ? $field->field_size : 255]);
}
}
}
?>
<?php
if (Module::doCaptcha('registration')) {
echo $form->field($model, 'captcha')->widget(\yii\captcha\Captcha::classname(), ['captchaAction' => '/site/captcha'])->hint(Module::t("Please enter the letters as they are shown in the image above.") . "<br/>" . Module::t("Letters are not case-sensitive."));
}
?>
<div class="form-group">
<?php
echo Html::submitButton(Module::t('Register'), ['class' => 'btn btn-success']);
?>
</div>
<?php
ActiveForm::end();
?>
</div>
</div><!-- form -->
示例9:
$form = ActiveForm::begin();
?>
<?php
echo $form->field($model, 'username')->textInput();
?>
<?php
echo $form->field($model, 'email')->textInput(['type' => 'email']);
?>
<?php
echo $form->field($model, 'message')->textarea(['rows' => 6]);
?>
<?php
echo $form->field($model, 'verifyCode')->widget(\yii\captcha\Captcha::classname(), ['captchaAction' => '/hotel/guest-book/captcha'])->label(false);
?>
<div class="form-group">
<?php
echo Html::submitButton('Submit', ['class' => 'btn-guest']);
?>
</div>
<?php
ActiveForm::end();
?>
</div><!-- _form -->
示例10:
?>
</h1>
<p><?php
echo Yii::t('app', 'Please fill out your email. A link to reset password will be sent there.');
?>
</p>
<div class="row">
<div class="col-lg-5">
<?php
$form = ActiveForm::begin(['id' => 'request-password-reset-form']);
?>
<?php
echo $form->field($model, 'email');
?>
<?php
echo $form->field($model, 'verificationCode')->widget(\yii\captcha\Captcha::classname(), ['template' => '{image}{input}']);
?>
<div class="form-group form-group">
<?php
echo Html::submitButton(Yii::t('app', 'Send'), ['class' => 'btn btn-primary']);
?>
</div>
<?php
ActiveForm::end();
?>
</div>
</div>
</div>
示例11:
<div class="row">
<div class="col-lg-12">
<?php
$form = ActiveForm::begin(['id' => 'login-form']);
?>
<?php
echo $form->field($model, 'username')->textInput(['autofocus' => true]);
?>
<?php
echo $form->field($model, 'password')->passwordInput();
?>
<?php
echo $form->field($model, 'captcha')->widget(\yii\captcha\Captcha::classname(), ['captchaAction' => 'site/captcha', 'imageOptions' => ['alt' => '点击换图', 'title' => '点击换图', 'style' => 'cursor:pointer']]);
?>
<div class="form-group">
<?php
echo Html::submitButton(Yii::t('app', 'Login'), ['class' => 'btn btn-primary', 'name' => 'login-button']);
?>
</div>
<?php
ActiveForm::end();
?>
</div>
</div>
</div>
示例12:
$form = ActiveForm::begin(['id' => 'contact-form', 'action' => '/reviews/']);
?>
<?php
echo $form->field($reviews, 'name')->textInput(['placeholder' => 'Введите имя']);
?>
<?php
echo $form->field($reviews, 'email')->textInput(['placeholder' => 'Введите e-mail']);
?>
<?php
echo $this->render('_reviews_form_smiles');
?>
<?php
echo $form->field($reviews, 'text')->textArea(['rows' => 6, 'placeholder' => 'Введите текст']);
?>
<?php
echo $form->field($reviews, 'verifyCode')->widget(Captcha::classname(), ['options' => ['style' => 'font-size: 24px;width: 105px;padding-left: 10px;padding-right: 10px;margin-left: 0px;height: 50px;'], 'template' => '<div class="row"><div class="col-lg-3">{image}</div><div style="margin-left: 70px;" class="col-lg-6">{input}</div></div>']);
?>
<?php
echo $form->field($reviews, 'section')->textInput(['value' => $section, 'style' => 'display: none;'])->label(false);
?>
<?php
if ($section == 'masters' || $section == 'programs') {
?>
<?php
echo $form->field($reviews, 'translate')->textInput(['value' => $translate, 'style' => 'display: none;'])->label(false);
?>
<?php
}
?>
<div class="form-group">
<?php
示例13:
echo $form->field($model, 'photo')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*']]);
?>
<?php
echo $form->field($model, 'birthday')->widget(DatePicker::classname(), ['readonly' => true]);
?>
<?php
echo $form->field($model, 'country');
?>
<?php
echo $form->field($model, 'place');
?>
<?php
echo $form->field($model, 'email');
?>
<?php
echo $form->field($model, 'verifyCode')->widget(\yii\captcha\Captcha::classname(), []);
?>
<div class="form-group">
<div class="col-lg-11">
<?php
echo Html::submitButton(\Yii::t('app', 'Зарегистрироваться'), ['class' => 'btn btn-primary', 'name' => 'login-button']);
?>
</div>
</div>
<?php
ActiveForm::end();
?>
</div>