ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCaptchaUtil Class Reference

Captcha util. More...

+ Collaboration diagram for ilCaptchaUtil:

Static Public Member Functions

static checkFreetype ()
 Check whether captcha support is active.
static __callStatic ($name, array $arguments=array())

Data Fields

const CONTEXT_FORUM = 'frm'
const CONTEXT_LOGIN = 'auth'
const CONTEXT_REGISTRATION = 'reg'
const CONTEXT_WIKI = 'wiki'

Static Protected Attributes

static $context_map

Static Private Member Functions

static getSupportedContexts ()

Detailed Description

Captcha util.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

Definition at line 11 of file class.ilCaptchaUtil.php.

Member Function Documentation

static ilCaptchaUtil::__callStatic (   $name,
array  $arguments = array() 
)
static
Parameters
string$name
array$arguments
Returns
bool
Exceptions
BadMethodCallException

Definition at line 42 of file class.ilCaptchaUtil.php.

References checkFreetype(), and getSupportedContexts().

{
if(
strpos($name, 'isActiveFor') === 0 ||
strpos($name, 'setActiveFor') === 0
)
{
$settings = new ilSetting('cptch');
$supported_contexts = self::getSupportedContexts();
$method_parts = explode('_', strtolower(preg_replace('/([a-z])([A-Z])/', '$1_$2', $name)));
$requested_context = strtolower($method_parts[count($method_parts) - 1]);
if(!isset($requested_context, self::$context_map))
{
throw new BadMethodCallException('Method ' . $name . ' called for a non existing context.');
}
if('set' == $method_parts[0])
{
$settings->set('activate_captcha_anonym_' . $supported_contexts[$requested_context], (int)$arguments[0]);
return;
}
else
{
return self::checkFreetype() && (bool)$settings->get('activate_captcha_anonym_' . $supported_contexts[$requested_context], false);
}
}
else
{
throw new BadMethodCallException('Call to an undefined static method ' . $name . ' in class ' . __CLASS__ . '.');
}
}

+ Here is the call graph for this function:

static ilCaptchaUtil::checkFreetype ( )
static

Check whether captcha support is active.

Returns
bool

Definition at line 27 of file class.ilCaptchaUtil.php.

Referenced by __callStatic(), ilObjForumAdministrationGUI\getSettingsForm(), ilObjAuthSettingsGUI\initAuthModeDetermination(), ilRegistrationSettingsGUI\initForm(), and ilObjWikiSettingsGUI\initForm().

{
if(function_exists('imageftbbox'))
{
return true;
}
return false;
}

+ Here is the caller graph for this function:

static ilCaptchaUtil::getSupportedContexts ( )
staticprivate
Returns
array

Definition at line 91 of file class.ilCaptchaUtil.php.

References $context_map.

Referenced by __callStatic().

{
if(null !== self::$context_map)
{
}
self::$context_map = array();
$r = new ReflectionClass(new self());
$constants = $r->getConstants();
foreach($constants as $name => $value)
{
if(strpos($name, 'CONTEXT_') === 0)
{
self::$context_map[strtolower(substr($name, strlen('CONTEXT_')))] = $value;
}
}
}

+ Here is the caller graph for this function:

Field Documentation

ilCaptchaUtil::$context_map
staticprotected

Definition at line 21 of file class.ilCaptchaUtil.php.

Referenced by getSupportedContexts().

const ilCaptchaUtil::CONTEXT_FORUM = 'frm'

Definition at line 13 of file class.ilCaptchaUtil.php.

const ilCaptchaUtil::CONTEXT_LOGIN = 'auth'

Definition at line 14 of file class.ilCaptchaUtil.php.

const ilCaptchaUtil::CONTEXT_REGISTRATION = 'reg'

Definition at line 15 of file class.ilCaptchaUtil.php.

const ilCaptchaUtil::CONTEXT_WIKI = 'wiki'

Definition at line 16 of file class.ilCaptchaUtil.php.


The documentation for this class was generated from the following file: