[ Index ] |
PHP Cross Reference of phpBB-3.1.12-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * 4 * This file is part of the phpBB Forum Software package. 5 * 6 * @copyright (c) phpBB Limited <https://www.phpbb.com> 7 * @license GNU General Public License, version 2 (GPL-2.0) 8 * 9 * For full copyright and license information, please see 10 * the docs/CREDITS.txt file. 11 * 12 */ 13 14 namespace phpbb\captcha; 15 16 class factory 17 { 18 /** 19 * @var \Symfony\Component\DependencyInjection\ContainerInterface 20 */ 21 private $container; 22 23 /** 24 * @var \phpbb\di\service_collection 25 */ 26 private $plugins; 27 28 /** 29 * Constructor 30 * 31 * @param \Symfony\Component\DependencyInjection\ContainerInterface $container 32 * @param \phpbb\di\service_collection $plugins 33 */ 34 public function __construct(\Symfony\Component\DependencyInjection\ContainerInterface $container, \phpbb\di\service_collection $plugins) 35 { 36 $this->container = $container; 37 $this->plugins = $plugins; 38 } 39 40 /** 41 * Return a new instance of a given plugin 42 * 43 * @param $name 44 * @return object 45 */ 46 public function get_instance($name) 47 { 48 return $this->container->get($name); 49 } 50 51 /** 52 * Call the garbage collector 53 * 54 * @param string $name The name to the captcha service. 55 */ 56 function garbage_collect($name) 57 { 58 $captcha = $this->get_instance($name); 59 $captcha->garbage_collect(0); 60 } 61 62 /** 63 * Return a list of all registered CAPTCHA plugins 64 * 65 * @returns array 66 */ 67 function get_captcha_types() 68 { 69 $captchas = array( 70 'available' => array(), 71 'unavailable' => array(), 72 ); 73 74 foreach ($this->plugins as $plugin => $plugin_instance) 75 { 76 if ($plugin_instance->is_available()) 77 { 78 $captchas['available'][$plugin] = $plugin_instance->get_name(); 79 } 80 else 81 { 82 $captchas['unavailable'][$plugin] = $plugin_instance->get_name(); 83 } 84 } 85 86 return $captchas; 87 } 88 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Jan 11 00:25:41 2018 | Cross-referenced by PHPXref 0.7.1 |