Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

factory.php

Zuletzt modifiziert: 02.04.2025, 15:02 - Dateigröße: 1.71 KiB


01  <?php
02  /**
03  *
04  * This file is part of the phpBB Forum Software package.
05  *
06  * @copyright (c) phpBB Limited <https://www.phpbb.com>
07  * @license GNU General Public License, version 2 (GPL-2.0)
08  *
09  * 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  }
89