diff options
| author | Tristan Darricau <github@nicofuma.fr> | 2014-08-08 18:02:03 +0200 |
|---|---|---|
| committer | Tristan Darricau <github@nicofuma.fr> | 2014-08-11 01:15:49 +0200 |
| commit | 160ff7b912243dc14d871b820213ddcd20dd06f4 (patch) | |
| tree | d6d2f0e7fa38cc5944c7a0fa438c1deea2adc1c6 /phpBB/includes/captcha/captcha_factory.php | |
| parent | e0d377bca70cff7846ba920a03b717aac1d208a4 (diff) | |
| download | forums-160ff7b912243dc14d871b820213ddcd20dd06f4.tar forums-160ff7b912243dc14d871b820213ddcd20dd06f4.tar.gz forums-160ff7b912243dc14d871b820213ddcd20dd06f4.tar.bz2 forums-160ff7b912243dc14d871b820213ddcd20dd06f4.tar.xz forums-160ff7b912243dc14d871b820213ddcd20dd06f4.zip | |
[ticket/11854] Move captcha stuff to phpbb/ and use DI for plugins
PHPBB3-11854
Diffstat (limited to 'phpBB/includes/captcha/captcha_factory.php')
| -rw-r--r-- | phpBB/includes/captcha/captcha_factory.php | 100 |
1 files changed, 0 insertions, 100 deletions
diff --git a/phpBB/includes/captcha/captcha_factory.php b/phpBB/includes/captcha/captcha_factory.php deleted file mode 100644 index ebeb695282..0000000000 --- a/phpBB/includes/captcha/captcha_factory.php +++ /dev/null @@ -1,100 +0,0 @@ -<?php -/** -* -* This file is part of the phpBB Forum Software package. -* -* @copyright (c) phpBB Limited <https://www.phpbb.com> -* @license GNU General Public License, version 2 (GPL-2.0) -* -* For full copyright and license information, please see -* the docs/CREDITS.txt file. -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -/** -* A small class for 3.0.x (no autoloader in 3.0.x) -*/ -class phpbb_captcha_factory -{ - /** - * return an instance of class $name in file $name_plugin.php - */ - static public function get_instance($name) - { - global $phpbb_root_path, $phpEx; - - $name = basename($name); - if (!class_exists($name)) - { - include($phpbb_root_path . "includes/captcha/plugins/{$name}_plugin." . $phpEx); - } - $instance = call_user_func(array($name, 'get_instance')); - return $instance; - } - - /** - * Call the garbage collector - */ - function garbage_collect($name) - { - global $phpbb_root_path, $phpEx; - - $name = basename($name); - if (!class_exists($name)) - { - include($phpbb_root_path . "includes/captcha/plugins/{$name}_plugin." . $phpEx); - } - $captcha = self::get_instance($name); - $captcha->garbage_collect(0); - } - - /** - * return a list of all discovered CAPTCHA plugins - */ - function get_captcha_types() - { - global $phpbb_root_path, $phpEx, $phpbb_extension_manager; - - $captchas = array( - 'available' => array(), - 'unavailable' => array(), - ); - - $finder = $phpbb_extension_manager->get_finder(); - $captcha_plugin_classes = $finder - ->extension_directory('/captcha') - ->suffix('_plugin') - ->core_path('includes/captcha/plugins/') - ->get_classes(); - - foreach ($captcha_plugin_classes as $class) - { - // check if this class needs to be loaded in legacy mode - $old_class = preg_replace('/^phpbb_captcha_plugins_/', '', $class); - if (file_exists($phpbb_root_path . "includes/captcha/plugins/$old_class.$phpEx") && !class_exists($old_class)) - { - include($phpbb_root_path . "includes/captcha/plugins/$old_class.$phpEx"); - $class = preg_replace('/_plugin$/', '', $old_class); - } - - if (call_user_func(array($class, 'is_available'))) - { - $captchas['available'][$class] = call_user_func(array($class, 'get_name')); - } - else - { - $captchas['unavailable'][$class] = call_user_func(array($class, 'get_name')); - } - } - - return $captchas; - } -} |
