From cb7dabbffc7ea5e2acffaa6fed96ea682f93581d Mon Sep 17 00:00:00 2001 From: David King Date: Wed, 28 Mar 2012 16:13:59 -0400 Subject: [ticket/10586] Change the interface to an abstract class This allows the common phpBB objects to be automatically accessible to extensions without the author having to globalize and assign each one himself. This is better because it also gives purpose to the phpbb_extension_controller class; instead of just being the way to ensure a handle() method is present, it also does this work for us. PHPBB3-10586 --- phpBB/includes/extension/controller.php | 85 +++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 phpBB/includes/extension/controller.php (limited to 'phpBB/includes/extension/controller.php') diff --git a/phpBB/includes/extension/controller.php b/phpBB/includes/extension/controller.php new file mode 100644 index 0000000000..985aded862 --- /dev/null +++ b/phpBB/includes/extension/controller.php @@ -0,0 +1,85 @@ +request =& $request; + $this->db =& $db; + $this->user =& $user; + $this->template =& $template; + $this->config =& $config; + + $this->phpEx = $phpEx; + $this->phpbb_root_path = $phpbb_root_path; + } + + /** + * Handle the request to display a page from an extension + * + * @return null + */ + abstract public function handle(); +} -- cgit v1.2.1 From 9a8b3ff44967bed2dbc5400986e55e124e9018ab Mon Sep 17 00:00:00 2001 From: David King Date: Wed, 28 Mar 2012 16:21:17 -0400 Subject: [ticket/10586] Make the abstract class implement the original interface PHPBB3-10586 --- phpBB/includes/extension/controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/extension/controller.php') diff --git a/phpBB/includes/extension/controller.php b/phpBB/includes/extension/controller.php index 985aded862..e7d4427c87 100644 --- a/phpBB/includes/extension/controller.php +++ b/phpBB/includes/extension/controller.php @@ -20,7 +20,7 @@ if (!defined('IN_PHPBB')) * * @package extension */ -abstract class phpbb_extension_controller +abstract class phpbb_extension_controller implements phpbb_extension_controller_interface { /** * @var phpbb_request Request class object -- cgit v1.2.1 From 7071110d9aaeaf19d8dccab72a69972b302ab77d Mon Sep 17 00:00:00 2001 From: David King Date: Wed, 28 Mar 2012 16:23:40 -0400 Subject: [ticket/10586] Do not pass as reference PHPBB3-10586 --- phpBB/includes/extension/controller.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'phpBB/includes/extension/controller.php') diff --git a/phpBB/includes/extension/controller.php b/phpBB/includes/extension/controller.php index e7d4427c87..6e47948156 100644 --- a/phpBB/includes/extension/controller.php +++ b/phpBB/includes/extension/controller.php @@ -66,12 +66,11 @@ abstract class phpbb_extension_controller implements phpbb_extension_controller_ global $request, $db, $user, $template, $config; global $phpEx, $phpbb_root_path; - $this->request =& $request; - $this->db =& $db; - $this->user =& $user; - $this->template =& $template; - $this->config =& $config; - + $this->request = $request; + $this->db = $db; + $this->user = $user; + $this->template = $template; + $this->config = $config; $this->phpEx = $phpEx; $this->phpbb_root_path = $phpbb_root_path; } -- cgit v1.2.1 From 7b091f18a83f4bc31fc00ef067b55db48137ef47 Mon Sep 17 00:00:00 2001 From: David King Date: Wed, 28 Mar 2012 16:37:42 -0400 Subject: [ticket/10586] Remove handle() from abstract class, undo change in index.php PHPBB3-10586 --- phpBB/includes/extension/controller.php | 7 ------- 1 file changed, 7 deletions(-) (limited to 'phpBB/includes/extension/controller.php') diff --git a/phpBB/includes/extension/controller.php b/phpBB/includes/extension/controller.php index 6e47948156..8861ec2696 100644 --- a/phpBB/includes/extension/controller.php +++ b/phpBB/includes/extension/controller.php @@ -74,11 +74,4 @@ abstract class phpbb_extension_controller implements phpbb_extension_controller_ $this->phpEx = $phpEx; $this->phpbb_root_path = $phpbb_root_path; } - - /** - * Handle the request to display a page from an extension - * - * @return null - */ - abstract public function handle(); } -- cgit v1.2.1 From afc55b4c08ca891e11e2aba15dce1f9b5b7c481a Mon Sep 17 00:00:00 2001 From: David King Date: Wed, 28 Mar 2012 16:50:18 -0400 Subject: [ticket/10586] Added visibility indication to __construct() PHPBB3-10586 --- phpBB/includes/extension/controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/extension/controller.php') diff --git a/phpBB/includes/extension/controller.php b/phpBB/includes/extension/controller.php index 8861ec2696..c7fd439a19 100644 --- a/phpBB/includes/extension/controller.php +++ b/phpBB/includes/extension/controller.php @@ -61,7 +61,7 @@ abstract class phpbb_extension_controller implements phpbb_extension_controller_ * Constructor method that provides the common phpBB objects as inherited class * properties for automatic availability in extension controllers */ - function __construct() + public function __construct() { global $request, $db, $user, $template, $config; global $phpEx, $phpbb_root_path; -- cgit v1.2.1