当前位置: 首页>>代码示例>>PHP>>正文


PHP captcha::render方法代码示例

本文整理汇总了PHP中captcha::render方法的典型用法代码示例。如果您正苦于以下问题:PHP captcha::render方法的具体用法?PHP captcha::render怎么用?PHP captcha::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在captcha的用法示例。


在下文中一共展示了captcha::render方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render

 /**
  * Renders a participation form. This form is ready to be echo'ed in your template
  */
 function render()
 {
     global $thinkedit;
     // add content
     $this->form->add('<h1>');
     $this->form->add($this->title);
     $this->form->add('</h1>');
     // In all cases, build form UI
     foreach ($this->content->field as $field) {
         if ($field->isUsedIn('participation') && $field->getType() != 'id') {
             $this->form->add('<div class="participation_field">');
             $this->form->add('<div class="participation_field_title">');
             if ($field->isRequired() || $field->isTitle()) {
                 $this->form->add('<span class="participation_field_required">*</span>');
             }
             $this->form->add($field->getTitle() . ' : ');
             $this->form->add('</div>');
             if ($field->getHelp()) {
                 $this->form->add('<div class="participation_field_help">');
                 $this->form->add($field->getHelp());
                 $this->form->add('</div>');
             }
             if ($this->form->isSent() && $field->getErrorMessage()) {
                 $this->form->add('<div class="participation_field_error">');
                 $this->form->add($field->getErrorMessage());
                 $this->form->add('</div>');
             }
             $this->form->add('<div class="participation_field_ui">');
             $this->form->add($field->renderUi());
             $this->form->add('</div>');
             $this->form->add('</div>');
         }
     }
     // add captcha if needed
     if ($this->enable_captcha) {
         require_once ROOT . '/class/captcha.class.php';
         $captcha = new captcha();
         $this->form->add('<div class="participation_field">');
         $this->form->add('<div class="participation_field_title">');
         $this->form->add('<span class="participation_field_required">*</span>');
         $this->form->add($this->captcha_title);
         $this->form->add('</div>');
         $this->form->add('<div class="participation_field_help">');
         $this->form->add($this->captcha_help);
         $this->form->add('</div>');
         if ($this->form->isSent()) {
             if (isset($_REQUEST['captcha']) && $_REQUEST['captcha'] != $captcha->get()) {
                 $this->form->add('<div class="participation_field_error">');
                 $this->form->add($this->captcha_error);
                 $this->form->add('</div>');
                 $captcha->reset();
             }
         }
         if (isset($_REQUEST['captcha'])) {
             $captcha_entered = $_REQUEST['captcha'];
         } else {
             $captcha_entered = '';
         }
         $this->form->add('<div class="participation_field_ui">');
         $this->form->add('<br/>');
         $this->form->add('<img src="' . $captcha->render() . '">');
         $this->form->add('<br/> <br/>');
         $this->form->add('Code : <input type="text" name="captcha" value="' . $captcha_entered . '">');
         $this->form->add('</div>');
         $this->form->add('</div>');
     }
     return $this->form->render();
 }
开发者ID:philippejadin,项目名称:thinkedit,代码行数:71,代码来源:participation.class.php


注:本文中的captcha::render方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。