Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

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

config.php

Zuletzt modifiziert: 09.10.2024, 12:51 - Dateigröße: 4.26 KiB


 001  <?php
 002  /**
 003  *
 004  * This file is part of the phpBB Forum Software package.
 005  *
 006  * @copyright (c) phpBB Limited <https://www.phpbb.com>
 007  * @license GNU General Public License, version 2 (GPL-2.0)
 008  *
 009  * For full copyright and license information, please see
 010  * the docs/CREDITS.txt file.
 011  *
 012  */
 013   
 014  namespace phpbb\config;
 015   
 016  /**
 017  * Configuration container class
 018  */
 019  class config implements \ArrayAccess, \IteratorAggregate, \Countable
 020  {
 021      /**
 022      * The configuration data
 023      * @var array(string => string)
 024      */
 025      protected $config;
 026   
 027      /**
 028      * Creates a configuration container with a default set of values
 029      *
 030      * @param array(string => string) $config The configuration data.
 031      */
 032      public function __construct(array $config)
 033      {
 034          $this->config = $config;
 035      }
 036   
 037      /**
 038      * Retrieves an ArrayIterator over the configuration values.
 039      *
 040      * @return \ArrayIterator An iterator over all config data
 041      */
 042      public function getIterator()
 043      {
 044          return new \ArrayIterator($this->config);
 045      }
 046   
 047      /**
 048      * Checks if the specified config value exists.
 049      *
 050      * @param  string $key The configuration option's name.
 051      * @return bool        Whether the configuration option exists.
 052      */
 053      public function offsetExists($key)
 054      {
 055          return isset($this->config[$key]);
 056      }
 057   
 058      /**
 059      * Retrieves a configuration value.
 060      *
 061      * @param  string $key The configuration option's name.
 062      * @return string      The configuration value
 063      */
 064      public function offsetGet($key)
 065      {
 066          return (isset($this->config[$key])) ? $this->config[$key] : '';
 067      }
 068   
 069      /**
 070      * Temporarily overwrites the value of a configuration variable.
 071      *
 072      * The configuration change will not persist. It will be lost
 073      * after the request.
 074      *
 075      * @param string $key   The configuration option's name.
 076      * @param string $value The temporary value.
 077      */
 078      public function offsetSet($key, $value)
 079      {
 080          $this->config[$key] = $value;
 081      }
 082   
 083      /**
 084      * Called when deleting a configuration value directly, triggers an error.
 085      *
 086      * @param string $key The configuration option's name.
 087      */
 088      public function offsetUnset($key)
 089      {
 090          trigger_error('Config values have to be deleted explicitly with the \phpbb\config\config::delete($key) method.', E_USER_ERROR);
 091      }
 092   
 093      /**
 094      * Retrieves the number of configuration options currently set.
 095      *
 096      * @return int Number of config options
 097      */
 098      public function count()
 099      {
 100          return count($this->config);
 101      }
 102   
 103      /**
 104      * Removes a configuration option
 105      *
 106      * @param  String $key       The configuration option's name
 107      * @param  bool   $use_cache Whether this variable should be cached or if it
 108      *                           changes too frequently to be efficiently cached
 109      * @return null
 110      */
 111      public function delete($key, $use_cache = true)
 112      {
 113          unset($this->config[$key]);
 114      }
 115   
 116      /**
 117      * Sets a configuration option's value
 118      *
 119      * @param string $key       The configuration option's name
 120      * @param string $value     New configuration value
 121      * @param bool   $use_cache Whether this variable should be cached or if it
 122      *                          changes too frequently to be efficiently cached.
 123      */
 124      public function set($key, $value, $use_cache = true)
 125      {
 126          $this->config[$key] = $value;
 127      }
 128   
 129      /**
 130      * Sets a configuration option's value only if the old_value matches the
 131      * current configuration value or the configuration value does not exist yet.
 132      *
 133      * @param  string $key       The configuration option's name
 134      * @param  string $old_value Current configuration value
 135      * @param  string $new_value New configuration value
 136      * @param  bool   $use_cache Whether this variable should be cached or if it
 137      *                           changes too frequently to be efficiently cached.
 138      * @return bool              True if the value was changed, false otherwise.
 139      */
 140      public function set_atomic($key, $old_value, $new_value, $use_cache = true)
 141      {
 142          if (!isset($this->config[$key]) || $this->config[$key] == $old_value)
 143          {
 144              $this->config[$key] = $new_value;
 145              return true;
 146          }
 147          return false;
 148      }
 149   
 150      /**
 151      * Increments an integer configuration value.
 152      *
 153      * @param string $key       The configuration option's name
 154      * @param int    $increment Amount to increment by
 155      * @param bool   $use_cache Whether this variable should be cached or if it
 156      *                          changes too frequently to be efficiently cached.
 157      */
 158      function increment($key, $increment, $use_cache = true)
 159      {
 160          if (!isset($this->config[$key]))
 161          {
 162              $this->config[$key] = 0;
 163          }
 164   
 165          $this->config[$key] += $increment;
 166      }
 167  }
 168