aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Darricau <github@nicofuma.fr>2014-08-10 15:10:14 +0200
committerTristan Darricau <github@nicofuma.fr>2014-08-11 01:16:58 +0200
commitfa2ac1f27126292a24aa33136b2d3a7f1832ea47 (patch)
tree2a40bf7908771f6d889718753c25f5b39c252873
parent76633544ee6084e61641ec423cd0480bb4b771c5 (diff)
downloadforums-fa2ac1f27126292a24aa33136b2d3a7f1832ea47.tar
forums-fa2ac1f27126292a24aa33136b2d3a7f1832ea47.tar.gz
forums-fa2ac1f27126292a24aa33136b2d3a7f1832ea47.tar.bz2
forums-fa2ac1f27126292a24aa33136b2d3a7f1832ea47.tar.xz
forums-fa2ac1f27126292a24aa33136b2d3a7f1832ea47.zip
[ticket/11854] Use a set_name method instead of overriding get_service_name
PHPBB3-11854
-rw-r--r--phpBB/config/captcha.yml10
-rw-r--r--phpBB/phpbb/captcha/plugins/captcha_abstract.php20
-rw-r--r--phpBB/phpbb/captcha/plugins/gd.php8
-rw-r--r--phpBB/phpbb/captcha/plugins/gd_wave.php8
-rw-r--r--phpBB/phpbb/captcha/plugins/qa.php19
-rw-r--r--phpBB/phpbb/captcha/plugins/recaptcha.php8
6 files changed, 46 insertions, 27 deletions
diff --git a/phpBB/config/captcha.yml b/phpBB/config/captcha.yml
index 15d6a4ce3d..bca37767af 100644
--- a/phpBB/config/captcha.yml
+++ b/phpBB/config/captcha.yml
@@ -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 }
diff --git a/phpBB/phpbb/captcha/plugins/captcha_abstract.php b/phpBB/phpbb/captcha/plugins/captcha_abstract.php
index 982798e464..24ed7f939d 100644
--- a/phpBB/phpbb/captcha/plugins/captcha_abstract.php
+++ b/phpBB/phpbb/captcha/plugins/captcha_abstract.php
@@ -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
diff --git a/phpBB/phpbb/captcha/plugins/gd.php b/phpBB/phpbb/captcha/plugins/gd.php
index c1d8c83095..f6200b5b2f 100644
--- a/phpBB/phpbb/captcha/plugins/gd.php
+++ b/phpBB/phpbb/captcha/plugins/gd.php
@@ -31,14 +31,6 @@ class gd extends captcha_abstract
}
/**
- * @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
*/
function get_generator_class()
diff --git a/phpBB/phpbb/captcha/plugins/gd_wave.php b/phpBB/phpbb/captcha/plugins/gd_wave.php
index 2d38ef08dd..e1d44df778 100644
--- a/phpBB/phpbb/captcha/plugins/gd_wave.php
+++ b/phpBB/phpbb/captcha/plugins/gd_wave.php
@@ -26,14 +26,6 @@ class gd_wave extends captcha_abstract
}
/**
- * @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
*/
function get_generator_class()
diff --git a/phpBB/phpbb/captcha/plugins/qa.php b/phpBB/phpbb/captcha/plugins/qa.php
index 96cd99826d..a7ba994cc3 100644
--- a/phpBB/phpbb/captcha/plugins/qa.php
+++ b/phpBB/phpbb/captcha/plugins/qa.php
@@ -35,6 +35,11 @@ class qa
protected $table_qa_confirm;
/**
+ * @var string name of the service.
+ */
+ protected $service_name;
+
+ /**
* Constructor
*
* @param string $table_captcha_questions
@@ -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;
}
/**
diff --git a/phpBB/phpbb/captcha/plugins/recaptcha.php b/phpBB/phpbb/captcha/plugins/recaptcha.php
index efa93ab72a..928694f6ca 100644
--- a/phpBB/phpbb/captcha/plugins/recaptcha.php
+++ b/phpBB/phpbb/captcha/plugins/recaptcha.php
@@ -64,14 +64,6 @@ class recaptcha extends \phpbb\captcha\plugins\captcha_abstract
}
/**
- * @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.
*/
function get_generator_class()