mirror of
https://github.com/phpbb/phpbb.git
synced 2025-04-19 07:16:36 +02:00
[ticket/11854] Use a set_name method instead of overriding get_service_name
PHPBB3-11854
This commit is contained in:
parent
76633544ee
commit
fa2ac1f271
@ -20,18 +20,24 @@ services:
|
||||
core.captcha.plugins.gd:
|
||||
class: phpbb\captcha\plugins\gd
|
||||
scope: prototype # scope MUST be prototype for this to work!
|
||||
calls:
|
||||
- [set_name, [core.captcha.plugins.gd]]
|
||||
tags:
|
||||
- { name: captcha.plugins }
|
||||
|
||||
core.captcha.plugins.gd_wave:
|
||||
class: phpbb\captcha\plugins\gd_wave
|
||||
scope: prototype # scope MUST be prototype for this to work!
|
||||
calls:
|
||||
- [set_name, [core.captcha.plugins.gd_wave]]
|
||||
tags:
|
||||
- { name: captcha.plugins }
|
||||
|
||||
core.captcha.plugins.nogd:
|
||||
class: phpbb\captcha\plugins\nogd
|
||||
scope: prototype # scope MUST be prototype for this to work!
|
||||
calls:
|
||||
- [set_name, [core.captcha.plugins.nogd]]
|
||||
tags:
|
||||
- { name: captcha.plugins }
|
||||
|
||||
@ -42,11 +48,15 @@ services:
|
||||
- %tables.captcha_qa_questions%
|
||||
- %tables.captcha_qa_answers%
|
||||
- %tables.captcha_qa_confirm%
|
||||
calls:
|
||||
- [set_name, [core.captcha.plugins.qa]]
|
||||
tags:
|
||||
- { name: captcha.plugins }
|
||||
|
||||
core.captcha.plugins.recaptcha:
|
||||
class: phpbb\captcha\plugins\recaptcha
|
||||
scope: prototype # scope MUST be prototype for this to work!
|
||||
calls:
|
||||
- [set_name, [core.captcha.plugins.recaptcha]]
|
||||
tags:
|
||||
- { name: captcha.plugins }
|
||||
|
@ -27,6 +27,11 @@ abstract class captcha_abstract
|
||||
var $solved = 0;
|
||||
var $captcha_vars = false;
|
||||
|
||||
/**
|
||||
* @var string name of the service.
|
||||
*/
|
||||
protected $service_name;
|
||||
|
||||
function init($type)
|
||||
{
|
||||
global $config, $db, $user;
|
||||
@ -363,7 +368,20 @@ abstract class captcha_abstract
|
||||
/**
|
||||
* @return string the name of the service corresponding to the plugin
|
||||
*/
|
||||
abstract function get_service_name();
|
||||
function get_service_name()
|
||||
{
|
||||
return $this->service_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name of the plugin
|
||||
*
|
||||
* @param string $name
|
||||
*/
|
||||
public function set_name($name)
|
||||
{
|
||||
$this->service_name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the name of the class used to generate the captcha
|
||||
|
@ -30,14 +30,6 @@ class gd extends captcha_abstract
|
||||
return @extension_loaded('gd');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the name of the service corresponding to the plugin
|
||||
*/
|
||||
function get_service_name()
|
||||
{
|
||||
return 'core.captcha.plugins.gd';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the name of the class used to generate the captcha
|
||||
*/
|
||||
|
@ -25,14 +25,6 @@ class gd_wave extends captcha_abstract
|
||||
return 'CAPTCHA_GD_3D';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the name of the service corresponding to the plugin
|
||||
*/
|
||||
function get_service_name()
|
||||
{
|
||||
return 'core.captcha.plugins.gd_wave';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the name of the class used to generate the captcha
|
||||
*/
|
||||
|
@ -34,6 +34,11 @@ class qa
|
||||
protected $table_captcha_answers;
|
||||
protected $table_qa_confirm;
|
||||
|
||||
/**
|
||||
* @var string name of the service.
|
||||
*/
|
||||
protected $service_name;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -157,11 +162,21 @@ class qa
|
||||
}
|
||||
|
||||
/**
|
||||
* API function
|
||||
* @return string the name of the service corresponding to the plugin
|
||||
*/
|
||||
function get_service_name()
|
||||
{
|
||||
return 'core.captcha.plugins.qa';
|
||||
return $this->service_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name of the plugin
|
||||
*
|
||||
* @param string $name
|
||||
*/
|
||||
public function set_name($name)
|
||||
{
|
||||
$this->service_name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -63,14 +63,6 @@ class recaptcha extends \phpbb\captcha\plugins\captcha_abstract
|
||||
return 'CAPTCHA_RECAPTCHA';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the name of the service corresponding to the plugin
|
||||
*/
|
||||
function get_service_name()
|
||||
{
|
||||
return 'core.captcha.plugins.recaptcha';
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is implemented because required by the upper class, but is never used for reCaptcha.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user