Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • Net
  • None
  • PHP
  • system
    • base
    • caching
      • dependencies
    • collections
    • console
    • db
      • ar
      • schema
        • cubrid
        • mssql
        • mysql
        • oci
        • pgsql
        • sqlite
    • i18n
      • gettext
    • logging
    • test
    • utils
    • validators
    • web
      • actions
      • auth
      • filters
      • form
      • helpers
      • renderers
      • services
      • widgets
        • captcha
        • pagers
  • Text
    • Highlighter
  • zii
    • behaviors
    • widgets
      • grid
      • jui

Classes

  • CCaptcha
  • CCaptchaAction
  • MobileCaptcha
  • Overview
  • Package
  • Class
  • Tree

Class CCaptcha

CCaptcha renders a CAPTCHA image element.

CCaptcha is used together with CCaptchaAction to provide CAPTCHA

  • a way of preventing site spam.

The image element rendered by CCaptcha will display a CAPTCHA image generated by an action of class CCaptchaAction belonging to the current controller. By default, the action ID should be 'captcha', which can be changed by setting CCaptcha::$captchaAction.

CCaptcha may also render a button next to the CAPTCHA image. Clicking on the button will change the CAPTCHA image to be a new one in an AJAX way.

If CCaptcha::$clickableImage is set true, clicking on the CAPTCHA image will refresh the CAPTCHA.

A CCaptchaValidator may be used to validate that the user enters a verification code matching the code displayed in the CAPTCHA image.

When combining CCaptcha with CActiveForm or CForm, make sure ajaxValidation is disabled. Performing ajax validation causes your Captcha to be refreshed, rendering the code invalid on the next validation attempt.

CComponent
Extended by CBaseController
Extended by CWidget
Extended by CCaptcha

Direct known subclasses

MobileCaptcha
Package: system\web\widgets\captcha
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/web/widgets/captcha/CCaptcha.php
Methods summary
public
# run( )

Renders the widget.

Renders the widget.

Overrides

CWidget::run()
protected
# renderImage( )

Renders the CAPTCHA image.

Renders the CAPTCHA image.

public
# registerClientScript( )

Registers the needed client scripts.

Registers the needed client scripts.

public static boolean
# checkRequirements( string $extension = null )

Checks if specified graphic extension support is loaded.

Checks if specified graphic extension support is loaded.

Parameters

$extension
string
$extension name to be checked. Possible values are 'gd', 'imagick' and null. Default value is null meaning that both extensions will be checked. This parameter is available since 1.1.13.

Returns

boolean
true if ImageMagick extension with PNG support or GD with FreeType support is loaded, otherwise false

Since

1.1.5
Methods inherited from CWidget
__construct(), actions(), getController(), getId(), getOwner(), getViewFile(), getViewPath(), init(), render(), setId()
Methods inherited from CBaseController
beginCache(), beginClip(), beginContent(), beginWidget(), createWidget(), endCache(), endClip(), endContent(), endWidget(), renderFile(), renderInternal(), widget()
Methods inherited from CComponent
__call(), __get(), __isset(), __set(), __unset(), asa(), attachBehavior(), attachBehaviors(), attachEventHandler(), canGetProperty(), canSetProperty(), detachBehavior(), detachBehaviors(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), getEventHandlers(), hasEvent(), hasEventHandler(), hasProperty(), raiseEvent()
Properties summary
public string $captchaAction 'captcha'
#

the ID of the action that should provide CAPTCHA image. Defaults to 'captcha', meaning the 'captcha' action of the current controller. This property may also be in the format of 'ControllerID/ActionID'. Underneath, this property is used by CController::createUrl() to create the URL that would serve the CAPTCHA image. The action has to be of CCaptchaAction.

the ID of the action that should provide CAPTCHA image. Defaults to 'captcha', meaning the 'captcha' action of the current controller. This property may also be in the format of 'ControllerID/ActionID'. Underneath, this property is used by CController::createUrl() to create the URL that would serve the CAPTCHA image. The action has to be of CCaptchaAction.

public boolean $showRefreshButton true
#

whether to display a button next to the CAPTCHA image. Clicking on the button will cause the CAPTCHA image to be changed to a new one. Defaults to true.

whether to display a button next to the CAPTCHA image. Clicking on the button will cause the CAPTCHA image to be changed to a new one. Defaults to true.

public boolean $clickableImage false
#

whether to allow clicking on the CAPTCHA image to refresh the CAPTCHA letters. Defaults to false. Hint: you may want to set CCaptcha::$showRefreshButton to false if you set this property to be true because they serve for the same purpose. To enhance accessibility, you may set CCaptcha::$imageOptions to provide hints to end-users that the image is clickable.

whether to allow clicking on the CAPTCHA image to refresh the CAPTCHA letters. Defaults to false. Hint: you may want to set CCaptcha::$showRefreshButton to false if you set this property to be true because they serve for the same purpose. To enhance accessibility, you may set CCaptcha::$imageOptions to provide hints to end-users that the image is clickable.

public string $buttonLabel
#

the label for the refresh button. Defaults to 'Get a new code'.

the label for the refresh button. Defaults to 'Get a new code'.

public string $buttonType 'link'
#

the type of the refresh button. This should be either 'link' or 'button'. The former refers to hyperlink button while the latter a normal push button. Defaults to 'link'.

the type of the refresh button. This should be either 'link' or 'button'. The former refers to hyperlink button while the latter a normal push button. Defaults to 'link'.

public array $imageOptions array()
#

HTML attributes to be applied to the rendered image element.

HTML attributes to be applied to the rendered image element.

public array $buttonOptions array()
#

HTML attributes to be applied to the rendered refresh button element.

HTML attributes to be applied to the rendered refresh button element.

Properties inherited from CWidget
$actionPrefix, $skin
Magic properties inherited from CWidget
$controller, $id, $owner, $viewPath
API documentation generated by ApiGen 2.8.0