29 if(function_exists(
'imageftbbox'))
42 public static function __callStatic($name, array $arguments = array())
45 strpos($name,
'isActiveFor') === 0 ||
46 strpos($name,
'setActiveFor') === 0
51 $method_parts = explode(
'_', strtolower(preg_replace(
'/([a-z])([A-Z])/',
'$1_$2', $name)));
52 $requested_context = strtolower($method_parts[count($method_parts) - 1]);
53 if(!isset($requested_context, self::$context_map))
55 throw new BadMethodCallException(
'Method ' . $name .
' called for a non existing context.');
58 if(
'set' == $method_parts[0])
60 $settings->set(
'activate_captcha_anonym_' . $supported_contexts[$requested_context], (
int)$arguments[0]);
65 return self::checkFreetype() && (bool)$settings->get(
'activate_captcha_anonym_' . $supported_contexts[$requested_context],
false);
70 throw new BadMethodCallException(
'Call to an undefined static method ' . $name .
' in class ' . __CLASS__ .
'.');
77 public static function getPreconditionsMessage()
84 $lng->loadLanguageModule(
'cptch');
85 return "<a target='_blank' href='http://php.net/manual/en/image.installation.php'>" . $lng->txt(
'cptch_freetype_support_needed') .
"</a>";
93 if(null !== self::$context_map)
98 self::$context_map = array();
100 $r =
new ReflectionClass(
new self());
101 $constants = $r->getConstants();
102 foreach($constants as $name => $value)
104 if(strpos($name,
'CONTEXT_') === 0)
106 self::$context_map[strtolower(substr($name, strlen(
'CONTEXT_')))] = $value;